diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..0811992
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,7 @@
+Copyright (c) 2016 Dawn Griffiths and David Griffiths
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/README.md b/README.md
index f4326ef..654777a 100644
--- a/README.md
+++ b/README.md
@@ -163,6 +163,10 @@ There are some operations you want to keep on running irrespective of which app
With API level 21, Google introduced Material Design. In this chapter we’ll look at **what Material Design is**, and how to make your apps fit in with it. We’ll start by introducing you to **card views** you can reuse across your app for a *consistent look and feel*. Then we’ll introduce you to the **recycler view**, the list view’s flexible friend. Along the way you’ll see how to **create your own adapters**, and how to completely change the look of a recycler view with *just two lines of code*.
+**Apps you'll build:**
+
+[BitsAndPizzas (one more time)](https://github.com/dogriffiths/HeadFirstAndroid/tree/master/chapter14/BitsAndPizzas)
+

## Appendix 1: ART–The Android Runtime
diff --git a/chapter01/MyFirstApp/.idea/.name b/chapter01/MyFirstApp/.idea/.name
index f12019b..6c7d845 100644
--- a/chapter01/MyFirstApp/.idea/.name
+++ b/chapter01/MyFirstApp/.idea/.name
@@ -1 +1 @@
-My First App
\ No newline at end of file
+MyFirstApp
\ No newline at end of file
diff --git a/chapter01/MyFirstApp/.idea/compiler.xml b/chapter01/MyFirstApp/.idea/compiler.xml
index 217af47..96cc43e 100644
--- a/chapter01/MyFirstApp/.idea/compiler.xml
+++ b/chapter01/MyFirstApp/.idea/compiler.xml
@@ -1,7 +1,6 @@
-
@@ -12,6 +11,7 @@
+
@@ -19,5 +19,4 @@
-
-
+
\ No newline at end of file
diff --git a/chapter01/MyFirstApp/.idea/encodings.xml b/chapter01/MyFirstApp/.idea/encodings.xml
index e206d70..97626ba 100644
--- a/chapter01/MyFirstApp/.idea/encodings.xml
+++ b/chapter01/MyFirstApp/.idea/encodings.xml
@@ -1,5 +1,6 @@
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/chapter01/MyFirstApp/.idea/gradle.xml b/chapter01/MyFirstApp/.idea/gradle.xml
index 736c7b5..7ac24c7 100644
--- a/chapter01/MyFirstApp/.idea/gradle.xml
+++ b/chapter01/MyFirstApp/.idea/gradle.xml
@@ -11,8 +11,8 @@
+
-
-
+
\ No newline at end of file
diff --git a/chapter01/MyFirstApp/.idea/misc.xml b/chapter01/MyFirstApp/.idea/misc.xml
index 99b2e43..7c1371c 100644
--- a/chapter01/MyFirstApp/.idea/misc.xml
+++ b/chapter01/MyFirstApp/.idea/misc.xml
@@ -1,26 +1,43 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
- 1.8
-
-
-
-
-
-
-
-
-
-
+
+
-
-
+
\ No newline at end of file
diff --git a/chapter01/MyFirstApp/.idea/modules.xml b/chapter01/MyFirstApp/.idea/modules.xml
index e5f04f1..2cc4e74 100644
--- a/chapter01/MyFirstApp/.idea/modules.xml
+++ b/chapter01/MyFirstApp/.idea/modules.xml
@@ -6,5 +6,4 @@
-
-
+
\ No newline at end of file
diff --git a/chapter01/MyFirstApp/.idea/runConfigurations.xml b/chapter01/MyFirstApp/.idea/runConfigurations.xml
new file mode 100644
index 0000000..7f68460
--- /dev/null
+++ b/chapter01/MyFirstApp/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter01/MyFirstApp/.idea/scopes/scope_settings.xml b/chapter01/MyFirstApp/.idea/scopes/scope_settings.xml
deleted file mode 100644
index 922003b..0000000
--- a/chapter01/MyFirstApp/.idea/scopes/scope_settings.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/chapter01/MyFirstApp/.idea/vcs.xml b/chapter01/MyFirstApp/.idea/vcs.xml
deleted file mode 100644
index def6a6a..0000000
--- a/chapter01/MyFirstApp/.idea/vcs.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/chapter01/MyFirstApp/MyFirstApp.iml b/chapter01/MyFirstApp/MyFirstApp.iml
index 0bb6048..8efa52e 100644
--- a/chapter01/MyFirstApp/MyFirstApp.iml
+++ b/chapter01/MyFirstApp/MyFirstApp.iml
@@ -1,13 +1,14 @@
-
+
+
-
+
@@ -15,5 +16,4 @@
-
-
+
\ No newline at end of file
diff --git a/chapter01/MyFirstApp/app/app.iml b/chapter01/MyFirstApp/app/app.iml
index 792a38a..ce52f6b 100644
--- a/chapter01/MyFirstApp/app/app.iml
+++ b/chapter01/MyFirstApp/app/app.iml
@@ -1,5 +1,5 @@
-
+
@@ -9,12 +9,11 @@
-
-
-
-
+
+ generateDebugSources
+
@@ -23,71 +22,72 @@
-
+
-
+
+
-
+
+
-
+
-
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
+
-
-
+
\ No newline at end of file
diff --git a/chapter01/MyFirstApp/app/build.gradle b/chapter01/MyFirstApp/app/build.gradle
index 5bd814c..4fc6f68 100644
--- a/chapter01/MyFirstApp/app/build.gradle
+++ b/chapter01/MyFirstApp/app/build.gradle
@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 21
- buildToolsVersion "21.1.2"
+ buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.hfad.myfirstapp"
diff --git a/chapter01/MyFirstApp/build.gradle b/chapter01/MyFirstApp/build.gradle
index d3ff69d..ea98e44 100644
--- a/chapter01/MyFirstApp/build.gradle
+++ b/chapter01/MyFirstApp/build.gradle
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.1.0'
+ classpath 'com.android.tools.build:gradle:2.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/chapter01/MyFirstApp/gradle/wrapper/gradle-wrapper.properties b/chapter01/MyFirstApp/gradle/wrapper/gradle-wrapper.properties
index 0c71e76..949ff26 100644
--- a/chapter01/MyFirstApp/gradle/wrapper/gradle-wrapper.properties
+++ b/chapter01/MyFirstApp/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Wed Apr 10 15:27:10 PDT 2013
+#Tue May 23 19:41:23 BST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
diff --git a/chapter02/BeerAdviser/.idea/.name b/chapter02/BeerAdviser/.idea/.name
index abf2000..6044f05 100644
--- a/chapter02/BeerAdviser/.idea/.name
+++ b/chapter02/BeerAdviser/.idea/.name
@@ -1 +1 @@
-Beer Adviser
\ No newline at end of file
+BeerAdviser
\ No newline at end of file
diff --git a/chapter02/BeerAdviser/.idea/compiler.xml b/chapter02/BeerAdviser/.idea/compiler.xml
index 217af47..96cc43e 100644
--- a/chapter02/BeerAdviser/.idea/compiler.xml
+++ b/chapter02/BeerAdviser/.idea/compiler.xml
@@ -1,7 +1,6 @@
-
@@ -12,6 +11,7 @@
+
@@ -19,5 +19,4 @@
-
-
+
\ No newline at end of file
diff --git a/chapter02/BeerAdviser/.idea/encodings.xml b/chapter02/BeerAdviser/.idea/encodings.xml
index e206d70..97626ba 100644
--- a/chapter02/BeerAdviser/.idea/encodings.xml
+++ b/chapter02/BeerAdviser/.idea/encodings.xml
@@ -1,5 +1,6 @@
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/chapter02/BeerAdviser/.idea/gradle.xml b/chapter02/BeerAdviser/.idea/gradle.xml
index 736c7b5..7ac24c7 100644
--- a/chapter02/BeerAdviser/.idea/gradle.xml
+++ b/chapter02/BeerAdviser/.idea/gradle.xml
@@ -11,8 +11,8 @@
+
-
-
+
\ No newline at end of file
diff --git a/chapter02/BeerAdviser/.idea/misc.xml b/chapter02/BeerAdviser/.idea/misc.xml
index 99b2e43..1d9d626 100644
--- a/chapter02/BeerAdviser/.idea/misc.xml
+++ b/chapter02/BeerAdviser/.idea/misc.xml
@@ -1,26 +1,19 @@
-
-
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
- 1.8
-
-
-
-
-
-
-
-
-
-
+
+
-
-
+
\ No newline at end of file
diff --git a/chapter02/BeerAdviser/.idea/modules.xml b/chapter02/BeerAdviser/.idea/modules.xml
index b5061c7..1344ed7 100644
--- a/chapter02/BeerAdviser/.idea/modules.xml
+++ b/chapter02/BeerAdviser/.idea/modules.xml
@@ -6,5 +6,4 @@
-
-
+
\ No newline at end of file
diff --git a/chapter02/BeerAdviser/.idea/runConfigurations.xml b/chapter02/BeerAdviser/.idea/runConfigurations.xml
new file mode 100644
index 0000000..7f68460
--- /dev/null
+++ b/chapter02/BeerAdviser/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter02/BeerAdviser/.idea/scopes/scope_settings.xml b/chapter02/BeerAdviser/.idea/scopes/scope_settings.xml
deleted file mode 100644
index 922003b..0000000
--- a/chapter02/BeerAdviser/.idea/scopes/scope_settings.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/chapter02/BeerAdviser/.idea/vcs.xml b/chapter02/BeerAdviser/.idea/vcs.xml
deleted file mode 100644
index def6a6a..0000000
--- a/chapter02/BeerAdviser/.idea/vcs.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/chapter02/BeerAdviser/BeerAdviser.iml b/chapter02/BeerAdviser/BeerAdviser.iml
index 0bb6048..104385b 100644
--- a/chapter02/BeerAdviser/BeerAdviser.iml
+++ b/chapter02/BeerAdviser/BeerAdviser.iml
@@ -1,13 +1,14 @@
-
+
+
-
+
@@ -15,5 +16,4 @@
-
-
+
\ No newline at end of file
diff --git a/chapter02/BeerAdviser/app/app.iml b/chapter02/BeerAdviser/app/app.iml
index 7775b0e..023aae6 100644
--- a/chapter02/BeerAdviser/app/app.iml
+++ b/chapter02/BeerAdviser/app/app.iml
@@ -1,5 +1,5 @@
-
+
@@ -9,12 +9,11 @@
-
-
-
-
+
+ generateDebugSources
+
@@ -23,71 +22,86 @@
-
+
-
+
+
-
+
+
-
+
-
+
+
+
+
+
+
+
+
-
+
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
-
-
+
+
+
-
+
-
-
+
\ No newline at end of file
diff --git a/chapter02/BeerAdviser/app/build.gradle b/chapter02/BeerAdviser/app/build.gradle
index 1be23f5..fd7764e 100644
--- a/chapter02/BeerAdviser/app/build.gradle
+++ b/chapter02/BeerAdviser/app/build.gradle
@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 21
- buildToolsVersion "21.1.2"
+ buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.hfad.beeradviser"
diff --git a/chapter02/BeerAdviser/build.gradle b/chapter02/BeerAdviser/build.gradle
index d3ff69d..ea98e44 100644
--- a/chapter02/BeerAdviser/build.gradle
+++ b/chapter02/BeerAdviser/build.gradle
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.1.0'
+ classpath 'com.android.tools.build:gradle:2.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/chapter02/BeerAdviser/gradle/wrapper/gradle-wrapper.properties b/chapter02/BeerAdviser/gradle/wrapper/gradle-wrapper.properties
index 0c71e76..dd53845 100644
--- a/chapter02/BeerAdviser/gradle/wrapper/gradle-wrapper.properties
+++ b/chapter02/BeerAdviser/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Wed Apr 10 15:27:10 PDT 2013
+#Tue May 23 19:42:25 BST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
diff --git a/chapter03/Messenger/.idea/compiler.xml b/chapter03/Messenger/.idea/compiler.xml
index 217af47..96cc43e 100644
--- a/chapter03/Messenger/.idea/compiler.xml
+++ b/chapter03/Messenger/.idea/compiler.xml
@@ -1,7 +1,6 @@
-
@@ -12,6 +11,7 @@
+
@@ -19,5 +19,4 @@
-
-
+
\ No newline at end of file
diff --git a/chapter03/Messenger/.idea/encodings.xml b/chapter03/Messenger/.idea/encodings.xml
index e206d70..97626ba 100644
--- a/chapter03/Messenger/.idea/encodings.xml
+++ b/chapter03/Messenger/.idea/encodings.xml
@@ -1,5 +1,6 @@
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/chapter03/Messenger/.idea/gradle.xml b/chapter03/Messenger/.idea/gradle.xml
index 736c7b5..7ac24c7 100644
--- a/chapter03/Messenger/.idea/gradle.xml
+++ b/chapter03/Messenger/.idea/gradle.xml
@@ -11,8 +11,8 @@
+
-
-
+
\ No newline at end of file
diff --git a/chapter03/Messenger/.idea/misc.xml b/chapter03/Messenger/.idea/misc.xml
index 99b2e43..1d9d626 100644
--- a/chapter03/Messenger/.idea/misc.xml
+++ b/chapter03/Messenger/.idea/misc.xml
@@ -1,26 +1,19 @@
-
-
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
- 1.8
-
-
-
-
-
-
-
-
-
-
+
+
-
-
+
\ No newline at end of file
diff --git a/chapter03/Messenger/.idea/modules.xml b/chapter03/Messenger/.idea/modules.xml
index ab9f4e6..0b1dd29 100644
--- a/chapter03/Messenger/.idea/modules.xml
+++ b/chapter03/Messenger/.idea/modules.xml
@@ -6,5 +6,4 @@
-
-
+
\ No newline at end of file
diff --git a/chapter03/Messenger/.idea/runConfigurations.xml b/chapter03/Messenger/.idea/runConfigurations.xml
new file mode 100644
index 0000000..7f68460
--- /dev/null
+++ b/chapter03/Messenger/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter03/Messenger/.idea/scopes/scope_settings.xml b/chapter03/Messenger/.idea/scopes/scope_settings.xml
deleted file mode 100644
index 922003b..0000000
--- a/chapter03/Messenger/.idea/scopes/scope_settings.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/chapter03/Messenger/.idea/vcs.xml b/chapter03/Messenger/.idea/vcs.xml
deleted file mode 100644
index def6a6a..0000000
--- a/chapter03/Messenger/.idea/vcs.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/chapter03/Messenger/Messenger.iml b/chapter03/Messenger/Messenger.iml
index 0bb6048..e848486 100644
--- a/chapter03/Messenger/Messenger.iml
+++ b/chapter03/Messenger/Messenger.iml
@@ -1,13 +1,14 @@
-
+
+
-
+
@@ -15,5 +16,4 @@
-
-
+
\ No newline at end of file
diff --git a/chapter03/Messenger/app/app.iml b/chapter03/Messenger/app/app.iml
index 525880b..c20d6ac 100644
--- a/chapter03/Messenger/app/app.iml
+++ b/chapter03/Messenger/app/app.iml
@@ -1,5 +1,5 @@
-
+
@@ -9,12 +9,11 @@
-
-
-
-
+
+ generateDebugSources
+
@@ -23,71 +22,86 @@
-
+
-
+
+
-
+
+
-
+
-
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
-
+
+
-
-
-
-
-
-
-
+
+
+
+
+
-
-
+
+
+
-
+
-
-
+
\ No newline at end of file
diff --git a/chapter03/Messenger/app/build.gradle b/chapter03/Messenger/app/build.gradle
index fc7ee59..91dab30 100644
--- a/chapter03/Messenger/app/build.gradle
+++ b/chapter03/Messenger/app/build.gradle
@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 21
- buildToolsVersion "21.1.2"
+ buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.hfad.messenger"
diff --git a/chapter03/Messenger/build.gradle b/chapter03/Messenger/build.gradle
index d3ff69d..ea98e44 100644
--- a/chapter03/Messenger/build.gradle
+++ b/chapter03/Messenger/build.gradle
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.1.0'
+ classpath 'com.android.tools.build:gradle:2.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/chapter03/Messenger/gradle/wrapper/gradle-wrapper.properties b/chapter03/Messenger/gradle/wrapper/gradle-wrapper.properties
index 0c71e76..ce236ef 100644
--- a/chapter03/Messenger/gradle/wrapper/gradle-wrapper.properties
+++ b/chapter03/Messenger/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Wed Apr 10 15:27:10 PDT 2013
+#Tue May 23 19:43:03 BST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
diff --git a/chapter04/Stopwatch/.idea/compiler.xml b/chapter04/Stopwatch/.idea/compiler.xml
index 217af47..96cc43e 100644
--- a/chapter04/Stopwatch/.idea/compiler.xml
+++ b/chapter04/Stopwatch/.idea/compiler.xml
@@ -1,7 +1,6 @@
-
@@ -12,6 +11,7 @@
+
@@ -19,5 +19,4 @@
-
-
+
\ No newline at end of file
diff --git a/chapter04/Stopwatch/.idea/encodings.xml b/chapter04/Stopwatch/.idea/encodings.xml
index e206d70..97626ba 100644
--- a/chapter04/Stopwatch/.idea/encodings.xml
+++ b/chapter04/Stopwatch/.idea/encodings.xml
@@ -1,5 +1,6 @@
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/chapter04/Stopwatch/.idea/gradle.xml b/chapter04/Stopwatch/.idea/gradle.xml
index 8d2df47..7ac24c7 100644
--- a/chapter04/Stopwatch/.idea/gradle.xml
+++ b/chapter04/Stopwatch/.idea/gradle.xml
@@ -5,13 +5,13 @@
-
+
diff --git a/chapter04/Stopwatch/.idea/misc.xml b/chapter04/Stopwatch/.idea/misc.xml
index 99b2e43..7c1371c 100644
--- a/chapter04/Stopwatch/.idea/misc.xml
+++ b/chapter04/Stopwatch/.idea/misc.xml
@@ -1,26 +1,43 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
- 1.8
-
-
-
-
-
-
-
-
-
-
+
+
-
-
+
\ No newline at end of file
diff --git a/chapter04/Stopwatch/.idea/modules.xml b/chapter04/Stopwatch/.idea/modules.xml
index f44c040..7d09189 100644
--- a/chapter04/Stopwatch/.idea/modules.xml
+++ b/chapter04/Stopwatch/.idea/modules.xml
@@ -6,5 +6,4 @@
-
-
+
\ No newline at end of file
diff --git a/chapter04/Stopwatch/.idea/runConfigurations.xml b/chapter04/Stopwatch/.idea/runConfigurations.xml
new file mode 100644
index 0000000..7f68460
--- /dev/null
+++ b/chapter04/Stopwatch/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter04/Stopwatch/.idea/scopes/scope_settings.xml b/chapter04/Stopwatch/.idea/scopes/scope_settings.xml
deleted file mode 100644
index 922003b..0000000
--- a/chapter04/Stopwatch/.idea/scopes/scope_settings.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/chapter04/Stopwatch/.idea/vcs.xml b/chapter04/Stopwatch/.idea/vcs.xml
deleted file mode 100644
index def6a6a..0000000
--- a/chapter04/Stopwatch/.idea/vcs.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/chapter04/Stopwatch/Stopwatch.iml b/chapter04/Stopwatch/Stopwatch.iml
index 87fc42d..db8e8f8 100644
--- a/chapter04/Stopwatch/Stopwatch.iml
+++ b/chapter04/Stopwatch/Stopwatch.iml
@@ -8,7 +8,7 @@
-
+
diff --git a/chapter04/Stopwatch/app/app.iml b/chapter04/Stopwatch/app/app.iml
index 5713356..e5af568 100644
--- a/chapter04/Stopwatch/app/app.iml
+++ b/chapter04/Stopwatch/app/app.iml
@@ -9,13 +9,11 @@
-
-
-
-
-
+
+ generateDebugSources
+
@@ -24,70 +22,86 @@
-
+
-
+
+
-
+
+
-
+
-
+
+
+
+
+
+
+
+
-
+
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
-
-
+
+
+
-
+
\ No newline at end of file
diff --git a/chapter04/Stopwatch/app/build.gradle b/chapter04/Stopwatch/app/build.gradle
index 0d0bd5b..1382521 100644
--- a/chapter04/Stopwatch/app/build.gradle
+++ b/chapter04/Stopwatch/app/build.gradle
@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 21
- buildToolsVersion "21.1.2"
+ buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.hfad.stopwatch"
diff --git a/chapter04/Stopwatch/build.gradle b/chapter04/Stopwatch/build.gradle
index d3ff69d..ea98e44 100644
--- a/chapter04/Stopwatch/build.gradle
+++ b/chapter04/Stopwatch/build.gradle
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.1.0'
+ classpath 'com.android.tools.build:gradle:2.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/chapter04/Stopwatch/gradle/wrapper/gradle-wrapper.properties b/chapter04/Stopwatch/gradle/wrapper/gradle-wrapper.properties
index 0c71e76..d30d0a3 100644
--- a/chapter04/Stopwatch/gradle/wrapper/gradle-wrapper.properties
+++ b/chapter04/Stopwatch/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Wed Apr 10 15:27:10 PDT 2013
+#Tue May 23 19:43:35 BST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
diff --git a/chapter06/Starbuzz/.idea/compiler.xml b/chapter06/Starbuzz/.idea/compiler.xml
index 9a8b7e5..96cc43e 100644
--- a/chapter06/Starbuzz/.idea/compiler.xml
+++ b/chapter06/Starbuzz/.idea/compiler.xml
@@ -1,7 +1,6 @@
-
@@ -12,6 +11,7 @@
+
diff --git a/chapter06/Starbuzz/.idea/vcs.xml b/chapter06/Starbuzz/.idea/encodings.xml
similarity index 52%
rename from chapter06/Starbuzz/.idea/vcs.xml
rename to chapter06/Starbuzz/.idea/encodings.xml
index 6564d52..97626ba 100644
--- a/chapter06/Starbuzz/.idea/vcs.xml
+++ b/chapter06/Starbuzz/.idea/encodings.xml
@@ -1,6 +1,6 @@
-
-
+
+
\ No newline at end of file
diff --git a/chapter06/Starbuzz/.idea/gradle.xml b/chapter06/Starbuzz/.idea/gradle.xml
index 8d2df47..7ac24c7 100644
--- a/chapter06/Starbuzz/.idea/gradle.xml
+++ b/chapter06/Starbuzz/.idea/gradle.xml
@@ -5,13 +5,13 @@
-
+
diff --git a/chapter06/Starbuzz/.idea/misc.xml b/chapter06/Starbuzz/.idea/misc.xml
index aaaf922..1d9d626 100644
--- a/chapter06/Starbuzz/.idea/misc.xml
+++ b/chapter06/Starbuzz/.idea/misc.xml
@@ -1,8 +1,5 @@
-
-
-
@@ -13,26 +10,10 @@
-
+
-
-
-
-
- 1.8
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/chapter06/Starbuzz/.idea/runConfigurations.xml b/chapter06/Starbuzz/.idea/runConfigurations.xml
new file mode 100644
index 0000000..7f68460
--- /dev/null
+++ b/chapter06/Starbuzz/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter06/Starbuzz/Starbuzz.iml b/chapter06/Starbuzz/Starbuzz.iml
index 9b1e96b..8517df0 100644
--- a/chapter06/Starbuzz/Starbuzz.iml
+++ b/chapter06/Starbuzz/Starbuzz.iml
@@ -8,7 +8,7 @@
-
+
diff --git a/chapter06/Starbuzz/app/app.iml b/chapter06/Starbuzz/app/app.iml
index 6ca15de..007ee37 100644
--- a/chapter06/Starbuzz/app/app.iml
+++ b/chapter06/Starbuzz/app/app.iml
@@ -9,13 +9,11 @@
-
-
-
-
-
+
+ generateDebugSources
+
@@ -24,70 +22,85 @@
-
+
-
+
+
-
+
+
-
+
-
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
-
+
+
-
-
-
-
-
-
-
+
+
+
+
+
-
-
+
+
-
+
\ No newline at end of file
diff --git a/chapter06/Starbuzz/app/build.gradle b/chapter06/Starbuzz/app/build.gradle
index ee06e72..c8544ff 100644
--- a/chapter06/Starbuzz/app/build.gradle
+++ b/chapter06/Starbuzz/app/build.gradle
@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 21
- buildToolsVersion "21.1.2"
+ buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.hfad.starbuzz"
diff --git a/chapter06/Starbuzz/build.gradle b/chapter06/Starbuzz/build.gradle
index d3ff69d..ea98e44 100644
--- a/chapter06/Starbuzz/build.gradle
+++ b/chapter06/Starbuzz/build.gradle
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.1.0'
+ classpath 'com.android.tools.build:gradle:2.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/chapter06/Starbuzz/gradle/wrapper/gradle-wrapper.properties b/chapter06/Starbuzz/gradle/wrapper/gradle-wrapper.properties
index 0c71e76..63f7575 100644
--- a/chapter06/Starbuzz/gradle/wrapper/gradle-wrapper.properties
+++ b/chapter06/Starbuzz/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Wed Apr 10 15:27:10 PDT 2013
+#Tue May 23 19:44:39 BST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
diff --git a/chapter07/Workout/.idea/compiler.xml b/chapter07/Workout/.idea/compiler.xml
index 9a8b7e5..96cc43e 100644
--- a/chapter07/Workout/.idea/compiler.xml
+++ b/chapter07/Workout/.idea/compiler.xml
@@ -1,7 +1,6 @@
-
@@ -12,6 +11,7 @@
+
diff --git a/chapter07/Workout/.idea/vcs.xml b/chapter07/Workout/.idea/encodings.xml
similarity index 52%
rename from chapter07/Workout/.idea/vcs.xml
rename to chapter07/Workout/.idea/encodings.xml
index 6564d52..97626ba 100644
--- a/chapter07/Workout/.idea/vcs.xml
+++ b/chapter07/Workout/.idea/encodings.xml
@@ -1,6 +1,6 @@
-
-
+
+
\ No newline at end of file
diff --git a/chapter07/Workout/.idea/gradle.xml b/chapter07/Workout/.idea/gradle.xml
index 8d2df47..7ac24c7 100644
--- a/chapter07/Workout/.idea/gradle.xml
+++ b/chapter07/Workout/.idea/gradle.xml
@@ -5,13 +5,13 @@
-
+
diff --git a/chapter07/Workout/.idea/misc.xml b/chapter07/Workout/.idea/misc.xml
index aaaf922..1d9d626 100644
--- a/chapter07/Workout/.idea/misc.xml
+++ b/chapter07/Workout/.idea/misc.xml
@@ -1,8 +1,5 @@
-
-
-
@@ -13,26 +10,10 @@
-
+
-
-
-
-
- 1.8
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/chapter07/Workout/.idea/modules.xml b/chapter07/Workout/.idea/modules.xml
index 6d963b6..d5e9f31 100644
--- a/chapter07/Workout/.idea/modules.xml
+++ b/chapter07/Workout/.idea/modules.xml
@@ -1,6 +1,9 @@
-
+
+
+
+
\ No newline at end of file
diff --git a/chapter07/Workout/.idea/runConfigurations.xml b/chapter07/Workout/.idea/runConfigurations.xml
new file mode 100644
index 0000000..7f68460
--- /dev/null
+++ b/chapter07/Workout/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter07/Workout/Workout.iml b/chapter07/Workout/Workout.iml
index d19b748..d40d26b 100644
--- a/chapter07/Workout/Workout.iml
+++ b/chapter07/Workout/Workout.iml
@@ -8,7 +8,7 @@
-
+
diff --git a/chapter07/Workout/app/app.iml b/chapter07/Workout/app/app.iml
index de5aa4c..ce41a15 100644
--- a/chapter07/Workout/app/app.iml
+++ b/chapter07/Workout/app/app.iml
@@ -9,13 +9,11 @@
-
-
-
-
-
+
+ generateDebugSources
+
@@ -24,70 +22,86 @@
-
+
-
+
+
-
+
+
-
+
-
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
-
+
+
-
-
-
-
-
-
-
+
+
+
+
+
-
-
+
+
+
-
+
\ No newline at end of file
diff --git a/chapter07/Workout/app/build.gradle b/chapter07/Workout/app/build.gradle
index d51f3f5..b917892 100644
--- a/chapter07/Workout/app/build.gradle
+++ b/chapter07/Workout/app/build.gradle
@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 21
- buildToolsVersion "21.1.2"
+ buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.hfad.workout"
diff --git a/chapter07/Workout/app/src/main/java/com/hfad/workout/WorkoutDetailFragment.java b/chapter07/Workout/app/src/main/java/com/hfad/workout/WorkoutDetailFragment.java
index ee8a9f4..68ac320 100644
--- a/chapter07/Workout/app/src/main/java/com/hfad/workout/WorkoutDetailFragment.java
+++ b/chapter07/Workout/app/src/main/java/com/hfad/workout/WorkoutDetailFragment.java
@@ -11,11 +11,16 @@ public class WorkoutDetailFragment extends Fragment {
private long workoutId;
@Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
+ public void onCreate(Bundle savedInstanceState){
+ super.onCreate(savedInstanceState);
if (savedInstanceState != null) {
workoutId = savedInstanceState.getLong("workoutId");
}
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_workout_detail, container, false);
}
diff --git a/chapter07/Workout/build.gradle b/chapter07/Workout/build.gradle
index d3ff69d..ea98e44 100644
--- a/chapter07/Workout/build.gradle
+++ b/chapter07/Workout/build.gradle
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.1.0'
+ classpath 'com.android.tools.build:gradle:2.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/chapter07/Workout/gradle/wrapper/gradle-wrapper.properties b/chapter07/Workout/gradle/wrapper/gradle-wrapper.properties
index 0c71e76..0353f34 100644
--- a/chapter07/Workout/gradle/wrapper/gradle-wrapper.properties
+++ b/chapter07/Workout/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Wed Apr 10 15:27:10 PDT 2013
+#Tue May 23 19:45:12 BST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
diff --git a/chapter08/Workout/.idea/compiler.xml b/chapter08/Workout/.idea/compiler.xml
index 9a8b7e5..96cc43e 100644
--- a/chapter08/Workout/.idea/compiler.xml
+++ b/chapter08/Workout/.idea/compiler.xml
@@ -1,7 +1,6 @@
-
@@ -12,6 +11,7 @@
+
diff --git a/chapter08/Workout/.idea/vcs.xml b/chapter08/Workout/.idea/encodings.xml
similarity index 52%
rename from chapter08/Workout/.idea/vcs.xml
rename to chapter08/Workout/.idea/encodings.xml
index 6564d52..97626ba 100644
--- a/chapter08/Workout/.idea/vcs.xml
+++ b/chapter08/Workout/.idea/encodings.xml
@@ -1,6 +1,6 @@
-
-
+
+
\ No newline at end of file
diff --git a/chapter08/Workout/.idea/gradle.xml b/chapter08/Workout/.idea/gradle.xml
index 8d2df47..7ac24c7 100644
--- a/chapter08/Workout/.idea/gradle.xml
+++ b/chapter08/Workout/.idea/gradle.xml
@@ -5,13 +5,13 @@
-
+
diff --git a/chapter08/Workout/.idea/misc.xml b/chapter08/Workout/.idea/misc.xml
index aaaf922..7c1371c 100644
--- a/chapter08/Workout/.idea/misc.xml
+++ b/chapter08/Workout/.idea/misc.xml
@@ -1,7 +1,28 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -13,26 +34,10 @@
-
+
-
-
-
-
- 1.8
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/chapter08/Workout/.idea/runConfigurations.xml b/chapter08/Workout/.idea/runConfigurations.xml
new file mode 100644
index 0000000..7f68460
--- /dev/null
+++ b/chapter08/Workout/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter08/Workout/Workout.iml b/chapter08/Workout/Workout.iml
index d19b748..d40d26b 100644
--- a/chapter08/Workout/Workout.iml
+++ b/chapter08/Workout/Workout.iml
@@ -8,7 +8,7 @@
-
+
diff --git a/chapter08/Workout/app/app.iml b/chapter08/Workout/app/app.iml
index de5aa4c..10f40a0 100644
--- a/chapter08/Workout/app/app.iml
+++ b/chapter08/Workout/app/app.iml
@@ -9,13 +9,11 @@
-
-
-
-
-
+
+ generateDebugSources
+
@@ -24,70 +22,86 @@
-
+
-
+
+
-
+
+
-
+
-
+
+
+
+
+
+
+
+
-
+
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
-
-
+
+
+
-
+
\ No newline at end of file
diff --git a/chapter08/Workout/app/build.gradle b/chapter08/Workout/app/build.gradle
index d51f3f5..b917892 100644
--- a/chapter08/Workout/app/build.gradle
+++ b/chapter08/Workout/app/build.gradle
@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 21
- buildToolsVersion "21.1.2"
+ buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.hfad.workout"
diff --git a/chapter08/Workout/app/src/main/java/com/hfad/workout/WorkoutDetailFragment.java b/chapter08/Workout/app/src/main/java/com/hfad/workout/WorkoutDetailFragment.java
index d060c67..0e850f3 100644
--- a/chapter08/Workout/app/src/main/java/com/hfad/workout/WorkoutDetailFragment.java
+++ b/chapter08/Workout/app/src/main/java/com/hfad/workout/WorkoutDetailFragment.java
@@ -12,8 +12,8 @@ public class WorkoutDetailFragment extends Fragment {
private long workoutId;
@Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
+ public void onCreate(Bundle savedInstanceState){
+ super.onCreate(savedInstanceState);
if (savedInstanceState != null) {
workoutId = savedInstanceState.getLong("workoutId");
} else {
@@ -24,6 +24,11 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
ft.commit();
}
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_workout_detail, container, false);
}
diff --git a/chapter08/Workout/build.gradle b/chapter08/Workout/build.gradle
index d3ff69d..ea98e44 100644
--- a/chapter08/Workout/build.gradle
+++ b/chapter08/Workout/build.gradle
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.1.0'
+ classpath 'com.android.tools.build:gradle:2.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/chapter08/Workout/gradle/wrapper/gradle-wrapper.properties b/chapter08/Workout/gradle/wrapper/gradle-wrapper.properties
index 0c71e76..17a90ea 100644
--- a/chapter08/Workout/gradle/wrapper/gradle-wrapper.properties
+++ b/chapter08/Workout/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Wed Apr 10 15:27:10 PDT 2013
+#Tue May 23 19:46:05 BST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
diff --git a/chapter09/BitsAndPizzas/.idea/.name b/chapter09/BitsAndPizzas/.idea/.name
index 69665e9..e40a72c 100644
--- a/chapter09/BitsAndPizzas/.idea/.name
+++ b/chapter09/BitsAndPizzas/.idea/.name
@@ -1 +1 @@
-Bits And Pizzas
\ No newline at end of file
+BitsAndPizzas
\ No newline at end of file
diff --git a/chapter09/BitsAndPizzas/.idea/compiler.xml b/chapter09/BitsAndPizzas/.idea/compiler.xml
index 9a8b7e5..96cc43e 100644
--- a/chapter09/BitsAndPizzas/.idea/compiler.xml
+++ b/chapter09/BitsAndPizzas/.idea/compiler.xml
@@ -1,7 +1,6 @@
-
@@ -12,6 +11,7 @@
+
diff --git a/chapter09/BitsAndPizzas/.idea/vcs.xml b/chapter09/BitsAndPizzas/.idea/encodings.xml
similarity index 52%
rename from chapter09/BitsAndPizzas/.idea/vcs.xml
rename to chapter09/BitsAndPizzas/.idea/encodings.xml
index 6564d52..97626ba 100644
--- a/chapter09/BitsAndPizzas/.idea/vcs.xml
+++ b/chapter09/BitsAndPizzas/.idea/encodings.xml
@@ -1,6 +1,6 @@
-
-
+
+
\ No newline at end of file
diff --git a/chapter09/BitsAndPizzas/.idea/gradle.xml b/chapter09/BitsAndPizzas/.idea/gradle.xml
index 8d2df47..7ac24c7 100644
--- a/chapter09/BitsAndPizzas/.idea/gradle.xml
+++ b/chapter09/BitsAndPizzas/.idea/gradle.xml
@@ -5,13 +5,13 @@
-
+
diff --git a/chapter09/BitsAndPizzas/.idea/misc.xml b/chapter09/BitsAndPizzas/.idea/misc.xml
index 0666132..1d9d626 100644
--- a/chapter09/BitsAndPizzas/.idea/misc.xml
+++ b/chapter09/BitsAndPizzas/.idea/misc.xml
@@ -10,26 +10,10 @@
-
+
-
-
-
-
- 1.8
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/chapter09/BitsAndPizzas/.idea/runConfigurations.xml b/chapter09/BitsAndPizzas/.idea/runConfigurations.xml
new file mode 100644
index 0000000..7f68460
--- /dev/null
+++ b/chapter09/BitsAndPizzas/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter09/BitsAndPizzas/BitsAndPizzas.iml b/chapter09/BitsAndPizzas/BitsAndPizzas.iml
index 592d909..e28da36 100644
--- a/chapter09/BitsAndPizzas/BitsAndPizzas.iml
+++ b/chapter09/BitsAndPizzas/BitsAndPizzas.iml
@@ -8,7 +8,7 @@
-
+
diff --git a/chapter09/BitsAndPizzas/app/app.iml b/chapter09/BitsAndPizzas/app/app.iml
index b322c19..313344a 100644
--- a/chapter09/BitsAndPizzas/app/app.iml
+++ b/chapter09/BitsAndPizzas/app/app.iml
@@ -9,13 +9,11 @@
-
-
-
-
-
+
+ generateDebugSources
+
@@ -24,70 +22,86 @@
-
+
-
+
+
-
+
+
-
+
-
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
-
+
+
-
-
-
-
-
-
-
+
+
+
+
+
-
-
+
+
+
-
+
\ No newline at end of file
diff --git a/chapter09/BitsAndPizzas/app/build.gradle b/chapter09/BitsAndPizzas/app/build.gradle
index 7a82e12..651f224 100644
--- a/chapter09/BitsAndPizzas/app/build.gradle
+++ b/chapter09/BitsAndPizzas/app/build.gradle
@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 21
- buildToolsVersion "21.1.2"
+ buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.hfad.bitsandpizzas"
diff --git a/chapter09/BitsAndPizzas/app/src/main/res/menu/menu_main.xml b/chapter09/BitsAndPizzas/app/src/main/res/menu/menu_main.xml
index 2870660..aee6964 100644
--- a/chapter09/BitsAndPizzas/app/src/main/res/menu/menu_main.xml
+++ b/chapter09/BitsAndPizzas/app/src/main/res/menu/menu_main.xml
@@ -7,16 +7,16 @@
android:title="@string/action_create_order"
android:icon="@drawable/ic_action_new_event"
android:orderInCategory="1"
- app:showAsAction="ifRoom" />
+ android:showAsAction="ifRoom" />
+ android:showAsAction="never" />
diff --git a/chapter09/BitsAndPizzas/build.gradle b/chapter09/BitsAndPizzas/build.gradle
index d3ff69d..ea98e44 100644
--- a/chapter09/BitsAndPizzas/build.gradle
+++ b/chapter09/BitsAndPizzas/build.gradle
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.1.0'
+ classpath 'com.android.tools.build:gradle:2.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/chapter09/BitsAndPizzas/gradle/wrapper/gradle-wrapper.properties b/chapter09/BitsAndPizzas/gradle/wrapper/gradle-wrapper.properties
index 0c71e76..6e5d2a7 100644
--- a/chapter09/BitsAndPizzas/gradle/wrapper/gradle-wrapper.properties
+++ b/chapter09/BitsAndPizzas/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Wed Apr 10 15:27:10 PDT 2013
+#Tue May 23 19:46:37 BST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
diff --git a/chapter10/BitsAndPizzas/.idea/compiler.xml b/chapter10/BitsAndPizzas/.idea/compiler.xml
index 9a8b7e5..96cc43e 100644
--- a/chapter10/BitsAndPizzas/.idea/compiler.xml
+++ b/chapter10/BitsAndPizzas/.idea/compiler.xml
@@ -1,7 +1,6 @@
-
@@ -12,6 +11,7 @@
+
diff --git a/chapter10/BitsAndPizzas/.idea/encodings.xml b/chapter10/BitsAndPizzas/.idea/encodings.xml
new file mode 100644
index 0000000..97626ba
--- /dev/null
+++ b/chapter10/BitsAndPizzas/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter10/BitsAndPizzas/.idea/gradle.xml b/chapter10/BitsAndPizzas/.idea/gradle.xml
index 8d2df47..7ac24c7 100644
--- a/chapter10/BitsAndPizzas/.idea/gradle.xml
+++ b/chapter10/BitsAndPizzas/.idea/gradle.xml
@@ -5,13 +5,13 @@
-
+
diff --git a/chapter10/BitsAndPizzas/.idea/misc.xml b/chapter10/BitsAndPizzas/.idea/misc.xml
index aaaf922..5d19981 100644
--- a/chapter10/BitsAndPizzas/.idea/misc.xml
+++ b/chapter10/BitsAndPizzas/.idea/misc.xml
@@ -3,6 +3,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -13,26 +37,10 @@
-
+
-
-
-
-
- 1.8
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/chapter10/BitsAndPizzas/.idea/runConfigurations.xml b/chapter10/BitsAndPizzas/.idea/runConfigurations.xml
new file mode 100644
index 0000000..7f68460
--- /dev/null
+++ b/chapter10/BitsAndPizzas/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter10/BitsAndPizzas/.idea/vcs.xml b/chapter10/BitsAndPizzas/.idea/vcs.xml
deleted file mode 100644
index 6564d52..0000000
--- a/chapter10/BitsAndPizzas/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/chapter10/BitsAndPizzas/BitsAndPizzas.iml b/chapter10/BitsAndPizzas/BitsAndPizzas.iml
index 592d909..e28da36 100644
--- a/chapter10/BitsAndPizzas/BitsAndPizzas.iml
+++ b/chapter10/BitsAndPizzas/BitsAndPizzas.iml
@@ -8,7 +8,7 @@
-
+
diff --git a/chapter10/BitsAndPizzas/app/app.iml b/chapter10/BitsAndPizzas/app/app.iml
index b322c19..8841a47 100644
--- a/chapter10/BitsAndPizzas/app/app.iml
+++ b/chapter10/BitsAndPizzas/app/app.iml
@@ -9,13 +9,11 @@
-
-
-
-
-
+
+ generateDebugSources
+
@@ -24,70 +22,88 @@
-
+
-
+
+
-
+
+
-
+
-
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
-
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
+
+
-
+
\ No newline at end of file
diff --git a/chapter10/BitsAndPizzas/app/build.gradle b/chapter10/BitsAndPizzas/app/build.gradle
index 7a82e12..651f224 100644
--- a/chapter10/BitsAndPizzas/app/build.gradle
+++ b/chapter10/BitsAndPizzas/app/build.gradle
@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 21
- buildToolsVersion "21.1.2"
+ buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.hfad.bitsandpizzas"
diff --git a/chapter10/BitsAndPizzas/app/src/main/java/com/hfad/bitsandpizzas/MainActivity.java b/chapter10/BitsAndPizzas/app/src/main/java/com/hfad/bitsandpizzas/MainActivity.java
index 93ae17a..f2a74eb 100644
--- a/chapter10/BitsAndPizzas/app/src/main/java/com/hfad/bitsandpizzas/MainActivity.java
+++ b/chapter10/BitsAndPizzas/app/src/main/java/com/hfad/bitsandpizzas/MainActivity.java
@@ -23,7 +23,7 @@ private class DrawerItemClickListener implements ListView.OnItemClickListener {
public void onItemClick(AdapterView> parent, View view, int position, long id) {
selectItem(position);
}
- };
+ }
private ShareActionProvider shareActionProvider;
private String[] titles;
diff --git a/chapter10/BitsAndPizzas/app/src/main/res/menu/menu_main.xml b/chapter10/BitsAndPizzas/app/src/main/res/menu/menu_main.xml
index 2870660..aee6964 100644
--- a/chapter10/BitsAndPizzas/app/src/main/res/menu/menu_main.xml
+++ b/chapter10/BitsAndPizzas/app/src/main/res/menu/menu_main.xml
@@ -7,16 +7,16 @@
android:title="@string/action_create_order"
android:icon="@drawable/ic_action_new_event"
android:orderInCategory="1"
- app:showAsAction="ifRoom" />
+ android:showAsAction="ifRoom" />
+ android:showAsAction="never" />
diff --git a/chapter10/BitsAndPizzas/build.gradle b/chapter10/BitsAndPizzas/build.gradle
index d3ff69d..ea98e44 100644
--- a/chapter10/BitsAndPizzas/build.gradle
+++ b/chapter10/BitsAndPizzas/build.gradle
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.1.0'
+ classpath 'com.android.tools.build:gradle:2.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/chapter10/BitsAndPizzas/gradle/wrapper/gradle-wrapper.properties b/chapter10/BitsAndPizzas/gradle/wrapper/gradle-wrapper.properties
index 0c71e76..6373157 100644
--- a/chapter10/BitsAndPizzas/gradle/wrapper/gradle-wrapper.properties
+++ b/chapter10/BitsAndPizzas/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Wed Apr 10 15:27:10 PDT 2013
+#Tue May 23 19:47:35 BST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
diff --git a/chapter11/Starbuzz/.idea/compiler.xml b/chapter11/Starbuzz/.idea/compiler.xml
index 9a8b7e5..96cc43e 100644
--- a/chapter11/Starbuzz/.idea/compiler.xml
+++ b/chapter11/Starbuzz/.idea/compiler.xml
@@ -1,7 +1,6 @@
-
@@ -12,6 +11,7 @@
+
diff --git a/chapter11/Starbuzz/.idea/encodings.xml b/chapter11/Starbuzz/.idea/encodings.xml
new file mode 100644
index 0000000..97626ba
--- /dev/null
+++ b/chapter11/Starbuzz/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter11/Starbuzz/.idea/gradle.xml b/chapter11/Starbuzz/.idea/gradle.xml
index 8d2df47..7ac24c7 100644
--- a/chapter11/Starbuzz/.idea/gradle.xml
+++ b/chapter11/Starbuzz/.idea/gradle.xml
@@ -5,13 +5,13 @@
-
+
diff --git a/chapter11/Starbuzz/.idea/misc.xml b/chapter11/Starbuzz/.idea/misc.xml
index aaaf922..1d9d626 100644
--- a/chapter11/Starbuzz/.idea/misc.xml
+++ b/chapter11/Starbuzz/.idea/misc.xml
@@ -1,8 +1,5 @@
-
-
-
@@ -13,26 +10,10 @@
-
+
-
-
-
-
- 1.8
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/chapter11/Starbuzz/.idea/runConfigurations.xml b/chapter11/Starbuzz/.idea/runConfigurations.xml
new file mode 100644
index 0000000..7f68460
--- /dev/null
+++ b/chapter11/Starbuzz/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter11/Starbuzz/.idea/vcs.xml b/chapter11/Starbuzz/.idea/vcs.xml
deleted file mode 100644
index 6564d52..0000000
--- a/chapter11/Starbuzz/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/chapter11/Starbuzz/Starbuzz.iml b/chapter11/Starbuzz/Starbuzz.iml
index 9b1e96b..8517df0 100644
--- a/chapter11/Starbuzz/Starbuzz.iml
+++ b/chapter11/Starbuzz/Starbuzz.iml
@@ -8,7 +8,7 @@
-
+
diff --git a/chapter11/Starbuzz/app/app.iml b/chapter11/Starbuzz/app/app.iml
index 6ca15de..4ef0ade 100644
--- a/chapter11/Starbuzz/app/app.iml
+++ b/chapter11/Starbuzz/app/app.iml
@@ -9,13 +9,11 @@
-
-
-
-
-
+
+ generateDebugSources
+
@@ -24,70 +22,86 @@
-
+
-
+
+
-
+
+
-
+
-
+
+
+
+
+
+
+
+
-
+
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
-
-
+
+
+
-
+
\ No newline at end of file
diff --git a/chapter11/Starbuzz/app/build.gradle b/chapter11/Starbuzz/app/build.gradle
index ee06e72..c8544ff 100644
--- a/chapter11/Starbuzz/app/build.gradle
+++ b/chapter11/Starbuzz/app/build.gradle
@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 21
- buildToolsVersion "21.1.2"
+ buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.hfad.starbuzz"
diff --git a/chapter11/Starbuzz/build.gradle b/chapter11/Starbuzz/build.gradle
index d3ff69d..ea98e44 100644
--- a/chapter11/Starbuzz/build.gradle
+++ b/chapter11/Starbuzz/build.gradle
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.1.0'
+ classpath 'com.android.tools.build:gradle:2.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/chapter11/Starbuzz/gradle/wrapper/gradle-wrapper.properties b/chapter11/Starbuzz/gradle/wrapper/gradle-wrapper.properties
index 0c71e76..26301b2 100644
--- a/chapter11/Starbuzz/gradle/wrapper/gradle-wrapper.properties
+++ b/chapter11/Starbuzz/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Wed Apr 10 15:27:10 PDT 2013
+#Tue May 23 19:48:19 BST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
diff --git a/chapter12/Starbuzz/.idea/compiler.xml b/chapter12/Starbuzz/.idea/compiler.xml
index 9a8b7e5..96cc43e 100644
--- a/chapter12/Starbuzz/.idea/compiler.xml
+++ b/chapter12/Starbuzz/.idea/compiler.xml
@@ -1,7 +1,6 @@
-
@@ -12,6 +11,7 @@
+
diff --git a/chapter12/Starbuzz/.idea/encodings.xml b/chapter12/Starbuzz/.idea/encodings.xml
new file mode 100644
index 0000000..97626ba
--- /dev/null
+++ b/chapter12/Starbuzz/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter12/Starbuzz/.idea/gradle.xml b/chapter12/Starbuzz/.idea/gradle.xml
index 8d2df47..7ac24c7 100644
--- a/chapter12/Starbuzz/.idea/gradle.xml
+++ b/chapter12/Starbuzz/.idea/gradle.xml
@@ -5,13 +5,13 @@
-
+
diff --git a/chapter12/Starbuzz/.idea/misc.xml b/chapter12/Starbuzz/.idea/misc.xml
index aaaf922..5d19981 100644
--- a/chapter12/Starbuzz/.idea/misc.xml
+++ b/chapter12/Starbuzz/.idea/misc.xml
@@ -3,6 +3,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -13,26 +37,10 @@
-
+
-
-
-
-
- 1.8
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/chapter12/Starbuzz/.idea/runConfigurations.xml b/chapter12/Starbuzz/.idea/runConfigurations.xml
new file mode 100644
index 0000000..7f68460
--- /dev/null
+++ b/chapter12/Starbuzz/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter12/Starbuzz/.idea/vcs.xml b/chapter12/Starbuzz/.idea/vcs.xml
deleted file mode 100644
index 6564d52..0000000
--- a/chapter12/Starbuzz/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/chapter12/Starbuzz/Starbuzz.iml b/chapter12/Starbuzz/Starbuzz.iml
index 9b1e96b..8517df0 100644
--- a/chapter12/Starbuzz/Starbuzz.iml
+++ b/chapter12/Starbuzz/Starbuzz.iml
@@ -8,7 +8,7 @@
-
+
diff --git a/chapter12/Starbuzz/app/app.iml b/chapter12/Starbuzz/app/app.iml
index 6ca15de..0fb4624 100644
--- a/chapter12/Starbuzz/app/app.iml
+++ b/chapter12/Starbuzz/app/app.iml
@@ -9,13 +9,11 @@
-
-
-
-
-
+
+ generateDebugSources
+
@@ -24,70 +22,79 @@
-
+
-
+
+
-
+
+
-
+
-
+
+
+
+
+
+
+
+
-
+
-
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
+
+
-
-
-
+
+
-
+
\ No newline at end of file
diff --git a/chapter12/Starbuzz/app/build.gradle b/chapter12/Starbuzz/app/build.gradle
index ee06e72..c8544ff 100644
--- a/chapter12/Starbuzz/app/build.gradle
+++ b/chapter12/Starbuzz/app/build.gradle
@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 21
- buildToolsVersion "21.1.2"
+ buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.hfad.starbuzz"
diff --git a/chapter12/Starbuzz/app/src/main/java/com/hfad/starbuzz/DrinkActivity.java b/chapter12/Starbuzz/app/src/main/java/com/hfad/starbuzz/DrinkActivity.java
index ffd19af..198f040 100644
--- a/chapter12/Starbuzz/app/src/main/java/com/hfad/starbuzz/DrinkActivity.java
+++ b/chapter12/Starbuzz/app/src/main/java/com/hfad/starbuzz/DrinkActivity.java
@@ -81,7 +81,8 @@ private class UpdateDrinkTask extends AsyncTask {
ContentValues drinkValues;
protected void onPreExecute() {
CheckBox favorite = (CheckBox)findViewById(R.id.favorite);
- drinkValues = new ContentValues(); drinkValues.put("FAVORITE", favorite.isChecked());
+ drinkValues = new ContentValues();
+ drinkValues.put("FAVORITE", favorite.isChecked());
}
protected Boolean doInBackground(Integer... drinks) {
int drinkNo = drinks[0];
diff --git a/chapter12/Starbuzz/app/src/main/java/com/hfad/starbuzz/TopLevelActivity.java b/chapter12/Starbuzz/app/src/main/java/com/hfad/starbuzz/TopLevelActivity.java
index ab8abaa..82c6f97 100644
--- a/chapter12/Starbuzz/app/src/main/java/com/hfad/starbuzz/TopLevelActivity.java
+++ b/chapter12/Starbuzz/app/src/main/java/com/hfad/starbuzz/TopLevelActivity.java
@@ -80,6 +80,7 @@ public void onDestroy(){
db.close();
}
+ @Override
public void onRestart() {
super.onRestart();
try {
diff --git a/chapter12/Starbuzz/build.gradle b/chapter12/Starbuzz/build.gradle
index d3ff69d..ea98e44 100644
--- a/chapter12/Starbuzz/build.gradle
+++ b/chapter12/Starbuzz/build.gradle
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.1.0'
+ classpath 'com.android.tools.build:gradle:2.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/chapter12/Starbuzz/gradle/wrapper/gradle-wrapper.properties b/chapter12/Starbuzz/gradle/wrapper/gradle-wrapper.properties
index 0c71e76..1ded3ad 100644
--- a/chapter12/Starbuzz/gradle/wrapper/gradle-wrapper.properties
+++ b/chapter12/Starbuzz/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Wed Apr 10 15:27:10 PDT 2013
+#Tue May 23 19:48:51 BST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
diff --git a/chapter13/Joke/.idea/compiler.xml b/chapter13/Joke/.idea/compiler.xml
index 9a8b7e5..96cc43e 100644
--- a/chapter13/Joke/.idea/compiler.xml
+++ b/chapter13/Joke/.idea/compiler.xml
@@ -1,7 +1,6 @@
-
@@ -12,6 +11,7 @@
+
diff --git a/chapter13/Joke/.idea/encodings.xml b/chapter13/Joke/.idea/encodings.xml
new file mode 100644
index 0000000..97626ba
--- /dev/null
+++ b/chapter13/Joke/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter13/Joke/.idea/gradle.xml b/chapter13/Joke/.idea/gradle.xml
index 8d2df47..7ac24c7 100644
--- a/chapter13/Joke/.idea/gradle.xml
+++ b/chapter13/Joke/.idea/gradle.xml
@@ -5,13 +5,13 @@
-
+
diff --git a/chapter13/Joke/.idea/misc.xml b/chapter13/Joke/.idea/misc.xml
index aaaf922..1d9d626 100644
--- a/chapter13/Joke/.idea/misc.xml
+++ b/chapter13/Joke/.idea/misc.xml
@@ -1,8 +1,5 @@
-
-
-
@@ -13,26 +10,10 @@
-
+
-
-
-
-
- 1.8
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/chapter13/Joke/.idea/runConfigurations.xml b/chapter13/Joke/.idea/runConfigurations.xml
new file mode 100644
index 0000000..7f68460
--- /dev/null
+++ b/chapter13/Joke/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter13/Joke/.idea/vcs.xml b/chapter13/Joke/.idea/vcs.xml
deleted file mode 100644
index 6564d52..0000000
--- a/chapter13/Joke/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/chapter13/Joke/Joke.iml b/chapter13/Joke/Joke.iml
index 3998261..e613fc4 100644
--- a/chapter13/Joke/Joke.iml
+++ b/chapter13/Joke/Joke.iml
@@ -8,7 +8,7 @@
-
+
diff --git a/chapter13/Joke/app/app.iml b/chapter13/Joke/app/app.iml
index 6c63eda..95e3eab 100644
--- a/chapter13/Joke/app/app.iml
+++ b/chapter13/Joke/app/app.iml
@@ -9,13 +9,11 @@
-
-
-
-
-
+
+ generateDebugSources
+
@@ -24,70 +22,86 @@
-
+
-
+
+
-
+
+
-
+
-
+
+
+
+
+
+
+
+
-
+
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
-
-
+
+
+
-
+
\ No newline at end of file
diff --git a/chapter13/Joke/app/build.gradle b/chapter13/Joke/app/build.gradle
index 6745b9e..3eeae93 100644
--- a/chapter13/Joke/app/build.gradle
+++ b/chapter13/Joke/app/build.gradle
@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 21
- buildToolsVersion "21.1.2"
+ buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.hfad.joke"
diff --git a/chapter13/Joke/build.gradle b/chapter13/Joke/build.gradle
index d3ff69d..ea98e44 100644
--- a/chapter13/Joke/build.gradle
+++ b/chapter13/Joke/build.gradle
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.1.0'
+ classpath 'com.android.tools.build:gradle:2.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/chapter13/Joke/gradle/wrapper/gradle-wrapper.properties b/chapter13/Joke/gradle/wrapper/gradle-wrapper.properties
index 0c71e76..f166b5a 100644
--- a/chapter13/Joke/gradle/wrapper/gradle-wrapper.properties
+++ b/chapter13/Joke/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Wed Apr 10 15:27:10 PDT 2013
+#Tue May 23 19:49:21 BST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
diff --git a/chapter13/Odometer/.idea/compiler.xml b/chapter13/Odometer/.idea/compiler.xml
index 9a8b7e5..96cc43e 100644
--- a/chapter13/Odometer/.idea/compiler.xml
+++ b/chapter13/Odometer/.idea/compiler.xml
@@ -1,7 +1,6 @@
-
@@ -12,6 +11,7 @@
+
diff --git a/chapter13/Odometer/.idea/encodings.xml b/chapter13/Odometer/.idea/encodings.xml
new file mode 100644
index 0000000..97626ba
--- /dev/null
+++ b/chapter13/Odometer/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter13/Odometer/.idea/gradle.xml b/chapter13/Odometer/.idea/gradle.xml
index 8d2df47..7ac24c7 100644
--- a/chapter13/Odometer/.idea/gradle.xml
+++ b/chapter13/Odometer/.idea/gradle.xml
@@ -5,13 +5,13 @@
-
+
diff --git a/chapter13/Odometer/.idea/misc.xml b/chapter13/Odometer/.idea/misc.xml
index aaaf922..7c1371c 100644
--- a/chapter13/Odometer/.idea/misc.xml
+++ b/chapter13/Odometer/.idea/misc.xml
@@ -1,7 +1,28 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -13,26 +34,10 @@
-
+
-
-
-
-
- 1.8
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/chapter13/Odometer/.idea/runConfigurations.xml b/chapter13/Odometer/.idea/runConfigurations.xml
new file mode 100644
index 0000000..7f68460
--- /dev/null
+++ b/chapter13/Odometer/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter13/Odometer/.idea/vcs.xml b/chapter13/Odometer/.idea/vcs.xml
deleted file mode 100644
index 6564d52..0000000
--- a/chapter13/Odometer/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/chapter13/Odometer/Odometer.iml b/chapter13/Odometer/Odometer.iml
index 82032ec..bd9eb3b 100644
--- a/chapter13/Odometer/Odometer.iml
+++ b/chapter13/Odometer/Odometer.iml
@@ -8,7 +8,7 @@
-
+
diff --git a/chapter13/Odometer/app/app.iml b/chapter13/Odometer/app/app.iml
index 6a285b2..7e0ad22 100644
--- a/chapter13/Odometer/app/app.iml
+++ b/chapter13/Odometer/app/app.iml
@@ -9,13 +9,11 @@
-
-
-
-
-
+
+ generateDebugSources
+
@@ -24,70 +22,80 @@
-
+
-
+
+
-
+
+
-
+
-
+
+
+
+
+
+
+
+
-
+
-
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
+
+
-
-
+
+
-
+
\ No newline at end of file
diff --git a/chapter13/Odometer/app/build.gradle b/chapter13/Odometer/app/build.gradle
index 53b4a90..1a24156 100644
--- a/chapter13/Odometer/app/build.gradle
+++ b/chapter13/Odometer/app/build.gradle
@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 21
- buildToolsVersion "21.1.2"
+ buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.hfad.odometer"
diff --git a/chapter13/Odometer/app/src/main/java/com/hfad/odometer/OdometerService.java b/chapter13/Odometer/app/src/main/java/com/hfad/odometer/OdometerService.java
index 58198cd..3c878ba 100644
--- a/chapter13/Odometer/app/src/main/java/com/hfad/odometer/OdometerService.java
+++ b/chapter13/Odometer/app/src/main/java/com/hfad/odometer/OdometerService.java
@@ -15,6 +15,8 @@ public class OdometerService extends Service {
private final IBinder binder = new OdometerBinder();
private static double distanceInMeters;
private static Location lastLocation = null;
+ private LocationListener listener;
+ private LocationManager locManager;
public class OdometerBinder extends Binder {
OdometerService getOdometer() {
@@ -29,7 +31,7 @@ public IBinder onBind(Intent intent) {
@Override
public void onCreate() {
- LocationListener listener = new LocationListener() {
+ listener = new LocationListener() {
@Override
public void onLocationChanged(Location location) {
if (lastLocation == null) {
@@ -48,10 +50,19 @@ public void onProviderEnabled(String arg0) {}
@Override
public void onStatusChanged(String arg0, int arg1, Bundle bundle) {}
};
- LocationManager locManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
+ locManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 1, listener);
}
+ @Override
+ public void onDestroy() {
+ if (locManager != null && listener != null) {
+ locManager.removeUpdates(listener);
+ locManager = null;
+ listener = null;
+ }
+ }
+
public double getMiles() {
return this.distanceInMeters / 1609.344;
}
diff --git a/chapter13/Odometer/app/src/main/res/layout/activity_main.xml b/chapter13/Odometer/app/src/main/res/layout/activity_main.xml
index 18abfce..add41b3 100644
--- a/chapter13/Odometer/app/src/main/res/layout/activity_main.xml
+++ b/chapter13/Odometer/app/src/main/res/layout/activity_main.xml
@@ -10,6 +10,5 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
- android:singleLine="false"
- android:textSize="60dp"/>
+ android:textSize="50sp"/>
diff --git a/chapter13/Odometer/build.gradle b/chapter13/Odometer/build.gradle
index d3ff69d..ea98e44 100644
--- a/chapter13/Odometer/build.gradle
+++ b/chapter13/Odometer/build.gradle
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.1.0'
+ classpath 'com.android.tools.build:gradle:2.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/chapter13/Odometer/gradle/wrapper/gradle-wrapper.properties b/chapter13/Odometer/gradle/wrapper/gradle-wrapper.properties
index 0c71e76..1575f4d 100644
--- a/chapter13/Odometer/gradle/wrapper/gradle-wrapper.properties
+++ b/chapter13/Odometer/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Wed Apr 10 15:27:10 PDT 2013
+#Tue May 23 19:40:05 BST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
diff --git a/chapter14/BitsAndPizzas/.gitignore b/chapter14/BitsAndPizzas/.gitignore
new file mode 100644
index 0000000..9c4de58
--- /dev/null
+++ b/chapter14/BitsAndPizzas/.gitignore
@@ -0,0 +1,7 @@
+.gradle
+/local.properties
+/.idea/workspace.xml
+/.idea/libraries
+.DS_Store
+/build
+/captures
diff --git a/chapter14/BitsAndPizzas/.idea/.name b/chapter14/BitsAndPizzas/.idea/.name
new file mode 100644
index 0000000..e40a72c
--- /dev/null
+++ b/chapter14/BitsAndPizzas/.idea/.name
@@ -0,0 +1 @@
+BitsAndPizzas
\ No newline at end of file
diff --git a/chapter14/BitsAndPizzas/.idea/compiler.xml b/chapter14/BitsAndPizzas/.idea/compiler.xml
new file mode 100644
index 0000000..96cc43e
--- /dev/null
+++ b/chapter14/BitsAndPizzas/.idea/compiler.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter14/BitsAndPizzas/.idea/copyright/profiles_settings.xml b/chapter14/BitsAndPizzas/.idea/copyright/profiles_settings.xml
new file mode 100644
index 0000000..e7bedf3
--- /dev/null
+++ b/chapter14/BitsAndPizzas/.idea/copyright/profiles_settings.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/chapter14/BitsAndPizzas/.idea/encodings.xml b/chapter14/BitsAndPizzas/.idea/encodings.xml
new file mode 100644
index 0000000..97626ba
--- /dev/null
+++ b/chapter14/BitsAndPizzas/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter14/BitsAndPizzas/.idea/gradle.xml b/chapter14/BitsAndPizzas/.idea/gradle.xml
new file mode 100644
index 0000000..7ac24c7
--- /dev/null
+++ b/chapter14/BitsAndPizzas/.idea/gradle.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter14/BitsAndPizzas/.idea/misc.xml b/chapter14/BitsAndPizzas/.idea/misc.xml
new file mode 100644
index 0000000..5d19981
--- /dev/null
+++ b/chapter14/BitsAndPizzas/.idea/misc.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter14/BitsAndPizzas/.idea/modules.xml b/chapter14/BitsAndPizzas/.idea/modules.xml
new file mode 100644
index 0000000..a7bf6e5
--- /dev/null
+++ b/chapter14/BitsAndPizzas/.idea/modules.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter14/BitsAndPizzas/.idea/runConfigurations.xml b/chapter14/BitsAndPizzas/.idea/runConfigurations.xml
new file mode 100644
index 0000000..7f68460
--- /dev/null
+++ b/chapter14/BitsAndPizzas/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter14/BitsAndPizzas/BitsAndPizzas.iml b/chapter14/BitsAndPizzas/BitsAndPizzas.iml
new file mode 100644
index 0000000..e28da36
--- /dev/null
+++ b/chapter14/BitsAndPizzas/BitsAndPizzas.iml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter14/BitsAndPizzas/app/.gitignore b/chapter14/BitsAndPizzas/app/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/chapter14/BitsAndPizzas/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/chapter14/BitsAndPizzas/app/app.iml b/chapter14/BitsAndPizzas/app/app.iml
new file mode 100644
index 0000000..75a8796
--- /dev/null
+++ b/chapter14/BitsAndPizzas/app/app.iml
@@ -0,0 +1,111 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ generateDebugSources
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter14/BitsAndPizzas/app/build.gradle b/chapter14/BitsAndPizzas/app/build.gradle
new file mode 100644
index 0000000..2030650
--- /dev/null
+++ b/chapter14/BitsAndPizzas/app/build.gradle
@@ -0,0 +1,27 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 21
+ buildToolsVersion '25.0.0'
+
+ defaultConfig {
+ applicationId "com.hfad.bitsandpizzas"
+ minSdkVersion 17
+ targetSdkVersion 21
+ versionCode 1
+ versionName "1.0"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ compile 'com.android.support:appcompat-v7:22.2.1'
+ compile 'com.android.support:recyclerview-v7:22.2.1'
+ compile 'com.android.support:cardview-v7:22.2.1'
+}
diff --git a/chapter14/BitsAndPizzas/app/proguard-rules.pro b/chapter14/BitsAndPizzas/app/proguard-rules.pro
new file mode 100644
index 0000000..3e3c221
--- /dev/null
+++ b/chapter14/BitsAndPizzas/app/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in /Users/davidg/Library/Android/sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/chapter14/BitsAndPizzas/app/src/androidTest/java/com/hfad/bitsandpizzas/ApplicationTest.java b/chapter14/BitsAndPizzas/app/src/androidTest/java/com/hfad/bitsandpizzas/ApplicationTest.java
new file mode 100644
index 0000000..f36b088
--- /dev/null
+++ b/chapter14/BitsAndPizzas/app/src/androidTest/java/com/hfad/bitsandpizzas/ApplicationTest.java
@@ -0,0 +1,13 @@
+package com.hfad.bitsandpizzas;
+
+import android.app.Application;
+import android.test.ApplicationTestCase;
+
+/**
+ * Testing Fundamentals
+ */
+public class ApplicationTest extends ApplicationTestCase {
+ public ApplicationTest() {
+ super(Application.class);
+ }
+}
\ No newline at end of file
diff --git a/chapter14/BitsAndPizzas/app/src/main/AndroidManifest.xml b/chapter14/BitsAndPizzas/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..166f559
--- /dev/null
+++ b/chapter14/BitsAndPizzas/app/src/main/AndroidManifest.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/chapter14/BitsAndPizzas/app/src/main/java/com/hfad/bitsandpizzas/CaptionedImagesAdapter.java b/chapter14/BitsAndPizzas/app/src/main/java/com/hfad/bitsandpizzas/CaptionedImagesAdapter.java
new file mode 100644
index 0000000..2c0a736
--- /dev/null
+++ b/chapter14/BitsAndPizzas/app/src/main/java/com/hfad/bitsandpizzas/CaptionedImagesAdapter.java
@@ -0,0 +1,69 @@
+package com.hfad.bitsandpizzas;
+
+import android.graphics.drawable.Drawable;
+import android.support.v7.widget.RecyclerView;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.support.v7.widget.CardView;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+class CaptionedImagesAdapter extends RecyclerView.Adapter {
+
+ private String[] captions;
+ private int[] imageIds;
+ private Listener listener;
+
+ public static interface Listener {
+ public void onClick(int position);
+ }
+
+ public static class ViewHolder extends RecyclerView.ViewHolder {
+ private CardView cardView;
+ public ViewHolder(CardView v) {
+ super(v);
+ cardView=v;
+ }
+ }
+
+ public CaptionedImagesAdapter(String[] captions, int[] imageIds){
+ this.captions = captions;
+ this.imageIds = imageIds;
+ }
+
+ public void setListener(Listener listener) {
+ this.listener = listener;
+ }
+
+ @Override
+ public CaptionedImagesAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
+ CardView cv = (CardView) LayoutInflater.from(parent.getContext())
+ .inflate(R.layout.card_captioned_image, parent, false);
+ return new ViewHolder(cv);
+ }
+
+ @Override
+ public void onBindViewHolder(ViewHolder holder, final int position) {
+ CardView cardView = holder.cardView;
+ ImageView imageView = (ImageView)cardView.findViewById(R.id.info_image);
+ Drawable drawable = cardView.getResources().getDrawable(imageIds[position]);
+ imageView.setImageDrawable(drawable);
+ imageView.setContentDescription(captions[position]);
+ TextView textView = (TextView)cardView.findViewById(R.id.info_text);
+ textView.setText(captions[position]);
+ cardView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (listener != null) {
+ listener.onClick(position);
+ }
+ }
+ });
+ }
+
+ @Override
+ public int getItemCount() {
+ return captions.length;
+ }
+}
diff --git a/chapter14/BitsAndPizzas/app/src/main/java/com/hfad/bitsandpizzas/MainActivity.java b/chapter14/BitsAndPizzas/app/src/main/java/com/hfad/bitsandpizzas/MainActivity.java
new file mode 100644
index 0000000..e78621a
--- /dev/null
+++ b/chapter14/BitsAndPizzas/app/src/main/java/com/hfad/bitsandpizzas/MainActivity.java
@@ -0,0 +1,196 @@
+package com.hfad.bitsandpizzas;
+
+import android.app.Activity;
+import android.app.Fragment;
+import android.app.FragmentManager;
+import android.app.FragmentTransaction;
+import android.content.Intent;
+import android.content.res.Configuration;
+import android.os.Bundle;
+import android.support.v4.widget.DrawerLayout;
+import android.support.v7.app.ActionBarDrawerToggle;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.ListView;
+import android.widget.ShareActionProvider;
+
+public class MainActivity extends Activity {
+ private class DrawerItemClickListener implements ListView.OnItemClickListener {
+ @Override
+ public void onItemClick(AdapterView> parent, View view, int position, long id) {
+ selectItem(position);
+ }
+ }
+
+ private ShareActionProvider shareActionProvider;
+ private String[] titles;
+ private ListView drawerList;
+ private DrawerLayout drawerLayout;
+ private ActionBarDrawerToggle drawerToggle;
+ private int currentPosition = 0;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+ titles = getResources().getStringArray(R.array.titles);
+ drawerList = (ListView)findViewById(R.id.drawer);
+ drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
+ //Populate the ListView
+ drawerList.setAdapter(new ArrayAdapter(this,
+ android.R.layout.simple_list_item_activated_1, titles));
+ drawerList.setOnItemClickListener(new DrawerItemClickListener());
+ //Display the correct fragment.
+ if (savedInstanceState != null) {
+ currentPosition = savedInstanceState.getInt("position");
+ setActionBarTitle(currentPosition);
+ } else {
+ selectItem(0);
+ }
+ //Create the ActionBarDrawerToggle
+ drawerToggle = new ActionBarDrawerToggle(this, drawerLayout,
+ R.string.open_drawer, R.string.close_drawer) {
+ //Called when a drawer has settled in a completely closed state
+ @Override
+ public void onDrawerClosed(View view) {
+ super.onDrawerClosed(view);
+ invalidateOptionsMenu();
+ }
+ //Called when a drawer has settled in a completely open state.
+ @Override
+ public void onDrawerOpened(View drawerView) {
+ super.onDrawerOpened(drawerView);
+ invalidateOptionsMenu();
+ }
+ };
+ drawerLayout.setDrawerListener(drawerToggle);
+ getActionBar().setDisplayHomeAsUpEnabled(true);
+ getActionBar().setHomeButtonEnabled(true);
+ getFragmentManager().addOnBackStackChangedListener(
+ new FragmentManager.OnBackStackChangedListener() {
+ public void onBackStackChanged() {
+ FragmentManager fragMan = getFragmentManager();
+ Fragment fragment = fragMan.findFragmentByTag("visible_fragment");
+ if (fragment instanceof TopFragment) {
+ currentPosition = 0;
+ }
+ if (fragment instanceof PizzaMaterialFragment) {
+ currentPosition = 1;
+ }
+ if (fragment instanceof PastaFragment) {
+ currentPosition = 2;
+ }
+ if (fragment instanceof StoresFragment) {
+ currentPosition = 3;
+ }
+ setActionBarTitle(currentPosition);
+ drawerList.setItemChecked(currentPosition, true);
+ }
+ }
+ );
+ }
+
+ private void selectItem(int position) {
+ // update the main content by replacing fragments
+ currentPosition = position;
+ Fragment fragment;
+ switch(position) {
+ case 1:
+ fragment = new PizzaMaterialFragment();
+ break;
+ case 2:
+ fragment = new PastaFragment();
+ break;
+ case 3:
+ fragment = new StoresFragment();
+ break;
+ default:
+ fragment = new TopFragment();
+ }
+ FragmentTransaction ft = getFragmentManager().beginTransaction();
+ ft.replace(R.id.content_frame, fragment, "visible_fragment");
+ ft.addToBackStack(null);
+ ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
+ ft.commit();
+ //Set the action bar title
+ setActionBarTitle(position);
+ //Close drawer
+ drawerLayout.closeDrawer(drawerList);
+ }
+
+ @Override
+ public boolean onPrepareOptionsMenu(Menu menu) {
+ // If the drawer is open, hide action items related to the content view
+ boolean drawerOpen = drawerLayout.isDrawerOpen(drawerList);
+ menu.findItem(R.id.action_share).setVisible(!drawerOpen);
+ return super.onPrepareOptionsMenu(menu);
+ }
+
+ @Override
+ protected void onPostCreate(Bundle savedInstanceState) {
+ super.onPostCreate(savedInstanceState);
+ // Sync the toggle state after onRestoreInstanceState has occurred.
+ drawerToggle.syncState();
+ }
+
+ @Override
+ public void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ drawerToggle.onConfigurationChanged(newConfig);
+ }
+
+ @Override
+ public void onSaveInstanceState(Bundle outState) {
+ super.onSaveInstanceState(outState);
+ outState.putInt("position", currentPosition);
+ }
+
+ private void setActionBarTitle(int position) {
+ String title;
+ if (position == 0) {
+ title = getResources().getString(R.string.app_name);
+ } else {
+ title = titles[position];
+ }
+ getActionBar().setTitle(title);
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ // Inflate the menu; this adds items to the action bar if it is present.
+ getMenuInflater().inflate(R.menu.menu_main, menu);
+ MenuItem menuItem = menu.findItem(R.id.action_share);
+ shareActionProvider = (ShareActionProvider) menuItem.getActionProvider();
+ setIntent("This is example text");
+ return super.onCreateOptionsMenu(menu);
+ }
+
+ private void setIntent(String text) {
+ Intent intent = new Intent(Intent.ACTION_SEND);
+ intent.setType("text/plain");
+ intent.putExtra(Intent.EXTRA_TEXT, text);
+ shareActionProvider.setShareIntent(intent);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ if (drawerToggle.onOptionsItemSelected(item)) {
+ return true;
+ }
+ switch (item.getItemId()) {
+ case R.id.action_create_order:
+ //Code to run when the Create Order item is clicked
+ Intent intent = new Intent(this, OrderActivity.class);
+ startActivity(intent);
+ return true;
+ case R.id.action_settings:
+ //Code to run when the settings item is clicked
+ return true;
+ default:
+ return super.onOptionsItemSelected(item);
+ }
+ }
+}
diff --git a/chapter14/BitsAndPizzas/app/src/main/java/com/hfad/bitsandpizzas/OrderActivity.java b/chapter14/BitsAndPizzas/app/src/main/java/com/hfad/bitsandpizzas/OrderActivity.java
new file mode 100644
index 0000000..4b23965
--- /dev/null
+++ b/chapter14/BitsAndPizzas/app/src/main/java/com/hfad/bitsandpizzas/OrderActivity.java
@@ -0,0 +1,15 @@
+package com.hfad.bitsandpizzas;
+
+import android.app.ActionBar;
+import android.app.Activity;
+import android.os.Bundle;
+
+public class OrderActivity extends Activity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_order);
+ ActionBar actionBar = getActionBar();
+ actionBar.setDisplayHomeAsUpEnabled(true);
+ }
+}
diff --git a/chapter14/BitsAndPizzas/app/src/main/java/com/hfad/bitsandpizzas/PastaFragment.java b/chapter14/BitsAndPizzas/app/src/main/java/com/hfad/bitsandpizzas/PastaFragment.java
new file mode 100644
index 0000000..319d482
--- /dev/null
+++ b/chapter14/BitsAndPizzas/app/src/main/java/com/hfad/bitsandpizzas/PastaFragment.java
@@ -0,0 +1,22 @@
+package com.hfad.bitsandpizzas;
+
+import android.app.ListFragment;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+
+public class PastaFragment extends ListFragment {
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ ArrayAdapter adapter = new ArrayAdapter(
+ inflater.getContext(),
+ android.R.layout.simple_list_item_1,
+ getResources().getStringArray(R.array.pasta));
+ setListAdapter(adapter);
+ return super.onCreateView(inflater, container, savedInstanceState);
+ }
+}
diff --git a/chapter14/BitsAndPizzas/app/src/main/java/com/hfad/bitsandpizzas/Pizza.java b/chapter14/BitsAndPizzas/app/src/main/java/com/hfad/bitsandpizzas/Pizza.java
new file mode 100644
index 0000000..6f54122
--- /dev/null
+++ b/chapter14/BitsAndPizzas/app/src/main/java/com/hfad/bitsandpizzas/Pizza.java
@@ -0,0 +1,24 @@
+package com.hfad.bitsandpizzas;
+
+public class Pizza {
+ private String name;
+ private int imageResourceId;
+
+ public static final Pizza[] pizzas = {
+ new Pizza("Diavolo", R.drawable.diavolo),
+ new Pizza("Funghi", R.drawable.funghi)
+ };
+
+ private Pizza(String name, int imageResourceId) {
+ this.name = name;
+ this.imageResourceId = imageResourceId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public int getImageResourceId() {
+ return imageResourceId;
+ }
+}
diff --git a/chapter14/BitsAndPizzas/app/src/main/java/com/hfad/bitsandpizzas/PizzaDetailActivity.java b/chapter14/BitsAndPizzas/app/src/main/java/com/hfad/bitsandpizzas/PizzaDetailActivity.java
new file mode 100644
index 0000000..28b1d55
--- /dev/null
+++ b/chapter14/BitsAndPizzas/app/src/main/java/com/hfad/bitsandpizzas/PizzaDetailActivity.java
@@ -0,0 +1,63 @@
+package com.hfad.bitsandpizzas;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.widget.ImageView;
+import android.widget.ShareActionProvider;
+import android.widget.TextView;
+
+public class PizzaDetailActivity extends Activity {
+
+ public static final String EXTRA_PIZZANO = "pizzaNo";
+ private ShareActionProvider shareActionProvider;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_pizza_detail);
+
+ //Enable the Up button
+ getActionBar().setDisplayHomeAsUpEnabled(true);
+
+ //Display details of the pizza
+ int pizzaNo = (Integer)getIntent().getExtras().get(EXTRA_PIZZANO);
+ String pizzaName = Pizza.pizzas[pizzaNo].getName();
+ TextView textView = (TextView)findViewById(R.id.pizza_text);
+ textView.setText(pizzaName);
+ int pizzaImage = Pizza.pizzas[pizzaNo].getImageResourceId();
+ ImageView imageView = (ImageView)findViewById(R.id.pizza_image);
+ imageView.setImageDrawable(getResources().getDrawable(pizzaImage));
+ imageView.setContentDescription(pizzaName);
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.menu_main, menu);
+
+ //Share the name of the pizza
+ TextView textView = (TextView)findViewById(R.id.pizza_text);
+ CharSequence pizzaName = textView.getText();
+ MenuItem menuItem = menu.findItem(R.id.action_share);
+ shareActionProvider = (ShareActionProvider) menuItem.getActionProvider();
+ Intent intent = new Intent(Intent.ACTION_SEND);
+ intent.setType("text/plain");
+ intent.putExtra(Intent.EXTRA_TEXT, pizzaName);
+ shareActionProvider.setShareIntent(intent);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.action_create_order:
+ Intent intent = new Intent(this, OrderActivity.class);
+ startActivity(intent);
+ return true;
+ default:
+ return super.onOptionsItemSelected(item);
+ }
+ }
+}
diff --git a/chapter14/BitsAndPizzas/app/src/main/java/com/hfad/bitsandpizzas/PizzaFragment.java b/chapter14/BitsAndPizzas/app/src/main/java/com/hfad/bitsandpizzas/PizzaFragment.java
new file mode 100644
index 0000000..ae7939a
--- /dev/null
+++ b/chapter14/BitsAndPizzas/app/src/main/java/com/hfad/bitsandpizzas/PizzaFragment.java
@@ -0,0 +1,22 @@
+package com.hfad.bitsandpizzas;
+
+import android.app.ListFragment;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+
+public class PizzaFragment extends ListFragment {
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ ArrayAdapter adapter = new ArrayAdapter(
+ inflater.getContext(),
+ android.R.layout.simple_list_item_1,
+ getResources().getStringArray(R.array.pizzas));
+ setListAdapter(adapter);
+ return super.onCreateView(inflater, container, savedInstanceState);
+ }
+}
diff --git a/chapter14/BitsAndPizzas/app/src/main/java/com/hfad/bitsandpizzas/PizzaMaterialFragment.java b/chapter14/BitsAndPizzas/app/src/main/java/com/hfad/bitsandpizzas/PizzaMaterialFragment.java
new file mode 100644
index 0000000..e0ae660
--- /dev/null
+++ b/chapter14/BitsAndPizzas/app/src/main/java/com/hfad/bitsandpizzas/PizzaMaterialFragment.java
@@ -0,0 +1,43 @@
+package com.hfad.bitsandpizzas;
+
+import android.app.Fragment;
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.v7.widget.LinearLayoutManager;
+import android.support.v7.widget.RecyclerView;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+public class PizzaMaterialFragment extends Fragment {
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ RecyclerView pizzaRecycler = (RecyclerView)inflater.inflate(R.layout.fragment_pizza_material,
+ container, false);
+
+ String[] pizzaNames = new String[Pizza.pizzas.length];
+ for (int i = 0; i < pizzaNames.length; i++) {
+ pizzaNames[i] = Pizza.pizzas[i].getName();
+ }
+
+ int[] pizzaImages = new int[Pizza.pizzas.length];
+ for (int i = 0; i < pizzaImages.length; i++) {
+ pizzaImages[i] = Pizza.pizzas[i].getImageResourceId();
+ }
+
+ CaptionedImagesAdapter adapter = new CaptionedImagesAdapter(pizzaNames, pizzaImages);
+ pizzaRecycler.setAdapter(adapter);
+ LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
+ pizzaRecycler.setLayoutManager(layoutManager);
+ adapter.setListener(new CaptionedImagesAdapter.Listener() {
+ public void onClick(int position) {
+ Intent intent = new Intent(getActivity(), PizzaDetailActivity.class);
+ intent.putExtra(PizzaDetailActivity.EXTRA_PIZZANO, position);
+ getActivity().startActivity(intent);
+ }
+ });
+ return pizzaRecycler;
+ }
+}
diff --git a/chapter14/BitsAndPizzas/app/src/main/java/com/hfad/bitsandpizzas/StoresFragment.java b/chapter14/BitsAndPizzas/app/src/main/java/com/hfad/bitsandpizzas/StoresFragment.java
new file mode 100644
index 0000000..a8440ae
--- /dev/null
+++ b/chapter14/BitsAndPizzas/app/src/main/java/com/hfad/bitsandpizzas/StoresFragment.java
@@ -0,0 +1,22 @@
+package com.hfad.bitsandpizzas;
+
+import android.app.ListFragment;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+
+public class StoresFragment extends ListFragment {
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ ArrayAdapter adapter = new ArrayAdapter(
+ inflater.getContext(),
+ android.R.layout.simple_list_item_1,
+ getResources().getStringArray(R.array.stores));
+ setListAdapter(adapter);
+ return super.onCreateView(inflater, container, savedInstanceState);
+ }
+}
diff --git a/chapter14/BitsAndPizzas/app/src/main/java/com/hfad/bitsandpizzas/TopFragment.java b/chapter14/BitsAndPizzas/app/src/main/java/com/hfad/bitsandpizzas/TopFragment.java
new file mode 100644
index 0000000..3af0d8e
--- /dev/null
+++ b/chapter14/BitsAndPizzas/app/src/main/java/com/hfad/bitsandpizzas/TopFragment.java
@@ -0,0 +1,41 @@
+package com.hfad.bitsandpizzas;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.app.Fragment;
+import android.support.v7.widget.GridLayoutManager;
+import android.support.v7.widget.RecyclerView;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.RelativeLayout;
+
+public class TopFragment extends Fragment {
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ RelativeLayout layout = (RelativeLayout)inflater.inflate(R.layout.fragment_top, container, false);
+ RecyclerView pizzaRecycler = (RecyclerView)layout.findViewById(R.id.pizza_recycler);
+ String[] pizzaNames = new String[2];
+ for (int i = 0; i < 2; i++) {
+ pizzaNames[i] = Pizza.pizzas[i].getName();
+ }
+ int[] pizzaImages = new int[2];
+ for (int i = 0; i < 2; i++) {
+ pizzaImages[i] = Pizza.pizzas[i].getImageResourceId();
+ }
+ GridLayoutManager layoutManager = new GridLayoutManager(getActivity(),2);
+ pizzaRecycler.setLayoutManager(layoutManager);
+ CaptionedImagesAdapter adapter = new CaptionedImagesAdapter(pizzaNames, pizzaImages);
+ pizzaRecycler.setAdapter(adapter);
+ adapter.setListener(new CaptionedImagesAdapter.Listener() {
+ public void onClick(int position) {
+ Intent intent = new Intent(getActivity(), PizzaDetailActivity.class);
+ intent.putExtra(PizzaDetailActivity.EXTRA_PIZZANO, position);
+ getActivity().startActivity(intent);
+ }
+ });
+ return layout;
+ }
+}
diff --git a/chapter14/BitsAndPizzas/app/src/main/res/drawable-hdpi/ic_action_new_event.png b/chapter14/BitsAndPizzas/app/src/main/res/drawable-hdpi/ic_action_new_event.png
new file mode 100644
index 0000000..5a5d558
Binary files /dev/null and b/chapter14/BitsAndPizzas/app/src/main/res/drawable-hdpi/ic_action_new_event.png differ
diff --git a/chapter14/BitsAndPizzas/app/src/main/res/drawable-mdpi/ic_action_new_event.png b/chapter14/BitsAndPizzas/app/src/main/res/drawable-mdpi/ic_action_new_event.png
new file mode 100644
index 0000000..e8b7e41
Binary files /dev/null and b/chapter14/BitsAndPizzas/app/src/main/res/drawable-mdpi/ic_action_new_event.png differ
diff --git a/chapter14/BitsAndPizzas/app/src/main/res/drawable-nodpi/diavolo.jpg b/chapter14/BitsAndPizzas/app/src/main/res/drawable-nodpi/diavolo.jpg
new file mode 100644
index 0000000..0d40004
Binary files /dev/null and b/chapter14/BitsAndPizzas/app/src/main/res/drawable-nodpi/diavolo.jpg differ
diff --git a/chapter14/BitsAndPizzas/app/src/main/res/drawable-nodpi/funghi.jpg b/chapter14/BitsAndPizzas/app/src/main/res/drawable-nodpi/funghi.jpg
new file mode 100644
index 0000000..3a392b7
Binary files /dev/null and b/chapter14/BitsAndPizzas/app/src/main/res/drawable-nodpi/funghi.jpg differ
diff --git a/chapter14/BitsAndPizzas/app/src/main/res/drawable-xhdpi/ic_action_new_event.png b/chapter14/BitsAndPizzas/app/src/main/res/drawable-xhdpi/ic_action_new_event.png
new file mode 100644
index 0000000..f2435cb
Binary files /dev/null and b/chapter14/BitsAndPizzas/app/src/main/res/drawable-xhdpi/ic_action_new_event.png differ
diff --git a/chapter14/BitsAndPizzas/app/src/main/res/drawable-xxhdpi/ic_action_new_event.png b/chapter14/BitsAndPizzas/app/src/main/res/drawable-xxhdpi/ic_action_new_event.png
new file mode 100644
index 0000000..ebd2410
Binary files /dev/null and b/chapter14/BitsAndPizzas/app/src/main/res/drawable-xxhdpi/ic_action_new_event.png differ
diff --git a/chapter14/BitsAndPizzas/app/src/main/res/layout/activity_main.xml b/chapter14/BitsAndPizzas/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..99333f3
--- /dev/null
+++ b/chapter14/BitsAndPizzas/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,18 @@
+
+
+
+
diff --git a/chapter14/BitsAndPizzas/app/src/main/res/layout/activity_order.xml b/chapter14/BitsAndPizzas/app/src/main/res/layout/activity_order.xml
new file mode 100644
index 0000000..bc56ff5
--- /dev/null
+++ b/chapter14/BitsAndPizzas/app/src/main/res/layout/activity_order.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
diff --git a/chapter14/BitsAndPizzas/app/src/main/res/layout/activity_pizza_detail.xml b/chapter14/BitsAndPizzas/app/src/main/res/layout/activity_pizza_detail.xml
new file mode 100644
index 0000000..0207374
--- /dev/null
+++ b/chapter14/BitsAndPizzas/app/src/main/res/layout/activity_pizza_detail.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
diff --git a/chapter14/BitsAndPizzas/app/src/main/res/layout/card_captioned_image.xml b/chapter14/BitsAndPizzas/app/src/main/res/layout/card_captioned_image.xml
new file mode 100644
index 0000000..617f69e
--- /dev/null
+++ b/chapter14/BitsAndPizzas/app/src/main/res/layout/card_captioned_image.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/chapter14/BitsAndPizzas/app/src/main/res/layout/fragment_pizza_material.xml b/chapter14/BitsAndPizzas/app/src/main/res/layout/fragment_pizza_material.xml
new file mode 100644
index 0000000..265f139
--- /dev/null
+++ b/chapter14/BitsAndPizzas/app/src/main/res/layout/fragment_pizza_material.xml
@@ -0,0 +1,7 @@
+
+
diff --git a/chapter14/BitsAndPizzas/app/src/main/res/layout/fragment_top.xml b/chapter14/BitsAndPizzas/app/src/main/res/layout/fragment_top.xml
new file mode 100644
index 0000000..bb34136
--- /dev/null
+++ b/chapter14/BitsAndPizzas/app/src/main/res/layout/fragment_top.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
diff --git a/chapter14/BitsAndPizzas/app/src/main/res/menu/menu_main.xml b/chapter14/BitsAndPizzas/app/src/main/res/menu/menu_main.xml
new file mode 100644
index 0000000..aee6964
--- /dev/null
+++ b/chapter14/BitsAndPizzas/app/src/main/res/menu/menu_main.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
diff --git a/chapter14/BitsAndPizzas/app/src/main/res/menu/menu_order.xml b/chapter14/BitsAndPizzas/app/src/main/res/menu/menu_order.xml
new file mode 100644
index 0000000..fd5454a
--- /dev/null
+++ b/chapter14/BitsAndPizzas/app/src/main/res/menu/menu_order.xml
@@ -0,0 +1,7 @@
+
+
+
diff --git a/chapter14/BitsAndPizzas/app/src/main/res/menu/menu_pizza_detail.xml b/chapter14/BitsAndPizzas/app/src/main/res/menu/menu_pizza_detail.xml
new file mode 100644
index 0000000..4a797fd
--- /dev/null
+++ b/chapter14/BitsAndPizzas/app/src/main/res/menu/menu_pizza_detail.xml
@@ -0,0 +1,7 @@
+
+
+
diff --git a/chapter14/BitsAndPizzas/app/src/main/res/mipmap-hdpi/ic_launcher.png b/chapter14/BitsAndPizzas/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..cde69bc
Binary files /dev/null and b/chapter14/BitsAndPizzas/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/chapter14/BitsAndPizzas/app/src/main/res/mipmap-mdpi/ic_launcher.png b/chapter14/BitsAndPizzas/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..c133a0c
Binary files /dev/null and b/chapter14/BitsAndPizzas/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/chapter14/BitsAndPizzas/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/chapter14/BitsAndPizzas/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..bfa42f0
Binary files /dev/null and b/chapter14/BitsAndPizzas/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/chapter14/BitsAndPizzas/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/chapter14/BitsAndPizzas/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..324e72c
Binary files /dev/null and b/chapter14/BitsAndPizzas/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/chapter14/BitsAndPizzas/app/src/main/res/values-v21/styles.xml b/chapter14/BitsAndPizzas/app/src/main/res/values-v21/styles.xml
new file mode 100644
index 0000000..be7431d
--- /dev/null
+++ b/chapter14/BitsAndPizzas/app/src/main/res/values-v21/styles.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
diff --git a/chapter14/BitsAndPizzas/app/src/main/res/values-w820dp/dimens.xml b/chapter14/BitsAndPizzas/app/src/main/res/values-w820dp/dimens.xml
new file mode 100644
index 0000000..63fc816
--- /dev/null
+++ b/chapter14/BitsAndPizzas/app/src/main/res/values-w820dp/dimens.xml
@@ -0,0 +1,6 @@
+
+
+ 64dp
+
diff --git a/chapter14/BitsAndPizzas/app/src/main/res/values/dimens.xml b/chapter14/BitsAndPizzas/app/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..47c8224
--- /dev/null
+++ b/chapter14/BitsAndPizzas/app/src/main/res/values/dimens.xml
@@ -0,0 +1,5 @@
+
+
+ 16dp
+ 16dp
+
diff --git a/chapter14/BitsAndPizzas/app/src/main/res/values/strings.xml b/chapter14/BitsAndPizzas/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..bbd7b5c
--- /dev/null
+++ b/chapter14/BitsAndPizzas/app/src/main/res/values/strings.xml
@@ -0,0 +1,36 @@
+
+ Bits And Pizzas
+
+ Hello world!
+ Settings
+ Create Order
+ Order Activity
+ Share
+
+
+ Hello blank fragment
+ Top fragment
+
+ - Diavolo
+ - Funghi
+
+
+ - Spaghetti Bolognese
+ - Lasagne
+
+
+ - Cambridge
+ - Sebastopol
+
+
+ - Home
+ - Pizzas
+ - Pasta
+ - Stores
+
+ Open drawer
+ Close drawer
+ Pizza Detail
+ We offer a range of freshly baked pizza and pasta
+ dishes. Why not try some?
+
diff --git a/chapter14/BitsAndPizzas/app/src/main/res/values/styles.xml b/chapter14/BitsAndPizzas/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..e0c5aae
--- /dev/null
+++ b/chapter14/BitsAndPizzas/app/src/main/res/values/styles.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
diff --git a/chapter14/BitsAndPizzas/build.gradle b/chapter14/BitsAndPizzas/build.gradle
new file mode 100644
index 0000000..ea98e44
--- /dev/null
+++ b/chapter14/BitsAndPizzas/build.gradle
@@ -0,0 +1,19 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+ repositories {
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:2.3.2'
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ jcenter()
+ }
+}
diff --git a/chapter14/BitsAndPizzas/gradle.properties b/chapter14/BitsAndPizzas/gradle.properties
new file mode 100644
index 0000000..1d3591c
--- /dev/null
+++ b/chapter14/BitsAndPizzas/gradle.properties
@@ -0,0 +1,18 @@
+# Project-wide Gradle settings.
+
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+# Default value: -Xmx10248m -XX:MaxPermSize=256m
+# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
+
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
\ No newline at end of file
diff --git a/chapter14/BitsAndPizzas/gradle/wrapper/gradle-wrapper.jar b/chapter14/BitsAndPizzas/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..8c0fb64
Binary files /dev/null and b/chapter14/BitsAndPizzas/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/chapter14/BitsAndPizzas/gradle/wrapper/gradle-wrapper.properties b/chapter14/BitsAndPizzas/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..6b2f827
--- /dev/null
+++ b/chapter14/BitsAndPizzas/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Tue May 23 19:50:17 BST 2017
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
diff --git a/chapter14/BitsAndPizzas/gradlew b/chapter14/BitsAndPizzas/gradlew
new file mode 100755
index 0000000..91a7e26
--- /dev/null
+++ b/chapter14/BitsAndPizzas/gradlew
@@ -0,0 +1,164 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched.
+if $cygwin ; then
+ [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+fi
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >&-
+APP_HOME="`pwd -P`"
+cd "$SAVED" >&-
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/chapter14/BitsAndPizzas/gradlew.bat b/chapter14/BitsAndPizzas/gradlew.bat
new file mode 100644
index 0000000..aec9973
--- /dev/null
+++ b/chapter14/BitsAndPizzas/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/chapter14/BitsAndPizzas/settings.gradle b/chapter14/BitsAndPizzas/settings.gradle
new file mode 100644
index 0000000..e7b4def
--- /dev/null
+++ b/chapter14/BitsAndPizzas/settings.gradle
@@ -0,0 +1 @@
+include ':app'