aboutsummaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorTrevor Johns <trevorjohns@google.com>2013-10-30 21:57:35 +0000
committerTrevor Johns <trevorjohns@google.com>2013-10-30 21:57:35 +0000
commitec985147ec781dfff9a229c6b794ee4eac0ced91 (patch)
treee2a89c3e427d9af663d0399b5aa0f61e7ffa3f7a /connectivity
parentbc6fe0f65025563ab50af193b099a8fca95ff0a2 (diff)
downloadandroid-ec985147ec781dfff9a229c6b794ee4eac0ced91.tar.gz
Revert "Merge downstream branch 'developers-dev' into 'klp-dev'"
Undoing recent merge to get a clean klp-dev samples release without template code. Will un-revert for followup release with templates after that build has been cut. This reverts commit bc6fe0f65025563ab50af193b099a8fca95ff0a2. Change-Id: Icd2b9772986de7c4978a92e7e22bb2c2cef20bd0
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/build.gradle6
-rw-r--r--connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/AndroidManifest.xml (renamed from connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/AndroidManifest.xml)41
-rw-r--r--connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/java/com/example/bluetooth/le/BluetoothLeService.java (renamed from connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/java/com/example/android/bluetoothlegatt/BluetoothLeService.java)2
-rw-r--r--connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/java/com/example/bluetooth/le/DeviceControlActivity.java (renamed from connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/java/com/example/android/bluetoothlegatt/DeviceControlActivity.java)2
-rw-r--r--connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/java/com/example/bluetooth/le/DeviceScanActivity.java (renamed from connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/java/com/example/android/bluetoothlegatt/DeviceScanActivity.java)3
-rw-r--r--connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/java/com/example/bluetooth/le/SampleGattAttributes.java (renamed from connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/java/com/example/android/bluetoothlegatt/SampleGattAttributes.java)2
-rwxr-xr-xconnectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/drawable-hdpi/ic_launcher.png (renamed from connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/drawable-hdpi/ic_launcher.png)bin5170 -> 5170 bytes
-rwxr-xr-xconnectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/drawable-mdpi/ic_launcher.png (renamed from connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/drawable-mdpi/ic_launcher.png)bin3025 -> 3025 bytes
-rwxr-xr-xconnectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/drawable-xhdpi/ic_launcher.png (renamed from connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/drawable-xhdpi/ic_launcher.png)bin7227 -> 7227 bytes
-rwxr-xr-xconnectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/drawable-xxhdpi/ic_launcher.png (renamed from connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/drawable-xxhdpi/ic_launcher.png)bin12800 -> 12800 bytes
-rw-r--r--connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/layout/actionbar_indeterminate_progress.xml (renamed from connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/layout/actionbar_indeterminate_progress.xml)0
-rw-r--r--connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/layout/gatt_services_characteristics.xml (renamed from connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/layout/gatt_services_characteristics.xml)0
-rw-r--r--connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/layout/listitem_device.xml (renamed from connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/layout/listitem_device.xml)0
-rw-r--r--connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/menu/gatt_services.xml (renamed from connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/menu/gatt_services.xml)0
-rw-r--r--connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/menu/main.xml (renamed from connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/menu/main.xml)0
-rw-r--r--connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/values/strings.xml (renamed from connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/values/strings.xml)1
-rw-r--r--connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/.gitignore16
-rw-r--r--connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/proguard-project.txt20
-rw-r--r--connectivity/bluetooth/BluetoothLeGatt/build.gradle16
-rw-r--r--connectivity/bluetooth/BluetoothLeGatt/buildSrc/build.gradle18
-rw-r--r--connectivity/bluetooth/BluetoothLeGatt/gradle/wrapper/gradle-wrapper.properties2
-rw-r--r--connectivity/bluetooth/BluetoothLeGatt/settings.gradle5
-rw-r--r--connectivity/bluetooth/BluetoothLeGatt/template-params.xml36
-rw-r--r--connectivity/network/BasicNetworkDemo/BasicNetworkDemo/build.gradle10
-rwxr-xr-x[-rw-r--r--]connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/AndroidManifest.xml (renamed from connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/AndroidManifest.xml)4
-rw-r--r--connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/SimpleTextFragment.java (renamed from connectivity/network/NetworkConnect/NetworkConnectSample/src/main/java/com/example/android/networkconnect/SimpleTextFragment.java)3
-rw-r--r--connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/logger/Log.java236
-rw-r--r--connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/logger/LogNode.java39
-rw-r--r--connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/logger/LogView.java133
-rw-r--r--connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/logger/LogWrapper.java75
-rw-r--r--connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/logger/MessageOnlyLogFilter.java60
-rw-r--r--connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/networkbasic/LogFragment.java60
-rwxr-xr-xconnectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/networkbasic/MainActivity.java (renamed from connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/java/com/example/android/basicnetworking/MainActivity.java)6
-rwxr-xr-xconnectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/drawable-hdpi/ic_launcher.png (renamed from connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/drawable-hdpi/ic_launcher.png)bin4407 -> 4407 bytes
-rwxr-xr-xconnectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/drawable-mdpi/ic_launcher.png (renamed from connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/drawable-mdpi/ic_launcher.png)bin2668 -> 2668 bytes
-rwxr-xr-xconnectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/drawable-xhdpi/ic_launcher.png (renamed from connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/drawable-xhdpi/ic_launcher.png)bin6230 -> 6230 bytes
-rwxr-xr-xconnectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/drawable-xxhdpi/ic_launcher.png (renamed from connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/drawable-xxhdpi/ic_launcher.png)bin11294 -> 11294 bytes
-rwxr-xr-xconnectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/layout/activity_main.xml (renamed from connectivity/network/NetworkConnect/NetworkConnectSample/src/main/res/layout/sample_main.xml)4
-rw-r--r--connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/layout/log_fragment.xml33
-rw-r--r--connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/menu/main.xml (renamed from connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/menu/main.xml)0
-rw-r--r--connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/values-sw600dp/styles.xml28
-rw-r--r--connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/values-v11/styles.xml19
-rw-r--r--connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/values/dimens.xml24
-rwxr-xr-xconnectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/values/strings.xml (renamed from connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/values/strings.xml)6
-rw-r--r--connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/values/styles.xml (renamed from connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/values/styles.xml)8
-rw-r--r--connectivity/network/BasicNetworkDemo/README.txt6
-rw-r--r--connectivity/network/BasicNetworkDemo/build.gradle8
-rw-r--r--connectivity/network/BasicNetworkDemo/gradle/wrapper/gradle-wrapper.jar (renamed from connectivity/network/BasicNetworking/gradle/wrapper/gradle-wrapper.jar)bin49896 -> 49896 bytes
-rw-r--r--connectivity/network/BasicNetworkDemo/gradle/wrapper/gradle-wrapper.properties (renamed from connectivity/network/BasicNetworking/gradle/wrapper/gradle-wrapper.properties)5
-rwxr-xr-xconnectivity/network/BasicNetworkDemo/gradlew (renamed from connectivity/network/BasicNetworking/gradlew)0
-rw-r--r--connectivity/network/BasicNetworkDemo/gradlew.bat (renamed from connectivity/network/BasicNetworking/gradlew.bat)0
-rw-r--r--connectivity/network/BasicNetworkDemo/settings.gradle1
-rw-r--r--connectivity/network/BasicNetworking/BasicNetworkingSample/.gitignore16
-rw-r--r--connectivity/network/BasicNetworking/BasicNetworkingSample/proguard-project.txt20
-rw-r--r--connectivity/network/BasicNetworking/BasicNetworkingSample/tests/AndroidManifest.xml42
-rw-r--r--connectivity/network/BasicNetworking/BasicNetworkingSample/tests/src/com/example/android/basicnetworking/tests/SampleTests.java79
-rw-r--r--connectivity/network/BasicNetworking/build.gradle10
-rw-r--r--connectivity/network/BasicNetworking/buildSrc/build.gradle18
-rw-r--r--connectivity/network/BasicNetworking/settings.gradle4
-rw-r--r--connectivity/network/BasicNetworking/template-params.xml39
-rw-r--r--connectivity/network/NetworkConnect/NetworkConnect/build.gradle10
-rwxr-xr-x[-rw-r--r--]connectivity/network/NetworkConnect/NetworkConnect/src/main/AndroidManifest.xml (renamed from connectivity/network/NetworkConnect/NetworkConnectSample/src/main/AndroidManifest.xml)25
-rw-r--r--connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/SimpleTextFragment.java (renamed from connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/java/com/example/android/basicnetworking/SimpleTextFragment.java)2
-rw-r--r--connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/logger/Log.java236
-rw-r--r--connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/logger/LogNode.java39
-rw-r--r--connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/logger/LogView.java133
-rw-r--r--connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/logger/LogWrapper.java75
-rw-r--r--connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/logger/MessageOnlyLogFilter.java60
-rw-r--r--connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/networkconnect/LogFragment.java60
-rwxr-xr-xconnectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/networkconnect/MainActivity.java (renamed from connectivity/network/NetworkConnect/NetworkConnectSample/src/main/java/com/example/android/networkconnect/MainActivity.java)12
-rwxr-xr-xconnectivity/network/NetworkConnect/NetworkConnect/src/main/res/drawable-hdpi/ic_launcher.png (renamed from connectivity/network/NetworkConnect/NetworkConnectSample/src/main/res/drawable-hdpi/ic_launcher.png)bin4407 -> 4407 bytes
-rwxr-xr-xconnectivity/network/NetworkConnect/NetworkConnect/src/main/res/drawable-mdpi/ic_launcher.png (renamed from connectivity/network/NetworkConnect/NetworkConnectSample/src/main/res/drawable-mdpi/ic_launcher.png)bin2668 -> 2668 bytes
-rwxr-xr-xconnectivity/network/NetworkConnect/NetworkConnect/src/main/res/drawable-xhdpi/ic_launcher.png (renamed from connectivity/network/NetworkConnect/NetworkConnectSample/src/main/res/drawable-xhdpi/ic_launcher.png)bin6230 -> 6230 bytes
-rwxr-xr-xconnectivity/network/NetworkConnect/NetworkConnect/src/main/res/drawable-xxhdpi/ic_launcher.png (renamed from connectivity/network/NetworkConnect/NetworkConnectSample/src/main/res/drawable-xxhdpi/ic_launcher.png)bin11294 -> 11294 bytes
-rwxr-xr-xconnectivity/network/NetworkConnect/NetworkConnect/src/main/res/layout/activity_main.xml (renamed from connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/layout/sample_main.xml)4
-rw-r--r--connectivity/network/NetworkConnect/NetworkConnect/src/main/res/layout/log_fragment.xml33
-rw-r--r--connectivity/network/NetworkConnect/NetworkConnect/src/main/res/menu/main.xml (renamed from connectivity/network/NetworkConnect/NetworkConnectSample/src/main/res/menu/main.xml)0
-rw-r--r--connectivity/network/NetworkConnect/NetworkConnect/src/main/res/values-sw600dp/styles.xml28
-rw-r--r--connectivity/network/NetworkConnect/NetworkConnect/src/main/res/values-v11/styles.xml19
-rw-r--r--connectivity/network/NetworkConnect/NetworkConnect/src/main/res/values/dimens.xml24
-rwxr-xr-xconnectivity/network/NetworkConnect/NetworkConnect/src/main/res/values/strings.xml (renamed from connectivity/network/NetworkConnect/NetworkConnectSample/src/main/res/values/strings.xml)4
-rw-r--r--connectivity/network/NetworkConnect/NetworkConnect/src/main/res/values/styles.xml40
-rw-r--r--connectivity/network/NetworkConnect/NetworkConnectSample/.gitignore16
-rw-r--r--connectivity/network/NetworkConnect/NetworkConnectSample/tests/AndroidManifest.xml42
-rw-r--r--connectivity/network/NetworkConnect/NetworkConnectSample/tests/src/com/example/android/networkconnect/tests/SampleTests.java79
-rw-r--r--connectivity/network/NetworkConnect/README.txt6
-rw-r--r--connectivity/network/NetworkConnect/build.gradle16
-rw-r--r--connectivity/network/NetworkConnect/buildSrc/build.gradle18
-rw-r--r--connectivity/network/NetworkConnect/gradle/wrapper/gradle-wrapper.properties5
-rw-r--r--connectivity/network/NetworkConnect/settings.gradle5
-rw-r--r--connectivity/network/NetworkConnect/template-params.xml40
-rw-r--r--connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/build.gradle15
-rw-r--r--connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/AndroidManifest.xml (renamed from connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/AndroidManifest.xml)42
-rw-r--r--connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/EntryListActivity.java (renamed from connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/EntryListActivity.java)2
-rw-r--r--connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/EntryListFragment.java (renamed from connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/EntryListFragment.java)8
-rw-r--r--connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/SyncAdapter.java (renamed from connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/SyncAdapter.java)13
-rw-r--r--connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/SyncService.java (renamed from connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/SyncService.java)2
-rw-r--r--connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/SyncUtils.java (renamed from connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/SyncUtils.java)20
-rw-r--r--connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/net/FeedParser.java (renamed from connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/net/FeedParser.java)18
-rw-r--r--connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/provider/FeedContract.java (renamed from connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/provider/FeedContract.java)8
-rw-r--r--connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/provider/FeedProvider.java (renamed from connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/provider/FeedProvider.java)2
-rw-r--r--connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/drawable-hdpi/ic_launcher.png (renamed from connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/drawable-hdpi/ic_launcher.png)bin5473 -> 5473 bytes
-rw-r--r--connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/drawable-mdpi/ic_launcher.png (renamed from connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/drawable-mdpi/ic_launcher.png)bin3298 -> 3298 bytes
-rw-r--r--connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/drawable-xhdpi/ic_action_refresh.png (renamed from connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/drawable-xhdpi/ic_action_refresh.png)bin856 -> 856 bytes
-rw-r--r--connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/drawable-xhdpi/ic_launcher.png (renamed from connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/drawable-xhdpi/ic_launcher.png)bin7401 -> 7401 bytes
-rw-r--r--connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/drawable-xxhdpi/ic_launcher.png (renamed from connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/drawable-xxhdpi/ic_launcher.png)bin12074 -> 12074 bytes
-rw-r--r--connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/layout/actionbar_indeterminate_progress.xml (renamed from connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/layout/actionbar_indeterminate_progress.xml)0
-rw-r--r--connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/layout/activity_entry_list.xml (renamed from connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/layout/activity_entry_list.xml)2
-rw-r--r--connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/menu/main.xml (renamed from connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/menu/main.xml)0
-rw-r--r--connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values-v11/styles.xml28
-rw-r--r--connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values-v14/styles.xml29
-rw-r--r--connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values/attrs.xml (renamed from connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/values/attrs.xml)0
-rw-r--r--connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values/dimen.xml (renamed from connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/values/dimen.xml)0
-rw-r--r--connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values/strings.xml (renamed from connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/values/strings.xml)1
-rw-r--r--connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values/styles.xml37
-rw-r--r--connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/xml/authenticator.xml (renamed from connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/xml/authenticator.xml)2
-rw-r--r--connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/xml/syncadapter.xml (renamed from connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/xml/syncadapter.xml)4
-rw-r--r--connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/.gitignore16
-rw-r--r--connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/proguard-project.txt20
-rw-r--r--connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/tests/AndroidManifest.xml42
-rw-r--r--connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/tests/src/com/example/android/basicsyncadapter/tests/SampleTests.java79
-rw-r--r--connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/AndroidManifest.xml26
-rw-r--r--connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/proguard-project.txt (renamed from connectivity/network/NetworkConnect/NetworkConnectSample/proguard-project.txt)2
-rw-r--r--connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/src/com/example/android/network/sync/basicsyncadapter/SyncAdapterTest.java73
-rw-r--r--connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/src/com/example/android/network/sync/basicsyncadapter/net/FeedParserTest.java21
-rw-r--r--connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/src/com/example/android/network/sync/basicsyncadapter/provider/FeedProviderTest.java119
-rw-r--r--connectivity/sync/BasicSyncAdapter/README.txt6
-rw-r--r--connectivity/sync/BasicSyncAdapter/build.gradle11
-rw-r--r--connectivity/sync/BasicSyncAdapter/buildSrc/build.gradle18
-rw-r--r--connectivity/sync/BasicSyncAdapter/gradle/wrapper/gradle-wrapper.properties3
-rw-r--r--connectivity/sync/BasicSyncAdapter/settings.gradle5
-rw-r--r--connectivity/sync/BasicSyncAdapter/template-params.xml43
132 files changed, 2002 insertions, 912 deletions
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/build.gradle b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/build.gradle
new file mode 100644
index 00000000..945e1f51
--- /dev/null
+++ b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/build.gradle
@@ -0,0 +1,6 @@
+apply plugin: 'android'
+
+android {
+ compileSdkVersion 18
+ buildToolsVersion "18.0.0"
+}
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/AndroidManifest.xml b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/AndroidManifest.xml
index babd6df2..019d2587 100644
--- a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/AndroidManifest.xml
+++ b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/AndroidManifest.xml
@@ -1,29 +1,25 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<!--
- Copyright 2013 The Android Open Source Project
+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
+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,
- 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.
+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.bluetoothlegatt"
- android:versionCode="1"
- android:versionName="1.0">
-
+ package="com.example.bluetooth.le"
+ android:versionCode="1"
+ android:versionName="1.0">
<uses-sdk android:minSdkVersion="18"
- android:targetSdkVersion="18"/>
+ android:targetSdkVersion="18"/>
<!-- Declare this required feature if you want to make the app available to BLE-capable
devices only. If you want to make your app available to devices that don't support BLE,
you should omit this in the manifest. Instead, determine BLE capability by using
@@ -34,10 +30,10 @@
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<application android:label="@string/app_name"
- android:icon="@drawable/ic_launcher"
- android:theme="@android:style/Theme.Holo.Light">
+ android:icon="@drawable/ic_launcher"
+ android:theme="@android:style/Theme.Holo.Light">
<activity android:name=".DeviceScanActivity"
- android:label="@string/app_name">
+ android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
@@ -46,5 +42,4 @@
<activity android:name=".DeviceControlActivity"/>
<service android:name=".BluetoothLeService" android:enabled="true"/>
</application>
-
</manifest>
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/java/com/example/android/bluetoothlegatt/BluetoothLeService.java b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/java/com/example/bluetooth/le/BluetoothLeService.java
index 694faaf9..9e7aabd8 100644
--- a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/java/com/example/android/bluetoothlegatt/BluetoothLeService.java
+++ b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/java/com/example/bluetooth/le/BluetoothLeService.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.example.android.bluetoothlegatt;
+package com.example.bluetooth.le;
import android.app.Service;
import android.bluetooth.BluetoothAdapter;
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/java/com/example/android/bluetoothlegatt/DeviceControlActivity.java b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/java/com/example/bluetooth/le/DeviceControlActivity.java
index dc2f90bd..06b3bb46 100644
--- a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/java/com/example/android/bluetoothlegatt/DeviceControlActivity.java
+++ b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/java/com/example/bluetooth/le/DeviceControlActivity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.example.android.bluetoothlegatt;
+package com.example.bluetooth.le;
import android.app.Activity;
import android.bluetooth.BluetoothGattCharacteristic;
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/java/com/example/android/bluetoothlegatt/DeviceScanActivity.java b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/java/com/example/bluetooth/le/DeviceScanActivity.java
index 9b86f7ab..1cc954df 100644
--- a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/java/com/example/android/bluetoothlegatt/DeviceScanActivity.java
+++ b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/java/com/example/bluetooth/le/DeviceScanActivity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.example.android.bluetoothlegatt;
+package com.example.bluetooth.le;
import android.app.Activity;
import android.app.ListActivity;
@@ -37,6 +37,7 @@ import android.widget.TextView;
import android.widget.Toast;
import java.util.ArrayList;
+import java.util.UUID;
/**
* Activity for scanning and displaying available Bluetooth LE devices.
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/java/com/example/android/bluetoothlegatt/SampleGattAttributes.java b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/java/com/example/bluetooth/le/SampleGattAttributes.java
index e8db74cd..255653eb 100644
--- a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/java/com/example/android/bluetoothlegatt/SampleGattAttributes.java
+++ b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/java/com/example/bluetooth/le/SampleGattAttributes.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.example.android.bluetoothlegatt;
+package com.example.bluetooth.le;
import java.util.HashMap;
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/drawable-hdpi/ic_launcher.png b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/drawable-hdpi/ic_launcher.png
index 15367c05..15367c05 100755
--- a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/drawable-hdpi/ic_launcher.png
+++ b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/drawable-mdpi/ic_launcher.png b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/drawable-mdpi/ic_launcher.png
index ba810a76..ba810a76 100755
--- a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/drawable-mdpi/ic_launcher.png
+++ b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/drawable-xhdpi/ic_launcher.png b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/drawable-xhdpi/ic_launcher.png
index 14f1d746..14f1d746 100755
--- a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/drawable-xhdpi/ic_launcher.png
+++ b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/drawable-xxhdpi/ic_launcher.png b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/drawable-xxhdpi/ic_launcher.png
index 81ff9cc8..81ff9cc8 100755
--- a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/drawable-xxhdpi/ic_launcher.png
+++ b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/layout/actionbar_indeterminate_progress.xml b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/layout/actionbar_indeterminate_progress.xml
index a950833f..a950833f 100644
--- a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/layout/actionbar_indeterminate_progress.xml
+++ b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/layout/actionbar_indeterminate_progress.xml
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/layout/gatt_services_characteristics.xml b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/layout/gatt_services_characteristics.xml
index 2f310610..2f310610 100644
--- a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/layout/gatt_services_characteristics.xml
+++ b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/layout/gatt_services_characteristics.xml
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/layout/listitem_device.xml b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/layout/listitem_device.xml
index eff44fcd..eff44fcd 100644
--- a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/layout/listitem_device.xml
+++ b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/layout/listitem_device.xml
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/menu/gatt_services.xml b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/menu/gatt_services.xml
index 464d32ff..464d32ff 100644
--- a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/menu/gatt_services.xml
+++ b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/menu/gatt_services.xml
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/menu/main.xml b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/menu/main.xml
index 39dd66aa..39dd66aa 100644
--- a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/menu/main.xml
+++ b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/menu/main.xml
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/values/strings.xml b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/values/strings.xml
index 19f3dce9..d828aa01 100644
--- a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/values/strings.xml
+++ b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/values/strings.xml
@@ -14,6 +14,7 @@
limitations under the License.
-->
<resources>
+ <string name="app_name">BLE Sample</string>
<string name="ble_not_supported">BLE is not supported</string>
<string name="label_data">Data:</string>
<string name="label_device_address">Device address:</string>
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/.gitignore b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/.gitignore
deleted file mode 100644
index 6eb878d4..00000000
--- a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/.gitignore
+++ /dev/null
@@ -1,16 +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.
-src/template/
-src/common/
-build.gradle
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/proguard-project.txt b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/proguard-project.txt
deleted file mode 100644
index 0d8f171d..00000000
--- a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/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/connectivity/bluetooth/BluetoothLeGatt/build.gradle b/connectivity/bluetooth/BluetoothLeGatt/build.gradle
index cca9ac33..036abc8d 100644
--- a/connectivity/bluetooth/BluetoothLeGatt/build.gradle
+++ b/connectivity/bluetooth/BluetoothLeGatt/build.gradle
@@ -1,10 +1,8 @@
-// BEGIN_EXCLUDE
-import com.example.android.samples.build.SampleGenPlugin
-apply plugin: SampleGenPlugin
-
-samplegen {
- pathToBuild "../../../../../build"
- pathToSamplesCommon "../../../common"
+buildscript {
+ repositories {
+ mavenCentral()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:0.5.+'
+ }
}
-apply from: "../../../../../build/build.gradle"
-// END_EXCLUDE
diff --git a/connectivity/bluetooth/BluetoothLeGatt/buildSrc/build.gradle b/connectivity/bluetooth/BluetoothLeGatt/buildSrc/build.gradle
deleted file mode 100644
index e344a8cb..00000000
--- a/connectivity/bluetooth/BluetoothLeGatt/buildSrc/build.gradle
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-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/bluetooth/BluetoothLeGatt/gradle/wrapper/gradle-wrapper.properties b/connectivity/bluetooth/BluetoothLeGatt/gradle/wrapper/gradle-wrapper.properties
index 861eddc3..5c22dec0 100644
--- a/connectivity/bluetooth/BluetoothLeGatt/gradle/wrapper/gradle-wrapper.properties
+++ b/connectivity/bluetooth/BluetoothLeGatt/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.8-bin.zip
+distributionUrl=http\://services.gradle.org/distributions/gradle-1.6-bin.zip
diff --git a/connectivity/bluetooth/BluetoothLeGatt/settings.gradle b/connectivity/bluetooth/BluetoothLeGatt/settings.gradle
index 05cae43f..639c5c89 100644
--- a/connectivity/bluetooth/BluetoothLeGatt/settings.gradle
+++ b/connectivity/bluetooth/BluetoothLeGatt/settings.gradle
@@ -1,4 +1 @@
-
-
-
-include 'BluetoothLeGattSample'
+include ':BluetoothLeGatt'
diff --git a/connectivity/bluetooth/BluetoothLeGatt/template-params.xml b/connectivity/bluetooth/BluetoothLeGatt/template-params.xml
deleted file mode 100644
index 323e1d72..00000000
--- a/connectivity/bluetooth/BluetoothLeGatt/template-params.xml
+++ /dev/null
@@ -1,36 +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.
--->
-<sample>
- <name>BluetoothLeGatt</name>
- <group>Connectivity</group>
- <package>com.example.android.bluetoothlegatt</package>
-
- <!-- change minSdk if needed-->
- <minSdk>18</minSdk>
-
- <strings>
- <intro>
- <![CDATA[
- This sample demonstrates how to use the Bluetooth LE Generic Attribute Profile (GATT)
- to transmit arbitrary data between devices.
- ]]>
- </intro>
- </strings>
-
- <template src="base"/>
-
-</sample>
diff --git a/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/build.gradle b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/build.gradle
new file mode 100644
index 00000000..0baece96
--- /dev/null
+++ b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/build.gradle
@@ -0,0 +1,10 @@
+apply plugin: 'android'
+
+dependencies {
+ compile "com.android.support:support-v4:18.0.+"
+}
+
+android {
+ compileSdkVersion 18
+ buildToolsVersion "18.0.0"
+}
diff --git a/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/AndroidManifest.xml b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/AndroidManifest.xml
index 48bfeac4..c0d3e647 100644..100755
--- a/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/AndroidManifest.xml
+++ b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/AndroidManifest.xml
@@ -16,7 +16,7 @@
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.basicnetworking"
+ package="com.example.android.networkbasic"
android:versionCode="1"
android:versionName="1.0">
@@ -31,7 +31,7 @@
android:allowBackup="true">
<activity
- android:name="com.example.android.basicnetworking.MainActivity"
+ android:name="com.example.android.networkbasic.MainActivity"
android:label="@string/app_name"
android:uiOptions="splitActionBarWhenNarrow">
diff --git a/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/java/com/example/android/networkconnect/SimpleTextFragment.java b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/SimpleTextFragment.java
index 32029376..a2be93fb 100644
--- a/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/java/com/example/android/networkconnect/SimpleTextFragment.java
+++ b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/SimpleTextFragment.java
@@ -14,9 +14,10 @@
* limitations under the License.
*/
-package com.example.android.networkconnect;
+package com.example.android.common;
import android.os.Bundle;
+
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.Gravity;
diff --git a/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/logger/Log.java b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/logger/Log.java
new file mode 100644
index 00000000..cf4abb79
--- /dev/null
+++ b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/logger/Log.java
@@ -0,0 +1,236 @@
+/*
+ * 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);
+ }
+} \ No newline at end of file
diff --git a/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/logger/LogNode.java b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/logger/LogNode.java
new file mode 100644
index 00000000..bc37cabc
--- /dev/null
+++ b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/logger/LogNode.java
@@ -0,0 +1,39 @@
+/*
+ * 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/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/logger/LogView.java b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/logger/LogView.java
new file mode 100644
index 00000000..953b8b1e
--- /dev/null
+++ b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/logger/LogView.java
@@ -0,0 +1,133 @@
+/*
+ * 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.util.*;
+import android.widget.TextView;
+
+/** Simple TextView which is used to output log data received through the LogNode interface.
+*/
+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 usable 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 separator, 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 addStr The String to append
+ * @param delimiter The String to separate the source and appended 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("\n" + s);
+ }
+}
diff --git a/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/logger/LogWrapper.java b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/logger/LogWrapper.java
new file mode 100644
index 00000000..ea8e20ef
--- /dev/null
+++ b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/logger/LogWrapper.java
@@ -0,0 +1,75 @@
+/*
+ * 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);
+ }
+ }
+} \ No newline at end of file
diff --git a/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/logger/MessageOnlyLogFilter.java b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/logger/MessageOnlyLogFilter.java
new file mode 100644
index 00000000..c57a1112
--- /dev/null
+++ b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/logger/MessageOnlyLogFilter.java
@@ -0,0 +1,60 @@
+/*
+ * 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;
+ }
+
+} \ No newline at end of file
diff --git a/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/networkbasic/LogFragment.java b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/networkbasic/LogFragment.java
new file mode 100644
index 00000000..ecbe2ebf
--- /dev/null
+++ b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/networkbasic/LogFragment.java
@@ -0,0 +1,60 @@
+package com.example.android.networkbasic;
+
+import android.support.v4.app.Fragment;
+
+import com.example.android.networkbasic.R;
+import com.example.android.common.logger.LogView;
+
+import android.os.Bundle;
+
+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 fragment that contains a LogView and uses it 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;
+ }
+
+}
diff --git a/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/java/com/example/android/basicnetworking/MainActivity.java b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/networkbasic/MainActivity.java
index 39ed4b1b..c2a43056 100755
--- a/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/java/com/example/android/basicnetworking/MainActivity.java
+++ b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/networkbasic/MainActivity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.example.android.basicnetworking;
+package com.example.android.networkbasic;
import android.content.Context;
import android.net.ConnectivityManager;
@@ -25,8 +25,8 @@ import android.util.TypedValue;
import android.view.Menu;
import android.view.MenuItem;
+import com.example.android.common.SimpleTextFragment;
import com.example.android.common.logger.Log;
-import com.example.android.common.logger.LogFragment;
import com.example.android.common.logger.LogWrapper;
import com.example.android.common.logger.MessageOnlyLogFilter;
@@ -53,7 +53,7 @@ public class MainActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.sample_main);
+ setContentView(R.layout.activity_main);
// Initialize text fragment that displays intro text.
SimpleTextFragment introFragment = (SimpleTextFragment)
diff --git a/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/drawable-hdpi/ic_launcher.png b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/drawable-hdpi/ic_launcher.png
index 22ce6061..22ce6061 100755
--- a/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/drawable-hdpi/ic_launcher.png
+++ b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/drawable-mdpi/ic_launcher.png b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/drawable-mdpi/ic_launcher.png
index f21e17b6..f21e17b6 100755
--- a/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/drawable-mdpi/ic_launcher.png
+++ b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/drawable-xhdpi/ic_launcher.png b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/drawable-xhdpi/ic_launcher.png
index 64b80590..64b80590 100755
--- a/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/drawable-xhdpi/ic_launcher.png
+++ b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/drawable-xxhdpi/ic_launcher.png b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/drawable-xxhdpi/ic_launcher.png
index 6b4434a8..6b4434a8 100755
--- a/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/drawable-xxhdpi/ic_launcher.png
+++ b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/res/layout/sample_main.xml b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/layout/activity_main.xml
index 76fa7d78..d9be6863 100755
--- a/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/res/layout/sample_main.xml
+++ b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/layout/activity_main.xml
@@ -22,7 +22,7 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<fragment
- android:name="com.example.android.networkconnect.SimpleTextFragment"
+ android:name="com.example.android.common.SimpleTextFragment"
android:id="@+id/intro_fragment"
android:layout_weight="1"
android:layout_width="match_parent"
@@ -32,7 +32,7 @@
android:layout_height="1dp"
android:background="@android:color/darker_gray"/>
<fragment
- android:name="com.example.android.common.logger.LogFragment"
+ android:name="com.example.android.networkbasic.LogFragment"
android:id="@+id/log_fragment"
android:layout_weight="1"
android:layout_width="match_parent"
diff --git a/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/layout/log_fragment.xml b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/layout/log_fragment.xml
new file mode 100644
index 00000000..6d795484
--- /dev/null
+++ b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/layout/log_fragment.xml
@@ -0,0 +1,33 @@
+<?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/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/menu/main.xml b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/menu/main.xml
index f05f16a5..f05f16a5 100644
--- a/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/menu/main.xml
+++ b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/menu/main.xml
diff --git a/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/values-sw600dp/styles.xml b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/values-sw600dp/styles.xml
new file mode 100644
index 00000000..ffcbe8ac
--- /dev/null
+++ b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/values-sw600dp/styles.xml
@@ -0,0 +1,28 @@
+<!--
+ 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/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/values-v11/styles.xml b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/values-v11/styles.xml
new file mode 100644
index 00000000..c6c648b4
--- /dev/null
+++ b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/values-v11/styles.xml
@@ -0,0 +1,19 @@
+<!--
+ 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/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/values/dimens.xml b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/values/dimens.xml
new file mode 100644
index 00000000..4f69897d
--- /dev/null
+++ b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/values/dimens.xml
@@ -0,0 +1,24 @@
+<!--
+ 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/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/values/strings.xml b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/values/strings.xml
index d39460a4..d8116aa1 100755
--- a/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/values/strings.xml
+++ b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/values/strings.xml
@@ -15,6 +15,12 @@
-->
<resources>
+ <string name="app_name">Basic Network Demo</string>
+
+ <string name="intro_message">Welcome to Basic Network Demo!
+ Click TEST to find out whether your device has a network connection, and if so, what type it is.
+ </string>
+
<string name="test_text">Test</string>
<string name="clear_text">Clear</string>
<string name="wifi_connection">The active connection is wifi.</string>
diff --git a/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/values/styles.xml b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/values/styles.xml
index 3450a54b..4d9bb984 100644
--- a/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/values/styles.xml
+++ b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/values/styles.xml
@@ -16,8 +16,16 @@
<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>
diff --git a/connectivity/network/BasicNetworkDemo/README.txt b/connectivity/network/BasicNetworkDemo/README.txt
new file mode 100644
index 00000000..38608dfc
--- /dev/null
+++ b/connectivity/network/BasicNetworkDemo/README.txt
@@ -0,0 +1,6 @@
+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/network/BasicNetworkDemo/build.gradle b/connectivity/network/BasicNetworkDemo/build.gradle
new file mode 100644
index 00000000..036abc8d
--- /dev/null
+++ b/connectivity/network/BasicNetworkDemo/build.gradle
@@ -0,0 +1,8 @@
+buildscript {
+ repositories {
+ mavenCentral()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:0.5.+'
+ }
+}
diff --git a/connectivity/network/BasicNetworking/gradle/wrapper/gradle-wrapper.jar b/connectivity/network/BasicNetworkDemo/gradle/wrapper/gradle-wrapper.jar
index 8c0fb64a..8c0fb64a 100644
--- a/connectivity/network/BasicNetworking/gradle/wrapper/gradle-wrapper.jar
+++ b/connectivity/network/BasicNetworkDemo/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/connectivity/network/BasicNetworking/gradle/wrapper/gradle-wrapper.properties b/connectivity/network/BasicNetworkDemo/gradle/wrapper/gradle-wrapper.properties
index 861eddc3..055ba6fa 100644
--- a/connectivity/network/BasicNetworking/gradle/wrapper/gradle-wrapper.properties
+++ b/connectivity/network/BasicNetworkDemo/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,7 @@
-#Wed Apr 10 15:27:10 PDT 2013
+#
+#Mon Jul 22 11:40:20 PDT 2013
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.8-bin.zip
+distributionUrl=http\://services.gradle.org/distributions/gradle-1.6-bin.zip
diff --git a/connectivity/network/BasicNetworking/gradlew b/connectivity/network/BasicNetworkDemo/gradlew
index 91a7e269..91a7e269 100755
--- a/connectivity/network/BasicNetworking/gradlew
+++ b/connectivity/network/BasicNetworkDemo/gradlew
diff --git a/connectivity/network/BasicNetworking/gradlew.bat b/connectivity/network/BasicNetworkDemo/gradlew.bat
index aec99730..aec99730 100644
--- a/connectivity/network/BasicNetworking/gradlew.bat
+++ b/connectivity/network/BasicNetworkDemo/gradlew.bat
diff --git a/connectivity/network/BasicNetworkDemo/settings.gradle b/connectivity/network/BasicNetworkDemo/settings.gradle
new file mode 100644
index 00000000..49816546
--- /dev/null
+++ b/connectivity/network/BasicNetworkDemo/settings.gradle
@@ -0,0 +1 @@
+include ':BasicNetworkDemo'
diff --git a/connectivity/network/BasicNetworking/BasicNetworkingSample/.gitignore b/connectivity/network/BasicNetworking/BasicNetworkingSample/.gitignore
deleted file mode 100644
index 6eb878d4..00000000
--- a/connectivity/network/BasicNetworking/BasicNetworkingSample/.gitignore
+++ /dev/null
@@ -1,16 +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.
-src/template/
-src/common/
-build.gradle
diff --git a/connectivity/network/BasicNetworking/BasicNetworkingSample/proguard-project.txt b/connectivity/network/BasicNetworking/BasicNetworkingSample/proguard-project.txt
deleted file mode 100644
index 0d8f171d..00000000
--- a/connectivity/network/BasicNetworking/BasicNetworkingSample/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/connectivity/network/BasicNetworking/BasicNetworkingSample/tests/AndroidManifest.xml b/connectivity/network/BasicNetworking/BasicNetworkingSample/tests/AndroidManifest.xml
deleted file mode 100644
index 293c16bd..00000000
--- a/connectivity/network/BasicNetworking/BasicNetworkingSample/tests/AndroidManifest.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?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="com.example.android.basicnetworking.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="com.example.android.basicnetworking"
- android:label="Tests for com.example.android.basicnetworking" />
-
-</manifest> \ No newline at end of file
diff --git a/connectivity/network/BasicNetworking/BasicNetworkingSample/tests/src/com/example/android/basicnetworking/tests/SampleTests.java b/connectivity/network/BasicNetworking/BasicNetworkingSample/tests/src/com/example/android/basicnetworking/tests/SampleTests.java
deleted file mode 100644
index 0cf077ed..00000000
--- a/connectivity/network/BasicNetworking/BasicNetworkingSample/tests/src/com/example/android/basicnetworking/tests/SampleTests.java
+++ /dev/null
@@ -1,79 +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.
-*/
-
-
-
-/*
-* 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.basicnetworking.tests;
-
-import com.example.android.basicnetworking.*;
-
-import android.test.ActivityInstrumentationTestCase2;
-
-/**
-* Tests for BasicNetworking sample.
-*/
-public class SampleTests extends ActivityInstrumentationTestCase2<MainActivity> {
-
- private MainActivity mTestActivity;
- private BasicNetworkingFragment 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 = (BasicNetworkingFragment)
- 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/network/BasicNetworking/build.gradle b/connectivity/network/BasicNetworking/build.gradle
deleted file mode 100644
index cca9ac33..00000000
--- a/connectivity/network/BasicNetworking/build.gradle
+++ /dev/null
@@ -1,10 +0,0 @@
-// BEGIN_EXCLUDE
-import com.example.android.samples.build.SampleGenPlugin
-apply plugin: SampleGenPlugin
-
-samplegen {
- pathToBuild "../../../../../build"
- pathToSamplesCommon "../../../common"
-}
-apply from: "../../../../../build/build.gradle"
-// END_EXCLUDE
diff --git a/connectivity/network/BasicNetworking/buildSrc/build.gradle b/connectivity/network/BasicNetworking/buildSrc/build.gradle
deleted file mode 100644
index e344a8cb..00000000
--- a/connectivity/network/BasicNetworking/buildSrc/build.gradle
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-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/network/BasicNetworking/settings.gradle b/connectivity/network/BasicNetworking/settings.gradle
deleted file mode 100644
index 453e7cd7..00000000
--- a/connectivity/network/BasicNetworking/settings.gradle
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-include 'BasicNetworkingSample'
diff --git a/connectivity/network/BasicNetworking/template-params.xml b/connectivity/network/BasicNetworking/template-params.xml
deleted file mode 100644
index 34137401..00000000
--- a/connectivity/network/BasicNetworking/template-params.xml
+++ /dev/null
@@ -1,39 +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.
--->
-<sample>
- <name>BasicNetworking</name>
- <group>Connectivity</group>
- <package>com.example.android.basicnetworking</package>
-
- <!-- change minSdk if needed-->
- <minSdk>4</minSdk>
-
- <strings>
- <intro>
- <![CDATA[
- This sample demonstrates how to use the ConnectivityManager to determine if you have
- a network connection, and if so, what type of connection it is.
- \n\nA "NetworkInfo" object is retrieved from the ConnectivityManager, which contains information
- on the active connection, and then the connection type is printed to an on-screen console.
- ]]>
- </intro>
- </strings>
-
- <template src="base"/>
- <common src="logger"/>
-
-</sample>
diff --git a/connectivity/network/NetworkConnect/NetworkConnect/build.gradle b/connectivity/network/NetworkConnect/NetworkConnect/build.gradle
new file mode 100644
index 00000000..0baece96
--- /dev/null
+++ b/connectivity/network/NetworkConnect/NetworkConnect/build.gradle
@@ -0,0 +1,10 @@
+apply plugin: 'android'
+
+dependencies {
+ compile "com.android.support:support-v4:18.0.+"
+}
+
+android {
+ compileSdkVersion 18
+ buildToolsVersion "18.0.0"
+}
diff --git a/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/AndroidManifest.xml b/connectivity/network/NetworkConnect/NetworkConnect/src/main/AndroidManifest.xml
index 1ae29df9..09fd2ee2 100644..100755
--- a/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/AndroidManifest.xml
+++ b/connectivity/network/NetworkConnect/NetworkConnect/src/main/AndroidManifest.xml
@@ -1,21 +1,18 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright 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
-
- 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.
--->
+ 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"
diff --git a/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/java/com/example/android/basicnetworking/SimpleTextFragment.java b/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/SimpleTextFragment.java
index c6d409cb..a2be93fb 100644
--- a/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/java/com/example/android/basicnetworking/SimpleTextFragment.java
+++ b/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/SimpleTextFragment.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.example.android.basicnetworking;
+package com.example.android.common;
import android.os.Bundle;
diff --git a/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/logger/Log.java b/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/logger/Log.java
new file mode 100644
index 00000000..cf4abb79
--- /dev/null
+++ b/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/logger/Log.java
@@ -0,0 +1,236 @@
+/*
+ * 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);
+ }
+} \ No newline at end of file
diff --git a/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/logger/LogNode.java b/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/logger/LogNode.java
new file mode 100644
index 00000000..bc37cabc
--- /dev/null
+++ b/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/logger/LogNode.java
@@ -0,0 +1,39 @@
+/*
+ * 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/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/logger/LogView.java b/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/logger/LogView.java
new file mode 100644
index 00000000..953b8b1e
--- /dev/null
+++ b/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/logger/LogView.java
@@ -0,0 +1,133 @@
+/*
+ * 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.util.*;
+import android.widget.TextView;
+
+/** Simple TextView which is used to output log data received through the LogNode interface.
+*/
+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 usable 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 separator, 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 addStr The String to append
+ * @param delimiter The String to separate the source and appended 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("\n" + s);
+ }
+}
diff --git a/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/logger/LogWrapper.java b/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/logger/LogWrapper.java
new file mode 100644
index 00000000..ea8e20ef
--- /dev/null
+++ b/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/logger/LogWrapper.java
@@ -0,0 +1,75 @@
+/*
+ * 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);
+ }
+ }
+} \ No newline at end of file
diff --git a/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/logger/MessageOnlyLogFilter.java b/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/logger/MessageOnlyLogFilter.java
new file mode 100644
index 00000000..c57a1112
--- /dev/null
+++ b/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/logger/MessageOnlyLogFilter.java
@@ -0,0 +1,60 @@
+/*
+ * 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;
+ }
+
+} \ No newline at end of file
diff --git a/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/networkconnect/LogFragment.java b/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/networkconnect/LogFragment.java
new file mode 100644
index 00000000..655d4286
--- /dev/null
+++ b/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/networkconnect/LogFragment.java
@@ -0,0 +1,60 @@
+package com.example.android.networkconnect;
+
+import android.support.v4.app.Fragment;
+
+import com.example.android.networkconnect.R;
+import com.example.android.common.logger.LogView;
+
+import android.os.Bundle;
+
+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 fragment that contains a LogView and uses it 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;
+ }
+
+}
diff --git a/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/java/com/example/android/networkconnect/MainActivity.java b/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/networkconnect/MainActivity.java
index 3ad46463..ae1591d2 100755
--- a/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/java/com/example/android/networkconnect/MainActivity.java
+++ b/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/networkconnect/MainActivity.java
@@ -23,8 +23,8 @@ import android.util.TypedValue;
import android.view.Menu;
import android.view.MenuItem;
+import com.example.android.common.SimpleTextFragment;
import com.example.android.common.logger.Log;
-import com.example.android.common.logger.LogFragment;
import com.example.android.common.logger.LogWrapper;
import com.example.android.common.logger.MessageOnlyLogFilter;
@@ -55,12 +55,12 @@ public class MainActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.sample_main);
+ setContentView(R.layout.activity_main);
// Initialize text fragment that displays intro text.
SimpleTextFragment introFragment = (SimpleTextFragment)
getSupportFragmentManager().findFragmentById(R.id.intro_fragment);
- introFragment.setText(R.string.welcome_message);
+ introFragment.setText(R.string.intro_message);
introFragment.getTextView().setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16.0f);
// Initialize the logging framework.
@@ -135,7 +135,7 @@ public class MainActivity extends FragmentActivity {
* an input stream.
* @param urlString A string representation of a URL.
* @return An InputStream retrieved from a successful HttpURLConnection.
- * @throws java.io.IOException
+ * @throws IOException
*/
private InputStream downloadUrl(String urlString) throws IOException {
// BEGIN_INCLUDE(get_inputstream)
@@ -156,8 +156,8 @@ public class MainActivity extends FragmentActivity {
* @param stream InputStream containing HTML from targeted site.
* @param len Length of string that this method returns.
* @return String concatenated according to len parameter.
- * @throws java.io.IOException
- * @throws java.io.UnsupportedEncodingException
+ * @throws IOException
+ * @throws UnsupportedEncodingException
*/
private String readIt(InputStream stream, int len) throws IOException, UnsupportedEncodingException {
Reader reader = null;
diff --git a/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/res/drawable-hdpi/ic_launcher.png b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/drawable-hdpi/ic_launcher.png
index 22ce6061..22ce6061 100755
--- a/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/res/drawable-hdpi/ic_launcher.png
+++ b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/res/drawable-mdpi/ic_launcher.png b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/drawable-mdpi/ic_launcher.png
index f21e17b6..f21e17b6 100755
--- a/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/res/drawable-mdpi/ic_launcher.png
+++ b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/res/drawable-xhdpi/ic_launcher.png b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/drawable-xhdpi/ic_launcher.png
index 64b80590..64b80590 100755
--- a/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/res/drawable-xhdpi/ic_launcher.png
+++ b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/res/drawable-xxhdpi/ic_launcher.png b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/drawable-xxhdpi/ic_launcher.png
index 6b4434a8..6b4434a8 100755
--- a/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/res/drawable-xxhdpi/ic_launcher.png
+++ b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/layout/sample_main.xml b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/layout/activity_main.xml
index ccbe6ae3..f21b1ac8 100755
--- a/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/layout/sample_main.xml
+++ b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/layout/activity_main.xml
@@ -22,7 +22,7 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<fragment
- android:name="com.example.android.basicnetworking.SimpleTextFragment"
+ android:name="com.example.android.common.SimpleTextFragment"
android:id="@+id/intro_fragment"
android:layout_weight="1"
android:layout_width="match_parent"
@@ -32,7 +32,7 @@
android:layout_height="1dp"
android:background="@android:color/darker_gray"/>
<fragment
- android:name="com.example.android.common.logger.LogFragment"
+ android:name="com.example.android.networkconnect.LogFragment"
android:id="@+id/log_fragment"
android:layout_weight="1"
android:layout_width="match_parent"
diff --git a/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/layout/log_fragment.xml b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/layout/log_fragment.xml
new file mode 100644
index 00000000..6d795484
--- /dev/null
+++ b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/layout/log_fragment.xml
@@ -0,0 +1,33 @@
+<?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/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/res/menu/main.xml b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/menu/main.xml
index ef1568fc..ef1568fc 100644
--- a/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/res/menu/main.xml
+++ b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/menu/main.xml
diff --git a/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/values-sw600dp/styles.xml b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/values-sw600dp/styles.xml
new file mode 100644
index 00000000..ffcbe8ac
--- /dev/null
+++ b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/values-sw600dp/styles.xml
@@ -0,0 +1,28 @@
+<!--
+ 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/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/values-v11/styles.xml b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/values-v11/styles.xml
new file mode 100644
index 00000000..c6c648b4
--- /dev/null
+++ b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/values-v11/styles.xml
@@ -0,0 +1,19 @@
+<!--
+ 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/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/values/dimens.xml b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/values/dimens.xml
new file mode 100644
index 00000000..4f69897d
--- /dev/null
+++ b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/values/dimens.xml
@@ -0,0 +1,24 @@
+<!--
+ 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/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/res/values/strings.xml b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/values/strings.xml
index 1e7915af..756f4a78 100755
--- a/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/res/values/strings.xml
+++ b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/values/strings.xml
@@ -15,7 +15,9 @@
-->
<resources>
- <string name="welcome_message">Welcome to Network Connect!
+ <string name="app_name">Network Connect</string>
+
+ <string name="intro_message">Welcome to Network Connect!
Click FETCH to fetch the first 500 characters of raw HTML from www.google.com.
</string>
diff --git a/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/values/styles.xml b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/values/styles.xml
new file mode 100644
index 00000000..4d9bb984
--- /dev/null
+++ b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/values/styles.xml
@@ -0,0 +1,40 @@
+<!--
+ 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/connectivity/network/NetworkConnect/NetworkConnectSample/.gitignore b/connectivity/network/NetworkConnect/NetworkConnectSample/.gitignore
deleted file mode 100644
index 6eb878d4..00000000
--- a/connectivity/network/NetworkConnect/NetworkConnectSample/.gitignore
+++ /dev/null
@@ -1,16 +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.
-src/template/
-src/common/
-build.gradle
diff --git a/connectivity/network/NetworkConnect/NetworkConnectSample/tests/AndroidManifest.xml b/connectivity/network/NetworkConnect/NetworkConnectSample/tests/AndroidManifest.xml
deleted file mode 100644
index 80fec80c..00000000
--- a/connectivity/network/NetworkConnect/NetworkConnectSample/tests/AndroidManifest.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?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="com.example.android.networkconnect.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="com.example.android.networkconnect"
- android:label="Tests for com.example.android.networkconnect" />
-
-</manifest> \ No newline at end of file
diff --git a/connectivity/network/NetworkConnect/NetworkConnectSample/tests/src/com/example/android/networkconnect/tests/SampleTests.java b/connectivity/network/NetworkConnect/NetworkConnectSample/tests/src/com/example/android/networkconnect/tests/SampleTests.java
deleted file mode 100644
index a5549647..00000000
--- a/connectivity/network/NetworkConnect/NetworkConnectSample/tests/src/com/example/android/networkconnect/tests/SampleTests.java
+++ /dev/null
@@ -1,79 +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.
-*/
-
-
-
-/*
-* 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.networkconnect.tests;
-
-import com.example.android.networkconnect.*;
-
-import android.test.ActivityInstrumentationTestCase2;
-
-/**
-* Tests for NetworkConnect sample.
-*/
-public class SampleTests extends ActivityInstrumentationTestCase2<MainActivity> {
-
- private MainActivity mTestActivity;
- private NetworkConnectFragment 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 = (NetworkConnectFragment)
- 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/network/NetworkConnect/README.txt b/connectivity/network/NetworkConnect/README.txt
new file mode 100644
index 00000000..38608dfc
--- /dev/null
+++ b/connectivity/network/NetworkConnect/README.txt
@@ -0,0 +1,6 @@
+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/network/NetworkConnect/build.gradle b/connectivity/network/NetworkConnect/build.gradle
index cca9ac33..036abc8d 100644
--- a/connectivity/network/NetworkConnect/build.gradle
+++ b/connectivity/network/NetworkConnect/build.gradle
@@ -1,10 +1,8 @@
-// BEGIN_EXCLUDE
-import com.example.android.samples.build.SampleGenPlugin
-apply plugin: SampleGenPlugin
-
-samplegen {
- pathToBuild "../../../../../build"
- pathToSamplesCommon "../../../common"
+buildscript {
+ repositories {
+ mavenCentral()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:0.5.+'
+ }
}
-apply from: "../../../../../build/build.gradle"
-// END_EXCLUDE
diff --git a/connectivity/network/NetworkConnect/buildSrc/build.gradle b/connectivity/network/NetworkConnect/buildSrc/build.gradle
deleted file mode 100644
index e344a8cb..00000000
--- a/connectivity/network/NetworkConnect/buildSrc/build.gradle
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-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/network/NetworkConnect/gradle/wrapper/gradle-wrapper.properties b/connectivity/network/NetworkConnect/gradle/wrapper/gradle-wrapper.properties
index 861eddc3..055ba6fa 100644
--- a/connectivity/network/NetworkConnect/gradle/wrapper/gradle-wrapper.properties
+++ b/connectivity/network/NetworkConnect/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,7 @@
-#Wed Apr 10 15:27:10 PDT 2013
+#
+#Mon Jul 22 11:40:20 PDT 2013
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.8-bin.zip
+distributionUrl=http\://services.gradle.org/distributions/gradle-1.6-bin.zip
diff --git a/connectivity/network/NetworkConnect/settings.gradle b/connectivity/network/NetworkConnect/settings.gradle
index ebae0915..771d665e 100644
--- a/connectivity/network/NetworkConnect/settings.gradle
+++ b/connectivity/network/NetworkConnect/settings.gradle
@@ -1,4 +1 @@
-
-
-
-include 'NetworkConnectSample'
+include ':NetworkConnect'
diff --git a/connectivity/network/NetworkConnect/template-params.xml b/connectivity/network/NetworkConnect/template-params.xml
deleted file mode 100644
index a1d59912..00000000
--- a/connectivity/network/NetworkConnect/template-params.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.
--->
-<sample>
- <name>NetworkConnect</name>
- <group>Connectivity</group>
- <package>com.example.android.networkconnect</package>
-
-
-
- <!-- change minSdk if needed-->
- <minSdk>8</minSdk>
-
-
- <strings>
- <intro>
- <![CDATA[
- This sample demonstrates how to connect to the network and fetch raw HTML using
- HttpURLConnection. AsyncTask is used to perform the fetch on a background thread.
- ]]>
- </intro>
- </strings>
-
- <template src="base"/>
- <common src="logger"/>
-
-</sample>
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/build.gradle b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/build.gradle
new file mode 100644
index 00000000..e802f1bf
--- /dev/null
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/build.gradle
@@ -0,0 +1,15 @@
+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.0"
+}
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/AndroidManifest.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/AndroidManifest.xml
index dd59b066..385b2936 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/AndroidManifest.xml
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/AndroidManifest.xml
@@ -1,26 +1,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.
--->
-
-
-
+<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.basicsyncadapter"
+ package="com.example.android.network.sync.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
@@ -45,7 +27,7 @@
<!-- Main activity, responsible for showing a list of feed entries. -->
<activity
- android:name=".EntryListActivity"
+ android:name="com.example.android.network.sync.basicsyncadapter.EntryListActivity"
android:label="@string/app_name" >
<!-- This intent filter places this activity in the system's app launcher. -->
<intent-filter>
@@ -63,14 +45,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.basicsyncadapter"
- android:exported="false" />
+ android:name=".provider.FeedProvider"
+ android:authorities="com.example.android.network.sync.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>
@@ -78,7 +60,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
@@ -94,9 +76,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>
+</manifest> \ No newline at end of file
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/EntryListActivity.java b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/EntryListActivity.java
index 9d8cb779..cff07025 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/EntryListActivity.java
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/EntryListActivity.java
@@ -1,4 +1,4 @@
-package com.example.android.basicsyncadapter;
+package com.example.android.network.sync.basicsyncadapter;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/EntryListFragment.java b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/EntryListFragment.java
index 83e240af..0efeb400 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/EntryListFragment.java
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/EntryListFragment.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.example.android.basicsyncadapter;
+package com.example.android.network.sync.basicsyncadapter;
import android.accounts.Account;
import android.annotation.TargetApi;
@@ -41,13 +41,13 @@ import android.widget.ListView;
import android.widget.TextView;
import com.example.android.common.accounts.GenericAccountService;
-import com.example.android.basicsyncadapter.provider.FeedContract;
+import com.example.android.network.sync.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.basicsyncadapter.provider.FeedProvider}. This content
+ * {@link com.example.android.network.sync.basicsyncadapter.provider.FeedProvider}. This content
* provider is
* automatically populated by {@link SyncService}.
*
@@ -333,7 +333,7 @@ public class EntryListFragment extends ListFragment
// 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(SyncUtils.ACCOUNT_TYPE);
+ Account account = GenericAccountService.GetAccount();
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/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/SyncAdapter.java b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/SyncAdapter.java
index da671076..a759adb2 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/SyncAdapter.java
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/SyncAdapter.java
@@ -14,10 +14,9 @@
* limitations under the License.
*/
-package com.example.android.basicsyncadapter;
+package com.example.android.network.sync.basicsyncadapter;
import android.accounts.Account;
-import android.annotation.TargetApi;
import android.content.AbstractThreadedSyncAdapter;
import android.content.ContentProviderClient;
import android.content.ContentProviderOperation;
@@ -27,13 +26,12 @@ import android.content.OperationApplicationException;
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.basicsyncadapter.net.FeedParser;
-import com.example.android.basicsyncadapter.provider.FeedContract;
+import com.example.android.network.sync.basicsyncadapter.net.FeedParser;
+import com.example.android.network.sync.basicsyncadapter.provider.FeedContract;
import org.xmlpull.v1.XmlPullParserException;
@@ -110,7 +108,6 @@ class SyncAdapter extends AbstractThreadedSyncAdapter {
/**
* 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();
@@ -125,7 +122,7 @@ class SyncAdapter extends AbstractThreadedSyncAdapter {
.
*
* <p>This is where we actually perform any work required to perform a sync.
- * {@link android.content.AbstractThreadedSyncAdapter} guarantees that this will be called on a non-UI thread,
+ * {@link 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
@@ -151,7 +148,7 @@ class SyncAdapter extends AbstractThreadedSyncAdapter {
}
}
} catch (MalformedURLException e) {
- Log.e(TAG, "Feed URL is malformed", e);
+ Log.wtf(TAG, "Feed URL is malformed", e);
syncResult.stats.numParseExceptions++;
return;
} catch (IOException e) {
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/SyncService.java b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/SyncService.java
index 41e9c030..bd92f379 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/SyncService.java
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/SyncService.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.example.android.basicsyncadapter;
+package com.example.android.network.sync.basicsyncadapter;
import android.app.Service;
import android.content.Intent;
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/SyncUtils.java b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/SyncUtils.java
index b327c728..c6552da3 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/SyncUtils.java
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/SyncUtils.java
@@ -14,19 +14,17 @@
* limitations under the License.
*/
-package com.example.android.basicsyncadapter;
+package com.example.android.network.sync.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.basicsyncadapter.provider.FeedContract;
+import com.example.android.network.sync.basicsyncadapter.provider.FeedContract;
/**
* Static helper methods for working with the sync framework.
@@ -35,24 +33,20 @@ public class SyncUtils {
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(ACCOUNT_TYPE);
- AccountManager accountManager =
- (AccountManager) context.getSystemService(Context.ACCOUNT_SERVICE);
+ Account account = GenericAccountService.GetAccount();
+ 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);
@@ -92,8 +86,8 @@ public class SyncUtils {
b.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
b.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
ContentResolver.requestSync(
- GenericAccountService.GetAccount(ACCOUNT_TYPE), // Sync account
- FeedContract.CONTENT_AUTHORITY, // Content authority
- b); // Extras
+ GenericAccountService.GetAccount(), // Sync account
+ FeedContract.CONTENT_AUTHORITY, // Content authority
+ b); // Extras
}
}
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/net/FeedParser.java b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/net/FeedParser.java
index a778390a..2bcbc0f2 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/net/FeedParser.java
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/net/FeedParser.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.example.android.basicsyncadapter.net;
+package com.example.android.network.sync.basicsyncadapter.net;
import android.text.format.Time;
import android.util.Xml;
@@ -51,9 +51,9 @@ public class FeedParser {
/** Parse an Atom feed, returning a collection of Entry objects.
*
* @param in Atom feed, as a stream.
- * @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.
+ * @return List of {@link Entry} objects.
+ * @throws XmlPullParserException on error parsing feed.
+ * @throws IOException on I/O error.
*/
public List<Entry> parse(InputStream in)
throws XmlPullParserException, IOException, ParseException {
@@ -72,9 +72,9 @@ public class FeedParser {
* Decode a feed attached to an XmlPullParser.
*
* @param parser Incoming XMl
- * @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.
+ * @return List of {@link Entry} objects.
+ * @throws XmlPullParserException on error parsing feed.
+ * @throws IOException on I/O error.
*/
private List<Entry> readFeed(XmlPullParser parser)
throws XmlPullParserException, IOException, ParseException {
@@ -193,8 +193,8 @@ public class FeedParser {
* @param parser Current parser object
* @param tag XML element tag name to parse
* @return Body of the specified tag
- * @throws java.io.IOException
- * @throws org.xmlpull.v1.XmlPullParserException
+ * @throws IOException
+ * @throws XmlPullParserException
*/
private String readBasicTag(XmlPullParser parser, String tag)
throws IOException, XmlPullParserException {
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/provider/FeedContract.java b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/provider/FeedContract.java
index e29ec482..7bfcf7f8 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/provider/FeedContract.java
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/provider/FeedContract.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.example.android.basicsyncadapter.provider;
+package com.example.android.network.sync.basicsyncadapter.provider;
import android.content.ContentResolver;
import android.net.Uri;
@@ -22,7 +22,7 @@ import android.provider.BaseColumns;
/**
* Field and table name constants for
- * {@link com.example.android.basicsyncadapter.provider.FeedProvider}.
+ * {@link com.example.android.network.sync.basicsyncadapter.provider.FeedProvider}.
*/
public class FeedContract {
private FeedContract() {
@@ -31,10 +31,10 @@ public class FeedContract {
/**
* Content provider authority.
*/
- public static final String CONTENT_AUTHORITY = "com.example.android.basicsyncadapter";
+ public static final String CONTENT_AUTHORITY = "com.example.android.network.sync.basicsyncadapter";
/**
- * Base URI. (content://com.example.android.basicsyncadapter)
+ * Base URI. (content://com.example.android.network.sync.basicsyncadapter)
*/
public static final Uri BASE_CONTENT_URI = Uri.parse("content://" + CONTENT_AUTHORITY);
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/provider/FeedProvider.java b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/provider/FeedProvider.java
index 80bf1d3d..358e3240 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/provider/FeedProvider.java
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/provider/FeedProvider.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.example.android.basicsyncadapter.provider;
+package com.example.android.network.sync.basicsyncadapter.provider;
import android.content.ContentProvider;
import android.content.ContentValues;
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/drawable-hdpi/ic_launcher.png b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/drawable-hdpi/ic_launcher.png
index a0f7005a..a0f7005a 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/drawable-hdpi/ic_launcher.png
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/drawable-mdpi/ic_launcher.png b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/drawable-mdpi/ic_launcher.png
index a085462c..a085462c 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/drawable-mdpi/ic_launcher.png
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/drawable-xhdpi/ic_action_refresh.png b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/drawable-xhdpi/ic_action_refresh.png
index 4f5d2558..4f5d2558 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/drawable-xhdpi/ic_action_refresh.png
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/drawable-xhdpi/ic_action_refresh.png
Binary files differ
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/drawable-xhdpi/ic_launcher.png b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/drawable-xhdpi/ic_launcher.png
index 4f78eb84..4f78eb84 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/drawable-xhdpi/ic_launcher.png
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/drawable-xxhdpi/ic_launcher.png b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/drawable-xxhdpi/ic_launcher.png
index b198ee3e..b198ee3e 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/drawable-xxhdpi/ic_launcher.png
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/layout/actionbar_indeterminate_progress.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/layout/actionbar_indeterminate_progress.xml
index b2540130..b2540130 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/layout/actionbar_indeterminate_progress.xml
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/layout/actionbar_indeterminate_progress.xml
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/layout/activity_entry_list.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/layout/activity_entry_list.xml
index 3c8c901c..6e3e2fd3 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/layout/activity_entry_list.xml
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/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.basicsyncadapter.EntryListFragment"
+ android:name="com.example.android.network.sync.basicsyncadapter.EntryListFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="16dp"
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/menu/main.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/menu/main.xml
index 63ad3d15..63ad3d15 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/menu/main.xml
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/menu/main.xml
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
new file mode 100644
index 00000000..ff653017
--- /dev/null
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values-v11/styles.xml
@@ -0,0 +1,28 @@
+<?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
new file mode 100644
index 00000000..a4a443af
--- /dev/null
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values-v14/styles.xml
@@ -0,0 +1,29 @@
+<?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/BasicSyncAdapterSample/src/main/res/values/attrs.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values/attrs.xml
index 6c155046..6c155046 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/values/attrs.xml
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values/attrs.xml
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/values/dimen.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values/dimen.xml
index d838c696..d838c696 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/values/dimen.xml
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values/dimen.xml
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/values/strings.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values/strings.xml
index f4cade9e..02718508 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/values/strings.xml
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values/strings.xml
@@ -16,6 +16,7 @@ limitations under the License.
-->
<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/values/styles.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values/styles.xml
new file mode 100644
index 00000000..43a8f2b0
--- /dev/null
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values/styles.xml
@@ -0,0 +1,37 @@
+<?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/src/main/res/xml/authenticator.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/xml/authenticator.xml
index 8b969077..cb69a664 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/xml/authenticator.xml
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/xml/authenticator.xml
@@ -16,7 +16,7 @@ limitations under the License.
-->
<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
- android:accountType="com.example.android.basicsyncadapter.account"
+ android:accountType="com.example.android.network.sync.basicsyncadapter"
android:icon="@drawable/ic_launcher"
android:smallIcon="@drawable/ic_launcher"
android:label="@string/app_name"
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/xml/syncadapter.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/xml/syncadapter.xml
index 6e12882c..0fcd6e3a 100644
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/xml/syncadapter.xml
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/xml/syncadapter.xml
@@ -16,8 +16,8 @@ limitations under the License.
-->
<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
- android:contentAuthority="com.example.android.basicsyncadapter"
- android:accountType="com.example.android.basicsyncadapter.account"
+ android:contentAuthority="com.example.android.network.sync.basicsyncadapter"
+ android:accountType="com.example.android.network.sync.basicsyncadapter"
android:userVisible="false"
android:supportsUploading="false"
android:allowParallelSyncs="false"
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/.gitignore b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/.gitignore
deleted file mode 100644
index 6eb878d4..00000000
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/.gitignore
+++ /dev/null
@@ -1,16 +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.
-src/template/
-src/common/
-build.gradle
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/proguard-project.txt b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/proguard-project.txt
deleted file mode 100644
index 0d8f171d..00000000
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/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/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/tests/AndroidManifest.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/tests/AndroidManifest.xml
deleted file mode 100644
index 44c910a5..00000000
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/tests/AndroidManifest.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?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="com.example.android.basicsyncadapter.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="com.example.android.basicsyncadapter"
- android:label="Tests for com.example.android.basicsyncadapter" />
-
-</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
deleted file mode 100644
index 08798ba2..00000000
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/tests/src/com/example/android/basicsyncadapter/tests/SampleTests.java
+++ /dev/null
@@ -1,79 +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.
-*/
-
-
-
-/*
-* 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
new file mode 100644
index 00000000..91c98613
--- /dev/null
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/AndroidManifest.xml
@@ -0,0 +1,26 @@
+<?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/network/NetworkConnect/NetworkConnectSample/proguard-project.txt b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/proguard-project.txt
index 0d8f171d..f2fe1559 100644
--- a/connectivity/network/NetworkConnect/NetworkConnectSample/proguard-project.txt
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/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/BasicSyncAdapterTests/src/com/example/android/network/sync/basicsyncadapter/SyncAdapterTest.java b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/src/com/example/android/network/sync/basicsyncadapter/SyncAdapterTest.java
new file mode 100644
index 00000000..820882db
--- /dev/null
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/src/com/example/android/network/sync/basicsyncadapter/SyncAdapterTest.java
@@ -0,0 +1,73 @@
+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>deckard@example.com</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
new file mode 100644
index 00000000..0c66871b
--- /dev/null
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/src/com/example/android/network/sync/basicsyncadapter/net/FeedParserTest.java
@@ -0,0 +1,21 @@
+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
new file mode 100644
index 00000000..a80b5cab
--- /dev/null
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterTests/src/com/example/android/network/sync/basicsyncadapter/provider/FeedProviderTest.java
@@ -0,0 +1,119 @@
+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
new file mode 100644
index 00000000..38608dfc
--- /dev/null
+++ b/connectivity/sync/BasicSyncAdapter/README.txt
@@ -0,0 +1,6 @@
+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 cca9ac33..495c5038 100644
--- a/connectivity/sync/BasicSyncAdapter/build.gradle
+++ b/connectivity/sync/BasicSyncAdapter/build.gradle
@@ -1,10 +1 @@
-// BEGIN_EXCLUDE
-import com.example.android.samples.build.SampleGenPlugin
-apply plugin: SampleGenPlugin
-
-samplegen {
- pathToBuild "../../../../../build"
- pathToSamplesCommon "../../../common"
-}
-apply from: "../../../../../build/build.gradle"
-// END_EXCLUDE
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
diff --git a/connectivity/sync/BasicSyncAdapter/buildSrc/build.gradle b/connectivity/sync/BasicSyncAdapter/buildSrc/build.gradle
deleted file mode 100644
index e344a8cb..00000000
--- a/connectivity/sync/BasicSyncAdapter/buildSrc/build.gradle
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-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 5c22dec0..055ba6fa 100644
--- a/connectivity/sync/BasicSyncAdapter/gradle/wrapper/gradle-wrapper.properties
+++ b/connectivity/sync/BasicSyncAdapter/gradle/wrapper/gradle-wrapper.properties
@@ -1,4 +1,5 @@
-#Wed Apr 10 15:27:10 PDT 2013
+#
+#Mon Jul 22 11:40:20 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 a691e9e9..5f2be674 100644
--- a/connectivity/sync/BasicSyncAdapter/settings.gradle
+++ b/connectivity/sync/BasicSyncAdapter/settings.gradle
@@ -1,4 +1 @@
-
-
-
-include 'BasicSyncAdapterSample'
+include ':BasicSyncAdapter'
diff --git a/connectivity/sync/BasicSyncAdapter/template-params.xml b/connectivity/sync/BasicSyncAdapter/template-params.xml
deleted file mode 100644
index 7fba1387..00000000
--- a/connectivity/sync/BasicSyncAdapter/template-params.xml
+++ /dev/null
@@ -1,43 +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.
--->
-<sample>
- <name>BasicSyncAdapter</name>
- <group>Connectivity</group>
- <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>