diff --git a/.gitignore b/.gitignore
index e8d0311..720f2a7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,10 @@
-/.metadata
+.DS_*
+.checkstyle
+.classpath
+.project
+.settings
+.metadata
+bin
+gen
+lint.xml
+
diff --git a/02/FillListTask/.gitignore b/02/FillListTask/.gitignore
deleted file mode 100644
index 3672777..0000000
--- a/02/FillListTask/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-/gen
-/assets
-/eclipse
-/.project
-/.classpath
-/bin
diff --git a/02/FillListTask/default.properties b/02/FillListTask/default.properties
deleted file mode 100644
index bf5e7c2..0000000
--- a/02/FillListTask/default.properties
+++ /dev/null
@@ -1,11 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system use,
-# "build.properties", and override values to adapt the script to your
-# project structure.
-
-# Project target.
-target=Google Inc.:Google APIs:8
diff --git a/02/SharedListTask/.gitignore b/02/SharedListTask/.gitignore
deleted file mode 100644
index 3672777..0000000
--- a/02/SharedListTask/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-/gen
-/assets
-/eclipse
-/.project
-/.classpath
-/bin
diff --git a/02/SharedListTask/default.properties b/02/SharedListTask/default.properties
deleted file mode 100644
index bf5e7c2..0000000
--- a/02/SharedListTask/default.properties
+++ /dev/null
@@ -1,11 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system use,
-# "build.properties", and override values to adapt the script to your
-# project structure.
-
-# Project target.
-target=Google Inc.:Google APIs:8
diff --git a/03/TestApp/.gitignore b/03/TestApp/.gitignore
deleted file mode 100644
index 8b15079..0000000
--- a/03/TestApp/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-/gen
-/assets
-/.project
-/.classpath
-/bin
diff --git a/03/TestApp/default.properties b/03/TestApp/default.properties
deleted file mode 100644
index 088c703..0000000
--- a/03/TestApp/default.properties
+++ /dev/null
@@ -1,11 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system use,
-# "build.properties", and override values to adapt the script to your
-# project structure.
-
-# Project target.
-target=Google Inc.:Google APIs:9
diff --git a/06/AIDLDemo/.gitignore b/06/AIDLDemo/.gitignore
deleted file mode 100644
index 8b15079..0000000
--- a/06/AIDLDemo/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-/gen
-/assets
-/.project
-/.classpath
-/bin
diff --git a/06/AIDLDemo/default.properties b/06/AIDLDemo/default.properties
deleted file mode 100644
index 088c703..0000000
--- a/06/AIDLDemo/default.properties
+++ /dev/null
@@ -1,11 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system use,
-# "build.properties", and override values to adapt the script to your
-# project structure.
-
-# Project target.
-target=Google Inc.:Google APIs:9
diff --git a/06/AIDLDemo/src/com/oreilly/demo/android/ch06/aidl/service/Path.aidl b/06/AIDLDemo/src/com/oreilly/demo/android/ch06/aidl/service/Path.aidl
deleted file mode 100644
index 934e604..0000000
--- a/06/AIDLDemo/src/com/oreilly/demo/android/ch06/aidl/service/Path.aidl
+++ /dev/null
@@ -1,3 +0,0 @@
-package com.oreilly.demo.android.ch06.aidl.service;
-
-parcelable Path;
diff --git a/06/AsyncTaskDemo/.gitignore b/06/AsyncTaskDemo/.gitignore
deleted file mode 100644
index 8b15079..0000000
--- a/06/AsyncTaskDemo/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-/gen
-/assets
-/.project
-/.classpath
-/bin
diff --git a/06/AsyncTaskDemo/default.properties b/06/AsyncTaskDemo/default.properties
deleted file mode 100644
index 088c703..0000000
--- a/06/AsyncTaskDemo/default.properties
+++ /dev/null
@@ -1,11 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system use,
-# "build.properties", and override values to adapt the script to your
-# project structure.
-
-# Project target.
-target=Google Inc.:Google APIs:9
diff --git a/06/JSerializable/.gitignore b/06/JSerializable/.gitignore
deleted file mode 100644
index 8b15079..0000000
--- a/06/JSerializable/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-/gen
-/assets
-/.project
-/.classpath
-/bin
diff --git a/06/JSerializable/default.properties b/06/JSerializable/default.properties
deleted file mode 100644
index 088c703..0000000
--- a/06/JSerializable/default.properties
+++ /dev/null
@@ -1,11 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system use,
-# "build.properties", and override values to adapt the script to your
-# project structure.
-
-# Project target.
-target=Google Inc.:Google APIs:9
diff --git a/06/JSerializable/res/layout/main.xml b/06/JSerializable/res/layout/main.xml
deleted file mode 100644
index 3a5f117..0000000
--- a/06/JSerializable/res/layout/main.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
diff --git a/07/AndroidUIDemo/.gitignore b/07/AndroidUIDemo/.gitignore
deleted file mode 100644
index 8b15079..0000000
--- a/07/AndroidUIDemo/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-/gen
-/assets
-/.project
-/.classpath
-/bin
diff --git a/07/AndroidUIDemo/AndroidManifest.xml b/07/AndroidUIDemo/AndroidManifest.xml
deleted file mode 100755
index f9e8dbc..0000000
--- a/07/AndroidUIDemo/AndroidManifest.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/07/AndroidUIDemo/default.properties b/07/AndroidUIDemo/default.properties
deleted file mode 100755
index ca9c762..0000000
--- a/07/AndroidUIDemo/default.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system use,
-# "build.properties", and override values to adapt the script to your
-# project structure.
-
-# apk configurations. This property allows creation of APK files with limited
-# resources. For example, if your application contains many locales and
-# you wish to release multiple smaller apks instead of a large one, you can
-# define configuration to create apks with limited language sets.
-# Format is a comma separated list of configuration names. For each
-# configuration, a property will declare the resource configurations to
-# include. Example:
-# apk-configurations=european,northamerica
-# apk-config-european=en,fr,it,de,es
-# apk-config-northamerica=en,es
-apk-configurations=
-# Project target.
-target=Google Inc.:Google APIs:9
diff --git a/07/AndroidUIDemo/res/values/colors.xml b/07/AndroidUIDemo/res/values/colors.xml
deleted file mode 100644
index 1a19fa5..0000000
--- a/07/AndroidUIDemo/res/values/colors.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
- #ffff0000
- #ff00ff00
- #dddddd
- #999999
- #666666
-
diff --git a/08/SimpleFragment/.gitignore b/08/SimpleFragment/.gitignore
deleted file mode 100644
index 8b15079..0000000
--- a/08/SimpleFragment/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-/gen
-/assets
-/.project
-/.classpath
-/bin
diff --git a/09/AndroidViewDemo/.gitignore b/09/AndroidViewDemo/.gitignore
deleted file mode 100644
index 8b15079..0000000
--- a/09/AndroidViewDemo/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-/gen
-/assets
-/.project
-/.classpath
-/bin
diff --git a/09/AndroidViewDemo/AndroidManifest.xml b/09/AndroidViewDemo/AndroidManifest.xml
deleted file mode 100644
index 348b20e..0000000
--- a/09/AndroidViewDemo/AndroidManifest.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/09/AndroidViewDemo/default.properties b/09/AndroidViewDemo/default.properties
deleted file mode 100644
index ca9c762..0000000
--- a/09/AndroidViewDemo/default.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system use,
-# "build.properties", and override values to adapt the script to your
-# project structure.
-
-# apk configurations. This property allows creation of APK files with limited
-# resources. For example, if your application contains many locales and
-# you wish to release multiple smaller apks instead of a large one, you can
-# define configuration to create apks with limited language sets.
-# Format is a comma separated list of configuration names. For each
-# configuration, a property will declare the resource configurations to
-# include. Example:
-# apk-configurations=european,northamerica
-# apk-config-european=en,fr,it,de,es
-# apk-config-northamerica=en,es
-apk-configurations=
-# Project target.
-target=Google Inc.:Google APIs:9
diff --git a/10/MicroJobs/.gitignore b/10/MicroJobs/.gitignore
deleted file mode 100644
index 8b15079..0000000
--- a/10/MicroJobs/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-/gen
-/assets
-/.project
-/.classpath
-/bin
diff --git a/10/MicroJobs/default.properties b/10/MicroJobs/default.properties
deleted file mode 100644
index 088c703..0000000
--- a/10/MicroJobs/default.properties
+++ /dev/null
@@ -1,11 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system use,
-# "build.properties", and override values to adapt the script to your
-# project structure.
-
-# Project target.
-target=Google Inc.:Google APIs:9
diff --git a/10/MicroJobs/tools/ide/eclipse/classpath b/10/MicroJobs/tools/ide/eclipse/classpath
deleted file mode 100644
index 609aa00..0000000
--- a/10/MicroJobs/tools/ide/eclipse/classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/11/FinchLifecycle/.gitignore b/11/FinchLifecycle/.gitignore
deleted file mode 100644
index 8b15079..0000000
--- a/11/FinchLifecycle/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-/gen
-/assets
-/.project
-/.classpath
-/bin
diff --git a/11/FinchLifecycle/tools/ide/eclipse/classpath b/11/FinchLifecycle/tools/ide/eclipse/classpath
deleted file mode 100644
index 609aa00..0000000
--- a/11/FinchLifecycle/tools/ide/eclipse/classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/11/FinchLifecycleBackport/.gitignore b/11/FinchLifecycleBackport/.gitignore
deleted file mode 100644
index 8b15079..0000000
--- a/11/FinchLifecycleBackport/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-/gen
-/assets
-/.project
-/.classpath
-/bin
diff --git a/11/FinchLifecycleBackport/tools/ide/eclipse/classpath b/11/FinchLifecycleBackport/tools/ide/eclipse/classpath
deleted file mode 100644
index ccf8f2c..0000000
--- a/11/FinchLifecycleBackport/tools/ide/eclipse/classpath
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/12/FinchVideo/.gitignore b/12/FinchVideo/.gitignore
deleted file mode 100644
index 8b15079..0000000
--- a/12/FinchVideo/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-/gen
-/assets
-/.project
-/.classpath
-/bin
diff --git a/12/FinchVideo/AndroidManifest.xml b/12/FinchVideo/AndroidManifest.xml
deleted file mode 100644
index 8d7cdf9..0000000
--- a/12/FinchVideo/AndroidManifest.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/12/FinchVideo/README.txt b/12/FinchVideo/README.txt
deleted file mode 100644
index 9cab5e5..0000000
--- a/12/FinchVideo/README.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-
-Probably the simplest way to set up this project is to use the project and
-classpath files in the tools/ide/eclipse folders. The more complete description
-is that need to set up the Finch Framework project
-($root/finch/framework/FinchFramework). You need to be sure that the directory
-lib-src is on the build path. You will also need to set up FinchWelcome as a library:
-
-1) import FinchWelcome into your workspace
-2) for FinchWelcome, check Properties > Android and verify that it is
- a library project (bottom half of the dialog)
-3) in the project, use Android > Properties to add that project
- to this one, as a library
-
-Using the normal eclipse project dependency mechanism will not work.
-
diff --git a/12/FinchVideo/default.properties b/12/FinchVideo/default.properties
deleted file mode 100644
index 154b673..0000000
--- a/12/FinchVideo/default.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system use,
-# "build.properties", and override values to adapt the script to your
-# project structure.
-
-# Project target.
-target=Google Inc.:Google APIs:9
-android.library.reference.1=../../framework/FinchFramework
-android.library=false
diff --git a/12/FinchVideo/local.properties b/12/FinchVideo/local.properties
deleted file mode 100644
index 9370052..0000000
--- a/12/FinchVideo/local.properties
+++ /dev/null
@@ -1,10 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must *NOT* be checked in Version Control Systems,
-# as it contains information specific to your local configuration.
-
-# location of the SDK. This is only used by Ant
-# For customization when using a Version Control System, please read the
-# header note.
-sdk.dir=/Applications/Android/android-sdk-mac
diff --git a/12/FinchVideo/res/layout/simple_video_activity.xml b/12/FinchVideo/res/layout/simple_video_activity.xml
deleted file mode 100644
index 9c27be6..0000000
--- a/12/FinchVideo/res/layout/simple_video_activity.xml
+++ /dev/null
@@ -1,96 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/12/FinchVideo/res/layout/simple_video_list_item.xml b/12/FinchVideo/res/layout/simple_video_list_item.xml
deleted file mode 100644
index 82be2a3..0000000
--- a/12/FinchVideo/res/layout/simple_video_list_item.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/12/FinchVideo/src/com/oreilly/demo/pa/finchvideo/Ch12.java b/12/FinchVideo/src/com/oreilly/demo/pa/finchvideo/Ch12.java
deleted file mode 100644
index 9a1b98b..0000000
--- a/12/FinchVideo/src/com/oreilly/demo/pa/finchvideo/Ch12.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package com.oreilly.demo.pa.finchvideo;
-
-public class Ch12 {
- public static final String LOG_TAG = "finch.finchvideo";
-}
diff --git a/12/FinchVideo/src/com/oreilly/demo/pa/finchvideo/FinchVideoActivity.java b/12/FinchVideo/src/com/oreilly/demo/pa/finchvideo/FinchVideoActivity.java
deleted file mode 100644
index a051c3d..0000000
--- a/12/FinchVideo/src/com/oreilly/demo/pa/finchvideo/FinchVideoActivity.java
+++ /dev/null
@@ -1,151 +0,0 @@
-package com.oreilly.demo.pa.finchvideo;
-
-import android.app.Activity;
-import android.content.ContentUris;
-import android.content.res.Resources;
-import android.database.Cursor;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.net.Uri;
-import android.os.Bundle;
-import android.util.Log;
-import android.view.KeyEvent;
-import android.view.View;
-import android.widget.EditText;
-import android.widget.ImageButton;
-import android.widget.ImageView;
-import android.widget.ListView;
-import android.widget.SimpleCursorAdapter;
-import android.widget.TextView;
-import com.finchframework.finch.Finch;
-import com.finchframework.finch.views.MesgEditText;
-import com.oreilly.demo.pa.finchvideo.provider.FinchVideo;
-
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-
-/**
- * Slightly more sophisticated FinchVideo search application that allows a user
- * to type a search query and see network results update as they are received
- * from RESTful web services like gdata.youtube.com. The results appear one by
- * one in the graphical list display as they are parsed from network data.
- */
-public class FinchVideoActivity extends Activity {
- SimpleCursorAdapter mAdapter;
-
- private MesgEditText mSearchText;
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.video_query_activity);
- Resources r = getResources();
-
- final ListView searchList = (ListView) findViewById(R.id.video_list);
- Cursor videoCursor =
- managedQuery(FinchVideo.Videos.CONTENT_URI, null,
- null, null, null);
-
- // have to reset this on a new search
-
- // Maps video entries from the database to views
- mAdapter = new SimpleCursorAdapter(this,
- R.layout.video_list_item,
- videoCursor,
- new String[] {
- FinchVideo.Videos.TITLE,
- FinchVideo.Videos.THUMB_URI_NAME
- },
- new int[] { R.id.video_text, R.id.video_thumb_icon });
-
- SimpleCursorAdapter.ViewBinder savb =
- new SimpleCursorAdapter.ViewBinder() {
- @Override
- public boolean setViewValue(View view, Cursor cursor, int i) {
- switch (i) {
- case FinchVideo.TITLE_COLUMN:
- TextView tv = (TextView)
- view.findViewById(R.id.video_text);
- String videoText = cursor.getString(i);
- tv.setText(videoText);
-
- break;
- case FinchVideo.THUMB_URI_COLUMN:
- setThumbResource(view, cursor);
- break;
- }
-
- return true;
- }
- };
-
- mAdapter.setViewBinder(savb);
-
- searchList.setAdapter(mAdapter);
-
- mSearchText = (MesgEditText) findViewById(R.id.video_search_box);
- mSearchText.setMesgText(r.getString(R.string.finch_video_search));
- mSearchText.setOnEditorActionListener(
- new EditText.OnEditorActionListener() {
- @Override
- public boolean onEditorAction(TextView textView,
- int actionId,
- KeyEvent keyEvent)
- {
- // a null key event observed on some devices
- if (null != keyEvent) {
- int keyCode = keyEvent.getKeyCode();
- if ((keyCode == KeyEvent.KEYCODE_ENTER) &&
- (keyEvent.getAction() ==
- KeyEvent.ACTION_DOWN))
- {
- // action only causes the provider to ensure
- // the presence of some search results.
- query();
-
- return true;
- }
- }
- return false;
- }
- });
-
- final ImageButton refreshButton = (ImageButton)
- findViewById(R.id.video_update_button);
- refreshButton.setOnClickListener(new View.OnClickListener() {
- @Override public void onClick(View view) { query(); }
- });
- refreshButton.setFocusable(true);
- }
-
- void setThumbResource(View view, Cursor cursor) {
- Uri thumbUri = ContentUris.
- withAppendedId(FinchVideo.Videos.THUMB_URI,
- cursor.getLong(FinchVideo.ID_COLUMN));
- try {
- InputStream thumbStream =
- getContentResolver().openInputStream(thumbUri);
- ImageView iv = (ImageView)
- view.findViewById(R.id.video_thumb_icon);
- Bitmap bm = BitmapFactory.decodeStream(thumbStream);
- iv.setImageBitmap(bm);
-
- } catch (FileNotFoundException e) {
- Log.d(Finch.LOG_TAG, "could not open provider thumb: ", e);
- }
- }
-
- // sends the query to the finch video content provider
- void query() {
- if (!mSearchText.searchEmpty()) {
- String queryString =
- FinchVideo.Videos.QUERY_PARAM_NAME + "=" +
- Uri.encode(mSearchText.getText().toString());
- Uri queryUri =
- Uri.parse(FinchVideo.Videos.CONTENT_URI + "?" +
- queryString);
- Cursor c = managedQuery(queryUri, null, null, null, null);
- mAdapter.changeCursor(c);
- }
- }
-}
diff --git a/12/FinchVideo/tools/ide/eclipse/classpath b/12/FinchVideo/tools/ide/eclipse/classpath
deleted file mode 100644
index fcd4b56..0000000
--- a/12/FinchVideo/tools/ide/eclipse/classpath
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/13/README b/13/README
deleted file mode 100644
index 4660504..0000000
--- a/13/README
+++ /dev/null
@@ -1,3 +0,0 @@
-
-Chapter 13 uses the code from Chapter 12.
-
diff --git a/14/AudioPlayer/.gitignore b/14/AudioPlayer/.gitignore
deleted file mode 100644
index 8b15079..0000000
--- a/14/AudioPlayer/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-/gen
-/assets
-/.project
-/.classpath
-/bin
diff --git a/14/AudioPlayer/README.txt b/14/AudioPlayer/README.txt
deleted file mode 100644
index 2e843ef..0000000
--- a/14/AudioPlayer/README.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-This example must be run on actual hardware (not an emulator)
-as this contains hardware specific code.
-
-
-(This was tested on a Nexus One and Nexus S phones)
diff --git a/14/AudioPlayer/default.properties b/14/AudioPlayer/default.properties
deleted file mode 100644
index 088c703..0000000
--- a/14/AudioPlayer/default.properties
+++ /dev/null
@@ -1,11 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system use,
-# "build.properties", and override values to adapt the script to your
-# project structure.
-
-# Project target.
-target=Google Inc.:Google APIs:9
diff --git a/14/AudioPlayer/res/layout/videoplayer.xml b/14/AudioPlayer/res/layout/videoplayer.xml
deleted file mode 100644
index cd578bf..0000000
--- a/14/AudioPlayer/res/layout/videoplayer.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
diff --git a/14/AudioPlayer/tools/ide/eclipse/classpath b/14/AudioPlayer/tools/ide/eclipse/classpath
deleted file mode 100644
index 609aa00..0000000
--- a/14/AudioPlayer/tools/ide/eclipse/classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/14/AudioPlayer/tools/ide/eclipse/settings/org.eclipse.jdt.core.prefs b/14/AudioPlayer/tools/ide/eclipse/settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 2e00a60..0000000
--- a/14/AudioPlayer/tools/ide/eclipse/settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,5 +0,0 @@
-#Wed Sep 15 18:54:11 EDT 2010
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.source=1.5
diff --git a/16/SensorDemos/.gitignore b/16/SensorDemos/.gitignore
deleted file mode 100644
index 8b15079..0000000
--- a/16/SensorDemos/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-/gen
-/assets
-/.project
-/.classpath
-/bin
diff --git a/16/SensorDemos/res/layout/gestureadd.xml b/16/SensorDemos/res/layout/gestureadd.xml
deleted file mode 100644
index 89eab88..0000000
--- a/16/SensorDemos/res/layout/gestureadd.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/16/SensorDemos/res/layout/nfc233.xml b/16/SensorDemos/res/layout/nfc233.xml
deleted file mode 100644
index 3468f18..0000000
--- a/16/SensorDemos/res/layout/nfc233.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/16/SensorDemos/res/layout/sensoraccel.xml b/16/SensorDemos/res/layout/sensoraccel.xml
deleted file mode 100644
index 3cca0a9..0000000
--- a/16/SensorDemos/res/layout/sensoraccel.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
diff --git a/16/SensorDemos/res/layout/sensorgravity.xml b/16/SensorDemos/res/layout/sensorgravity.xml
deleted file mode 100644
index e0d1847..0000000
--- a/16/SensorDemos/res/layout/sensorgravity.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
diff --git a/16/SensorDemos/res/layout/sensorlight.xml b/16/SensorDemos/res/layout/sensorlight.xml
deleted file mode 100644
index f735313..0000000
--- a/16/SensorDemos/res/layout/sensorlight.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
diff --git a/16/SensorDemos/res/layout/sensorlinearacel.xml b/16/SensorDemos/res/layout/sensorlinearacel.xml
deleted file mode 100644
index 1a002e5..0000000
--- a/16/SensorDemos/res/layout/sensorlinearacel.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
diff --git a/16/SensorDemos/res/layout/sensormagnetic.xml b/16/SensorDemos/res/layout/sensormagnetic.xml
deleted file mode 100644
index fa0da33..0000000
--- a/16/SensorDemos/res/layout/sensormagnetic.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
diff --git a/16/SensorDemos/res/layout/sensorpressure.xml b/16/SensorDemos/res/layout/sensorpressure.xml
deleted file mode 100644
index 9eab644..0000000
--- a/16/SensorDemos/res/layout/sensorpressure.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
diff --git a/16/SensorDemos/res/layout/sensorproximity.xml b/16/SensorDemos/res/layout/sensorproximity.xml
deleted file mode 100644
index d1c8c2e..0000000
--- a/16/SensorDemos/res/layout/sensorproximity.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
diff --git a/16/SensorDemos/res/layout/sensorrotationvector.xml b/16/SensorDemos/res/layout/sensorrotationvector.xml
deleted file mode 100644
index 4fb06a7..0000000
--- a/16/SensorDemos/res/layout/sensorrotationvector.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
diff --git a/16/SensorDemos/res/layout/sensortemp.xml b/16/SensorDemos/res/layout/sensortemp.xml
deleted file mode 100644
index dc96074..0000000
--- a/16/SensorDemos/res/layout/sensortemp.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
diff --git a/16/SensorDemos/tools/ide/eclipse/classpath b/16/SensorDemos/tools/ide/eclipse/classpath
deleted file mode 100644
index 609aa00..0000000
--- a/16/SensorDemos/tools/ide/eclipse/classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/17/ClientDemo/.gitignore b/17/ClientDemo/.gitignore
deleted file mode 100644
index 8b15079..0000000
--- a/17/ClientDemo/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-/gen
-/assets
-/.project
-/.classpath
-/bin
diff --git a/17/ClientDemo/proguard.cfg b/17/ClientDemo/proguard.cfg
deleted file mode 100644
index 8ad7d33..0000000
--- a/17/ClientDemo/proguard.cfg
+++ /dev/null
@@ -1,34 +0,0 @@
--optimizationpasses 5
--dontusemixedcaseclassnames
--dontskipnonpubliclibraryclasses
--dontpreverify
--verbose
--optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-
--keep public class * extends android.app.Activity
--keep public class * extends android.app.Application
--keep public class * extends android.app.Service
--keep public class * extends android.content.BroadcastReceiver
--keep public class * extends android.content.ContentProvider
--keep public class com.android.vending.licensing.ILicensingService
-
--keepclasseswithmembernames class * {
- native ;
-}
-
--keepclasseswithmembernames class * {
- public (android.content.Context, android.util.AttributeSet);
-}
-
--keepclasseswithmembernames class * {
- public (android.content.Context, android.util.AttributeSet, int);
-}
-
--keepclassmembers enum * {
- public static **[] values();
- public static ** valueOf(java.lang.String);
-}
-
--keep class * implements android.os.Parcelable {
- public static final android.os.Parcelable$Creator *;
-}
diff --git a/17/ClientDemo/res/layout/accountadd.xml b/17/ClientDemo/res/layout/accountadd.xml
deleted file mode 100644
index 1c24cae..0000000
--- a/17/ClientDemo/res/layout/accountadd.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-
-
-
-
diff --git a/17/ClientDemo/res/layout/settings.xml b/17/ClientDemo/res/layout/settings.xml
deleted file mode 100644
index 5dd9480..0000000
--- a/17/ClientDemo/res/layout/settings.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/17/ClientDemo/tools/ide/eclipse/classpath b/17/ClientDemo/tools/ide/eclipse/classpath
deleted file mode 100644
index 609aa00..0000000
--- a/17/ClientDemo/tools/ide/eclipse/classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/17/DemoServer/.gitignore b/17/DemoServer/.gitignore
deleted file mode 100644
index 8b15079..0000000
--- a/17/DemoServer/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-/gen
-/assets
-/.project
-/.classpath
-/bin
diff --git a/17/DemoServer/config/Config.json b/17/DemoServer/config/Config.json
deleted file mode 100644
index d8e42d0..0000000
--- a/17/DemoServer/config/Config.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "debug" : true,
- "httpservletport" : 8080,
- "httpservlets" : [
- "com.oreilly.demo.pa.ch17.server.servlet.LoginServlet",
- "com.oreilly.demo.pa.ch17.server.servlet.GetFriendsServlet",
- "com.oreilly.demo.pa.ch17.server.servlet.AddFriendServlet",
- "com.oreilly.demo.pa.ch17.server.servlet.DeleteFriendServlet",
- "com.oreilly.demo.pa.ch17.server.servlet.AddUserServlet"
- ],
- "userdata" : "config/UsersDB.json"
-}
diff --git a/18/NDKDemo/.gitignore b/18/NDKDemo/.gitignore
deleted file mode 100644
index 8b15079..0000000
--- a/18/NDKDemo/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-/gen
-/assets
-/.project
-/.classpath
-/bin
diff --git a/18/NDKDemo/README.txt b/18/NDKDemo/README.txt
deleted file mode 100644
index 868143f..0000000
--- a/18/NDKDemo/README.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-This example must be run on actual hardware (not an emulator)
-as this contains hardware specific code.
-
-
-(This was tested on a Nexus One and Nexus S phones)
diff --git a/18/NDKDemo/proguard.cfg b/18/NDKDemo/proguard.cfg
deleted file mode 100644
index 8ad7d33..0000000
--- a/18/NDKDemo/proguard.cfg
+++ /dev/null
@@ -1,34 +0,0 @@
--optimizationpasses 5
--dontusemixedcaseclassnames
--dontskipnonpubliclibraryclasses
--dontpreverify
--verbose
--optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-
--keep public class * extends android.app.Activity
--keep public class * extends android.app.Application
--keep public class * extends android.app.Service
--keep public class * extends android.content.BroadcastReceiver
--keep public class * extends android.content.ContentProvider
--keep public class com.android.vending.licensing.ILicensingService
-
--keepclasseswithmembernames class * {
- native ;
-}
-
--keepclasseswithmembernames class * {
- public (android.content.Context, android.util.AttributeSet);
-}
-
--keepclasseswithmembernames class * {
- public (android.content.Context, android.util.AttributeSet, int);
-}
-
--keepclassmembers enum * {
- public static **[] values();
- public static ** valueOf(java.lang.String);
-}
-
--keep class * implements android.os.Parcelable {
- public static final android.os.Parcelable$Creator *;
-}
diff --git a/18/NDKDemo/tools/ide/eclipse/classpath b/18/NDKDemo/tools/ide/eclipse/classpath
deleted file mode 100644
index 609aa00..0000000
--- a/18/NDKDemo/tools/ide/eclipse/classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/06/AIDLDemo/AndroidManifest.xml b/AIDLDemo/AndroidManifest.xml
similarity index 64%
rename from 06/AIDLDemo/AndroidManifest.xml
rename to AIDLDemo/AndroidManifest.xml
index 6a1ca0d..fbbc444 100644
--- a/06/AIDLDemo/AndroidManifest.xml
+++ b/AIDLDemo/AndroidManifest.xml
@@ -1,8 +1,8 @@
-
+ android:versionName="1.0" package="com.oreilly.demo.android.pa.aidl">
+
@@ -10,9 +10,9 @@
-
+
-
+
diff --git a/11/FinchLifecycle/proguard.cfg b/AIDLDemo/proguard.cfg
similarity index 86%
rename from 11/FinchLifecycle/proguard.cfg
rename to AIDLDemo/proguard.cfg
index 12dd039..b1cdf17 100644
--- a/11/FinchLifecycle/proguard.cfg
+++ b/AIDLDemo/proguard.cfg
@@ -18,14 +18,18 @@
native ;
}
--keepclasseswithmembernames class * {
+-keepclasseswithmembers class * {
public (android.content.Context, android.util.AttributeSet);
}
--keepclasseswithmembernames class * {
+-keepclasseswithmembers class * {
public (android.content.Context, android.util.AttributeSet, int);
}
+-keepclassmembers class * extends android.app.Activity {
+ public void *(android.view.View);
+}
+
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
diff --git a/11/FinchLifecycle/default.properties b/AIDLDemo/project.properties
similarity index 75%
rename from 11/FinchLifecycle/default.properties
rename to AIDLDemo/project.properties
index d1cacf1..8da376a 100644
--- a/11/FinchLifecycle/default.properties
+++ b/AIDLDemo/project.properties
@@ -4,8 +4,8 @@
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
-# "build.properties", and override values to adapt the script to your
+# "ant.properties", and override values to adapt the script to your
# project structure.
# Project target.
-target=android-11
+target=android-15
diff --git a/06/AIDLDemo/res/drawable-hdpi/icon.png b/AIDLDemo/res/drawable-hdpi/icon.png
similarity index 100%
rename from 06/AIDLDemo/res/drawable-hdpi/icon.png
rename to AIDLDemo/res/drawable-hdpi/icon.png
diff --git a/06/AIDLDemo/res/drawable-ldpi/icon.png b/AIDLDemo/res/drawable-ldpi/icon.png
similarity index 100%
rename from 06/AIDLDemo/res/drawable-ldpi/icon.png
rename to AIDLDemo/res/drawable-ldpi/icon.png
diff --git a/06/AIDLDemo/res/drawable-mdpi/icon.png b/AIDLDemo/res/drawable-mdpi/icon.png
similarity index 100%
rename from 06/AIDLDemo/res/drawable-mdpi/icon.png
rename to AIDLDemo/res/drawable-mdpi/icon.png
diff --git a/06/AIDLDemo/res/layout/main.xml b/AIDLDemo/res/layout/main.xml
similarity index 70%
rename from 06/AIDLDemo/res/layout/main.xml
rename to AIDLDemo/res/layout/main.xml
index dcddcd7..3117038 100644
--- a/06/AIDLDemo/res/layout/main.xml
+++ b/AIDLDemo/res/layout/main.xml
@@ -1,12 +1,12 @@
diff --git a/06/AIDLDemo/res/values/strings.xml b/AIDLDemo/res/values/strings.xml
similarity index 100%
rename from 06/AIDLDemo/res/values/strings.xml
rename to AIDLDemo/res/values/strings.xml
diff --git a/06/AIDLDemo/src/com/oreilly/demo/android/ch06/aidl/client/AIDLDemo.java b/AIDLDemo/src/com/oreilly/demo/android/pa/aidl/client/AIDLDemo.java
similarity index 92%
rename from 06/AIDLDemo/src/com/oreilly/demo/android/ch06/aidl/client/AIDLDemo.java
rename to AIDLDemo/src/com/oreilly/demo/android/pa/aidl/client/AIDLDemo.java
index fe0f55b..c6265f7 100644
--- a/06/AIDLDemo/src/com/oreilly/demo/android/ch06/aidl/client/AIDLDemo.java
+++ b/AIDLDemo/src/com/oreilly/demo/android/pa/aidl/client/AIDLDemo.java
@@ -1,4 +1,4 @@
-package com.oreilly.demo.android.ch06.aidl.client;
+package com.oreilly.demo.android.pa.aidl.client;
import java.util.ArrayList;
import java.util.List;
@@ -16,9 +16,9 @@
import android.view.View.OnClickListener;
import android.widget.Button;
-import com.oreilly.demo.android.ch06.aidl.R;
-import com.oreilly.demo.android.ch06.aidl.parcelables.ParcelableList;
-import com.oreilly.demo.android.ch06.aidl.service.PathService;
+import com.oreilly.demo.android.pa.aidl.R;
+import com.oreilly.demo.android.pa.aidl.service.PathService;
+import com.oreilly.demo.android.pa.aidl.parcelables.ParcelableList;
/**
diff --git a/06/AIDLDemo/src/com/oreilly/demo/android/ch06/aidl/parcelables/ParcelableList.java b/AIDLDemo/src/com/oreilly/demo/android/pa/aidl/parcelables/ParcelableList.java
similarity index 96%
rename from 06/AIDLDemo/src/com/oreilly/demo/android/ch06/aidl/parcelables/ParcelableList.java
rename to AIDLDemo/src/com/oreilly/demo/android/pa/aidl/parcelables/ParcelableList.java
index 9d6a8ce..93e2967 100644
--- a/06/AIDLDemo/src/com/oreilly/demo/android/ch06/aidl/parcelables/ParcelableList.java
+++ b/AIDLDemo/src/com/oreilly/demo/android/pa/aidl/parcelables/ParcelableList.java
@@ -1,6 +1,6 @@
/* $Id: $
*/
-package com.oreilly.demo.android.ch06.aidl.parcelables;
+package com.oreilly.demo.android.pa.aidl.parcelables;
import java.util.ArrayList;
import java.util.List;
diff --git a/06/AIDLDemo/src/com/oreilly/demo/android/ch06/aidl/parcelables/SimpleParcelable.java b/AIDLDemo/src/com/oreilly/demo/android/pa/aidl/parcelables/SimpleParcelable.java
similarity index 97%
rename from 06/AIDLDemo/src/com/oreilly/demo/android/ch06/aidl/parcelables/SimpleParcelable.java
rename to AIDLDemo/src/com/oreilly/demo/android/pa/aidl/parcelables/SimpleParcelable.java
index e05cd24..caf01fd 100644
--- a/06/AIDLDemo/src/com/oreilly/demo/android/ch06/aidl/parcelables/SimpleParcelable.java
+++ b/AIDLDemo/src/com/oreilly/demo/android/pa/aidl/parcelables/SimpleParcelable.java
@@ -1,6 +1,6 @@
/* $Id: $
*/
-package com.oreilly.demo.android.ch06.aidl.parcelables;
+package com.oreilly.demo.android.pa.aidl.parcelables;
import java.util.Collections;
import java.util.Date;
diff --git a/AIDLDemo/src/com/oreilly/demo/android/pa/aidl/service/Path.aidl b/AIDLDemo/src/com/oreilly/demo/android/pa/aidl/service/Path.aidl
new file mode 100644
index 0000000..e9712f4
--- /dev/null
+++ b/AIDLDemo/src/com/oreilly/demo/android/pa/aidl/service/Path.aidl
@@ -0,0 +1,3 @@
+package com.oreilly.demo.android.pa.aidl.service;
+
+parcelable Path;
diff --git a/06/AIDLDemo/src/com/oreilly/demo/android/ch06/aidl/service/Path.java b/AIDLDemo/src/com/oreilly/demo/android/pa/aidl/service/Path.java
similarity index 97%
rename from 06/AIDLDemo/src/com/oreilly/demo/android/ch06/aidl/service/Path.java
rename to AIDLDemo/src/com/oreilly/demo/android/pa/aidl/service/Path.java
index fa7cff5..ca48ae6 100644
--- a/06/AIDLDemo/src/com/oreilly/demo/android/ch06/aidl/service/Path.java
+++ b/AIDLDemo/src/com/oreilly/demo/android/pa/aidl/service/Path.java
@@ -1,4 +1,4 @@
-package com.oreilly.demo.android.ch06.aidl.service;
+package com.oreilly.demo.android.pa.aidl.service;
import java.util.Collections;
import java.util.LinkedList;
diff --git a/06/AIDLDemo/src/com/oreilly/demo/android/ch06/aidl/service/PathService.aidl b/AIDLDemo/src/com/oreilly/demo/android/pa/aidl/service/PathService.aidl
similarity index 74%
rename from 06/AIDLDemo/src/com/oreilly/demo/android/ch06/aidl/service/PathService.aidl
rename to AIDLDemo/src/com/oreilly/demo/android/pa/aidl/service/PathService.aidl
index 109fa4e..53f4a68 100644
--- a/06/AIDLDemo/src/com/oreilly/demo/android/ch06/aidl/service/PathService.aidl
+++ b/AIDLDemo/src/com/oreilly/demo/android/pa/aidl/service/PathService.aidl
@@ -1,5 +1,5 @@
-package com.oreilly.demo.android.ch06.aidl.service;
+package com.oreilly.demo.android.pa.aidl.service;
interface PathService {
void setPoint(in String name, in String path);
diff --git a/06/AIDLDemo/src/com/oreilly/demo/android/ch06/aidl/service/Point.java b/AIDLDemo/src/com/oreilly/demo/android/pa/aidl/service/Point.java
similarity index 94%
rename from 06/AIDLDemo/src/com/oreilly/demo/android/ch06/aidl/service/Point.java
rename to AIDLDemo/src/com/oreilly/demo/android/pa/aidl/service/Point.java
index 4ab777c..589560a 100644
--- a/06/AIDLDemo/src/com/oreilly/demo/android/ch06/aidl/service/Point.java
+++ b/AIDLDemo/src/com/oreilly/demo/android/pa/aidl/service/Point.java
@@ -1,4 +1,4 @@
-package com.oreilly.demo.android.ch06.aidl.service;
+package com.oreilly.demo.android.pa.aidl.service;
/** A dot: the coordinates, color and size. */
diff --git a/06/AIDLDemo/src/com/oreilly/demo/android/ch06/aidl/service/SimplePathService.java b/AIDLDemo/src/com/oreilly/demo/android/pa/aidl/service/SimplePathService.java
similarity index 93%
rename from 06/AIDLDemo/src/com/oreilly/demo/android/ch06/aidl/service/SimplePathService.java
rename to AIDLDemo/src/com/oreilly/demo/android/pa/aidl/service/SimplePathService.java
index 69013d5..80d8237 100644
--- a/06/AIDLDemo/src/com/oreilly/demo/android/ch06/aidl/service/SimplePathService.java
+++ b/AIDLDemo/src/com/oreilly/demo/android/pa/aidl/service/SimplePathService.java
@@ -1,6 +1,6 @@
/* $Id: $
*/
-package com.oreilly.demo.android.ch06.aidl.service;
+package com.oreilly.demo.android.pa.aidl.service;
import android.app.Service;
import android.content.Intent;
@@ -8,7 +8,7 @@
import android.os.RemoteException;
import android.util.Log;
-import com.oreilly.demo.android.ch06.aidl.service.PathService;
+import com.oreilly.demo.android.pa.aidl.service.PathService;
/**
diff --git a/10/MicroJobs/tools/ant/build.xml b/AIDLDemo/tools/ant/build.xml
similarity index 79%
rename from 10/MicroJobs/tools/ant/build.xml
rename to AIDLDemo/tools/ant/build.xml
index d16869e..ba8b742 100644
--- a/10/MicroJobs/tools/ant/build.xml
+++ b/AIDLDemo/tools/ant/build.xml
@@ -1,5 +1,5 @@
-
+
-
-
-
-
-
-
-
+
+
+
@@ -60,12 +52,15 @@
-->
-
diff --git a/07/AndroidUIDemo/tools/ide/eclipse/classpath b/AIDLDemo/tools/ide/eclipse/classpath
similarity index 63%
rename from 07/AndroidUIDemo/tools/ide/eclipse/classpath
rename to AIDLDemo/tools/ide/eclipse/classpath
index b28e3e6..75d8290 100644
--- a/07/AndroidUIDemo/tools/ide/eclipse/classpath
+++ b/AIDLDemo/tools/ide/eclipse/classpath
@@ -1,7 +1,8 @@
-
-
+
+
+
diff --git a/06/AIDLDemo/tools/ide/eclipse/project b/AIDLDemo/tools/ide/eclipse/project
similarity index 100%
rename from 06/AIDLDemo/tools/ide/eclipse/project
rename to AIDLDemo/tools/ide/eclipse/project
diff --git a/AIDLDemo/tools/ide/eclipse/settings/org.eclipse.jdt.core.prefs b/AIDLDemo/tools/ide/eclipse/settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..a3f9445
--- /dev/null
+++ b/AIDLDemo/tools/ide/eclipse/settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+#Sun Jan 15 16:54:42 PST 2012
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/AndroidUIDemo/AndroidManifest.xml b/AndroidUIDemo/AndroidManifest.xml
new file mode 100755
index 0000000..a08d966
--- /dev/null
+++ b/AndroidUIDemo/AndroidManifest.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/08/SimpleFragment/proguard.cfg b/AndroidUIDemo/proguard.cfg
similarity index 86%
rename from 08/SimpleFragment/proguard.cfg
rename to AndroidUIDemo/proguard.cfg
index 12dd039..b1cdf17 100644
--- a/08/SimpleFragment/proguard.cfg
+++ b/AndroidUIDemo/proguard.cfg
@@ -18,14 +18,18 @@
native ;
}
--keepclasseswithmembernames class * {
+-keepclasseswithmembers class * {
public (android.content.Context, android.util.AttributeSet);
}
--keepclasseswithmembernames class * {
+-keepclasseswithmembers class * {
public (android.content.Context, android.util.AttributeSet, int);
}
+-keepclassmembers class * extends android.app.Activity {
+ public void *(android.view.View);
+}
+
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
diff --git a/17/ClientDemo/default.properties b/AndroidUIDemo/project.properties
similarity index 72%
rename from 17/ClientDemo/default.properties
rename to AndroidUIDemo/project.properties
index 77f7ad7..8da376a 100644
--- a/17/ClientDemo/default.properties
+++ b/AndroidUIDemo/project.properties
@@ -4,8 +4,8 @@
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
-# "build.properties", and override values to adapt the script to your
+# "ant.properties", and override values to adapt the script to your
# project structure.
# Project target.
-target=Google Inc.:Google APIs:9
+target=android-15
diff --git a/06/AsyncTaskDemo/res/drawable-hdpi/icon.png b/AndroidUIDemo/res/drawable-hdpi/icon.png
similarity index 100%
rename from 06/AsyncTaskDemo/res/drawable-hdpi/icon.png
rename to AndroidUIDemo/res/drawable-hdpi/icon.png
diff --git a/AndroidUIDemo/res/drawable-hdpi/trashcan.png b/AndroidUIDemo/res/drawable-hdpi/trashcan.png
new file mode 100644
index 0000000..3c6ca64
Binary files /dev/null and b/AndroidUIDemo/res/drawable-hdpi/trashcan.png differ
diff --git a/06/AsyncTaskDemo/res/drawable-ldpi/icon.png b/AndroidUIDemo/res/drawable-ldpi/icon.png
similarity index 100%
rename from 06/AsyncTaskDemo/res/drawable-ldpi/icon.png
rename to AndroidUIDemo/res/drawable-ldpi/icon.png
diff --git a/AndroidUIDemo/res/drawable-ldpi/trashcan.png b/AndroidUIDemo/res/drawable-ldpi/trashcan.png
new file mode 100644
index 0000000..3c6ca64
Binary files /dev/null and b/AndroidUIDemo/res/drawable-ldpi/trashcan.png differ
diff --git a/06/AsyncTaskDemo/res/drawable-mdpi/icon.png b/AndroidUIDemo/res/drawable-mdpi/icon.png
similarity index 100%
rename from 06/AsyncTaskDemo/res/drawable-mdpi/icon.png
rename to AndroidUIDemo/res/drawable-mdpi/icon.png
diff --git a/07/AndroidUIDemo/res/layout/main.xml b/AndroidUIDemo/res/layout/main.xml
similarity index 58%
rename from 07/AndroidUIDemo/res/layout/main.xml
rename to AndroidUIDemo/res/layout/main.xml
index 30050b5..f4dbf0d 100644
--- a/07/AndroidUIDemo/res/layout/main.xml
+++ b/AndroidUIDemo/res/layout/main.xml
@@ -1,56 +1,65 @@
-
+ android:background="@color/lt_grey"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:baselineAligned="false">
+
+
diff --git a/AndroidUIDemo/res/menu/simple_menu.xml b/AndroidUIDemo/res/menu/simple_menu.xml
new file mode 100644
index 0000000..2f43e20
--- /dev/null
+++ b/AndroidUIDemo/res/menu/simple_menu.xml
@@ -0,0 +1,12 @@
+
+
diff --git a/AndroidUIDemo/res/values/colors.xml b/AndroidUIDemo/res/values/colors.xml
new file mode 100644
index 0000000..e1806dc
--- /dev/null
+++ b/AndroidUIDemo/res/values/colors.xml
@@ -0,0 +1,9 @@
+
+
+ #ffff0000
+ #ff00ff00
+ #dddddd
+ #999999
+ #666666
+ #ffffffff
+
diff --git a/07/AndroidUIDemo/res/values/strings.xml b/AndroidUIDemo/res/values/strings.xml
similarity index 84%
rename from 07/AndroidUIDemo/res/values/strings.xml
rename to AndroidUIDemo/res/values/strings.xml
index 7f66cb2..cd1fb0e 100644
--- a/07/AndroidUIDemo/res/values/strings.xml
+++ b/AndroidUIDemo/res/values/strings.xml
@@ -4,4 +4,5 @@
0
Red
Green
+ Clear
diff --git a/07/AndroidUIDemo/src/com/oreilly/demo/android/ch07/TouchMe.java b/AndroidUIDemo/src/com/oreilly/demo/android/pa/uidemo/TouchMe.java
similarity index 65%
rename from 07/AndroidUIDemo/src/com/oreilly/demo/android/ch07/TouchMe.java
rename to AndroidUIDemo/src/com/oreilly/demo/android/pa/uidemo/TouchMe.java
index 32ef22e..2892565 100644
--- a/07/AndroidUIDemo/src/com/oreilly/demo/android/ch07/TouchMe.java
+++ b/AndroidUIDemo/src/com/oreilly/demo/android/pa/uidemo/TouchMe.java
@@ -1,5 +1,7 @@
-package com.oreilly.demo.android.ch07;
+package com.oreilly.demo.android.pa.uidemo;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Random;
import android.app.Activity;
@@ -17,11 +19,10 @@
import android.view.View.OnKeyListener;
import android.widget.Button;
import android.widget.EditText;
-import android.widget.LinearLayout;
-import com.oreilly.demo.android.ch07.model.Dot;
-import com.oreilly.demo.android.ch07.model.Dots;
-import com.oreilly.demo.android.ch07.view.DotView;
+import com.oreilly.demo.android.pa.uidemo.model.Dot;
+import com.oreilly.demo.android.pa.uidemo.model.Dots;
+import com.oreilly.demo.android.pa.uidemo.view.DotView;
/**
@@ -36,35 +37,57 @@ private static final class TrackingTouchListener
implements View.OnTouchListener
{
private final Dots mDots;
+ private List tracks = new ArrayList();
TrackingTouchListener(Dots dots) { mDots = dots; }
@Override public boolean onTouch(View v, MotionEvent evt) {
- switch (evt.getAction()) {
+ int n;
+ int idx;
+ int action = evt.getAction();
+ switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN:
+ case MotionEvent.ACTION_POINTER_DOWN:
+ idx = (action & MotionEvent.ACTION_POINTER_INDEX_MASK)
+ >> MotionEvent.ACTION_POINTER_INDEX_SHIFT;
+ tracks.add(Integer.valueOf(evt.getPointerId(idx)));
+ break;
+
+ case MotionEvent.ACTION_POINTER_UP:
+ idx = (action & MotionEvent.ACTION_POINTER_INDEX_MASK)
+ >> MotionEvent.ACTION_POINTER_INDEX_SHIFT;
+ tracks.remove(Integer.valueOf(evt.getPointerId(idx)));
break;
case MotionEvent.ACTION_MOVE:
- for (int i = 0, n = evt.getHistorySize(); i < n; i++) {
- addDot(
- mDots,
- evt.getHistoricalX(i),
- evt.getHistoricalY(i),
- evt.getHistoricalPressure(i),
- evt.getHistoricalSize(i));
+ n = evt.getHistorySize();
+ for (Integer i: tracks) {
+ idx = evt.findPointerIndex(i.intValue());
+ for (int j = 0; j < n; j++) {
+ addDot(
+ mDots,
+ evt.getHistoricalX(idx, j),
+ evt.getHistoricalY(idx, j),
+ evt.getHistoricalPressure(idx, j),
+ evt.getHistoricalSize(idx, j));
+ }
}
break;
+
default:
return false;
}
- addDot(
- mDots,
- evt.getX(),
- evt.getY(),
- evt.getPressure(),
- evt.getSize());
+ for (Integer i: tracks) {
+ idx = evt.findPointerIndex(i.intValue());
+ addDot(
+ mDots,
+ evt.getX(idx),
+ evt.getY(idx),
+ evt.getPressure(idx),
+ evt.getSize(idx));
+ }
return true;
}
@@ -74,7 +97,7 @@ private void addDot(Dots dots, float x, float y, float p, float s) {
x,
y,
Color.CYAN,
- (int) ((p * s * DOT_DIAMETER) + 1));
+ (int) ((p + 0.5) * (s + 0.5) * DOT_DIAMETER));
}
}
@@ -124,35 +147,38 @@ public void run() {
@Override public void onCreate(Bundle state) {
super.onCreate(state);
- dotView = new DotView(this, dotModel);
- dotView.setOnCreateContextMenuListener(this);
-
// install the view
setContentView(R.layout.main);
- ((LinearLayout) findViewById(R.id.root)).addView(dotView, 0);
+ // find the dots view
+ dotView = (DotView) findViewById(R.id.dots);
+ dotView.setDots(dotModel);
+
+ dotView.setOnCreateContextMenuListener(this);
dotView.setOnTouchListener(new TrackingTouchListener(dotModel));
dotView.setOnKeyListener(new OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
- if (KeyEvent.ACTION_UP != event.getAction()) {
- int color = Color.BLUE;
- switch (keyCode) {
- case KeyEvent.KEYCODE_SPACE:
- color = Color.MAGENTA;
- break;
- case KeyEvent.KEYCODE_ENTER:
- color = Color.YELLOW;
- break;
- default: ;
- }
+ if (KeyEvent.ACTION_DOWN != event.getAction()) {
+ return false;
+ }
- makeDot(dotModel, dotView, color);
+ int color;
+ switch (keyCode) {
+ case KeyEvent.KEYCODE_SPACE:
+ color = Color.MAGENTA;
+ break;
+ case KeyEvent.KEYCODE_ENTER:
+ color = Color.BLUE;
+ break;
+ default:
+ return false;
}
- return (keyCode < KeyEvent.KEYCODE_0)
- ||(keyCode > KeyEvent.KEYCODE_9);
+ makeDot(dotModel, dotView, color);
+
+ return true;
} });
@@ -186,30 +212,30 @@ else if (hasFocus && (null == dotGenerator)) {
dotModel.setDotsChangeListener(new Dots.DotsChangeListener() {
@Override public void onDotsChange(Dots dots) {
Dot d = dots.getLastDot();
- tb1.setText((null == d) ? "" : String.valueOf(d.getX()));
- tb2.setText((null == d) ? "" : String.valueOf(d.getY()));
+ // This code makes the UI unacceptably unresponsive.
+ // ... investigating
+ //tb1.setText((null == d) ? "" : String.valueOf(d.getX()));
+ //tb2.setText((null == d) ? "" : String.valueOf(d.getY()));
dotView.invalidate();
} });
}
/** Install an options menu. */
@Override public boolean onCreateOptionsMenu(Menu menu) {
- super.onCreateOptionsMenu(menu);
- menu.add(Menu.NONE, 1, Menu.NONE, "Clear")
- .setAlphabeticShortcut('x');
+ getMenuInflater().inflate(R.menu.simple_menu, menu);
return true;
}
/** Respond to an options menu selection. */
@Override public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
- case 1:
+ case R.id.menu_clear:
dotModel.clearDots();
return true;
- default: ;
- }
- return false;
+ default:
+ return super.onOptionsItemSelected(item);
+ }
}
/** Install a context menu. */
diff --git a/07/AndroidUIDemo/src/com/oreilly/demo/android/ch07/model/Dot.java b/AndroidUIDemo/src/com/oreilly/demo/android/pa/uidemo/model/Dot.java
similarity index 94%
rename from 07/AndroidUIDemo/src/com/oreilly/demo/android/ch07/model/Dot.java
rename to AndroidUIDemo/src/com/oreilly/demo/android/pa/uidemo/model/Dot.java
index 96da2be..88e18e1 100644
--- a/07/AndroidUIDemo/src/com/oreilly/demo/android/ch07/model/Dot.java
+++ b/AndroidUIDemo/src/com/oreilly/demo/android/pa/uidemo/model/Dot.java
@@ -1,4 +1,4 @@
-package com.oreilly.demo.android.ch07.model;
+package com.oreilly.demo.android.pa.uidemo.model;
/** A dot: the coordinates, color and size. */
diff --git a/07/AndroidUIDemo/src/com/oreilly/demo/android/ch07/model/Dots.java b/AndroidUIDemo/src/com/oreilly/demo/android/pa/uidemo/model/Dots.java
similarity index 92%
rename from 07/AndroidUIDemo/src/com/oreilly/demo/android/ch07/model/Dots.java
rename to AndroidUIDemo/src/com/oreilly/demo/android/pa/uidemo/model/Dots.java
index 654f9e8..5183bd5 100644
--- a/07/AndroidUIDemo/src/com/oreilly/demo/android/ch07/model/Dots.java
+++ b/AndroidUIDemo/src/com/oreilly/demo/android/pa/uidemo/model/Dots.java
@@ -1,4 +1,4 @@
-package com.oreilly.demo.android.ch07.model;
+package com.oreilly.demo.android.pa.uidemo.model;
import java.util.Collections;
import java.util.LinkedList;
@@ -12,12 +12,12 @@ public interface DotsChangeListener {
/** @param dots the dots that changed. */
void onDotsChange(Dots dots);
}
-
+
private final LinkedList dots = new LinkedList();
private final List safeDots = Collections.unmodifiableList(dots);
-
+
private DotsChangeListener dotsChangeListener;
-
+
/** @param l set the change listener. */
public void setDotsChangeListener(DotsChangeListener l) {
dotsChangeListener = l;
@@ -27,7 +27,7 @@ public void setDotsChangeListener(DotsChangeListener l) {
public Dot getLastDot() {
return (dots.size() <= 0) ? null : dots.getLast();
}
-
+
/** @return immutable list of dots. */
public List getDots() { return safeDots; }
@@ -50,7 +50,7 @@ public void clearDots() {
private void notifyListener() {
if (null != dotsChangeListener) {
- dotsChangeListener.onDotsChange(this);
+ dotsChangeListener.onDotsChange(this);
}
}
}
diff --git a/07/AndroidUIDemo/src/com/oreilly/demo/android/ch07/view/DotView.java b/AndroidUIDemo/src/com/oreilly/demo/android/pa/uidemo/view/DotView.java
similarity index 55%
rename from 07/AndroidUIDemo/src/com/oreilly/demo/android/ch07/view/DotView.java
rename to AndroidUIDemo/src/com/oreilly/demo/android/pa/uidemo/view/DotView.java
index b842e81..560dc9d 100644
--- a/07/AndroidUIDemo/src/com/oreilly/demo/android/ch07/view/DotView.java
+++ b/AndroidUIDemo/src/com/oreilly/demo/android/pa/uidemo/view/DotView.java
@@ -1,4 +1,4 @@
-package com.oreilly.demo.android.ch07.view;
+package com.oreilly.demo.android.pa.uidemo.view;
import android.content.Context;
@@ -6,11 +6,11 @@
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Style;
-
+import android.util.AttributeSet;
import android.view.View;
-import com.oreilly.demo.android.ch07.model.Dot;
-import com.oreilly.demo.android.ch07.model.Dots;
+import com.oreilly.demo.android.pa.uidemo.model.Dot;
+import com.oreilly.demo.android.pa.uidemo.model.Dots;
/**
@@ -19,41 +19,52 @@
* @author Blake Meike
*/
public class DotView extends View {
- private final Dots dots;
+
+ private volatile Dots dots;
/**
* @param context the rest of the application
- * @param dots the dots we draw
*/
- public DotView(Context context, Dots dots) {
+ public DotView(Context context) {
super(context);
- this.dots = dots;
- setMinimumWidth(180);
- setMinimumHeight(200);
- setFocusable(true);
+ setFocusableInTouchMode(true);
+ }
+
+ /**
+ * @param context
+ * @param attrs
+ */
+ public DotView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ setFocusableInTouchMode(true);
}
-
+
/**
- * @see android.view.View#onMeasure(int, int)
+ * @param context
+ * @param attrs
+ * @param defStyle
*/
- @Override
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- setMeasuredDimension(
- getSuggestedMinimumWidth(),
- getSuggestedMinimumHeight());
+ public DotView(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ setFocusableInTouchMode(true);
}
+ /**
+ * @param dots
+ */
+ public void setDots(Dots dots) { this.dots = dots; }
+
/**
* @see android.view.View#onDraw(android.graphics.Canvas)
*/
@Override protected void onDraw(Canvas canvas) {
- canvas.drawColor(Color.WHITE);
-
Paint paint = new Paint();
paint.setStyle(Style.STROKE);
paint.setColor(hasFocus() ? Color.BLUE : Color.GRAY);
canvas.drawRect(0, 0, getWidth() - 1, getHeight() -1, paint);
-
+
+ if (null == dots) { return; }
+
paint.setStyle(Style.FILL);
for (Dot dot : dots.getDots()) {
paint.setColor(dot.getColor());
diff --git a/12/FinchVideo/tools/ant/build.xml b/AndroidUIDemo/tools/ant/build.xml
similarity index 79%
rename from 12/FinchVideo/tools/ant/build.xml
rename to AndroidUIDemo/tools/ant/build.xml
index 03a242a..ea1d22b 100644
--- a/12/FinchVideo/tools/ant/build.xml
+++ b/AndroidUIDemo/tools/ant/build.xml
@@ -1,5 +1,5 @@
-
+
-
-
-
-
-
-
-
+
+
+
@@ -60,12 +52,15 @@
-->
-
diff --git a/06/AIDLDemo/tools/ide/eclipse/classpath b/AndroidUIDemo/tools/ide/eclipse/classpath
similarity index 63%
rename from 06/AIDLDemo/tools/ide/eclipse/classpath
rename to AndroidUIDemo/tools/ide/eclipse/classpath
index 4dabc98..80452d3 100644
--- a/06/AIDLDemo/tools/ide/eclipse/classpath
+++ b/AndroidUIDemo/tools/ide/eclipse/classpath
@@ -1,7 +1,8 @@
+
-
-
+
+
diff --git a/07/AndroidUIDemo/tools/ide/eclipse/project b/AndroidUIDemo/tools/ide/eclipse/project
similarity index 100%
rename from 07/AndroidUIDemo/tools/ide/eclipse/project
rename to AndroidUIDemo/tools/ide/eclipse/project
diff --git a/AndroidUIDemo/tools/ide/eclipse/settings/org.eclipse.jdt.core.prefs b/AndroidUIDemo/tools/ide/eclipse/settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..3d7da02
--- /dev/null
+++ b/AndroidUIDemo/tools/ide/eclipse/settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+#Sun Jan 15 16:54:51 PST 2012
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/AndroidViewDemo/AndroidManifest.xml b/AndroidViewDemo/AndroidManifest.xml
new file mode 100644
index 0000000..7fde7d6
--- /dev/null
+++ b/AndroidViewDemo/AndroidManifest.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/AndroidViewDemo/TODO b/AndroidViewDemo/TODO
new file mode 100644
index 0000000..83a23bb
--- /dev/null
+++ b/AndroidViewDemo/TODO
@@ -0,0 +1,4 @@
+
+- Animation is choppy
+- OpenGL demo should be separate
+
diff --git a/11/FinchLifecycleBackport/proguard.cfg b/AndroidViewDemo/proguard.cfg
similarity index 86%
rename from 11/FinchLifecycleBackport/proguard.cfg
rename to AndroidViewDemo/proguard.cfg
index 12dd039..b1cdf17 100644
--- a/11/FinchLifecycleBackport/proguard.cfg
+++ b/AndroidViewDemo/proguard.cfg
@@ -18,14 +18,18 @@
native ;
}
--keepclasseswithmembernames class * {
+-keepclasseswithmembers class * {
public (android.content.Context, android.util.AttributeSet);
}
--keepclasseswithmembernames class * {
+-keepclasseswithmembers class * {
public (android.content.Context, android.util.AttributeSet, int);
}
+-keepclassmembers class * extends android.app.Activity {
+ public void *(android.view.View);
+}
+
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
diff --git a/18/NDKDemo/default.properties b/AndroidViewDemo/project.properties
similarity index 72%
rename from 18/NDKDemo/default.properties
rename to AndroidViewDemo/project.properties
index 77f7ad7..8da376a 100644
--- a/18/NDKDemo/default.properties
+++ b/AndroidViewDemo/project.properties
@@ -4,8 +4,8 @@
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
-# "build.properties", and override values to adapt the script to your
+# "ant.properties", and override values to adapt the script to your
# project structure.
# Project target.
-target=Google Inc.:Google APIs:9
+target=android-15
diff --git a/06/JSerializable/res/drawable-hdpi/icon.png b/AndroidViewDemo/res/drawable-hdpi/icon.png
similarity index 100%
rename from 06/JSerializable/res/drawable-hdpi/icon.png
rename to AndroidViewDemo/res/drawable-hdpi/icon.png
diff --git a/06/JSerializable/res/drawable-ldpi/icon.png b/AndroidViewDemo/res/drawable-ldpi/icon.png
similarity index 100%
rename from 06/JSerializable/res/drawable-ldpi/icon.png
rename to AndroidViewDemo/res/drawable-ldpi/icon.png
diff --git a/06/JSerializable/res/drawable-mdpi/icon.png b/AndroidViewDemo/res/drawable-mdpi/icon.png
similarity index 100%
rename from 06/JSerializable/res/drawable-mdpi/icon.png
rename to AndroidViewDemo/res/drawable-mdpi/icon.png
diff --git a/09/AndroidViewDemo/res/drawable/cb.png b/AndroidViewDemo/res/drawable/cb.png
similarity index 100%
rename from 09/AndroidViewDemo/res/drawable/cb.png
rename to AndroidViewDemo/res/drawable/cb.png
diff --git a/09/AndroidViewDemo/res/drawable/throbber.xml b/AndroidViewDemo/res/drawable/throbber.xml
similarity index 88%
rename from 09/AndroidViewDemo/res/drawable/throbber.xml
rename to AndroidViewDemo/res/drawable/throbber.xml
index 41b176e..4d2d268 100644
--- a/09/AndroidViewDemo/res/drawable/throbber.xml
+++ b/AndroidViewDemo/res/drawable/throbber.xml
@@ -2,11 +2,11 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/09/AndroidViewDemo/res/drawable/to.png b/AndroidViewDemo/res/drawable/to.png
similarity index 100%
rename from 09/AndroidViewDemo/res/drawable/to.png
rename to AndroidViewDemo/res/drawable/to.png
diff --git a/09/AndroidViewDemo/res/layout/main.xml b/AndroidViewDemo/res/layout/main.xml
similarity index 56%
rename from 09/AndroidViewDemo/res/layout/main.xml
rename to AndroidViewDemo/res/layout/main.xml
index e6866b2..94e8a89 100644
--- a/09/AndroidViewDemo/res/layout/main.xml
+++ b/AndroidViewDemo/res/layout/main.xml
@@ -1,51 +1,63 @@
-
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
-
+
+
+
+
diff --git a/AndroidViewDemo/res/layout/paint.xml b/AndroidViewDemo/res/layout/paint.xml
new file mode 100644
index 0000000..f66534f
--- /dev/null
+++ b/AndroidViewDemo/res/layout/paint.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/09/AndroidViewDemo/res/values/colors.xml b/AndroidViewDemo/res/values/colors.xml
similarity index 100%
rename from 09/AndroidViewDemo/res/values/colors.xml
rename to AndroidViewDemo/res/values/colors.xml
diff --git a/09/AndroidViewDemo/res/values/strings.xml b/AndroidViewDemo/res/values/strings.xml
similarity index 100%
rename from 09/AndroidViewDemo/res/values/strings.xml
rename to AndroidViewDemo/res/values/strings.xml
diff --git a/09/AndroidViewDemo/src/com/example/android/apis/graphics/GLSurfaceView.java b/AndroidViewDemo/src/com/example/android/apis/graphics/GLSurfaceView.java
similarity index 100%
rename from 09/AndroidViewDemo/src/com/example/android/apis/graphics/GLSurfaceView.java
rename to AndroidViewDemo/src/com/example/android/apis/graphics/GLSurfaceView.java
diff --git a/AndroidViewDemo/src/com/oreilly/demo/android/pa/viewdemo/PaintActivity.java b/AndroidViewDemo/src/com/oreilly/demo/android/pa/viewdemo/PaintActivity.java
new file mode 100644
index 0000000..3ac64c8
--- /dev/null
+++ b/AndroidViewDemo/src/com/oreilly/demo/android/pa/viewdemo/PaintActivity.java
@@ -0,0 +1,13 @@
+package com.oreilly.demo.android.pa.viewdemo;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+public class PaintActivity extends Activity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.paint);
+ }
+}
diff --git a/09/AndroidViewDemo/src/com/oreilly/demo/android/ch09/TransformIt.java b/AndroidViewDemo/src/com/oreilly/demo/android/pa/viewdemo/TransformIt.java
similarity index 83%
rename from 09/AndroidViewDemo/src/com/oreilly/demo/android/ch09/TransformIt.java
rename to AndroidViewDemo/src/com/oreilly/demo/android/pa/viewdemo/TransformIt.java
index 8b10e9d..8f1daa9 100644
--- a/09/AndroidViewDemo/src/com/oreilly/demo/android/ch09/TransformIt.java
+++ b/AndroidViewDemo/src/com/oreilly/demo/android/pa/viewdemo/TransformIt.java
@@ -1,7 +1,7 @@
/* $Id: $
*
*/
-package com.oreilly.demo.android.ch09;
+package com.oreilly.demo.android.pa.viewdemo;
import android.app.Activity;
import android.graphics.BlurMaskFilter;
@@ -17,12 +17,12 @@
import android.view.View.OnClickListener;
import android.widget.LinearLayout;
-import com.oreilly.demo.android.ch09.drawable.HelloAndroidTextDrawable;
-import com.oreilly.demo.android.ch09.efx.RotationTransitionAnimation;
-import com.oreilly.demo.android.ch09.widget.EffectsWidget;
-import com.oreilly.demo.android.ch09.widget.GLDemoWidget;
-import com.oreilly.demo.android.ch09.widget.TransformedViewWidget;
-import com.oreilly.demo.android.ch09.widget.TransformedViewWidget.Transformation;
+import com.oreilly.demo.android.pa.viewdemo.drawable.HelloAndroidTextDrawable;
+import com.oreilly.demo.android.pa.viewdemo.efx.RotationTransitionAnimation;
+import com.oreilly.demo.android.pa.viewdemo.widget.EffectsWidget;
+import com.oreilly.demo.android.pa.viewdemo.widget.GLDemoWidget;
+import com.oreilly.demo.android.pa.viewdemo.widget.TransformedViewWidget;
+import com.oreilly.demo.android.pa.viewdemo.widget.TransformedViewWidget.Transformation;
/**
@@ -36,7 +36,9 @@ public class TransformIt extends Activity {
/** the view up next */
View next;
+ private AnimationDrawable throbber;
private GLDemoWidget glWidget;
+ private View efxView;
/** @see android.app.Activity#onCreate(android.os.Bundle) */
@@ -55,10 +57,13 @@ public void onCreate(Bundle savedInstanceState) {
// and the next one
next = findViewById(R.id.efx_v);
next.setVisibility(View.GONE);
- buildEfxView(
+ throbber = buildEfxView(
(LinearLayout) findViewById(R.id.efx_v_left),
(LinearLayout) findViewById(R.id.efx_v_right));
+ glWidget = (GLDemoWidget) findViewById(R.id.efx_gl);
+ efxView = next;
+
// install the animation click listener
final View root = findViewById(R.id.main);
findViewById(R.id.main).setOnClickListener(
@@ -70,6 +75,7 @@ public void onCreate(Bundle savedInstanceState) {
View t = cur;
cur = next;
next = t;
+ toggleThrobber();
} });
}
@@ -136,7 +142,7 @@ private void buildXformView(LinearLayout lv, LinearLayout rv) {
} }));
}
- private void buildEfxView(LinearLayout lv, LinearLayout rv) {
+ private AnimationDrawable buildEfxView(LinearLayout lv, LinearLayout rv) {
lv.addView(new EffectsWidget(
this,
1,
@@ -153,11 +159,11 @@ private void buildEfxView(LinearLayout lv, LinearLayout rv) {
new LinearGradient(
0.0F,
0.0F,
- 160.0F,
- 80.0F,
+ 100.0F,
+ 10.0F,
new int[] {
Color.BLACK, Color.RED, Color.YELLOW },
- new float[] { 0.2F, 0.3F, 0.2F },
+ new float[] { 0.0F, 0.5F, 0.95F },
Shader.TileMode.REPEAT));
} }));
lv.addView(new EffectsWidget(
@@ -169,10 +175,6 @@ private void buildEfxView(LinearLayout lv, LinearLayout rv) {
new BlurMaskFilter(2, BlurMaskFilter.Blur.NORMAL));
} }));
- // the OpenGL widget
- glWidget = new GLDemoWidget(this);
- lv.addView(glWidget);
-
rv.addView(new EffectsWidget(
this,
2,
@@ -204,14 +206,10 @@ private void buildEfxView(LinearLayout lv, LinearLayout rv) {
rv.addView(w);
w.setBackgroundResource(R.drawable.throbber);
- //!!! Hack; should be fixed in Cupcake
- w.setOnClickListener(new OnClickListener() {
- @Override public void onClick(View v) {
- AnimationDrawable animation
- = (AnimationDrawable) v.getBackground();
- if (animation.isRunning()) { animation.stop(); }
- else { animation.start(); }
- } });
+ lv.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
+ rv.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
+
+ return (AnimationDrawable) w.getBackground();
}
/**
@@ -220,6 +218,7 @@ private void buildEfxView(LinearLayout lv, LinearLayout rv) {
@Override
protected void onPause() {
super.onPause();
+ if (null != throbber) { throbber.stop(); }
if (null != glWidget) { glWidget.onPause(); }
}
@@ -229,6 +228,14 @@ protected void onPause() {
@Override
protected void onResume() {
super.onResume();
+ toggleThrobber();
if (null != glWidget) { glWidget.onResume(); }
}
+
+ void toggleThrobber() {
+ if (null != throbber) {
+ if (efxView.equals(cur)) { throbber.start(); }
+ else { throbber.stop(); }
+ }
+ }
}
diff --git a/09/AndroidViewDemo/src/com/oreilly/demo/android/ch09/drawable/HelloAndroidTextDrawable.java b/AndroidViewDemo/src/com/oreilly/demo/android/pa/viewdemo/drawable/HelloAndroidTextDrawable.java
similarity index 96%
rename from 09/AndroidViewDemo/src/com/oreilly/demo/android/ch09/drawable/HelloAndroidTextDrawable.java
rename to AndroidViewDemo/src/com/oreilly/demo/android/pa/viewdemo/drawable/HelloAndroidTextDrawable.java
index 836ca9d..52e17d8 100644
--- a/09/AndroidViewDemo/src/com/oreilly/demo/android/ch09/drawable/HelloAndroidTextDrawable.java
+++ b/AndroidViewDemo/src/com/oreilly/demo/android/pa/viewdemo/drawable/HelloAndroidTextDrawable.java
@@ -1,4 +1,4 @@
-package com.oreilly.demo.android.ch09.drawable;
+package com.oreilly.demo.android.pa.viewdemo.drawable;
import android.graphics.Canvas;
import android.graphics.Color;
diff --git a/09/AndroidViewDemo/src/com/oreilly/demo/android/ch09/efx/RotationTransitionAnimation.java b/AndroidViewDemo/src/com/oreilly/demo/android/pa/viewdemo/efx/RotationTransitionAnimation.java
similarity index 84%
rename from 09/AndroidViewDemo/src/com/oreilly/demo/android/ch09/efx/RotationTransitionAnimation.java
rename to AndroidViewDemo/src/com/oreilly/demo/android/pa/viewdemo/efx/RotationTransitionAnimation.java
index 120fdc8..dabd3bd 100644
--- a/09/AndroidViewDemo/src/com/oreilly/demo/android/ch09/efx/RotationTransitionAnimation.java
+++ b/AndroidViewDemo/src/com/oreilly/demo/android/pa/viewdemo/efx/RotationTransitionAnimation.java
@@ -1,7 +1,7 @@
/* $Id: $
*
*/
-package com.oreilly.demo.android.ch09.efx;
+package com.oreilly.demo.android.pa.viewdemo.efx;
import android.graphics.Camera;
import android.graphics.Matrix;
@@ -28,9 +28,10 @@ public class RotationTransitionAnimation
/** the transition target */
final View nextView;
+ final float xCenter;
+ final float yCenter;
+
private final int dir;
- private final float xCenter;
- private final float yCenter;
private final Camera camera = new Camera();
/**
@@ -55,8 +56,22 @@ public RotationTransitionAnimation(
curView = cur;
nextView = nxt;
- xCenter = root.getWidth() / 2.0f;
- yCenter = root.getHeight() / 2.0f;
+ xCenter = cur.getWidth() / 2.0f;
+ yCenter = cur.getHeight() / 2.0f;
+ }
+
+ RotationTransitionAnimation(
+ View r,
+ View cur,
+ float xc,
+ float yc)
+ {
+ dir = -1;
+ root = r;
+ curView = cur;
+ nextView = null;
+ xCenter = xc;
+ yCenter = yc;
}
/**
@@ -98,8 +113,8 @@ public void onAnimationEnd(Animation animation) {
curView.setVisibility(View.GONE);
nextView.setVisibility(View.VISIBLE);
nextView.requestFocus();
- new RotationTransitionAnimation(-1, root, nextView, null)
- . animateOnce(new DecelerateInterpolator(), null);
+ new RotationTransitionAnimation(root, nextView, xCenter, yCenter)
+ .animateOnce(new DecelerateInterpolator(), null);
} });
}
@@ -125,7 +140,7 @@ void animateOnce(
Interpolator interpolator,
Animation.AnimationListener listener)
{
- setDuration(700);
+ setDuration(2000);
setInterpolator(interpolator);
setAnimationListener(listener);
root.startAnimation(this);
diff --git a/09/AndroidViewDemo/src/com/oreilly/demo/android/ch09/widget/EffectsWidget.java b/AndroidViewDemo/src/com/oreilly/demo/android/pa/viewdemo/widget/EffectsWidget.java
similarity index 83%
rename from 09/AndroidViewDemo/src/com/oreilly/demo/android/ch09/widget/EffectsWidget.java
rename to AndroidViewDemo/src/com/oreilly/demo/android/pa/viewdemo/widget/EffectsWidget.java
index f2e4d52..b99ebf7 100644
--- a/09/AndroidViewDemo/src/com/oreilly/demo/android/ch09/widget/EffectsWidget.java
+++ b/AndroidViewDemo/src/com/oreilly/demo/android/pa/viewdemo/widget/EffectsWidget.java
@@ -1,15 +1,16 @@
/* $Id: $
*
*/
-package com.oreilly.demo.android.ch09.widget;
+package com.oreilly.demo.android.pa.viewdemo.widget;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.view.View;
+import android.view.ViewGroup;
-import com.oreilly.demo.android.ch09.R;
+import com.oreilly.demo.android.pa.viewdemo.R;
/**
@@ -18,7 +19,10 @@
public class EffectsWidget extends View {
/** The effect to apply to the drawing */
- public interface PaintEffect { void setEffect(Paint paint); }
+ public interface PaintEffect {
+ /** @param paint the paint effect */
+ void setEffect(Paint paint);
+ }
private final PaintEffect effect;
private final int id;
@@ -36,7 +40,7 @@ public EffectsWidget(Context context, int n, PaintEffect pe) {
effect = pe;
setMinimumWidth(160);
- setMinimumHeight(80);
+ setMinimumHeight(135);
setBackgroundResource(R.drawable.bg0);
}
@@ -45,7 +49,7 @@ public EffectsWidget(Context context, int n, PaintEffect pe) {
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
setMeasuredDimension(
- getSuggestedMinimumWidth(),
+ ViewGroup.LayoutParams.MATCH_PARENT,
getSuggestedMinimumHeight());
}
diff --git a/09/AndroidViewDemo/src/com/oreilly/demo/android/ch09/widget/GLDemoWidget.java b/AndroidViewDemo/src/com/oreilly/demo/android/pa/viewdemo/widget/GLDemoWidget.java
similarity index 92%
rename from 09/AndroidViewDemo/src/com/oreilly/demo/android/ch09/widget/GLDemoWidget.java
rename to AndroidViewDemo/src/com/oreilly/demo/android/pa/viewdemo/widget/GLDemoWidget.java
index 201585f..4539f42 100644
--- a/09/AndroidViewDemo/src/com/oreilly/demo/android/ch09/widget/GLDemoWidget.java
+++ b/AndroidViewDemo/src/com/oreilly/demo/android/pa/viewdemo/widget/GLDemoWidget.java
@@ -1,5 +1,5 @@
/* $Id: $ */
-package com.oreilly.demo.android.ch09.widget;
+package com.oreilly.demo.android.pa.viewdemo.widget;
import java.io.IOException;
import java.io.InputStream;
@@ -17,9 +17,10 @@
import android.opengl.GLU;
import android.opengl.GLUtils;
import android.os.SystemClock;
+import android.util.AttributeSet;
import com.example.android.apis.graphics.GLSurfaceView;
-import com.oreilly.demo.android.ch09.R;
+import com.oreilly.demo.android.pa.viewdemo.R;
/**
@@ -37,14 +38,12 @@ public class GLDemoWidget extends GLSurfaceView
/**
* @param context the app context
+ * @param attrs the view attributes
*/
- public GLDemoWidget(Context context) {
- super(context);
+ public GLDemoWidget(Context context, AttributeSet attrs) {
+ super(context, attrs);
this.context = context;
- setMinimumWidth(160);
- setMinimumHeight(80);
-
setRenderer(this);
float[] coords = {
@@ -86,14 +85,6 @@ public GLDemoWidget(Context context) {
indexBuf.position(0);
}
- /** @see android.view.View#onMeasure(int, int) */
- @Override
- protected void onMeasure(int widthSpec, int heightSpec) {
- setMeasuredDimension(
- getSuggestedMinimumWidth(),
- getSuggestedMinimumHeight());
- }
-
/**
* We don't need a depth buffer and don't care about our color depth.
*/
@@ -131,7 +122,7 @@ public void surfaceCreated(GL10 gl) {
GL10.GL_PERSPECTIVE_CORRECTION_HINT,
GL10.GL_FASTEST);
- gl.glClearColor(0.4f, 0.2f, 0.2f, 0.5f);
+ gl.glClearColor(0.2f, 0.1f, 0.8f, 0.1f);
gl.glShadeModel(GL10.GL_SMOOTH);
gl.glEnable(GL10.GL_DEPTH_TEST);
diff --git a/AndroidViewDemo/src/com/oreilly/demo/android/pa/viewdemo/widget/PaintWidget.java b/AndroidViewDemo/src/com/oreilly/demo/android/pa/viewdemo/widget/PaintWidget.java
new file mode 100644
index 0000000..06feccd
--- /dev/null
+++ b/AndroidViewDemo/src/com/oreilly/demo/android/pa/viewdemo/widget/PaintWidget.java
@@ -0,0 +1,44 @@
+package com.oreilly.demo.android.pa.viewdemo.widget;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.util.AttributeSet;
+import android.view.View;
+
+public class PaintWidget extends View {
+
+ public PaintWidget(Context context, AttributeSet attrs, int defStyle) {
+ this(context);
+ }
+
+ public PaintWidget(Context context, AttributeSet attrs) {
+ this(context);
+ }
+
+ public PaintWidget(Context context) { super(context); }
+
+ @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ setMeasuredDimension(100, 100);
+ }
+
+ @Override protected void onDraw(Canvas canvas) {
+ canvas.drawColor(Color.WHITE);
+
+ Paint paint = new Paint();
+ canvas.drawLine(33, 0, 33, 100, paint);
+
+ paint.setColor(Color.RED);
+ paint.setStrokeWidth(10);
+ canvas.drawLine(56, 0, 56, 100, paint);
+
+ paint.setColor(Color.GREEN);
+ paint.setStrokeWidth(5);
+
+ for (int y = 30, alpha = 255; alpha > 2; alpha >>= 1, y += 10) {
+ paint.setAlpha(alpha);
+ canvas.drawLine(0, y, 100, y, paint);
+ }
+ }
+}
diff --git a/09/AndroidViewDemo/src/com/oreilly/demo/android/ch09/widget/TransformedViewWidget.java b/AndroidViewDemo/src/com/oreilly/demo/android/pa/viewdemo/widget/TransformedViewWidget.java
similarity index 93%
rename from 09/AndroidViewDemo/src/com/oreilly/demo/android/ch09/widget/TransformedViewWidget.java
rename to AndroidViewDemo/src/com/oreilly/demo/android/pa/viewdemo/widget/TransformedViewWidget.java
index fa7b78c..f77ece2 100644
--- a/09/AndroidViewDemo/src/com/oreilly/demo/android/ch09/widget/TransformedViewWidget.java
+++ b/AndroidViewDemo/src/com/oreilly/demo/android/pa/viewdemo/widget/TransformedViewWidget.java
@@ -1,5 +1,5 @@
/* $Id: $ */
-package com.oreilly.demo.android.ch09.widget;
+package com.oreilly.demo.android.pa.viewdemo.widget;
import android.content.Context;
import android.graphics.Canvas;
@@ -8,6 +8,7 @@
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.view.View;
+import android.view.ViewGroup;
/**
@@ -53,7 +54,7 @@ public TransformedViewWidget(
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
setMeasuredDimension(
- getSuggestedMinimumWidth(),
+ ViewGroup.LayoutParams.MATCH_PARENT,
getSuggestedMinimumHeight());
}
diff --git a/AndroidViewDemo/tools/ant/build.xml b/AndroidViewDemo/tools/ant/build.xml
new file mode 100644
index 0000000..978bc62
--- /dev/null
+++ b/AndroidViewDemo/tools/ant/build.xml
@@ -0,0 +1,79 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/09/AndroidViewDemo/tools/ide/eclipse/classpath b/AndroidViewDemo/tools/ide/eclipse/classpath
similarity index 63%
rename from 09/AndroidViewDemo/tools/ide/eclipse/classpath
rename to AndroidViewDemo/tools/ide/eclipse/classpath
index 7490853..b1128bd 100644
--- a/09/AndroidViewDemo/tools/ide/eclipse/classpath
+++ b/AndroidViewDemo/tools/ide/eclipse/classpath
@@ -3,5 +3,6 @@
-
+
+
diff --git a/09/AndroidViewDemo/tools/ide/eclipse/project b/AndroidViewDemo/tools/ide/eclipse/project
similarity index 100%
rename from 09/AndroidViewDemo/tools/ide/eclipse/project
rename to AndroidViewDemo/tools/ide/eclipse/project
diff --git a/AndroidViewDemo/tools/ide/eclipse/settings/org.eclipse.jdt.core.prefs b/AndroidViewDemo/tools/ide/eclipse/settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..2b690c3
--- /dev/null
+++ b/AndroidViewDemo/tools/ide/eclipse/settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+#Sun Jan 15 16:55:02 PST 2012
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/06/AsyncTaskDemo/AndroidManifest.xml b/AsyncTaskDemo/AndroidManifest.xml
similarity index 89%
rename from 06/AsyncTaskDemo/AndroidManifest.xml
rename to AsyncTaskDemo/AndroidManifest.xml
index 406a960..20df03e 100644
--- a/06/AsyncTaskDemo/AndroidManifest.xml
+++ b/AsyncTaskDemo/AndroidManifest.xml
@@ -1,8 +1,8 @@
-
+ android:versionName="1.0" package="com.oreilly.demo.android.pa.asynctask">
+
diff --git a/16/SensorDemos/proguard.cfg b/AsyncTaskDemo/proguard.cfg
similarity index 76%
rename from 16/SensorDemos/proguard.cfg
rename to AsyncTaskDemo/proguard.cfg
index 8ad7d33..b1cdf17 100644
--- a/16/SensorDemos/proguard.cfg
+++ b/AsyncTaskDemo/proguard.cfg
@@ -10,20 +10,26 @@
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
+-keep public class * extends android.app.backup.BackupAgentHelper
+-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService
-keepclasseswithmembernames class * {
native ;
}
--keepclasseswithmembernames class * {
+-keepclasseswithmembers class * {
public (android.content.Context, android.util.AttributeSet);
}
--keepclasseswithmembernames class * {
+-keepclasseswithmembers class * {
public (android.content.Context, android.util.AttributeSet, int);
}
+-keepclassmembers class * extends android.app.Activity {
+ public void *(android.view.View);
+}
+
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
diff --git a/AsyncTaskDemo/project.properties b/AsyncTaskDemo/project.properties
new file mode 100644
index 0000000..8da376a
--- /dev/null
+++ b/AsyncTaskDemo/project.properties
@@ -0,0 +1,11 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system use,
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+
+# Project target.
+target=android-15
diff --git a/06/AsyncTaskDemo/res/anim/dots.xml b/AsyncTaskDemo/res/anim/dots.xml
similarity index 100%
rename from 06/AsyncTaskDemo/res/anim/dots.xml
rename to AsyncTaskDemo/res/anim/dots.xml
diff --git a/07/AndroidUIDemo/res/drawable-hdpi/icon.png b/AsyncTaskDemo/res/drawable-hdpi/icon.png
similarity index 100%
rename from 07/AndroidUIDemo/res/drawable-hdpi/icon.png
rename to AsyncTaskDemo/res/drawable-hdpi/icon.png
diff --git a/07/AndroidUIDemo/res/drawable-ldpi/icon.png b/AsyncTaskDemo/res/drawable-ldpi/icon.png
similarity index 100%
rename from 07/AndroidUIDemo/res/drawable-ldpi/icon.png
rename to AsyncTaskDemo/res/drawable-ldpi/icon.png
diff --git a/07/AndroidUIDemo/res/drawable-mdpi/icon.png b/AsyncTaskDemo/res/drawable-mdpi/icon.png
similarity index 100%
rename from 07/AndroidUIDemo/res/drawable-mdpi/icon.png
rename to AsyncTaskDemo/res/drawable-mdpi/icon.png
diff --git a/06/AsyncTaskDemo/res/drawable/dots_f0.png b/AsyncTaskDemo/res/drawable/dots_f0.png
similarity index 100%
rename from 06/AsyncTaskDemo/res/drawable/dots_f0.png
rename to AsyncTaskDemo/res/drawable/dots_f0.png
diff --git a/06/AsyncTaskDemo/res/drawable/dots_f1.png b/AsyncTaskDemo/res/drawable/dots_f1.png
similarity index 100%
rename from 06/AsyncTaskDemo/res/drawable/dots_f1.png
rename to AsyncTaskDemo/res/drawable/dots_f1.png
diff --git a/06/AsyncTaskDemo/res/drawable/dots_f2.png b/AsyncTaskDemo/res/drawable/dots_f2.png
similarity index 100%
rename from 06/AsyncTaskDemo/res/drawable/dots_f2.png
rename to AsyncTaskDemo/res/drawable/dots_f2.png
diff --git a/06/AsyncTaskDemo/res/drawable/dots_f3.png b/AsyncTaskDemo/res/drawable/dots_f3.png
similarity index 100%
rename from 06/AsyncTaskDemo/res/drawable/dots_f3.png
rename to AsyncTaskDemo/res/drawable/dots_f3.png
diff --git a/06/AsyncTaskDemo/res/drawable/dots_f4.png b/AsyncTaskDemo/res/drawable/dots_f4.png
similarity index 100%
rename from 06/AsyncTaskDemo/res/drawable/dots_f4.png
rename to AsyncTaskDemo/res/drawable/dots_f4.png
diff --git a/06/AsyncTaskDemo/res/layout/asyncdemo.xml b/AsyncTaskDemo/res/layout/asyncdemo.xml
similarity index 75%
rename from 06/AsyncTaskDemo/res/layout/asyncdemo.xml
rename to AsyncTaskDemo/res/layout/asyncdemo.xml
index 7525f94..2d2f72a 100644
--- a/06/AsyncTaskDemo/res/layout/asyncdemo.xml
+++ b/AsyncTaskDemo/res/layout/asyncdemo.xml
@@ -2,29 +2,29 @@
diff --git a/06/AsyncTaskDemo/res/layout/asyncdemoprogress.xml b/AsyncTaskDemo/res/layout/asyncdemoprogress.xml
similarity index 76%
rename from 06/AsyncTaskDemo/res/layout/asyncdemoprogress.xml
rename to AsyncTaskDemo/res/layout/asyncdemoprogress.xml
index d865563..faf5d36 100644
--- a/06/AsyncTaskDemo/res/layout/asyncdemoprogress.xml
+++ b/AsyncTaskDemo/res/layout/asyncdemoprogress.xml
@@ -2,21 +2,21 @@
@@ -24,14 +24,14 @@
diff --git a/06/AsyncTaskDemo/res/values/strings.xml b/AsyncTaskDemo/res/values/strings.xml
similarity index 100%
rename from 06/AsyncTaskDemo/res/values/strings.xml
rename to AsyncTaskDemo/res/values/strings.xml
diff --git a/06/AsyncTaskDemo/src/com/oreilly/demo/android/ch06/AsyncTaskDemo.java b/AsyncTaskDemo/src/com/oreilly/demo/android/pa/asynctask/AsyncTaskDemo.java
similarity index 91%
rename from 06/AsyncTaskDemo/src/com/oreilly/demo/android/ch06/AsyncTaskDemo.java
rename to AsyncTaskDemo/src/com/oreilly/demo/android/pa/asynctask/AsyncTaskDemo.java
index 05ae1f7..5109751 100644
--- a/06/AsyncTaskDemo/src/com/oreilly/demo/android/ch06/AsyncTaskDemo.java
+++ b/AsyncTaskDemo/src/com/oreilly/demo/android/pa/asynctask/AsyncTaskDemo.java
@@ -1,7 +1,6 @@
-package com.oreilly.demo.android.ch06;
+package com.oreilly.demo.android.pa.asynctask;
import android.app.Activity;
-import android.graphics.Color;
import android.graphics.drawable.AnimationDrawable;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
@@ -10,8 +9,7 @@
import android.widget.Button;
import android.widget.TextView;
-import com.oreilly.demo.android.ch06.R;
-import com.oreilly.demo.android.ch06.game.Game;
+import com.oreilly.demo.android.pa.asynctask.game.Game;
/** AsyncTaskDemo */
@@ -71,24 +69,24 @@ public void onCreate(Bundle state) {
super.onCreate(state);
setContentView(R.layout.asyncdemo);
-
+
final View dots = findViewById(R.id.dots);
final Drawable bg = dots.getBackground();
final TextView msg = ((TextView) findViewById(R.id.msg));
final Game game = Game.newGame();
-
+
((Button) findViewById(R.id.start)).setOnClickListener(
new View.OnClickListener() {
@Override public void onClick(View v) {
- //initGame(
+// initGame(
new AsyncInitGame(
dots,
bg,
game,
- //msg,
- //"basic");
+// msg,
+// "basic");
msg)
.execute("basic");
} });
@@ -97,6 +95,12 @@ public void onCreate(Bundle state) {
/**
* Synchronous request to remote service
* DO NOT USE!!
+
+ * @param dots
+ * @param bg
+ * @param game
+ * @param resp
+ * @param level
*/
void initGame(
View dots,
diff --git a/06/AsyncTaskDemo/src/com/oreilly/demo/android/ch06/AsyncTaskDemoWithProgress.java b/AsyncTaskDemo/src/com/oreilly/demo/android/pa/asynctask/AsyncTaskDemoWithProgress.java
similarity index 95%
rename from 06/AsyncTaskDemo/src/com/oreilly/demo/android/ch06/AsyncTaskDemoWithProgress.java
rename to AsyncTaskDemo/src/com/oreilly/demo/android/pa/asynctask/AsyncTaskDemoWithProgress.java
index 6fb3f33..3dced2e 100644
--- a/06/AsyncTaskDemo/src/com/oreilly/demo/android/ch06/AsyncTaskDemoWithProgress.java
+++ b/AsyncTaskDemo/src/com/oreilly/demo/android/pa/asynctask/AsyncTaskDemoWithProgress.java
@@ -1,4 +1,4 @@
-package com.oreilly.demo.android.ch06;
+package com.oreilly.demo.android.pa.asynctask;
import android.app.Activity;
import android.graphics.drawable.AnimationDrawable;
@@ -10,8 +10,8 @@
import android.widget.ProgressBar;
import android.widget.TextView;
-import com.oreilly.demo.android.ch06.R;
-import com.oreilly.demo.android.ch06.game.Game;
+import com.oreilly.demo.android.pa.asynctask.R;
+import com.oreilly.demo.android.pa.asynctask.game.Game;
/** AsyncTaskDemo */
diff --git a/06/AsyncTaskDemo/src/com/oreilly/demo/android/ch06/AsyncTaskSample.java b/AsyncTaskDemo/src/com/oreilly/demo/android/pa/asynctask/AsyncTaskSample.java
similarity index 78%
rename from 06/AsyncTaskDemo/src/com/oreilly/demo/android/ch06/AsyncTaskSample.java
rename to AsyncTaskDemo/src/com/oreilly/demo/android/pa/asynctask/AsyncTaskSample.java
index e738913..d465d15 100644
--- a/06/AsyncTaskDemo/src/com/oreilly/demo/android/ch06/AsyncTaskSample.java
+++ b/AsyncTaskDemo/src/com/oreilly/demo/android/pa/asynctask/AsyncTaskSample.java
@@ -1,6 +1,6 @@
/* $Id: $
*/
-package com.oreilly.demo.android.ch06;
+package com.oreilly.demo.android.pa.asynctask;
import java.net.URI;
import java.sql.PreparedStatement;
@@ -21,24 +21,39 @@
*/
public class AsyncTaskSample {
+ /**
+ * AsyncDBReq
+ */
public class AsyncDBReq
extends AsyncTask
{
+ /**
+ * @see android.os.AsyncTask#doInBackground(PreparedStatement[])
+ */
@Override
protected ResultSet doInBackground(PreparedStatement... q) {
// implementation...
return null;
}
+ /**
+ * @see android.os.AsyncTask#onPostExecute(java.lang.Object)
+ */
@Override
protected void onPostExecute(ResultSet result) {
// implementation...
}
}
+ /**
+ * AsyncContentReq
+ */
public class AsyncContentReq
extends AsyncTask
{
+ /**
+ * @see android.os.AsyncTask#doInBackground(PreparedStatement[])
+ */
@Override
protected HttpResponse doInBackground(URI... req) {
// implementation...
@@ -46,6 +61,9 @@ protected HttpResponse doInBackground(URI... req) {
}
+ /**
+ * @see android.os.AsyncTask#onPostExecute(java.lang.Object)
+ */
@Override
protected void onPostExecute(HttpResponse result) {
// implementation...
@@ -54,9 +72,12 @@ protected void onPostExecute(HttpResponse result) {
int mCount;
+ /**
+ * @param button
+ */
public void initButton1( Button button) {
mCount = 0;
- button.setOnClickListener(
+ button.setOnClickListener(
new View.OnClickListener() {
@Override public void onClick(View v) {
new AsyncTask() {
@@ -69,11 +90,15 @@ protected Void doInBackground(Void... args) {
} });
}
+ /**
+ * @param button
+ * @param vals
+ */
public void initButton2(
Button button,
final Map vals)
{
- button.setOnClickListener(
+ button.setOnClickListener(
new View.OnClickListener() {
@SuppressWarnings("unchecked")
@Override public void onClick(View v) {
diff --git a/06/AsyncTaskDemo/src/com/oreilly/demo/android/ch06/game/Game.java b/AsyncTaskDemo/src/com/oreilly/demo/android/pa/asynctask/game/Game.java
similarity index 96%
rename from 06/AsyncTaskDemo/src/com/oreilly/demo/android/ch06/game/Game.java
rename to AsyncTaskDemo/src/com/oreilly/demo/android/pa/asynctask/game/Game.java
index cfd35fc..3df45e1 100644
--- a/06/AsyncTaskDemo/src/com/oreilly/demo/android/ch06/game/Game.java
+++ b/AsyncTaskDemo/src/com/oreilly/demo/android/pa/asynctask/game/Game.java
@@ -1,6 +1,6 @@
/* $Id: $
*/
-package com.oreilly.demo.android.ch06.game;
+package com.oreilly.demo.android.pa.asynctask.game;
/**
diff --git a/06/AsyncTaskDemo/src/com/oreilly/demo/android/ch06/game/MockGame.java b/AsyncTaskDemo/src/com/oreilly/demo/android/pa/asynctask/game/MockGame.java
similarity index 94%
rename from 06/AsyncTaskDemo/src/com/oreilly/demo/android/ch06/game/MockGame.java
rename to AsyncTaskDemo/src/com/oreilly/demo/android/pa/asynctask/game/MockGame.java
index f782067..54e1bae 100644
--- a/06/AsyncTaskDemo/src/com/oreilly/demo/android/ch06/game/MockGame.java
+++ b/AsyncTaskDemo/src/com/oreilly/demo/android/pa/asynctask/game/MockGame.java
@@ -1,6 +1,6 @@
/* $Id: $
*/
-package com.oreilly.demo.android.ch06.game;
+package com.oreilly.demo.android.pa.asynctask.game;
/**
diff --git a/06/AsyncTaskDemo/src/com/oreilly/demo/android/ch06/game/PersistentModel.java b/AsyncTaskDemo/src/com/oreilly/demo/android/pa/asynctask/game/PersistentModel.java
similarity index 76%
rename from 06/AsyncTaskDemo/src/com/oreilly/demo/android/ch06/game/PersistentModel.java
rename to AsyncTaskDemo/src/com/oreilly/demo/android/pa/asynctask/game/PersistentModel.java
index d15a3c4..d8a9079 100644
--- a/06/AsyncTaskDemo/src/com/oreilly/demo/android/ch06/game/PersistentModel.java
+++ b/AsyncTaskDemo/src/com/oreilly/demo/android/pa/asynctask/game/PersistentModel.java
@@ -1,6 +1,6 @@
/* $Id: $
*/
-package com.oreilly.demo.android.ch06.game;
+package com.oreilly.demo.android.pa.asynctask.game;
import android.os.Handler;
import android.os.Looper;
@@ -26,8 +26,8 @@ public void run() {
Looper.loop();
}
- public Handler getHandler() {
- // TODO Auto-generated method stub
- return null;
- }
+ /**
+ * @return the handler
+ */
+ public Handler getHandler() { return null; }
}
diff --git a/AsyncTaskDemo/tools/ant/build.xml b/AsyncTaskDemo/tools/ant/build.xml
new file mode 100644
index 0000000..ae992f6
--- /dev/null
+++ b/AsyncTaskDemo/tools/ant/build.xml
@@ -0,0 +1,79 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/AsyncTaskDemo/tools/ide/eclipse/classpath b/AsyncTaskDemo/tools/ide/eclipse/classpath
new file mode 100644
index 0000000..0ca188f
--- /dev/null
+++ b/AsyncTaskDemo/tools/ide/eclipse/classpath
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/06/AsyncTaskDemo/tools/ide/eclipse/project b/AsyncTaskDemo/tools/ide/eclipse/project
similarity index 100%
rename from 06/AsyncTaskDemo/tools/ide/eclipse/project
rename to AsyncTaskDemo/tools/ide/eclipse/project
diff --git a/AsyncTaskDemo/tools/ide/eclipse/settings/org.eclipse.jdt.core.prefs b/AsyncTaskDemo/tools/ide/eclipse/settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..5aec38c
--- /dev/null
+++ b/AsyncTaskDemo/tools/ide/eclipse/settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+#Sun Jan 15 16:55:11 PST 2012
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/14/AudioPlayer/AndroidManifest.xml b/AudioPlayer/AndroidManifest.xml
similarity index 93%
rename from 14/AudioPlayer/AndroidManifest.xml
rename to AudioPlayer/AndroidManifest.xml
index 5433530..409d013 100644
--- a/14/AudioPlayer/AndroidManifest.xml
+++ b/AudioPlayer/AndroidManifest.xml
@@ -1,8 +1,16 @@
+
+
+
+
+
+
+
+
@@ -21,12 +29,5 @@
-
-
-
-
-
-
-
-
+
diff --git a/AudioPlayer/README.txt b/AudioPlayer/README.txt
new file mode 100644
index 0000000..af3282a
--- /dev/null
+++ b/AudioPlayer/README.txt
@@ -0,0 +1,6 @@
+
+This example must be run on actual device (not an emulator)
+becaue it contains hardware specific code.
+
+It has been tested on a Nexus One, Nexus S, Galaxy Nexus phones
+
diff --git a/AudioPlayer/proguard.cfg b/AudioPlayer/proguard.cfg
new file mode 100644
index 0000000..b1cdf17
--- /dev/null
+++ b/AudioPlayer/proguard.cfg
@@ -0,0 +1,40 @@
+-optimizationpasses 5
+-dontusemixedcaseclassnames
+-dontskipnonpubliclibraryclasses
+-dontpreverify
+-verbose
+-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
+
+-keep public class * extends android.app.Activity
+-keep public class * extends android.app.Application
+-keep public class * extends android.app.Service
+-keep public class * extends android.content.BroadcastReceiver
+-keep public class * extends android.content.ContentProvider
+-keep public class * extends android.app.backup.BackupAgentHelper
+-keep public class * extends android.preference.Preference
+-keep public class com.android.vending.licensing.ILicensingService
+
+-keepclasseswithmembernames class * {
+ native ;
+}
+
+-keepclasseswithmembers class * {
+ public (android.content.Context, android.util.AttributeSet);
+}
+
+-keepclasseswithmembers class * {
+ public (android.content.Context, android.util.AttributeSet, int);
+}
+
+-keepclassmembers class * extends android.app.Activity {
+ public void *(android.view.View);
+}
+
+-keepclassmembers enum * {
+ public static **[] values();
+ public static ** valueOf(java.lang.String);
+}
+
+-keep class * implements android.os.Parcelable {
+ public static final android.os.Parcelable$Creator *;
+}
diff --git a/AudioPlayer/project.properties b/AudioPlayer/project.properties
new file mode 100644
index 0000000..8da376a
--- /dev/null
+++ b/AudioPlayer/project.properties
@@ -0,0 +1,11 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system use,
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+
+# Project target.
+target=android-15
diff --git a/08/SimpleFragment/res/drawable-hdpi/icon.png b/AudioPlayer/res/drawable-hdpi/icon.png
similarity index 100%
rename from 08/SimpleFragment/res/drawable-hdpi/icon.png
rename to AudioPlayer/res/drawable-hdpi/icon.png
diff --git a/08/SimpleFragment/res/drawable-ldpi/icon.png b/AudioPlayer/res/drawable-ldpi/icon.png
similarity index 100%
rename from 08/SimpleFragment/res/drawable-ldpi/icon.png
rename to AudioPlayer/res/drawable-ldpi/icon.png
diff --git a/08/SimpleFragment/res/drawable-mdpi/icon.png b/AudioPlayer/res/drawable-mdpi/icon.png
similarity index 100%
rename from 08/SimpleFragment/res/drawable-mdpi/icon.png
rename to AudioPlayer/res/drawable-mdpi/icon.png
diff --git a/14/AudioPlayer/res/drawable-mdpi/pause.png b/AudioPlayer/res/drawable-mdpi/pause.png
similarity index 100%
rename from 14/AudioPlayer/res/drawable-mdpi/pause.png
rename to AudioPlayer/res/drawable-mdpi/pause.png
diff --git a/14/AudioPlayer/res/drawable-mdpi/play.png b/AudioPlayer/res/drawable-mdpi/play.png
similarity index 100%
rename from 14/AudioPlayer/res/drawable-mdpi/play.png
rename to AudioPlayer/res/drawable-mdpi/play.png
diff --git a/14/AudioPlayer/res/drawable-mdpi/record.png b/AudioPlayer/res/drawable-mdpi/record.png
similarity index 100%
rename from 14/AudioPlayer/res/drawable-mdpi/record.png
rename to AudioPlayer/res/drawable-mdpi/record.png
diff --git a/14/AudioPlayer/res/drawable-mdpi/stop.png b/AudioPlayer/res/drawable-mdpi/stop.png
similarity index 100%
rename from 14/AudioPlayer/res/drawable-mdpi/stop.png
rename to AudioPlayer/res/drawable-mdpi/stop.png
diff --git a/14/AudioPlayer/res/layout/audioplayer.xml b/AudioPlayer/res/layout/audioplayer.xml
similarity index 77%
rename from 14/AudioPlayer/res/layout/audioplayer.xml
rename to AudioPlayer/res/layout/audioplayer.xml
index e880dec..96af94c 100644
--- a/14/AudioPlayer/res/layout/audioplayer.xml
+++ b/AudioPlayer/res/layout/audioplayer.xml
@@ -2,26 +2,26 @@
diff --git a/14/AudioPlayer/res/layout/audiorecorder.xml b/AudioPlayer/res/layout/audiorecorder.xml
similarity index 80%
rename from 14/AudioPlayer/res/layout/audiorecorder.xml
rename to AudioPlayer/res/layout/audiorecorder.xml
index 8286061..2609b2b 100644
--- a/14/AudioPlayer/res/layout/audiorecorder.xml
+++ b/AudioPlayer/res/layout/audiorecorder.xml
@@ -2,19 +2,19 @@