Merge "Fix path issues in the repeating alarm sample" into developers-dev
diff --git a/common/src/com/example/android/common/accounts/GenericAccountService.java b/common/src/java/com/example/android/common/accounts/GenericAccountService.java
similarity index 85%
rename from common/src/com/example/android/common/accounts/GenericAccountService.java
rename to common/src/java/com/example/android/common/accounts/GenericAccountService.java
index 9480023..0cd499a 100644
--- a/common/src/com/example/android/common/accounts/GenericAccountService.java
+++ b/common/src/java/com/example/android/common/accounts/GenericAccountService.java
@@ -29,17 +29,23 @@
public class GenericAccountService extends Service {
private static final String TAG = "GenericAccountService";
- private static final String ACCOUNT_TYPE = "com.example.android.network.sync.basicsyncadapter";
- public static final String ACCOUNT_NAME = "sync";
+ public static final String ACCOUNT_NAME = "Account";
private Authenticator mAuthenticator;
/**
* Obtain a handle to the {@link android.accounts.Account} used for sync in this application.
*
+ * <p>It is important that the accountType specified here matches the value in your sync adapter
+ * configuration XML file for android.accounts.AccountAuthenticator (often saved in
+ * res/xml/syncadapter.xml). If this is not set correctly, you'll receive an error indicating
+ * that "caller uid XXXXX is different than the authenticator's uid".
+ *
+ * @param accountType AccountType defined in the configuration XML file for
+ * android.accounts.AccountAuthenticator (e.g. res/xml/syncadapter.xml).
* @return Handle to application's account (not guaranteed to resolve unless CreateSyncAccount()
* has been called)
*/
- public static Account GetAccount() {
+ public static Account GetAccount(String accountType) {
// Note: Normally the account name is set to the user's identity (username or email
// address). However, since we aren't actually using any user accounts, it makes more sense
// to use a generic string in this case.
@@ -47,7 +53,7 @@
// This string should *not* be localized. If the user switches locale, we would not be
// able to locate the old account, and may erroneously register multiple accounts.
final String accountName = ACCOUNT_NAME;
- return new Account(accountName, ACCOUNT_TYPE);
+ return new Account(accountName, accountType);
}
@Override
diff --git a/common/src/com/example/android/common/db/SelectionBuilder.java b/common/src/java/com/example/android/common/db/SelectionBuilder.java
similarity index 98%
rename from common/src/com/example/android/common/db/SelectionBuilder.java
rename to common/src/java/com/example/android/common/db/SelectionBuilder.java
index 51d8cc3..a1964c5 100644
--- a/common/src/com/example/android/common/db/SelectionBuilder.java
+++ b/common/src/java/com/example/android/common/db/SelectionBuilder.java
@@ -28,12 +28,10 @@
import android.text.TextUtils;
import android.util.Log;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
+import java.util.HashMap;
import java.util.Map;
/**
@@ -96,9 +94,9 @@
private static final String TAG = "basicsyncadapter";
private String mTable = null;
- private Map<String, String> mProjectionMap = Maps.newHashMap();
+ private Map<String, String> mProjectionMap = new HashMap<String, String>();
private StringBuilder mSelection = new StringBuilder();
- private ArrayList<String> mSelectionArgs = Lists.newArrayList();
+ private ArrayList<String> mSelectionArgs = new ArrayList<String>();
/**
* Reset any internal state, allowing this builder to be recycled.
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/build.gradle b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/build.gradle
deleted file mode 100644
index 9424fe8..0000000
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/build.gradle
+++ /dev/null
@@ -1,25 +0,0 @@
-buildscript {
- repositories {
- mavenCentral()
- }
-
- dependencies {
- classpath 'com.android.tools.build:gradle:0.5.+'
- }
-}
-
-apply plugin: 'android'
-
-repositories {
- mavenCentral()
-}
-
-dependencies {
- compile 'com.google.guava:guava:14.0.+'
- compile "com.android.support:support-v4:18.0.+"
-}
-
-android {
- compileSdkVersion 18
- buildToolsVersion "18.0.1"
-}
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values-v11/styles.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values-v11/styles.xml
deleted file mode 100644
index ff65301..0000000
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values-v11/styles.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-Copyright 2013 The Android Open Source Project
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-
-<resources>
-
- <!--
- Base application theme for API 11+. This theme completely replaces
- AppBaseTheme from res/values/styles.xml on API 11+ devices.
- -->
- <style name="AppBaseTheme" parent="android:Theme.Holo.Light">
- <!-- API 11 theme customizations can go here. -->
- </style>
-
-</resources>
\ No newline at end of file
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values-v14/styles.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values-v14/styles.xml
deleted file mode 100644
index a4a443a..0000000
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values-v14/styles.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-Copyright 2013 The Android Open Source Project
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-
-<resources>
-
- <!--
- Base application theme for API 14+. This theme completely replaces
- AppBaseTheme from BOTH res/values/styles.xml and
- res/values-v11/styles.xml on API 14+ devices.
- -->
- <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
- <!-- API 14 theme customizations can go here. -->
- </style>
-
-</resources>
\ No newline at end of file
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values/styles.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values/styles.xml
deleted file mode 100644
index 43a8f2b..0000000
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values/styles.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-Copyright 2013 The Android Open Source Project
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-
-<resources>
-
- <!--
- Base application theme, dependent on API level. This theme is replaced
- by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
- -->
- <style name="AppBaseTheme" parent="android:Theme.Light">
- <!--
- Theme customizations available in newer API levels can go in
- res/values-vXX/styles.xml, while customizations related to
- backward-compatibility can go here.
- -->
- </style>
-
- <!-- Application theme. -->
- <style name="AppTheme" parent="AppBaseTheme">
- <!-- All customizations that are NOT specific to a particular API-level can go here. -->
- </style>
-
-</resources>
\ No newline at end of file
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/.gitignore b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/.gitignore
new file mode 100644
index 0000000..6eb878d
--- /dev/null
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/.gitignore
@@ -0,0 +1,16 @@
+# Copyright 2013 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+src/template/
+src/common/
+build.gradle
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/proguard-project.txt b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/proguard-project.txt
similarity index 91%
rename from connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/proguard-project.txt
rename to connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/proguard-project.txt
index f2fe155..0d8f171 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/proguard-project.txt
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/proguard-project.txt
@@ -1,4 +1,4 @@
-# To enable ProGuard in your project, edit project.properties
+ To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/AndroidManifest.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/AndroidManifest.xml
similarity index 75%
rename from connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/AndroidManifest.xml
rename to connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/AndroidManifest.xml
index 385b293..dd59b06 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/AndroidManifest.xml
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/AndroidManifest.xml
@@ -1,8 +1,26 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.network.sync.basicsyncadapter"
+ package="com.example.android.basicsyncadapter"
android:versionCode="1"
- android:versionName="1.0" >
+ android:versionName="1.0">
<!-- SyncAdapters are available in API 5 and above. We use API 7 as a baseline for samples. -->
<uses-sdk
@@ -27,7 +45,7 @@
<!-- Main activity, responsible for showing a list of feed entries. -->
<activity
- android:name="com.example.android.network.sync.basicsyncadapter.EntryListActivity"
+ android:name=".EntryListActivity"
android:label="@string/app_name" >
<!-- This intent filter places this activity in the system's app launcher. -->
<intent-filter>
@@ -45,14 +63,14 @@
Since this ContentProvider is not exported, it will not be accessible outside of this app's
package. -->
<provider
- android:name=".provider.FeedProvider"
- android:authorities="com.example.android.network.sync.basicsyncadapter"
- android:exported="false" />
+ android:name=".provider.FeedProvider"
+ android:authorities="com.example.android.basicsyncadapter"
+ android:exported="false" />
<!-- This service implements our SyncAdapter. It needs to be exported, so that the system
sync framework can access it. -->
<service android:name=".SyncService"
- android:exported="true">
+ android:exported="true">
<!-- This intent filter is required. It allows the system to launch our sync service
as needed. -->
<intent-filter>
@@ -60,7 +78,7 @@
</intent-filter>
<!-- This points to a required XML file which describes our SyncAdapter. -->
<meta-data android:name="android.content.SyncAdapter"
- android:resource="@xml/syncadapter" />
+ android:resource="@xml/syncadapter" />
</service>
<!-- This implements the account we'll use as an attachment point for our SyncAdapter. Since
@@ -76,9 +94,9 @@
</intent-filter>
<!-- This points to an XMLf ile which describes our account service. -->
<meta-data android:name="android.accounts.AccountAuthenticator"
- android:resource="@xml/authenticator" />
+ android:resource="@xml/authenticator" />
</service>
-</application>
+ </application>
-</manifest>
\ No newline at end of file
+</manifest>
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/EntryListActivity.java b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/EntryListActivity.java
similarity index 85%
rename from connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/EntryListActivity.java
rename to connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/EntryListActivity.java
index cff0702..9d8cb77 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/EntryListActivity.java
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/EntryListActivity.java
@@ -1,4 +1,4 @@
-package com.example.android.network.sync.basicsyncadapter;
+package com.example.android.basicsyncadapter;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/EntryListFragment.java b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/EntryListFragment.java
similarity index 97%
rename from connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/EntryListFragment.java
rename to connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/EntryListFragment.java
index 0efeb40..83e240a 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/EntryListFragment.java
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/EntryListFragment.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.example.android.network.sync.basicsyncadapter;
+package com.example.android.basicsyncadapter;
import android.accounts.Account;
import android.annotation.TargetApi;
@@ -41,13 +41,13 @@
import android.widget.TextView;
import com.example.android.common.accounts.GenericAccountService;
-import com.example.android.network.sync.basicsyncadapter.provider.FeedContract;
+import com.example.android.basicsyncadapter.provider.FeedContract;
/**
* List fragment containing a list of Atom entry objects (articles) stored in the local database.
*
* <p>Database access is mediated by a content provider, specified in
- * {@link com.example.android.network.sync.basicsyncadapter.provider.FeedProvider}. This content
+ * {@link com.example.android.basicsyncadapter.provider.FeedProvider}. This content
* provider is
* automatically populated by {@link SyncService}.
*
@@ -333,7 +333,7 @@
// Create a handle to the account that was created by
// SyncService.CreateSyncAccount(). This will be used to query the system to
// see how the sync status has changed.
- Account account = GenericAccountService.GetAccount();
+ Account account = GenericAccountService.GetAccount(SyncUtils.ACCOUNT_TYPE);
if (account == null) {
// GetAccount() returned an invalid value. This shouldn't happen, but
// we'll set the status to "not refreshing".
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/SyncAdapter.java b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/SyncAdapter.java
similarity index 96%
rename from connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/SyncAdapter.java
rename to connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/SyncAdapter.java
index a759adb..da67107 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/SyncAdapter.java
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/SyncAdapter.java
@@ -14,9 +14,10 @@
* limitations under the License.
*/
-package com.example.android.network.sync.basicsyncadapter;
+package com.example.android.basicsyncadapter;
import android.accounts.Account;
+import android.annotation.TargetApi;
import android.content.AbstractThreadedSyncAdapter;
import android.content.ContentProviderClient;
import android.content.ContentProviderOperation;
@@ -26,12 +27,13 @@
import android.content.SyncResult;
import android.database.Cursor;
import android.net.Uri;
+import android.os.Build;
import android.os.Bundle;
import android.os.RemoteException;
import android.util.Log;
-import com.example.android.network.sync.basicsyncadapter.net.FeedParser;
-import com.example.android.network.sync.basicsyncadapter.provider.FeedContract;
+import com.example.android.basicsyncadapter.net.FeedParser;
+import com.example.android.basicsyncadapter.provider.FeedContract;
import org.xmlpull.v1.XmlPullParserException;
@@ -108,6 +110,7 @@
/**
* Constructor. Obtains handle to content resolver for later use.
*/
+ @TargetApi(Build.VERSION_CODES.HONEYCOMB)
public SyncAdapter(Context context, boolean autoInitialize, boolean allowParallelSyncs) {
super(context, autoInitialize, allowParallelSyncs);
mContentResolver = context.getContentResolver();
@@ -122,7 +125,7 @@
.
*
* <p>This is where we actually perform any work required to perform a sync.
- * {@link AbstractThreadedSyncAdapter} guarantees that this will be called on a non-UI thread,
+ * {@link android.content.AbstractThreadedSyncAdapter} guarantees that this will be called on a non-UI thread,
* so it is safe to peform blocking I/O here.
*
* <p>The syncResult argument allows you to pass information back to the method that triggered
@@ -148,7 +151,7 @@
}
}
} catch (MalformedURLException e) {
- Log.wtf(TAG, "Feed URL is malformed", e);
+ Log.e(TAG, "Feed URL is malformed", e);
syncResult.stats.numParseExceptions++;
return;
} catch (IOException e) {
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/SyncService.java b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/SyncService.java
similarity index 97%
rename from connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/SyncService.java
rename to connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/SyncService.java
index bd92f37..41e9c03 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/SyncService.java
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/SyncService.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.example.android.network.sync.basicsyncadapter;
+package com.example.android.basicsyncadapter;
import android.app.Service;
import android.content.Intent;
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/SyncUtils.java b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/SyncUtils.java
similarity index 82%
rename from connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/SyncUtils.java
rename to connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/SyncUtils.java
index c6552da..b327c72 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/SyncUtils.java
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/SyncUtils.java
@@ -14,17 +14,19 @@
* limitations under the License.
*/
-package com.example.android.network.sync.basicsyncadapter;
+package com.example.android.basicsyncadapter;
import android.accounts.Account;
import android.accounts.AccountManager;
+import android.annotation.TargetApi;
import android.content.ContentResolver;
import android.content.Context;
+import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
import com.example.android.common.accounts.GenericAccountService;
-import com.example.android.network.sync.basicsyncadapter.provider.FeedContract;
+import com.example.android.basicsyncadapter.provider.FeedContract;
/**
* Static helper methods for working with the sync framework.
@@ -33,20 +35,24 @@
private static final long SYNC_FREQUENCY = 60 * 60; // 1 hour (in seconds)
private static final String CONTENT_AUTHORITY = FeedContract.CONTENT_AUTHORITY;
private static final String PREF_SETUP_COMPLETE = "setup_complete";
+ // Value below must match the account type specified in res/xml/syncadapter.xml
+ public static final String ACCOUNT_TYPE = "com.example.android.basicsyncadapter.account";
/**
* Create an entry for this application in the system account list, if it isn't already there.
*
* @param context Context
*/
+ @TargetApi(Build.VERSION_CODES.FROYO)
public static void CreateSyncAccount(Context context) {
boolean newAccount = false;
boolean setupComplete = PreferenceManager
.getDefaultSharedPreferences(context).getBoolean(PREF_SETUP_COMPLETE, false);
// Create account, if it's missing. (Either first run, or user has deleted account.)
- Account account = GenericAccountService.GetAccount();
- AccountManager accountManager = (AccountManager) context.getSystemService(Context.ACCOUNT_SERVICE);
+ Account account = GenericAccountService.GetAccount(ACCOUNT_TYPE);
+ AccountManager accountManager =
+ (AccountManager) context.getSystemService(Context.ACCOUNT_SERVICE);
if (accountManager.addAccountExplicitly(account, null, null)) {
// Inform the system that this account supports sync
ContentResolver.setIsSyncable(account, CONTENT_AUTHORITY, 1);
@@ -86,8 +92,8 @@
b.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
b.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
ContentResolver.requestSync(
- GenericAccountService.GetAccount(), // Sync account
- FeedContract.CONTENT_AUTHORITY, // Content authority
- b); // Extras
+ GenericAccountService.GetAccount(ACCOUNT_TYPE), // Sync account
+ FeedContract.CONTENT_AUTHORITY, // Content authority
+ b); // Extras
}
}
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/net/FeedParser.java b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/net/FeedParser.java
similarity index 94%
rename from connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/net/FeedParser.java
rename to connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/net/FeedParser.java
index 2bcbc0f..a778390 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/net/FeedParser.java
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/net/FeedParser.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.example.android.network.sync.basicsyncadapter.net;
+package com.example.android.basicsyncadapter.net;
import android.text.format.Time;
import android.util.Xml;
@@ -51,9 +51,9 @@
/** Parse an Atom feed, returning a collection of Entry objects.
*
* @param in Atom feed, as a stream.
- * @return List of {@link Entry} objects.
- * @throws XmlPullParserException on error parsing feed.
- * @throws IOException on I/O error.
+ * @return List of {@link com.example.android.basicsyncadapter.net.FeedParser.Entry} objects.
+ * @throws org.xmlpull.v1.XmlPullParserException on error parsing feed.
+ * @throws java.io.IOException on I/O error.
*/
public List<Entry> parse(InputStream in)
throws XmlPullParserException, IOException, ParseException {
@@ -72,9 +72,9 @@
* Decode a feed attached to an XmlPullParser.
*
* @param parser Incoming XMl
- * @return List of {@link Entry} objects.
- * @throws XmlPullParserException on error parsing feed.
- * @throws IOException on I/O error.
+ * @return List of {@link com.example.android.basicsyncadapter.net.FeedParser.Entry} objects.
+ * @throws org.xmlpull.v1.XmlPullParserException on error parsing feed.
+ * @throws java.io.IOException on I/O error.
*/
private List<Entry> readFeed(XmlPullParser parser)
throws XmlPullParserException, IOException, ParseException {
@@ -193,8 +193,8 @@
* @param parser Current parser object
* @param tag XML element tag name to parse
* @return Body of the specified tag
- * @throws IOException
- * @throws XmlPullParserException
+ * @throws java.io.IOException
+ * @throws org.xmlpull.v1.XmlPullParserException
*/
private String readBasicTag(XmlPullParser parser, String tag)
throws IOException, XmlPullParserException {
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/provider/FeedContract.java b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/provider/FeedContract.java
similarity index 90%
rename from connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/provider/FeedContract.java
rename to connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/provider/FeedContract.java
index 7bfcf7f..e29ec48 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/provider/FeedContract.java
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/provider/FeedContract.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.example.android.network.sync.basicsyncadapter.provider;
+package com.example.android.basicsyncadapter.provider;
import android.content.ContentResolver;
import android.net.Uri;
@@ -22,7 +22,7 @@
/**
* Field and table name constants for
- * {@link com.example.android.network.sync.basicsyncadapter.provider.FeedProvider}.
+ * {@link com.example.android.basicsyncadapter.provider.FeedProvider}.
*/
public class FeedContract {
private FeedContract() {
@@ -31,10 +31,10 @@
/**
* Content provider authority.
*/
- public static final String CONTENT_AUTHORITY = "com.example.android.network.sync.basicsyncadapter";
+ public static final String CONTENT_AUTHORITY = "com.example.android.basicsyncadapter";
/**
- * Base URI. (content://com.example.android.network.sync.basicsyncadapter)
+ * Base URI. (content://com.example.android.basicsyncadapter)
*/
public static final Uri BASE_CONTENT_URI = Uri.parse("content://" + CONTENT_AUTHORITY);
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/provider/FeedProvider.java b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/provider/FeedProvider.java
similarity index 98%
rename from connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/provider/FeedProvider.java
rename to connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/provider/FeedProvider.java
index 358e324..80bf1d3 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/provider/FeedProvider.java
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/provider/FeedProvider.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.example.android.network.sync.basicsyncadapter.provider;
+package com.example.android.basicsyncadapter.provider;
import android.content.ContentProvider;
import android.content.ContentValues;
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/drawable-hdpi/ic_launcher.png b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/drawable-hdpi/ic_launcher.png
similarity index 100%
rename from connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/drawable-hdpi/ic_launcher.png
rename to connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/drawable-mdpi/ic_launcher.png b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/drawable-mdpi/ic_launcher.png
similarity index 100%
rename from connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/drawable-mdpi/ic_launcher.png
rename to connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/drawable-xhdpi/ic_action_refresh.png b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/drawable-xhdpi/ic_action_refresh.png
similarity index 100%
rename from connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/drawable-xhdpi/ic_action_refresh.png
rename to connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/drawable-xhdpi/ic_action_refresh.png
Binary files differ
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/drawable-xhdpi/ic_launcher.png b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/drawable-xhdpi/ic_launcher.png
similarity index 100%
rename from connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/drawable-xhdpi/ic_launcher.png
rename to connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/drawable-xxhdpi/ic_launcher.png b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/drawable-xxhdpi/ic_launcher.png
similarity index 100%
rename from connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/drawable-xxhdpi/ic_launcher.png
rename to connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/layout/actionbar_indeterminate_progress.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/layout/actionbar_indeterminate_progress.xml
similarity index 100%
rename from connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/layout/actionbar_indeterminate_progress.xml
rename to connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/layout/actionbar_indeterminate_progress.xml
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/layout/activity_entry_list.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/layout/activity_entry_list.xml
similarity index 83%
rename from connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/layout/activity_entry_list.xml
rename to connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/layout/activity_entry_list.xml
index 6e3e2fd..3c8c901 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/layout/activity_entry_list.xml
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/layout/activity_entry_list.xml
@@ -3,7 +3,7 @@
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/entry_list"
- android:name="com.example.android.network.sync.basicsyncadapter.EntryListFragment"
+ android:name="com.example.android.basicsyncadapter.EntryListFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="16dp"
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/menu/main.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/menu/main.xml
similarity index 100%
rename from connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/menu/main.xml
rename to connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/menu/main.xml
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values/attrs.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/values/attrs.xml
similarity index 100%
rename from connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values/attrs.xml
rename to connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/values/attrs.xml
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values/dimen.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/values/dimen.xml
similarity index 100%
rename from connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values/dimen.xml
rename to connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/values/dimen.xml
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values/strings.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/values/strings.xml
similarity index 94%
rename from connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values/strings.xml
rename to connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/values/strings.xml
index 0271850..f4cade9 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values/strings.xml
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/values/strings.xml
@@ -16,7 +16,6 @@
-->
<resources>
- <string name="app_name">FeedSync Sample</string>
<string name="account_name">FeedSync Service</string>
<string name="title_entry_detail">Entry Detail</string>
<string name="loading">Waiting for sync...</string>
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/xml/authenticator.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/xml/authenticator.xml
similarity index 96%
rename from connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/xml/authenticator.xml
rename to connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/xml/authenticator.xml
index cb69a66..8b96907 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/xml/authenticator.xml
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/xml/authenticator.xml
@@ -16,7 +16,7 @@
-->
<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
- android:accountType="com.example.android.network.sync.basicsyncadapter"
+ android:accountType="com.example.android.basicsyncadapter.account"
android:icon="@drawable/ic_launcher"
android:smallIcon="@drawable/ic_launcher"
android:label="@string/app_name"
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/xml/syncadapter.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/xml/syncadapter.xml
similarity index 83%
rename from connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/xml/syncadapter.xml
rename to connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/xml/syncadapter.xml
index 0fcd6e3..6e12882 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/xml/syncadapter.xml
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/xml/syncadapter.xml
@@ -16,8 +16,8 @@
-->
<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
- android:contentAuthority="com.example.android.network.sync.basicsyncadapter"
- android:accountType="com.example.android.network.sync.basicsyncadapter"
+ android:contentAuthority="com.example.android.basicsyncadapter"
+ android:accountType="com.example.android.basicsyncadapter.account"
android:userVisible="false"
android:supportsUploading="false"
android:allowParallelSyncs="false"
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/tests/AndroidManifest.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/tests/AndroidManifest.xml
new file mode 100644
index 0000000..87b785f
--- /dev/null
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/tests/AndroidManifest.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<!-- package name must be unique so suffix with "tests" so package loader doesn't ignore us -->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="${sample.package}.tests"
+ android:versionCode="1"
+ android:versionName="1.0">
+
+ <uses-sdk
+ android:minSdkVersion="18"
+ android:targetSdkVersion="19" />
+
+ <!-- We add an application tag here just so that we can indicate that
+ this package needs to link against the android.test library,
+ which is needed when building test cases. -->
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <!--
+ Specifies the instrumentation test runner used to run the tests.
+ -->
+ <instrumentation
+ android:name="android.test.InstrumentationTestRunner"
+ android:targetPackage="${sample.package}"
+ android:label="Tests for ${sample.package}" />
+
+</manifest>
\ No newline at end of file
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/tests/src/com/example/android/basicsyncadapter/tests/SampleTests.java b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/tests/src/com/example/android/basicsyncadapter/tests/SampleTests.java
new file mode 100644
index 0000000..08798ba
--- /dev/null
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/tests/src/com/example/android/basicsyncadapter/tests/SampleTests.java
@@ -0,0 +1,79 @@
+/*
+* Copyright 2013 The Android Open Source Project
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+
+/*
+* Copyright (C) 2013 The Android Open Source Project
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package com.example.android.basicsyncadapter.tests;
+
+import com.example.android.basicsyncadapter.*;
+
+import android.test.ActivityInstrumentationTestCase2;
+
+/**
+* Tests for BasicSyncAdapter sample.
+*/
+public class SampleTests extends ActivityInstrumentationTestCase2<MainActivity> {
+
+ private MainActivity mTestActivity;
+ private BasicSyncAdapterFragment mTestFragment;
+
+ public SampleTests() {
+ super(MainActivity.class);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ // Starts the activity under test using the default Intent with:
+ // action = {@link Intent#ACTION_MAIN}
+ // flags = {@link Intent#FLAG_ACTIVITY_NEW_TASK}
+ // All other fields are null or empty.
+ mTestActivity = getActivity();
+ mTestFragment = (BasicSyncAdapterFragment)
+ mTestActivity.getSupportFragmentManager().getFragments().get(1);
+ }
+
+ /**
+ * Test if the test fixture has been set up correctly.
+ */
+ public void testPreconditions() {
+ //Try to add a message to add context to your assertions. These messages will be shown if
+ //a tests fails and make it easy to understand why a test failed
+ assertNotNull("mTestActivity is null", mTestActivity);
+ assertNotNull("mTestFragment is null", mTestFragment);
+ }
+
+ /**
+ * Add more tests below.
+ */
+
+}
\ No newline at end of file
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/AndroidManifest.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/AndroidManifest.xml
deleted file mode 100644
index 91c9861..0000000
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/AndroidManifest.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- package name must be unique so suffix with "tests" so package loader doesn't ignore us -->
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.network.sync.basicsyncadapter.tests"
- android:versionCode="1"
- android:versionName="1.0">
- <uses-sdk
- android:minSdkVersion="11"
- android:targetSdkVersion="17" />
-
- <!-- We add an application tag here just so that we can indicate that
- this package needs to link against the android.test library,
- which is needed when building test cases. -->
- <application>
- <uses-library android:name="android.test.runner"/>
- </application>
- <!--
- This declares that this application uses the instrumentation test runner targeting
- the package of com.android.example.FeedSyncSampleTo run the tests use the command:
- "adb shell am instrument -w com.android.example.FeedSyncSamplests/android.test.InstrumentationTestRunner"
- -->
- <instrumentation
- android:name="android.test.InstrumentationTestRunner"
- android:targetPackage="com.example.android.network.sync.basicsyncadapter"
- android:label="Tests for com.example.android.network.sync.BasicSyncAdapter"/>
-</manifest>
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/src/com/example/android/network/sync/basicsyncadapter/SyncAdapterTest.java b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/src/com/example/android/network/sync/basicsyncadapter/SyncAdapterTest.java
deleted file mode 100644
index 820882d..0000000
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/src/com/example/android/network/sync/basicsyncadapter/SyncAdapterTest.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package com.example.android.network.sync.basicsyncadapter;
-
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.OperationApplicationException;
-import android.content.SyncResult;
-import android.database.Cursor;
-import android.os.RemoteException;
-import android.test.ServiceTestCase;
-
-import com.example.android.network.sync.basicsyncadapter.provider.FeedContract;
-
-import org.xmlpull.v1.XmlPullParserException;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.text.ParseException;
-
-public class SyncAdapterTest extends ServiceTestCase<SyncService> {
- public SyncAdapterTest() {
- super(SyncService.class);
- }
-
- public void testIncomingFeedParsed()
- throws IOException, XmlPullParserException, RemoteException,
- OperationApplicationException, ParseException {
- String sampleFeed = "<?xml version=\"1.0\"?>\n" +
- "<feed xmlns=\"http://www.w3.org/2005/Atom\">\n" +
- " \n" +
- " <title>Sample Blog</title>\n" +
- " <link href=\"http://example.com/\"/>\n" +
- " <link type=\"application/atom+xml\" rel=\"self\" href=\"http://example.xom/feed.xml\"/>\n" +
- " <updated>2013-05-16T16:53:23-07:00</updated>\n" +
- " <id>http://example.com/</id>\n" +
- " <author>\n" +
- " <name>Rick Deckard</name>\n" +
- " <email>[email protected]</email>\n" +
- " </author>\n" +
- "\n" +
- " <entry>\n" +
- " <id>http://example.com/2012/10/20/test-post</id>\n" +
- " <link type=\"text/html\" rel=\"alternate\" href=\"http://example.com/2012/10/20/test-post.html\"/>\n" +
- " <title>Test Post #1</title>\n" +
- " <published>2012-10-20T00:00:00-07:00</published>\n" +
- " <updated>2012-10-20T00:00:00-07:00</updated>\n" +
- " <author>\n" +
- " <name>Rick Deckard</name>\n" +
- " <uri>http://example.com/</uri>\n" +
- " </author>\n" +
- " <summary>This is a sample summary.</summary>\n" +
- " <content type=\"html\">Here's some <em>sample</em> content.</content>\n" +
- " </entry>\n" +
- "</feed>\n";
- InputStream stream = new ByteArrayInputStream(sampleFeed.getBytes());
- SyncAdapter adapter = new SyncAdapter(getContext(), false);
- adapter.updateLocalFeedData(stream, new SyncResult());
-
- Context ctx = getContext();
- assert ctx != null;
- ContentResolver cr = ctx.getContentResolver();
- final String[] projection = {FeedContract.Entry.COLUMN_NAME_ENTRY_ID,
- FeedContract.Entry.COLUMN_NAME_TITLE,
- FeedContract.Entry.COLUMN_NAME_LINK};
- Cursor c = cr.query(FeedContract.Entry.CONTENT_URI, projection, null, null, null);
- assert c != null;
- assertEquals(1, c.getCount());
- c.moveToFirst();
- assertEquals("http://example.com/2012/10/20/test-post", c.getString(0));
- assertEquals("Test Post #1", c.getString(1));
- assertEquals("http://example.com/2012/10/20/test-post.html", c.getString(2));
- }
-}
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/src/com/example/android/network/sync/basicsyncadapter/net/FeedParserTest.java b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/src/com/example/android/network/sync/basicsyncadapter/net/FeedParserTest.java
deleted file mode 100644
index 0c66871..0000000
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/src/com/example/android/network/sync/basicsyncadapter/net/FeedParserTest.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.example.android.network.sync.basicsyncadapter.net;
-
-import junit.framework.TestCase;
-
-public class FeedParserTest extends TestCase {
- public FeedParserTest() {
- super();
- }
-
-// public void testEntriesEqualById() {
-// FeedParser.Entry e1 = new FeedParser.Entry("alpha", "Aardvark", "Bear", "Cat");
-// FeedParser.Entry e2 = new FeedParser.Entry("alpha", "Dog", "Elephant", "Faun");
-// assertEquals(e1, e2);
-// }
-//
-// public void testEntriesHashById() {
-// FeedParser.Entry e1 = new FeedParser.Entry("alpha", "Aardvark", "Bear", "Cat");
-// FeedParser.Entry e2 = new FeedParser.Entry("alpha", "Dog", "Elephant", "Faun");
-// assertEquals(e1.hashCode(), e2.hashCode());
-// }
-}
\ No newline at end of file
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/src/com/example/android/network/sync/basicsyncadapter/provider/FeedProviderTest.java b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/src/com/example/android/network/sync/basicsyncadapter/provider/FeedProviderTest.java
deleted file mode 100644
index a80b5ca..0000000
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/src/com/example/android/network/sync/basicsyncadapter/provider/FeedProviderTest.java
+++ /dev/null
@@ -1,119 +0,0 @@
-package com.example.android.network.sync.basicsyncadapter.provider;
-
-import android.content.ContentValues;
-import android.database.Cursor;
-import android.net.Uri;
-import android.test.ProviderTestCase2;
-
-public class FeedProviderTest extends ProviderTestCase2<FeedProvider> {
- public FeedProviderTest() {
- super(FeedProvider.class, FeedContract.CONTENT_AUTHORITY);
- }
-
- public void testEntryContentUriIsSane() {
- assertEquals(Uri.parse("content://com.example.android.network.sync.basicsyncadapter/entries"),
- FeedContract.Entry.CONTENT_URI);
- }
-
- public void testCreateAndRetrieve() {
- // Create
- ContentValues newValues = new ContentValues();
- newValues.put(FeedContract.Entry.COLUMN_NAME_TITLE, "MyTitle");
- newValues.put(FeedContract.Entry.COLUMN_NAME_LINK, "http://example.com");
- newValues.put(FeedContract.Entry.COLUMN_NAME_ENTRY_ID, "MyEntryID");
- Uri newUri = getMockContentResolver().insert(
- FeedContract.Entry.CONTENT_URI,
- newValues);
-
- // Retrieve
- String[] projection = {
- FeedContract.Entry.COLUMN_NAME_TITLE, // 0
- FeedContract.Entry.COLUMN_NAME_LINK, // 1
- FeedContract.Entry.COLUMN_NAME_ENTRY_ID}; // 2
- Cursor c = getMockContentResolver().query(newUri, projection, null, null, null);
- assertEquals(1, c.getCount());
- c.moveToFirst();
- assertEquals("MyTitle", c.getString(0));
- assertEquals("http://example.com", c.getString(1));
- assertEquals("MyEntryID", c.getString(2));
- }
-
- public void testCreateAndQuery() {
- // Create
- ContentValues newValues = new ContentValues();
- newValues.put(FeedContract.Entry.COLUMN_NAME_TITLE, "Alpha-MyTitle");
- newValues.put(FeedContract.Entry.COLUMN_NAME_LINK, "http://alpha.example.com");
- newValues.put(FeedContract.Entry.COLUMN_NAME_ENTRY_ID, "Alpha-MyEntryID");
- getMockContentResolver().insert(
- FeedContract.Entry.CONTENT_URI,
- newValues);
-
- newValues = new ContentValues();
- newValues.put(FeedContract.Entry.COLUMN_NAME_TITLE, "Beta-MyTitle");
- newValues.put(FeedContract.Entry.COLUMN_NAME_LINK, "http://beta.example.com");
- newValues.put(FeedContract.Entry.COLUMN_NAME_ENTRY_ID, "Beta-MyEntryID");
- getMockContentResolver().insert(
- FeedContract.Entry.CONTENT_URI,
- newValues);
-
- // Retrieve
- String[] projection = {
- FeedContract.Entry.COLUMN_NAME_TITLE, // 0
- FeedContract.Entry.COLUMN_NAME_LINK, // 1
- FeedContract.Entry.COLUMN_NAME_ENTRY_ID}; // 2
- String where = FeedContract.Entry.COLUMN_NAME_TITLE + " LIKE ?";
- Cursor c = getMockContentResolver().query(FeedContract.Entry.CONTENT_URI, projection,
- where, new String[] {"Alpha%"}, null);
- assertEquals(1, c.getCount());
- c.moveToFirst();
- assertEquals("Alpha-MyTitle", c.getString(0));
- assertEquals("http://alpha.example.com", c.getString(1));
- assertEquals("Alpha-MyEntryID", c.getString(2));
- }
-
- public void testUpdate() {
- // Create
- ContentValues newValues = new ContentValues();
- newValues.put(FeedContract.Entry.COLUMN_NAME_TITLE, "Alpha-MyTitle");
- newValues.put(FeedContract.Entry.COLUMN_NAME_LINK, "http://alpha.example.com");
- newValues.put(FeedContract.Entry.COLUMN_NAME_ENTRY_ID, "Alpha-MyEntryID");
- Uri alpha = getMockContentResolver().insert(
- FeedContract.Entry.CONTENT_URI,
- newValues);
-
- newValues = new ContentValues();
- newValues.put(FeedContract.Entry.COLUMN_NAME_TITLE, "Beta-MyTitle");
- newValues.put(FeedContract.Entry.COLUMN_NAME_LINK, "http://beta.example.com");
- newValues.put(FeedContract.Entry.COLUMN_NAME_ENTRY_ID, "Beta-MyEntryID");
- Uri beta = getMockContentResolver().insert(
- FeedContract.Entry.CONTENT_URI,
- newValues);
-
- // Update
- newValues = new ContentValues();
- newValues.put(FeedContract.Entry.COLUMN_NAME_LINK, "http://replaced.example.com");
- getMockContentResolver().update(alpha, newValues, null, null);
-
- // Retrieve
- String[] projection = {
- FeedContract.Entry.COLUMN_NAME_TITLE, // 0
- FeedContract.Entry.COLUMN_NAME_LINK, // 1
- FeedContract.Entry.COLUMN_NAME_ENTRY_ID}; // 2
- // Check that alpha was updated
- Cursor c = getMockContentResolver().query(alpha, projection, null, null, null);
- assertEquals(1, c.getCount());
- c.moveToFirst();
- assertEquals("Alpha-MyTitle", c.getString(0));
- assertEquals("http://replaced.example.com", c.getString(1));
- assertEquals("Alpha-MyEntryID", c.getString(2));
-
- // ...and that beta was not
- c = getMockContentResolver().query(beta, projection, null, null, null);
- assertEquals(1, c.getCount());
- c.moveToFirst();
- assertEquals("Beta-MyTitle", c.getString(0));
- assertEquals("http://beta.example.com", c.getString(1));
- assertEquals("Beta-MyEntryID", c.getString(2));
- }
-
-}
diff --git a/connectivity/sync/BasicSyncAdapter/README.txt b/connectivity/sync/BasicSyncAdapter/README.txt
deleted file mode 100644
index 38608df..0000000
--- a/connectivity/sync/BasicSyncAdapter/README.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-Build Instructions
--------------------
-This sample uses the Gradle build system. To build this project, use the
-"gradlew build" command.
-
-To see a list of all available commands, run "gradlew tasks".
\ No newline at end of file
diff --git a/connectivity/sync/BasicSyncAdapter/build.gradle b/connectivity/sync/BasicSyncAdapter/build.gradle
index 495c503..ffb5c2f 100644
--- a/connectivity/sync/BasicSyncAdapter/build.gradle
+++ b/connectivity/sync/BasicSyncAdapter/build.gradle
@@ -1 +1,11 @@
-// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+
+
+
+// BEGIN_EXCLUDE
+apply from: "../../../../../build/build.gradle"
+samplegen {
+ pathToBuild "../../../../../build"
+ pathToSamplesCommon "../../../common"
+}
+// END_EXCLUDE
diff --git a/connectivity/sync/BasicSyncAdapter/buildSrc/build.gradle b/connectivity/sync/BasicSyncAdapter/buildSrc/build.gradle
new file mode 100644
index 0000000..e344a8c
--- /dev/null
+++ b/connectivity/sync/BasicSyncAdapter/buildSrc/build.gradle
@@ -0,0 +1,18 @@
+
+
+
+repositories {
+ mavenCentral()
+}
+dependencies {
+ compile 'org.freemarker:freemarker:2.3.20'
+}
+
+sourceSets {
+ main {
+ groovy {
+ srcDir new File(rootDir, "../../../../../../build/buildSrc/src/main/groovy")
+ }
+ }
+}
+
diff --git a/connectivity/sync/BasicSyncAdapter/gradle/wrapper/gradle-wrapper.properties b/connectivity/sync/BasicSyncAdapter/gradle/wrapper/gradle-wrapper.properties
index 055ba6f..5c22dec 100644
--- a/connectivity/sync/BasicSyncAdapter/gradle/wrapper/gradle-wrapper.properties
+++ b/connectivity/sync/BasicSyncAdapter/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,4 @@
-#
-#Mon Jul 22 11:40:20 PDT 2013
+#Wed Apr 10 15:27:10 PDT 2013
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
diff --git a/connectivity/sync/BasicSyncAdapter/settings.gradle b/connectivity/sync/BasicSyncAdapter/settings.gradle
index 5f2be67..a691e9e 100644
--- a/connectivity/sync/BasicSyncAdapter/settings.gradle
+++ b/connectivity/sync/BasicSyncAdapter/settings.gradle
@@ -1 +1,4 @@
-include ':BasicSyncAdapter'
+
+
+
+include 'BasicSyncAdapterSample'
diff --git a/connectivity/sync/BasicSyncAdapter/template-params.xml b/connectivity/sync/BasicSyncAdapter/template-params.xml
new file mode 100644
index 0000000..ba1feff
--- /dev/null
+++ b/connectivity/sync/BasicSyncAdapter/template-params.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+
+
+<sample>
+ <name>BasicSyncAdapter</name>
+ <package>com.example.android.basicsyncadapter</package>
+
+
+ <!-- change minSdk if needed-->
+ <minSdk>7</minSdk>
+
+ <strings>
+ <intro>
+ <![CDATA[
+ This sample demonstrates using SyncAdapter to fetch background data for an app that
+ doesn\'t require a user-visible account type or 2-way synchronization.
+
+ \n\nThis sample periodically downloads the feed from the Android Developer Blog and
+ caches the data in a content provider. At runtime, the cached feed data is displayed
+ inside a ListView.
+ ]]>
+ </intro>
+ </strings>
+
+ <template src="base"/>
+ <common src="accounts"/>
+ <common src="db"/>
+ <common src="logger"/>
+</sample>
diff --git a/input/gestures/BasicGestureDetect/BasicGestureDetect/_index.jd b/input/gestures/BasicGestureDetect/BasicGestureDetect/_index.jd
deleted file mode 100644
index db0461b..0000000
--- a/input/gestures/BasicGestureDetect/BasicGestureDetect/_index.jd
+++ /dev/null
@@ -1,6 +0,0 @@
-page.tags="gestures", "motion event"
-sample.group=Input
-@jd:body
-
-<p>Example code that shows how to handle gestures in apps and games.</p>
-
diff --git a/input/gestures/BasicGestureDetect/BasicGestureDetect/build.gradle b/input/gestures/BasicGestureDetect/BasicGestureDetect/build.gradle
deleted file mode 100644
index 10fb811..0000000
--- a/input/gestures/BasicGestureDetect/BasicGestureDetect/build.gradle
+++ /dev/null
@@ -1,10 +0,0 @@
-apply plugin: 'android'
-
-dependencies {
- compile "com.android.support:support-v4:18.0.+"
-}
-
-android {
- compileSdkVersion 18
- buildToolsVersion "18.0.1"
-}
diff --git a/input/gestures/BasicGestureDetect/BasicGestureDetect/libs/android-support-v4.jar b/input/gestures/BasicGestureDetect/BasicGestureDetect/libs/android-support-v4.jar
deleted file mode 100644
index 428bdbc..0000000
--- a/input/gestures/BasicGestureDetect/BasicGestureDetect/libs/android-support-v4.jar
+++ /dev/null
Binary files differ
diff --git a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/AndroidManifest.xml b/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/AndroidManifest.xml
deleted file mode 100755
index 9c6ec99..0000000
--- a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<!--
- Copyright 2013 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<manifest
- xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.basicgesturedetect"
- android:versionCode="1"
- android:versionName="1.0">
-
- <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" />
-
- <application
- android:label="@string/app_name"
- android:icon="@drawable/ic_launcher"
- android:theme="@style/Theme.Sample"
- android:allowBackup="true">
-
- <activity
- android:name=".MainActivity"
- android:label="@string/app_name"
- android:uiOptions="splitActionBarWhenNarrow">
-
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
-</manifest>
diff --git a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/java/com/example/android/basicgesturedetect/GestureListener.java b/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/java/com/example/android/basicgesturedetect/GestureListener.java
deleted file mode 100644
index 2e2921d..0000000
--- a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/java/com/example/android/basicgesturedetect/GestureListener.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.example.android.basicgesturedetect;
-
-import android.view.GestureDetector;
-import android.view.MotionEvent;
-
-import com.example.android.common.logger.Log;
-
-public class GestureListener extends GestureDetector.SimpleOnGestureListener {
-
- public static final String TAG = "GestureListener";
-
- // BEGIN_INCLUDE(init_gestureListener)
- @Override
- public boolean onSingleTapUp(MotionEvent e) {
- // Up motion completing a single tap occurred.
- Log.i(TAG, "Single Tap Up");
- return false;
- }
-
- @Override
- public void onLongPress(MotionEvent e) {
- // Touch has been long enough to indicate a long press.
- // Does not indicate motion is complete yet (no up event necessarily)
- Log.i(TAG, "Long Press");
- }
-
- @Override
- public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX,
- float distanceY) {
- // User attempted to scroll
- Log.i(TAG, "Scroll");
- return false;
- }
-
- @Override
- public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
- float velocityY) {
- // Fling event occurred. Notification of this one happens after an "up" event.
- Log.i(TAG, "Fling");
- return false;
- }
-
- @Override
- public void onShowPress(MotionEvent e) {
- // User performed a down event, and hasn't moved yet.
- Log.i(TAG, "Show Press");
- }
-
- @Override
- public boolean onDown(MotionEvent e) {
- // "Down" event - User touched the screen.
- Log.i(TAG, "Down");
- return false;
- }
-
- @Override
- public boolean onDoubleTap(MotionEvent e) {
- // User tapped the screen twice.
- Log.i(TAG, "Double tap");
- return false;
- }
-
- @Override
- public boolean onDoubleTapEvent(MotionEvent e) {
- // Since double-tap is actually several events which are considered one aggregate
- // gesture, there's a separate callback for an individual event within the doubletap
- // occurring. This occurs for down, up, and move.
- Log.i(TAG, "Event within double tap");
- return false;
- }
-
- @Override
- public boolean onSingleTapConfirmed(MotionEvent e) {
- // A confirmed single-tap event has occurred. Only called when the detector has
- // determined that the first tap stands alone, and is not part of a double tap.
- Log.i(TAG, "Single tap confirmed");
- return false;
- }
- // END_INCLUDE(init_gestureListener)
-}
diff --git a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/java/com/example/android/basicgesturedetect/LogFragment.java b/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/java/com/example/android/basicgesturedetect/LogFragment.java
deleted file mode 100644
index 849edac..0000000
--- a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/java/com/example/android/basicgesturedetect/LogFragment.java
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2013 Google Inc. All Rights Reserved.
-
-package com.example.android.basicgesturedetect;
-
-import com.example.android.common.logger.LogView;
-
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.text.Editable;
-import android.text.TextWatcher;
-
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ScrollView;
-
-/**
- * Simple fraggment which contains a LogView and uses is to output log data it receives
- * through the LogNode interface.
- */
-public class LogFragment extends Fragment {
-
- private LogView mLogView;
-
- public LogFragment() {}
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
-
- View result = inflater.inflate(R.layout.log_fragment, container, false);
-
- mLogView = (LogView) result.findViewById(R.id.sample_output);
-
- // Wire up so when the text changes, the view scrolls down.
- final ScrollView scrollView =
- ((ScrollView) result.findViewById(R.id.log_scroll));
-
- mLogView.addTextChangedListener(new TextWatcher() {
- @Override
- public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
-
- @Override
- public void onTextChanged(CharSequence s, int start, int before, int count) {}
-
- @Override
- public void afterTextChanged(Editable s) {
- scrollView.fullScroll(ScrollView.FOCUS_DOWN);
- }
- });
-
- return result;
- }
-
- public LogView getLogView() {
- return mLogView;
- }
-}
\ No newline at end of file
diff --git a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/java/com/example/android/basicgesturedetect/MainActivity.java b/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/java/com/example/android/basicgesturedetect/MainActivity.java
deleted file mode 100755
index 4654ac9..0000000
--- a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/java/com/example/android/basicgesturedetect/MainActivity.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.example.android.basicgesturedetect;
-
-import android.os.Bundle;
-import android.support.v4.app.FragmentActivity;
-import android.util.TypedValue;
-import android.view.GestureDetector;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.MotionEvent;
-import android.view.View;
-
-import com.example.android.common.logger.LogWrapper;
-import com.example.android.common.logger.Log;
-import com.example.android.common.widgets.SimpleTextFragment;
-import com.example.android.common.logger.MessageOnlyLogFilter;
-
-/**
- * Sample application demonstrating how to use GestureDetector go detect when a user performs
- * a gesture that's recognized by the framework. This example uses SimpleGestureDetector. If you
- * want to detect
- * as well as customize that shortcut with metadata to send along to the application it activates.
- * Code is also included for removing your shortcut from the homescreen, for situations where that
- * is necessary (for instance, removing a shortcut to some data when that data is deleted from your
- * app).
- */
-public class MainActivity extends FragmentActivity {
-
- public static final String TAG = "Basic Gesture Detector";
-
- // Reference to the fragment showing events, so we can clear it with a button as necessary.
- private LogFragment mLogFragment;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- SimpleTextFragment actionFragment = (SimpleTextFragment)
- getSupportFragmentManager().findFragmentById(R.id.intro_fragment);
- actionFragment.setText(R.string.intro_message);
- actionFragment.getView().setClickable(true);
- actionFragment.getView().setFocusable(true);
- actionFragment.getTextView().setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16.0f);
-
-
- // BEGIN_INCLUDE(init_detector)
-
- // First create the GestureListener that will include all our callbacks.
- // Then create the GestureDetector, which takes that listener as an argument.
- GestureDetector.SimpleOnGestureListener gestureListener = getGestureListener();
- final GestureDetector gd = new GestureDetector(this, gestureListener);
-
- /* For the view where gestures will occur, create an onTouchListener that sends
- * all motion events to the gesture detector. When the gesture detector
- * actually detects an event, it will use the callbacks you created in the
- * SimpleOnGestureListener to alert your application.
- */
-
- actionFragment.getView().setOnTouchListener(new View.OnTouchListener() {
- @Override
- public boolean onTouch(View view, MotionEvent motionEvent) {
- gd.onTouchEvent(motionEvent);
- return false;
- }
- });
- // END_INCLUDE(init_detector)
-
- initializeLogging();
- }
-
- /** Create a gesture listener which will be attached to the GestureDetector.
- * This listener is where you can write all your callbacks for when certain events occur.
- * @return The listener your GestureDetector will use to inform your application when
- * the supported gestures occur.
- */
- public GestureDetector.SimpleOnGestureListener getGestureListener() {
- return new GestureListener();
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case R.id.sample_action:
- // Clears the log fragment when clicked.
- mLogFragment.getLogView().setText("");
- return true;
- }
- return false;
- }
-
- /** Create a chain of targets that will receive log data */
- public void initializeLogging() {
- // Wraps Android's native log framework.
- LogWrapper logWrapper = new LogWrapper();
- // Using Log, front-end to the logging chain, emulates android.util.log method signatures.
- Log.setLogNode(logWrapper);
-
- // Filter strips out everything except the message text.
- MessageOnlyLogFilter msgFilter = new MessageOnlyLogFilter();
- logWrapper.setNext(msgFilter);
-
- // On screen logging via a fragment with a TextView.
- mLogFragment =
- (LogFragment) getSupportFragmentManager().findFragmentById(R.id.log_fragment);
- msgFilter.setNext(mLogFragment.getLogView());
-
- Log.i(TAG, "Ready");
- }
-}
\ No newline at end of file
diff --git a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/java/com/example/android/common/logger/Log.java b/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/java/com/example/android/common/logger/Log.java
deleted file mode 100644
index a87f299..0000000
--- a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/java/com/example/android/common/logger/Log.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.example.android.common.logger;
-
-/**
- * Helper class for a list (or tree) of LoggerNodes.
- *
- * <p>When this is set as the head of the list,
- * an instance of it can function as a drop-in replacement for {@link android.util.Log}.
- * Most of the methods in this class server only to map a method call in Log to its equivalent
- * in LogNode.</p>
- */
-public class Log {
- // Grab the native values from Android's native logging facilities,
- // to make for easy migration and interop.
- public static final int NONE = -1;
- public static final int VERBOSE = android.util.Log.VERBOSE;
- public static final int DEBUG = android.util.Log.DEBUG;
- public static final int INFO = android.util.Log.INFO;
- public static final int WARN = android.util.Log.WARN;
- public static final int ERROR = android.util.Log.ERROR;
- public static final int ASSERT = android.util.Log.ASSERT;
-
- // Stores the beginning of the LogNode topology.
- private static LogNode mLogNode;
-
- /**
- * Returns the next LogNode in the linked list.
- */
- public static LogNode getLogNode() {
- return mLogNode;
- }
-
- /**
- * Sets the LogNode data will be sent to.
- */
- public static void setLogNode(LogNode node) {
- mLogNode = node;
- }
-
- /**
- * Instructs the LogNode to print the log data provided. Other LogNodes can
- * be chained to the end of the LogNode as desired.
- *
- * @param priority Log level of the data being logged. Verbose, Error, etc.
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param msg The actual message to be logged.
- * @param tr If an exception was thrown, this can be sent along for the logging facilities
- * to extract and print useful information.
- */
- public static void println(int priority, String tag, String msg, Throwable tr) {
- if (mLogNode != null) {
- mLogNode.println(priority, tag, msg, tr);
- }
- }
-
- /**
- * Instructs the LogNode to print the log data provided. Other LogNodes can
- * be chained to the end of the LogNode as desired.
- *
- * @param priority Log level of the data being logged. Verbose, Error, etc.
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param msg The actual message to be logged. The actual message to be logged.
- */
- public static void println(int priority, String tag, String msg) {
- println(priority, tag, msg, null);
- }
-
- /**
- * Prints a message at VERBOSE priority.
- *
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param msg The actual message to be logged.
- * @param tr If an exception was thrown, this can be sent along for the logging facilities
- * to extract and print useful information.
- */
- public static void v(String tag, String msg, Throwable tr) {
- println(VERBOSE, tag, msg, tr);
- }
-
- /**
- * Prints a message at VERBOSE priority.
- *
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param msg The actual message to be logged.
- */
- public static void v(String tag, String msg) {
- v(tag, msg, null);
- }
-
-
- /**
- * Prints a message at DEBUG priority.
- *
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param msg The actual message to be logged.
- * @param tr If an exception was thrown, this can be sent along for the logging facilities
- * to extract and print useful information.
- */
- public static void d(String tag, String msg, Throwable tr) {
- println(DEBUG, tag, msg, tr);
- }
-
- /**
- * Prints a message at DEBUG priority.
- *
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param msg The actual message to be logged.
- */
- public static void d(String tag, String msg) {
- d(tag, msg, null);
- }
-
- /**
- * Prints a message at INFO priority.
- *
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param msg The actual message to be logged.
- * @param tr If an exception was thrown, this can be sent along for the logging facilities
- * to extract and print useful information.
- */
- public static void i(String tag, String msg, Throwable tr) {
- println(INFO, tag, msg, tr);
- }
-
- /**
- * Prints a message at INFO priority.
- *
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param msg The actual message to be logged.
- */
- public static void i(String tag, String msg) {
- i(tag, msg, null);
- }
-
- /**
- * Prints a message at WARN priority.
- *
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param msg The actual message to be logged.
- * @param tr If an exception was thrown, this can be sent along for the logging facilities
- * to extract and print useful information.
- */
- public static void w(String tag, String msg, Throwable tr) {
- println(WARN, tag, msg, tr);
- }
-
- /**
- * Prints a message at WARN priority.
- *
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param msg The actual message to be logged.
- */
- public static void w(String tag, String msg) {
- w(tag, msg, null);
- }
-
- /**
- * Prints a message at WARN priority.
- *
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param tr If an exception was thrown, this can be sent along for the logging facilities
- * to extract and print useful information.
- */
- public static void w(String tag, Throwable tr) {
- w(tag, null, tr);
- }
-
- /**
- * Prints a message at ERROR priority.
- *
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param msg The actual message to be logged.
- * @param tr If an exception was thrown, this can be sent along for the logging facilities
- * to extract and print useful information.
- */
- public static void e(String tag, String msg, Throwable tr) {
- println(ERROR, tag, msg, tr);
- }
-
- /**
- * Prints a message at ERROR priority.
- *
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param msg The actual message to be logged.
- */
- public static void e(String tag, String msg) {
- e(tag, msg, null);
- }
-
- /**
- * Prints a message at ASSERT priority.
- *
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param msg The actual message to be logged.
- * @param tr If an exception was thrown, this can be sent along for the logging facilities
- * to extract and print useful information.
- */
- public static void wtf(String tag, String msg, Throwable tr) {
- println(ASSERT, tag, msg, tr);
- }
-
- /**
- * Prints a message at ASSERT priority.
- *
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param msg The actual message to be logged.
- */
- public static void wtf(String tag, String msg) {
- wtf(tag, msg, null);
- }
-
- /**
- * Prints a message at ASSERT priority.
- *
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param tr If an exception was thrown, this can be sent along for the logging facilities
- * to extract and print useful information.
- */
- public static void wtf(String tag, Throwable tr) {
- wtf(tag, null, tr);
- }
-}
diff --git a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/java/com/example/android/common/logger/LogNode.java b/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/java/com/example/android/common/logger/LogNode.java
deleted file mode 100644
index bc37cab..0000000
--- a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/java/com/example/android/common/logger/LogNode.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.example.android.common.logger;
-
-/**
- * Basic interface for a logging system that can output to one or more targets.
- * Note that in addition to classes that will output these logs in some format,
- * one can also implement this interface over a filter and insert that in the chain,
- * such that no targets further down see certain data, or see manipulated forms of the data.
- * You could, for instance, write a "ToHtmlLoggerNode" that just converted all the log data
- * it received to HTML and sent it along to the next node in the chain, without printing it
- * anywhere.
- */
-public interface LogNode {
-
- /**
- * Instructs first LogNode in the list to print the log data provided.
- * @param priority Log level of the data being logged. Verbose, Error, etc.
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param msg The actual message to be logged. The actual message to be logged.
- * @param tr If an exception was thrown, this can be sent along for the logging facilities
- * to extract and print useful information.
- */
- public void println(int priority, String tag, String msg, Throwable tr);
-
-}
diff --git a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/java/com/example/android/common/logger/LogView.java b/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/java/com/example/android/common/logger/LogView.java
deleted file mode 100644
index d86a88b..0000000
--- a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/java/com/example/android/common/logger/LogView.java
+++ /dev/null
@@ -1,121 +0,0 @@
-package com.example.android.common.logger;
-
-import android.content.Context;
-import android.text.method.ScrollingMovementMethod;
-import android.util.*;
-import android.widget.TextView;
-
-/**
- * Created by alexlucas on 6/4/13.
- */
-
-
-public class LogView extends TextView implements LogNode {
-
- public LogView(Context context) {
- super(context);
- }
-
- public LogView(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- public LogView(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- }
-
- /**
- * Formats the log data and prints it out to the LogView.
- * @param priority Log level of the data being logged. Verbose, Error, etc.
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param msg The actual message to be logged. The actual message to be logged.
- * @param tr If an exception was thrown, this can be sent along for the logging facilities
- * to extract and print useful information.
- */
- @Override
- public void println(int priority, String tag, String msg, Throwable tr) {
- String priorityStr = null;
-
- // For the purposes of this View, we want to print the priority as readable text.
- switch(priority) {
- case android.util.Log.VERBOSE:
- priorityStr = "VERBOSE";
- break;
- case android.util.Log.DEBUG:
- priorityStr = "DEBUG";
- break;
- case android.util.Log.INFO:
- priorityStr = "INFO";
- break;
- case android.util.Log.WARN:
- priorityStr = "WARN";
- break;
- case android.util.Log.ERROR:
- priorityStr = "ERROR";
- break;
- case android.util.Log.ASSERT:
- priorityStr = "ASSERT";
- break;
- default:
- break;
- }
-
- // Handily, the Log class has a facility for converting a stack trace into a useable string.
- String exceptionStr = null;
- if (tr != null) {
- exceptionStr = android.util.Log.getStackTraceString(tr);
- }
-
- // Take the priority, tag, message, and exception, and concatonate as necessary
- // into one usable line of text.
- String outputStr = "";
- outputStr = appendIfNotNull(outputStr, priorityStr, "\t");
- outputStr = appendIfNotNull(outputStr, tag, "\t");
- outputStr = appendIfNotNull(outputStr, msg, "\t");
- outputStr = appendIfNotNull(outputStr, exceptionStr, "\t");
-
- // Actually display the text we just generated within the LogView.
- appendToLog(outputStr);
-
- if (mNext != null) {
- mNext.println(priority, tag, msg, tr);
- }
- }
-
- public LogNode getNext() {
- return mNext;
- }
-
- public void setNext(LogNode node) {
- mNext = node;
- }
-
- /** Takes a string and adds to it, with a seperator, if the bit to be added isn't null. Since
- * the logger takes so many arguments that might be null, this method helps cut out some of the
- * agonizing tedium of writing the same 3 lines over and over.
- * @param sourceStr The String to append to.
- * @param appendStr The String to append
- * @param delimiter The String to seperate the source and appendee strings. A tab or comma,
- * for instance.
- * @return The fully concatonated String
- */
- private String appendIfNotNull(String sourceStr, String appendStr, String delimiter) {
- if (appendStr != null) {
- if (appendStr.length() == 0) {
- delimiter = "";
- }
- sourceStr += delimiter + appendStr;
- }
- return sourceStr;
- }
-
- // The next LogNode in the chain.
- LogNode mNext;
-
- /** Outputs the string as a new line of log data in the LogView. */
- public void appendToLog(String s) {
- append("\n" + s);
- }
-
-
-}
diff --git a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/java/com/example/android/common/logger/LogWrapper.java b/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/java/com/example/android/common/logger/LogWrapper.java
deleted file mode 100644
index 16a9e7b..0000000
--- a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/java/com/example/android/common/logger/LogWrapper.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.example.android.common.logger;
-
-import android.util.Log;
-
-/**
- * Helper class which wraps Android's native Log utility in the Logger interface. This way
- * normal DDMS output can be one of the many targets receiving and outputting logs simultaneously.
- */
-public class LogWrapper implements LogNode {
-
- // For piping: The next node to receive Log data after this one has done its work.
- private LogNode mNext;
-
- /**
- * Returns the next LogNode in the linked list.
- */
- public LogNode getNext() {
- return mNext;
- }
-
- /**
- * Sets the LogNode data will be sent to..
- */
- public void setNext(LogNode node) {
- mNext = node;
- }
-
- /**
- * Prints data out to the console using Android's native log mechanism.
- * @param priority Log level of the data being logged. Verbose, Error, etc.
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param msg The actual message to be logged. The actual message to be logged.
- * @param tr If an exception was thrown, this can be sent along for the logging facilities
- * to extract and print useful information.
- */
- @Override
- public void println(int priority, String tag, String msg, Throwable tr) {
- // There actually are log methods that don't take a msg parameter. For now,
- // if that's the case, just convert null to the empty string and move on.
- String useMsg = msg;
- if (useMsg == null) {
- useMsg = "";
- }
-
- // If an exeption was provided, convert that exception to a usable string and attach
- // it to the end of the msg method.
- if (tr != null) {
- msg += "\n" + Log.getStackTraceString(tr);
- }
-
- // This is functionally identical to Log.x(tag, useMsg);
- // For instance, if priority were Log.VERBOSE, this would be the same as Log.v(tag, useMsg)
- Log.println(priority, tag, useMsg);
-
- // If this isn't the last node in the chain, move things along.
- if (mNext != null) {
- mNext.println(priority, tag, msg, tr);
- }
- }
-}
diff --git a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/java/com/example/android/common/logger/MessageOnlyLogFilter.java b/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/java/com/example/android/common/logger/MessageOnlyLogFilter.java
deleted file mode 100644
index 6b72771..0000000
--- a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/java/com/example/android/common/logger/MessageOnlyLogFilter.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.example.android.common.logger;
-
-/**
- * Simple {@link LogNode} filter, removes everything except the message.
- * Useful for situations like on-screen log output where you don't want a lot of metadata displayed,
- * just easy-to-read message updates as they're happening.
- */
-public class MessageOnlyLogFilter implements LogNode {
-
- LogNode mNext;
-
- /**
- * Takes the "next" LogNode as a parameter, to simplify chaining.
- *
- * @param next The next LogNode in the pipeline.
- */
- public MessageOnlyLogFilter(LogNode next) {
- mNext = next;
- }
-
- public MessageOnlyLogFilter() {
- }
-
- @Override
- public void println(int priority, String tag, String msg, Throwable tr) {
- if (mNext != null) {
- getNext().println(Log.NONE, null, msg, null);
- }
- }
-
- /**
- * Returns the next LogNode in the linked list.
- */
- public LogNode getNext() {
- return mNext;
- }
-
- /**
- * Sets the LogNode data will be sent to..
- */
- public void setNext(LogNode node) {
- mNext = node;
- }
-
-}
diff --git a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/java/com/example/android/common/widgets/SimpleTextFragment.java b/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/java/com/example/android/common/widgets/SimpleTextFragment.java
deleted file mode 100644
index bd51a1c..0000000
--- a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/java/com/example/android/common/widgets/SimpleTextFragment.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.example.android.common.widgets;
-
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.util.Log;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.TextView;
-
-/**
- * Simple fragment containing only a TextView. Used by TextPagerAdapter to create
- * tutorial-style pages for apps.
- */
-public class SimpleTextFragment extends Fragment {
-
- // Contains the text that will be displayed by this Fragment
- String mText;
-
- // Contains a resource ID for the text that will be displayed by this fragment.
- int mTextId = -1;
-
- // Keys which will be used to store/retrieve text passed in via setArguments.
- public static final String TEXT_KEY = "text";
- public static final String TEXT_ID_KEY = "text_id";
-
- // For situations where the app wants to modify text at Runtime, exposing the TextView.
- private TextView mTextView;
-
- public SimpleTextFragment() {
- }
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- // Before initializing the textView, check if any arguments were provided via setArguments.
- processArguments();
-
- // Create a new TextView and set its text to whatever was provided.
- mTextView = new TextView(getActivity());
- mTextView.setGravity(Gravity.CENTER);
-
- if (mText != null) {
- mTextView.setText(mText);
- Log.i("SimpleTextFragment", mText);
- }
- return mTextView;
- }
-
- public TextView getTextView() {
- return mTextView;
- }
-
- /**
- * Changes the text for this TextView, according to the resource ID provided.
- * @param stringId A resource ID representing the text content for this Fragment's TextView.
- */
- public void setText(int stringId) {
- getTextView().setText(getActivity().getString(stringId));
- }
-
- /**
- * Processes the arguments passed into this Fragment via setArguments method.
- * Currently the method only looks for text or a textID, nothing else.
- */
- public void processArguments() {
- // For most objects we'd handle the multiple possibilities for initialization variables
- // as multiple constructors. For Fragments, however, it's customary to use
- // setArguments / getArguments.
- if (getArguments() != null) {
- Bundle args = getArguments();
- if (args.containsKey(TEXT_KEY)) {
- mText = args.getString(TEXT_KEY);
- Log.d("Constructor", "Added Text.");
- } else if (args.containsKey(TEXT_ID_KEY)) {
- mTextId = args.getInt(TEXT_ID_KEY);
- mText = getString(mTextId);
- }
- }
- }
-}
\ No newline at end of file
diff --git a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/drawable-hdpi/ic_launcher.png b/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/drawable-hdpi/ic_launcher.png
deleted file mode 100755
index 22ce606..0000000
--- a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/drawable-hdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/drawable-mdpi/ic_launcher.png b/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/drawable-mdpi/ic_launcher.png
deleted file mode 100755
index f21e17b..0000000
--- a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/drawable-mdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/drawable-xhdpi/ic_launcher.png b/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/drawable-xhdpi/ic_launcher.png
deleted file mode 100755
index 64b8059..0000000
--- a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/drawable-xhdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/drawable-xxhdpi/ic_launcher.png b/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/drawable-xxhdpi/ic_launcher.png
deleted file mode 100755
index 6b4434a..0000000
--- a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/drawable-xxhdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/layout/activity_main.xml b/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/layout/activity_main.xml
deleted file mode 100755
index 471748f..0000000
--- a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/layout/activity_main.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!--
- Copyright 2013 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent">
- <fragment
- android:name="com.example.android.common.SimpleTextFragment"
- android:id="@+id/intro_fragment"
- android:layout_weight="1"
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
- <View
- android:layout_width="fill_parent"
- android:layout_height="1dp"
- android:background="@android:color/darker_gray"/>
- <fragment
- android:name="com.example.android.basicgesturedetect.LogFragment"
- android:id="@+id/log_fragment"
- android:layout_weight="1"
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
-</LinearLayout>
diff --git a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/layout/log_fragment.xml b/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/layout/log_fragment.xml
deleted file mode 100644
index 6d79548..0000000
--- a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/layout/log_fragment.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!--
- Copyright 2013 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/log_scroll"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <com.example.android.common.logger.LogView
- android:id="@+id/sample_output"
- style="@style/Log"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:clickable="true"
- android:focusable="true"
- android:text=""
- android:gravity="bottom" />
-</ScrollView>
\ No newline at end of file
diff --git a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/menu/main.xml b/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/menu/main.xml
deleted file mode 100644
index d0ffa14..0000000
--- a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/menu/main.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<!--
- Copyright 2013 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:id="@+id/sample_action"
- android:showAsAction="ifRoom|withText"
- android:title="@string/clear_text" />
-</menu>
diff --git a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/values-sw600dp/dimens.xml b/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/values-sw600dp/dimens.xml
deleted file mode 100644
index 886b05f..0000000
--- a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/values-sw600dp/dimens.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<resources>
- <!-- Customize dimensions originally defined in res/values/dimens.xml (such as
- screen margins) for sw600dp devices (e.g. 7" tablets) here. -->
-</resources>
diff --git a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/values-sw600dp/styles.xml b/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/values-sw600dp/styles.xml
deleted file mode 100644
index ffcbe8a..0000000
--- a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/values-sw600dp/styles.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
- Copyright 2013 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<resources>
-
- <style name="Widget.SampleOutput">
- <item name="android:paddingTop">@dimen/margin_medium</item>
- <item name="android:paddingBottom">@dimen/margin_medium</item>
- <item name="android:paddingLeft">@dimen/margin_huge</item>
- <item name="android:paddingRight">@dimen/margin_huge</item>
- <item name="android:textAppearance">?android:textAppearanceLarge</item>
- <item name="android:lineSpacingMultiplier">1.2</item>
- </style>
-
-</resources>
diff --git a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/values-sw720dp-land/dimens.xml b/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/values-sw720dp-land/dimens.xml
deleted file mode 100644
index 00059fc..0000000
--- a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/values-sw720dp-land/dimens.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<resources>
- <!-- Customize dimensions originally defined in res/values/dimens.xml (such as
- screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here. -->
- <dimen name="activity_horizontal_margin">128dp</dimen>
-</resources>
diff --git a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/values-v11/styles.xml b/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/values-v11/styles.xml
deleted file mode 100644
index c6c648b..0000000
--- a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/values-v11/styles.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<!--
- Copyright 2013 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<resources>
- <style name="Theme.Base" parent="android:Theme.Holo.Light" />
-</resources>
diff --git a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/values-v14/styles.xml b/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/values-v14/styles.xml
deleted file mode 100644
index a91fd03..0000000
--- a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/values-v14/styles.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<resources>
-
- <!--
- Base application theme for API 14+. This theme completely replaces
- AppBaseTheme from BOTH res/values/styles.xml and
- res/values-v11/styles.xml on API 14+ devices.
- -->
- <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
- <!-- API 14 theme customizations can go here. -->
- </style>
-
-</resources>
diff --git a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/values/dimens.xml b/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/values/dimens.xml
deleted file mode 100644
index 4f69897..0000000
--- a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/values/dimens.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
- Copyright 2013 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<resources>
-
- <!-- Define standard dimensions to comply with Holo-style grids and rhythm. -->
-
- <dimen name="margin_medium">16dp</dimen>
- <dimen name="margin_huge">64dp</dimen>
-
-</resources>
diff --git a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/values/strings.xml b/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/values/strings.xml
deleted file mode 100755
index ce1ad02..0000000
--- a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<!--
- Copyright 2013 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<resources>
- <string name="app_name">Basic Gesture Detect</string>
-
- <string name="intro_message">Welcome to Basic Gesture Detect!
- In order to try this sample out, try dragging or tapping this text to see what happens!
- </string>
-
- <string name="clear_text">Clear Text</string>
-</resources>
diff --git a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/values/styles.xml b/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/values/styles.xml
deleted file mode 100644
index 4d9bb98..0000000
--- a/input/gestures/BasicGestureDetect/BasicGestureDetect/src/main/res/values/styles.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<!--
- Copyright 2013 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under thegi License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<resources>
-
- <!-- Activity themes -->
-
- <style name="Theme.Base" parent="android:Theme.Light" />
-
- <style name="Theme.Sample" parent="Theme.Base" />
-
- <!-- Widget styling -->
-
- <style name="Widget" />
-
- <style name="Widget.SampleOutput">
- <item name="android:padding">@dimen/margin_medium</item>
- <item name="android:textAppearance">?android:textAppearanceMedium</item>
- <item name="android:lineSpacingMultiplier">1.1</item>
- </style>
-
- <style name="Log" parent="Widget.SampleOutput">
- <item name="android:typeface">monospace</item>
- </style>
-
-
-</resources>
diff --git a/input/gestures/BasicGestureDetect/BasicGestureDetectSample/.gitignore b/input/gestures/BasicGestureDetect/BasicGestureDetectSample/.gitignore
new file mode 100644
index 0000000..6eb878d
--- /dev/null
+++ b/input/gestures/BasicGestureDetect/BasicGestureDetectSample/.gitignore
@@ -0,0 +1,16 @@
+# Copyright 2013 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+src/template/
+src/common/
+build.gradle
diff --git a/input/gestures/BasicGestureDetect/BasicGestureDetectSample/README-singleview.txt b/input/gestures/BasicGestureDetect/BasicGestureDetectSample/README-singleview.txt
new file mode 100644
index 0000000..0cacd46
--- /dev/null
+++ b/input/gestures/BasicGestureDetect/BasicGestureDetectSample/README-singleview.txt
@@ -0,0 +1,47 @@
+<#--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+Steps to implement SingleView template:
+-in template-params.xml.ftl:
+ -add the following line to common imports
+ <common src="activities"/>
+
+ -add a string for the action button's text using the element name "sample_action".
+ This element should be a child of <strings>:
+ <strings>
+ ...
+ <sample_action>ButtonText</sample_action>
+ ...
+ </strings>
+
+
+
+-Add a Fragment to handle behavior. In your MainActivity.java class, it will reference a Fragment
+ called (yourProjectName)Fragment.java. Create that file in your project, using the "main" source
+ folder instead of "common" or "templates".
+ For instance, if your package name is com.example.foo, create the file
+ src/main/java/com/example/foo/FooFragment.java
+
+
+-Within this fragment, make sure that the onCreate method has the line
+ "setHasOptionsMenu(true);", to enable the fragment to handle menu events.
+
+-In order to override menu events, override onOptionsItemSelected.
+
+-refer to sampleSamples/singleViewSample for a reference implementation of a
+project built on this template.
+
+
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/proguard-project.txt b/input/gestures/BasicGestureDetect/BasicGestureDetectSample/proguard-project.txt
similarity index 91%
copy from connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/proguard-project.txt
copy to input/gestures/BasicGestureDetect/BasicGestureDetectSample/proguard-project.txt
index f2fe155..0d8f171 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/proguard-project.txt
+++ b/input/gestures/BasicGestureDetect/BasicGestureDetectSample/proguard-project.txt
@@ -1,4 +1,4 @@
-# To enable ProGuard in your project, edit project.properties
+ To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
diff --git a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/AndroidManifest.xml b/input/gestures/BasicGestureDetect/BasicGestureDetectSample/src/main/AndroidManifest.xml
similarity index 61%
copy from ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/AndroidManifest.xml
copy to input/gestures/BasicGestureDetect/BasicGestureDetectSample/src/main/AndroidManifest.xml
index 3c0e66a..1d7b3bd 100644
--- a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/AndroidManifest.xml
+++ b/input/gestures/BasicGestureDetect/BasicGestureDetectSample/src/main/AndroidManifest.xml
@@ -1,12 +1,12 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (C) 2013 The Android Open Source Project
+ Copyright 2013 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
+ http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@@ -15,23 +15,23 @@
limitations under the License.
-->
+
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.ui.accessibility.BasicAccessibility"
+ package="com.example.android.basicgesturedetect"
android:versionCode="1"
- android:versionName="1.0" >
+ android:versionName="1.0">
- <uses-sdk
- android:minSdkVersion="11"
- android:targetSdkVersion="16" />
+ <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="17" />
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
+ <application android:allowBackup="true"
android:label="@string/app_name"
- android:theme="@style/AppTheme" >
- <activity
- android:name="com.example.android.ui.accessibility.BasicAccessibility.MainActivity"
- android:label="@string/app_name" >
+ android:icon="@drawable/ic_launcher"
+ android:theme="@style/AppTheme">
+
+ <activity android:name=".MainActivity"
+ android:label="@string/app_name"
+ android:uiOptions="splitActionBarWhenNarrow">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
@@ -39,4 +39,5 @@
</activity>
</application>
+
</manifest>
diff --git a/input/gestures/BasicGestureDetect/BasicGestureDetectSample/src/main/java/com/example/android/basicgesturedetect/BasicGestureDetectFragment.java b/input/gestures/BasicGestureDetect/BasicGestureDetectSample/src/main/java/com/example/android/basicgesturedetect/BasicGestureDetectFragment.java
new file mode 100644
index 0000000..820e972
--- /dev/null
+++ b/input/gestures/BasicGestureDetect/BasicGestureDetectSample/src/main/java/com/example/android/basicgesturedetect/BasicGestureDetectFragment.java
@@ -0,0 +1,81 @@
+/*
+* Copyright (C) 2013 The Android Open Source Project
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package com.example.android.basicgesturedetect;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.view.GestureDetector;
+import android.view.MenuItem;
+import android.view.MotionEvent;
+import android.view.View;
+
+import com.example.android.common.logger.Log;
+import com.example.android.common.logger.LogFragment;
+
+public class BasicGestureDetectFragment extends Fragment{
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setHasOptionsMenu(true);
+ }
+
+ @Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+ View gestureView = getActivity().findViewById(R.id.sample_output);
+ gestureView.setClickable(true);
+ gestureView.setFocusable(true);
+
+ // BEGIN_INCLUDE(init_detector)
+
+ // First create the GestureListener that will include all our callbacks.
+ // Then create the GestureDetector, which takes that listener as an argument.
+ GestureDetector.SimpleOnGestureListener gestureListener = new GestureListener();
+ final GestureDetector gd = new GestureDetector(getActivity(), gestureListener);
+
+ /* For the view where gestures will occur, create an onTouchListener that sends
+ * all motion events to the gesture detector. When the gesture detector
+ * actually detects an event, it will use the callbacks you created in the
+ * SimpleOnGestureListener to alert your application.
+ */
+
+ gestureView.setOnTouchListener(new View.OnTouchListener() {
+ @Override
+ public boolean onTouch(View view, MotionEvent motionEvent) {
+ gd.onTouchEvent(motionEvent);
+ return false;
+ }
+ });
+ // END_INCLUDE(init_detector)
+ }
+
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ if (item.getItemId() == R.id.sample_action) {
+ clearLog();
+ }
+ return true;
+ }
+
+ public void clearLog() {
+ LogFragment logFragment = ((LogFragment) getActivity().getSupportFragmentManager()
+ .findFragmentById(R.id.log_fragment));
+ logFragment.getLogView().setText("");
+ }
+}
diff --git a/input/gestures/BasicGestureDetect/BasicGestureDetectSample/src/main/res/drawable-hdpi/ic_launcher.png b/input/gestures/BasicGestureDetect/BasicGestureDetectSample/src/main/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 0000000..b1efaf4
--- /dev/null
+++ b/input/gestures/BasicGestureDetect/BasicGestureDetectSample/src/main/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/input/gestures/BasicGestureDetect/BasicGestureDetectSample/src/main/res/drawable-mdpi/ic_launcher.png b/input/gestures/BasicGestureDetect/BasicGestureDetectSample/src/main/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 0000000..f5f9244
--- /dev/null
+++ b/input/gestures/BasicGestureDetect/BasicGestureDetectSample/src/main/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/input/gestures/BasicGestureDetect/BasicGestureDetectSample/src/main/res/drawable-xhdpi/ic_launcher.png b/input/gestures/BasicGestureDetect/BasicGestureDetectSample/src/main/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..5d07b3f
--- /dev/null
+++ b/input/gestures/BasicGestureDetect/BasicGestureDetectSample/src/main/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/input/gestures/BasicGestureDetect/BasicGestureDetectSample/src/main/res/drawable-xxhdpi/ic_launcher.png b/input/gestures/BasicGestureDetect/BasicGestureDetectSample/src/main/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..6ef21e1
--- /dev/null
+++ b/input/gestures/BasicGestureDetect/BasicGestureDetectSample/src/main/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/input/gestures/BasicGestureDetect/BasicGestureDetectSample/tests/AndroidManifest.xml b/input/gestures/BasicGestureDetect/BasicGestureDetectSample/tests/AndroidManifest.xml
new file mode 100644
index 0000000..87b785f
--- /dev/null
+++ b/input/gestures/BasicGestureDetect/BasicGestureDetectSample/tests/AndroidManifest.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<!-- package name must be unique so suffix with "tests" so package loader doesn't ignore us -->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="${sample.package}.tests"
+ android:versionCode="1"
+ android:versionName="1.0">
+
+ <uses-sdk
+ android:minSdkVersion="18"
+ android:targetSdkVersion="19" />
+
+ <!-- We add an application tag here just so that we can indicate that
+ this package needs to link against the android.test library,
+ which is needed when building test cases. -->
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <!--
+ Specifies the instrumentation test runner used to run the tests.
+ -->
+ <instrumentation
+ android:name="android.test.InstrumentationTestRunner"
+ android:targetPackage="${sample.package}"
+ android:label="Tests for ${sample.package}" />
+
+</manifest>
\ No newline at end of file
diff --git a/input/gestures/BasicGestureDetect/BasicGestureDetectSample/tests/src/com/example/android/basicgesturedetect/tests/SampleTests.java b/input/gestures/BasicGestureDetect/BasicGestureDetectSample/tests/src/com/example/android/basicgesturedetect/tests/SampleTests.java
new file mode 100644
index 0000000..e72c22e
--- /dev/null
+++ b/input/gestures/BasicGestureDetect/BasicGestureDetectSample/tests/src/com/example/android/basicgesturedetect/tests/SampleTests.java
@@ -0,0 +1,79 @@
+/*
+* Copyright 2013 The Android Open Source Project
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+
+/*
+* Copyright (C) 2013 The Android Open Source Project
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package com.example.android.basicgesturedetect.tests;
+
+import com.example.android.basicgesturedetect.*;
+
+import android.test.ActivityInstrumentationTestCase2;
+
+/**
+* Tests for BasicGestureDetect sample.
+*/
+public class SampleTests extends ActivityInstrumentationTestCase2<MainActivity> {
+
+ private MainActivity mTestActivity;
+ private BasicGestureDetectFragment mTestFragment;
+
+ public SampleTests() {
+ super(MainActivity.class);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ // Starts the activity under test using the default Intent with:
+ // action = {@link Intent#ACTION_MAIN}
+ // flags = {@link Intent#FLAG_ACTIVITY_NEW_TASK}
+ // All other fields are null or empty.
+ mTestActivity = getActivity();
+ mTestFragment = (BasicGestureDetectFragment)
+ mTestActivity.getSupportFragmentManager().getFragments().get(1);
+ }
+
+ /**
+ * Test if the test fixture has been set up correctly.
+ */
+ public void testPreconditions() {
+ //Try to add a message to add context to your assertions. These messages will be shown if
+ //a tests fails and make it easy to understand why a test failed
+ assertNotNull("mTestActivity is null", mTestActivity);
+ assertNotNull("mTestFragment is null", mTestFragment);
+ }
+
+ /**
+ * Add more tests below.
+ */
+
+}
\ No newline at end of file
diff --git a/input/gestures/BasicGestureDetect/README.txt b/input/gestures/BasicGestureDetect/README.txt
deleted file mode 100644
index 38608df..0000000
--- a/input/gestures/BasicGestureDetect/README.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-Build Instructions
--------------------
-This sample uses the Gradle build system. To build this project, use the
-"gradlew build" command.
-
-To see a list of all available commands, run "gradlew tasks".
\ No newline at end of file
diff --git a/input/gestures/BasicGestureDetect/build.gradle b/input/gestures/BasicGestureDetect/build.gradle
index 036abc8..ffb5c2f 100644
--- a/input/gestures/BasicGestureDetect/build.gradle
+++ b/input/gestures/BasicGestureDetect/build.gradle
@@ -1,8 +1,11 @@
-buildscript {
- repositories {
- mavenCentral()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:0.5.+'
- }
+
+
+
+
+// BEGIN_EXCLUDE
+apply from: "../../../../../build/build.gradle"
+samplegen {
+ pathToBuild "../../../../../build"
+ pathToSamplesCommon "../../../common"
}
+// END_EXCLUDE
diff --git a/input/gestures/BasicGestureDetect/buildSrc/build.gradle b/input/gestures/BasicGestureDetect/buildSrc/build.gradle
new file mode 100644
index 0000000..e344a8c
--- /dev/null
+++ b/input/gestures/BasicGestureDetect/buildSrc/build.gradle
@@ -0,0 +1,18 @@
+
+
+
+repositories {
+ mavenCentral()
+}
+dependencies {
+ compile 'org.freemarker:freemarker:2.3.20'
+}
+
+sourceSets {
+ main {
+ groovy {
+ srcDir new File(rootDir, "../../../../../../build/buildSrc/src/main/groovy")
+ }
+ }
+}
+
diff --git a/input/gestures/BasicGestureDetect/gradle/wrapper/gradle-wrapper.properties b/input/gestures/BasicGestureDetect/gradle/wrapper/gradle-wrapper.properties
index 055ba6f..5c22dec 100644
--- a/input/gestures/BasicGestureDetect/gradle/wrapper/gradle-wrapper.properties
+++ b/input/gestures/BasicGestureDetect/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,4 @@
-#
-#Mon Jul 22 11:40:20 PDT 2013
+#Wed Apr 10 15:27:10 PDT 2013
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
diff --git a/input/gestures/BasicGestureDetect/settings.gradle b/input/gestures/BasicGestureDetect/settings.gradle
index 2270ab7..ba7e8c0 100644
--- a/input/gestures/BasicGestureDetect/settings.gradle
+++ b/input/gestures/BasicGestureDetect/settings.gradle
@@ -1 +1,4 @@
-include ':BasicGestureDetect'
+
+
+
+include 'BasicGestureDetectSample'
diff --git a/input/gestures/BasicGestureDetect/template-params.xml b/input/gestures/BasicGestureDetect/template-params.xml
new file mode 100644
index 0000000..1feba01
--- /dev/null
+++ b/input/gestures/BasicGestureDetect/template-params.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+
+
+<sample>
+ <name>BasicGestureDetect</name>
+ <package>com.example.android.basicgesturedetect</package>
+
+
+ <!-- change minSdk if needed-->
+ <minSdk>18</minSdk>
+
+
+ <strings>
+ <intro>
+ <![CDATA[
+ Welcome to Basic Gesture Detect!
+ In order to try this sample out, try dragging or tapping this text to see what happens!
+ ]]>
+ </intro>
+ <sample_action>Clear Text</sample_action>
+ </strings>
+
+ <template src="base"/>
+ <template src="SingleView"/>
+ <common src="logger"/>
+ <common src="activities"/>
+
+</sample>
diff --git a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/build.gradle b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/build.gradle
deleted file mode 100644
index 10fb811..0000000
--- a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/build.gradle
+++ /dev/null
@@ -1,10 +0,0 @@
-apply plugin: 'android'
-
-dependencies {
- compile "com.android.support:support-v4:18.0.+"
-}
-
-android {
- compileSdkVersion 18
- buildToolsVersion "18.0.1"
-}
diff --git a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/AndroidManifest.xml b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/AndroidManifest.xml
deleted file mode 100644
index 7693ed1..0000000
--- a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<!--
- Copyright 2013 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.basicandroidkeystore"
- android:versionCode="1"
- android:versionName="1.0">
-
- <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" />
-
- <application android:label="@string/app_name"
- android:icon="@drawable/ic_launcher"
- android:theme="@style/Theme.Sample">
-
- <activity android:name=".MainActivity"
- android:label="@string/app_name"
- android:uiOptions="splitActionBarWhenNarrow">
-
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
-
- </application>
-
-</manifest>
diff --git a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/java/com/example/android/basicandroidkeystore/LogFragment.java b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/java/com/example/android/basicandroidkeystore/LogFragment.java
deleted file mode 100644
index 23d4da7..0000000
--- a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/java/com/example/android/basicandroidkeystore/LogFragment.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.example.android.basicandroidkeystore;
-
-import com.example.android.common.logger.LogView;
-
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.text.Editable;
-import android.text.TextWatcher;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ScrollView;
-
-/**
- * Simple fraggment which contains a LogView and uses is to output log data it receives
- * through the LogNode interface.
- */
-public class LogFragment extends Fragment {
-
- private LogView mLogView;
-
- public LogFragment() {}
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
-
- View result = inflater.inflate(R.layout.log_fragment, container, false);
-
- mLogView = (LogView) result.findViewById(R.id.sample_output);
-
- // Wire up so when the text changes, the view scrolls down.
- final ScrollView scrollView =
- ((ScrollView) result.findViewById(R.id.log_scroll));
-
- mLogView.addTextChangedListener(new TextWatcher() {
- @Override
- public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
-
- @Override
- public void onTextChanged(CharSequence s, int start, int before, int count) {
- scrollView.fullScroll(ScrollView.FOCUS_DOWN);
- }
-
- @Override
- public void afterTextChanged(Editable s) {
- scrollView.fullScroll(ScrollView.FOCUS_DOWN);
- }
- });
-
- return result;
- }
-
- public LogView getLogView() {
- return mLogView;
- }
-}
\ No newline at end of file
diff --git a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/java/com/example/android/basicandroidkeystore/MainActivity.java b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/java/com/example/android/basicandroidkeystore/MainActivity.java
deleted file mode 100644
index 33af4e5..0000000
--- a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/java/com/example/android/basicandroidkeystore/MainActivity.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Copyright 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.example.android.basicandroidkeystore;
-
-import android.os.Bundle;
-import android.support.v4.app.FragmentActivity;
-import android.view.Menu;
-import android.view.MenuItem;
-
-import com.example.android.common.SimpleTextFragment;
-import com.example.android.common.logger.LogWrapper;
-import com.example.android.common.logger.MessageOnlyLogFilter;
-import com.example.android.common.logger.Log;
-
-import java.io.IOException;
-import java.security.InvalidAlgorithmParameterException;
-import java.security.InvalidKeyException;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.SignatureException;
-import java.security.UnrecoverableEntryException;
-import java.security.cert.CertificateException;
-
-public class MainActivity extends FragmentActivity {
-
- public final static String TAG = "MainActivity";
- public LogFragment mLogFragment;
-
- public KeyStoreHelper mKeyStoreHelper;
-
-
- // BEGIN_INCLUDE(values)
- // You can store multiple key pairs in the Key Store. The string used to refer to the Key you
- // want to store, or later pull, is referred to as an "alias" in this case, because calling it
- // a key, when you use it to retrieve a key, would just be irritating.
- public static final String ALIAS = "myKey";
-
- // Some sample data to sign, and later verify using the generated signature.
- public static final String SAMPLE_INPUT="Hello, Android!";
-
- // Just a handy place to store the signature in between signing and verifying.
- public String mSignatureStr = null;
- // END_INCLUDE(values)
-
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- SimpleTextFragment actionFragment =
- (SimpleTextFragment) getSupportFragmentManager()
- .findFragmentById(R.id.intro_fragment);
- actionFragment.setText(R.string.intro_message);
-
- mKeyStoreHelper = new KeyStoreHelper();
- mKeyStoreHelper.setAlias(ALIAS);
- initializeLogging();
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case R.id.btn_create_keys:
- try {
- mKeyStoreHelper.createKeys(this);
- Log.d(TAG, "Keys created");
- return true;
- } catch (NoSuchAlgorithmException e) {
- Log.w(TAG, "RSA not supported", e);
- } catch (InvalidAlgorithmParameterException e) {
- Log.w(TAG, "No such provider: AndroidKeyStore");
- } catch (NoSuchProviderException e) {
- Log.w(TAG, "Invalid Algorithm Parameter Exception", e);
- }
- return true;
- case R.id.btn_sign_data:
- try {
- mSignatureStr = mKeyStoreHelper.signData(SAMPLE_INPUT);
- } catch (KeyStoreException e) {
- Log.w(TAG, "KeyStore not Initialized", e);
- } catch (UnrecoverableEntryException e) {
- Log.w(TAG, "KeyPair not recovered", e);
- } catch (NoSuchAlgorithmException e) {
- Log.w(TAG, "RSA not supported", e);
- } catch (InvalidKeyException e) {
- Log.w(TAG, "Invalid Key", e);
- } catch (SignatureException e) {
- Log.w(TAG, "Invalid Signature", e);
- } catch (IOException e) {
- Log.w(TAG, "IO Exception", e);
- } catch (CertificateException e) {
- Log.w(TAG, "Error occurred while loading certificates", e);
- }
- Log.d(TAG, "Signature: " + mSignatureStr);
- return true;
-
- case R.id.btn_verify_data:
- boolean verified = false;
- try {
- if (mSignatureStr != null) {
- verified = mKeyStoreHelper.verifyData(SAMPLE_INPUT, mSignatureStr);
- }
- } catch (KeyStoreException e) {
- Log.w(TAG, "KeyStore not Initialized", e);
- } catch (CertificateException e) {
- Log.w(TAG, "Error occurred while loading certificates", e);
- } catch (NoSuchAlgorithmException e) {
- Log.w(TAG, "RSA not supported", e);
- } catch (IOException e) {
- Log.w(TAG, "IO Exception", e);
- } catch (UnrecoverableEntryException e) {
- Log.w(TAG, "KeyPair not recovered", e);
- } catch (InvalidKeyException e) {
- Log.w(TAG, "Invalid Key", e);
- } catch (SignatureException e) {
- Log.w(TAG, "Invalid Signature", e);
- }
- if (verified) {
- Log.d(TAG, "Data Signature Verified");
- } else {
- Log.d(TAG, "Data not verified.");
- }
- return true;
- }
- return false;
- }
-
- /** Create a chain of targets that will receive log data */
- public void initializeLogging() {
- // Using Log, front-end to the logging chain, emulates android.util.log method signatures.
- // Wraps Android's native log framework
- LogWrapper logWrapper = new LogWrapper();
- Log.setLogNode(logWrapper);
-
- // A filter that strips out everything except the message text
- MessageOnlyLogFilter msgFilter = new MessageOnlyLogFilter();
- logWrapper.setNext(msgFilter);
-
- // On screen logging via a fragment with a TextView
- mLogFragment = (LogFragment) getSupportFragmentManager().findFragmentById(R.id.log_fragment);
- msgFilter.setNext(mLogFragment.getLogView());
- Log.i(TAG, "Ready");
- }
-}
diff --git a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/java/com/example/android/common/SimpleTextFragment.java b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/java/com/example/android/common/SimpleTextFragment.java
deleted file mode 100644
index 2895ea0..0000000
--- a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/java/com/example/android/common/SimpleTextFragment.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.example.android.common;
-
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.util.Log;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.TextView;
-
-/**
- * Simple fragment containing only a TextView. Used by TextPagerAdapter to create
- * tutorial-style pages for apps.
- */
-public class SimpleTextFragment extends Fragment {
-
- // Contains the text that will be displayed by this Fragment
- String mText;
-
- // Contains a resource ID for the text that will be displayed by this fragment.
- int mTextId = -1;
-
- // Keys which will be used to store/retrieve text passed in via setArguments.
- public static final String TEXT_KEY = "text";
- public static final String TEXT_ID_KEY = "text_id";
-
- // For situations where the app wants to modify text at Runtime, exposing the TextView.
- private TextView mTextView;
-
- public SimpleTextFragment() {
- }
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- // Before initializing the textView, check if any arguments were provided via setArguments.
- processArguments();
-
- // Create a new TextView and set its text to whatever was provided.
- mTextView = new TextView(getActivity());
-
- if (mText != null) {
- mTextView.setText(mText);
- Log.i("SimpleTextFragment", mText);
- }
- return mTextView;
- }
-
- public TextView getTextView() {
- return mTextView;
- }
-
- /**
- * Changes the text for this TextView, according to the resource ID provided.
- *
- * @param stringId A resource ID representing the text content for this Fragment's TextView.
- */
- public void setText(int stringId) {
- getTextView().setText(getActivity().getString(stringId));
- }
-
- /**
- * Processes the arguments passed into this Fragment via setArguments method.
- * Currently the method only looks for text or a textID, nothing else.
- */
- public void processArguments() {
- // For most objects we'd handle the multiple possibilities for initialization variables
- // as multiple constructors. For Fragments, however, it's customary to use
- // setArguments / getArguments.
- if (getArguments() != null) {
- Bundle args = getArguments();
- if (args.containsKey(TEXT_KEY)) {
- mText = args.getString(TEXT_KEY);
- Log.d("Constructor", "Added Text.");
- } else if (args.containsKey(TEXT_ID_KEY)) {
- mTextId = args.getInt(TEXT_ID_KEY);
- mText = getString(mTextId);
- }
- }
- }
-}
\ No newline at end of file
diff --git a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/java/com/example/android/common/logger/Log.java b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/java/com/example/android/common/logger/Log.java
deleted file mode 100644
index 17503c5..0000000
--- a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/java/com/example/android/common/logger/Log.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.example.android.common.logger;
-
-/**
- * Helper class for a list (or tree) of LoggerNodes.
- *
- * <p>When this is set as the head of the list,
- * an instance of it can function as a drop-in replacement for {@link android.util.Log}.
- * Most of the methods in this class server only to map a method call in Log to its equivalent
- * in LogNode.</p>
- */
-public class Log {
- // Grabbing the native values from Android's native logging facilities,
- // to make for easy migration and interop.
- public static final int NONE = -1;
- public static final int VERBOSE = android.util.Log.VERBOSE;
- public static final int DEBUG = android.util.Log.DEBUG;
- public static final int INFO = android.util.Log.INFO;
- public static final int WARN = android.util.Log.WARN;
- public static final int ERROR = android.util.Log.ERROR;
- public static final int ASSERT = android.util.Log.ASSERT;
-
- // Stores the beginning of the LogNode topology.
- private static LogNode mLogNode;
-
- /**
- * Returns the next LogNode in the linked list.
- */
- public static LogNode getLogNode() {
- return mLogNode;
- }
-
- /**
- * Sets the LogNode data will be sent to.
- */
- public static void setLogNode(LogNode node) {
- mLogNode = node;
- }
-
- /**
- * Instructs the LogNode to print the log data provided. Other LogNodes can
- * be chained to the end of the LogNode as desired.
- *
- * @param priority Log level of the data being logged. Verbose, Error, etc.
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param msg The actual message to be logged.
- * @param tr If an exception was thrown, this can be sent along for the logging facilities
- * to extract and print useful information.
- */
- public static void println(int priority, String tag, String msg, Throwable tr) {
- if (mLogNode != null) {
- mLogNode.println(priority, tag, msg, tr);
- }
- }
-
- /**
- * Instructs the LogNode to print the log data provided. Other LogNodes can
- * be chained to the end of the LogNode as desired.
- *
- * @param priority Log level of the data being logged. Verbose, Error, etc.
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param msg The actual message to be logged. The actual message to be logged.
- */
- public static void println(int priority, String tag, String msg) {
- println(priority, tag, msg, null);
- }
-
- /**
- * Prints a message at VERBOSE priority.
- *
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param msg The actual message to be logged.
- * @param tr If an exception was thrown, this can be sent along for the logging facilities
- * to extract and print useful information.
- */
- public static void v(String tag, String msg, Throwable tr) {
- println(VERBOSE, tag, msg, tr);
- }
-
- /**
- * Prints a message at VERBOSE priority.
- *
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param msg The actual message to be logged.
- */
- public static void v(String tag, String msg) {
- v(tag, msg, null);
- }
-
-
- /**
- * Prints a message at DEBUG priority.
- *
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param msg The actual message to be logged.
- * @param tr If an exception was thrown, this can be sent along for the logging facilities
- * to extract and print useful information.
- */
- public static void d(String tag, String msg, Throwable tr) {
- println(DEBUG, tag, msg, tr);
- }
-
- /**
- * Prints a message at DEBUG priority.
- *
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param msg The actual message to be logged.
- */
- public static void d(String tag, String msg) {
- d(tag, msg, null);
- }
-
- /**
- * Prints a message at INFO priority.
- *
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param msg The actual message to be logged.
- * @param tr If an exception was thrown, this can be sent along for the logging facilities
- * to extract and print useful information.
- */
- public static void i(String tag, String msg, Throwable tr) {
- println(INFO, tag, msg, tr);
- }
-
- /**
- * Prints a message at INFO priority.
- *
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param msg The actual message to be logged.
- */
- public static void i(String tag, String msg) {
- i(tag, msg, null);
- }
-
- /**
- * Prints a message at WARN priority.
- *
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param msg The actual message to be logged.
- * @param tr If an exception was thrown, this can be sent along for the logging facilities
- * to extract and print useful information.
- */
- public static void w(String tag, String msg, Throwable tr) {
- println(WARN, tag, msg, tr);
- }
-
- /**
- * Prints a message at WARN priority.
- *
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param msg The actual message to be logged.
- */
- public static void w(String tag, String msg) {
- w(tag, msg, null);
- }
-
- /**
- * Prints a message at WARN priority.
- *
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param tr If an exception was thrown, this can be sent along for the logging facilities
- * to extract and print useful information.
- */
- public static void w(String tag, Throwable tr) {
- w(tag, null, tr);
- }
-
- /**
- * Prints a message at ERROR priority.
- *
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param msg The actual message to be logged.
- * @param tr If an exception was thrown, this can be sent along for the logging facilities
- * to extract and print useful information.
- */
- public static void e(String tag, String msg, Throwable tr) {
- println(ERROR, tag, msg, tr);
- }
-
- /**
- * Prints a message at ERROR priority.
- *
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param msg The actual message to be logged.
- */
- public static void e(String tag, String msg) {
- e(tag, msg, null);
- }
-
- /**
- * Prints a message at ASSERT priority.
- *
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param msg The actual message to be logged.
- * @param tr If an exception was thrown, this can be sent along for the logging facilities
- * to extract and print useful information.
- */
- public static void wtf(String tag, String msg, Throwable tr) {
- println(ASSERT, tag, msg, tr);
- }
-
- /**
- * Prints a message at ASSERT priority.
- *
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param msg The actual message to be logged.
- */
- public static void wtf(String tag, String msg) {
- wtf(tag, msg, null);
- }
-
- /**
- * Prints a message at ASSERT priority.
- *
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param tr If an exception was thrown, this can be sent along for the logging facilities
- * to extract and print useful information.
- */
- public static void wtf(String tag, Throwable tr) {
- wtf(tag, null, tr);
- }
-}
diff --git a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/java/com/example/android/common/logger/LogNode.java b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/java/com/example/android/common/logger/LogNode.java
deleted file mode 100644
index bc37cab..0000000
--- a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/java/com/example/android/common/logger/LogNode.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.example.android.common.logger;
-
-/**
- * Basic interface for a logging system that can output to one or more targets.
- * Note that in addition to classes that will output these logs in some format,
- * one can also implement this interface over a filter and insert that in the chain,
- * such that no targets further down see certain data, or see manipulated forms of the data.
- * You could, for instance, write a "ToHtmlLoggerNode" that just converted all the log data
- * it received to HTML and sent it along to the next node in the chain, without printing it
- * anywhere.
- */
-public interface LogNode {
-
- /**
- * Instructs first LogNode in the list to print the log data provided.
- * @param priority Log level of the data being logged. Verbose, Error, etc.
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param msg The actual message to be logged. The actual message to be logged.
- * @param tr If an exception was thrown, this can be sent along for the logging facilities
- * to extract and print useful information.
- */
- public void println(int priority, String tag, String msg, Throwable tr);
-
-}
diff --git a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/java/com/example/android/common/logger/LogView.java b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/java/com/example/android/common/logger/LogView.java
deleted file mode 100644
index dfe7648..0000000
--- a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/java/com/example/android/common/logger/LogView.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.example.android.common.logger;
-
-import android.content.Context;
-import android.text.method.ScrollingMovementMethod;
-import android.util.*;
-import android.widget.TextView;
-
-/**
- * Created by alexlucas on 6/4/13.
- */
-
-
-public class LogView extends TextView implements LogNode {
-
- public LogView(Context context) {
- super(context);
- }
-
- public LogView(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- public LogView(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- }
-
- /**
- * Formats the log data and prints it out to the LogView.
- * @param priority Log level of the data being logged. Verbose, Error, etc.
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param msg The actual message to be logged. The actual message to be logged.
- * @param tr If an exception was thrown, this can be sent along for the logging facilities
- * to extract and print useful information.
- */
- @Override
- public void println(int priority, String tag, String msg, Throwable tr) {
- String priorityStr = null;
-
- // For the purposes of this View, we want to print the priority as readable text.
- switch(priority) {
- case android.util.Log.VERBOSE:
- priorityStr = "VERBOSE";
- break;
- case android.util.Log.DEBUG:
- priorityStr = "DEBUG";
- break;
- case android.util.Log.INFO:
- priorityStr = "INFO";
- break;
- case android.util.Log.WARN:
- priorityStr = "WARN";
- break;
- case android.util.Log.ERROR:
- priorityStr = "ERROR";
- break;
- case android.util.Log.ASSERT:
- priorityStr = "ASSERT";
- break;
- default:
- break;
- }
-
- // Handily, the Log class has a facility for converting a stack trace into a useable string.
- String exceptionStr = null;
- if (tr != null) {
- exceptionStr = android.util.Log.getStackTraceString(tr);
- }
-
- // Take the priority, tag, message, and exception, and concatenate as necessary
- // into one usable line of text.
- StringBuilder outputBuilder = new StringBuilder();
-
- String delimiter = "\t";
-
- appendIfNotNull(outputBuilder, priorityStr, delimiter);
- appendIfNotNull(outputBuilder, tag, delimiter);
- appendIfNotNull(outputBuilder, msg, delimiter);
- appendIfNotNull(outputBuilder, exceptionStr, delimiter);
-
- // Actually display the text we just generated within the LogView.
- appendToLog(outputBuilder.toString());
-
- if (mNext != null) {
- mNext.println(priority, tag, msg, tr);
- }
- }
-
- public LogNode getNext() {
- return mNext;
- }
-
- public void setNext(LogNode node) {
- mNext = node;
- }
-
- /** Takes a string and adds to it, with a seperator, if the bit to be added isn't null. Since
- * the logger takes so many arguments that might be null, this method helps cut out some of the
- * agonizing tedium of writing the same 3 lines over and over.
- * @param source Stringbuilder containing the text to append to.
- * @param addStrStr The String to append
- * @param delimiter The String to seperate the source and appendee strings. A tab or comma,
- * for instance.
- * @return The fully concatenated String as a StringBuilder
- */
- private StringBuilder appendIfNotNull(StringBuilder source, String addStr, String delimiter) {
- if (addStr != null) {
- if (addStr.length() == 0) {
- delimiter = "";
- }
-
- return source.append(addStr).append(delimiter);
- }
- return source;
- }
-
- // The next LogNode in the chain.
- LogNode mNext;
-
- /** Outputs the string as a new line of log data in the LogView. */
- public void appendToLog(String s) {
- append(s + "\n");
- }
-
-
-}
diff --git a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/java/com/example/android/common/logger/LogWrapper.java b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/java/com/example/android/common/logger/LogWrapper.java
deleted file mode 100644
index 16a9e7b..0000000
--- a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/java/com/example/android/common/logger/LogWrapper.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.example.android.common.logger;
-
-import android.util.Log;
-
-/**
- * Helper class which wraps Android's native Log utility in the Logger interface. This way
- * normal DDMS output can be one of the many targets receiving and outputting logs simultaneously.
- */
-public class LogWrapper implements LogNode {
-
- // For piping: The next node to receive Log data after this one has done its work.
- private LogNode mNext;
-
- /**
- * Returns the next LogNode in the linked list.
- */
- public LogNode getNext() {
- return mNext;
- }
-
- /**
- * Sets the LogNode data will be sent to..
- */
- public void setNext(LogNode node) {
- mNext = node;
- }
-
- /**
- * Prints data out to the console using Android's native log mechanism.
- * @param priority Log level of the data being logged. Verbose, Error, etc.
- * @param tag Tag for for the log data. Can be used to organize log statements.
- * @param msg The actual message to be logged. The actual message to be logged.
- * @param tr If an exception was thrown, this can be sent along for the logging facilities
- * to extract and print useful information.
- */
- @Override
- public void println(int priority, String tag, String msg, Throwable tr) {
- // There actually are log methods that don't take a msg parameter. For now,
- // if that's the case, just convert null to the empty string and move on.
- String useMsg = msg;
- if (useMsg == null) {
- useMsg = "";
- }
-
- // If an exeption was provided, convert that exception to a usable string and attach
- // it to the end of the msg method.
- if (tr != null) {
- msg += "\n" + Log.getStackTraceString(tr);
- }
-
- // This is functionally identical to Log.x(tag, useMsg);
- // For instance, if priority were Log.VERBOSE, this would be the same as Log.v(tag, useMsg)
- Log.println(priority, tag, useMsg);
-
- // If this isn't the last node in the chain, move things along.
- if (mNext != null) {
- mNext.println(priority, tag, msg, tr);
- }
- }
-}
diff --git a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/java/com/example/android/common/logger/MessageOnlyLogFilter.java b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/java/com/example/android/common/logger/MessageOnlyLogFilter.java
deleted file mode 100644
index 19967dc..0000000
--- a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/java/com/example/android/common/logger/MessageOnlyLogFilter.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.example.android.common.logger;
-
-/**
- * Simple {@link LogNode} filter, removes everything except the message.
- * Useful for situations like on-screen log output where you don't want a lot of metadata displayed,
- * just easy-to-read message updates as they're happening.
- */
-public class MessageOnlyLogFilter implements LogNode {
-
- LogNode mNext;
-
- /**
- * Takes the "next" LogNode as a parameter, to simplify chaining.
- *
- * @param next The next LogNode in the pipeline.
- */
- public MessageOnlyLogFilter(LogNode next) {
- mNext = next;
- }
-
- public MessageOnlyLogFilter() {
- }
-
- @Override
- public void println(int priority, String tag, String msg, Throwable tr) {
- if (mNext != null) {
- getNext().println(Log.NONE, null, msg, null);
- }
- }
-
- /**
- * Returns the next LogNode in the chain.
- */
- public LogNode getNext() {
- return mNext;
- }
-
- /**
- * Sets the LogNode data will be sent to..
- */
- public void setNext(LogNode node) {
- mNext = node;
- }
-
-}
diff --git a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/res/drawable-hdpi/ic_launcher.png b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/res/drawable-hdpi/ic_launcher.png
deleted file mode 100755
index 22ce606..0000000
--- a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/res/drawable-hdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/res/drawable-mdpi/ic_launcher.png b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/res/drawable-mdpi/ic_launcher.png
deleted file mode 100755
index f21e17b..0000000
--- a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/res/drawable-mdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/res/drawable-xhdpi/ic_launcher.png b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/res/drawable-xhdpi/ic_launcher.png
deleted file mode 100755
index 64b8059..0000000
--- a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/res/drawable-xhdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/res/drawable-xxhdpi/ic_launcher.png b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/res/drawable-xxhdpi/ic_launcher.png
deleted file mode 100755
index 6b4434a..0000000
--- a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/res/drawable-xxhdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/res/layout/activity_main.xml b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/res/layout/activity_main.xml
deleted file mode 100755
index a86e2b0..0000000
--- a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/res/layout/activity_main.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<!--
- Copyright 2013 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent">
-<fragment
- android:name="com.example.android.common.SimpleTextFragment"
- android:id="@+id/intro_fragment"
- android:layout_weight="1"
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
-<View
- android:layout_width="fill_parent"
- android:layout_height="1dp"
- android:background="@android:color/darker_gray"/>
-<fragment
- android:name="com.example.android.basicandroidkeystore.LogFragment"
- android:id="@+id/log_fragment"
- android:layout_weight="1"
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
- </LinearLayout>
\ No newline at end of file
diff --git a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/res/layout/log_fragment.xml b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/res/layout/log_fragment.xml
deleted file mode 100644
index f2d7b75..0000000
--- a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/res/layout/log_fragment.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
- <!--
- Copyright 2013 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<ScrollView
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/log_scroll"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <com.example.android.common.logger.LogView
- android:id="@+id/sample_output"
- style="@style/Log"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:clickable="true"
- android:focusable="true"
- android:text=""
- android:gravity="bottom" />
-</ScrollView>
\ No newline at end of file
diff --git a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/res/values-sw600dp/styles.xml b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/res/values-sw600dp/styles.xml
deleted file mode 100644
index ffcbe8a..0000000
--- a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/res/values-sw600dp/styles.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
- Copyright 2013 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<resources>
-
- <style name="Widget.SampleOutput">
- <item name="android:paddingTop">@dimen/margin_medium</item>
- <item name="android:paddingBottom">@dimen/margin_medium</item>
- <item name="android:paddingLeft">@dimen/margin_huge</item>
- <item name="android:paddingRight">@dimen/margin_huge</item>
- <item name="android:textAppearance">?android:textAppearanceLarge</item>
- <item name="android:lineSpacingMultiplier">1.2</item>
- </style>
-
-</resources>
diff --git a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/res/values-v11/styles.xml b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/res/values-v11/styles.xml
deleted file mode 100644
index c6c648b..0000000
--- a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/res/values-v11/styles.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<!--
- Copyright 2013 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<resources>
- <style name="Theme.Base" parent="android:Theme.Holo.Light" />
-</resources>
diff --git a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/res/values/dimens.xml b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/res/values/dimens.xml
deleted file mode 100644
index 952c220..0000000
--- a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/res/values/dimens.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<!--
- Copyright 2013 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<resources>
-
- <!-- Define standard dimensions to comply with Holo-style grids and rhythm. -->
-
- <dimen name="margin_tiny">4dp</dimen>
- <dimen name="margin_small">8dp</dimen>
- <dimen name="margin_medium">16dp</dimen>
- <dimen name="margin_large">32dp</dimen>
- <dimen name="margin_huge">64dp</dimen>
-
-</resources>
diff --git a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/res/values/strings.xml b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/res/values/strings.xml
deleted file mode 100755
index e579aee..0000000
--- a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<!--
- Copyright 2013 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<resources>
- <string name="app_name">Androidkeystore</string>
- <string name="sample_action">Sample action</string>
-
- <!-- Steps -->
- <string name="intro_message">
- Welcome to the <b>Basic Android Key Store</b> sample!\n\n
- This sample demonstrates how to use the Android Key Store to safely create and store
- encryption keys that only your application can access. You can also sign data using those
- keys.\n\n
- To create a new KeyPair, click \"Create\".\n\n
- To sign some data using a KeyPair, click \"Sign\".\n\n
- To verify the data using the signature provided, click \"Verify\".\n\n
- </string>
-
- <!-- Button labels -->
- <string name="str_create_keys">Create</string>
- <string name="str_sign_data">Sign</string>
- <string name="str_verify_data">Verify</string>
-
-</resources>
diff --git a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/res/values/styles.xml b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/res/values/styles.xml
deleted file mode 100644
index fb75961..0000000
--- a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/res/values/styles.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<!--
- Copyright 2013 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<resources>
-
- <!-- Activity themes -->
-
- <style name="Theme.Base" parent="android:Theme.Light" />
-
- <style name="Theme.Sample" parent="Theme.Base" />
-
- <!-- Widget styling -->
-
- <style name="Widget" />
-
- <style name="Widget.SampleOutput">
- <item name="android:padding">@dimen/margin_medium</item>
- <item name="android:textAppearance">?android:textAppearanceMedium</item>
- <item name="android:lineSpacingMultiplier">1.1</item>
- </style>
-
- <style name="Log" parent="Widget.SampleOutput">
- <item name="android:typeface">monospace</item>
- </style>
-
-</resources>
diff --git a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/.gitignore b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/.gitignore
new file mode 100644
index 0000000..6eb878d
--- /dev/null
+++ b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/.gitignore
@@ -0,0 +1,16 @@
+# Copyright 2013 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+src/template/
+src/common/
+build.gradle
diff --git a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/README-simpleview.txt b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/README-simpleview.txt
new file mode 100644
index 0000000..4ac7cdb
--- /dev/null
+++ b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/README-simpleview.txt
@@ -0,0 +1,29 @@
+<#--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+Steps to implement SimpleView template:
+-in template-params.xml.ftl:
+ -add the following line to common imports
+ <common src="activities"/>
+
+-Add a Fragment to handle behavior. In your MainActivity.java class, it will reference a Fragment
+ called (yourProjectName)Fragment.java. Create that file in your project, using the "main" source
+ folder instead of "common" or "templates".
+ For instance, if your package name is com.example.foo, create the file
+ src/main/java/com/example/foo/FooFragment.java
+
+-refer to sampleSamples/simpleViewSample for a reference implementation of a
+project built on this template.
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/proguard-project.txt b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/proguard-project.txt
similarity index 91%
copy from connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/proguard-project.txt
copy to security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/proguard-project.txt
index f2fe155..0d8f171 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/proguard-project.txt
+++ b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/proguard-project.txt
@@ -1,4 +1,4 @@
-# To enable ProGuard in your project, edit project.properties
+ To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
diff --git a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/AndroidManifest.xml b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/src/main/AndroidManifest.xml
similarity index 61%
copy from ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/AndroidManifest.xml
copy to security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/src/main/AndroidManifest.xml
index 3c0e66a..28d256c 100644
--- a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/AndroidManifest.xml
+++ b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/src/main/AndroidManifest.xml
@@ -1,12 +1,12 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (C) 2013 The Android Open Source Project
+ Copyright 2013 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
+ http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@@ -15,28 +15,27 @@
limitations under the License.
-->
+
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.ui.accessibility.BasicAccessibility"
+ package="com.example.android.basicandroidkeystore"
android:versionCode="1"
- android:versionName="1.0" >
+ android:versionName="1.0">
- <uses-sdk
- android:minSdkVersion="11"
- android:targetSdkVersion="16" />
+ <uses-sdk android:minSdkVersion="18" android:targetSdkVersion="19" />
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
+ <application android:allowBackup="true"
android:label="@string/app_name"
- android:theme="@style/AppTheme" >
- <activity
- android:name="com.example.android.ui.accessibility.BasicAccessibility.MainActivity"
- android:label="@string/app_name" >
+ android:icon="@drawable/ic_launcher"
+ android:theme="@style/AppTheme">
+
+ <activity android:name=".MainActivity"
+ android:label="@string/app_name"
+ android:uiOptions="splitActionBarWhenNarrow">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
-
</manifest>
diff --git a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/java/com/example/android/basicandroidkeystore/KeyStoreHelper.java b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/src/main/java/com/example/android/basicandroidkeystore/BasicAndroidKeyStoreFragment.java
similarity index 63%
rename from security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/java/com/example/android/basicandroidkeystore/KeyStoreHelper.java
rename to security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/src/main/java/com/example/android/basicandroidkeystore/BasicAndroidKeyStoreFragment.java
index 7ccf733..12873e8 100644
--- a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/java/com/example/android/basicandroidkeystore/KeyStoreHelper.java
+++ b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/src/main/java/com/example/android/basicandroidkeystore/BasicAndroidKeyStoreFragment.java
@@ -1,27 +1,29 @@
/*
- * Copyright 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+* Copyright (C) 2013 The Android Open Source Project
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
package com.example.android.basicandroidkeystore;
import android.content.Context;
+import android.os.Bundle;
import android.security.KeyPairGeneratorSpec;
+import android.support.v4.app.Fragment;
import android.util.Base64;
+import android.view.MenuItem;
import com.example.android.common.logger.Log;
-import com.example.android.common.SecurityConstants;
import java.io.IOException;
import java.math.BigInteger;
@@ -42,15 +44,107 @@
import javax.security.auth.x500.X500Principal;
-public class KeyStoreHelper {
+public class BasicAndroidKeyStoreFragment extends Fragment {
- public static final String TAG = "KeyStoreHelper";
+ public static final String TAG = "BasicAndroidKeyStoreFragment";
+
+ // BEGIN_INCLUDE(values)
+
+ public static final String SAMPLE_ALIAS = "myKey";
+
+ // Some sample data to sign, and later verify using the generated signature.
+ public static final String SAMPLE_INPUT="Hello, Android!";
+
+ // Just a handy place to store the signature in between signing and verifying.
+ public String mSignatureStr = null;
// You can store multiple key pairs in the Key Store. The string used to refer to the Key you
// want to store, or later pull, is referred to as an "alias" in this case, because calling it
// a key, when you use it to retrieve a key, would just be irritating.
private String mAlias = null;
+ // END_INCLUDE(values)
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setHasOptionsMenu(true);
+ setAlias(SAMPLE_ALIAS);
+ }
+
+ @Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.btn_create_keys:
+ try {
+ createKeys(getActivity());
+ Log.d(TAG, "Keys created");
+ return true;
+ } catch (NoSuchAlgorithmException e) {
+ Log.w(TAG, "RSA not supported", e);
+ } catch (InvalidAlgorithmParameterException e) {
+ Log.w(TAG, "No such provider: AndroidKeyStore");
+ } catch (NoSuchProviderException e) {
+ Log.w(TAG, "Invalid Algorithm Parameter Exception", e);
+ }
+ return true;
+ case R.id.btn_sign_data:
+ try {
+ mSignatureStr = signData(SAMPLE_INPUT);
+ } catch (KeyStoreException e) {
+ Log.w(TAG, "KeyStore not Initialized", e);
+ } catch (UnrecoverableEntryException e) {
+ Log.w(TAG, "KeyPair not recovered", e);
+ } catch (NoSuchAlgorithmException e) {
+ Log.w(TAG, "RSA not supported", e);
+ } catch (InvalidKeyException e) {
+ Log.w(TAG, "Invalid Key", e);
+ } catch (SignatureException e) {
+ Log.w(TAG, "Invalid Signature", e);
+ } catch (IOException e) {
+ Log.w(TAG, "IO Exception", e);
+ } catch (CertificateException e) {
+ Log.w(TAG, "Error occurred while loading certificates", e);
+ }
+ Log.d(TAG, "Signature: " + mSignatureStr);
+ return true;
+
+ case R.id.btn_verify_data:
+ boolean verified = false;
+ try {
+ if (mSignatureStr != null) {
+ verified = verifyData(SAMPLE_INPUT, mSignatureStr);
+ }
+ } catch (KeyStoreException e) {
+ Log.w(TAG, "KeyStore not Initialized", e);
+ } catch (CertificateException e) {
+ Log.w(TAG, "Error occurred while loading certificates", e);
+ } catch (NoSuchAlgorithmException e) {
+ Log.w(TAG, "RSA not supported", e);
+ } catch (IOException e) {
+ Log.w(TAG, "IO Exception", e);
+ } catch (UnrecoverableEntryException e) {
+ Log.w(TAG, "KeyPair not recovered", e);
+ } catch (InvalidKeyException e) {
+ Log.w(TAG, "Invalid Key", e);
+ } catch (SignatureException e) {
+ Log.w(TAG, "Invalid Signature", e);
+ }
+ if (verified) {
+ Log.d(TAG, "Data Signature Verified");
+ } else {
+ Log.d(TAG, "Data not verified.");
+ }
+ return true;
+ }
+ return false;
+ }
+
/**
* Creates a public and private key and stores it using the Android Key Store, so that only
* this application will be able to access the keys.
@@ -74,20 +168,18 @@
new KeyPairGeneratorSpec.Builder(context)
// You'll use the alias later to retrieve the key. It's a key for the key!
.setAlias(mAlias)
- // The subject used for the self-signed certificate of the generated pair
+ // The subject used for the self-signed certificate of the generated pair
.setSubject(new X500Principal("CN=" + mAlias))
- // The serial number used for the self-signed certificate of the
- // generated pair.
+ // The serial number used for the self-signed certificate of the
+ // generated pair.
.setSerialNumber(BigInteger.valueOf(1337))
- // Date range of validity for the generated pair.
+ // Date range of validity for the generated pair.
.setStartDate(start.getTime())
.setEndDate(end.getTime())
.build();
// END_INCLUDE(create_spec)
-
// BEGIN_INCLUDE(create_keypair)
-
// Initialize a KeyPair generator using the the intended algorithm (in this example, RSA
// and the KeyStore. This example uses the AndroidKeyStore.
KeyPairGenerator kpGenerator = KeyPairGenerator
@@ -97,8 +189,6 @@
KeyPair kp = kpGenerator.generateKeyPair();
Log.d(TAG, "Public Key is: " + kp.getPublic().toString());
// END_INCLUDE(create_keypair)
-
-
}
/**
@@ -158,8 +248,7 @@
// Sign the data, store the result as a Base64 encoded String.
s.update(data);
byte[] signature = s.sign();
- String result = null;
- result = Base64.encodeToString(signature, Base64.DEFAULT);
+ String result = Base64.encodeToString(signature, Base64.DEFAULT);
// END_INCLUDE(sign_data)
return result;
diff --git a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/java/com/example/android/common/SecurityConstants.java b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/src/main/java/com/example/android/basicandroidkeystore/SecurityConstants.java
similarity index 95%
rename from security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/java/com/example/android/common/SecurityConstants.java
rename to security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/src/main/java/com/example/android/basicandroidkeystore/SecurityConstants.java
index e23110c..ea5ee30 100644
--- a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/java/com/example/android/common/SecurityConstants.java
+++ b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/src/main/java/com/example/android/basicandroidkeystore/SecurityConstants.java
@@ -1,5 +1,3 @@
-package com.example.android.common;
-
/*
* Copyright 2013 The Android Open Source Project
*
@@ -16,6 +14,8 @@
* limitations under the License.
*/
+package com.example.android.basicandroidkeystore;
+
/**
* Helper class, contains several constants used when encrypting/decrypting data on Android.
* This class should not be considered a complete list of the algorithms, keystore types,
@@ -30,5 +30,4 @@
public static final String SIGNATURE_SHA256withRSA = "SHA256withRSA";
public static final String SIGNATURE_SHA512withRSA = "SHA512withRSA";
-
}
diff --git a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/src/main/res/drawable-hdpi/ic_launcher.png b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/src/main/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 0000000..b1efaf4
--- /dev/null
+++ b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/src/main/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/src/main/res/drawable-mdpi/ic_launcher.png b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/src/main/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 0000000..f5f9244
--- /dev/null
+++ b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/src/main/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/src/main/res/drawable-xhdpi/ic_launcher.png b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/src/main/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..5d07b3f
--- /dev/null
+++ b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/src/main/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/src/main/res/drawable-xxhdpi/ic_launcher.png b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/src/main/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..6ef21e1
--- /dev/null
+++ b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/src/main/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/res/menu/main.xml b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/src/main/res/menu/main.xml
similarity index 100%
rename from security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStore/src/main/res/menu/main.xml
rename to security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/src/main/res/menu/main.xml
diff --git a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/src/main/res/values/strings.xml b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/src/main/res/values/strings.xml
new file mode 100644
index 0000000..25ad389
--- /dev/null
+++ b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/src/main/res/values/strings.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<resources>
+ <string name="str_create_keys">Create</string>
+ <string name="str_sign_data">Sign</string>
+ <string name="str_verify_data">Verify</string>
+</resources>
diff --git a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/tests/AndroidManifest.xml b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/tests/AndroidManifest.xml
new file mode 100644
index 0000000..87b785f
--- /dev/null
+++ b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/tests/AndroidManifest.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<!-- package name must be unique so suffix with "tests" so package loader doesn't ignore us -->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="${sample.package}.tests"
+ android:versionCode="1"
+ android:versionName="1.0">
+
+ <uses-sdk
+ android:minSdkVersion="18"
+ android:targetSdkVersion="19" />
+
+ <!-- We add an application tag here just so that we can indicate that
+ this package needs to link against the android.test library,
+ which is needed when building test cases. -->
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <!--
+ Specifies the instrumentation test runner used to run the tests.
+ -->
+ <instrumentation
+ android:name="android.test.InstrumentationTestRunner"
+ android:targetPackage="${sample.package}"
+ android:label="Tests for ${sample.package}" />
+
+</manifest>
\ No newline at end of file
diff --git a/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/tests/src/com/example/android/basicandroidkeystore/tests/SampleTests.java b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/tests/src/com/example/android/basicandroidkeystore/tests/SampleTests.java
new file mode 100644
index 0000000..756b605
--- /dev/null
+++ b/security/keystore/BasicAndroidKeyStore/BasicAndroidKeyStoreSample/tests/src/com/example/android/basicandroidkeystore/tests/SampleTests.java
@@ -0,0 +1,79 @@
+/*
+* Copyright 2013 The Android Open Source Project
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+
+/*
+* Copyright (C) 2013 The Android Open Source Project
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package com.example.android.basicandroidkeystore.tests;
+
+import com.example.android.basicandroidkeystore.*;
+
+import android.test.ActivityInstrumentationTestCase2;
+
+/**
+* Tests for BasicAndroidKeyStore sample.
+*/
+public class SampleTests extends ActivityInstrumentationTestCase2<MainActivity> {
+
+ private MainActivity mTestActivity;
+ private BasicAndroidKeyStoreFragment mTestFragment;
+
+ public SampleTests() {
+ super(MainActivity.class);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ // Starts the activity under test using the default Intent with:
+ // action = {@link Intent#ACTION_MAIN}
+ // flags = {@link Intent#FLAG_ACTIVITY_NEW_TASK}
+ // All other fields are null or empty.
+ mTestActivity = getActivity();
+ mTestFragment = (BasicAndroidKeyStoreFragment)
+ mTestActivity.getSupportFragmentManager().getFragments().get(1);
+ }
+
+ /**
+ * Test if the test fixture has been set up correctly.
+ */
+ public void testPreconditions() {
+ //Try to add a message to add context to your assertions. These messages will be shown if
+ //a tests fails and make it easy to understand why a test failed
+ assertNotNull("mTestActivity is null", mTestActivity);
+ assertNotNull("mTestFragment is null", mTestFragment);
+ }
+
+ /**
+ * Add more tests below.
+ */
+
+}
\ No newline at end of file
diff --git a/security/keystore/BasicAndroidKeyStore/README.txt b/security/keystore/BasicAndroidKeyStore/README.txt
deleted file mode 100644
index 38608df..0000000
--- a/security/keystore/BasicAndroidKeyStore/README.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-Build Instructions
--------------------
-This sample uses the Gradle build system. To build this project, use the
-"gradlew build" command.
-
-To see a list of all available commands, run "gradlew tasks".
\ No newline at end of file
diff --git a/security/keystore/BasicAndroidKeyStore/build.gradle b/security/keystore/BasicAndroidKeyStore/build.gradle
index 036abc8..ffb5c2f 100644
--- a/security/keystore/BasicAndroidKeyStore/build.gradle
+++ b/security/keystore/BasicAndroidKeyStore/build.gradle
@@ -1,8 +1,11 @@
-buildscript {
- repositories {
- mavenCentral()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:0.5.+'
- }
+
+
+
+
+// BEGIN_EXCLUDE
+apply from: "../../../../../build/build.gradle"
+samplegen {
+ pathToBuild "../../../../../build"
+ pathToSamplesCommon "../../../common"
}
+// END_EXCLUDE
diff --git a/security/keystore/BasicAndroidKeyStore/buildSrc/build.gradle b/security/keystore/BasicAndroidKeyStore/buildSrc/build.gradle
new file mode 100644
index 0000000..e344a8c
--- /dev/null
+++ b/security/keystore/BasicAndroidKeyStore/buildSrc/build.gradle
@@ -0,0 +1,18 @@
+
+
+
+repositories {
+ mavenCentral()
+}
+dependencies {
+ compile 'org.freemarker:freemarker:2.3.20'
+}
+
+sourceSets {
+ main {
+ groovy {
+ srcDir new File(rootDir, "../../../../../../build/buildSrc/src/main/groovy")
+ }
+ }
+}
+
diff --git a/security/keystore/BasicAndroidKeyStore/gradle/wrapper/gradle-wrapper.properties b/security/keystore/BasicAndroidKeyStore/gradle/wrapper/gradle-wrapper.properties
index 055ba6f..861eddc 100644
--- a/security/keystore/BasicAndroidKeyStore/gradle/wrapper/gradle-wrapper.properties
+++ b/security/keystore/BasicAndroidKeyStore/gradle/wrapper/gradle-wrapper.properties
@@ -1,7 +1,6 @@
-#
-#Mon Jul 22 11:40:20 PDT 2013
+#Wed Apr 10 15:27:10 PDT 2013
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.6-bin.zip
+distributionUrl=http\://services.gradle.org/distributions/gradle-1.8-bin.zip
diff --git a/security/keystore/BasicAndroidKeyStore/settings.gradle b/security/keystore/BasicAndroidKeyStore/settings.gradle
index 1d0b075..e4b36fe 100644
--- a/security/keystore/BasicAndroidKeyStore/settings.gradle
+++ b/security/keystore/BasicAndroidKeyStore/settings.gradle
@@ -1 +1,4 @@
-include ':BasicAndroidKeyStore'
+
+
+
+include 'BasicAndroidKeyStoreSample'
diff --git a/security/keystore/BasicAndroidKeyStore/template-params.xml b/security/keystore/BasicAndroidKeyStore/template-params.xml
new file mode 100644
index 0000000..2498b88
--- /dev/null
+++ b/security/keystore/BasicAndroidKeyStore/template-params.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+
+
+<sample>
+ <name>BasicAndroidKeyStore</name>
+ <package>com.example.android.basicandroidkeystore</package>
+
+ <!-- change minSdk if needed-->
+ <minSdk>18</minSdk>
+
+ <strings>
+ <intro>
+ <![CDATA[
+ Welcome to the <b>Basic Android Key Store</b> sample!\n\n
+ This sample demonstrates how to use the Android Key Store to safely create and store
+ encryption keys that only your application can access. You can also sign data
+ using those keys.\n\n
+ To create a new KeyPair, click \"Create\".\n\n
+ To sign some data using a KeyPair, click \"Sign\".\n\n
+ To verify the data using the signature provided, click \"Verify\".\n\n ]]>
+ </intro>
+ </strings>
+
+ <template src="base"/>
+ <template src="SimpleView"/>
+ <common src="activities"/>
+ <common src="logger"/>
+
+</sample>
diff --git a/testing/ActivityInstrumentation/ActivityInstrumentationSample/.gitignore b/testing/ActivityInstrumentation/ActivityInstrumentationSample/.gitignore
new file mode 100644
index 0000000..6eb878d
--- /dev/null
+++ b/testing/ActivityInstrumentation/ActivityInstrumentationSample/.gitignore
@@ -0,0 +1,16 @@
+# Copyright 2013 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+src/template/
+src/common/
+build.gradle
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/proguard-project.txt b/testing/ActivityInstrumentation/ActivityInstrumentationSample/proguard-project.txt
similarity index 91%
copy from connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/proguard-project.txt
copy to testing/ActivityInstrumentation/ActivityInstrumentationSample/proguard-project.txt
index f2fe155..0d8f171 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/proguard-project.txt
+++ b/testing/ActivityInstrumentation/ActivityInstrumentationSample/proguard-project.txt
@@ -1,4 +1,4 @@
-# To enable ProGuard in your project, edit project.properties
+ To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
diff --git a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/AndroidManifest.xml b/testing/ActivityInstrumentation/ActivityInstrumentationSample/src/main/AndroidManifest.xml
similarity index 61%
copy from ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/AndroidManifest.xml
copy to testing/ActivityInstrumentation/ActivityInstrumentationSample/src/main/AndroidManifest.xml
index 3c0e66a..547d95e 100644
--- a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/AndroidManifest.xml
+++ b/testing/ActivityInstrumentation/ActivityInstrumentationSample/src/main/AndroidManifest.xml
@@ -1,12 +1,12 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (C) 2013 The Android Open Source Project
+ Copyright 2013 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
+ http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@@ -15,23 +15,22 @@
limitations under the License.
-->
+
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.ui.accessibility.BasicAccessibility"
+ package="com.example.android.activityinstrumentation"
android:versionCode="1"
- android:versionName="1.0" >
+ android:versionName="1.0">
- <uses-sdk
- android:minSdkVersion="11"
- android:targetSdkVersion="16" />
+ <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="17" />
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
+ <application android:allowBackup="true"
android:label="@string/app_name"
- android:theme="@style/AppTheme" >
- <activity
- android:name="com.example.android.ui.accessibility.BasicAccessibility.MainActivity"
- android:label="@string/app_name" >
+ android:icon="@drawable/ic_launcher"
+ android:theme="@style/AppTheme">
+
+ <activity android:name=".MainActivity"
+ android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
@@ -39,4 +38,5 @@
</activity>
</application>
+
</manifest>
diff --git a/testing/ActivityInstrumentationSample/src/com/example/android/activityinstrumentation/MainActivity.java b/testing/ActivityInstrumentation/ActivityInstrumentationSample/src/main/java/com/example/android/activityinstrumentation/MainActivity.java
similarity index 98%
rename from testing/ActivityInstrumentationSample/src/com/example/android/activityinstrumentation/MainActivity.java
rename to testing/ActivityInstrumentation/ActivityInstrumentationSample/src/main/java/com/example/android/activityinstrumentation/MainActivity.java
index 39a7e37..39056ea 100644
--- a/testing/ActivityInstrumentationSample/src/com/example/android/activityinstrumentation/MainActivity.java
+++ b/testing/ActivityInstrumentation/ActivityInstrumentationSample/src/main/java/com/example/android/activityinstrumentation/MainActivity.java
@@ -16,9 +16,9 @@
package com.example.android.activityinstrumentation;
+import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle;
-import android.app.Activity;
import android.preference.PreferenceManager;
import android.view.View;
import android.widget.AdapterView;
@@ -67,7 +67,7 @@
super.onCreate(savedInstanceState);
// Inflate UI from res/layout/activity_main.xml
- setContentView(R.layout.activity_main);
+ setContentView(R.layout.sample_main);
// Get handle to default shared preferences for this activity
mPrefs = PreferenceManager.getDefaultSharedPreferences(MainActivity.this);
@@ -98,7 +98,7 @@
// statement and running the tests to watch them fail.
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
- mPrefs.edit().putInt(PREF_SPINNER_POS, position);
+ mPrefs.edit().putInt(PREF_SPINNER_POS, position).commit();
}
@Override
diff --git a/testing/ActivityInstrumentation/ActivityInstrumentationSample/src/main/res/drawable-hdpi/ic_launcher.png b/testing/ActivityInstrumentation/ActivityInstrumentationSample/src/main/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 0000000..b1efaf4
--- /dev/null
+++ b/testing/ActivityInstrumentation/ActivityInstrumentationSample/src/main/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/testing/ActivityInstrumentation/ActivityInstrumentationSample/src/main/res/drawable-mdpi/ic_launcher.png b/testing/ActivityInstrumentation/ActivityInstrumentationSample/src/main/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 0000000..f5f9244
--- /dev/null
+++ b/testing/ActivityInstrumentation/ActivityInstrumentationSample/src/main/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/testing/ActivityInstrumentation/ActivityInstrumentationSample/src/main/res/drawable-xhdpi/ic_launcher.png b/testing/ActivityInstrumentation/ActivityInstrumentationSample/src/main/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..5d07b3f
--- /dev/null
+++ b/testing/ActivityInstrumentation/ActivityInstrumentationSample/src/main/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/testing/ActivityInstrumentation/ActivityInstrumentationSample/src/main/res/drawable-xxhdpi/ic_launcher.png b/testing/ActivityInstrumentation/ActivityInstrumentationSample/src/main/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..6ef21e1
--- /dev/null
+++ b/testing/ActivityInstrumentation/ActivityInstrumentationSample/src/main/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/testing/ActivityInstrumentationSample/res/layout/activity_main.xml b/testing/ActivityInstrumentation/ActivityInstrumentationSample/src/main/res/layout/sample_main.xml
similarity index 100%
rename from testing/ActivityInstrumentationSample/res/layout/activity_main.xml
rename to testing/ActivityInstrumentation/ActivityInstrumentationSample/src/main/res/layout/sample_main.xml
diff --git a/testing/ActivityInstrumentationSample/res/values-sw720dp-land/dimens.xml b/testing/ActivityInstrumentation/ActivityInstrumentationSample/src/main/res/values-sw720dp-land/dimens.xml
similarity index 100%
rename from testing/ActivityInstrumentationSample/res/values-sw720dp-land/dimens.xml
rename to testing/ActivityInstrumentation/ActivityInstrumentationSample/src/main/res/values-sw720dp-land/dimens.xml
diff --git a/testing/ActivityInstrumentationSample/res/values/dimens.xml b/testing/ActivityInstrumentation/ActivityInstrumentationSample/src/main/res/values/dimens.xml
similarity index 100%
rename from testing/ActivityInstrumentationSample/res/values/dimens.xml
rename to testing/ActivityInstrumentation/ActivityInstrumentationSample/src/main/res/values/dimens.xml
diff --git a/testing/ActivityInstrumentationSample/res/values/strings.xml b/testing/ActivityInstrumentation/ActivityInstrumentationSample/src/main/res/values/strings.xml
similarity index 91%
rename from testing/ActivityInstrumentationSample/res/values/strings.xml
rename to testing/ActivityInstrumentation/ActivityInstrumentationSample/src/main/res/values/strings.xml
index 8bf4747..4ed2243 100644
--- a/testing/ActivityInstrumentationSample/res/values/strings.xml
+++ b/testing/ActivityInstrumentation/ActivityInstrumentationSample/src/main/res/values/strings.xml
@@ -16,6 +16,5 @@
-->
<resources>
- <string name="app_name">Activity Instrumentation Sample</string>
<string name="instructions">The value of the spinner below should be persisted when this activity is destroyed.</string>
</resources>
diff --git a/testing/ActivityInstrumentation/ActivityInstrumentationSample/tests/AndroidManifest.xml b/testing/ActivityInstrumentation/ActivityInstrumentationSample/tests/AndroidManifest.xml
new file mode 100644
index 0000000..87b785f
--- /dev/null
+++ b/testing/ActivityInstrumentation/ActivityInstrumentationSample/tests/AndroidManifest.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<!-- package name must be unique so suffix with "tests" so package loader doesn't ignore us -->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="${sample.package}.tests"
+ android:versionCode="1"
+ android:versionName="1.0">
+
+ <uses-sdk
+ android:minSdkVersion="18"
+ android:targetSdkVersion="19" />
+
+ <!-- We add an application tag here just so that we can indicate that
+ this package needs to link against the android.test library,
+ which is needed when building test cases. -->
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <!--
+ Specifies the instrumentation test runner used to run the tests.
+ -->
+ <instrumentation
+ android:name="android.test.InstrumentationTestRunner"
+ android:targetPackage="${sample.package}"
+ android:label="Tests for ${sample.package}" />
+
+</manifest>
\ No newline at end of file
diff --git a/testing/ActivityInstrumentationSample/tests/src/com/example/android/activityinstrumentation/MainActivityTest.java b/testing/ActivityInstrumentation/ActivityInstrumentationSample/tests/src/com/example/android/activityinstrumentation/SampleTests.java
similarity index 92%
rename from testing/ActivityInstrumentationSample/tests/src/com/example/android/activityinstrumentation/MainActivityTest.java
rename to testing/ActivityInstrumentation/ActivityInstrumentationSample/tests/src/com/example/android/activityinstrumentation/SampleTests.java
index fcffb01..3be1867 100644
--- a/testing/ActivityInstrumentationSample/tests/src/com/example/android/activityinstrumentation/MainActivityTest.java
+++ b/testing/ActivityInstrumentation/ActivityInstrumentationSample/tests/src/com/example/android/activityinstrumentation/SampleTests.java
@@ -20,6 +20,9 @@
import android.test.ActivityInstrumentationTestCase2;
import android.widget.Spinner;
+import com.example.android.activityinstrumentation.MainActivity;
+import com.example.android.activityinstrumentation.R;
+
/**
* This is a simple framework for a test of an Application. See
* {@link android.test.ApplicationTestCase ApplicationTestCase} for more information on
@@ -28,7 +31,7 @@
* <p>To run this test, you can type:
* adb shell am instrument -w \
* -e class com.example.android.activityinstrumentation.MainActivityTest \
- * com.example.android.activityinstrumentation.tests/android.test.InstrumentationTestRunner
+ * quux.tests/android.test.InstrumentationTestRunner
*
* <p>Individual tests are defined as any method beginning with 'test'.
*
@@ -36,9 +39,9 @@
* copy of the application under inspection. Calling getActivity() will return a
* handle to this activity (launching it if needed).
*/
-public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActivity> {
+public class SampleTests extends ActivityInstrumentationTestCase2<MainActivity> {
- public MainActivityTest() {
+ public SampleTests() {
super("com.example.android.activityinstrumentation", MainActivity.class);
}
@@ -50,7 +53,7 @@
*/
// BEGIN_INCLUDE (test_name)
public void testSpinnerValuePersistedBetweenLaunches() {
- // END_INCLUDE (test_name)
+ // END_INCLUDE (test_name)
final int TEST_SPINNER_POSITION_1 = MainActivity.WEATHER_PARTLY_CLOUDY;
// BEGIN_INCLUDE (launch_activity)
diff --git a/testing/ActivityInstrumentation/build.gradle b/testing/ActivityInstrumentation/build.gradle
new file mode 100644
index 0000000..c886d80
--- /dev/null
+++ b/testing/ActivityInstrumentation/build.gradle
@@ -0,0 +1,11 @@
+
+
+
+
+// BEGIN_EXCLUDE
+apply from: "../../../../build/build.gradle"
+samplegen {
+ pathToBuild "../../../../build"
+ pathToSamplesCommon "../../common"
+}
+// END_EXCLUDE
diff --git a/testing/ActivityInstrumentation/buildSrc/build.gradle b/testing/ActivityInstrumentation/buildSrc/build.gradle
new file mode 100644
index 0000000..29282af
--- /dev/null
+++ b/testing/ActivityInstrumentation/buildSrc/build.gradle
@@ -0,0 +1,18 @@
+
+
+
+repositories {
+ mavenCentral()
+}
+dependencies {
+ compile 'org.freemarker:freemarker:2.3.20'
+}
+
+sourceSets {
+ main {
+ groovy {
+ srcDir new File(rootDir, "../../../../../build/buildSrc/src/main/groovy")
+ }
+ }
+}
+
diff --git a/testing/ActivityInstrumentation/gradle/wrapper/gradle-wrapper.jar b/testing/ActivityInstrumentation/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..8c0fb64
--- /dev/null
+++ b/testing/ActivityInstrumentation/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/testing/ActivityInstrumentation/gradle/wrapper/gradle-wrapper.properties b/testing/ActivityInstrumentation/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..5c22dec
--- /dev/null
+++ b/testing/ActivityInstrumentation/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Wed Apr 10 15:27:10 PDT 2013
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=http\://services.gradle.org/distributions/gradle-1.6-bin.zip
diff --git a/testing/ActivityInstrumentation/gradlew b/testing/ActivityInstrumentation/gradlew
new file mode 100755
index 0000000..91a7e26
--- /dev/null
+++ b/testing/ActivityInstrumentation/gradlew
@@ -0,0 +1,164 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched.
+if $cygwin ; then
+ [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+fi
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >&-
+APP_HOME="`pwd -P`"
+cd "$SAVED" >&-
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/testing/ActivityInstrumentation/gradlew.bat b/testing/ActivityInstrumentation/gradlew.bat
new file mode 100644
index 0000000..aec9973
--- /dev/null
+++ b/testing/ActivityInstrumentation/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/testing/ActivityInstrumentation/settings.gradle b/testing/ActivityInstrumentation/settings.gradle
new file mode 100644
index 0000000..0f010ba
--- /dev/null
+++ b/testing/ActivityInstrumentation/settings.gradle
@@ -0,0 +1,4 @@
+
+
+
+include 'ActivityInstrumentationSample'
diff --git a/testing/ActivityInstrumentation/template-params.xml b/testing/ActivityInstrumentation/template-params.xml
new file mode 100644
index 0000000..937e26e
--- /dev/null
+++ b/testing/ActivityInstrumentation/template-params.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+
+
+<sample>
+ <name>ActivityInstrumentation</name>
+ <package>com.example.android.com.example.android.activityinstrumentation</package>
+
+
+ <!-- change minSdk if needed-->
+ <minSdk>4</minSdk>
+
+
+ <strings>
+ <intro>
+ <![CDATA[
+ This sample provides a basic example of using an InstrumentationTest to probe the
+ internal state of an Activity.
+ ]]>
+ </intro>
+ </strings>
+
+ <template src="base"/>
+ <common src="logger"/>
+
+</sample>
diff --git a/testing/ActivityInstrumentationSample/AndroidManifest.xml b/testing/ActivityInstrumentationSample/AndroidManifest.xml
deleted file mode 100644
index 783fc0c..0000000
--- a/testing/ActivityInstrumentationSample/AndroidManifest.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright 2013 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<!--
- This manifest describes the application which we'll be testing. The actual instrumentation
- tests are build a second APK, loaded alongside this one on the device.
-
- See also: //tests/AndroidManifest.xml
--->
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.activityinstrumentation"
- android:versionCode="1"
- android:versionName="1.0">
-
- <uses-sdk android:minSdkVersion="7"/>
-
- <!-- This is just a standard activity. -->
- <application
- android:label="@string/app_name"
- android:icon="@drawable/ic_launcher"
- android:theme="@style/AppTheme">
- <activity
- android:name="MainActivity"
- android:label="@string/app_name">
- <intent-filter>
- <action android:name="android.intent.action.MAIN"/>
- <category android:name="android.intent.category.LAUNCHER"/>
- </intent-filter>
- </activity>
- </application>
-</manifest>
diff --git a/testing/ActivityInstrumentationSample/proguard-project.txt b/testing/ActivityInstrumentationSample/proguard-project.txt
deleted file mode 100644
index f2fe155..0000000
--- a/testing/ActivityInstrumentationSample/proguard-project.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-# To enable ProGuard in your project, edit project.properties
-# to define the proguard.config property as described in that file.
-#
-# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in ${sdk.dir}/tools/proguard/proguard-android.txt
-# You can edit the include path and order by changing the ProGuard
-# include property in project.properties.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# Add any project specific keep options here:
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
diff --git a/testing/ActivityInstrumentationSample/res/drawable-hdpi/ic_launcher.png b/testing/ActivityInstrumentationSample/res/drawable-hdpi/ic_launcher.png
deleted file mode 100644
index 96a442e..0000000
--- a/testing/ActivityInstrumentationSample/res/drawable-hdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/testing/ActivityInstrumentationSample/res/drawable-ldpi/ic_launcher.png b/testing/ActivityInstrumentationSample/res/drawable-ldpi/ic_launcher.png
deleted file mode 100644
index 9923872..0000000
--- a/testing/ActivityInstrumentationSample/res/drawable-ldpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/testing/ActivityInstrumentationSample/res/drawable-mdpi/ic_launcher.png b/testing/ActivityInstrumentationSample/res/drawable-mdpi/ic_launcher.png
deleted file mode 100644
index 359047d..0000000
--- a/testing/ActivityInstrumentationSample/res/drawable-mdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/testing/ActivityInstrumentationSample/res/drawable-xhdpi/ic_launcher.png b/testing/ActivityInstrumentationSample/res/drawable-xhdpi/ic_launcher.png
deleted file mode 100644
index 71c6d76..0000000
--- a/testing/ActivityInstrumentationSample/res/drawable-xhdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/testing/ActivityInstrumentationSample/res/values-v11/styles.xml b/testing/ActivityInstrumentationSample/res/values-v11/styles.xml
deleted file mode 100644
index 1b39428..0000000
--- a/testing/ActivityInstrumentationSample/res/values-v11/styles.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright 2013 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<resources>
-
- <!--
- Base application theme for API 11+. This theme completely replaces
- AppBaseTheme from res/values/styles.xml on API 11+ devices.
- -->
- <style name="AppBaseTheme" parent="android:Theme.Holo.Light">
- <!-- API 11 theme customizations can go here. -->
- </style>
-
-</resources>
diff --git a/testing/ActivityInstrumentationSample/res/values-v14/styles.xml b/testing/ActivityInstrumentationSample/res/values-v14/styles.xml
deleted file mode 100644
index 219b706..0000000
--- a/testing/ActivityInstrumentationSample/res/values-v14/styles.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright 2013 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<resources>
-
- <!--
- Base application theme for API 14+. This theme completely replaces
- AppBaseTheme from BOTH res/values/styles.xml and
- res/values-v11/styles.xml on API 14+ devices.
- -->
- <style name="AppBaseTheme" parent="android:Theme.Holo.Light">
- <!-- API 14 theme customizations can go here. -->
- </style>
-
-</resources>
diff --git a/testing/ActivityInstrumentationSample/res/values/styles.xml b/testing/ActivityInstrumentationSample/res/values/styles.xml
deleted file mode 100644
index bdd3ba5..0000000
--- a/testing/ActivityInstrumentationSample/res/values/styles.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright 2013 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<resources>
-
- <!--
- Base application theme, dependent on API level. This theme is replaced
- by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
- -->
- <style name="AppBaseTheme" parent="android:Theme.Light">
- <!--
- Theme customizations available in newer API levels can go in
- res/values-vXX/styles.xml, while customizations related to
- backward-compatibility can go here.
- -->
- </style>
-
- <!-- Application theme. -->
- <style name="AppTheme" parent="AppBaseTheme">
- <!-- All customizations that are NOT specific to a particular API-level can go here. -->
- </style>
-
-</resources>
diff --git a/testing/ActivityInstrumentationSample/tests/AndroidManifest.xml b/testing/ActivityInstrumentationSample/tests/AndroidManifest.xml
deleted file mode 100644
index 1547109..0000000
--- a/testing/ActivityInstrumentationSample/tests/AndroidManifest.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright 2013 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<!-- package name must be unique so suffix with "tests" so package loader doesn't ignore us -->
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.activityinstrumentation.tests"
- android:versionCode="1"
- android:versionName="1.0">
- <!-- We add an application tag here just so that we can indicate that
- this package needs to link against the android.test library,
- which is needed when building test cases. -->
- <application>
- <uses-library android:name="android.test.runner" />
- </application>
- <!--
- This declares that this application uses the instrumentation test runner targeting
- the package of com.example.android.foohe tests use the command:
- "adb shell am instrument -w com.example.android.foooid.test.InstrumentationTestRunner"
- -->
- <instrumentation android:name="android.test.InstrumentationTestRunner"
- android:targetPackage="com.example.android.activityinstrumentation"
- android:label="Tests for com.example.android.UnitTestSample"/>
-</manifest>
diff --git a/testing/ActivityInstrumentationSample/tests/proguard-project.txt b/testing/ActivityInstrumentationSample/tests/proguard-project.txt
deleted file mode 100644
index f2fe155..0000000
--- a/testing/ActivityInstrumentationSample/tests/proguard-project.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-# To enable ProGuard in your project, edit project.properties
-# to define the proguard.config property as described in that file.
-#
-# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in ${sdk.dir}/tools/proguard/proguard-android.txt
-# You can edit the include path and order by changing the ProGuard
-# include property in project.properties.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# Add any project specific keep options here:
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
diff --git a/ui/accessibility/BasicAccessibility/BasicAccessibility/build.gradle b/ui/accessibility/BasicAccessibility/BasicAccessibility/build.gradle
deleted file mode 100644
index 10fb811..0000000
--- a/ui/accessibility/BasicAccessibility/BasicAccessibility/build.gradle
+++ /dev/null
@@ -1,10 +0,0 @@
-apply plugin: 'android'
-
-dependencies {
- compile "com.android.support:support-v4:18.0.+"
-}
-
-android {
- compileSdkVersion 18
- buildToolsVersion "18.0.1"
-}
diff --git a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/ic_launcher-web.png b/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/ic_launcher-web.png
deleted file mode 100644
index 6967d3e..0000000
--- a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/ic_launcher-web.png
+++ /dev/null
Binary files differ
diff --git a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/values-sw600dp/dimens.xml b/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/values-sw600dp/dimens.xml
deleted file mode 100644
index d0946b3..0000000
--- a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/values-sw600dp/dimens.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<!--
-Copyright (C) 2013 The Android Open Source Project
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-
-<resources>
- <!-- Customize dimensions originally defined in res/values/dimens.xml (such as
- screen margins) for sw600dp devices (e.g. 7" tablets) here. -->
-</resources>
diff --git a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/values-v11/styles.xml b/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/values-v11/styles.xml
deleted file mode 100644
index 5b1a3f2..0000000
--- a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/values-v11/styles.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<!--
-Copyright (C) 2013 The Android Open Source Project
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-
-<resources>
-
- <!--
- Base application theme for API 11+. This theme completely replaces
- AppBaseTheme from res/values/styles.xml on API 11+ devices.
- -->
- <style name="AppBaseTheme" parent="android:Theme.Holo.Light">
- <!-- API 11 theme customizations can go here. -->
- </style>
-
-</resources>
diff --git a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/values-v14/styles.xml b/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/values-v14/styles.xml
deleted file mode 100644
index b16c97b..0000000
--- a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/values-v14/styles.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
-Copyright (C) 2013 The Android Open Source Project
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-
-<resources>
-
- <!--
- Base application theme for API 14+. This theme completely replaces
- AppBaseTheme from BOTH res/values/styles.xml and
- res/values-v11/styles.xml on API 14+ devices.
- -->
- <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
- <!-- API 14 theme customizations can go here. -->
- </style>
-
-</resources>
diff --git a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/values/styles.xml b/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/values/styles.xml
deleted file mode 100644
index b0e6075..0000000
--- a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/values/styles.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<!--
-Copyright (C) 2013 The Android Open Source Project
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-
-<resources>
-
- <!--
- Base application theme, dependent on API level. This theme is replaced
- by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
- -->
- <style name="AppBaseTheme" parent="android:Theme.Light">
- <!--
- Theme customizations available in newer API levels can go in
- res/values-vXX/styles.xml, while customizations related to
- backward-compatibility can go here.
- -->
- </style>
-
- <!-- Application theme. -->
- <style name="AppTheme" parent="AppBaseTheme">
- <!-- All customizations that are NOT specific to a particular API-level can go here. -->
- </style>
-
-</resources>
diff --git a/ui/accessibility/BasicAccessibility/BasicAccessibilitySample/.gitignore b/ui/accessibility/BasicAccessibility/BasicAccessibilitySample/.gitignore
new file mode 100644
index 0000000..6eb878d
--- /dev/null
+++ b/ui/accessibility/BasicAccessibility/BasicAccessibilitySample/.gitignore
@@ -0,0 +1,16 @@
+# Copyright 2013 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+src/template/
+src/common/
+build.gradle
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/proguard-project.txt b/ui/accessibility/BasicAccessibility/BasicAccessibilitySample/proguard-project.txt
similarity index 91%
copy from connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/proguard-project.txt
copy to ui/accessibility/BasicAccessibility/BasicAccessibilitySample/proguard-project.txt
index f2fe155..0d8f171 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/proguard-project.txt
+++ b/ui/accessibility/BasicAccessibility/BasicAccessibilitySample/proguard-project.txt
@@ -1,4 +1,4 @@
-# To enable ProGuard in your project, edit project.properties
+ To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
diff --git a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/AndroidManifest.xml b/ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/AndroidManifest.xml
similarity index 77%
rename from ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/AndroidManifest.xml
rename to ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/AndroidManifest.xml
index 3c0e66a..d61d789 100644
--- a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/AndroidManifest.xml
+++ b/ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/AndroidManifest.xml
@@ -1,12 +1,12 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (C) 2013 The Android Open Source Project
+ Copyright 2013 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
+ http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@@ -15,10 +15,12 @@
limitations under the License.
-->
+
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.ui.accessibility.BasicAccessibility"
+ package="com.example.android.basicaccessibility"
android:versionCode="1"
- android:versionName="1.0" >
+ android:versionName="1.0">
<uses-sdk
android:minSdkVersion="11"
@@ -30,7 +32,7 @@
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
- android:name="com.example.android.ui.accessibility.BasicAccessibility.MainActivity"
+ android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
diff --git a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/java/com/example/android/ui/accessibility/BasicAccessibility/DialView.java b/ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/java/com/example/android/basicaccessibility/DialView.java
similarity index 97%
rename from ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/java/com/example/android/ui/accessibility/BasicAccessibility/DialView.java
rename to ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/java/com/example/android/basicaccessibility/DialView.java
index 1fc5e0c..efdb449 100644
--- a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/java/com/example/android/ui/accessibility/BasicAccessibility/DialView.java
+++ b/ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/java/com/example/android/basicaccessibility/DialView.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.example.android.ui.accessibility.BasicAccessibility;
+package com.example.android.basicaccessibility;
import android.annotation.TargetApi;
import android.content.Context;
@@ -30,7 +30,7 @@
* Custom view to demonstrate accessibility.
*
* <p>This view does not use any framework widgets, so does not get any accessibility features
- * automatically. Instead, we use {@link AccessibilityEvent} to provide accessibility hints to
+ * automatically. Instead, we use {@link android.view.accessibility.AccessibilityEvent} to provide accessibility hints to
* the OS.
*
* <p>For example, if TalkBack is enabled, users will be able to receive spoken feedback as they
diff --git a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/java/com/example/android/ui/accessibility/BasicAccessibility/MainActivity.java b/ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/java/com/example/android/basicaccessibility/MainActivity.java
similarity index 91%
rename from ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/java/com/example/android/ui/accessibility/BasicAccessibility/MainActivity.java
rename to ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/java/com/example/android/basicaccessibility/MainActivity.java
index 869301d..2777ad7 100644
--- a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/java/com/example/android/ui/accessibility/BasicAccessibility/MainActivity.java
+++ b/ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/java/com/example/android/basicaccessibility/MainActivity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.example.android.ui.accessibility.BasicAccessibility;
+package com.example.android.basicaccessibility;
import android.app.Activity;
import android.os.Bundle;
@@ -34,6 +34,6 @@
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+ setContentView(R.layout.sample_main);
}
}
diff --git a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/drawable-hdpi/ic_action_discard.png b/ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/res/drawable-hdpi/ic_action_discard.png
similarity index 100%
rename from ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/drawable-hdpi/ic_action_discard.png
rename to ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/res/drawable-hdpi/ic_action_discard.png
Binary files differ
diff --git a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/drawable-hdpi/ic_action_info.png b/ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/res/drawable-hdpi/ic_action_info.png
similarity index 100%
rename from ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/drawable-hdpi/ic_action_info.png
rename to ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/res/drawable-hdpi/ic_action_info.png
Binary files differ
diff --git a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/drawable-hdpi/ic_launcher.png b/ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/res/drawable-hdpi/ic_launcher.png
similarity index 100%
rename from ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/drawable-hdpi/ic_launcher.png
rename to ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/drawable-hdpi/partly_cloudy.png b/ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/res/drawable-hdpi/partly_cloudy.png
similarity index 100%
rename from ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/drawable-hdpi/partly_cloudy.png
rename to ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/res/drawable-hdpi/partly_cloudy.png
Binary files differ
diff --git a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/drawable-mdpi/ic_action_discard.png b/ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/res/drawable-mdpi/ic_action_discard.png
similarity index 100%
rename from ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/drawable-mdpi/ic_action_discard.png
rename to ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/res/drawable-mdpi/ic_action_discard.png
Binary files differ
diff --git a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/drawable-mdpi/ic_action_info.png b/ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/res/drawable-mdpi/ic_action_info.png
similarity index 100%
rename from ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/drawable-mdpi/ic_action_info.png
rename to ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/res/drawable-mdpi/ic_action_info.png
Binary files differ
diff --git a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/drawable-mdpi/ic_launcher.png b/ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/res/drawable-mdpi/ic_launcher.png
similarity index 100%
rename from ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/drawable-mdpi/ic_launcher.png
rename to ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/drawable-xhdpi/ic_action_discard.png b/ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/res/drawable-xhdpi/ic_action_discard.png
similarity index 100%
rename from ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/drawable-xhdpi/ic_action_discard.png
rename to ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/res/drawable-xhdpi/ic_action_discard.png
Binary files differ
diff --git a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/drawable-xhdpi/ic_action_info.png b/ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/res/drawable-xhdpi/ic_action_info.png
similarity index 100%
rename from ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/drawable-xhdpi/ic_action_info.png
rename to ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/res/drawable-xhdpi/ic_action_info.png
Binary files differ
diff --git a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/drawable-xhdpi/ic_launcher.png b/ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/res/drawable-xhdpi/ic_launcher.png
similarity index 100%
rename from ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/drawable-xhdpi/ic_launcher.png
rename to ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/drawable-xxhdpi/ic_launcher.png b/ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/res/drawable-xxhdpi/ic_launcher.png
similarity index 100%
rename from ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/drawable-xxhdpi/ic_launcher.png
rename to ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/layout/activity_main.xml b/ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/res/layout/sample_main.xml
similarity index 98%
rename from ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/layout/activity_main.xml
rename to ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/res/layout/sample_main.xml
index 394c72f..64f4f38 100644
--- a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/layout/activity_main.xml
+++ b/ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/res/layout/sample_main.xml
@@ -192,7 +192,7 @@
<!-- Custom views require additonal code changes. See DialView.java for more
details. -->
- <com.example.android.ui.accessibility.BasicAccessibility.DialView
+ <com.example.android.basicaccessibility.DialView
android:layout_width="200dp"
android:layout_height="200dp"
android:id="@+id/dialView"
diff --git a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/values-sw720dp-land/dimens.xml b/ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/res/values-sw720dp-land/dimens.xml
similarity index 100%
rename from ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/values-sw720dp-land/dimens.xml
rename to ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/res/values-sw720dp-land/dimens.xml
diff --git a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/values/dimens.xml b/ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/res/values/dimens.xml
similarity index 100%
rename from ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/values/dimens.xml
rename to ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/res/values/dimens.xml
diff --git a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/values/strings.xml b/ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/res/values/strings.xml
similarity index 95%
rename from ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/values/strings.xml
rename to ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/res/values/strings.xml
index 57b8e49..8340682 100644
--- a/ui/accessibility/BasicAccessibility/BasicAccessibility/src/main/res/values/strings.xml
+++ b/ui/accessibility/BasicAccessibility/BasicAccessibilitySample/src/main/res/values/strings.xml
@@ -16,8 +16,6 @@
-->
<resources>
-
- <string name="app_name" >Accessibility Sample</string>
<string name="composeButtonPressed">(Compose button pressed.)</string>
<string name="discardButtonPressed">(Discard button pressed.)</string>
<string name="infoButtonPressed">(Info button pressed.)</string>
diff --git a/ui/accessibility/BasicAccessibility/BasicAccessibilitySample/tests/AndroidManifest.xml b/ui/accessibility/BasicAccessibility/BasicAccessibilitySample/tests/AndroidManifest.xml
new file mode 100644
index 0000000..87b785f
--- /dev/null
+++ b/ui/accessibility/BasicAccessibility/BasicAccessibilitySample/tests/AndroidManifest.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<!-- package name must be unique so suffix with "tests" so package loader doesn't ignore us -->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="${sample.package}.tests"
+ android:versionCode="1"
+ android:versionName="1.0">
+
+ <uses-sdk
+ android:minSdkVersion="18"
+ android:targetSdkVersion="19" />
+
+ <!-- We add an application tag here just so that we can indicate that
+ this package needs to link against the android.test library,
+ which is needed when building test cases. -->
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <!--
+ Specifies the instrumentation test runner used to run the tests.
+ -->
+ <instrumentation
+ android:name="android.test.InstrumentationTestRunner"
+ android:targetPackage="${sample.package}"
+ android:label="Tests for ${sample.package}" />
+
+</manifest>
\ No newline at end of file
diff --git a/ui/accessibility/BasicAccessibility/BasicAccessibilitySample/tests/src/com/example/android/basicaccessibility/tests/SampleTests.java b/ui/accessibility/BasicAccessibility/BasicAccessibilitySample/tests/src/com/example/android/basicaccessibility/tests/SampleTests.java
new file mode 100644
index 0000000..0c9a152
--- /dev/null
+++ b/ui/accessibility/BasicAccessibility/BasicAccessibilitySample/tests/src/com/example/android/basicaccessibility/tests/SampleTests.java
@@ -0,0 +1,79 @@
+/*
+* Copyright 2013 The Android Open Source Project
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+
+/*
+* Copyright (C) 2013 The Android Open Source Project
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package com.example.android.basicaccessibility.tests;
+
+import com.example.android.basicaccessibility.*;
+
+import android.test.ActivityInstrumentationTestCase2;
+
+/**
+* Tests for BasicAccessibility sample.
+*/
+public class SampleTests extends ActivityInstrumentationTestCase2<MainActivity> {
+
+ private MainActivity mTestActivity;
+ private BasicAccessibilityFragment mTestFragment;
+
+ public SampleTests() {
+ super(MainActivity.class);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ // Starts the activity under test using the default Intent with:
+ // action = {@link Intent#ACTION_MAIN}
+ // flags = {@link Intent#FLAG_ACTIVITY_NEW_TASK}
+ // All other fields are null or empty.
+ mTestActivity = getActivity();
+ mTestFragment = (BasicAccessibilityFragment)
+ mTestActivity.getSupportFragmentManager().getFragments().get(1);
+ }
+
+ /**
+ * Test if the test fixture has been set up correctly.
+ */
+ public void testPreconditions() {
+ //Try to add a message to add context to your assertions. These messages will be shown if
+ //a tests fails and make it easy to understand why a test failed
+ assertNotNull("mTestActivity is null", mTestActivity);
+ assertNotNull("mTestFragment is null", mTestFragment);
+ }
+
+ /**
+ * Add more tests below.
+ */
+
+}
\ No newline at end of file
diff --git a/ui/accessibility/BasicAccessibility/README.txt b/ui/accessibility/BasicAccessibility/README.txt
deleted file mode 100644
index 38608df..0000000
--- a/ui/accessibility/BasicAccessibility/README.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-Build Instructions
--------------------
-This sample uses the Gradle build system. To build this project, use the
-"gradlew build" command.
-
-To see a list of all available commands, run "gradlew tasks".
\ No newline at end of file
diff --git a/ui/accessibility/BasicAccessibility/build.gradle b/ui/accessibility/BasicAccessibility/build.gradle
index 036abc8..ffb5c2f 100644
--- a/ui/accessibility/BasicAccessibility/build.gradle
+++ b/ui/accessibility/BasicAccessibility/build.gradle
@@ -1,8 +1,11 @@
-buildscript {
- repositories {
- mavenCentral()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:0.5.+'
- }
+
+
+
+
+// BEGIN_EXCLUDE
+apply from: "../../../../../build/build.gradle"
+samplegen {
+ pathToBuild "../../../../../build"
+ pathToSamplesCommon "../../../common"
}
+// END_EXCLUDE
diff --git a/ui/accessibility/BasicAccessibility/buildSrc/build.gradle b/ui/accessibility/BasicAccessibility/buildSrc/build.gradle
new file mode 100644
index 0000000..e344a8c
--- /dev/null
+++ b/ui/accessibility/BasicAccessibility/buildSrc/build.gradle
@@ -0,0 +1,18 @@
+
+
+
+repositories {
+ mavenCentral()
+}
+dependencies {
+ compile 'org.freemarker:freemarker:2.3.20'
+}
+
+sourceSets {
+ main {
+ groovy {
+ srcDir new File(rootDir, "../../../../../../build/buildSrc/src/main/groovy")
+ }
+ }
+}
+
diff --git a/ui/accessibility/BasicAccessibility/gradle/wrapper/gradle-wrapper.properties b/ui/accessibility/BasicAccessibility/gradle/wrapper/gradle-wrapper.properties
index 055ba6f..5c22dec 100644
--- a/ui/accessibility/BasicAccessibility/gradle/wrapper/gradle-wrapper.properties
+++ b/ui/accessibility/BasicAccessibility/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,4 @@
-#
-#Mon Jul 22 11:40:20 PDT 2013
+#Wed Apr 10 15:27:10 PDT 2013
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
diff --git a/ui/accessibility/BasicAccessibility/settings.gradle b/ui/accessibility/BasicAccessibility/settings.gradle
index 1c4fa86..7900b3d 100644
--- a/ui/accessibility/BasicAccessibility/settings.gradle
+++ b/ui/accessibility/BasicAccessibility/settings.gradle
@@ -1 +1,4 @@
-include ':BasicAccessibility'
+
+
+
+include 'BasicAccessibilitySample'
diff --git a/ui/accessibility/BasicAccessibility/template-params.xml b/ui/accessibility/BasicAccessibility/template-params.xml
new file mode 100644
index 0000000..bc87c3b
--- /dev/null
+++ b/ui/accessibility/BasicAccessibility/template-params.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+
+
+<sample>
+ <name>BasicAccessibility</name>
+ <package>com.example.android.basicaccessibility</package>
+
+
+ <!-- change minSdk if needed-->
+ <minSdk>11</minSdk>
+
+ <strings>
+ <intro>
+ <![CDATA[
+ This sample demonstrates how to create an accessible application, using a mix of different widgets demonstrating different ways of adding accessibility markup to a UI.
+ ]]>
+ </intro>
+ </strings>
+
+ <template src="base"/>
+ <common src="logger"/>
+
+</sample>