summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRicardo Cerqueira <ricardo@cyngn.com>2015-03-10 11:43:26 +0000
committerRicardo Cerqueira <ricardo@cyngn.com>2015-03-10 11:43:26 +0000
commit5b88c4465a219b5df4a7498a35d4862e7f2ab6e6 (patch)
tree4a23e8785a021989ec4452b674a8b98b16efa4a8
parenta37307bbf2e4f1599568ced129a41e0a1772f22a (diff)
parent679b210e3d317506f97126da5671e21f5f8af3ae (diff)
downloadandroid_development-5b88c4465a219b5df4a7498a35d4862e7f2ab6e6.tar.gz
android_development-5b88c4465a219b5df4a7498a35d4862e7f2ab6e6.tar.bz2
android_development-5b88c4465a219b5df4a7498a35d4862e7f2ab6e6.zip
Merge tag 'android-5.1.0_r1' into HEAD
Android 5.1.0 release 1
-rw-r--r--apps/Development/res/layout/connectivity.xml10
-rw-r--r--apps/Development/res/values/strings.xml2
-rw-r--r--apps/Development/src/com/android/development/Connectivity.java17
-rw-r--r--apps/Fallback/res/values-sl/strings.xml2
-rw-r--r--build/product_sdk.mk3
-rw-r--r--build/sdk-darwin-x86.atree2
-rw-r--r--build/sdk-linux-x86.atree1
-rw-r--r--build/sdk-windows-x86.atree5
-rw-r--r--build/sdk.atree60
-rw-r--r--build/tools/windows_sdk.mk1
-rw-r--r--build/windows_sdk_whitelist.mk1
-rw-r--r--docs/copyright-templates/asm.txt2
-rw-r--r--docs/copyright-templates/bash.txt2
-rw-r--r--docs/copyright-templates/bsd/c.txt2
-rw-r--r--docs/copyright-templates/c.txt2
-rw-r--r--docs/copyright-templates/java.txt2
-rw-r--r--docs/copyright-templates/make.txt2
-rw-r--r--docs/copyright-templates/plain.txt2
-rw-r--r--docs/copyright-templates/sh.txt2
-rw-r--r--docs/copyright-templates/xml.txt2
-rw-r--r--samples/ApiDemos/res/layout/media_projection.xml1
-rw-r--r--samples/ApiDemos/res/values/strings.xml4
-rw-r--r--samples/ApiDemos/res/xml/device_admin_general.xml15
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/app/DeviceAdminSample.java69
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/media/projection/MediaProjectionDemo.java13
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/os/MmsMessagingDemo.java6
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/os/MmsWapPushReceiver.java15
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/os/PduParserUtil.java37
-rw-r--r--samples/SoftKeyboard/src/com/example/android/softkeyboard/ImePreferences.java5
-rw-r--r--samples/Support7Demos/AndroidManifest.xml64
-rw-r--r--samples/Support7Demos/res/layout/activity_card_view.xml58
-rw-r--r--samples/Support7Demos/res/layout/toolbar_display_options.xml85
-rw-r--r--samples/Support7Demos/res/layout/toolbar_fragment_pager.xml34
-rw-r--r--samples/Support7Demos/res/layout/toolbar_usage.xml40
-rw-r--r--samples/Support7Demos/res/menu/actions.xml11
-rw-r--r--samples/Support7Demos/res/values/colors.xml5
-rw-r--r--samples/Support7Demos/res/values/strings.xml6
-rw-r--r--samples/Support7Demos/res/values/styles.xml32
-rw-r--r--samples/Support7Demos/res/xml/searchable.xml22
-rw-r--r--samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarDisplayOptions.java36
-rw-r--r--samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarTabs.java3
-rw-r--r--samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarUsage.java13
-rw-r--r--samples/Support7Demos/src/com/example/android/supportv7/app/RecentSuggestionsProvider.java28
-rw-r--r--samples/Support7Demos/src/com/example/android/supportv7/app/SearchActivity.java45
-rw-r--r--samples/Support7Demos/src/com/example/android/supportv7/app/ToolbarDisplayOptions.java129
-rw-r--r--samples/Support7Demos/src/com/example/android/supportv7/app/ToolbarFragmentPagerMenu.java171
-rw-r--r--samples/Support7Demos/src/com/example/android/supportv7/app/ToolbarUsage.java80
-rw-r--r--samples/Support7Demos/src/com/example/android/supportv7/media/LocalPlayer.java12
-rw-r--r--samples/Support7Demos/src/com/example/android/supportv7/media/Player.java73
-rw-r--r--samples/Support7Demos/src/com/example/android/supportv7/media/RemotePlayer.java6
-rw-r--r--samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouteControllerDialog.java121
-rw-r--r--samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouteProvider.java11
-rw-r--r--samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouteSettingsActivity.java27
-rw-r--r--samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouterActivity.java131
-rw-r--r--samples/Support7Demos/src/com/example/android/supportv7/view/CardViewActivity.java36
-rw-r--r--samples/Support7Demos/src/com/example/android/supportv7/widget/AnimatedRecyclerView.java12
-rw-r--r--samples/Support7Demos/src/com/example/android/supportv7/widget/BaseLayoutManagerActivity.java5
-rw-r--r--samples/Support7Demos/src/com/example/android/supportv7/widget/GridLayoutManagerActivity.java6
-rw-r--r--samples/Support7Demos/src/com/example/android/supportv7/widget/RecyclerViewActivity.java5
-rw-r--r--samples/SupportLeanbackDemos/AndroidManifest.xml11
-rw-r--r--samples/SupportLeanbackDemos/res/layout/horizontal_grid.xml23
-rw-r--r--samples/SupportLeanbackDemos/res/layout/rows.xml41
-rw-r--r--samples/SupportLeanbackDemos/res/values/styles.xml23
-rw-r--r--samples/SupportLeanbackDemos/res/values/themes.xml33
-rw-r--r--samples/SupportLeanbackDemos/src/com/example/android/leanback/BrowseAnimationFragment.java38
-rw-r--r--samples/SupportLeanbackDemos/src/com/example/android/leanback/BrowseErrorActivity.java3
-rw-r--r--samples/SupportLeanbackDemos/src/com/example/android/leanback/BrowseFragment.java50
-rw-r--r--samples/SupportLeanbackDemos/src/com/example/android/leanback/CardPresenter.java20
-rw-r--r--samples/SupportLeanbackDemos/src/com/example/android/leanback/DetailsFragment.java94
-rw-r--r--samples/SupportLeanbackDemos/src/com/example/android/leanback/HorizontalGridTestActivity.java172
-rw-r--r--samples/SupportLeanbackDemos/src/com/example/android/leanback/PhotoItem.java10
-rw-r--r--samples/SupportLeanbackDemos/src/com/example/android/leanback/PlaybackOverlayFragment.java504
-rw-r--r--samples/SupportLeanbackDemos/src/com/example/android/leanback/RowsActivity.java40
-rw-r--r--samples/SupportLeanbackDemos/src/com/example/android/leanback/RowsFragment.java124
-rw-r--r--samples/SupportLeanbackDemos/src/com/example/android/leanback/SearchFragment.java2
-rw-r--r--samples/SupportLeanbackDemos/src/com/example/android/leanback/VerticalGridFragment.java13
-rw-r--r--samples/browseable/ActionBarCompat-Basic/AndroidManifest.xml4
-rw-r--r--samples/browseable/ActionBarCompat-Basic/_index.jd19
-rw-r--r--samples/browseable/ActionBarCompat-Basic/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/ActionBarCompat-Basic/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/ActionBarCompat-Basic/res/values/base-strings.xml3
-rw-r--r--samples/browseable/ActionBarCompat-ListPopupMenu/AndroidManifest.xml4
-rw-r--r--samples/browseable/ActionBarCompat-ListPopupMenu/_index.jd16
-rw-r--r--samples/browseable/ActionBarCompat-ListPopupMenu/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/ActionBarCompat-ListPopupMenu/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/ActionBarCompat-ListPopupMenu/res/values/base-strings.xml3
-rw-r--r--samples/browseable/ActionBarCompat-ShareActionProvider/AndroidManifest.xml4
-rw-r--r--samples/browseable/ActionBarCompat-ShareActionProvider/_index.jd16
-rw-r--r--samples/browseable/ActionBarCompat-ShareActionProvider/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/ActionBarCompat-ShareActionProvider/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/ActionBarCompat-ShareActionProvider/res/values/base-strings.xml3
-rw-r--r--samples/browseable/ActionBarCompat-ShareActionProvider/src/com.example.android.actionbarcompat.shareactionprovider/MainActivity.java28
-rw-r--r--samples/browseable/ActionBarCompat-Styled/AndroidManifest.xml4
-rw-r--r--samples/browseable/ActionBarCompat-Styled/_index.jd15
-rw-r--r--samples/browseable/ActionBarCompat-Styled/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/ActionBarCompat-Styled/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/ActionBarCompat-Styled/res/values/base-strings.xml3
-rw-r--r--samples/browseable/ActivityInstrumentation/AndroidManifest.xml2
-rw-r--r--samples/browseable/ActivityInstrumentation/_index.jd15
-rw-r--r--samples/browseable/ActivityInstrumentation/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/ActivityInstrumentation/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/ActivityInstrumentation/res/values/base-strings.xml3
-rw-r--r--samples/browseable/ActivitySceneTransitionBasic/_index.jd6
-rw-r--r--samples/browseable/ActivitySceneTransitionBasic/res/layout/details.xml2
-rw-r--r--samples/browseable/ActivitySceneTransitionBasic/res/layout/grid_item.xml2
-rw-r--r--samples/browseable/ActivitySceneTransitionBasic/res/transition/grid_detail_transition.xml28
-rw-r--r--samples/browseable/ActivitySceneTransitionBasic/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/ActivitySceneTransitionBasic/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/ActivitySceneTransitionBasic/res/values-v21/styles.xml3
-rw-r--r--samples/browseable/ActivitySceneTransitionBasic/res/values-v21/template-styles.xml22
-rw-r--r--samples/browseable/ActivitySceneTransitionBasic/res/values/base-strings.xml6
-rw-r--r--samples/browseable/ActivitySceneTransitionBasic/res/values/strings.xml15
-rw-r--r--samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.activityscenetransitionbasic/DetailActivity.java118
-rw-r--r--samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.activityscenetransitionbasic/ImageMemoryCache.java96
-rw-r--r--samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.activityscenetransitionbasic/MainActivity.java44
-rw-r--r--samples/browseable/AdapterTransition/AndroidManifest.xml4
-rw-r--r--samples/browseable/AdapterTransition/_index.jd11
-rw-r--r--samples/browseable/AdapterTransition/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/AdapterTransition/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/AdapterTransition/res/values/base-strings.xml3
-rw-r--r--[-rwxr-xr-x]samples/browseable/AdapterTransition/res/values/strings.xml0
-rw-r--r--samples/browseable/AdapterTransition/src/com.example.android.adaptertransition/MainActivity.java13
-rw-r--r--samples/browseable/AdvancedImmersiveMode/AndroidManifest.xml2
-rw-r--r--samples/browseable/AdvancedImmersiveMode/_index.jd21
-rw-r--r--samples/browseable/AdvancedImmersiveMode/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/AdvancedImmersiveMode/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/AdvancedImmersiveMode/res/values/base-strings.xml3
-rw-r--r--samples/browseable/AdvancedImmersiveMode/src/com.example.android.advancedimmersivemode/MainActivity.java13
-rw-r--r--samples/browseable/AgendaData/Application/AndroidManifest.xml48
-rw-r--r--samples/browseable/AgendaData/Application/res/drawable-hdpi/ic_launcher.png (renamed from samples/wearable/AgendaData/Application/src/main/res/drawable-hdpi/ic_launcher.png)bin7609 -> 7609 bytes
-rw-r--r--samples/browseable/AgendaData/Application/res/drawable-hdpi/tile.9.png (renamed from samples/browseable/DoneBar/res/drawable-xhdpi/sample_dashboard_item_background.9.png)bin196 -> 196 bytes
-rw-r--r--samples/browseable/AgendaData/Application/res/drawable-mdpi/ic_launcher.png (renamed from samples/wearable/AgendaData/Application/src/main/res/drawable-mdpi/ic_launcher.png)bin4167 -> 4167 bytes
-rw-r--r--samples/browseable/AgendaData/Application/res/drawable-nodpi/nobody.png (renamed from samples/wearable/AgendaData/Application/src/main/res/drawable-nodpi/nobody.png)bin4059 -> 4059 bytes
-rw-r--r--samples/browseable/AgendaData/Application/res/drawable-xhdpi/ic_launcher.png (renamed from samples/wearable/AgendaData/Application/src/main/res/drawable-xhdpi/ic_launcher.png)bin11578 -> 11578 bytes
-rw-r--r--samples/browseable/AgendaData/Application/res/drawable-xxhdpi/ic_launcher.png (renamed from samples/wearable/AgendaData/Application/src/main/res/drawable-xxhdpi/ic_launcher.png)bin20247 -> 20247 bytes
-rwxr-xr-xsamples/browseable/AgendaData/Application/res/layout/activity_main.xml36
-rw-r--r--samples/browseable/AgendaData/Application/res/layout/main.xml (renamed from samples/wearable/AgendaData/Application/src/main/res/layout/main.xml)0
-rw-r--r--samples/browseable/AgendaData/Application/res/values-sw600dp/template-dimens.xml24
-rw-r--r--samples/browseable/AgendaData/Application/res/values-sw600dp/template-styles.xml25
-rw-r--r--samples/browseable/AgendaData/Application/res/values-v11/template-styles.xml22
-rw-r--r--samples/browseable/AgendaData/Application/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/AgendaData/Application/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/AgendaData/Application/res/values/base-strings.xml32
-rw-r--r--samples/browseable/AgendaData/Application/res/values/strings.xml21
-rw-r--r--samples/browseable/AgendaData/Application/res/values/template-dimens.xml32
-rw-r--r--samples/browseable/AgendaData/Application/res/values/template-styles.xml42
-rw-r--r--samples/browseable/AgendaData/Application/src/com.example.android.wearable.agendadata/CalendarQueryService.java (renamed from samples/wearable/AgendaData/Application/src/main/java/com/example/android/wearable/agendadata/CalendarQueryService.java)0
-rw-r--r--samples/browseable/AgendaData/Application/src/com.example.android.wearable.agendadata/Constants.java (renamed from samples/wearable/AgendaData/Application/src/main/java/com/example/android/wearable/agendadata/Constants.java)0
-rw-r--r--samples/browseable/AgendaData/Application/src/com.example.android.wearable.agendadata/MainActivity.java (renamed from samples/wearable/AgendaData/Application/src/main/java/com/example/android/wearable/agendadata/MainActivity.java)0
-rw-r--r--samples/browseable/AgendaData/Wearable/AndroidManifest.xml46
-rw-r--r--samples/browseable/AgendaData/Wearable/res/drawable-hdpi/ic_launcher.png (renamed from samples/wearable/AgendaData/Wearable/src/main/res/drawable-hdpi/ic_launcher.png)bin7609 -> 7609 bytes
-rw-r--r--samples/browseable/AgendaData/Wearable/res/drawable-hdpi/ic_menu_delete.png (renamed from samples/wearable/AgendaData/Wearable/src/main/res/drawable-hdpi/ic_menu_delete.png)bin1413 -> 1413 bytes
-rw-r--r--samples/browseable/AgendaData/Wearable/res/drawable-mdpi/ic_launcher.png (renamed from samples/wearable/AgendaData/Wearable/src/main/res/drawable-mdpi/ic_launcher.png)bin4167 -> 4167 bytes
-rw-r--r--samples/browseable/AgendaData/Wearable/res/drawable-mdpi/ic_menu_delete.png (renamed from samples/wearable/AgendaData/Wearable/src/main/res/drawable-mdpi/ic_menu_delete.png)bin967 -> 967 bytes
-rw-r--r--samples/browseable/AgendaData/Wearable/res/drawable-xhdpi/ic_launcher.png (renamed from samples/wearable/AgendaData/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png)bin11578 -> 11578 bytes
-rw-r--r--samples/browseable/AgendaData/Wearable/res/drawable-xhdpi/ic_menu_delete.png (renamed from samples/wearable/AgendaData/Wearable/src/main/res/drawable-xhdpi/ic_menu_delete.png)bin1880 -> 1880 bytes
-rw-r--r--samples/browseable/AgendaData/Wearable/res/drawable-xxhdpi/ic_launcher.png (renamed from samples/wearable/AgendaData/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png)bin20247 -> 20247 bytes
-rw-r--r--samples/browseable/AgendaData/Wearable/res/drawable-xxhdpi/ic_menu_delete.png (renamed from samples/wearable/AgendaData/Wearable/src/main/res/drawable-xxhdpi/ic_menu_delete.png)bin2989 -> 2989 bytes
-rw-r--r--samples/browseable/AgendaData/Wearable/res/values/strings.xml (renamed from samples/wearable/AgendaData/Wearable/src/main/res/values/strings.xml)0
-rw-r--r--samples/browseable/AgendaData/Wearable/src/com.example.android.wearable.agendadata/Constants.java (renamed from samples/wearable/AgendaData/Wearable/src/main/java/com/example/android/wearable/agendadata/Constants.java)0
-rw-r--r--samples/browseable/AgendaData/Wearable/src/com.example.android.wearable.agendadata/DeleteService.java (renamed from samples/wearable/AgendaData/Wearable/src/main/java/com/example/android/wearable/agendadata/DeleteService.java)0
-rw-r--r--samples/browseable/AgendaData/Wearable/src/com.example.android.wearable.agendadata/HomeListenerService.java (renamed from samples/wearable/AgendaData/Wearable/src/main/java/com/example/android/wearable/agendadata/HomeListenerService.java)0
-rw-r--r--samples/browseable/AgendaData/_index.jd13
-rw-r--r--samples/browseable/AppRestrictionEnforcer/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/AppRestrictionEnforcer/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/AppRestrictionEnforcer/res/values-v21/template-styles.xml22
-rw-r--r--samples/browseable/AppRestrictionSchema/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/AppRestrictionSchema/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/AppRestrictionSchema/res/values-v21/template-styles.xml22
-rw-r--r--samples/browseable/AppRestrictions/AndroidManifest.xml2
-rw-r--r--samples/browseable/AppRestrictions/_index.jd3
-rw-r--r--samples/browseable/AppRestrictions/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/AppRestrictions/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/AppRestrictions/res/values/base-strings.xml3
-rw-r--r--samples/browseable/BasicAccessibility/AndroidManifest.xml4
-rw-r--r--samples/browseable/BasicAccessibility/_index.jd13
-rw-r--r--samples/browseable/BasicAccessibility/res/drawable-hdpi/ic_launcher.pngbin3483 -> 3889 bytes
-rw-r--r--samples/browseable/BasicAccessibility/res/drawable-mdpi/ic_launcher.pngbin2304 -> 2533 bytes
-rw-r--r--samples/browseable/BasicAccessibility/res/drawable-xhdpi/ic_launcher.pngbin4379 -> 5270 bytes
-rw-r--r--samples/browseable/BasicAccessibility/res/drawable-xxhdpi/ic_launcher.pngbin6307 -> 9309 bytes
-rw-r--r--samples/browseable/BasicAccessibility/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/BasicAccessibility/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/BasicAccessibility/res/values/base-strings.xml3
-rw-r--r--samples/browseable/BasicAndroidKeyStore/AndroidManifest.xml2
-rw-r--r--samples/browseable/BasicAndroidKeyStore/_index.jd22
-rw-r--r--samples/browseable/BasicAndroidKeyStore/res/layout-sw600dp-land/activity_main.xml41
-rw-r--r--samples/browseable/BasicAndroidKeyStore/res/layout-sw600dp/activity_main.xml38
-rw-r--r--samples/browseable/BasicAndroidKeyStore/res/layout/activity_main.xml46
-rw-r--r--samples/browseable/BasicAndroidKeyStore/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/BasicAndroidKeyStore/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/BasicAndroidKeyStore/res/values/base-strings.xml20
-rw-r--r--samples/browseable/BasicAndroidKeyStore/src/com.example.android.basicandroidkeystore/MainActivity.java9
-rw-r--r--samples/browseable/BasicContactables/AndroidManifest.xml4
-rw-r--r--samples/browseable/BasicContactables/_index.jd16
-rw-r--r--samples/browseable/BasicContactables/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/BasicContactables/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/BasicContactables/res/values/base-strings.xml3
-rw-r--r--samples/browseable/BasicGestureDetect/AndroidManifest.xml2
-rw-r--r--samples/browseable/BasicGestureDetect/_index.jd14
-rw-r--r--samples/browseable/BasicGestureDetect/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/BasicGestureDetect/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/BasicGestureDetect/res/values/base-strings.xml3
-rw-r--r--samples/browseable/BasicGestureDetect/res/values/strings.xml3
-rw-r--r--samples/browseable/BasicGestureDetect/src/com.example.android.basicgesturedetect/MainActivity.java3
-rw-r--r--samples/browseable/BasicImmersiveMode/AndroidManifest.xml2
-rw-r--r--samples/browseable/BasicImmersiveMode/_index.jd15
-rw-r--r--samples/browseable/BasicImmersiveMode/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/BasicImmersiveMode/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/BasicImmersiveMode/res/values/base-strings.xml3
-rw-r--r--samples/browseable/BasicImmersiveMode/res/values/strings.xml3
-rw-r--r--samples/browseable/BasicImmersiveMode/src/com.example.android.basicimmersivemode/MainActivity.java3
-rw-r--r--samples/browseable/BasicManagedProfile/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/BasicManagedProfile/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/BasicManagedProfile/res/values-v21/template-styles.xml22
-rw-r--r--samples/browseable/BasicMediaDecoder/AndroidManifest.xml3
-rw-r--r--samples/browseable/BasicMediaDecoder/_index.jd11
-rw-r--r--samples/browseable/BasicMediaDecoder/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/BasicMediaDecoder/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/BasicMediaDecoder/res/values/base-strings.xml3
-rw-r--r--samples/browseable/BasicMediaRouter/AndroidManifest.xml4
-rw-r--r--samples/browseable/BasicMediaRouter/_index.jd24
-rw-r--r--samples/browseable/BasicMediaRouter/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/BasicMediaRouter/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/BasicMediaRouter/res/values/base-strings.xml3
-rw-r--r--samples/browseable/BasicMultitouch/AndroidManifest.xml4
-rw-r--r--samples/browseable/BasicMultitouch/_index.jd16
-rw-r--r--samples/browseable/BasicMultitouch/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/BasicMultitouch/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/BasicMultitouch/res/values/base-strings.xml3
-rw-r--r--samples/browseable/BasicNetworking/AndroidManifest.xml2
-rw-r--r--samples/browseable/BasicNetworking/_index.jd14
-rwxr-xr-xsamples/browseable/BasicNetworking/res/drawable-hdpi/ic_launcher.pngbin4407 -> 4499 bytes
-rwxr-xr-xsamples/browseable/BasicNetworking/res/drawable-mdpi/ic_launcher.pngbin2668 -> 2721 bytes
-rwxr-xr-xsamples/browseable/BasicNetworking/res/drawable-xhdpi/ic_launcher.pngbin6230 -> 6287 bytes
-rwxr-xr-xsamples/browseable/BasicNetworking/res/drawable-xxhdpi/ic_launcher.pngbin11294 -> 10763 bytes
-rw-r--r--samples/browseable/BasicNetworking/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/BasicNetworking/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/BasicNetworking/res/values/base-strings.xml11
-rw-r--r--samples/browseable/BasicNotifications/AndroidManifest.xml4
-rw-r--r--samples/browseable/BasicNotifications/_index.jd15
-rw-r--r--samples/browseable/BasicNotifications/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/BasicNotifications/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/BasicNotifications/res/values/base-strings.xml3
-rw-r--r--samples/browseable/BasicRenderScript/AndroidManifest.xml4
-rw-r--r--samples/browseable/BasicRenderScript/_index.jd13
-rw-r--r--samples/browseable/BasicRenderScript/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/BasicRenderScript/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/BasicRenderScript/res/values/base-strings.xml3
-rw-r--r--samples/browseable/BasicRenderScript/src/com.example.android.common.media/MediaCodecWrapper.java3
-rw-r--r--samples/browseable/BasicSyncAdapter/AndroidManifest.xml4
-rw-r--r--samples/browseable/BasicSyncAdapter/_index.jd20
-rw-r--r--samples/browseable/BasicSyncAdapter/res/drawable-hdpi/ic_launcher.pngbin5473 -> 4588 bytes
-rw-r--r--samples/browseable/BasicSyncAdapter/res/drawable-mdpi/ic_launcher.pngbin3298 -> 2770 bytes
-rw-r--r--samples/browseable/BasicSyncAdapter/res/drawable-xhdpi/ic_launcher.pngbin7401 -> 6549 bytes
-rw-r--r--samples/browseable/BasicSyncAdapter/res/drawable-xxhdpi/ic_launcher.pngbin12074 -> 11666 bytes
-rw-r--r--samples/browseable/BasicSyncAdapter/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/BasicSyncAdapter/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/BasicSyncAdapter/res/values/base-strings.xml3
-rw-r--r--samples/browseable/BasicTransition/AndroidManifest.xml2
-rw-r--r--samples/browseable/BasicTransition/_index.jd12
-rw-r--r--samples/browseable/BasicTransition/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/BasicTransition/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/BasicTransition/res/values/base-strings.xml3
-rw-r--r--[-rwxr-xr-x]samples/browseable/BasicTransition/res/values/strings.xml0
-rw-r--r--samples/browseable/BasicTransition/src/com.example.android.basictransition/MainActivity.java13
-rw-r--r--samples/browseable/BatchStepSensor/AndroidManifest.xml2
-rw-r--r--samples/browseable/BatchStepSensor/_index.jd37
-rw-r--r--samples/browseable/BatchStepSensor/res/drawable-v21/card_action_bg.xml20
-rw-r--r--samples/browseable/BatchStepSensor/res/drawable-v21/card_action_bg_negative.xml20
-rw-r--r--samples/browseable/BatchStepSensor/res/drawable-v21/card_action_bg_positive.xml20
-rwxr-xr-xsamples/browseable/BatchStepSensor/res/layout/activity_main.xml3
-rw-r--r--samples/browseable/BatchStepSensor/res/layout/card.xml3
-rw-r--r--samples/browseable/BatchStepSensor/res/layout/card_button_negative.xml3
-rw-r--r--samples/browseable/BatchStepSensor/res/layout/card_button_neutral.xml3
-rw-r--r--samples/browseable/BatchStepSensor/res/layout/card_button_positive.xml3
-rw-r--r--samples/browseable/BatchStepSensor/res/layout/cardstream.xml3
-rw-r--r--samples/browseable/BatchStepSensor/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/BatchStepSensor/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/BatchStepSensor/res/values/base-strings.xml13
-rw-r--r--samples/browseable/BatchStepSensor/res/values/color.xml5
-rw-r--r--samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/MainActivity.java5
-rw-r--r--samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/Card.java3
-rw-r--r--samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/CardActionButton.java33
-rw-r--r--samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/CardLayout.java3
-rw-r--r--samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/CardStream.java3
-rw-r--r--samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/CardStreamAnimator.java3
-rw-r--r--samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/CardStreamFragment.java3
-rw-r--r--samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/CardStreamLinearLayout.java3
-rw-r--r--samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/CardStreamState.java3
-rw-r--r--samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/DefaultCardStreamAnimator.java3
-rw-r--r--samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/OnCardClickListener.java3
-rw-r--r--samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/StreamRetentionFragment.java3
-rw-r--r--samples/browseable/BluetoothChat/AndroidManifest.xml53
-rw-r--r--samples/browseable/BluetoothChat/_index.jd15
-rwxr-xr-xsamples/browseable/BluetoothChat/res/drawable-hdpi/ic_action_device_access_bluetooth_searching.pngbin0 -> 1355 bytes
-rw-r--r--samples/browseable/BluetoothChat/res/drawable-hdpi/ic_launcher.pngbin0 -> 4689 bytes
-rw-r--r--samples/browseable/BluetoothChat/res/drawable-hdpi/tile.9.png (renamed from samples/browseable/NavigationDrawer/res/drawable-xhdpi/sample_dashboard_item_background.9.png)bin196 -> 196 bytes
-rwxr-xr-xsamples/browseable/BluetoothChat/res/drawable-mdpi/ic_action_device_access_bluetooth_searching.pngbin0 -> 841 bytes
-rw-r--r--samples/browseable/BluetoothChat/res/drawable-mdpi/ic_launcher.pngbin0 -> 2834 bytes
-rwxr-xr-xsamples/browseable/BluetoothChat/res/drawable-xhdpi/ic_action_device_access_bluetooth_searching.pngbin0 -> 1879 bytes
-rw-r--r--samples/browseable/BluetoothChat/res/drawable-xhdpi/ic_launcher.pngbin0 -> 6681 bytes
-rwxr-xr-xsamples/browseable/BluetoothChat/res/drawable-xxhdpi/ic_action_device_access_bluetooth_searching.pngbin0 -> 3083 bytes
-rw-r--r--samples/browseable/BluetoothChat/res/drawable-xxhdpi/ic_launcher.pngbin0 -> 12071 bytes
-rwxr-xr-xsamples/browseable/BluetoothChat/res/layout-w720dp/activity_main.xml73
-rw-r--r--samples/browseable/BluetoothChat/res/layout/activity_device_list.xml66
-rwxr-xr-xsamples/browseable/BluetoothChat/res/layout/activity_main.xml65
-rw-r--r--samples/browseable/BluetoothChat/res/layout/device_name.xml21
-rw-r--r--samples/browseable/BluetoothChat/res/layout/fragment_bluetooth_chat.xml49
-rw-r--r--samples/browseable/BluetoothChat/res/layout/message.xml21
-rw-r--r--samples/browseable/BluetoothChat/res/menu/bluetooth_chat.xml34
-rw-r--r--samples/browseable/BluetoothChat/res/menu/main.xml21
-rw-r--r--samples/browseable/BluetoothChat/res/values-sw600dp/template-dimens.xml24
-rw-r--r--samples/browseable/BluetoothChat/res/values-sw600dp/template-styles.xml25
-rw-r--r--samples/browseable/BluetoothChat/res/values-v11/template-styles.xml22
-rw-r--r--samples/browseable/BluetoothChat/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/BluetoothChat/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/BluetoothChat/res/values/base-strings.xml34
-rwxr-xr-xsamples/browseable/BluetoothChat/res/values/fragmentview_strings.xml (renamed from samples/browseable/AdvancedImmersiveMode/res/values/strings.xml)0
-rw-r--r--samples/browseable/BluetoothChat/res/values/strings.xml41
-rw-r--r--samples/browseable/BluetoothChat/res/values/template-dimens.xml32
-rw-r--r--samples/browseable/BluetoothChat/res/values/template-styles.xml42
-rw-r--r--samples/browseable/BluetoothChat/src/com.example.android.bluetoothchat/BluetoothChatFragment.java402
-rw-r--r--samples/browseable/BluetoothChat/src/com.example.android.bluetoothchat/BluetoothChatService.java519
-rw-r--r--samples/browseable/BluetoothChat/src/com.example.android.bluetoothchat/Constants.java35
-rw-r--r--samples/browseable/BluetoothChat/src/com.example.android.bluetoothchat/DeviceListActivity.java216
-rw-r--r--samples/browseable/BluetoothChat/src/com.example.android.bluetoothchat/MainActivity.java109
-rw-r--r--samples/browseable/BluetoothChat/src/com.example.android.common/activities/SampleActivityBase.java52
-rw-r--r--samples/browseable/BluetoothChat/src/com.example.android.common/logger/Log.java236
-rw-r--r--samples/browseable/BluetoothChat/src/com.example.android.common/logger/LogFragment.java109
-rw-r--r--samples/browseable/BluetoothChat/src/com.example.android.common/logger/LogNode.java39
-rw-r--r--samples/browseable/BluetoothChat/src/com.example.android.common/logger/LogView.java145
-rw-r--r--samples/browseable/BluetoothChat/src/com.example.android.common/logger/LogWrapper.java75
-rw-r--r--samples/browseable/BluetoothChat/src/com.example.android.common/logger/MessageOnlyLogFilter.java60
-rw-r--r--samples/browseable/BluetoothLeGatt/AndroidManifest.xml4
-rw-r--r--samples/browseable/BluetoothLeGatt/_index.jd14
-rw-r--r--samples/browseable/BluetoothLeGatt/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/BluetoothLeGatt/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/BluetoothLeGatt/res/values/base-strings.xml3
-rw-r--r--samples/browseable/BorderlessButtons/AndroidManifest.xml2
-rw-r--r--samples/browseable/BorderlessButtons/_index.jd11
-rw-r--r--samples/browseable/BorderlessButtons/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/BorderlessButtons/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/BorderlessButtons/res/values/base-strings.xml3
-rw-r--r--samples/browseable/Camera2Basic/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/Camera2Basic/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/Camera2Basic/res/values-v21/template-styles.xml22
-rw-r--r--samples/browseable/Camera2Basic/src/com.example.android.camera2basic/Camera2BasicFragment.java20
-rw-r--r--samples/browseable/Camera2Video/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/Camera2Video/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/Camera2Video/res/values-v21/template-styles.xml22
-rw-r--r--samples/browseable/CardEmulation/AndroidManifest.xml2
-rw-r--r--samples/browseable/CardEmulation/_index.jd23
-rw-r--r--samples/browseable/CardEmulation/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/CardEmulation/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/CardEmulation/res/values/base-strings.xml3
-rw-r--r--[-rwxr-xr-x]samples/browseable/CardEmulation/res/values/strings.xml0
-rw-r--r--samples/browseable/CardEmulation/src/com.example.android.cardemulation/MainActivity.java13
-rw-r--r--samples/browseable/CardReader/AndroidManifest.xml2
-rw-r--r--samples/browseable/CardReader/_index.jd24
-rw-r--r--samples/browseable/CardReader/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/CardReader/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/CardReader/res/values/base-strings.xml3
-rw-r--r--[-rwxr-xr-x]samples/browseable/CardReader/res/values/strings.xml0
-rw-r--r--samples/browseable/CardReader/src/com.example.android.cardreader/MainActivity.java13
-rw-r--r--samples/browseable/CardView/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/CardView/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/CardView/res/values-v21/template-styles.xml22
-rw-r--r--samples/browseable/ClippingBasic/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/ClippingBasic/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/ClippingBasic/res/values-v21/template-styles.xml22
-rw-r--r--samples/browseable/CustomChoiceList/AndroidManifest.xml2
-rw-r--r--samples/browseable/CustomChoiceList/_index.jd11
-rw-r--r--samples/browseable/CustomChoiceList/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/CustomChoiceList/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/CustomChoiceList/res/values/base-strings.xml3
-rw-r--r--samples/browseable/CustomNotifications/AndroidManifest.xml4
-rw-r--r--samples/browseable/CustomNotifications/_index.jd12
-rw-r--r--samples/browseable/CustomNotifications/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/CustomNotifications/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/CustomNotifications/res/values/base-strings.xml3
-rw-r--r--samples/browseable/CustomTransition/AndroidManifest.xml2
-rw-r--r--samples/browseable/CustomTransition/_index.jd9
-rw-r--r--samples/browseable/CustomTransition/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/CustomTransition/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/CustomTransition/res/values/base-strings.xml3
-rw-r--r--samples/browseable/CustomTransition/src/com.example.android.customtransition/MainActivity.java13
-rw-r--r--samples/browseable/DataLayer/Application/AndroidManifest.xml44
-rw-r--r--samples/browseable/DataLayer/Application/res/drawable-hdpi/ic_content_picture.png (renamed from samples/wearable/DataLayer/Application/src/main/res/drawable-hdpi/ic_content_picture.png)bin1474 -> 1474 bytes
-rwxr-xr-xsamples/browseable/DataLayer/Application/res/drawable-hdpi/ic_launcher.png (renamed from samples/wearable/DataLayer/Application/src/main/res/drawable-hdpi/ic_launcher.png)bin4584 -> 4584 bytes
-rw-r--r--samples/browseable/DataLayer/Application/res/drawable-hdpi/tile.9.pngbin0 -> 196 bytes
-rw-r--r--samples/browseable/DataLayer/Application/res/drawable-mdpi/ic_content_picture.png (renamed from samples/wearable/DataLayer/Application/src/main/res/drawable-mdpi/ic_content_picture.png)bin896 -> 896 bytes
-rwxr-xr-xsamples/browseable/DataLayer/Application/res/drawable-mdpi/ic_launcher.png (renamed from samples/wearable/DataLayer/Application/src/main/res/drawable-mdpi/ic_launcher.png)bin2757 -> 2757 bytes
-rw-r--r--samples/browseable/DataLayer/Application/res/drawable-xhdpi/ic_content_picture.png (renamed from samples/wearable/DataLayer/Application/src/main/res/drawable-xhdpi/ic_content_picture.png)bin2139 -> 2139 bytes
-rwxr-xr-xsamples/browseable/DataLayer/Application/res/drawable-xhdpi/ic_launcher.png (renamed from samples/wearable/DataLayer/Application/src/main/res/drawable-xhdpi/ic_launcher.png)bin6603 -> 6603 bytes
-rw-r--r--samples/browseable/DataLayer/Application/res/drawable-xxhdpi/ic_content_picture.png (renamed from samples/wearable/DataLayer/Application/src/main/res/drawable-xxhdpi/ic_content_picture.png)bin3602 -> 3602 bytes
-rwxr-xr-xsamples/browseable/DataLayer/Application/res/drawable-xxhdpi/ic_launcher.png (renamed from samples/wearable/DataLayer/Application/src/main/res/drawable-xxhdpi/ic_launcher.png)bin11788 -> 11788 bytes
-rw-r--r--samples/browseable/DataLayer/Application/res/drawable/divider.xml (renamed from samples/wearable/DataLayer/Application/src/main/res/drawable/divider.xml)0
-rwxr-xr-xsamples/browseable/DataLayer/Application/res/layout/activity_main.xml36
-rw-r--r--samples/browseable/DataLayer/Application/res/layout/main_activity.xml (renamed from samples/wearable/DataLayer/Application/src/main/res/layout/main_activity.xml)0
-rw-r--r--samples/browseable/DataLayer/Application/res/values-sw600dp/template-dimens.xml24
-rw-r--r--samples/browseable/DataLayer/Application/res/values-sw600dp/template-styles.xml25
-rw-r--r--samples/browseable/DataLayer/Application/res/values-v11/template-styles.xml22
-rw-r--r--samples/browseable/DataLayer/Application/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/DataLayer/Application/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/DataLayer/Application/res/values/base-strings.xml30
-rw-r--r--samples/browseable/DataLayer/Application/res/values/strings.xml22
-rw-r--r--samples/browseable/DataLayer/Application/res/values/style.xml (renamed from samples/wearable/DataLayer/Application/src/main/res/values/style.xml)0
-rw-r--r--samples/browseable/DataLayer/Application/res/values/template-dimens.xml32
-rw-r--r--samples/browseable/DataLayer/Application/res/values/template-styles.xml42
-rw-r--r--samples/browseable/DataLayer/Application/src/com.example.android.wearable.datalayer/MainActivity.java (renamed from samples/wearable/DataLayer/Application/src/main/java/com/example/android/wearable/datalayer/MainActivity.java)0
-rw-r--r--samples/browseable/DataLayer/Wearable/AndroidManifest.xml55
-rwxr-xr-xsamples/browseable/DataLayer/Wearable/res/drawable-hdpi/ic_launcher.png (renamed from samples/wearable/DataLayer/Wearable/src/main/res/drawable-hdpi/ic_launcher.png)bin4584 -> 4584 bytes
-rwxr-xr-xsamples/browseable/DataLayer/Wearable/res/drawable-mdpi/ic_launcher.png (renamed from samples/wearable/DataLayer/Wearable/src/main/res/drawable-mdpi/ic_launcher.png)bin2757 -> 2757 bytes
-rwxr-xr-xsamples/browseable/DataLayer/Wearable/res/drawable-xhdpi/ic_launcher.png (renamed from samples/wearable/DataLayer/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png)bin6603 -> 6603 bytes
-rwxr-xr-xsamples/browseable/DataLayer/Wearable/res/drawable-xxhdpi/ic_launcher.png (renamed from samples/wearable/DataLayer/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png)bin11788 -> 11788 bytes
-rw-r--r--samples/browseable/DataLayer/Wearable/res/layout/main_activity.xml (renamed from samples/wearable/DataLayer/Wearable/src/main/res/layout/main_activity.xml)0
-rw-r--r--samples/browseable/DataLayer/Wearable/res/values/strings.xml (renamed from samples/wearable/DataLayer/Wearable/src/main/res/values/strings.xml)0
-rw-r--r--samples/browseable/DataLayer/Wearable/src/com.example.android.wearable.datalayer/DataLayerListenerService.java (renamed from samples/wearable/DataLayer/Wearable/src/main/java/com/example/android/wearable/datalayer/DataLayerListenerService.java)0
-rw-r--r--samples/browseable/DataLayer/Wearable/src/com.example.android.wearable.datalayer/MainActivity.java (renamed from samples/wearable/DataLayer/Wearable/src/main/java/com/example/android/wearable/datalayer/MainActivity.java)0
-rw-r--r--samples/browseable/DataLayer/_index.jd11
-rw-r--r--samples/browseable/DelayedConfirmation/Application/AndroidManifest.xml42
-rwxr-xr-xsamples/browseable/DelayedConfirmation/Application/res/drawable-hdpi/ic_launcher.png (renamed from samples/wearable/DelayedConfirmation/Application/src/main/res/drawable-hdpi/ic_launcher.png)bin4584 -> 4584 bytes
-rw-r--r--samples/browseable/DelayedConfirmation/Application/res/drawable-hdpi/tile.9.pngbin0 -> 196 bytes
-rwxr-xr-xsamples/browseable/DelayedConfirmation/Application/res/drawable-mdpi/ic_launcher.png (renamed from samples/wearable/DelayedConfirmation/Application/src/main/res/drawable-mdpi/ic_launcher.png)bin2757 -> 2757 bytes
-rwxr-xr-xsamples/browseable/DelayedConfirmation/Application/res/drawable-xhdpi/ic_launcher.png (renamed from samples/wearable/DelayedConfirmation/Application/src/main/res/drawable-xhdpi/ic_launcher.png)bin6603 -> 6603 bytes
-rwxr-xr-xsamples/browseable/DelayedConfirmation/Application/res/drawable-xxhdpi/ic_launcher.png (renamed from samples/wearable/DelayedConfirmation/Application/src/main/res/drawable-xxhdpi/ic_launcher.png)bin11788 -> 11788 bytes
-rwxr-xr-xsamples/browseable/DelayedConfirmation/Application/res/layout/activity_main.xml36
-rw-r--r--samples/browseable/DelayedConfirmation/Application/res/layout/main_activity.xml (renamed from samples/wearable/DelayedConfirmation/Application/src/main/res/layout/main_activity.xml)0
-rw-r--r--samples/browseable/DelayedConfirmation/Application/res/values-sw600dp/template-dimens.xml24
-rw-r--r--samples/browseable/DelayedConfirmation/Application/res/values-sw600dp/template-styles.xml25
-rw-r--r--samples/browseable/DelayedConfirmation/Application/res/values-v11/template-styles.xml22
-rw-r--r--samples/browseable/DelayedConfirmation/Application/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/DelayedConfirmation/Application/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/DelayedConfirmation/Application/res/values/base-strings.xml33
-rw-r--r--samples/browseable/DelayedConfirmation/Application/res/values/strings.xml23
-rw-r--r--samples/browseable/DelayedConfirmation/Application/res/values/template-dimens.xml32
-rw-r--r--samples/browseable/DelayedConfirmation/Application/res/values/template-styles.xml42
-rw-r--r--samples/browseable/DelayedConfirmation/Application/src/com.example.android.wearable.delayedconfirmation/MainActivity.java (renamed from samples/wearable/DelayedConfirmation/Application/src/main/java/com/example/android/wearable/delayedconfirmation/MainActivity.java)0
-rw-r--r--samples/browseable/DelayedConfirmation/Wearable/AndroidManifest.xml47
-rwxr-xr-xsamples/browseable/DelayedConfirmation/Wearable/res/drawable-hdpi/ic_launcher.png (renamed from samples/wearable/DelayedConfirmation/Wearable/src/main/res/drawable-hdpi/ic_launcher.png)bin4584 -> 4584 bytes
-rwxr-xr-xsamples/browseable/DelayedConfirmation/Wearable/res/drawable-mdpi/ic_launcher.png (renamed from samples/wearable/DelayedConfirmation/Wearable/src/main/res/drawable-mdpi/ic_launcher.png)bin2757 -> 2757 bytes
-rwxr-xr-xsamples/browseable/DelayedConfirmation/Wearable/res/drawable-xhdpi/ic_launcher.png (renamed from samples/wearable/DelayedConfirmation/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png)bin6603 -> 6603 bytes
-rwxr-xr-xsamples/browseable/DelayedConfirmation/Wearable/res/drawable-xxhdpi/ic_launcher.png (renamed from samples/wearable/DelayedConfirmation/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png)bin11788 -> 11788 bytes
-rw-r--r--samples/browseable/DelayedConfirmation/Wearable/res/layout/main_activity.xml (renamed from samples/wearable/DelayedConfirmation/Wearable/src/main/res/layout/main_activity.xml)0
-rw-r--r--samples/browseable/DelayedConfirmation/Wearable/res/values/dimens.xml (renamed from samples/wearable/DelayedConfirmation/Wearable/src/main/res/values/dimens.xml)0
-rw-r--r--samples/browseable/DelayedConfirmation/Wearable/res/values/strings.xml (renamed from samples/wearable/DelayedConfirmation/Wearable/src/main/res/values/strings.xml)0
-rw-r--r--samples/browseable/DelayedConfirmation/Wearable/src/com.example.android.wearable.delayedconfirmation/MainActivity.java (renamed from samples/wearable/DelayedConfirmation/Wearable/src/main/java/com/example/android/wearable/delayedconfirmation/MainActivity.java)0
-rw-r--r--samples/browseable/DelayedConfirmation/Wearable/src/com.example.android.wearable.delayedconfirmation/WearableMessageListenerService.java (renamed from samples/wearable/DelayedConfirmation/Wearable/src/main/java/com/example/android/wearable/delayedconfirmation/WearableMessageListenerService.java)0
-rw-r--r--samples/browseable/DelayedConfirmation/_index.jd14
-rw-r--r--samples/browseable/DisplayingBitmaps/AndroidManifest.xml2
-rw-r--r--samples/browseable/DisplayingBitmaps/_index.jd26
-rw-r--r--samples/browseable/DisplayingBitmaps/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/DisplayingBitmaps/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/DisplayingBitmaps/res/values/base-strings.xml3
-rw-r--r--samples/browseable/DocumentCentricApps/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/DocumentCentricApps/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/DocumentCentricApps/res/values-v21/template-styles.xml22
-rw-r--r--samples/browseable/DocumentCentricRelinquishIdentity/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/DocumentCentricRelinquishIdentity/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/DocumentCentricRelinquishIdentity/res/values-v21/template-styles.xml22
-rw-r--r--samples/browseable/DoneBar/AndroidManifest.xml2
-rw-r--r--samples/browseable/DoneBar/_index.jd19
-rw-r--r--samples/browseable/DoneBar/res/layout/sample_dashboard_item.xml42
-rw-r--r--samples/browseable/DoneBar/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/DoneBar/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/DoneBar/res/values/activitycards-colors.xml21
-rw-r--r--samples/browseable/DoneBar/res/values/activitycards-dimens.xml22
-rw-r--r--samples/browseable/DoneBar/res/values/activitycards-strings.xml3
-rw-r--r--samples/browseable/DoneBar/res/values/base-strings.xml3
-rw-r--r--samples/browseable/DoneBar/res/values/template-styles.xml25
-rw-r--r--samples/browseable/DoneBar/src/com.example.android.donebar/MainActivity.java3
-rw-r--r--samples/browseable/DrawableTinting/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/DrawableTinting/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/DrawableTinting/res/values-v21/template-styles.xml22
-rw-r--r--samples/browseable/ElevationBasic/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/ElevationBasic/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/ElevationBasic/res/values-v21/template-styles.xml22
-rw-r--r--samples/browseable/ElevationDrag/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/ElevationDrag/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/ElevationDrag/res/values-v21/template-styles.xml22
-rw-r--r--samples/browseable/ElizaChat/Application/AndroidManifest.xml45
-rw-r--r--samples/browseable/ElizaChat/Application/res/drawable-hdpi/ic_full_reply.png (renamed from samples/wearable/ElizaChat/Application/src/main/res/drawable-hdpi/ic_full_reply.png)bin2022 -> 2022 bytes
-rw-r--r--samples/browseable/ElizaChat/Application/res/drawable-hdpi/tile.9.pngbin0 -> 196 bytes
-rw-r--r--samples/browseable/ElizaChat/Application/res/drawable-mdpi/ic_full_reply.png (renamed from samples/wearable/ElizaChat/Application/src/main/res/drawable-mdpi/ic_full_reply.png)bin1261 -> 1261 bytes
-rw-r--r--samples/browseable/ElizaChat/Application/res/drawable-nodpi/bg_eliza.png (renamed from samples/wearable/ElizaChat/Application/src/main/res/drawable-nodpi/bg_eliza.png)bin375313 -> 375313 bytes
-rw-r--r--samples/browseable/ElizaChat/Application/res/drawable-xhdpi/ic_full_reply.png (renamed from samples/wearable/ElizaChat/Application/src/main/res/drawable-xhdpi/ic_full_reply.png)bin1178 -> 1178 bytes
-rwxr-xr-xsamples/browseable/ElizaChat/Application/res/layout/activity_main.xml36
-rw-r--r--samples/browseable/ElizaChat/Application/res/layout/main.xml (renamed from samples/wearable/ElizaChat/Application/src/main/res/layout/activity_main.xml)0
-rw-r--r--samples/browseable/ElizaChat/Application/res/menu/main.xml (renamed from samples/wearable/ElizaChat/Application/src/main/res/menu/main.xml)0
-rw-r--r--samples/browseable/ElizaChat/Application/res/mipmap-hdpi/ic_app_eliza.png (renamed from samples/wearable/ElizaChat/Application/src/main/res/mipmap-hdpi/ic_app_eliza.png)bin7785 -> 7785 bytes
-rw-r--r--samples/browseable/ElizaChat/Application/res/mipmap-mdpi/ic_app_eliza.png (renamed from samples/wearable/ElizaChat/Application/src/main/res/mipmap-mdpi/ic_app_eliza.png)bin5019 -> 5019 bytes
-rw-r--r--samples/browseable/ElizaChat/Application/res/mipmap-xhdpi/ic_app_eliza.png (renamed from samples/wearable/ElizaChat/Application/src/main/res/mipmap-xhdpi/ic_app_eliza.png)bin10888 -> 10888 bytes
-rw-r--r--samples/browseable/ElizaChat/Application/res/mipmap-xxhdpi/ic_app_eliza.png (renamed from samples/wearable/ElizaChat/Application/src/main/res/mipmap-xxhdpi/ic_app_eliza.png)bin16592 -> 16592 bytes
-rw-r--r--samples/browseable/ElizaChat/Application/res/mipmap-xxxhdpi/ic_app_eliza.png (renamed from samples/wearable/ElizaChat/Application/src/main/res/mipmap-xxxhdpi/ic_app_eliza.png)bin14515 -> 14515 bytes
-rw-r--r--samples/browseable/ElizaChat/Application/res/values-sw600dp/template-dimens.xml24
-rw-r--r--samples/browseable/ElizaChat/Application/res/values-sw600dp/template-styles.xml25
-rw-r--r--samples/browseable/ElizaChat/Application/res/values-v11/template-styles.xml22
-rw-r--r--samples/browseable/ElizaChat/Application/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/ElizaChat/Application/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/ElizaChat/Application/res/values/base-strings.xml31
-rw-r--r--samples/browseable/ElizaChat/Application/res/values/dimens.xml (renamed from samples/wearable/ElizaChat/Application/src/main/res/values/dimens.xml)0
-rw-r--r--samples/browseable/ElizaChat/Application/res/values/strings.xml25
-rw-r--r--samples/browseable/ElizaChat/Application/res/values/template-dimens.xml32
-rw-r--r--samples/browseable/ElizaChat/Application/res/values/template-styles.xml42
-rw-r--r--samples/browseable/ElizaChat/Application/src/com.example.android.wearable.elizachat/ElizaResponder.java (renamed from samples/wearable/ElizaChat/Application/src/main/java/com/example/android/wearable/elizachat/ElizaResponder.java)0
-rw-r--r--samples/browseable/ElizaChat/Application/src/com.example.android.wearable.elizachat/MainActivity.java107
-rw-r--r--samples/browseable/ElizaChat/Application/src/com.example.android.wearable.elizachat/ResponderService.java (renamed from samples/wearable/ElizaChat/Application/src/main/java/com/example/android/wearable/elizachat/ResponderService.java)0
-rw-r--r--samples/browseable/ElizaChat/_index.jd12
-rw-r--r--samples/browseable/EmbeddedApp/Application/AndroidManifest.xml35
-rwxr-xr-xsamples/browseable/EmbeddedApp/Application/res/drawable-hdpi/ic_launcher.png (renamed from samples/wearable/EmbeddedApp/Application/src/main/res/drawable-hdpi/ic_launcher.png)bin4584 -> 4584 bytes
-rw-r--r--samples/browseable/EmbeddedApp/Application/res/drawable-hdpi/tile.9.pngbin0 -> 196 bytes
-rwxr-xr-xsamples/browseable/EmbeddedApp/Application/res/drawable-mdpi/ic_launcher.png (renamed from samples/wearable/EmbeddedApp/Application/src/main/res/drawable-mdpi/ic_launcher.png)bin2757 -> 2757 bytes
-rwxr-xr-xsamples/browseable/EmbeddedApp/Application/res/drawable-xhdpi/ic_launcher.png (renamed from samples/wearable/EmbeddedApp/Application/src/main/res/drawable-xhdpi/ic_launcher.png)bin6603 -> 6603 bytes
-rwxr-xr-xsamples/browseable/EmbeddedApp/Application/res/drawable-xxhdpi/ic_launcher.png (renamed from samples/wearable/EmbeddedApp/Application/src/main/res/drawable-xxhdpi/ic_launcher.png)bin11788 -> 11788 bytes
-rwxr-xr-xsamples/browseable/EmbeddedApp/Application/res/layout/activity_main.xml36
-rw-r--r--samples/browseable/EmbeddedApp/Application/res/layout/activity_phone.xml (renamed from samples/wearable/EmbeddedApp/Application/src/main/res/layout/activity_phone.xml)0
-rw-r--r--samples/browseable/EmbeddedApp/Application/res/values-sw600dp/template-dimens.xml24
-rw-r--r--samples/browseable/EmbeddedApp/Application/res/values-sw600dp/template-styles.xml25
-rw-r--r--samples/browseable/EmbeddedApp/Application/res/values-v11/template-styles.xml22
-rw-r--r--samples/browseable/EmbeddedApp/Application/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/EmbeddedApp/Application/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/EmbeddedApp/Application/res/values/base-strings.xml28
-rw-r--r--samples/browseable/EmbeddedApp/Application/res/values/dimens.xml (renamed from samples/wearable/EmbeddedApp/Application/src/main/res/values/dimens.xml)0
-rw-r--r--samples/browseable/EmbeddedApp/Application/res/values/strings.xml24
-rw-r--r--samples/browseable/EmbeddedApp/Application/res/values/template-dimens.xml32
-rw-r--r--samples/browseable/EmbeddedApp/Application/res/values/template-styles.xml42
-rw-r--r--samples/browseable/EmbeddedApp/Application/src/com.example.android.wearable.embeddedapp/PhoneActivity.java (renamed from samples/wearable/EmbeddedApp/Application/src/main/java/com/example/android/wearable/embeddedapp/PhoneActivity.java)0
-rw-r--r--samples/browseable/EmbeddedApp/Wearable/AndroidManifest.xml40
-rwxr-xr-xsamples/browseable/EmbeddedApp/Wearable/res/drawable-hdpi/ic_launcher.png (renamed from samples/wearable/EmbeddedApp/Wearable/src/main/res/drawable-hdpi/ic_launcher.png)bin4584 -> 4584 bytes
-rwxr-xr-xsamples/browseable/EmbeddedApp/Wearable/res/drawable-mdpi/ic_launcher.png (renamed from samples/wearable/EmbeddedApp/Wearable/src/main/res/drawable-mdpi/ic_launcher.png)bin2757 -> 2757 bytes
-rwxr-xr-xsamples/browseable/EmbeddedApp/Wearable/res/drawable-xhdpi/ic_launcher.png (renamed from samples/wearable/EmbeddedApp/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png)bin6603 -> 6603 bytes
-rwxr-xr-xsamples/browseable/EmbeddedApp/Wearable/res/drawable-xxhdpi/ic_launcher.png (renamed from samples/wearable/EmbeddedApp/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png)bin11788 -> 11788 bytes
-rw-r--r--samples/browseable/EmbeddedApp/Wearable/res/layout/activity_wearable.xml (renamed from samples/wearable/EmbeddedApp/Wearable/src/main/res/layout/activity_wearable.xml)0
-rw-r--r--samples/browseable/EmbeddedApp/Wearable/res/values/strings.xml (renamed from samples/wearable/EmbeddedApp/Wearable/src/main/res/values/strings.xml)0
-rw-r--r--samples/browseable/EmbeddedApp/Wearable/src/com.example.android.wearable.embeddedapp/WearableActivity.java (renamed from samples/wearable/EmbeddedApp/Wearable/src/main/java/com/example/android/wearable/embeddedapp/WearableActivity.java)0
-rw-r--r--samples/browseable/EmbeddedApp/_index.jd9
-rw-r--r--samples/browseable/FindMyPhone/Application/AndroidManifest.xml42
-rw-r--r--samples/browseable/FindMyPhone/Application/res/drawable-hdpi/ic_launcher.png (renamed from samples/wearable/FindMyPhone/Application/src/main/res/drawable-hdpi/ic_launcher.png)bin1000 -> 1000 bytes
-rw-r--r--samples/browseable/FindMyPhone/Application/res/drawable-hdpi/tile.9.pngbin0 -> 196 bytes
-rw-r--r--samples/browseable/FindMyPhone/Application/res/drawable-mdpi/ic_launcher.png (renamed from samples/wearable/FindMyPhone/Application/src/main/res/drawable-mdpi/ic_launcher.png)bin696 -> 696 bytes
-rw-r--r--samples/browseable/FindMyPhone/Application/res/drawable-xhdpi/ic_launcher.png (renamed from samples/wearable/FindMyPhone/Application/src/main/res/drawable-xhdpi/ic_launcher.png)bin1578 -> 1578 bytes
-rw-r--r--samples/browseable/FindMyPhone/Application/res/drawable-xxhdpi/ic_launcher.png (renamed from samples/wearable/FindMyPhone/Application/src/main/res/drawable-xxhdpi/ic_launcher.png)bin2975 -> 2975 bytes
-rwxr-xr-xsamples/browseable/FindMyPhone/Application/res/layout/activity_main.xml36
-rw-r--r--samples/browseable/FindMyPhone/Application/res/values-sw600dp/template-dimens.xml24
-rw-r--r--samples/browseable/FindMyPhone/Application/res/values-sw600dp/template-styles.xml25
-rw-r--r--samples/browseable/FindMyPhone/Application/res/values-v11/template-styles.xml22
-rw-r--r--samples/browseable/FindMyPhone/Application/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/FindMyPhone/Application/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/FindMyPhone/Application/res/values/base-strings.xml31
-rw-r--r--samples/browseable/FindMyPhone/Application/res/values/strings.xml18
-rw-r--r--samples/browseable/FindMyPhone/Application/res/values/template-dimens.xml32
-rw-r--r--samples/browseable/FindMyPhone/Application/res/values/template-styles.xml42
-rw-r--r--samples/browseable/FindMyPhone/Application/src/com.example.android.wearable.findphone/SoundAlarmListenerService.java (renamed from samples/wearable/FindMyPhone/Application/src/main/java/com/example/android/wearable/findphone/SoundAlarmListenerService.java)0
-rw-r--r--samples/browseable/FindMyPhone/Wearable/AndroidManifest.xml54
-rw-r--r--samples/browseable/FindMyPhone/Wearable/res/drawable-hdpi/alarm_action_icon.png (renamed from samples/wearable/FindMyPhone/Wearable/src/main/res/drawable-hdpi/alarm_action_icon.png)bin653 -> 653 bytes
-rw-r--r--samples/browseable/FindMyPhone/Wearable/res/drawable-hdpi/ic_launcher.png (renamed from samples/wearable/FindMyPhone/Wearable/src/main/res/drawable-hdpi/ic_launcher.png)bin1000 -> 1000 bytes
-rw-r--r--samples/browseable/FindMyPhone/Wearable/res/drawable-mdpi/ic_launcher.png (renamed from samples/wearable/FindMyPhone/Wearable/src/main/res/drawable-mdpi/ic_launcher.png)bin696 -> 696 bytes
-rw-r--r--samples/browseable/FindMyPhone/Wearable/res/drawable-xhdpi/ic_launcher.png (renamed from samples/wearable/FindMyPhone/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png)bin1578 -> 1578 bytes
-rw-r--r--samples/browseable/FindMyPhone/Wearable/res/drawable-xxhdpi/ic_launcher.png (renamed from samples/wearable/FindMyPhone/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png)bin2975 -> 2975 bytes
-rw-r--r--samples/browseable/FindMyPhone/Wearable/res/values/strings.xml (renamed from samples/wearable/FindMyPhone/Wearable/src/main/res/values/strings.xml)0
-rw-r--r--samples/browseable/FindMyPhone/Wearable/src/com.example.android.wearable.findphone/DisconnectListenerService.java (renamed from samples/wearable/FindMyPhone/Wearable/src/main/java/com/example/android/wearable/findphone/DisconnectListenerService.java)0
-rw-r--r--samples/browseable/FindMyPhone/Wearable/src/com.example.android.wearable.findphone/FindPhoneActivity.java (renamed from samples/wearable/FindMyPhone/Wearable/src/main/java/com/example/android/wearable/findphone/FindPhoneActivity.java)0
-rw-r--r--samples/browseable/FindMyPhone/Wearable/src/com.example.android.wearable.findphone/FindPhoneService.java (renamed from samples/wearable/FindMyPhone/Wearable/src/main/java/com/example/android/wearable/findphone/FindPhoneService.java)0
-rw-r--r--samples/browseable/FindMyPhone/_index.jd12
-rw-r--r--samples/browseable/Flashlight/Application/AndroidManifest.xml30
-rwxr-xr-xsamples/browseable/Flashlight/Application/res/drawable-hdpi/ic_launcher.png (renamed from samples/wearable/Flashlight/Wearable/src/main/res/drawable-hdpi/ic_launcher.png)bin4584 -> 4584 bytes
-rw-r--r--samples/browseable/Flashlight/Application/res/drawable-hdpi/tile.9.pngbin0 -> 196 bytes
-rwxr-xr-xsamples/browseable/Flashlight/Application/res/drawable-mdpi/ic_launcher.png (renamed from samples/wearable/Flashlight/Wearable/src/main/res/drawable-mdpi/ic_launcher.png)bin2757 -> 2757 bytes
-rwxr-xr-xsamples/browseable/Flashlight/Application/res/drawable-xhdpi/ic_launcher.png (renamed from samples/wearable/Flashlight/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png)bin6603 -> 6603 bytes
-rwxr-xr-xsamples/browseable/Flashlight/Application/res/drawable-xxhdpi/ic_launcher.png (renamed from samples/wearable/Flashlight/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png)bin11788 -> 11788 bytes
-rwxr-xr-xsamples/browseable/Flashlight/Application/res/layout/activity_main.xml36
-rw-r--r--samples/browseable/Flashlight/Application/res/values-sw600dp/template-dimens.xml24
-rw-r--r--samples/browseable/Flashlight/Application/res/values-sw600dp/template-styles.xml25
-rw-r--r--samples/browseable/Flashlight/Application/res/values-v11/template-styles.xml22
-rw-r--r--samples/browseable/Flashlight/Application/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/Flashlight/Application/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/Flashlight/Application/res/values/base-strings.xml29
-rw-r--r--samples/browseable/Flashlight/Application/res/values/template-dimens.xml32
-rw-r--r--samples/browseable/Flashlight/Application/res/values/template-styles.xml42
-rw-r--r--samples/browseable/Flashlight/Application/src/com.example.android.common/activities/SampleActivityBase.java52
-rw-r--r--samples/browseable/Flashlight/Application/src/com.example.android.common/logger/Log.java236
-rw-r--r--samples/browseable/Flashlight/Application/src/com.example.android.common/logger/LogFragment.java109
-rw-r--r--samples/browseable/Flashlight/Application/src/com.example.android.common/logger/LogNode.java39
-rw-r--r--samples/browseable/Flashlight/Application/src/com.example.android.common/logger/LogView.java145
-rw-r--r--samples/browseable/Flashlight/Application/src/com.example.android.common/logger/LogWrapper.java75
-rw-r--r--samples/browseable/Flashlight/Application/src/com.example.android.common/logger/MessageOnlyLogFilter.java60
-rw-r--r--samples/browseable/Flashlight/Wearable/AndroidManifest.xml40
-rwxr-xr-x[-rw-r--r--]samples/browseable/Flashlight/Wearable/res/drawable-hdpi/ic_launcher.png (renamed from samples/wearable/GridViewPager/Wearable/src/main/res/drawable-hdpi/ic_launcher.png)bin4584 -> 4584 bytes
-rwxr-xr-x[-rw-r--r--]samples/browseable/Flashlight/Wearable/res/drawable-mdpi/ic_launcher.png (renamed from samples/wearable/GridViewPager/Wearable/src/main/res/drawable-mdpi/ic_launcher.png)bin2757 -> 2757 bytes
-rwxr-xr-x[-rw-r--r--]samples/browseable/Flashlight/Wearable/res/drawable-xhdpi/ic_launcher.png (renamed from samples/wearable/GridViewPager/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png)bin6603 -> 6603 bytes
-rwxr-xr-xsamples/browseable/Flashlight/Wearable/res/drawable-xxhdpi/ic_launcher.png (renamed from samples/wearable/GridViewPager/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png)bin11788 -> 11788 bytes
-rw-r--r--samples/browseable/Flashlight/Wearable/res/layout/main.xml (renamed from samples/wearable/Flashlight/Wearable/src/main/res/layout/main.xml)0
-rw-r--r--samples/browseable/Flashlight/Wearable/res/layout/party_light.xml (renamed from samples/wearable/Flashlight/Wearable/src/main/res/layout/party_light.xml)0
-rw-r--r--samples/browseable/Flashlight/Wearable/res/layout/white_light.xml (renamed from samples/wearable/Flashlight/Wearable/src/main/res/layout/white_light.xml)0
-rw-r--r--samples/browseable/Flashlight/Wearable/res/values/strings.xml (renamed from samples/wearable/Flashlight/Wearable/src/main/res/values/strings.xml)0
-rw-r--r--samples/browseable/Flashlight/Wearable/src/com.example.android.wearable.flashlight/MainActivity.java (renamed from samples/wearable/Flashlight/Wearable/src/main/java/com/example/android/wearable/flashlight/MainActivity.java)0
-rw-r--r--samples/browseable/Flashlight/Wearable/src/com.example.android.wearable.flashlight/PartyLightView.java (renamed from samples/wearable/Flashlight/Wearable/src/main/java/com/example/android/wearable/flashlight/PartyLightView.java)0
-rw-r--r--samples/browseable/Flashlight/_index.jd10
-rw-r--r--samples/browseable/FloatingActionButtonBasic/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/FloatingActionButtonBasic/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/FloatingActionButtonBasic/res/values-v21/template-styles.xml22
-rw-r--r--samples/browseable/FloatingActionButtonBasic/res/values/dimens.xml4
-rw-r--r--samples/browseable/FragmentTransition/AndroidManifest.xml2
-rw-r--r--samples/browseable/FragmentTransition/_index.jd9
-rw-r--r--samples/browseable/FragmentTransition/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/FragmentTransition/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/FragmentTransition/res/values/base-strings.xml3
-rw-r--r--[-rwxr-xr-x]samples/browseable/FragmentTransition/res/values/strings.xml0
-rw-r--r--samples/browseable/FragmentTransition/src/com.example.android.fragmenttransition/MainActivity.java13
-rw-r--r--samples/browseable/Geofencing/Application/AndroidManifest.xml51
-rw-r--r--samples/browseable/Geofencing/Application/res/drawable-hdpi/ic_launcher.png (renamed from samples/wearable/Geofencing/Application/src/main/res/drawable-hdpi/ic_launcher.png)bin507 -> 507 bytes
-rw-r--r--samples/browseable/Geofencing/Application/res/drawable-hdpi/tile.9.pngbin0 -> 196 bytes
-rw-r--r--samples/browseable/Geofencing/Application/res/drawable-mdpi/ic_launcher.png (renamed from samples/wearable/Geofencing/Application/src/main/res/drawable-mdpi/ic_launcher.png)bin580 -> 580 bytes
-rw-r--r--samples/browseable/Geofencing/Application/res/drawable-xhdpi/ic_launcher.png (renamed from samples/wearable/Geofencing/Application/src/main/res/drawable-xhdpi/ic_launcher.png)bin874 -> 874 bytes
-rw-r--r--samples/browseable/Geofencing/Application/res/drawable-xxhdpi/ic_launcher.png (renamed from samples/wearable/Geofencing/Application/src/main/res/drawable-xxhdpi/ic_launcher.png)bin1703 -> 1703 bytes
-rwxr-xr-xsamples/browseable/Geofencing/Application/res/layout/activity_main.xml36
-rw-r--r--samples/browseable/Geofencing/Application/res/values-sw600dp/template-dimens.xml24
-rw-r--r--samples/browseable/Geofencing/Application/res/values-sw600dp/template-styles.xml25
-rw-r--r--samples/browseable/Geofencing/Application/res/values-v11/template-styles.xml22
-rw-r--r--samples/browseable/Geofencing/Application/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/Geofencing/Application/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/Geofencing/Application/res/values/base-strings.xml31
-rw-r--r--samples/browseable/Geofencing/Application/res/values/strings.xml21
-rw-r--r--samples/browseable/Geofencing/Application/res/values/template-dimens.xml32
-rw-r--r--samples/browseable/Geofencing/Application/res/values/template-styles.xml42
-rw-r--r--samples/browseable/Geofencing/Application/src/com.example.android.wearable.geofencing/Constants.java (renamed from samples/wearable/Geofencing/Application/src/main/java/com/example/android/wearable/geofencing/Constants.java)0
-rw-r--r--samples/browseable/Geofencing/Application/src/com.example.android.wearable.geofencing/GeofenceTransitionsIntentService.java122
-rw-r--r--samples/browseable/Geofencing/Application/src/com.example.android.wearable.geofencing/MainActivity.java198
-rw-r--r--samples/browseable/Geofencing/Application/src/com.example.android.wearable.geofencing/SimpleGeofence.java (renamed from samples/wearable/Geofencing/Application/src/main/java/com/example/android/wearable/geofencing/SimpleGeofence.java)0
-rw-r--r--samples/browseable/Geofencing/Application/src/com.example.android.wearable.geofencing/SimpleGeofenceStore.java (renamed from samples/wearable/Geofencing/Application/src/main/java/com/example/android/wearable/geofencing/SimpleGeofenceStore.java)0
-rw-r--r--samples/browseable/Geofencing/Wearable/AndroidManifest.xml44
-rw-r--r--samples/browseable/Geofencing/Wearable/res/drawable-hdpi/ic_action_check_in.png (renamed from samples/wearable/Geofencing/Wearable/src/main/res/drawable-hdpi/ic_action_check_in.png)bin903 -> 903 bytes
-rw-r--r--samples/browseable/Geofencing/Wearable/res/drawable-hdpi/ic_launcher.png (renamed from samples/wearable/Geofencing/Wearable/src/main/res/drawable-hdpi/ic_launcher.png)bin507 -> 507 bytes
-rw-r--r--samples/browseable/Geofencing/Wearable/res/drawable-mdpi/ic_launcher.png (renamed from samples/wearable/Geofencing/Wearable/src/main/res/drawable-mdpi/ic_launcher.png)bin580 -> 580 bytes
-rw-r--r--samples/browseable/Geofencing/Wearable/res/drawable-nodpi/android_building.png (renamed from samples/wearable/Geofencing/Wearable/src/main/res/drawable-nodpi/android_building.png)bin535862 -> 535862 bytes
-rw-r--r--samples/browseable/Geofencing/Wearable/res/drawable-nodpi/yerba_buena.png (renamed from samples/wearable/Geofencing/Wearable/src/main/res/drawable-nodpi/yerba_buena.png)bin242342 -> 242342 bytes
-rw-r--r--samples/browseable/Geofencing/Wearable/res/drawable-xhdpi/ic_launcher.png (renamed from samples/wearable/Geofencing/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png)bin874 -> 874 bytes
-rw-r--r--samples/browseable/Geofencing/Wearable/res/drawable-xxhdpi/ic_launcher.png (renamed from samples/wearable/Geofencing/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png)bin1703 -> 1703 bytes
-rw-r--r--samples/browseable/Geofencing/Wearable/res/values/strings.xml (renamed from samples/wearable/Geofencing/Wearable/src/main/res/values/strings.xml)0
-rw-r--r--samples/browseable/Geofencing/Wearable/src/com.example.android.wearable.geofencing/CheckInAndDeleteDataItemsService.java (renamed from samples/wearable/Geofencing/Wearable/src/main/java/com/example/android/wearable/geofencing/CheckInAndDeleteDataItemsService.java)0
-rw-r--r--samples/browseable/Geofencing/Wearable/src/com.example.android.wearable.geofencing/Constants.java (renamed from samples/wearable/Geofencing/Wearable/src/main/java/com/example/android/wearable/geofencing/Constants.java)0
-rw-r--r--samples/browseable/Geofencing/Wearable/src/com.example.android.wearable.geofencing/HomeListenerService.java (renamed from samples/wearable/Geofencing/Wearable/src/main/java/com/example/android/wearable/geofencing/HomeListenerService.java)0
-rw-r--r--samples/browseable/Geofencing/_index.jd12
-rw-r--r--samples/browseable/GridViewPager/Application/AndroidManifest.xml30
-rwxr-xr-xsamples/browseable/GridViewPager/Application/res/drawable-hdpi/ic_launcher.png (renamed from samples/wearable/SkeletonWearableApp/Wearable/src/main/res/drawable-hdpi/ic_launcher.png)bin4584 -> 4584 bytes
-rw-r--r--samples/browseable/GridViewPager/Application/res/drawable-hdpi/tile.9.pngbin0 -> 196 bytes
-rwxr-xr-xsamples/browseable/GridViewPager/Application/res/drawable-mdpi/ic_launcher.png (renamed from samples/wearable/SkeletonWearableApp/Wearable/src/main/res/drawable-mdpi/ic_launcher.png)bin2757 -> 2757 bytes
-rwxr-xr-xsamples/browseable/GridViewPager/Application/res/drawable-xhdpi/ic_launcher.png (renamed from samples/wearable/SkeletonWearableApp/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png)bin6603 -> 6603 bytes
-rwxr-xr-xsamples/browseable/GridViewPager/Application/res/drawable-xxhdpi/ic_launcher.png (renamed from samples/wearable/SkeletonWearableApp/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png)bin11788 -> 11788 bytes
-rwxr-xr-xsamples/browseable/GridViewPager/Application/res/layout/activity_main.xml36
-rw-r--r--samples/browseable/GridViewPager/Application/res/values-sw600dp/template-dimens.xml24
-rw-r--r--samples/browseable/GridViewPager/Application/res/values-sw600dp/template-styles.xml25
-rw-r--r--samples/browseable/GridViewPager/Application/res/values-v11/template-styles.xml22
-rw-r--r--samples/browseable/GridViewPager/Application/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/GridViewPager/Application/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/GridViewPager/Application/res/values/base-strings.xml28
-rw-r--r--samples/browseable/GridViewPager/Application/res/values/template-dimens.xml32
-rw-r--r--samples/browseable/GridViewPager/Application/res/values/template-styles.xml42
-rw-r--r--samples/browseable/GridViewPager/Wearable/AndroidManifest.xml40
-rw-r--r--samples/browseable/GridViewPager/Wearable/res/drawable-hdpi/bugdroid.png (renamed from samples/wearable/GridViewPager/Wearable/src/main/res/drawable-hdpi/bugdroid.png)bin3739 -> 3739 bytes
-rw-r--r--[-rwxr-xr-x]samples/browseable/GridViewPager/Wearable/res/drawable-hdpi/ic_launcher.png (renamed from samples/wearable/WatchViewStub/Wearable/src/main/res/drawable-hdpi/ic_launcher.png)bin4584 -> 4584 bytes
-rw-r--r--samples/browseable/GridViewPager/Wearable/res/drawable-hdpi/ic_swipe_arrow_left.png (renamed from samples/wearable/GridViewPager/Wearable/src/main/res/drawable-hdpi/ic_swipe_arrow_left.png)bin1253 -> 1253 bytes
-rw-r--r--samples/browseable/GridViewPager/Wearable/res/drawable-hdpi/ic_swipe_arrow_right.png (renamed from samples/wearable/GridViewPager/Wearable/src/main/res/drawable-hdpi/ic_swipe_arrow_right.png)bin1244 -> 1244 bytes
-rw-r--r--samples/browseable/GridViewPager/Wearable/res/drawable-hdpi/ic_swipe_arrow_up.png (renamed from samples/wearable/GridViewPager/Wearable/src/main/res/drawable-hdpi/ic_swipe_arrow_up.png)bin1583 -> 1583 bytes
-rw-r--r--samples/browseable/GridViewPager/Wearable/res/drawable-mdpi/bugdroid.png (renamed from samples/wearable/GridViewPager/Wearable/src/main/res/drawable-mdpi/bugdroid.png)bin3357 -> 3357 bytes
-rw-r--r--[-rwxr-xr-x]samples/browseable/GridViewPager/Wearable/res/drawable-mdpi/ic_launcher.png (renamed from samples/wearable/WatchViewStub/Wearable/src/main/res/drawable-mdpi/ic_launcher.png)bin2757 -> 2757 bytes
-rw-r--r--samples/browseable/GridViewPager/Wearable/res/drawable-mdpi/ic_swipe_arrow_left.png (renamed from samples/wearable/GridViewPager/Wearable/src/main/res/drawable-mdpi/ic_swipe_arrow_left.png)bin844 -> 844 bytes
-rw-r--r--samples/browseable/GridViewPager/Wearable/res/drawable-mdpi/ic_swipe_arrow_right.png (renamed from samples/wearable/GridViewPager/Wearable/src/main/res/drawable-mdpi/ic_swipe_arrow_right.png)bin831 -> 831 bytes
-rw-r--r--samples/browseable/GridViewPager/Wearable/res/drawable-mdpi/ic_swipe_arrow_up.png (renamed from samples/wearable/GridViewPager/Wearable/src/main/res/drawable-mdpi/ic_swipe_arrow_up.png)bin1127 -> 1127 bytes
-rw-r--r--samples/browseable/GridViewPager/Wearable/res/drawable-nodpi/bugdroid_large.pngbin0 -> 10089 bytes
-rw-r--r--[-rwxr-xr-x]samples/browseable/GridViewPager/Wearable/res/drawable-xhdpi/ic_launcher.png (renamed from samples/wearable/WatchViewStub/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png)bin6603 -> 6603 bytes
-rw-r--r--samples/browseable/GridViewPager/Wearable/res/drawable-xhdpi/ic_swipe_arrow_left.png (renamed from samples/wearable/GridViewPager/Wearable/src/main/res/drawable-xhdpi/ic_swipe_arrow_left.png)bin556 -> 556 bytes
-rw-r--r--samples/browseable/GridViewPager/Wearable/res/drawable-xhdpi/ic_swipe_arrow_right.png (renamed from samples/wearable/GridViewPager/Wearable/src/main/res/drawable-xhdpi/ic_swipe_arrow_right.png)bin520 -> 520 bytes
-rw-r--r--samples/browseable/GridViewPager/Wearable/res/drawable-xhdpi/ic_swipe_arrow_up.png (renamed from samples/wearable/GridViewPager/Wearable/src/main/res/drawable-xhdpi/ic_swipe_arrow_up.png)bin710 -> 710 bytes
-rwxr-xr-xsamples/browseable/GridViewPager/Wearable/res/drawable-xxhdpi/ic_launcher.png (renamed from samples/wearable/WatchViewStub/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png)bin11788 -> 11788 bytes
-rw-r--r--samples/browseable/GridViewPager/Wearable/res/drawable/debug_background_1.png (renamed from samples/wearable/GridViewPager/Wearable/src/main/res/drawable/debug_background_1.png)bin284197 -> 284197 bytes
-rw-r--r--samples/browseable/GridViewPager/Wearable/res/drawable/debug_background_2.png (renamed from samples/wearable/GridViewPager/Wearable/src/main/res/drawable/debug_background_2.png)bin120042 -> 120042 bytes
-rw-r--r--samples/browseable/GridViewPager/Wearable/res/drawable/debug_background_3.png (renamed from samples/wearable/GridViewPager/Wearable/src/main/res/drawable/debug_background_3.png)bin244132 -> 244132 bytes
-rw-r--r--samples/browseable/GridViewPager/Wearable/res/drawable/debug_background_4.png (renamed from samples/wearable/GridViewPager/Wearable/src/main/res/drawable/debug_background_4.png)bin146796 -> 146796 bytes
-rw-r--r--samples/browseable/GridViewPager/Wearable/res/drawable/debug_background_5.png (renamed from samples/wearable/GridViewPager/Wearable/src/main/res/drawable/debug_background_5.png)bin117080 -> 117080 bytes
-rw-r--r--samples/browseable/GridViewPager/Wearable/res/drawable/gradient.xml27
-rw-r--r--samples/browseable/GridViewPager/Wearable/res/drawable/shape.xml34
-rw-r--r--samples/browseable/GridViewPager/Wearable/res/layout/activity_main.xml33
-rw-r--r--samples/browseable/GridViewPager/Wearable/res/layout/custom_fragment.xml31
-rw-r--r--samples/browseable/GridViewPager/Wearable/res/values/dimens.xml22
-rw-r--r--samples/browseable/GridViewPager/Wearable/res/values/strings.xml42
-rw-r--r--samples/browseable/GridViewPager/Wearable/src/com.example.android.wearable.gridviewpager/CustomFragment.java32
-rw-r--r--samples/browseable/GridViewPager/Wearable/src/com.example.android.wearable.gridviewpager/MainActivity.java59
-rw-r--r--samples/browseable/GridViewPager/Wearable/src/com.example.android.wearable.gridviewpager/SampleGridPagerAdapter.java198
-rw-r--r--samples/browseable/GridViewPager/_index.jd9
-rw-r--r--samples/browseable/HdrViewfinder/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/HdrViewfinder/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/HdrViewfinder/res/values-v21/template-styles.xml22
-rw-r--r--samples/browseable/HorizontalPaging/AndroidManifest.xml4
-rw-r--r--samples/browseable/HorizontalPaging/_index.jd12
-rw-r--r--[-rwxr-xr-x]samples/browseable/HorizontalPaging/res/drawable-hdpi/ic_launcher.pngbin9397 -> 4135 bytes
-rw-r--r--[-rwxr-xr-x]samples/browseable/HorizontalPaging/res/drawable-mdpi/ic_launcher.pngbin5237 -> 2492 bytes
-rw-r--r--[-rwxr-xr-x]samples/browseable/HorizontalPaging/res/drawable-xhdpi/ic_launcher.pngbin14383 -> 5828 bytes
-rw-r--r--samples/browseable/HorizontalPaging/res/drawable-xxhdpi/ic_launcher.pngbin0 -> 10533 bytes
-rw-r--r--samples/browseable/HorizontalPaging/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/HorizontalPaging/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/HorizontalPaging/res/values/base-strings.xml3
-rw-r--r--samples/browseable/ImmersiveMode/AndroidManifest.xml2
-rw-r--r--samples/browseable/ImmersiveMode/_index.jd15
-rw-r--r--samples/browseable/ImmersiveMode/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/ImmersiveMode/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/ImmersiveMode/res/values/base-strings.xml3
-rw-r--r--samples/browseable/ImmersiveMode/res/values/strings.xml3
-rw-r--r--samples/browseable/ImmersiveMode/src/com.example.android.immersivemode/MainActivity.java3
-rw-r--r--samples/browseable/Interpolator/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/Interpolator/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/Interpolator/res/values-v21/template-styles.xml22
-rw-r--r--samples/browseable/JobScheduler/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/JobScheduler/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/JobScheduler/res/values-v21/template-styles.xml22
-rw-r--r--samples/browseable/JobScheduler/src/com.example.android.jobscheduler/MainActivity.java4
-rw-r--r--samples/browseable/JumpingJack/Application/AndroidManifest.xml31
-rwxr-xr-xsamples/browseable/JumpingJack/Application/res/drawable-hdpi/ic_launcher.pngbin0 -> 4584 bytes
-rw-r--r--samples/browseable/JumpingJack/Application/res/drawable-hdpi/tile.9.pngbin0 -> 196 bytes
-rwxr-xr-xsamples/browseable/JumpingJack/Application/res/drawable-mdpi/ic_launcher.pngbin0 -> 2757 bytes
-rwxr-xr-xsamples/browseable/JumpingJack/Application/res/drawable-xhdpi/ic_launcher.pngbin0 -> 6603 bytes
-rw-r--r--samples/browseable/JumpingJack/Application/res/drawable-xxhdpi/ic_launcher.pngbin0 -> 11788 bytes
-rwxr-xr-xsamples/browseable/JumpingJack/Application/res/layout/activity_main.xml36
-rw-r--r--samples/browseable/JumpingJack/Application/res/values-sw600dp/template-dimens.xml24
-rw-r--r--samples/browseable/JumpingJack/Application/res/values-sw600dp/template-styles.xml25
-rw-r--r--samples/browseable/JumpingJack/Application/res/values-v11/template-styles.xml22
-rw-r--r--samples/browseable/JumpingJack/Application/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/JumpingJack/Application/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/JumpingJack/Application/res/values/base-strings.xml28
-rw-r--r--samples/browseable/JumpingJack/Application/res/values/template-dimens.xml32
-rw-r--r--samples/browseable/JumpingJack/Application/res/values/template-styles.xml42
-rw-r--r--samples/browseable/JumpingJack/Application/src/com.example.android.common/activities/SampleActivityBase.java52
-rw-r--r--samples/browseable/JumpingJack/Application/src/com.example.android.common/logger/Log.java236
-rw-r--r--samples/browseable/JumpingJack/Application/src/com.example.android.common/logger/LogFragment.java109
-rw-r--r--samples/browseable/JumpingJack/Application/src/com.example.android.common/logger/LogNode.java39
-rw-r--r--samples/browseable/JumpingJack/Application/src/com.example.android.common/logger/LogView.java145
-rw-r--r--samples/browseable/JumpingJack/Application/src/com.example.android.common/logger/LogWrapper.java75
-rw-r--r--samples/browseable/JumpingJack/Application/src/com.example.android.common/logger/MessageOnlyLogFilter.java60
-rw-r--r--samples/browseable/JumpingJack/Wearable/AndroidManifest.xml42
-rw-r--r--samples/browseable/JumpingJack/Wearable/res/drawable-hdpi/btn_reset_normal_200.png (renamed from samples/wearable/JumpingJack/Wearable/src/main/res/drawable-hdpi/btn_reset_normal_200.png)bin6323 -> 6323 bytes
-rw-r--r--samples/browseable/JumpingJack/Wearable/res/drawable-hdpi/btn_reset_pressed_200.png (renamed from samples/wearable/JumpingJack/Wearable/src/main/res/drawable-hdpi/btn_reset_pressed_200.png)bin7100 -> 7100 bytes
-rw-r--r--samples/browseable/JumpingJack/Wearable/res/drawable-hdpi/ic_launcher.png (renamed from samples/wearable/JumpingJack/Wearable/src/main/res/drawable-hdpi/ic_launcher.png)bin4258 -> 4258 bytes
-rw-r--r--samples/browseable/JumpingJack/Wearable/res/drawable-mdpi/ic_launcher.png (renamed from samples/wearable/JumpingJack/Wearable/src/main/res/drawable-mdpi/ic_launcher.png)bin2451 -> 2451 bytes
-rw-r--r--samples/browseable/JumpingJack/Wearable/res/drawable-xhdpi/ic_launcher.png (renamed from samples/wearable/JumpingJack/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png)bin6239 -> 6239 bytes
-rw-r--r--samples/browseable/JumpingJack/Wearable/res/drawable-xxhdpi/ic_launcher.png (renamed from samples/wearable/JumpingJack/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png)bin10489 -> 10489 bytes
-rw-r--r--samples/browseable/JumpingJack/Wearable/res/drawable-xxxhdpi/ic_launcher.png (renamed from samples/wearable/JumpingJack/Wearable/src/main/res/drawable-xxxhdpi/ic_launcher.png)bin15228 -> 15228 bytes
-rw-r--r--samples/browseable/JumpingJack/Wearable/res/drawable/empty_10.png (renamed from samples/wearable/JumpingJack/Wearable/src/main/res/drawable/empty_10.png)bin252 -> 252 bytes
-rw-r--r--samples/browseable/JumpingJack/Wearable/res/drawable/full_10.png (renamed from samples/wearable/JumpingJack/Wearable/src/main/res/drawable/full_10.png)bin307 -> 307 bytes
-rw-r--r--samples/browseable/JumpingJack/Wearable/res/drawable/jump_down_50.png (renamed from samples/wearable/JumpingJack/Wearable/src/main/res/drawable/jump_down_50.png)bin558 -> 558 bytes
-rw-r--r--samples/browseable/JumpingJack/Wearable/res/drawable/jump_up_50.png (renamed from samples/wearable/JumpingJack/Wearable/src/main/res/drawable/jump_up_50.png)bin751 -> 751 bytes
-rw-r--r--samples/browseable/JumpingJack/Wearable/res/drawable/submit_button.xml (renamed from samples/wearable/JumpingJack/Wearable/src/main/res/drawable/submit_button.xml)0
-rw-r--r--samples/browseable/JumpingJack/Wearable/res/layout/counter_layout.xml (renamed from samples/wearable/JumpingJack/Wearable/src/main/res/layout/counter_layout.xml)0
-rw-r--r--samples/browseable/JumpingJack/Wearable/res/layout/jj_layout.xml (renamed from samples/wearable/JumpingJack/Wearable/src/main/res/layout/jj_layout.xml)0
-rw-r--r--samples/browseable/JumpingJack/Wearable/res/layout/setting_layout.xml (renamed from samples/wearable/JumpingJack/Wearable/src/main/res/layout/setting_layout.xml)0
-rw-r--r--samples/browseable/JumpingJack/Wearable/res/values/colors.xml (renamed from samples/wearable/JumpingJack/Wearable/src/main/res/values/colors.xml)0
-rw-r--r--samples/browseable/JumpingJack/Wearable/res/values/dimens.xml (renamed from samples/wearable/JumpingJack/Wearable/src/main/res/values/dimens.xml)0
-rw-r--r--samples/browseable/JumpingJack/Wearable/res/values/strings.xml (renamed from samples/wearable/JumpingJack/Wearable/src/main/res/values/strings.xml)0
-rw-r--r--samples/browseable/JumpingJack/Wearable/src/com.example.android.wearable.jumpingjack/MainActivity.java257
-rw-r--r--samples/browseable/JumpingJack/Wearable/src/com.example.android.wearable.jumpingjack/PagerAdapter.java (renamed from samples/wearable/JumpingJack/Wearable/src/main/java/com/example/android/wearable/jumpingjack/PagerAdapter.java)0
-rw-r--r--samples/browseable/JumpingJack/Wearable/src/com.example.android.wearable.jumpingjack/Utils.java (renamed from samples/wearable/JumpingJack/Wearable/src/main/java/com/example/android/wearable/jumpingjack/Utils.java)0
-rw-r--r--samples/browseable/JumpingJack/Wearable/src/com.example.android.wearable.jumpingjack/fragments/CounterFragment.java (renamed from samples/wearable/JumpingJack/Wearable/src/main/java/com/example/android/wearable/jumpingjack/fragments/CounterFragment.java)0
-rw-r--r--samples/browseable/JumpingJack/Wearable/src/com.example.android.wearable.jumpingjack/fragments/SettingsFragment.java48
-rw-r--r--samples/browseable/JumpingJack/_index.jd9
-rw-r--r--samples/browseable/LNotifications/_index.jd2
-rw-r--r--samples/browseable/LNotifications/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/LNotifications/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/LNotifications/res/values-v21/template-styles.xml22
-rw-r--r--samples/browseable/MediaBrowserService/AndroidManifest.xml65
-rw-r--r--samples/browseable/MediaBrowserService/_index.jd17
-rw-r--r--samples/browseable/MediaBrowserService/res/drawable-hdpi/ic_launcher.pngbin0 -> 2051 bytes
-rw-r--r--samples/browseable/MediaBrowserService/res/drawable-hdpi/ic_notification.pngbin0 -> 4163 bytes
-rw-r--r--samples/browseable/MediaBrowserService/res/drawable-hdpi/ic_pause_white_24dp.pngbin0 -> 188 bytes
-rw-r--r--samples/browseable/MediaBrowserService/res/drawable-hdpi/ic_play_arrow_white_24dp.pngbin0 -> 282 bytes
-rw-r--r--samples/browseable/MediaBrowserService/res/drawable-hdpi/ic_shuffle_white_24dp.pngbin0 -> 458 bytes
-rw-r--r--samples/browseable/MediaBrowserService/res/drawable-hdpi/ic_skip_next_white_24dp.pngbin0 -> 291 bytes
-rw-r--r--samples/browseable/MediaBrowserService/res/drawable-hdpi/ic_skip_previous_white_24dp.pngbin0 -> 306 bytes
-rw-r--r--samples/browseable/MediaBrowserService/res/drawable-mdpi/ic_launcher.pngbin0 -> 1545 bytes
-rw-r--r--samples/browseable/MediaBrowserService/res/drawable-xhdpi/ic_equalizer_white_24dp.pngbin0 -> 207 bytes
-rw-r--r--samples/browseable/MediaBrowserService/res/drawable-xhdpi/ic_launcher.pngbin0 -> 2838 bytes
-rw-r--r--samples/browseable/MediaBrowserService/res/drawable-xhdpi/ic_pause_white_24dp.pngbin0 -> 193 bytes
-rw-r--r--samples/browseable/MediaBrowserService/res/drawable-xhdpi/ic_play_arrow_white_24dp.pngbin0 -> 318 bytes
-rw-r--r--samples/browseable/MediaBrowserService/res/drawable-xhdpi/ic_shuffle_white_24dp.pngbin0 -> 481 bytes
-rw-r--r--samples/browseable/MediaBrowserService/res/drawable-xhdpi/ic_skip_next_white_24dp.pngbin0 -> 326 bytes
-rw-r--r--samples/browseable/MediaBrowserService/res/drawable-xhdpi/ic_skip_previous_white_24dp.pngbin0 -> 354 bytes
-rw-r--r--samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_by_genre.pngbin0 -> 1562 bytes
-rw-r--r--samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_default_art.pngbin0 -> 1593 bytes
-rw-r--r--samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_equalizer_white_24dp.pngbin0 -> 265 bytes
-rw-r--r--samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_launcher.pngbin0 -> 4437 bytes
-rw-r--r--samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_pause_white_24dp.pngbin0 -> 215 bytes
-rw-r--r--samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_play_arrow_white_24dp.pngbin0 -> 399 bytes
-rw-r--r--samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_shuffle_white_24dp.pngbin0 -> 830 bytes
-rw-r--r--samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_skip_next_white_24dp.pngbin0 -> 408 bytes
-rw-r--r--samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_skip_previous_white_24dp.pngbin0 -> 447 bytes
-rw-r--r--samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_star_off.pngbin0 -> 4835 bytes
-rw-r--r--samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_star_on.pngbin0 -> 3309 bytes
-rw-r--r--samples/browseable/MediaBrowserService/res/drawable-xxxhdpi/ic_launcher.pngbin0 -> 5982 bytes
-rw-r--r--samples/browseable/MediaBrowserService/res/layout/activity_player.xml22
-rw-r--r--samples/browseable/MediaBrowserService/res/layout/fragment_list.xml60
-rw-r--r--samples/browseable/MediaBrowserService/res/layout/media_list_item.xml55
-rw-r--r--samples/browseable/MediaBrowserService/res/values-v21/styles.xml33
-rw-r--r--samples/browseable/MediaBrowserService/res/values/dimens.xml21
-rw-r--r--samples/browseable/MediaBrowserService/res/values/strings.xml33
-rw-r--r--samples/browseable/MediaBrowserService/res/values/strings_notifications.xml24
-rw-r--r--samples/browseable/MediaBrowserService/res/values/styles.xml26
-rw-r--r--samples/browseable/MediaBrowserService/res/xml/automotive_app_desc.xml19
-rw-r--r--samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/BrowseFragment.java210
-rw-r--r--samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/MediaNotification.java381
-rw-r--r--samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/MusicPlayerActivity.java57
-rw-r--r--samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/MusicService.java947
-rw-r--r--samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/PackageValidator.java216
-rw-r--r--samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/QueueAdapter.java82
-rw-r--r--samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/QueueFragment.java295
-rw-r--r--samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/model/MusicProvider.java296
-rw-r--r--samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/utils/BitmapHelper.java77
-rw-r--r--samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/utils/LogHelper.java67
-rw-r--r--samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/utils/MediaIDHelper.java88
-rw-r--r--samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/utils/QueueHelper.java129
-rw-r--r--samples/browseable/MediaEffects/AndroidManifest.xml43
-rw-r--r--samples/browseable/MediaEffects/_index.jd12
-rw-r--r--samples/browseable/MediaEffects/res/drawable-hdpi/ic_launcher.pngbin0 -> 4360 bytes
-rw-r--r--samples/browseable/MediaEffects/res/drawable-hdpi/tile.9.pngbin0 -> 196 bytes
-rw-r--r--samples/browseable/MediaEffects/res/drawable-mdpi/ic_launcher.pngbin0 -> 2684 bytes
-rw-r--r--samples/browseable/MediaEffects/res/drawable-nodpi/puppy.jpgbin0 -> 73836 bytes
-rw-r--r--samples/browseable/MediaEffects/res/drawable-xhdpi/ic_launcher.pngbin0 -> 6178 bytes
-rw-r--r--samples/browseable/MediaEffects/res/drawable-xxhdpi/ic_launcher.pngbin0 -> 10820 bytes
-rwxr-xr-xsamples/browseable/MediaEffects/res/layout-w720dp/activity_main.xml73
-rwxr-xr-xsamples/browseable/MediaEffects/res/layout/activity_main.xml65
-rw-r--r--samples/browseable/MediaEffects/res/layout/fragment_media_effects.xml26
-rw-r--r--samples/browseable/MediaEffects/res/menu/main.xml21
-rw-r--r--samples/browseable/MediaEffects/res/menu/media_effects.xml112
-rw-r--r--samples/browseable/MediaEffects/res/values-sw600dp/template-dimens.xml24
-rw-r--r--samples/browseable/MediaEffects/res/values-sw600dp/template-styles.xml25
-rw-r--r--samples/browseable/MediaEffects/res/values-v11/template-styles.xml22
-rw-r--r--samples/browseable/MediaEffects/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/MediaEffects/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/MediaEffects/res/values/base-strings.xml31
-rwxr-xr-xsamples/browseable/MediaEffects/res/values/fragmentview_strings.xml (renamed from samples/browseable/CustomTransition/res/values/strings.xml)0
-rw-r--r--samples/browseable/MediaEffects/res/values/strings.xml41
-rw-r--r--samples/browseable/MediaEffects/res/values/template-dimens.xml32
-rw-r--r--samples/browseable/MediaEffects/res/values/template-styles.xml42
-rw-r--r--samples/browseable/MediaEffects/src/com.example.android.common/activities/SampleActivityBase.java52
-rw-r--r--samples/browseable/MediaEffects/src/com.example.android.common/logger/Log.java236
-rw-r--r--samples/browseable/MediaEffects/src/com.example.android.common/logger/LogFragment.java109
-rw-r--r--samples/browseable/MediaEffects/src/com.example.android.common/logger/LogNode.java39
-rw-r--r--samples/browseable/MediaEffects/src/com.example.android.common/logger/LogView.java145
-rw-r--r--samples/browseable/MediaEffects/src/com.example.android.common/logger/LogWrapper.java75
-rw-r--r--samples/browseable/MediaEffects/src/com.example.android.common/logger/MessageOnlyLogFilter.java60
-rw-r--r--samples/browseable/MediaEffects/src/com.example.android.mediaeffects/GLToolbox.java86
-rw-r--r--samples/browseable/MediaEffects/src/com.example.android.mediaeffects/MainActivity.java109
-rw-r--r--samples/browseable/MediaEffects/src/com.example.android.mediaeffects/MediaEffectsFragment.java287
-rw-r--r--samples/browseable/MediaEffects/src/com.example.android.mediaeffects/TextureRenderer.java164
-rw-r--r--samples/browseable/MediaRecorder/AndroidManifest.xml4
-rw-r--r--samples/browseable/MediaRecorder/_index.jd10
-rw-r--r--samples/browseable/MediaRecorder/res/drawable-hdpi/ic_launcher.pngbin4512 -> 3925 bytes
-rw-r--r--samples/browseable/MediaRecorder/res/drawable-mdpi/ic_launcher.pngbin2719 -> 2388 bytes
-rw-r--r--samples/browseable/MediaRecorder/res/drawable-xhdpi/ic_launcher.pngbin6345 -> 5433 bytes
-rw-r--r--samples/browseable/MediaRecorder/res/drawable-xxhdpi/ic_launcher.pngbin11620 -> 9657 bytes
-rw-r--r--samples/browseable/MediaRecorder/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/MediaRecorder/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/MediaRecorder/res/values/base-strings.xml13
-rw-r--r--samples/browseable/MediaRecorder/src/com.example.android.common.media/MediaCodecWrapper.java3
-rw-r--r--samples/browseable/MediaRouter/AndroidManifest.xml5
-rw-r--r--samples/browseable/MediaRouter/_index.jd7
-rw-r--r--samples/browseable/MediaRouter/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/MediaRouter/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/MediaRouter/res/values/base-strings.xml3
-rw-r--r--samples/browseable/MessagingService/AndroidManifest.xml52
-rw-r--r--samples/browseable/MessagingService/_index.jd12
-rw-r--r--samples/browseable/MessagingService/res/drawable-hdpi/android_contact.pngbin0 -> 1575 bytes
-rw-r--r--samples/browseable/MessagingService/res/drawable-hdpi/ic_launcher.pngbin0 -> 4801 bytes
-rw-r--r--samples/browseable/MessagingService/res/drawable-hdpi/notification_icon.pngbin0 -> 937 bytes
-rw-r--r--samples/browseable/MessagingService/res/drawable-mdpi/android_contact.pngbin0 -> 959 bytes
-rw-r--r--samples/browseable/MessagingService/res/drawable-mdpi/ic_launcher.pngbin0 -> 2956 bytes
-rw-r--r--samples/browseable/MessagingService/res/drawable-mdpi/notification_icon.pngbin0 -> 609 bytes
-rw-r--r--samples/browseable/MessagingService/res/drawable-xhdpi/android_contact.pngbin0 -> 2451 bytes
-rw-r--r--samples/browseable/MessagingService/res/drawable-xhdpi/ic_launcher.pngbin0 -> 6724 bytes
-rw-r--r--samples/browseable/MessagingService/res/drawable-xhdpi/notification_icon.pngbin0 -> 1233 bytes
-rw-r--r--samples/browseable/MessagingService/res/drawable-xxhdpi/android_contact.pngbin0 -> 3267 bytes
-rw-r--r--samples/browseable/MessagingService/res/drawable-xxhdpi/ic_launcher.pngbin0 -> 11883 bytes
-rw-r--r--samples/browseable/MessagingService/res/drawable-xxhdpi/notification_icon.pngbin0 -> 1973 bytes
-rw-r--r--samples/browseable/MessagingService/res/layout-land/fragment_message_me.xml66
-rw-r--r--samples/browseable/MessagingService/res/layout/activity_main.xml22
-rw-r--r--samples/browseable/MessagingService/res/layout/fragment_message_me.xml57
-rw-r--r--samples/browseable/MessagingService/res/values-v21/styles.xml22
-rw-r--r--samples/browseable/MessagingService/res/values/colors.xml20
-rw-r--r--samples/browseable/MessagingService/res/values/dimens.xml21
-rw-r--r--samples/browseable/MessagingService/res/values/strings.xml26
-rw-r--r--samples/browseable/MessagingService/res/values/styles.xml20
-rw-r--r--samples/browseable/MessagingService/res/xml/automotive_app_desc.xml19
-rw-r--r--samples/browseable/MessagingService/src/com.example.android.messagingservice/Conversations.java126
-rw-r--r--samples/browseable/MessagingService/src/com.example.android.messagingservice/MainActivity.java34
-rw-r--r--samples/browseable/MessagingService/src/com.example.android.messagingservice/MessageLogger.java57
-rw-r--r--samples/browseable/MessagingService/src/com.example.android.messagingservice/MessageReadReceiver.java42
-rw-r--r--samples/browseable/MessagingService/src/com.example.android.messagingservice/MessageReplyReceiver.java58
-rw-r--r--samples/browseable/MessagingService/src/com.example.android.messagingservice/MessagingFragment.java170
-rw-r--r--samples/browseable/MessagingService/src/com.example.android.messagingservice/MessagingService.java174
-rw-r--r--samples/browseable/NavigationDrawer/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/NavigationDrawer/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/NavigationDrawer/res/values-v21/template-styles.xml22
-rw-r--r--samples/browseable/NetworkConnect/AndroidManifest.xml2
-rw-r--r--samples/browseable/NetworkConnect/_index.jd12
-rw-r--r--samples/browseable/NetworkConnect/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/NetworkConnect/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/NetworkConnect/res/values/base-strings.xml3
-rw-r--r--samples/browseable/Notifications/Application/AndroidManifest.xml52
-rw-r--r--samples/browseable/Notifications/Application/res/drawable-hdpi/example_large_icon.png (renamed from samples/wearable/Notifications/Application/src/main/res/drawable-hdpi/example_large_icon.png)bin4205 -> 4205 bytes
-rw-r--r--samples/browseable/Notifications/Application/res/drawable-hdpi/ic_full_action.png (renamed from samples/wearable/Notifications/Application/src/main/res/drawable-hdpi/ic_full_action.png)bin2736 -> 2736 bytes
-rw-r--r--samples/browseable/Notifications/Application/res/drawable-hdpi/ic_full_reply.png (renamed from samples/wearable/Notifications/Application/src/main/res/drawable-hdpi/ic_full_reply.png)bin2022 -> 2022 bytes
-rw-r--r--samples/browseable/Notifications/Application/res/drawable-hdpi/ic_result_open.png (renamed from samples/wearable/Notifications/Application/src/main/res/drawable-hdpi/ic_result_open.png)bin1246 -> 1246 bytes
-rw-r--r--samples/browseable/Notifications/Application/res/drawable-hdpi/tile.9.pngbin0 -> 196 bytes
-rw-r--r--samples/browseable/Notifications/Application/res/drawable-mdpi/ic_full_action.png (renamed from samples/wearable/Notifications/Application/src/main/res/drawable-mdpi/ic_full_action.png)bin1763 -> 1763 bytes
-rw-r--r--samples/browseable/Notifications/Application/res/drawable-mdpi/ic_full_reply.png (renamed from samples/wearable/Notifications/Application/src/main/res/drawable-mdpi/ic_full_reply.png)bin1261 -> 1261 bytes
-rw-r--r--samples/browseable/Notifications/Application/res/drawable-mdpi/ic_result_open.png (renamed from samples/wearable/Notifications/Application/src/main/res/drawable-mdpi/ic_result_open.png)bin915 -> 915 bytes
-rw-r--r--samples/browseable/Notifications/Application/res/drawable-nodpi/bg_1.png (renamed from samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/bg_1.png)bin813614 -> 813614 bytes
-rw-r--r--samples/browseable/Notifications/Application/res/drawable-nodpi/bg_2.png (renamed from samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/bg_2.png)bin623153 -> 623153 bytes
-rw-r--r--samples/browseable/Notifications/Application/res/drawable-nodpi/bg_3.png (renamed from samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/bg_3.png)bin1152914 -> 1152914 bytes
-rw-r--r--samples/browseable/Notifications/Application/res/drawable-nodpi/bg_4.png (renamed from samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/bg_4.png)bin817089 -> 817089 bytes
-rw-r--r--samples/browseable/Notifications/Application/res/drawable-nodpi/bg_5.png (renamed from samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/bg_5.png)bin650677 -> 650677 bytes
-rw-r--r--samples/browseable/Notifications/Application/res/drawable-nodpi/content_icon_large.png (renamed from samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/content_icon_large.png)bin655 -> 655 bytes
-rw-r--r--samples/browseable/Notifications/Application/res/drawable-nodpi/content_icon_small.png (renamed from samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/content_icon_small.png)bin399 -> 399 bytes
-rw-r--r--samples/browseable/Notifications/Application/res/drawable-nodpi/example_big_picture.jpg (renamed from samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/example_big_picture.jpg)bin414841 -> 414841 bytes
-rw-r--r--samples/browseable/Notifications/Application/res/drawable-nodpi/qr_code.pngbin0 -> 12394 bytes
-rw-r--r--samples/browseable/Notifications/Application/res/drawable-xhdpi/ic_full_action.png (renamed from samples/wearable/Notifications/Application/src/main/res/drawable-xhdpi/ic_full_action.png)bin1677 -> 1677 bytes
-rw-r--r--samples/browseable/Notifications/Application/res/drawable-xhdpi/ic_full_reply.png (renamed from samples/wearable/Notifications/Application/src/main/res/drawable-xhdpi/ic_full_reply.png)bin1178 -> 1178 bytes
-rw-r--r--samples/browseable/Notifications/Application/res/drawable-xhdpi/ic_result_open.png (renamed from samples/wearable/Notifications/Application/src/main/res/drawable-xhdpi/ic_result_open.png)bin632 -> 632 bytes
-rw-r--r--samples/browseable/Notifications/Application/res/drawable/selected_background.xml (renamed from samples/wearable/Notifications/Application/src/main/res/drawable/selected_background.xml)0
-rw-r--r--samples/browseable/Notifications/Application/res/drawable/unselected_background.xml (renamed from samples/wearable/Notifications/Application/src/main/res/drawable/unselected_background.xml)0
-rwxr-xr-xsamples/browseable/Notifications/Application/res/layout/activity_main.xml36
-rw-r--r--samples/browseable/Notifications/Application/res/layout/background_picker.xml (renamed from samples/wearable/Notifications/Application/src/main/res/layout/background_picker.xml)0
-rw-r--r--samples/browseable/Notifications/Application/res/layout/layout_divider.xml (renamed from samples/wearable/Notifications/Application/src/main/res/layout/layout_divider.xml)0
-rw-r--r--samples/browseable/Notifications/Application/res/layout/main.xml (renamed from samples/wearable/Notifications/Application/src/main/res/layout/activity_main.xml)0
-rw-r--r--samples/browseable/Notifications/Application/res/layout/simple_spinner_item.xml (renamed from samples/wearable/Notifications/Application/src/main/res/layout/simple_spinner_item.xml)0
-rw-r--r--samples/browseable/Notifications/Application/res/mipmap-hdpi/ic_launcher.png (renamed from samples/wearable/Notifications/Application/src/main/res/mipmap-hdpi/ic_launcher.png)bin3744 -> 3744 bytes
-rw-r--r--samples/browseable/Notifications/Application/res/mipmap-mdpi/ic_launcher.png (renamed from samples/wearable/Notifications/Application/src/main/res/mipmap-mdpi/ic_launcher.png)bin2607 -> 2607 bytes
-rw-r--r--samples/browseable/Notifications/Application/res/mipmap-xhdpi/ic_launcher.png (renamed from samples/wearable/Notifications/Application/src/main/res/mipmap-xhdpi/ic_launcher.png)bin5012 -> 5012 bytes
-rw-r--r--samples/browseable/Notifications/Application/res/mipmap-xxhdpi/ic_launcher.png (renamed from samples/wearable/Notifications/Application/src/main/res/mipmap-xxhdpi/ic_launcher.png)bin7142 -> 7142 bytes
-rw-r--r--samples/browseable/Notifications/Application/res/mipmap-xxxhdpi/ic_launcher.png (renamed from samples/wearable/Notifications/Application/src/main/res/mipmap-xxxhdpi/ic_launcher.png)bin6722 -> 6722 bytes
-rw-r--r--samples/browseable/Notifications/Application/res/values-sw600dp/template-dimens.xml24
-rw-r--r--samples/browseable/Notifications/Application/res/values-sw600dp/template-styles.xml25
-rw-r--r--samples/browseable/Notifications/Application/res/values-v11/template-styles.xml22
-rw-r--r--samples/browseable/Notifications/Application/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/Notifications/Application/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/Notifications/Application/res/values/base-strings.xml31
-rw-r--r--samples/browseable/Notifications/Application/res/values/colors.xml19
-rw-r--r--samples/browseable/Notifications/Application/res/values/dimens.xml (renamed from samples/wearable/Notifications/Application/src/main/res/values/dimens.xml)0
-rw-r--r--samples/browseable/Notifications/Application/res/values/strings.xml196
-rw-r--r--samples/browseable/Notifications/Application/res/values/styles.xml24
-rw-r--r--samples/browseable/Notifications/Application/res/values/template-dimens.xml32
-rw-r--r--samples/browseable/Notifications/Application/res/values/template-styles.xml42
-rw-r--r--samples/browseable/Notifications/Application/src/com.example.android.support.wearable.notifications/ActionsPreset.java (renamed from samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/ActionsPreset.java)0
-rw-r--r--samples/browseable/Notifications/Application/src/com.example.android.support.wearable.notifications/ActionsPresets.java (renamed from samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/ActionsPresets.java)0
-rw-r--r--samples/browseable/Notifications/Application/src/com.example.android.support.wearable.notifications/BackgroundPickers.java (renamed from samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/BackgroundPickers.java)0
-rw-r--r--samples/browseable/Notifications/Application/src/com.example.android.support.wearable.notifications/MainActivity.java352
-rw-r--r--samples/browseable/Notifications/Application/src/com.example.android.support.wearable.notifications/NamedPreset.java (renamed from samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/NamedPreset.java)0
-rw-r--r--samples/browseable/Notifications/Application/src/com.example.android.support.wearable.notifications/NotificationIntentReceiver.java (renamed from samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/NotificationIntentReceiver.java)0
-rw-r--r--samples/browseable/Notifications/Application/src/com.example.android.support.wearable.notifications/NotificationPreset.java (renamed from samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/NotificationPreset.java)0
-rw-r--r--samples/browseable/Notifications/Application/src/com.example.android.support.wearable.notifications/NotificationPresets.java510
-rw-r--r--samples/browseable/Notifications/Application/src/com.example.android.support.wearable.notifications/NotificationUtil.java (renamed from samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/NotificationUtil.java)0
-rw-r--r--samples/browseable/Notifications/Application/src/com.example.android.support.wearable.notifications/PriorityPreset.java (renamed from samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/PriorityPreset.java)0
-rw-r--r--samples/browseable/Notifications/Application/src/com.example.android.support.wearable.notifications/PriorityPresets.java (renamed from samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/PriorityPresets.java)0
-rw-r--r--samples/browseable/Notifications/Wearable/AndroidManifest.xml53
-rw-r--r--samples/browseable/Notifications/Wearable/res/drawable-nodpi/content_icon_large.png (renamed from samples/wearable/Notifications/Wearable/src/main/res/drawable-nodpi/content_icon_large.png)bin655 -> 655 bytes
-rw-r--r--samples/browseable/Notifications/Wearable/res/drawable-nodpi/content_icon_small.png (renamed from samples/wearable/Notifications/Wearable/src/main/res/drawable-nodpi/content_icon_small.png)bin399 -> 399 bytes
-rw-r--r--samples/browseable/Notifications/Wearable/res/drawable-nodpi/example_big_picture.jpg (renamed from samples/wearable/Notifications/Wearable/src/main/res/drawable-nodpi/example_big_picture.jpg)bin414841 -> 414841 bytes
-rw-r--r--samples/browseable/Notifications/Wearable/res/drawable/wl_circle.xml (renamed from samples/wearable/Notifications/Wearable/src/main/res/drawable/wl_circle.xml)0
-rw-r--r--samples/browseable/Notifications/Wearable/res/layout/activity_animated_notification_display.xml (renamed from samples/wearable/Notifications/Wearable/src/main/res/layout/activity_animated_notification_display.xml)0
-rw-r--r--samples/browseable/Notifications/Wearable/res/layout/activity_main.xml (renamed from samples/wearable/Notifications/Wearable/src/main/res/layout/activity_main.xml)0
-rw-r--r--samples/browseable/Notifications/Wearable/res/layout/activity_notification_display.xml (renamed from samples/wearable/Notifications/Wearable/src/main/res/layout/activity_notification_display.xml)0
-rw-r--r--samples/browseable/Notifications/Wearable/res/layout/notif_preset_list_item.xml (renamed from samples/wearable/Notifications/Wearable/src/main/res/layout/notif_preset_list_item.xml)0
-rw-r--r--samples/browseable/Notifications/Wearable/res/mipmap-hdpi/ic_launcher.png (renamed from samples/wearable/Notifications/Wearable/src/main/res/mipmap-hdpi/ic_launcher.png)bin3744 -> 3744 bytes
-rw-r--r--samples/browseable/Notifications/Wearable/res/mipmap-mdpi/ic_launcher.png (renamed from samples/wearable/Notifications/Wearable/src/main/res/mipmap-mdpi/ic_launcher.png)bin2607 -> 2607 bytes
-rw-r--r--samples/browseable/Notifications/Wearable/res/mipmap-xhdpi/ic_launcher.png (renamed from samples/wearable/Notifications/Wearable/src/main/res/mipmap-xhdpi/ic_launcher.png)bin5012 -> 5012 bytes
-rw-r--r--samples/browseable/Notifications/Wearable/res/mipmap-xxhdpi/ic_launcher.png (renamed from samples/wearable/Notifications/Wearable/src/main/res/mipmap-xxhdpi/ic_launcher.png)bin7142 -> 7142 bytes
-rw-r--r--samples/browseable/Notifications/Wearable/res/mipmap-xxxhdpi/ic_launcher.png (renamed from samples/wearable/Notifications/Wearable/src/main/res/mipmap-xxxhdpi/ic_launcher.png)bin6722 -> 6722 bytes
-rw-r--r--samples/browseable/Notifications/Wearable/res/values/colors.xml (renamed from samples/wearable/Notifications/Wearable/src/main/res/values/colors.xml)0
-rw-r--r--samples/browseable/Notifications/Wearable/res/values/dimens.xml (renamed from samples/wearable/Notifications/Wearable/src/main/res/values/dimens.xml)0
-rw-r--r--samples/browseable/Notifications/Wearable/res/values/integers.xml (renamed from samples/wearable/Notifications/Wearable/src/main/res/values/integers.xml)0
-rw-r--r--samples/browseable/Notifications/Wearable/res/values/strings.xml (renamed from samples/wearable/Notifications/Wearable/src/main/res/values/strings.xml)0
-rw-r--r--samples/browseable/Notifications/Wearable/src/com.example.android.support.wearable.notifications/AnimatedNotificationDisplayActivity.java (renamed from samples/wearable/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/AnimatedNotificationDisplayActivity.java)0
-rw-r--r--samples/browseable/Notifications/Wearable/src/com.example.android.support.wearable.notifications/BasicNotificationDisplayActivity.java (renamed from samples/wearable/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/BasicNotificationDisplayActivity.java)0
-rw-r--r--samples/browseable/Notifications/Wearable/src/com.example.android.support.wearable.notifications/MainActivity.java (renamed from samples/wearable/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/MainActivity.java)0
-rw-r--r--samples/browseable/Notifications/Wearable/src/com.example.android.support.wearable.notifications/NotificationPreset.java (renamed from samples/wearable/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/NotificationPreset.java)0
-rw-r--r--samples/browseable/Notifications/Wearable/src/com.example.android.support.wearable.notifications/NotificationPresets.java (renamed from samples/wearable/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/NotificationPresets.java)0
-rw-r--r--samples/browseable/Notifications/Wearable/src/com.example.android.support.wearable.notifications/WearableListItemLayout.java70
-rw-r--r--samples/browseable/Notifications/_index.jd12
-rw-r--r--samples/browseable/PdfRendererBasic/AndroidManifest.xml38
-rw-r--r--samples/browseable/PdfRendererBasic/_index.jd9
-rw-r--r--samples/browseable/PdfRendererBasic/res/drawable-hdpi/ic_action_info.pngbin0 -> 1025 bytes
-rw-r--r--samples/browseable/PdfRendererBasic/res/drawable-hdpi/ic_launcher.pngbin0 -> 3976 bytes
-rw-r--r--samples/browseable/PdfRendererBasic/res/drawable-hdpi/tile.9.pngbin0 -> 196 bytes
-rw-r--r--samples/browseable/PdfRendererBasic/res/drawable-mdpi/ic_action_info.pngbin0 -> 665 bytes
-rw-r--r--samples/browseable/PdfRendererBasic/res/drawable-mdpi/ic_launcher.pngbin0 -> 2373 bytes
-rw-r--r--samples/browseable/PdfRendererBasic/res/drawable-xhdpi/ic_action_info.pngbin0 -> 1355 bytes
-rw-r--r--samples/browseable/PdfRendererBasic/res/drawable-xhdpi/ic_launcher.pngbin0 -> 5478 bytes
-rw-r--r--samples/browseable/PdfRendererBasic/res/drawable-xxhdpi/ic_action_info.pngbin0 -> 2265 bytes
-rw-r--r--samples/browseable/PdfRendererBasic/res/drawable-xxhdpi/ic_launcher.pngbin0 -> 9652 bytes
-rwxr-xr-xsamples/browseable/PdfRendererBasic/res/layout/activity_main.xml36
-rw-r--r--samples/browseable/PdfRendererBasic/res/layout/activity_main_real.xml23
-rw-r--r--samples/browseable/PdfRendererBasic/res/layout/fragment_pdf_renderer_basic.xml56
-rw-r--r--samples/browseable/PdfRendererBasic/res/menu/main.xml25
-rw-r--r--samples/browseable/PdfRendererBasic/res/values-sw600dp/template-dimens.xml24
-rw-r--r--samples/browseable/PdfRendererBasic/res/values-sw600dp/template-styles.xml25
-rw-r--r--samples/browseable/PdfRendererBasic/res/values-v11/template-styles.xml22
-rw-r--r--samples/browseable/PdfRendererBasic/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/PdfRendererBasic/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/PdfRendererBasic/res/values/base-strings.xml28
-rw-r--r--samples/browseable/PdfRendererBasic/res/values/strings.xml24
-rw-r--r--samples/browseable/PdfRendererBasic/res/values/template-dimens.xml32
-rw-r--r--samples/browseable/PdfRendererBasic/res/values/template-styles.xml42
-rw-r--r--samples/browseable/PdfRendererBasic/src/com.example.android.pdfrendererbasic/MainActivity.java59
-rw-r--r--samples/browseable/PdfRendererBasic/src/com.example.android.pdfrendererbasic/PdfRendererBasicFragment.java221
-rw-r--r--samples/browseable/Quiz/Application/AndroidManifest.xml44
-rw-r--r--samples/browseable/Quiz/Application/res/drawable-hdpi/ic_choice_a.png (renamed from samples/wearable/Quiz/Application/src/main/res/drawable-hdpi/ic_choice_a.png)bin1040 -> 1040 bytes
-rw-r--r--samples/browseable/Quiz/Application/res/drawable-hdpi/ic_choice_b.png (renamed from samples/wearable/Quiz/Application/src/main/res/drawable-hdpi/ic_choice_b.png)bin1081 -> 1081 bytes
-rw-r--r--samples/browseable/Quiz/Application/res/drawable-hdpi/ic_choice_c.png (renamed from samples/wearable/Quiz/Application/src/main/res/drawable-hdpi/ic_choice_c.png)bin965 -> 965 bytes
-rw-r--r--samples/browseable/Quiz/Application/res/drawable-hdpi/ic_choice_d.png (renamed from samples/wearable/Quiz/Application/src/main/res/drawable-hdpi/ic_choice_d.png)bin1058 -> 1058 bytes
-rwxr-xr-xsamples/browseable/Quiz/Application/res/drawable-hdpi/ic_launcher.png (renamed from samples/wearable/Quiz/Application/src/main/res/drawable-hdpi/ic_launcher.png)bin4234 -> 4234 bytes
-rw-r--r--samples/browseable/Quiz/Application/res/drawable-hdpi/ic_unknown_choice.png (renamed from samples/wearable/Quiz/Application/src/main/res/drawable-hdpi/ic_unknown_choice.png)bin835 -> 835 bytes
-rw-r--r--samples/browseable/Quiz/Application/res/drawable-hdpi/tile.9.pngbin0 -> 196 bytes
-rw-r--r--samples/browseable/Quiz/Application/res/drawable-mdpi/ic_choice_a.png (renamed from samples/wearable/Quiz/Application/src/main/res/drawable-mdpi/ic_choice_a.png)bin686 -> 686 bytes
-rw-r--r--samples/browseable/Quiz/Application/res/drawable-mdpi/ic_choice_b.png (renamed from samples/wearable/Quiz/Application/src/main/res/drawable-mdpi/ic_choice_b.png)bin711 -> 711 bytes
-rw-r--r--samples/browseable/Quiz/Application/res/drawable-mdpi/ic_choice_c.png (renamed from samples/wearable/Quiz/Application/src/main/res/drawable-mdpi/ic_choice_c.png)bin638 -> 638 bytes
-rw-r--r--samples/browseable/Quiz/Application/res/drawable-mdpi/ic_choice_d.png (renamed from samples/wearable/Quiz/Application/src/main/res/drawable-mdpi/ic_choice_d.png)bin700 -> 700 bytes
-rwxr-xr-xsamples/browseable/Quiz/Application/res/drawable-mdpi/ic_launcher.png (renamed from samples/wearable/Quiz/Application/src/main/res/drawable-mdpi/ic_launcher.png)bin2612 -> 2612 bytes
-rw-r--r--samples/browseable/Quiz/Application/res/drawable-mdpi/ic_unknown_choice.png (renamed from samples/wearable/Quiz/Application/src/main/res/drawable-mdpi/ic_unknown_choice.png)bin583 -> 583 bytes
-rw-r--r--samples/browseable/Quiz/Application/res/drawable-xhdpi/ic_choice_a.png (renamed from samples/wearable/Quiz/Application/src/main/res/drawable-xhdpi/ic_choice_a.png)bin1432 -> 1432 bytes
-rw-r--r--samples/browseable/Quiz/Application/res/drawable-xhdpi/ic_choice_b.png (renamed from samples/wearable/Quiz/Application/src/main/res/drawable-xhdpi/ic_choice_b.png)bin1444 -> 1444 bytes
-rw-r--r--samples/browseable/Quiz/Application/res/drawable-xhdpi/ic_choice_c.png (renamed from samples/wearable/Quiz/Application/src/main/res/drawable-xhdpi/ic_choice_c.png)bin1305 -> 1305 bytes
-rw-r--r--samples/browseable/Quiz/Application/res/drawable-xhdpi/ic_choice_d.png (renamed from samples/wearable/Quiz/Application/src/main/res/drawable-xhdpi/ic_choice_d.png)bin1467 -> 1467 bytes
-rwxr-xr-xsamples/browseable/Quiz/Application/res/drawable-xhdpi/ic_launcher.png (renamed from samples/wearable/Quiz/Application/src/main/res/drawable-xhdpi/ic_launcher.png)bin6028 -> 6028 bytes
-rwxr-xr-xsamples/browseable/Quiz/Application/res/drawable-xxhdpi/ic_launcher.png (renamed from samples/wearable/Quiz/Application/src/main/res/drawable-xxhdpi/ic_launcher.png)bin10859 -> 10859 bytes
-rw-r--r--samples/browseable/Quiz/Application/res/drawable/selected_background.xml (renamed from samples/wearable/Quiz/Application/src/main/res/drawable/selected_background.xml)0
-rw-r--r--samples/browseable/Quiz/Application/res/drawable/unselected_background.xml (renamed from samples/wearable/Quiz/Application/src/main/res/drawable/unselected_background.xml)0
-rwxr-xr-xsamples/browseable/Quiz/Application/res/layout/activity_main.xml36
-rw-r--r--samples/browseable/Quiz/Application/res/layout/main.xml (renamed from samples/wearable/Quiz/Application/src/main/res/layout/activity_main.xml)0
-rw-r--r--samples/browseable/Quiz/Application/res/layout/question_status_element.xml (renamed from samples/wearable/Quiz/Application/src/main/res/layout/question_status_element.xml)0
-rw-r--r--samples/browseable/Quiz/Application/res/values-sw600dp/template-dimens.xml24
-rw-r--r--samples/browseable/Quiz/Application/res/values-sw600dp/template-styles.xml25
-rw-r--r--samples/browseable/Quiz/Application/res/values-v11/template-styles.xml22
-rw-r--r--samples/browseable/Quiz/Application/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/Quiz/Application/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/Quiz/Application/res/values/base-strings.xml34
-rw-r--r--samples/browseable/Quiz/Application/res/values/dimens.xml (renamed from samples/wearable/Quiz/Application/src/main/res/values/dimens.xml)0
-rw-r--r--samples/browseable/Quiz/Application/res/values/strings.xml38
-rw-r--r--samples/browseable/Quiz/Application/res/values/styles.xml24
-rw-r--r--samples/browseable/Quiz/Application/res/values/template-dimens.xml32
-rw-r--r--samples/browseable/Quiz/Application/res/values/template-styles.xml42
-rw-r--r--samples/browseable/Quiz/Application/src/com.example.android.wearable.quiz/Constants.java (renamed from samples/wearable/Quiz/Application/src/main/java/com/example/android/wearable/quiz/Constants.java)0
-rw-r--r--samples/browseable/Quiz/Application/src/com.example.android.wearable.quiz/JsonUtils.java (renamed from samples/wearable/Quiz/Application/src/main/java/com/example/android/wearable/quiz/JsonUtils.java)0
-rw-r--r--samples/browseable/Quiz/Application/src/com.example.android.wearable.quiz/MainActivity.java585
-rw-r--r--samples/browseable/Quiz/Wearable/AndroidManifest.xml46
-rw-r--r--samples/browseable/Quiz/Wearable/res/drawable-hdpi/ic_choice_a.png (renamed from samples/wearable/Quiz/Wearable/src/main/res/drawable-hdpi/ic_choice_a.png)bin1040 -> 1040 bytes
-rw-r--r--samples/browseable/Quiz/Wearable/res/drawable-hdpi/ic_choice_b.png (renamed from samples/wearable/Quiz/Wearable/src/main/res/drawable-hdpi/ic_choice_b.png)bin1081 -> 1081 bytes
-rw-r--r--samples/browseable/Quiz/Wearable/res/drawable-hdpi/ic_choice_c.png (renamed from samples/wearable/Quiz/Wearable/src/main/res/drawable-hdpi/ic_choice_c.png)bin965 -> 965 bytes
-rw-r--r--samples/browseable/Quiz/Wearable/res/drawable-hdpi/ic_choice_d.png (renamed from samples/wearable/Quiz/Wearable/src/main/res/drawable-hdpi/ic_choice_d.png)bin1058 -> 1058 bytes
-rwxr-xr-xsamples/browseable/Quiz/Wearable/res/drawable-hdpi/ic_launcher.png (renamed from samples/wearable/Quiz/Wearable/src/main/res/drawable-hdpi/ic_launcher.png)bin4234 -> 4234 bytes
-rw-r--r--samples/browseable/Quiz/Wearable/res/drawable-hdpi/ic_unknown_choice.png (renamed from samples/wearable/Quiz/Wearable/src/main/res/drawable-hdpi/ic_unknown_choice.png)bin835 -> 835 bytes
-rw-r--r--samples/browseable/Quiz/Wearable/res/drawable-mdpi/ic_choice_a.png (renamed from samples/wearable/Quiz/Wearable/src/main/res/drawable-mdpi/ic_choice_a.png)bin686 -> 686 bytes
-rw-r--r--samples/browseable/Quiz/Wearable/res/drawable-mdpi/ic_choice_b.png (renamed from samples/wearable/Quiz/Wearable/src/main/res/drawable-mdpi/ic_choice_b.png)bin711 -> 711 bytes
-rw-r--r--samples/browseable/Quiz/Wearable/res/drawable-mdpi/ic_choice_c.png (renamed from samples/wearable/Quiz/Wearable/src/main/res/drawable-mdpi/ic_choice_c.png)bin638 -> 638 bytes
-rw-r--r--samples/browseable/Quiz/Wearable/res/drawable-mdpi/ic_choice_d.png (renamed from samples/wearable/Quiz/Wearable/src/main/res/drawable-mdpi/ic_choice_d.png)bin700 -> 700 bytes
-rwxr-xr-xsamples/browseable/Quiz/Wearable/res/drawable-mdpi/ic_launcher.png (renamed from samples/wearable/Quiz/Wearable/src/main/res/drawable-mdpi/ic_launcher.png)bin2612 -> 2612 bytes
-rw-r--r--samples/browseable/Quiz/Wearable/res/drawable-mdpi/ic_unknown_choice.png (renamed from samples/wearable/Quiz/Wearable/src/main/res/drawable-mdpi/ic_unknown_choice.png)bin583 -> 583 bytes
-rw-r--r--samples/browseable/Quiz/Wearable/res/drawable-xhdpi/ic_choice_a.png (renamed from samples/wearable/Quiz/Wearable/src/main/res/drawable-xhdpi/ic_choice_a.png)bin1432 -> 1432 bytes
-rw-r--r--samples/browseable/Quiz/Wearable/res/drawable-xhdpi/ic_choice_b.png (renamed from samples/wearable/Quiz/Wearable/src/main/res/drawable-xhdpi/ic_choice_b.png)bin1444 -> 1444 bytes
-rw-r--r--samples/browseable/Quiz/Wearable/res/drawable-xhdpi/ic_choice_c.png (renamed from samples/wearable/Quiz/Wearable/src/main/res/drawable-xhdpi/ic_choice_c.png)bin1305 -> 1305 bytes
-rw-r--r--samples/browseable/Quiz/Wearable/res/drawable-xhdpi/ic_choice_d.png (renamed from samples/wearable/Quiz/Wearable/src/main/res/drawable-xhdpi/ic_choice_d.png)bin1467 -> 1467 bytes
-rwxr-xr-xsamples/browseable/Quiz/Wearable/res/drawable-xhdpi/ic_launcher.png (renamed from samples/wearable/Quiz/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png)bin6028 -> 6028 bytes
-rw-r--r--samples/browseable/Quiz/Wearable/res/drawable-xhdpi/ic_unknown_choice.png (renamed from samples/wearable/Quiz/Wearable/src/main/res/drawable-xhdpi/ic_unknown_choice.png)bin1174 -> 1174 bytes
-rwxr-xr-xsamples/browseable/Quiz/Wearable/res/drawable-xxhdpi/ic_launcher.png (renamed from samples/wearable/Quiz/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png)bin10859 -> 10859 bytes
-rw-r--r--samples/browseable/Quiz/Wearable/res/values/colors.xml (renamed from samples/wearable/Quiz/Wearable/src/main/res/values/colors.xml)0
-rw-r--r--samples/browseable/Quiz/Wearable/res/values/strings.xml (renamed from samples/wearable/Quiz/Wearable/src/main/res/values/strings.xml)0
-rw-r--r--samples/browseable/Quiz/Wearable/src/com.example.android.wearable.quiz/Constants.java (renamed from samples/wearable/Quiz/Wearable/src/main/java/com/example/android/wearable/quiz/Constants.java)0
-rw-r--r--samples/browseable/Quiz/Wearable/src/com.example.android.wearable.quiz/DeleteQuestionService.java (renamed from samples/wearable/Quiz/Wearable/src/main/java/com/example/android/wearable/quiz/DeleteQuestionService.java)0
-rw-r--r--samples/browseable/Quiz/Wearable/src/com.example.android.wearable.quiz/QuizListenerService.java (renamed from samples/wearable/Quiz/Wearable/src/main/java/com/example/android/wearable/quiz/QuizListenerService.java)0
-rw-r--r--samples/browseable/Quiz/Wearable/src/com.example.android.wearable.quiz/QuizReportActionService.java (renamed from samples/wearable/Quiz/Wearable/src/main/java/com/example/android/wearable/quiz/QuizReportActionService.java)0
-rw-r--r--samples/browseable/Quiz/Wearable/src/com.example.android.wearable.quiz/UpdateQuestionService.java (renamed from samples/wearable/Quiz/Wearable/src/main/java/com/example/android/wearable/quiz/UpdateQuestionService.java)0
-rw-r--r--samples/browseable/Quiz/_index.jd15
-rw-r--r--samples/browseable/RecipeAssistant/Application/AndroidManifest.xml44
-rw-r--r--samples/browseable/RecipeAssistant/Application/res/drawable-hdpi/ic_noimage.png (renamed from samples/wearable/RecipeAssistant/Application/src/main/res/drawable-hdpi/ic_noimage.png)bin526 -> 526 bytes
-rw-r--r--samples/browseable/RecipeAssistant/Application/res/drawable-hdpi/tile.9.pngbin0 -> 196 bytes
-rw-r--r--samples/browseable/RecipeAssistant/Application/res/drawable-mdpi/ic_noimage.png (renamed from samples/wearable/RecipeAssistant/Application/src/main/res/drawable-mdpi/ic_noimage.png)bin388 -> 388 bytes
-rw-r--r--samples/browseable/RecipeAssistant/Application/res/drawable-xhdpi/ic_noimage.png (renamed from samples/wearable/RecipeAssistant/Application/src/main/res/drawable-xhdpi/ic_noimage.png)bin684 -> 684 bytes
-rwxr-xr-xsamples/browseable/RecipeAssistant/Application/res/layout/activity_main.xml36
-rw-r--r--samples/browseable/RecipeAssistant/Application/res/layout/list_item.xml (renamed from samples/wearable/RecipeAssistant/Application/src/main/res/layout/list_item.xml)0
-rw-r--r--samples/browseable/RecipeAssistant/Application/res/layout/recipe.xml (renamed from samples/wearable/RecipeAssistant/Application/src/main/res/layout/recipe.xml)0
-rw-r--r--samples/browseable/RecipeAssistant/Application/res/layout/step_item.xml (renamed from samples/wearable/RecipeAssistant/Application/src/main/res/layout/step_item.xml)0
-rw-r--r--samples/browseable/RecipeAssistant/Application/res/menu/main.xml (renamed from samples/wearable/RecipeAssistant/Application/src/main/res/menu/main.xml)0
-rw-r--r--samples/browseable/RecipeAssistant/Application/res/mipmap-hdpi/ic_app_recipe.png (renamed from samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-hdpi/ic_app_recipe.png)bin6585 -> 6585 bytes
-rw-r--r--samples/browseable/RecipeAssistant/Application/res/mipmap-hdpi/ic_notification_recipe.png (renamed from samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-hdpi/ic_notification_recipe.png)bin1074 -> 1074 bytes
-rw-r--r--samples/browseable/RecipeAssistant/Application/res/mipmap-mdpi/ic_app_recipe.png (renamed from samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-mdpi/ic_app_recipe.png)bin4246 -> 4246 bytes
-rw-r--r--samples/browseable/RecipeAssistant/Application/res/mipmap-mdpi/ic_notification_recipe.png (renamed from samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-mdpi/ic_notification_recipe.png)bin758 -> 758 bytes
-rw-r--r--samples/browseable/RecipeAssistant/Application/res/mipmap-xhdpi/ic_app_recipe.png (renamed from samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-xhdpi/ic_app_recipe.png)bin9595 -> 9595 bytes
-rw-r--r--samples/browseable/RecipeAssistant/Application/res/mipmap-xhdpi/ic_notification_recipe.png (renamed from samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-xhdpi/ic_notification_recipe.png)bin1396 -> 1396 bytes
-rw-r--r--samples/browseable/RecipeAssistant/Application/res/mipmap-xxhdpi/ic_app_recipe.png (renamed from samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-xxhdpi/ic_app_recipe.png)bin15387 -> 15387 bytes
-rw-r--r--samples/browseable/RecipeAssistant/Application/res/mipmap-xxhdpi/ic_notification_recipe.png (renamed from samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-xxhdpi/ic_notification_recipe.png)bin2169 -> 2169 bytes
-rw-r--r--samples/browseable/RecipeAssistant/Application/res/mipmap-xxxhdpi/ic_app_recipe.png (renamed from samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-xxxhdpi/ic_app_recipe.png)bin14753 -> 14753 bytes
-rw-r--r--samples/browseable/RecipeAssistant/Application/res/mipmap-xxxhdpi/ic_notification_recipe.png (renamed from samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-xxxhdpi/ic_notification_recipe.png)bin2355 -> 2355 bytes
-rw-r--r--samples/browseable/RecipeAssistant/Application/res/values-sw600dp/template-dimens.xml24
-rw-r--r--samples/browseable/RecipeAssistant/Application/res/values-sw600dp/template-styles.xml25
-rw-r--r--samples/browseable/RecipeAssistant/Application/res/values-v11/template-styles.xml22
-rw-r--r--samples/browseable/RecipeAssistant/Application/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/RecipeAssistant/Application/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/RecipeAssistant/Application/res/values/base-strings.xml33
-rw-r--r--samples/browseable/RecipeAssistant/Application/res/values/colors.xml (renamed from samples/wearable/RecipeAssistant/Application/src/main/res/values/colors.xml)0
-rw-r--r--samples/browseable/RecipeAssistant/Application/res/values/strings.xml23
-rw-r--r--samples/browseable/RecipeAssistant/Application/res/values/styles.xml (renamed from samples/wearable/RecipeAssistant/Application/src/main/res/values/styles.xml)0
-rw-r--r--samples/browseable/RecipeAssistant/Application/res/values/template-dimens.xml32
-rw-r--r--samples/browseable/RecipeAssistant/Application/res/values/template-styles.xml42
-rw-r--r--samples/browseable/RecipeAssistant/Application/src/com.example.android.common/activities/SampleActivityBase.java52
-rw-r--r--samples/browseable/RecipeAssistant/Application/src/com.example.android.common/logger/Log.java236
-rw-r--r--samples/browseable/RecipeAssistant/Application/src/com.example.android.common/logger/LogFragment.java109
-rw-r--r--samples/browseable/RecipeAssistant/Application/src/com.example.android.common/logger/LogNode.java39
-rw-r--r--samples/browseable/RecipeAssistant/Application/src/com.example.android.common/logger/LogView.java145
-rw-r--r--samples/browseable/RecipeAssistant/Application/src/com.example.android.common/logger/LogWrapper.java75
-rw-r--r--samples/browseable/RecipeAssistant/Application/src/com.example.android.common/logger/MessageOnlyLogFilter.java60
-rw-r--r--samples/browseable/RecipeAssistant/Application/src/com.example.android.wearable.recipeassistant/AssetUtils.java (renamed from samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/AssetUtils.java)0
-rw-r--r--samples/browseable/RecipeAssistant/Application/src/com.example.android.wearable.recipeassistant/Constants.java (renamed from samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/Constants.java)0
-rw-r--r--samples/browseable/RecipeAssistant/Application/src/com.example.android.wearable.recipeassistant/MainActivity.java (renamed from samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/MainActivity.java)0
-rw-r--r--samples/browseable/RecipeAssistant/Application/src/com.example.android.wearable.recipeassistant/Recipe.java (renamed from samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/Recipe.java)0
-rw-r--r--samples/browseable/RecipeAssistant/Application/src/com.example.android.wearable.recipeassistant/RecipeActivity.java (renamed from samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/RecipeActivity.java)0
-rw-r--r--samples/browseable/RecipeAssistant/Application/src/com.example.android.wearable.recipeassistant/RecipeListAdapter.java (renamed from samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/RecipeListAdapter.java)0
-rw-r--r--samples/browseable/RecipeAssistant/Application/src/com.example.android.wearable.recipeassistant/RecipeService.java (renamed from samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/RecipeService.java)0
-rw-r--r--samples/browseable/RecipeAssistant/_index.jd14
-rw-r--r--samples/browseable/RecyclerView/_index.jd4
-rw-r--r--samples/browseable/RecyclerView/res/layout/recycler_view_frag.xml22
-rw-r--r--samples/browseable/RecyclerView/res/layout/text_row_item.xml19
-rw-r--r--samples/browseable/RecyclerView/res/values-v21/base-colors.xml22
-rw-r--r--samples/browseable/RecyclerView/res/values-v21/base-template-styles.xml25
-rw-r--r--samples/browseable/RecyclerView/res/values-v21/template-styles.xml22
-rw-r--r--samples/browseable/RecyclerView/res/values/base-strings.xml4
-rw-r--r--samples/browseable/RecyclerView/res/values/dimens.xml20
-rw-r--r--samples/browseable/RecyclerView/res/values/strings.xml2
-rw-r--r--samples/browseable/RecyclerView/src/com.example.android.recyclerview/CustomAdapter.java27
-rw-r--r--samples/browseable/RecyclerView/src/com.example.android.recyclerview/RecyclerViewFragment.java89
-rw-r--r--samples/browseable/RenderScriptIntrinsic/AndroidManifest.xml4
-rw-r--r--samples/browseable/RenderScriptIntrinsic/_index.jd16
-rw-r--r--samples/browseable/RenderScriptIntrinsic/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/RenderScriptIntrinsic/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/RenderScriptIntrinsic/res/values/base-strings.xml3
-rw-r--r--samples/browseable/RepeatingAlarm/AndroidManifest.xml2
-rw-r--r--samples/browseable/RepeatingAlarm/_index.jd13
-rw-r--r--samples/browseable/RepeatingAlarm/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/RepeatingAlarm/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/RepeatingAlarm/res/values/base-strings.xml3
-rw-r--r--samples/browseable/RepeatingAlarm/res/values/strings.xml3
-rw-r--r--samples/browseable/RepeatingAlarm/src/com.example.android.repeatingalarm/MainActivity.java3
-rw-r--r--samples/browseable/RevealEffectBasic/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/RevealEffectBasic/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/RevealEffectBasic/res/values-v21/template-styles.xml22
-rw-r--r--samples/browseable/SkeletonWearableApp/Application/AndroidManifest.xml30
-rwxr-xr-xsamples/browseable/SkeletonWearableApp/Application/res/drawable-hdpi/ic_launcher.pngbin0 -> 4584 bytes
-rw-r--r--samples/browseable/SkeletonWearableApp/Application/res/drawable-hdpi/tile.9.pngbin0 -> 196 bytes
-rwxr-xr-xsamples/browseable/SkeletonWearableApp/Application/res/drawable-mdpi/ic_launcher.pngbin0 -> 2757 bytes
-rwxr-xr-xsamples/browseable/SkeletonWearableApp/Application/res/drawable-xhdpi/ic_launcher.pngbin0 -> 6603 bytes
-rwxr-xr-xsamples/browseable/SkeletonWearableApp/Application/res/drawable-xxhdpi/ic_launcher.pngbin0 -> 11788 bytes
-rwxr-xr-xsamples/browseable/SkeletonWearableApp/Application/res/layout/activity_main.xml36
-rw-r--r--samples/browseable/SkeletonWearableApp/Application/res/values-sw600dp/template-dimens.xml24
-rw-r--r--samples/browseable/SkeletonWearableApp/Application/res/values-sw600dp/template-styles.xml25
-rw-r--r--samples/browseable/SkeletonWearableApp/Application/res/values-v11/template-styles.xml22
-rw-r--r--samples/browseable/SkeletonWearableApp/Application/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/SkeletonWearableApp/Application/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/SkeletonWearableApp/Application/res/values/base-strings.xml31
-rw-r--r--samples/browseable/SkeletonWearableApp/Application/res/values/template-dimens.xml32
-rw-r--r--samples/browseable/SkeletonWearableApp/Application/res/values/template-styles.xml42
-rw-r--r--samples/browseable/SkeletonWearableApp/Wearable/AndroidManifest.xml51
-rwxr-xr-xsamples/browseable/SkeletonWearableApp/Wearable/res/drawable-hdpi/ic_launcher.pngbin0 -> 4584 bytes
-rwxr-xr-xsamples/browseable/SkeletonWearableApp/Wearable/res/drawable-mdpi/ic_launcher.pngbin0 -> 2757 bytes
-rwxr-xr-xsamples/browseable/SkeletonWearableApp/Wearable/res/drawable-xhdpi/ic_launcher.pngbin0 -> 6603 bytes
-rwxr-xr-xsamples/browseable/SkeletonWearableApp/Wearable/res/drawable-xxhdpi/ic_launcher.pngbin0 -> 11788 bytes
-rw-r--r--samples/browseable/SkeletonWearableApp/Wearable/res/layout/grid_activity.xml (renamed from samples/wearable/SkeletonWearableApp/Wearable/src/main/res/layout/grid_activity.xml)0
-rw-r--r--samples/browseable/SkeletonWearableApp/Wearable/res/layout/main_activity.xml (renamed from samples/wearable/SkeletonWearableApp/Wearable/src/main/res/layout/main_activity.xml)0
-rw-r--r--samples/browseable/SkeletonWearableApp/Wearable/res/values/dimens.xml (renamed from samples/wearable/SkeletonWearableApp/Wearable/src/main/res/values/dimens.xml)0
-rw-r--r--samples/browseable/SkeletonWearableApp/Wearable/res/values/strings.xml (renamed from samples/wearable/SkeletonWearableApp/Wearable/src/main/res/values/strings.xml)0
-rw-r--r--samples/browseable/SkeletonWearableApp/Wearable/src/com.example.android.google.wearable.app/GridExampleActivity.java115
-rw-r--r--samples/browseable/SkeletonWearableApp/Wearable/src/com.example.android.google.wearable.app/MainActivity.java (renamed from samples/wearable/SkeletonWearableApp/Wearable/src/main/java/com/example/android/google/wearable/app/MainActivity.java)0
-rw-r--r--samples/browseable/SkeletonWearableApp/_index.jd12
-rw-r--r--samples/browseable/SlidingTabsBasic/AndroidManifest.xml2
-rw-r--r--samples/browseable/SlidingTabsBasic/_index.jd14
-rw-r--r--samples/browseable/SlidingTabsBasic/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/SlidingTabsBasic/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/SlidingTabsBasic/res/values/base-strings.xml3
-rwxr-xr-xsamples/browseable/SlidingTabsBasic/res/values/strings.xml19
-rw-r--r--samples/browseable/SlidingTabsBasic/src/com.example.android.slidingtabsbasic/MainActivity.java13
-rw-r--r--samples/browseable/SlidingTabsColors/AndroidManifest.xml2
-rw-r--r--samples/browseable/SlidingTabsColors/_index.jd14
-rw-r--r--samples/browseable/SlidingTabsColors/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/SlidingTabsColors/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/SlidingTabsColors/res/values/base-strings.xml3
-rw-r--r--[-rwxr-xr-x]samples/browseable/SlidingTabsColors/res/values/strings.xml0
-rw-r--r--samples/browseable/SlidingTabsColors/src/com.example.android.slidingtabscolors/MainActivity.java13
-rw-r--r--samples/browseable/SpeedTracker/Application/AndroidManifest.xml46
-rw-r--r--samples/browseable/SpeedTracker/Application/res/drawable-hdpi/ic_launcher.pngbin0 -> 4311 bytes
-rw-r--r--samples/browseable/SpeedTracker/Application/res/drawable-hdpi/tile.9.pngbin0 -> 196 bytes
-rw-r--r--samples/browseable/SpeedTracker/Application/res/drawable-mdpi/ic_launcher.pngbin0 -> 2600 bytes
-rw-r--r--samples/browseable/SpeedTracker/Application/res/drawable-xhdpi/ic_launcher.pngbin0 -> 5894 bytes
-rw-r--r--samples/browseable/SpeedTracker/Application/res/drawable-xxhdpi/ic_launcher.pngbin0 -> 9540 bytes
-rw-r--r--samples/browseable/SpeedTracker/Application/res/drawable-xxxhdpi/ic_launcher.pngbin0 -> 13382 bytes
-rwxr-xr-xsamples/browseable/SpeedTracker/Application/res/layout/activity_main.xml36
-rw-r--r--samples/browseable/SpeedTracker/Application/res/layout/main_activity.xml51
-rw-r--r--samples/browseable/SpeedTracker/Application/res/values-sw600dp/template-dimens.xml24
-rw-r--r--samples/browseable/SpeedTracker/Application/res/values-sw600dp/template-styles.xml25
-rw-r--r--samples/browseable/SpeedTracker/Application/res/values-v11/template-styles.xml22
-rw-r--r--samples/browseable/SpeedTracker/Application/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/SpeedTracker/Application/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/SpeedTracker/Application/res/values/base-strings.xml37
-rw-r--r--samples/browseable/SpeedTracker/Application/res/values/strings.xml26
-rw-r--r--samples/browseable/SpeedTracker/Application/res/values/template-dimens.xml32
-rw-r--r--samples/browseable/SpeedTracker/Application/res/values/template-styles.xml42
-rw-r--r--samples/browseable/SpeedTracker/Application/src/com.example.android.wearable.speedtracker/LocationDataManager.java95
-rw-r--r--samples/browseable/SpeedTracker/Application/src/com.example.android.wearable.speedtracker/PhoneApplication.java43
-rw-r--r--samples/browseable/SpeedTracker/Application/src/com.example.android.wearable.speedtracker/PhoneMainActivity.java134
-rw-r--r--samples/browseable/SpeedTracker/Application/src/com.example.android.wearable.speedtracker/db/LocationDbHelper.java165
-rw-r--r--samples/browseable/SpeedTracker/Application/src/com.example.android.wearable.speedtracker/db/UpdateService.java135
-rw-r--r--samples/browseable/SpeedTracker/Shared/AndroidManifest.xml6
-rw-r--r--samples/browseable/SpeedTracker/Shared/src/com.example.android.wearable.speedtracker.common/Constants.java30
-rw-r--r--samples/browseable/SpeedTracker/Shared/src/com.example.android.wearable.speedtracker.common/LocationEntry.java61
-rw-r--r--samples/browseable/SpeedTracker/Shared/src/com.example.android.wearable.speedtracker.common/Utils.java37
-rw-r--r--samples/browseable/SpeedTracker/Wearable/AndroidManifest.xml59
-rw-r--r--samples/browseable/SpeedTracker/Wearable/res/drawable-hdpi/ic_launcher.pngbin0 -> 4311 bytes
-rw-r--r--samples/browseable/SpeedTracker/Wearable/res/drawable-mdpi/ic_boot_cancel.pngbin0 -> 535 bytes
-rw-r--r--samples/browseable/SpeedTracker/Wearable/res/drawable-mdpi/ic_launcher.pngbin0 -> 2600 bytes
-rw-r--r--samples/browseable/SpeedTracker/Wearable/res/drawable-nodpi/dot.pngbin0 -> 280 bytes
-rw-r--r--samples/browseable/SpeedTracker/Wearable/res/drawable-xhdpi/ic_cancel_80.pngbin0 -> 703 bytes
-rwxr-xr-xsamples/browseable/SpeedTracker/Wearable/res/drawable-xhdpi/ic_confirmation.pngbin0 -> 1499 bytes
-rw-r--r--samples/browseable/SpeedTracker/Wearable/res/drawable-xhdpi/ic_confirmation_80.pngbin0 -> 933 bytes
-rw-r--r--samples/browseable/SpeedTracker/Wearable/res/drawable-xhdpi/ic_launcher.pngbin0 -> 5894 bytes
-rw-r--r--samples/browseable/SpeedTracker/Wearable/res/drawable-xxhdpi/ic_gps_not_saving_grey600_96dp.pngbin0 -> 6470 bytes
-rw-r--r--samples/browseable/SpeedTracker/Wearable/res/drawable-xxhdpi/ic_gps_saving_grey600_96dp.pngbin0 -> 5667 bytes
-rw-r--r--samples/browseable/SpeedTracker/Wearable/res/drawable-xxhdpi/ic_launcher.pngbin0 -> 9540 bytes
-rw-r--r--samples/browseable/SpeedTracker/Wearable/res/drawable-xxhdpi/ic_settings_black_24dp.pngbin0 -> 1257 bytes
-rw-r--r--samples/browseable/SpeedTracker/Wearable/res/drawable-xxhdpi/ic_settings_googblue_24dp.pngbin0 -> 1849 bytes
-rw-r--r--samples/browseable/SpeedTracker/Wearable/res/drawable-xxhdpi/ic_settings_grey600_24dp.pngbin0 -> 1299 bytes
-rw-r--r--samples/browseable/SpeedTracker/Wearable/res/drawable-xxhdpi/ic_settings_white_24dp.pngbin0 -> 1273 bytes
-rw-r--r--samples/browseable/SpeedTracker/Wearable/res/drawable-xxxhdpi/ic_launcher.pngbin0 -> 13382 bytes
-rw-r--r--samples/browseable/SpeedTracker/Wearable/res/drawable/settings.xml6
-rw-r--r--samples/browseable/SpeedTracker/Wearable/res/drawable/wl_circle.xml (renamed from samples/wearable/Timer/Wearable/src/main/res/drawable/wl_circle.xml)0
-rw-r--r--samples/browseable/SpeedTracker/Wearable/res/layout/main_activity.xml101
-rw-r--r--samples/browseable/SpeedTracker/Wearable/res/layout/saving_activity.xml63
-rw-r--r--samples/browseable/SpeedTracker/Wearable/res/layout/speed_picker_activity.xml48
-rw-r--r--samples/browseable/SpeedTracker/Wearable/res/layout/speed_picker_item_layout.xml38
-rw-r--r--samples/browseable/SpeedTracker/Wearable/res/values/colors.xml29
-rw-r--r--samples/browseable/SpeedTracker/Wearable/res/values/dimens.xml23
-rw-r--r--samples/browseable/SpeedTracker/Wearable/res/values/integers.xml19
-rw-r--r--samples/browseable/SpeedTracker/Wearable/res/values/strings.xml35
-rw-r--r--samples/browseable/SpeedTracker/Wearable/src/com.example.android.wearable.speedtracker/SpeedPickerActivity.java87
-rw-r--r--samples/browseable/SpeedTracker/Wearable/src/com.example.android.wearable.speedtracker/WearableMainActivity.java349
-rw-r--r--samples/browseable/SpeedTracker/Wearable/src/com.example.android.wearable.speedtracker/ui/LocationSettingActivity.java75
-rw-r--r--samples/browseable/SpeedTracker/Wearable/src/com.example.android.wearable.speedtracker/ui/SpeedPickerLayout.java79
-rw-r--r--samples/browseable/SpeedTracker/Wearable/src/com.example.android.wearable.speedtracker/ui/SpeedPickerListAdapter.java89
-rw-r--r--samples/browseable/SpeedTracker/_index.jd18
-rw-r--r--samples/browseable/StorageClient/AndroidManifest.xml2
-rw-r--r--samples/browseable/StorageClient/_index.jd16
-rw-r--r--samples/browseable/StorageClient/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/StorageClient/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/StorageClient/res/values/base-strings.xml3
-rw-r--r--samples/browseable/StorageClient/res/values/strings.xml3
-rw-r--r--samples/browseable/StorageClient/src/com.example.android.storageclient/MainActivity.java3
-rw-r--r--samples/browseable/StorageProvider/AndroidManifest.xml4
-rw-r--r--samples/browseable/StorageProvider/_index.jd11
-rw-r--r--[-rwxr-xr-x]samples/browseable/StorageProvider/res/drawable-hdpi/ic_launcher.pngbin4165 -> 3454 bytes
-rw-r--r--[-rwxr-xr-x]samples/browseable/StorageProvider/res/drawable-mdpi/ic_launcher.pngbin2376 -> 2117 bytes
-rw-r--r--[-rwxr-xr-x]samples/browseable/StorageProvider/res/drawable-xhdpi/ic_launcher.pngbin6258 -> 4966 bytes
-rw-r--r--[-rwxr-xr-x]samples/browseable/StorageProvider/res/drawable-xxhdpi/ic_launcher.pngbin12088 -> 8803 bytes
-rwxr-xr-xsamples/browseable/StorageProvider/res/ic_launcher.pngbin4165 -> 0 bytes
-rw-r--r--samples/browseable/StorageProvider/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/StorageProvider/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/StorageProvider/res/values/base-strings.xml3
-rw-r--r--samples/browseable/StorageProvider/res/values/strings.xml3
-rw-r--r--samples/browseable/StorageProvider/src/com.example.android.storageprovider/MainActivity.java3
-rw-r--r--samples/browseable/SwipeRefreshLayoutBasic/AndroidManifest.xml2
-rw-r--r--samples/browseable/SwipeRefreshLayoutBasic/_index.jd14
-rw-r--r--samples/browseable/SwipeRefreshLayoutBasic/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/SwipeRefreshLayoutBasic/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/SwipeRefreshLayoutBasic/res/values/base-strings.xml3
-rw-r--r--[-rwxr-xr-x]samples/browseable/SwipeRefreshLayoutBasic/res/values/strings.xml0
-rw-r--r--samples/browseable/SwipeRefreshLayoutBasic/src/com.example.android.swiperefreshlayoutbasic/MainActivity.java13
-rw-r--r--samples/browseable/SwipeRefreshListFragment/AndroidManifest.xml2
-rw-r--r--samples/browseable/SwipeRefreshListFragment/_index.jd16
-rw-r--r--samples/browseable/SwipeRefreshListFragment/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/SwipeRefreshListFragment/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/SwipeRefreshListFragment/res/values/base-strings.xml3
-rw-r--r--[-rwxr-xr-x]samples/browseable/SwipeRefreshListFragment/res/values/strings.xml0
-rw-r--r--samples/browseable/SwipeRefreshListFragment/src/com.example.android.swiperefreshlistfragment/MainActivity.java13
-rw-r--r--samples/browseable/SwipeRefreshMultipleViews/AndroidManifest.xml2
-rw-r--r--samples/browseable/SwipeRefreshMultipleViews/_index.jd16
-rw-r--r--samples/browseable/SwipeRefreshMultipleViews/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/SwipeRefreshMultipleViews/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/SwipeRefreshMultipleViews/res/values/base-strings.xml3
-rw-r--r--[-rwxr-xr-x]samples/browseable/SwipeRefreshMultipleViews/res/values/strings.xml0
-rw-r--r--samples/browseable/SwipeRefreshMultipleViews/src/com.example.android.swiperefreshmultipleviews/MainActivity.java13
-rw-r--r--samples/browseable/SynchronizedNotifications/Application/AndroidManifest.xml56
-rw-r--r--samples/browseable/SynchronizedNotifications/Application/res/drawable-hdpi/ic_launcher.pngbin0 -> 4199 bytes
-rw-r--r--samples/browseable/SynchronizedNotifications/Application/res/drawable-hdpi/tile.9.pngbin0 -> 196 bytes
-rw-r--r--samples/browseable/SynchronizedNotifications/Application/res/drawable-mdpi/ic_launcher.pngbin0 -> 2535 bytes
-rw-r--r--samples/browseable/SynchronizedNotifications/Application/res/drawable-xhdpi/ic_launcher.pngbin0 -> 6022 bytes
-rw-r--r--samples/browseable/SynchronizedNotifications/Application/res/drawable-xxhdpi/ic_launcher.pngbin0 -> 11040 bytes
-rw-r--r--samples/browseable/SynchronizedNotifications/Application/res/layout-sw600dp-land/activity_main.xml42
-rw-r--r--samples/browseable/SynchronizedNotifications/Application/res/layout-sw600dp/activity_main.xml40
-rw-r--r--samples/browseable/SynchronizedNotifications/Application/res/layout/activity_main.xml43
-rw-r--r--samples/browseable/SynchronizedNotifications/Application/res/menu/main.xml30
-rw-r--r--samples/browseable/SynchronizedNotifications/Application/res/values-sw600dp/template-dimens.xml24
-rw-r--r--samples/browseable/SynchronizedNotifications/Application/res/values-sw600dp/template-styles.xml25
-rw-r--r--samples/browseable/SynchronizedNotifications/Application/res/values-v11/template-styles.xml22
-rw-r--r--samples/browseable/SynchronizedNotifications/Application/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/SynchronizedNotifications/Application/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/SynchronizedNotifications/Application/res/values/base-strings.xml29
-rw-r--r--samples/browseable/SynchronizedNotifications/Application/res/values/dimens.xml (renamed from samples/wearable/SynchronizedNotifications/Application/src/main/res/values/dimens.xml)0
-rw-r--r--samples/browseable/SynchronizedNotifications/Application/res/values/sample-strings.xml25
-rw-r--r--samples/browseable/SynchronizedNotifications/Application/res/values/template-dimens.xml32
-rw-r--r--samples/browseable/SynchronizedNotifications/Application/res/values/template-styles.xml54
-rw-r--r--samples/browseable/SynchronizedNotifications/Application/src/com.example.android.common/activities/SampleActivityBase.java52
-rw-r--r--samples/browseable/SynchronizedNotifications/Application/src/com.example.android.common/logger/Log.java236
-rw-r--r--samples/browseable/SynchronizedNotifications/Application/src/com.example.android.common/logger/LogFragment.java109
-rw-r--r--samples/browseable/SynchronizedNotifications/Application/src/com.example.android.common/logger/LogNode.java39
-rw-r--r--samples/browseable/SynchronizedNotifications/Application/src/com.example.android.common/logger/LogView.java145
-rw-r--r--samples/browseable/SynchronizedNotifications/Application/src/com.example.android.common/logger/LogWrapper.java75
-rw-r--r--samples/browseable/SynchronizedNotifications/Application/src/com.example.android.common/logger/MessageOnlyLogFilter.java60
-rw-r--r--samples/browseable/SynchronizedNotifications/Application/src/com.example.android.wearable.synchronizednotifications/DismissListener.java128
-rw-r--r--samples/browseable/SynchronizedNotifications/Application/src/com.example.android.wearable.synchronizednotifications/MainActivity.java82
-rw-r--r--samples/browseable/SynchronizedNotifications/Application/src/com.example.android.wearable.synchronizednotifications/SynchronizedNotificationsFragment.java198
-rw-r--r--samples/browseable/SynchronizedNotifications/Shared/AndroidManifest.xml25
-rw-r--r--samples/browseable/SynchronizedNotifications/Shared/res/values/strings.xml18
-rw-r--r--samples/browseable/SynchronizedNotifications/Shared/src/com.example.android.wearable.synchronizednotifications.common/Constants.java37
-rw-r--r--samples/browseable/SynchronizedNotifications/Wearable/AndroidManifest.xml55
-rw-r--r--samples/browseable/SynchronizedNotifications/Wearable/res/drawable-hdpi/ic_launcher.png (renamed from samples/wearable/SynchronizedNotifications/Application/src/main/res/drawable-hdpi/ic_launcher.png)bin297 -> 297 bytes
-rw-r--r--samples/browseable/SynchronizedNotifications/Wearable/res/drawable-mdpi/ic_launcher.png (renamed from samples/wearable/SynchronizedNotifications/Application/src/main/res/drawable-mdpi/ic_launcher.png)bin254 -> 254 bytes
-rw-r--r--samples/browseable/SynchronizedNotifications/Wearable/res/drawable-xhdpi/ic_launcher.png (renamed from samples/wearable/SynchronizedNotifications/Application/src/main/res/drawable-xhdpi/ic_launcher.png)bin342 -> 342 bytes
-rw-r--r--samples/browseable/SynchronizedNotifications/Wearable/res/layout/activity_wearable.xml (renamed from samples/wearable/SynchronizedNotifications/Wearable/src/main/res/layout/activity_wearable.xml)0
-rw-r--r--samples/browseable/SynchronizedNotifications/Wearable/res/values/strings.xml20
-rw-r--r--samples/browseable/SynchronizedNotifications/Wearable/src/com.example.android.wearable.synchronizednotifications/NotificationUpdateService.java164
-rw-r--r--samples/browseable/SynchronizedNotifications/Wearable/src/com.example.android.wearable.synchronizednotifications/WearableActivity.java28
-rw-r--r--samples/browseable/SynchronizedNotifications/_index.jd10
-rw-r--r--samples/browseable/TextLinkify/AndroidManifest.xml4
-rw-r--r--samples/browseable/TextLinkify/_index.jd18
-rw-r--r--samples/browseable/TextLinkify/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/TextLinkify/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/TextLinkify/res/values/base-strings.xml3
-rw-r--r--samples/browseable/TextSwitcher/AndroidManifest.xml4
-rw-r--r--samples/browseable/TextSwitcher/_index.jd14
-rw-r--r--samples/browseable/TextSwitcher/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/TextSwitcher/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/TextSwitcher/res/values/base-strings.xml3
-rw-r--r--samples/browseable/Timer/Application/AndroidManifest.xml30
-rwxr-xr-xsamples/browseable/Timer/Application/res/drawable-hdpi/ic_launcher.pngbin0 -> 4584 bytes
-rw-r--r--samples/browseable/Timer/Application/res/drawable-hdpi/tile.9.pngbin0 -> 196 bytes
-rwxr-xr-xsamples/browseable/Timer/Application/res/drawable-mdpi/ic_launcher.pngbin0 -> 2757 bytes
-rwxr-xr-xsamples/browseable/Timer/Application/res/drawable-xhdpi/ic_launcher.pngbin0 -> 6603 bytes
-rwxr-xr-xsamples/browseable/Timer/Application/res/drawable-xxhdpi/ic_launcher.pngbin0 -> 11788 bytes
-rwxr-xr-xsamples/browseable/Timer/Application/res/layout/activity_main.xml36
-rw-r--r--samples/browseable/Timer/Application/res/values-sw600dp/template-dimens.xml24
-rw-r--r--samples/browseable/Timer/Application/res/values-sw600dp/template-styles.xml25
-rw-r--r--samples/browseable/Timer/Application/res/values-v11/template-styles.xml22
-rw-r--r--samples/browseable/Timer/Application/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/Timer/Application/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/Timer/Application/res/values/base-strings.xml29
-rw-r--r--samples/browseable/Timer/Application/res/values/template-dimens.xml32
-rw-r--r--samples/browseable/Timer/Application/res/values/template-styles.xml42
-rw-r--r--samples/browseable/Timer/Wearable/AndroidManifest.xml47
-rw-r--r--samples/browseable/Timer/Wearable/res/drawable/ic_cc_alarm.png (renamed from samples/wearable/Timer/Wearable/src/main/res/drawable/ic_cc_alarm.png)bin2303 -> 2303 bytes
-rw-r--r--samples/browseable/Timer/Wearable/res/drawable/wl_circle.xml6
-rw-r--r--samples/browseable/Timer/Wearable/res/layout/timer_list_item.xml (renamed from samples/wearable/Timer/Wearable/src/main/res/layout/timer_list_item.xml)0
-rw-r--r--samples/browseable/Timer/Wearable/res/layout/timer_set_timer.xml (renamed from samples/wearable/Timer/Wearable/src/main/res/layout/timer_set_timer.xml)0
-rw-r--r--samples/browseable/Timer/Wearable/res/mipmap-hdpi/ic_launcher.png (renamed from samples/wearable/Timer/Wearable/src/main/res/mipmap-hdpi/ic_launcher.png)bin11523 -> 11523 bytes
-rw-r--r--samples/browseable/Timer/Wearable/res/mipmap-mdpi/ic_launcher.png (renamed from samples/wearable/Timer/Wearable/src/main/res/mipmap-mdpi/ic_launcher.png)bin6368 -> 6368 bytes
-rw-r--r--samples/browseable/Timer/Wearable/res/mipmap-xhdpi/ic_launcher.png (renamed from samples/wearable/Timer/Wearable/src/main/res/mipmap-xhdpi/ic_launcher.png)bin16892 -> 16892 bytes
-rw-r--r--samples/browseable/Timer/Wearable/res/mipmap-xxhdpi/ic_launcher.png (renamed from samples/wearable/Timer/Wearable/src/main/res/mipmap-xxhdpi/ic_launcher.png)bin27697 -> 27697 bytes
-rw-r--r--samples/browseable/Timer/Wearable/res/mipmap-xxxhdpi/ic_launcher.png (renamed from samples/wearable/Timer/Wearable/src/main/res/mipmap-xxxhdpi/ic_launcher.png)bin46860 -> 46860 bytes
-rw-r--r--samples/browseable/Timer/Wearable/res/values/colors.xml (renamed from samples/wearable/Timer/Wearable/src/main/res/values/colors.xml)0
-rw-r--r--samples/browseable/Timer/Wearable/res/values/integers.xml (renamed from samples/wearable/Timer/Wearable/src/main/res/values/integers.xml)0
-rw-r--r--samples/browseable/Timer/Wearable/res/values/strings.xml (renamed from samples/wearable/Timer/Wearable/src/main/res/values/strings.xml)0
-rw-r--r--samples/browseable/Timer/Wearable/src/com.example.android.wearable.timer/SetTimerActivity.java (renamed from samples/wearable/Timer/Wearable/src/main/java/com/example/android/wearable/timer/SetTimerActivity.java)0
-rw-r--r--samples/browseable/Timer/Wearable/src/com.example.android.wearable.timer/TimerNotificationService.java (renamed from samples/wearable/Timer/Wearable/src/main/java/com/example/android/wearable/timer/TimerNotificationService.java)0
-rw-r--r--samples/browseable/Timer/Wearable/src/com.example.android.wearable.timer/WearableListItemLayout.java68
-rw-r--r--samples/browseable/Timer/Wearable/src/com.example.android.wearable.timer/util/Constants.java (renamed from samples/wearable/Timer/Wearable/src/main/java/com/example/android/wearable/timer/util/Constants.java)0
-rw-r--r--samples/browseable/Timer/Wearable/src/com.example.android.wearable.timer/util/TimerFormat.java (renamed from samples/wearable/Timer/Wearable/src/main/java/com/example/android/wearable/timer/util/TimerFormat.java)0
-rw-r--r--samples/browseable/Timer/Wearable/src/com.example.android.wearable.timer/util/TimerObj.java (renamed from samples/wearable/Timer/Wearable/src/main/java/com/example/android/wearable/timer/util/TimerObj.java)0
-rw-r--r--samples/browseable/Timer/_index.jd10
-rw-r--r--samples/browseable/WatchFace/Application/AndroidManifest.xml74
-rwxr-xr-xsamples/browseable/WatchFace/Application/res/drawable-hdpi/ic_launcher.pngbin0 -> 4584 bytes
-rw-r--r--samples/browseable/WatchFace/Application/res/drawable-hdpi/tile.9.pngbin0 -> 196 bytes
-rwxr-xr-xsamples/browseable/WatchFace/Application/res/drawable-mdpi/ic_launcher.pngbin0 -> 2757 bytes
-rwxr-xr-xsamples/browseable/WatchFace/Application/res/drawable-xhdpi/ic_launcher.pngbin0 -> 6603 bytes
-rwxr-xr-xsamples/browseable/WatchFace/Application/res/drawable-xxhdpi/ic_launcher.pngbin0 -> 11788 bytes
-rw-r--r--samples/browseable/WatchFace/Application/res/layout/activity_analog_watch_face_config.xml27
-rw-r--r--samples/browseable/WatchFace/Application/res/layout/activity_digital_watch_face_config.xml95
-rwxr-xr-xsamples/browseable/WatchFace/Application/res/layout/activity_main.xml36
-rw-r--r--samples/browseable/WatchFace/Application/res/layout/activity_tilt_watch_face_config.xml27
-rw-r--r--samples/browseable/WatchFace/Application/res/values-sw600dp/template-dimens.xml24
-rw-r--r--samples/browseable/WatchFace/Application/res/values-sw600dp/template-styles.xml25
-rw-r--r--samples/browseable/WatchFace/Application/res/values-v11/template-styles.xml22
-rw-r--r--samples/browseable/WatchFace/Application/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/WatchFace/Application/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/WatchFace/Application/res/values/base-strings.xml31
-rw-r--r--samples/browseable/WatchFace/Application/res/values/strings.xml45
-rw-r--r--samples/browseable/WatchFace/Application/res/values/template-dimens.xml32
-rw-r--r--samples/browseable/WatchFace/Application/res/values/template-styles.xml42
-rw-r--r--samples/browseable/WatchFace/Application/src/com.example.android.wearable.watchface/AnalogAndCardBoundsWatchFaceConfigActivity.java37
-rw-r--r--samples/browseable/WatchFace/Application/src/com.example.android.wearable.watchface/DigitalWatchFaceCompanionConfigActivity.java217
-rw-r--r--samples/browseable/WatchFace/Application/src/com.example.android.wearable.watchface/TiltWatchFaceConfigActivity.java37
-rw-r--r--samples/browseable/WatchFace/Wearable/AndroidManifest.xml205
-rw-r--r--samples/browseable/WatchFace/Wearable/res/drawable-hdpi/bg.pngbin0 -> 61104 bytes
-rw-r--r--samples/browseable/WatchFace/Wearable/res/drawable-hdpi/ic_launcher.pngbin0 -> 4584 bytes
-rw-r--r--samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_analog.pngbin0 -> 35216 bytes
-rw-r--r--samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_analog_circular.pngbin0 -> 89304 bytes
-rw-r--r--samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_calendar.pngbin0 -> 1793 bytes
-rw-r--r--samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_calendar_circular.pngbin0 -> 4572 bytes
-rw-r--r--samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_card_bounds.pngbin0 -> 9853 bytes
-rw-r--r--samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_card_bounds_circular.pngbin0 -> 24280 bytes
-rw-r--r--samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_digital.pngbin0 -> 50993 bytes
-rw-r--r--samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_digital_circular.pngbin0 -> 8256 bytes
-rw-r--r--samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_tilt.pngbin0 -> 5703 bytes
-rw-r--r--samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_tilt_circular.pngbin0 -> 9987 bytes
-rw-r--r--samples/browseable/WatchFace/Wearable/res/drawable-mdpi/ic_launcher.pngbin0 -> 2757 bytes
-rw-r--r--samples/browseable/WatchFace/Wearable/res/drawable-xhdpi/ic_launcher.pngbin0 -> 6603 bytes
-rw-r--r--samples/browseable/WatchFace/Wearable/res/drawable-xxhdpi/ic_launcher.pngbin0 -> 11788 bytes
-rw-r--r--samples/browseable/WatchFace/Wearable/res/layout/activity_digital_config.xml39
-rw-r--r--samples/browseable/WatchFace/Wearable/res/layout/color_picker_item.xml38
-rw-r--r--samples/browseable/WatchFace/Wearable/res/values/color.xml23
-rw-r--r--samples/browseable/WatchFace/Wearable/res/values/dimens.xml26
-rw-r--r--samples/browseable/WatchFace/Wearable/res/values/strings.xml51
-rw-r--r--samples/browseable/WatchFace/Wearable/res/xml/watch_face.xml16
-rw-r--r--samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/AnalogWatchFaceService.java334
-rw-r--r--samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/CalendarWatchFaceService.java232
-rw-r--r--samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/CardBoundsWatchFaceService.java103
-rw-r--r--samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/DigitalWatchFaceConfigListenerService.java91
-rw-r--r--samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/DigitalWatchFaceService.java605
-rw-r--r--samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/DigitalWatchFaceUtil.java205
-rw-r--r--samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/DigitalWatchFaceWearableConfigActivity.java298
-rw-r--r--samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/Gles2ColoredTriangleList.java278
-rw-r--r--samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/SweepWatchFaceService.java275
-rw-r--r--samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/TiltWatchFaceService.java478
-rw-r--r--samples/browseable/WatchFace/_index.jd12
-rw-r--r--samples/browseable/WatchViewStub/Application/AndroidManifest.xml30
-rwxr-xr-xsamples/browseable/WatchViewStub/Application/res/drawable-hdpi/ic_launcher.pngbin0 -> 4584 bytes
-rw-r--r--samples/browseable/WatchViewStub/Application/res/drawable-hdpi/tile.9.pngbin0 -> 196 bytes
-rwxr-xr-xsamples/browseable/WatchViewStub/Application/res/drawable-mdpi/ic_launcher.pngbin0 -> 2757 bytes
-rwxr-xr-xsamples/browseable/WatchViewStub/Application/res/drawable-xhdpi/ic_launcher.pngbin0 -> 6603 bytes
-rwxr-xr-xsamples/browseable/WatchViewStub/Application/res/drawable-xxhdpi/ic_launcher.pngbin0 -> 11788 bytes
-rwxr-xr-xsamples/browseable/WatchViewStub/Application/res/layout/activity_main.xml36
-rw-r--r--samples/browseable/WatchViewStub/Application/res/values-sw600dp/template-dimens.xml24
-rw-r--r--samples/browseable/WatchViewStub/Application/res/values-sw600dp/template-styles.xml25
-rw-r--r--samples/browseable/WatchViewStub/Application/res/values-v11/template-styles.xml22
-rw-r--r--samples/browseable/WatchViewStub/Application/res/values-v21/base-colors.xml20
-rw-r--r--samples/browseable/WatchViewStub/Application/res/values-v21/base-template-styles.xml23
-rw-r--r--samples/browseable/WatchViewStub/Application/res/values/base-strings.xml28
-rw-r--r--samples/browseable/WatchViewStub/Application/res/values/template-dimens.xml32
-rw-r--r--samples/browseable/WatchViewStub/Application/res/values/template-styles.xml42
-rw-r--r--samples/browseable/WatchViewStub/Wearable/AndroidManifest.xml40
-rwxr-xr-xsamples/browseable/WatchViewStub/Wearable/res/drawable-hdpi/ic_launcher.pngbin0 -> 4584 bytes
-rwxr-xr-xsamples/browseable/WatchViewStub/Wearable/res/drawable-mdpi/ic_launcher.pngbin0 -> 2757 bytes
-rwxr-xr-xsamples/browseable/WatchViewStub/Wearable/res/drawable-xhdpi/ic_launcher.pngbin0 -> 6603 bytes
-rwxr-xr-xsamples/browseable/WatchViewStub/Wearable/res/drawable-xxhdpi/ic_launcher.pngbin0 -> 11788 bytes
-rw-r--r--samples/browseable/WatchViewStub/Wearable/res/drawable/rect_background.xml (renamed from samples/wearable/WatchViewStub/Wearable/src/main/res/drawable/rect_background.xml)0
-rw-r--r--samples/browseable/WatchViewStub/Wearable/res/drawable/round_background.xml (renamed from samples/wearable/WatchViewStub/Wearable/src/main/res/drawable/round_background.xml)0
-rw-r--r--samples/browseable/WatchViewStub/Wearable/res/layout/main_activity.xml (renamed from samples/wearable/WatchViewStub/Wearable/src/main/res/layout/main_activity.xml)0
-rw-r--r--samples/browseable/WatchViewStub/Wearable/res/layout/rect_layout.xml (renamed from samples/wearable/WatchViewStub/Wearable/src/main/res/layout/rect_layout.xml)0
-rw-r--r--samples/browseable/WatchViewStub/Wearable/res/layout/round_layout.xml (renamed from samples/wearable/WatchViewStub/Wearable/src/main/res/layout/round_layout.xml)0
-rw-r--r--samples/browseable/WatchViewStub/Wearable/res/values/dimens.xml (renamed from samples/wearable/WatchViewStub/Wearable/src/main/res/values/dimens.xml)0
-rw-r--r--samples/browseable/WatchViewStub/Wearable/res/values/strings.xml (renamed from samples/wearable/WatchViewStub/Wearable/src/main/res/values/strings.xml)0
-rw-r--r--samples/browseable/WatchViewStub/Wearable/src/com.example.android.google.wearable.watchviewstub/MainActivity.java (renamed from samples/wearable/WatchViewStub/Wearable/src/main/java/com/example/android/google/wearable/watchviewstub/MainActivity.java)0
-rw-r--r--samples/browseable/WatchViewStub/_index.jd9
-rw-r--r--samples/samples_source.prop_template2
-rw-r--r--samples/wearable/.gitignore42
-rw-r--r--samples/wearable/AgendaData/Application/build.gradle26
-rw-r--r--samples/wearable/AgendaData/Application/proguard-rules.txt28
-rw-r--r--samples/wearable/AgendaData/Application/project.properties14
-rw-r--r--samples/wearable/AgendaData/Application/src/main/AndroidManifest.xml45
-rw-r--r--samples/wearable/AgendaData/Application/src/main/res/values/strings.xml22
-rw-r--r--samples/wearable/AgendaData/Application/src/main/res/values/styles.xml26
-rw-r--r--samples/wearable/AgendaData/Wearable/build.gradle25
-rw-r--r--samples/wearable/AgendaData/Wearable/proguard-rules.txt22
-rw-r--r--samples/wearable/AgendaData/Wearable/project.properties14
-rw-r--r--samples/wearable/AgendaData/Wearable/src/main/AndroidManifest.xml43
-rw-r--r--samples/wearable/AgendaData/_index.html17
-rw-r--r--samples/wearable/AgendaData/build.gradle14
-rw-r--r--samples/wearable/AgendaData/gradle.properties18
-rw-r--r--samples/wearable/AgendaData/gradle/wrapper/gradle-wrapper.jarbin49896 -> 0 bytes
-rw-r--r--samples/wearable/AgendaData/gradle/wrapper/gradle-wrapper.properties6
-rwxr-xr-xsamples/wearable/AgendaData/gradlew164
-rwxr-xr-xsamples/wearable/AgendaData/gradlew.bat90
-rw-r--r--samples/wearable/AgendaData/screenshots/companion_agenda_data.pngbin189298 -> 0 bytes
-rw-r--r--samples/wearable/AgendaData/screenshots/dummy_calendar_event.pngbin52952 -> 0 bytes
-rw-r--r--samples/wearable/AgendaData/settings.gradle1
-rw-r--r--samples/wearable/DataLayer/Application/build.gradle26
-rw-r--r--samples/wearable/DataLayer/Application/proguard-rules.txt20
-rw-r--r--samples/wearable/DataLayer/Application/src/main/AndroidManifest.xml41
-rw-r--r--samples/wearable/DataLayer/Application/src/main/res/values/strings.xml23
-rw-r--r--samples/wearable/DataLayer/Wearable/build.gradle24
-rw-r--r--samples/wearable/DataLayer/Wearable/proguard-rules.txt20
-rw-r--r--samples/wearable/DataLayer/Wearable/src/main/AndroidManifest.xml52
-rw-r--r--samples/wearable/DataLayer/_index.html15
-rw-r--r--samples/wearable/DataLayer/build.gradle14
-rw-r--r--samples/wearable/DataLayer/gradle/wrapper/gradle-wrapper.jarbin49896 -> 0 bytes
-rw-r--r--samples/wearable/DataLayer/gradle/wrapper/gradle-wrapper.properties6
-rwxr-xr-xsamples/wearable/DataLayer/gradlew164
-rwxr-xr-xsamples/wearable/DataLayer/gradlew.bat90
-rw-r--r--samples/wearable/DataLayer/screenshots/phone_image.pngbin1549078 -> 0 bytes
-rw-r--r--samples/wearable/DataLayer/screenshots/wearable_background_image.pngbin150420 -> 0 bytes
-rw-r--r--samples/wearable/DataLayer/settings.gradle1
-rw-r--r--samples/wearable/DelayedConfirmation/Application/build.gradle25
-rw-r--r--samples/wearable/DelayedConfirmation/Application/proguard-rules.txt20
-rw-r--r--samples/wearable/DelayedConfirmation/Application/src/main/AndroidManifest.xml39
-rw-r--r--samples/wearable/DelayedConfirmation/Application/src/main/res/values/strings.xml24
-rw-r--r--samples/wearable/DelayedConfirmation/Wearable/build.gradle25
-rw-r--r--samples/wearable/DelayedConfirmation/Wearable/proguard-rules.txt21
-rw-r--r--samples/wearable/DelayedConfirmation/Wearable/src/main/AndroidManifest.xml44
-rw-r--r--samples/wearable/DelayedConfirmation/_index.html28
-rw-r--r--samples/wearable/DelayedConfirmation/build.gradle14
-rw-r--r--samples/wearable/DelayedConfirmation/gradle.properties18
-rw-r--r--samples/wearable/DelayedConfirmation/gradle/wrapper/gradle-wrapper.jarbin49896 -> 0 bytes
-rw-r--r--samples/wearable/DelayedConfirmation/gradle/wrapper/gradle-wrapper.properties6
-rwxr-xr-xsamples/wearable/DelayedConfirmation/gradlew164
-rwxr-xr-xsamples/wearable/DelayedConfirmation/gradlew.bat90
-rw-r--r--samples/wearable/DelayedConfirmation/screenshots/companion_delayed_confirmation.pngbin111638 -> 0 bytes
-rw-r--r--samples/wearable/DelayedConfirmation/screenshots/delayed_confirmation_box_inset_all.pngbin21123 -> 0 bytes
-rw-r--r--samples/wearable/DelayedConfirmation/screenshots/delayed_confirmation_box_inset_top.pngbin21178 -> 0 bytes
-rw-r--r--samples/wearable/DelayedConfirmation/screenshots/delayed_confirmation_notification.pngbin123940 -> 0 bytes
-rw-r--r--samples/wearable/DelayedConfirmation/settings.gradle1
-rw-r--r--samples/wearable/ElizaChat/Application/build.gradle24
-rw-r--r--samples/wearable/ElizaChat/Application/proguard-rules.txt20
-rw-r--r--samples/wearable/ElizaChat/Application/project.properties14
-rw-r--r--samples/wearable/ElizaChat/Application/src/main/AndroidManifest.xml42
-rw-r--r--samples/wearable/ElizaChat/Application/src/main/java/com/example/android/wearable/elizachat/MainActivity.java107
-rw-r--r--samples/wearable/ElizaChat/Application/src/main/res/values/strings.xml26
-rw-r--r--samples/wearable/ElizaChat/Application/src/main/res/values/styles.xml24
-rw-r--r--samples/wearable/ElizaChat/_index.html33
-rw-r--r--samples/wearable/ElizaChat/build.gradle14
-rw-r--r--samples/wearable/ElizaChat/gradle.properties18
-rw-r--r--samples/wearable/ElizaChat/gradle/wrapper/gradle-wrapper.jarbin49896 -> 0 bytes
-rw-r--r--samples/wearable/ElizaChat/gradle/wrapper/gradle-wrapper.properties6
-rwxr-xr-xsamples/wearable/ElizaChat/gradlew164
-rwxr-xr-xsamples/wearable/ElizaChat/gradlew.bat90
-rw-r--r--samples/wearable/ElizaChat/screenshots/companion_eliza_chat.pngbin68875 -> 0 bytes
-rw-r--r--samples/wearable/ElizaChat/screenshots/companion_eliza_chat_response.pngbin96693 -> 0 bytes
-rw-r--r--samples/wearable/ElizaChat/screenshots/wearable_eliza_notification.pngbin43519 -> 0 bytes
-rw-r--r--samples/wearable/ElizaChat/screenshots/wearable_voice_reply.pngbin8902 -> 0 bytes
-rw-r--r--samples/wearable/ElizaChat/settings.gradle1
-rw-r--r--samples/wearable/EmbeddedApp/Application/build.gradle34
-rw-r--r--samples/wearable/EmbeddedApp/Application/proguard-rules.txt17
-rw-r--r--samples/wearable/EmbeddedApp/Application/src/main/AndroidManifest.xml35
-rw-r--r--samples/wearable/EmbeddedApp/Application/src/main/res/values/strings.xml25
-rw-r--r--samples/wearable/EmbeddedApp/Wearable/build.gradle30
-rw-r--r--samples/wearable/EmbeddedApp/Wearable/proguard-rules.txt17
-rw-r--r--samples/wearable/EmbeddedApp/Wearable/src/main/AndroidManifest.xml37
-rw-r--r--samples/wearable/EmbeddedApp/_index.html11
-rw-r--r--samples/wearable/EmbeddedApp/build.gradle14
-rw-r--r--samples/wearable/EmbeddedApp/debug.keystorebin1395 -> 0 bytes
-rw-r--r--samples/wearable/EmbeddedApp/gradle/wrapper/gradle-wrapper.jarbin49896 -> 0 bytes
-rw-r--r--samples/wearable/EmbeddedApp/gradle/wrapper/gradle-wrapper.properties6
-rwxr-xr-xsamples/wearable/EmbeddedApp/gradlew164
-rwxr-xr-xsamples/wearable/EmbeddedApp/gradlew.bat90
-rw-r--r--samples/wearable/EmbeddedApp/screenshots/embedded_wearable_app.pngbin21543 -> 0 bytes
-rw-r--r--samples/wearable/EmbeddedApp/screenshots/phone_app.pngbin164943 -> 0 bytes
-rw-r--r--samples/wearable/EmbeddedApp/settings.gradle1
-rw-r--r--samples/wearable/FindMyPhone/Application/build.gradle26
-rw-r--r--samples/wearable/FindMyPhone/Application/proguard-rules.txt22
-rw-r--r--samples/wearable/FindMyPhone/Application/project.properties14
-rw-r--r--samples/wearable/FindMyPhone/Application/src/main/AndroidManifest.xml39
-rw-r--r--samples/wearable/FindMyPhone/Application/src/main/res/values/strings.xml21
-rw-r--r--samples/wearable/FindMyPhone/Wearable/build.gradle25
-rw-r--r--samples/wearable/FindMyPhone/Wearable/proguard-rules.txt22
-rw-r--r--samples/wearable/FindMyPhone/Wearable/project.properties14
-rw-r--r--samples/wearable/FindMyPhone/Wearable/src/main/AndroidManifest.xml51
-rw-r--r--samples/wearable/FindMyPhone/_index.html21
-rw-r--r--samples/wearable/FindMyPhone/build.gradle14
-rw-r--r--samples/wearable/FindMyPhone/gradle.properties18
-rw-r--r--samples/wearable/FindMyPhone/gradle/wrapper/gradle-wrapper.jarbin49896 -> 0 bytes
-rw-r--r--samples/wearable/FindMyPhone/gradle/wrapper/gradle-wrapper.properties6
-rwxr-xr-xsamples/wearable/FindMyPhone/gradlew164
-rwxr-xr-xsamples/wearable/FindMyPhone/gradlew.bat90
-rw-r--r--samples/wearable/FindMyPhone/screenshots/find_my_phone_activity.pngbin143295 -> 0 bytes
-rw-r--r--samples/wearable/FindMyPhone/screenshots/find_my_phone_notification.pngbin14452 -> 0 bytes
-rw-r--r--samples/wearable/FindMyPhone/settings.gradle1
-rw-r--r--samples/wearable/Flashlight/Wearable/build.gradle24
-rw-r--r--samples/wearable/Flashlight/Wearable/proguard-rules.txt44
-rw-r--r--samples/wearable/Flashlight/Wearable/src/main/AndroidManifest.xml37
-rw-r--r--samples/wearable/Flashlight/_index.html12
-rw-r--r--samples/wearable/Flashlight/build.gradle14
-rw-r--r--samples/wearable/Flashlight/gradle/wrapper/gradle-wrapper.jarbin49896 -> 0 bytes
-rw-r--r--samples/wearable/Flashlight/gradle/wrapper/gradle-wrapper.properties6
-rwxr-xr-xsamples/wearable/Flashlight/gradlew164
-rwxr-xr-xsamples/wearable/Flashlight/gradlew.bat90
-rw-r--r--samples/wearable/Flashlight/screenshots/flashlight.pngbin5402 -> 0 bytes
-rw-r--r--samples/wearable/Flashlight/screenshots/party_mode.gifbin7329 -> 0 bytes
-rw-r--r--samples/wearable/Flashlight/settings.gradle1
-rw-r--r--samples/wearable/Geofencing/Application/build.gradle26
-rw-r--r--samples/wearable/Geofencing/Application/proguard-rules.txt20
-rw-r--r--samples/wearable/Geofencing/Application/project.properties14
-rw-r--r--samples/wearable/Geofencing/Application/src/main/AndroidManifest.xml48
-rw-r--r--samples/wearable/Geofencing/Application/src/main/java/com/example/android/wearable/geofencing/GeofenceTransitionsIntentService.java119
-rw-r--r--samples/wearable/Geofencing/Application/src/main/java/com/example/android/wearable/geofencing/MainActivity.java240
-rw-r--r--samples/wearable/Geofencing/Application/src/main/res/values/strings.xml20
-rw-r--r--samples/wearable/Geofencing/Wearable/build.gradle25
-rw-r--r--samples/wearable/Geofencing/Wearable/proguard-rules.txt20
-rw-r--r--samples/wearable/Geofencing/Wearable/project.properties14
-rw-r--r--samples/wearable/Geofencing/Wearable/src/main/AndroidManifest.xml41
-rw-r--r--samples/wearable/Geofencing/_index.html17
-rw-r--r--samples/wearable/Geofencing/build.gradle14
-rw-r--r--samples/wearable/Geofencing/gradle/wrapper/gradle-wrapper.jarbin49896 -> 0 bytes
-rw-r--r--samples/wearable/Geofencing/gradle/wrapper/gradle-wrapper.properties6
-rwxr-xr-xsamples/wearable/Geofencing/gradlew164
-rwxr-xr-xsamples/wearable/Geofencing/gradlew.bat90
-rw-r--r--samples/wearable/Geofencing/screenshots/android_building_check_in.pngbin107191 -> 0 bytes
-rw-r--r--samples/wearable/Geofencing/settings.gradle1
-rw-r--r--samples/wearable/GridViewPager/Wearable/build.gradle24
-rw-r--r--samples/wearable/GridViewPager/Wearable/proguard-rules.txt22
-rw-r--r--samples/wearable/GridViewPager/Wearable/src/main/AndroidManifest.xml37
-rw-r--r--samples/wearable/GridViewPager/Wearable/src/main/java/com/example/android/wearable/gridviewpager/MainActivity.java56
-rw-r--r--samples/wearable/GridViewPager/Wearable/src/main/java/com/example/android/wearable/gridviewpager/SampleGridPagerAdapter.java134
-rw-r--r--samples/wearable/GridViewPager/Wearable/src/main/res/layout/activity_main.xml22
-rw-r--r--samples/wearable/GridViewPager/Wearable/src/main/res/values/dimens.xml21
-rw-r--r--samples/wearable/GridViewPager/Wearable/src/main/res/values/strings.xml56
-rw-r--r--samples/wearable/GridViewPager/_index.html12
-rw-r--r--samples/wearable/GridViewPager/build.gradle14
-rw-r--r--samples/wearable/GridViewPager/gradle.properties18
-rw-r--r--samples/wearable/GridViewPager/gradle/wrapper/gradle-wrapper.jarbin49896 -> 0 bytes
-rw-r--r--samples/wearable/GridViewPager/gradle/wrapper/gradle-wrapper.properties6
-rwxr-xr-xsamples/wearable/GridViewPager/gradlew164
-rwxr-xr-xsamples/wearable/GridViewPager/gradlew.bat90
-rw-r--r--samples/wearable/GridViewPager/screenshots/grid_view_pager.gifbin518920 -> 0 bytes
-rw-r--r--samples/wearable/GridViewPager/settings.gradle1
-rw-r--r--samples/wearable/JumpingJack/Wearable/build.gradle33
-rw-r--r--samples/wearable/JumpingJack/Wearable/proguard-rules.txt17
-rw-r--r--samples/wearable/JumpingJack/Wearable/src/main/AndroidManifest.xml39
-rw-r--r--samples/wearable/JumpingJack/Wearable/src/main/java/com/example/android/wearable/jumpingjack/MainActivity.java257
-rw-r--r--samples/wearable/JumpingJack/Wearable/src/main/java/com/example/android/wearable/jumpingjack/fragments/SettingsFragment.java55
-rw-r--r--samples/wearable/JumpingJack/_index.html10
-rw-r--r--samples/wearable/JumpingJack/build.gradle15
-rw-r--r--samples/wearable/JumpingJack/gradle.properties18
-rw-r--r--samples/wearable/JumpingJack/gradle/wrapper/gradle-wrapper.jarbin49896 -> 0 bytes
-rw-r--r--samples/wearable/JumpingJack/gradle/wrapper/gradle-wrapper.properties6
-rwxr-xr-xsamples/wearable/JumpingJack/gradlew164
-rwxr-xr-xsamples/wearable/JumpingJack/gradlew.bat90
-rw-r--r--samples/wearable/JumpingJack/license.txt5
-rw-r--r--samples/wearable/JumpingJack/proguard-rules.txt17
-rw-r--r--samples/wearable/JumpingJack/screenshots/jumping_jack.gifbin5199 -> 0 bytes
-rw-r--r--samples/wearable/JumpingJack/settings.gradle1
-rw-r--r--samples/wearable/Notifications/Application/build.gradle25
-rw-r--r--samples/wearable/Notifications/Application/proguard-rules.txt22
-rw-r--r--samples/wearable/Notifications/Application/src/main/AndroidManifest.xml47
-rw-r--r--samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/MainActivity.java352
-rw-r--r--samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/NotificationPresets.java479
-rw-r--r--samples/wearable/Notifications/Application/src/main/res/values/colors.xml19
-rw-r--r--samples/wearable/Notifications/Application/src/main/res/values/strings.xml193
-rw-r--r--samples/wearable/Notifications/Application/src/main/res/values/styles.xml29
-rw-r--r--samples/wearable/Notifications/Wearable/build.gradle24
-rw-r--r--samples/wearable/Notifications/Wearable/proguard-rules.txt22
-rw-r--r--samples/wearable/Notifications/Wearable/src/main/AndroidManifest.xml50
-rw-r--r--samples/wearable/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/WearableListItemLayout.java91
-rw-r--r--samples/wearable/Notifications/_index.html76
-rw-r--r--samples/wearable/Notifications/build.gradle14
-rw-r--r--samples/wearable/Notifications/gradle.properties18
-rw-r--r--samples/wearable/Notifications/gradle/wrapper/gradle-wrapper.jarbin49896 -> 0 bytes
-rw-r--r--samples/wearable/Notifications/gradle/wrapper/gradle-wrapper.properties6
-rwxr-xr-xsamples/wearable/Notifications/gradlew164
-rwxr-xr-xsamples/wearable/Notifications/gradlew.bat90
-rw-r--r--samples/wearable/Notifications/screenshots/basic-menu.pngbin8209 -> 0 bytes
-rw-r--r--samples/wearable/Notifications/screenshots/basic.pngbin11548 -> 0 bytes
-rw-r--r--samples/wearable/Notifications/screenshots/bottom-aligned.pngbin21453 -> 0 bytes
-rw-r--r--samples/wearable/Notifications/screenshots/bundle.pngbin14524 -> 0 bytes
-rw-r--r--samples/wearable/Notifications/screenshots/companion-bottom-aligned.pngbin251749 -> 0 bytes
-rw-r--r--samples/wearable/Notifications/screenshots/companion-bundle.pngbin242834 -> 0 bytes
-rw-r--r--samples/wearable/Notifications/screenshots/companion-content-action.pngbin246241 -> 0 bytes
-rw-r--r--samples/wearable/Notifications/screenshots/companion-multiple-page.pngbin457655 -> 0 bytes
-rw-r--r--samples/wearable/Notifications/screenshots/content-action.pngbin8621 -> 0 bytes
-rw-r--r--samples/wearable/Notifications/screenshots/content-action2.pngbin9653 -> 0 bytes
-rw-r--r--samples/wearable/Notifications/screenshots/content-icon-menu.pngbin9182 -> 0 bytes
-rw-r--r--samples/wearable/Notifications/screenshots/content-icon1.pngbin10393 -> 0 bytes
-rw-r--r--samples/wearable/Notifications/screenshots/content-icon2.pngbin10383 -> 0 bytes
-rw-r--r--samples/wearable/Notifications/screenshots/content-icon3.pngbin10841 -> 0 bytes
-rw-r--r--samples/wearable/Notifications/screenshots/content-icon4.pngbin10788 -> 0 bytes
-rw-r--r--samples/wearable/Notifications/screenshots/display-intent-menu.pngbin13160 -> 0 bytes
-rw-r--r--samples/wearable/Notifications/screenshots/display-intent.pngbin10924 -> 0 bytes
-rw-r--r--samples/wearable/Notifications/screenshots/multiple-page1.pngbin119352 -> 0 bytes
-rw-r--r--samples/wearable/Notifications/screenshots/multiple-page2.pngbin75010 -> 0 bytes
-rw-r--r--samples/wearable/Notifications/screenshots/stylized-menu.pngbin11678 -> 0 bytes
-rw-r--r--samples/wearable/Notifications/screenshots/stylized.pngbin24649 -> 0 bytes
-rw-r--r--samples/wearable/Notifications/settings.gradle1
-rw-r--r--samples/wearable/Quiz/Application/build.gradle26
-rw-r--r--samples/wearable/Quiz/Application/proguard-rules.txt22
-rw-r--r--samples/wearable/Quiz/Application/src/main/AndroidManifest.xml41
-rw-r--r--samples/wearable/Quiz/Application/src/main/assets/Quiz.json124
-rw-r--r--samples/wearable/Quiz/Application/src/main/java/com/example/android/wearable/quiz/MainActivity.java585
-rw-r--r--samples/wearable/Quiz/Application/src/main/res/values/strings.xml40
-rw-r--r--samples/wearable/Quiz/Application/src/main/res/values/styles.xml29
-rw-r--r--samples/wearable/Quiz/Wearable/build.gradle25
-rw-r--r--samples/wearable/Quiz/Wearable/proguard-rules.txt20
-rw-r--r--samples/wearable/Quiz/Wearable/src/main/AndroidManifest.xml42
-rw-r--r--samples/wearable/Quiz/_index.html25
-rw-r--r--samples/wearable/Quiz/build.gradle14
-rw-r--r--samples/wearable/Quiz/gradle.properties18
-rw-r--r--samples/wearable/Quiz/gradle/wrapper/gradle-wrapper.jarbin49896 -> 0 bytes
-rw-r--r--samples/wearable/Quiz/gradle/wrapper/gradle-wrapper.properties6
-rwxr-xr-xsamples/wearable/Quiz/gradlew164
-rwxr-xr-xsamples/wearable/Quiz/gradlew.bat90
-rw-r--r--samples/wearable/Quiz/screenshots/companion_quiz.pngbin184257 -> 0 bytes
-rw-r--r--samples/wearable/Quiz/screenshots/companion_quiz_correct_status.pngbin191361 -> 0 bytes
-rw-r--r--samples/wearable/Quiz/screenshots/wearable_quiz.pngbin16060 -> 0 bytes
-rw-r--r--samples/wearable/Quiz/screenshots/wearable_quiz_answer.pngbin12854 -> 0 bytes
-rw-r--r--samples/wearable/Quiz/screenshots/wearable_quiz_report.pngbin17850 -> 0 bytes
-rw-r--r--samples/wearable/Quiz/settings.gradle1
-rw-r--r--samples/wearable/RecipeAssistant/Application/build.gradle24
-rw-r--r--samples/wearable/RecipeAssistant/Application/proguard-rules.txt22
-rw-r--r--samples/wearable/RecipeAssistant/Application/src/main/AndroidManifest.xml41
-rw-r--r--samples/wearable/RecipeAssistant/Application/src/main/assets/beef-brisket-chili.json91
-rw-r--r--samples/wearable/RecipeAssistant/Application/src/main/assets/chili.jpgbin79408 -> 0 bytes
-rw-r--r--samples/wearable/RecipeAssistant/Application/src/main/assets/guacamole.jpgbin284874 -> 0 bytes
-rw-r--r--samples/wearable/RecipeAssistant/Application/src/main/assets/guacamole.json36
-rw-r--r--samples/wearable/RecipeAssistant/Application/src/main/assets/irish-stew.jpgbin145280 -> 0 bytes
-rw-r--r--samples/wearable/RecipeAssistant/Application/src/main/assets/northern-irish-vegetable-soup.json46
-rw-r--r--samples/wearable/RecipeAssistant/Application/src/main/assets/recipelist.json23
-rw-r--r--samples/wearable/RecipeAssistant/Application/src/main/assets/step-1-grind-spices.jpgbin94304 -> 0 bytes
-rw-r--r--samples/wearable/RecipeAssistant/Application/src/main/assets/step-2-score-beef.jpgbin200769 -> 0 bytes
-rw-r--r--samples/wearable/RecipeAssistant/Application/src/main/assets/step-3-brown-beef.jpgbin322673 -> 0 bytes
-rw-r--r--samples/wearable/RecipeAssistant/Application/src/main/assets/step-3-lime.jpgbin186310 -> 0 bytes
-rw-r--r--samples/wearable/RecipeAssistant/Application/src/main/assets/step-4-fry-onion.jpgbin209749 -> 0 bytes
-rw-r--r--samples/wearable/RecipeAssistant/Application/src/main/assets/step-6-combine.jpgbin206820 -> 0 bytes
-rw-r--r--samples/wearable/RecipeAssistant/Application/src/main/assets/step-8-pull.jpgbin247369 -> 0 bytes
-rw-r--r--samples/wearable/RecipeAssistant/Application/src/main/res/values/strings.xml24
-rw-r--r--samples/wearable/RecipeAssistant/_index.html19
-rw-r--r--samples/wearable/RecipeAssistant/build.gradle14
-rw-r--r--samples/wearable/RecipeAssistant/gradle/wrapper/gradle-wrapper.jarbin49896 -> 0 bytes
-rw-r--r--samples/wearable/RecipeAssistant/gradle/wrapper/gradle-wrapper.properties6
-rwxr-xr-xsamples/wearable/RecipeAssistant/gradlew164
-rwxr-xr-xsamples/wearable/RecipeAssistant/gradlew.bat90
-rw-r--r--samples/wearable/RecipeAssistant/screenshots/guac_notification.pngbin50992 -> 0 bytes
-rw-r--r--samples/wearable/RecipeAssistant/screenshots/guac_notification_step1.pngbin57419 -> 0 bytes
-rw-r--r--samples/wearable/RecipeAssistant/screenshots/recipe_assistant_guac.pngbin1166581 -> 0 bytes
-rw-r--r--samples/wearable/RecipeAssistant/settings.gradle1
-rw-r--r--samples/wearable/SkeletonWearableApp/Wearable/build.gradle24
-rw-r--r--samples/wearable/SkeletonWearableApp/Wearable/proguard-rules.txt21
-rw-r--r--samples/wearable/SkeletonWearableApp/Wearable/src/main/AndroidManifest.xml48
-rw-r--r--samples/wearable/SkeletonWearableApp/Wearable/src/main/java/com/example/android/google/wearable/app/GridExampleActivity.java108
-rw-r--r--samples/wearable/SkeletonWearableApp/_index.html22
-rw-r--r--samples/wearable/SkeletonWearableApp/build.gradle15
-rw-r--r--samples/wearable/SkeletonWearableApp/gradle.properties18
-rw-r--r--samples/wearable/SkeletonWearableApp/gradle/wrapper/gradle-wrapper.jarbin49896 -> 0 bytes
-rw-r--r--samples/wearable/SkeletonWearableApp/gradle/wrapper/gradle-wrapper.properties6
-rwxr-xr-xsamples/wearable/SkeletonWearableApp/gradlew164
-rwxr-xr-xsamples/wearable/SkeletonWearableApp/gradlew.bat90
-rw-r--r--samples/wearable/SkeletonWearableApp/screenshots/delayed_confirmation.pngbin17065 -> 0 bytes
-rw-r--r--samples/wearable/SkeletonWearableApp/screenshots/dismiss_overlay.pngbin16019 -> 0 bytes
-rw-r--r--samples/wearable/SkeletonWearableApp/screenshots/grid_view_pager.pngbin6093 -> 0 bytes
-rw-r--r--samples/wearable/SkeletonWearableApp/screenshots/skeleton_wearable_app.pngbin17882 -> 0 bytes
-rw-r--r--samples/wearable/SkeletonWearableApp/settings.gradle1
-rw-r--r--samples/wearable/SynchronizedNotifications/Application/build.gradle28
-rw-r--r--samples/wearable/SynchronizedNotifications/Application/proguard-rules.txt17
-rw-r--r--samples/wearable/SynchronizedNotifications/Application/src/main/AndroidManifest.xml47
-rw-r--r--samples/wearable/SynchronizedNotifications/Application/src/main/java/com/example/android/wearable/synchronizednotifications/DismissListener.java125
-rw-r--r--samples/wearable/SynchronizedNotifications/Application/src/main/java/com/example/android/wearable/synchronizednotifications/PhoneActivity.java192
-rw-r--r--samples/wearable/SynchronizedNotifications/Application/src/main/res/drawable-xxhdpi/ic_launcher.pngbin471 -> 0 bytes
-rw-r--r--samples/wearable/SynchronizedNotifications/Application/src/main/res/layout/activity_phone.xml57
-rw-r--r--samples/wearable/SynchronizedNotifications/Application/src/main/res/values/strings.xml26
-rw-r--r--samples/wearable/SynchronizedNotifications/Common/build.gradle20
-rw-r--r--samples/wearable/SynchronizedNotifications/Common/proguard-rules.txt17
-rw-r--r--samples/wearable/SynchronizedNotifications/Common/src/main/AndroidManifest.xml8
-rw-r--r--samples/wearable/SynchronizedNotifications/Common/src/main/java/com/example/android/wearable/synchronizednotifications/common/Constants.java38
-rw-r--r--samples/wearable/SynchronizedNotifications/Common/src/main/res/values/strings.xml3
-rw-r--r--samples/wearable/SynchronizedNotifications/Wearable/build.gradle28
-rw-r--r--samples/wearable/SynchronizedNotifications/Wearable/proguard-rules.txt17
-rw-r--r--samples/wearable/SynchronizedNotifications/Wearable/src/main/AndroidManifest.xml49
-rw-r--r--samples/wearable/SynchronizedNotifications/Wearable/src/main/java/com/example/android/wearable/synchronizednotifications/NotificationUpdateService.java164
-rw-r--r--samples/wearable/SynchronizedNotifications/Wearable/src/main/java/com/example/android/wearable/synchronizednotifications/WearableActivity.java29
-rw-r--r--samples/wearable/SynchronizedNotifications/Wearable/src/main/res/drawable-hdpi/ic_launcher.pngbin297 -> 0 bytes
-rw-r--r--samples/wearable/SynchronizedNotifications/Wearable/src/main/res/drawable-mdpi/ic_launcher.pngbin254 -> 0 bytes
-rw-r--r--samples/wearable/SynchronizedNotifications/Wearable/src/main/res/drawable-xhdpi/ic_launcher.pngbin342 -> 0 bytes
-rw-r--r--samples/wearable/SynchronizedNotifications/Wearable/src/main/res/values/strings.xml21
-rw-r--r--samples/wearable/SynchronizedNotifications/_index.html28
-rw-r--r--samples/wearable/SynchronizedNotifications/build.gradle14
-rw-r--r--samples/wearable/SynchronizedNotifications/gradle/wrapper/gradle-wrapper.jarbin49896 -> 0 bytes
-rw-r--r--samples/wearable/SynchronizedNotifications/gradle/wrapper/gradle-wrapper.properties6
-rwxr-xr-xsamples/wearable/SynchronizedNotifications/gradlew164
-rw-r--r--samples/wearable/SynchronizedNotifications/gradlew.bat90
-rw-r--r--samples/wearable/SynchronizedNotifications/screenshots/different_notifications_phone.pngbin135301 -> 0 bytes
-rw-r--r--samples/wearable/SynchronizedNotifications/screenshots/different_notifications_wearable.pngbin15816 -> 0 bytes
-rw-r--r--samples/wearable/SynchronizedNotifications/screenshots/notification_options.pngbin102231 -> 0 bytes
-rw-r--r--samples/wearable/SynchronizedNotifications/screenshots/watch_only_notification.pngbin18346 -> 0 bytes
-rw-r--r--samples/wearable/SynchronizedNotifications/settings.gradle1
-rw-r--r--samples/wearable/Timer/Wearable/build.gradle22
-rw-r--r--samples/wearable/Timer/Wearable/proguard-rules.txt22
-rw-r--r--samples/wearable/Timer/Wearable/src/main/AndroidManifest.xml44
-rw-r--r--samples/wearable/Timer/Wearable/src/main/java/com/example/android/wearable/timer/WearableListItemLayout.java90
-rw-r--r--samples/wearable/Timer/_index.html13
-rw-r--r--samples/wearable/Timer/build.gradle14
-rw-r--r--samples/wearable/Timer/gradle/wrapper/gradle-wrapper.jarbin49896 -> 0 bytes
-rw-r--r--samples/wearable/Timer/gradle/wrapper/gradle-wrapper.properties6
-rwxr-xr-xsamples/wearable/Timer/gradlew164
-rwxr-xr-xsamples/wearable/Timer/gradlew.bat90
-rw-r--r--samples/wearable/Timer/screenshots/timer.pngbin7849 -> 0 bytes
-rw-r--r--samples/wearable/Timer/screenshots/timer_countdown.pngbin116502 -> 0 bytes
-rw-r--r--samples/wearable/Timer/settings.gradle1
-rw-r--r--samples/wearable/WatchViewStub/Wearable/build.gradle24
-rw-r--r--samples/wearable/WatchViewStub/Wearable/proguard-rules.txt20
-rw-r--r--samples/wearable/WatchViewStub/Wearable/src/main/AndroidManifest.xml37
-rw-r--r--samples/wearable/WatchViewStub/_index.html26
-rw-r--r--samples/wearable/WatchViewStub/build.gradle15
-rw-r--r--samples/wearable/WatchViewStub/gradle.properties18
-rw-r--r--samples/wearable/WatchViewStub/gradle/wrapper/gradle-wrapper.jarbin49896 -> 0 bytes
-rw-r--r--samples/wearable/WatchViewStub/gradle/wrapper/gradle-wrapper.properties6
-rwxr-xr-xsamples/wearable/WatchViewStub/gradlew164
-rwxr-xr-xsamples/wearable/WatchViewStub/gradlew.bat90
-rw-r--r--samples/wearable/WatchViewStub/screenshots/watch_view_stub_rectangular.pngbin29819 -> 0 bytes
-rw-r--r--samples/wearable/WatchViewStub/screenshots/watch_view_stub_round.pngbin28097 -> 0 bytes
-rw-r--r--samples/wearable/WatchViewStub/settings.gradle1
-rw-r--r--samples/wearable/build.gradle46
-rw-r--r--samples/wearable/gradle.properties1
-rw-r--r--samples/wearable/gradle/wrapper/gradle-wrapper.jarbin49896 -> 0 bytes
-rw-r--r--samples/wearable/gradle/wrapper/gradle-wrapper.properties6
-rwxr-xr-xsamples/wearable/gradlew174
-rwxr-xr-xsamples/wearable/gradlew.bat90
-rw-r--r--samples/wearable/settings.gradle0
-rw-r--r--sdk/build_tools_source.prop_template2
-rw-r--r--sdk/platform_source.prop_template4
-rw-r--r--sdk/sdk_files_NOTICE.txt1
-rw-r--r--sdk/support_source.prop_template2
-rw-r--r--tools/recovery_l10n/res/values-sk/strings.xml2
1817 files changed, 35204 insertions, 14610 deletions
diff --git a/apps/Development/res/layout/connectivity.xml b/apps/Development/res/layout/connectivity.xml
index 2aaf6c61f..d23a6b1b9 100644
--- a/apps/Development/res/layout/connectivity.xml
+++ b/apps/Development/res/layout/connectivity.xml
@@ -274,6 +274,16 @@
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
+ <Button android:id="@+id/report_all_bad"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/report_all_bad" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
<Button android:id="@+id/crash"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
diff --git a/apps/Development/res/values/strings.xml b/apps/Development/res/values/strings.xml
index 0c13987c4..d670cf4c4 100644
--- a/apps/Development/res/values/strings.xml
+++ b/apps/Development/res/values/strings.xml
@@ -43,6 +43,8 @@
<string name="start_hipri">Start HiPri</string>
<string name="stop_hipri">Stop HiPri</string>
<string name="crash">CRASH</string>
+ <string name="report_all_bad">Report all bad</string>
+
<string name="netid">NetId</string>
<string name="add_default_route">Add Default Route</string>
<string name="remove_default_route">Remove Default Route</string>
diff --git a/apps/Development/src/com/android/development/Connectivity.java b/apps/Development/src/com/android/development/Connectivity.java
index 93d199b15..a576eb397 100644
--- a/apps/Development/src/com/android/development/Connectivity.java
+++ b/apps/Development/src/com/android/development/Connectivity.java
@@ -29,6 +29,7 @@ import android.content.SharedPreferences;
import android.content.pm.PackageManager.NameNotFoundException;
import android.net.ConnectivityManager;
import android.net.LinkAddress;
+import android.net.Network;
import android.net.NetworkUtils;
import android.net.RouteInfo;
import android.net.wifi.ScanResult;
@@ -304,6 +305,7 @@ public class Connectivity extends Activity {
findViewById(R.id.stop_mms).setOnClickListener(mClickListener);
findViewById(R.id.start_hipri).setOnClickListener(mClickListener);
findViewById(R.id.stop_hipri).setOnClickListener(mClickListener);
+ findViewById(R.id.report_all_bad).setOnClickListener(mClickListener);
findViewById(R.id.crash).setOnClickListener(mClickListener);
findViewById(R.id.add_default_route).setOnClickListener(mClickListener);
@@ -318,6 +320,11 @@ public class Connectivity extends Activity {
registerReceiver(mReceiver, new IntentFilter(CONNECTIVITY_TEST_ALARM));
}
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ unregisterReceiver(mReceiver);
+ }
@Override
public void onResume() {
@@ -387,6 +394,9 @@ public class Connectivity extends Activity {
case R.id.add_default_route:
onAddDefaultRoute();
break;
+ case R.id.report_all_bad:
+ onReportAllBad();
+ break;
case R.id.crash:
onCrash();
break;
@@ -460,6 +470,13 @@ public class Connectivity extends Activity {
private void onStopScreenCycle() {
}
+ private void onReportAllBad() {
+ Network[] networks = mCm.getAllNetworks();
+ for (Network network : networks) {
+ mCm.reportBadNetwork(network);
+ }
+ }
+
private void onCrash() {
ConnectivityManager foo = null;
foo.startUsingNetworkFeature(ConnectivityManager.TYPE_MOBILE,
diff --git a/apps/Fallback/res/values-sl/strings.xml b/apps/Fallback/res/values-sl/strings.xml
index 16f30ab9d..322f466d2 100644
--- a/apps/Fallback/res/values-sl/strings.xml
+++ b/apps/Fallback/res/values-sl/strings.xml
@@ -16,7 +16,7 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="appTitle" msgid="161410001913116606">"Nadomestna aplikacija"</string>
+ <string name="appTitle" msgid="161410001913116606">"Nadomestni program"</string>
<string name="title" msgid="8156274565006125136">"Dejanje ni podprto."</string>
<string name="error" msgid="6539615832923362301">"To dejanje trenutno še ni podprto."</string>
</resources>
diff --git a/build/product_sdk.mk b/build/product_sdk.mk
index 7aba4ee67..68a4ecc60 100644
--- a/build/product_sdk.mk
+++ b/build/product_sdk.mk
@@ -44,4 +44,5 @@ PRODUCT_PACKAGES += \
layoutlib-tests \
llvm-rs-cc \
sqlite3 \
- vgabios-cirrus.bin
+ vgabios-cirrus.bin \
+ split-select
diff --git a/build/sdk-darwin-x86.atree b/build/sdk-darwin-x86.atree
index 9f1eb38b7..084dcff15 100644
--- a/build/sdk-darwin-x86.atree
+++ b/build/sdk-darwin-x86.atree
@@ -32,6 +32,8 @@ prebuilts/sdk/tools/darwin/arm-linux-androideabi-ld strip build-tools/${PLATFO
prebuilts/sdk/tools/darwin/i686-linux-android-ld strip build-tools/${PLATFORM_NAME}/i686-linux-android-ld
prebuilts/sdk/tools/darwin/mipsel-linux-android-ld strip build-tools/${PLATFORM_NAME}/mipsel-linux-android-ld
+dalvik/dx/etc/mainDexClasses build-tools/${PLATFORM_NAME}/mainDexClasses
+
##############################################################################
# Docs Component
##############################################################################
diff --git a/build/sdk-linux-x86.atree b/build/sdk-linux-x86.atree
index 745be4925..6eb976b47 100644
--- a/build/sdk-linux-x86.atree
+++ b/build/sdk-linux-x86.atree
@@ -32,4 +32,5 @@ prebuilts/sdk/tools/linux/arm-linux-androideabi-ld strip build-tools/${PLATFOR
prebuilts/sdk/tools/linux/i686-linux-android-ld strip build-tools/${PLATFORM_NAME}/i686-linux-android-ld
prebuilts/sdk/tools/linux/mipsel-linux-android-ld strip build-tools/${PLATFORM_NAME}/mipsel-linux-android-ld
+dalvik/dx/etc/mainDexClasses build-tools/${PLATFORM_NAME}/mainDexClasses
diff --git a/build/sdk-windows-x86.atree b/build/sdk-windows-x86.atree
index 7820b8674..7ff3add13 100644
--- a/build/sdk-windows-x86.atree
+++ b/build/sdk-windows-x86.atree
@@ -61,6 +61,9 @@ bin/etc1tool.exe strip platform-tools/etc1tool.exe
rm build-tools/${PLATFORM_NAME}/aapt
bin/aapt.exe strip build-tools/${PLATFORM_NAME}/aapt.exe
+rm build-tools/${PLATFORM_NAME}/split-select
+bin/split-select.exe strip build-tools/${PLATFORM_NAME}/split-select.exe
+
rm build-tools/${PLATFORM_NAME}/aidl
bin/aidl.exe strip build-tools/${PLATFORM_NAME}/aidl.exe
@@ -101,6 +104,8 @@ prebuilts/sdk/tools/windows/i686-linux-android-ld.exe strip build-tools/${P
rm build-tools/${PLATFORM_NAME}/mipsel-linux-android-ld
prebuilts/sdk/tools/windows/mipsel-linux-android-ld.exe strip build-tools/${PLATFORM_NAME}/mipsel-linux-android-ld.exe
+dalvik/dx/etc/mainDexClasses.bat build-tools/${PLATFORM_NAME}/mainDexClasses.bat
+
##############################################################################
# Docs Component
diff --git a/build/sdk.atree b/build/sdk.atree
index f2cbfa278..9c7ba8a9c 100644
--- a/build/sdk.atree
+++ b/build/sdk.atree
@@ -79,6 +79,7 @@ development/sdk/build_tools_runtime.properties build-tools/${PLATFORM_NAME}/runt
# build tools from out/host/$(HOST_OS)-$(HOST_ARCH)/
bin/aapt strip build-tools/${PLATFORM_NAME}/aapt
bin/aidl strip build-tools/${PLATFORM_NAME}/aidl
+bin/split-select strip build-tools/${PLATFORM_NAME}/split-select
bin/zipalign strip build-tools/${PLATFORM_NAME}/zipalign
# renderscript (cc + headers)
@@ -118,6 +119,12 @@ bin/dx build-tools/${PLATFORM_NAME}/dx
framework/dx.jar build-tools/${PLATFORM_NAME}/lib/dx.jar
bin/dexdump build-tools/${PLATFORM_NAME}/dexdump
+# multi-dex
+prebuilts/sdk/tools/lib/shrinkedAndroid.jar build-tools/${PLATFORM_NAME}/lib/shrinkedAndroid.jar
+prebuilts/sdk/tools/jack.jar build-tools/${PLATFORM_NAME}/jack.jar
+prebuilts/sdk/tools/jill.jar build-tools/${PLATFORM_NAME}/jill.jar
+dalvik/dx/etc/mainDexClasses.rules build-tools/${PLATFORM_NAME}/mainDexClasses.rules
+
##############################################################################
# Platform Component
@@ -177,6 +184,9 @@ docs/features.txt platforms/${PLATFORM_NAME}/data/featur
# fonts for layoutlib.
${FONT_OUT} platforms/${PLATFORM_NAME}/data/fonts
+# timezone data for layoutlib
+bionic/libc/zoneinfo/tzdata platforms/${PLATFORM_NAME}/data/tzdata
+
# NOTICE files are copied by build/core/Makefile from sdk.git
development/sdk/sdk_files_NOTICE.txt platforms/${PLATFORM_NAME}/templates/NOTICE.txt
development/sdk/sdk_files_NOTICE.txt platforms/${PLATFORM_NAME}/data/NOTICE.txt
@@ -241,6 +251,11 @@ developers/build/prebuilts/gradle/ActivityInstrumentation/ sam
developers/build/prebuilts/gradle/MediaRecorder/ samples/${PLATFORM_NAME}/media/MediaRecorder
developers/build/prebuilts/gradle/BasicMediaRouter/ samples/${PLATFORM_NAME}/media/BasicMediaRouter
developers/build/prebuilts/gradle/BasicMediaDecoder/ samples/${PLATFORM_NAME}/media/BasicMediaDecoder
+developers/build/prebuilts/gradle/MediaBrowserService/ samples/${PLATFORM_NAME}/media/MediaBrowserService
+developers/build/prebuilts/gradle/BasicNotifications/ samples/${PLATFORM_NAME}/notification/BasicNotifications
+developers/build/prebuilts/gradle/CustomNotifications/ samples/${PLATFORM_NAME}/notification/CustomNotifications
+developers/build/prebuilts/gradle/LNotifications/ samples/${PLATFORM_NAME}/notification/LNotifications
+developers/build/prebuilts/gradle/MessagingService/ samples/${PLATFORM_NAME}/notification/MessagingService
developers/build/prebuilts/gradle/BorderlessButtons/ samples/${PLATFORM_NAME}/ui/BorderlessButtons
developers/build/prebuilts/gradle/BasicAccessibility/ samples/${PLATFORM_NAME}/ui/BasicAccessibility
developers/build/prebuilts/gradle/CustomChoiceList/ samples/${PLATFORM_NAME}/ui/CustomChoiceList
@@ -250,8 +265,6 @@ developers/build/prebuilts/gradle/ActionBarCompat-Styled/ sam
developers/build/prebuilts/gradle/ActionBarCompat-ListPopupMenu/ samples/${PLATFORM_NAME}/ui/ActionBarCompat-ListPopupMenu
developers/build/prebuilts/gradle/ActionBarCompat-ShareActionProvider/ samples/${PLATFORM_NAME}/ui/ActionBarCompat-ShareActionProvider
developers/build/prebuilts/gradle/ActionBarCompat-Basic/ samples/${PLATFORM_NAME}/ui/ActionBarCompat-Basic
-developers/build/prebuilts/gradle/BasicNotifications/ samples/${PLATFORM_NAME}/ui/BasicNotifications
-developers/build/prebuilts/gradle/CustomNotifications/ samples/${PLATFORM_NAME}/ui/CustomNotifications
developers/build/prebuilts/gradle/DoneBar/ samples/${PLATFORM_NAME}/ui/DoneBar
developers/build/prebuilts/gradle/BasicImmersiveMode/ samples/${PLATFORM_NAME}/ui/BasicImmersiveMode
developers/build/prebuilts/gradle/AdvancedImmersiveMode/ samples/${PLATFORM_NAME}/ui/AdvancedImmersiveMode
@@ -284,7 +297,7 @@ developers/build/prebuilts/gradle/NavigationDrawer sam
developers/build/prebuilts/gradle/ElevationBasic samples/${PLATFORM_NAME}/ui/views/Elevation/ElevationBasic
developers/build/prebuilts/gradle/ElevationDrag samples/${PLATFORM_NAME}/ui/views/Elevation/ElevationDrag
developers/build/prebuilts/gradle/ClippingBasic samples/${PLATFORM_NAME}/ui/views/Clipping/ClippingBasic
-developers/build/prebuilts/gradle/JobScheduler samples/${PLATFORM_NAME}/ui/views/Clipping/JobScheduler
+developers/build/prebuilts/gradle/JobScheduler samples/${PLATFORM_NAME}/background/JobScheduler
developers/build/prebuilts/gradle/HdrViewfinder samples/${PLATFORM_NAME}/media/HdrViewfinder
developers/build/prebuilts/gradle/DocumentCentricApps samples/${PLATFORM_NAME}/ui/activitytasks/DocumentCentricApps
developers/build/prebuilts/gradle/DocumentCentricRelinquishIdentity samples/${PLATFORM_NAME}/ui/activitytasks/DocumentCentricRelinquishIdentity
@@ -292,33 +305,38 @@ developers/build/prebuilts/gradle/AppRestrictionEnforcer sam
developers/build/prebuilts/gradle/AppRestrictionSchema samples/${PLATFORM_NAME}/admin/AppRestrictionSchema
developers/build/prebuilts/gradle/RecyclerView samples/${PLATFORM_NAME}/ui/views/RecyclerView
developers/build/prebuilts/gradle/CardView samples/${PLATFORM_NAME}/ui/views/CardView
-developers/build/prebuilts/gradle/LNotifications samples/${PLATFORM_NAME}/ui/notifications/LNotifications
developers/build/prebuilts/gradle/DrawableTinting samples/${PLATFORM_NAME}/ui/DrawableTinting
developers/build/prebuilts/gradle/Interpolator samples/${PLATFORM_NAME}/ui/Interpolator
developers/build/prebuilts/gradle/PdfRendererBasic samples/${PLATFORM_NAME}/ui/graphics/PdfRendererBasic
developers/build/prebuilts/gradle/FloatingActionButtonBasic samples/${PLATFORM_NAME}/ui/views/FloatingActionButton/FloatingActionButtonBasic
developers/build/prebuilts/gradle/RevealEffectBasic samples/${PLATFORM_NAME}/ui/views/RevealEffect/RevealEffectBasic
+developers/build/prebuilts/gradle/PermissionRequest samples/${PLATFORM_NAME}/content/webview/PermissionRequest
+developers/build/prebuilts/gradle/DirectorySelection samples/${PLATFORM_NAME}/content/documentsUi/DirectorySelection
+developers/build/prebuilts/gradle/AppUsageStatistics samples/${PLATFORM_NAME}/system/AppUsageStatistics
+developers/build/prebuilts/gradle/ScreenCapture samples/${PLATFORM_NAME}/media/ScreenCapture
developers/build/prebuilts/androidtv samples/${PLATFORM_NAME}/androidtv
# Wearable sample tree
-development/samples/wearable/AgendaData samples/${PLATFORM_NAME}/wearable/AgendaData
-development/samples/wearable/DataLayer samples/${PLATFORM_NAME}/wearable/DataLayer
-development/samples/wearable/DelayedConfirmation samples/${PLATFORM_NAME}/wearable/DelayedConfirmation
-development/samples/wearable/ElizaChat samples/${PLATFORM_NAME}/wearable/ElizaChat
-development/samples/wearable/EmbeddedApp samples/${PLATFORM_NAME}/wearable/EmbeddedApp
-development/samples/wearable/FindMyPhone samples/${PLATFORM_NAME}/wearable/FindMyPhone
-development/samples/wearable/Flashlight samples/${PLATFORM_NAME}/wearable/Flashlight
-development/samples/wearable/Geofencing samples/${PLATFORM_NAME}/wearable/Geofencing
-development/samples/wearable/GridViewPager samples/${PLATFORM_NAME}/wearable/GridViewPager
-development/samples/wearable/JumpingJack samples/${PLATFORM_NAME}/wearable/JumpingJack
-development/samples/wearable/Notifications samples/${PLATFORM_NAME}/wearable/Notifications
-development/samples/wearable/Quiz samples/${PLATFORM_NAME}/wearable/Quiz
-development/samples/wearable/RecipeAssistant samples/${PLATFORM_NAME}/wearable/RecipeAssistant
-development/samples/wearable/SkeletonWearableApp samples/${PLATFORM_NAME}/wearable/SkeletonWearableApp
-development/samples/wearable/SynchronizedNotifications samples/${PLATFORM_NAME}/wearable/SynchronizedNotifications
-development/samples/wearable/Timer samples/${PLATFORM_NAME}/wearable/Timer
-development/samples/wearable/WatchViewStub samples/${PLATFORM_NAME}/wearable/WatchViewStub
+developers/build/prebuilts/gradle/AgendaData samples/${PLATFORM_NAME}/wearable/AgendaData
+developers/build/prebuilts/gradle/DataLayer samples/${PLATFORM_NAME}/wearable/DataLayer
+developers/build/prebuilts/gradle/DelayedConfirmation samples/${PLATFORM_NAME}/wearable/DelayedConfirmation
+developers/build/prebuilts/gradle/ElizaChat samples/${PLATFORM_NAME}/wearable/ElizaChat
+developers/build/prebuilts/gradle/EmbeddedApp samples/${PLATFORM_NAME}/wearable/EmbeddedApp
+developers/build/prebuilts/gradle/FindMyPhone samples/${PLATFORM_NAME}/wearable/FindMyPhone
+developers/build/prebuilts/gradle/Flashlight samples/${PLATFORM_NAME}/wearable/Flashlight
+developers/build/prebuilts/gradle/Geofencing samples/${PLATFORM_NAME}/wearable/Geofencing
+developers/build/prebuilts/gradle/GridViewPager samples/${PLATFORM_NAME}/wearable/GridViewPager
+developers/build/prebuilts/gradle/JumpingJack samples/${PLATFORM_NAME}/wearable/JumpingJack
+developers/build/prebuilts/gradle/Notifications samples/${PLATFORM_NAME}/wearable/Notifications
+developers/build/prebuilts/gradle/Quiz samples/${PLATFORM_NAME}/wearable/Quiz
+developers/build/prebuilts/gradle/RecipeAssistant samples/${PLATFORM_NAME}/wearable/RecipeAssistant
+developers/build/prebuilts/gradle/SkeletonWearableApp samples/${PLATFORM_NAME}/wearable/SkeletonWearableApp
+developers/build/prebuilts/gradle/SpeedTracker samples/${PLATFORM_NAME}/wearable/SpeedTracker
+developers/build/prebuilts/gradle/SynchronizedNotifications samples/${PLATFORM_NAME}/wearable/SynchronizedNotifications
+developers/build/prebuilts/gradle/Timer samples/${PLATFORM_NAME}/wearable/Timer
+developers/build/prebuilts/gradle/WatchFace samples/${PLATFORM_NAME}/wearable/WatchFace
+developers/build/prebuilts/gradle/WatchViewStub samples/${PLATFORM_NAME}/wearable/WatchViewStub
# Old sample tree
development/samples/AccelerometerPlay samples/${PLATFORM_NAME}/legacy/AccelerometerPlay
diff --git a/build/tools/windows_sdk.mk b/build/tools/windows_sdk.mk
index d107d3712..dadb77313 100644
--- a/build/tools/windows_sdk.mk
+++ b/build/tools/windows_sdk.mk
@@ -41,6 +41,7 @@ WIN_TARGETS := \
prebuilt \
sqlite3 \
zipalign \
+ split-select \
$(WIN_SDK_TARGETS)
# This is the list of *Linux* build tools that we need
diff --git a/build/windows_sdk_whitelist.mk b/build/windows_sdk_whitelist.mk
index dfeaf3a55..d91dde5d1 100644
--- a/build/windows_sdk_whitelist.mk
+++ b/build/windows_sdk_whitelist.mk
@@ -40,6 +40,7 @@ subdirs += \
external/clang \
external/easymock \
external/expat \
+ external/gtest \
external/libcxx \
external/libcxxabi \
external/compiler-rt \
diff --git a/docs/copyright-templates/asm.txt b/docs/copyright-templates/asm.txt
index 22f9dd20d..4e79d32c5 100644
--- a/docs/copyright-templates/asm.txt
+++ b/docs/copyright-templates/asm.txt
@@ -1,4 +1,4 @@
-; Copyright 2013 The Android Open Source Project
+; Copyright 2015 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.
diff --git a/docs/copyright-templates/bash.txt b/docs/copyright-templates/bash.txt
index 389b21a08..65cc335ad 100644
--- a/docs/copyright-templates/bash.txt
+++ b/docs/copyright-templates/bash.txt
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Copyright 2013 The Android Open Source Project
+# Copyright 2015 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.
diff --git a/docs/copyright-templates/bsd/c.txt b/docs/copyright-templates/bsd/c.txt
index 55932e72f..1fe17d597 100644
--- a/docs/copyright-templates/bsd/c.txt
+++ b/docs/copyright-templates/bsd/c.txt
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 The Android Open Source Project
+ * Copyright 2015 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/docs/copyright-templates/c.txt b/docs/copyright-templates/c.txt
index 11644d2ba..a1a67bfa6 100644
--- a/docs/copyright-templates/c.txt
+++ b/docs/copyright-templates/c.txt
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 The Android Open Source Project
+ * Copyright 2015 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.
diff --git a/docs/copyright-templates/java.txt b/docs/copyright-templates/java.txt
index 11644d2ba..a1a67bfa6 100644
--- a/docs/copyright-templates/java.txt
+++ b/docs/copyright-templates/java.txt
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 The Android Open Source Project
+ * Copyright 2015 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.
diff --git a/docs/copyright-templates/make.txt b/docs/copyright-templates/make.txt
index 317c4e698..298771095 100644
--- a/docs/copyright-templates/make.txt
+++ b/docs/copyright-templates/make.txt
@@ -1,4 +1,4 @@
-# Copyright 2013 The Android Open Source Project
+# Copyright 2015 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.
diff --git a/docs/copyright-templates/plain.txt b/docs/copyright-templates/plain.txt
index 5db92824a..8545607fc 100644
--- a/docs/copyright-templates/plain.txt
+++ b/docs/copyright-templates/plain.txt
@@ -1,4 +1,4 @@
-Copyright 2013 The Android Open Source Project
+Copyright 2015 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.
diff --git a/docs/copyright-templates/sh.txt b/docs/copyright-templates/sh.txt
index 7bf532bbd..254134ae4 100644
--- a/docs/copyright-templates/sh.txt
+++ b/docs/copyright-templates/sh.txt
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright 2013 The Android Open Source Project
+# Copyright 2015 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.
diff --git a/docs/copyright-templates/xml.txt b/docs/copyright-templates/xml.txt
index 9d10d8811..789a71526 100644
--- a/docs/copyright-templates/xml.txt
+++ b/docs/copyright-templates/xml.txt
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright 2013 The Android Open Source Project
+<!-- Copyright 2015 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.
diff --git a/samples/ApiDemos/res/layout/media_projection.xml b/samples/ApiDemos/res/layout/media_projection.xml
index 412db4ce2..d9082a3d3 100644
--- a/samples/ApiDemos/res/layout/media_projection.xml
+++ b/samples/ApiDemos/res/layout/media_projection.xml
@@ -30,6 +30,7 @@
android:orientation="horizontal"
android:layout_alignParentBottom="true">
<ToggleButton
+ android:id="@+id/screen_sharing_toggle"
android:text="@string/screen_sharing_toggle"
android:layout_width="0dp"
android:layout_height="match_parent"
diff --git a/samples/ApiDemos/res/values/strings.xml b/samples/ApiDemos/res/values/strings.xml
index 58daf39fc..65bfba353 100644
--- a/samples/ApiDemos/res/values/strings.xml
+++ b/samples/ApiDemos/res/values/strings.xml
@@ -790,6 +790,10 @@
<string name="require_encryption">Require encryption</string>
<string name="activate_encryption">Activate encryption</string>
+ <string name="trust_agent_category">Trust Agent Features</string>
+ <string name="set_trust_agent_component_name">Enabled Component Name</string>
+ <string name="set_trust_agent_feature_list">Enabled Features (comma-separated)</string>
+
<!-- Strings used by DeviceAdminSample controller code -->
<string name="password_sufficient">Current password meets policy requirements</string>
<string name="password_insufficient">Current password does not meet policy requirements</string>
diff --git a/samples/ApiDemos/res/xml/device_admin_general.xml b/samples/ApiDemos/res/xml/device_admin_general.xml
index cfd0048be..1d0084e6a 100644
--- a/samples/ApiDemos/res/xml/device_admin_general.xml
+++ b/samples/ApiDemos/res/xml/device_admin_general.xml
@@ -57,4 +57,19 @@
</PreferenceCategory>
+ <PreferenceCategory
+ android:title="@string/trust_agent_category" >
+
+ <EditTextPreference
+ android:key="key_trust_agent_component"
+ android:title="@string/set_trust_agent_component_name"
+ android:dialogTitle="@string/set_trust_agent_component_name" />
+
+ <EditTextPreference
+ android:key="key_trust_agent_features"
+ android:title="@string/set_trust_agent_feature_list"
+ android:dialogTitle="@string/set_trust_agent_feature_list" />
+
+ </PreferenceCategory>
+
</PreferenceScreen>
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/DeviceAdminSample.java b/samples/ApiDemos/src/com/example/android/apis/app/DeviceAdminSample.java
index 82df9037a..71badcdf7 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/DeviceAdminSample.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/DeviceAdminSample.java
@@ -26,7 +26,9 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
+import android.content.SharedPreferences;
import android.os.Bundle;
+import android.os.PersistableBundle;
import android.preference.CheckBoxPreference;
import android.preference.EditTextPreference;
import android.preference.ListPreference;
@@ -41,6 +43,8 @@ import android.text.TextUtils;
import android.util.Log;
import android.widget.Toast;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
/**
@@ -71,6 +75,8 @@ public class DeviceAdminSample extends PreferenceActivity {
private static final String KEY_DISABLE_NOTIFICATIONS = "key_disable_notifications";
private static final String KEY_DISABLE_UNREDACTED = "key_disable_unredacted";
private static final String KEY_DISABLE_TRUST_AGENTS = "key_disable_trust_agents";
+ private static final String KEY_TRUST_AGENT_COMPONENT = "key_trust_agent_component";
+ private static final String KEY_TRUST_AGENT_FEATURES = "key_trust_agent_features";
private static final String KEY_DISABLE_KEYGUARD_WIDGETS = "key_disable_keyguard_widgets";
private static final String KEY_DISABLE_KEYGUARD_SECURE_CAMERA
= "key_disable_keyguard_secure_camera";
@@ -274,6 +280,8 @@ public class DeviceAdminSample extends PreferenceActivity {
private CheckBoxPreference mDisableKeyguardNotificationCheckbox;
private CheckBoxPreference mDisableKeyguardTrustAgentCheckbox;
private CheckBoxPreference mDisableKeyguardUnredactedCheckbox;
+ private EditTextPreference mTrustAgentComponent;
+ private EditTextPreference mTrustAgentFeatures;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -304,6 +312,14 @@ public class DeviceAdminSample extends PreferenceActivity {
mDisableKeyguardTrustAgentCheckbox =
(CheckBoxPreference) findPreference(KEY_DISABLE_TRUST_AGENTS);
mDisableKeyguardTrustAgentCheckbox.setOnPreferenceChangeListener(this);
+
+ mTrustAgentComponent =
+ (EditTextPreference) findPreference(KEY_TRUST_AGENT_COMPONENT);
+ mTrustAgentComponent.setOnPreferenceChangeListener(this);
+
+ mTrustAgentFeatures =
+ (EditTextPreference) findPreference(KEY_TRUST_AGENT_FEATURES);
+ mTrustAgentFeatures.setOnPreferenceChangeListener(this);
}
// At onResume time, reload UI with current values as required
@@ -340,8 +356,8 @@ public class DeviceAdminSample extends PreferenceActivity {
if (super.onPreferenceChange(preference, newValue)) {
return true;
}
- boolean value = (Boolean) newValue;
if (preference == mEnableCheckbox) {
+ boolean value = (Boolean) newValue;
if (value != mAdminActive) {
if (value) {
// Launch the activity to have the user enable our admin.
@@ -359,6 +375,7 @@ public class DeviceAdminSample extends PreferenceActivity {
}
}
} else if (preference == mDisableCameraCheckbox) {
+ boolean value = (Boolean) newValue;
mDPM.setCameraDisabled(mDeviceAdminSample, value);
// Delay update because the change is only applied after exiting this method.
postReloadSummaries();
@@ -366,20 +383,39 @@ public class DeviceAdminSample extends PreferenceActivity {
|| preference == mDisableKeyguardSecureCameraCheckbox
|| preference == mDisableKeyguardNotificationCheckbox
|| preference == mDisableKeyguardUnredactedCheckbox
- || preference == mDisableKeyguardTrustAgentCheckbox) {
- // Delay update because the change is only applied after exiting this method.
- getView().post(new Runnable() {
- @Override
- public void run() {
- mDPM.setKeyguardDisabledFeatures(mDeviceAdminSample,
- createKeyguardDisabledFlag());
- }
- });
+ || preference == mDisableKeyguardTrustAgentCheckbox
+ || preference == mTrustAgentComponent
+ || preference == mTrustAgentFeatures) {
+ postUpdateDpmDisableFeatures();
postReloadSummaries();
}
return true;
}
+ private void postUpdateDpmDisableFeatures() {
+ getView().post(new Runnable() {
+ @Override
+ public void run() {
+ mDPM.setKeyguardDisabledFeatures(mDeviceAdminSample,
+ createKeyguardDisabledFlag());
+ String component = mTrustAgentComponent.getText();
+ if (component != null) {
+ ComponentName agent = ComponentName.unflattenFromString(component);
+ if (agent != null) {
+ String featureString = mTrustAgentFeatures.getText();
+ if (featureString != null) {
+ PersistableBundle bundle = new PersistableBundle();
+ bundle.putStringArray("features", featureString.split(","));
+ mDPM.setTrustAgentConfiguration(mDeviceAdminSample, agent, bundle);
+ }
+ } else {
+ Log.w(TAG, "Invalid component: " + component);
+ }
+ }
+ }
+ });
+ }
+
@Override
protected void reloadSummaries() {
super.reloadSummaries();
@@ -416,6 +452,17 @@ public class DeviceAdminSample extends PreferenceActivity {
R.string.keyguard_trust_agents_disabled
: R.string.keyguard_trust_agents_enabled);
mDisableKeyguardTrustAgentCheckbox.setSummary(keyguardEnableTrustAgentSummary);
+
+ final SharedPreferences prefs = getPreferenceManager().getSharedPreferences();
+ final boolean trustDisabled =
+ (disabled & DevicePolicyManager.KEYGUARD_DISABLE_TRUST_AGENTS) != 0;
+ String component = prefs.getString(mTrustAgentComponent.getKey(), null);
+ mTrustAgentComponent.setSummary(component);
+ mTrustAgentComponent.setEnabled(trustDisabled);
+
+ String features = prefs.getString(mTrustAgentFeatures.getKey(), null);
+ mTrustAgentFeatures.setSummary(features);
+ mTrustAgentFeatures.setEnabled(trustDisabled);
}
/** Updates the device capabilities area (dis/enabling) as the admin is (de)activated */
@@ -426,6 +473,8 @@ public class DeviceAdminSample extends PreferenceActivity {
mDisableKeyguardNotificationCheckbox.setEnabled(enabled);
mDisableKeyguardUnredactedCheckbox.setEnabled(enabled);
mDisableKeyguardTrustAgentCheckbox.setEnabled(enabled);
+ mTrustAgentComponent.setEnabled(enabled);
+ mTrustAgentFeatures.setEnabled(enabled);
}
}
diff --git a/samples/ApiDemos/src/com/example/android/apis/media/projection/MediaProjectionDemo.java b/samples/ApiDemos/src/com/example/android/apis/media/projection/MediaProjectionDemo.java
index c593daf78..f8a5d0551 100644
--- a/samples/ApiDemos/src/com/example/android/apis/media/projection/MediaProjectionDemo.java
+++ b/samples/ApiDemos/src/com/example/android/apis/media/projection/MediaProjectionDemo.java
@@ -64,6 +64,7 @@ public class MediaProjectionDemo extends Activity {
private VirtualDisplay mVirtualDisplay;
private Surface mSurface;
private SurfaceView mSurfaceView;
+ private ToggleButton mToggle;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -85,6 +86,8 @@ public class MediaProjectionDemo extends Activity {
s.setAdapter(arrayAdapter);
s.setOnItemSelectedListener(new ResolutionSelector());
s.setSelection(0);
+
+ mToggle = (ToggleButton) findViewById(R.id.screen_sharing_toggle);
}
@Override
@@ -108,6 +111,7 @@ public class MediaProjectionDemo extends Activity {
return;
}
mMediaProjection = mProjectionManager.getMediaProjection(resultCode, data);
+ mMediaProjection.registerCallback(new MediaProjectionCallback(), null);
mVirtualDisplay = createVirtualDisplay();
}
@@ -133,11 +137,14 @@ public class MediaProjectionDemo extends Activity {
}
private void stopScreenSharing() {
+ if (mToggle.isChecked()) {
+ mToggle.setChecked(false);
+ }
mScreenSharing = false;
- if (mVirtualDisplay == null) {
- return;
+ if (mVirtualDisplay != null) {
+ mVirtualDisplay.release();
+ mVirtualDisplay = null;
}
- mVirtualDisplay.release();
}
private VirtualDisplay createVirtualDisplay() {
diff --git a/samples/ApiDemos/src/com/example/android/apis/os/MmsMessagingDemo.java b/samples/ApiDemos/src/com/example/android/apis/os/MmsMessagingDemo.java
index 6a5d94c99..0b66d6f5b 100644
--- a/samples/ApiDemos/src/com/example/android/apis/os/MmsMessagingDemo.java
+++ b/samples/ApiDemos/src/com/example/android/apis/os/MmsMessagingDemo.java
@@ -238,7 +238,8 @@ public class MmsMessagingDemo extends Activity {
if (code == Activity.RESULT_OK) {
final byte[] response = intent.getByteArrayExtra(SmsManager.EXTRA_MMS_DATA);
if (response != null) {
- final GenericPdu pdu = new PduParser(response).parse();
+ final GenericPdu pdu = new PduParser(
+ response, PduParserUtil.shouldParseContentDisposition()).parse();
if (pdu instanceof SendConf) {
final SendConf sendConf = (SendConf) pdu;
if (sendConf.getResponseStatus() == PduHeaders.RESPONSE_STATUS_OK) {
@@ -281,7 +282,8 @@ public class MmsMessagingDemo extends Activity {
final byte[] response = new byte[nBytes];
final int read = reader.read(response, 0, nBytes);
if (read == nBytes) {
- final GenericPdu pdu = new PduParser(response).parse();
+ final GenericPdu pdu = new PduParser(
+ response, PduParserUtil.shouldParseContentDisposition()).parse();
if (pdu instanceof RetrieveConf) {
final RetrieveConf retrieveConf = (RetrieveConf) pdu;
mRecipientsInput.setText(getRecipients(context, retrieveConf));
diff --git a/samples/ApiDemos/src/com/example/android/apis/os/MmsWapPushReceiver.java b/samples/ApiDemos/src/com/example/android/apis/os/MmsWapPushReceiver.java
index a291e4aee..f2ca090b0 100644
--- a/samples/ApiDemos/src/com/example/android/apis/os/MmsWapPushReceiver.java
+++ b/samples/ApiDemos/src/com/example/android/apis/os/MmsWapPushReceiver.java
@@ -16,18 +16,18 @@
package com.example.android.apis.os;
-import com.google.android.mms.ContentType;
-import com.google.android.mms.pdu.GenericPdu;
-import com.google.android.mms.pdu.NotificationInd;
-import com.google.android.mms.pdu.PduHeaders;
-import com.google.android.mms.pdu.PduParser;
-
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.provider.Telephony;
import android.util.Log;
+import com.google.android.mms.ContentType;
+import com.google.android.mms.pdu.GenericPdu;
+import com.google.android.mms.pdu.NotificationInd;
+import com.google.android.mms.pdu.PduHeaders;
+import com.google.android.mms.pdu.PduParser;
+
/**
* Receiver for MMS WAP push
*/
@@ -39,7 +39,8 @@ public class MmsWapPushReceiver extends BroadcastReceiver {
if (Telephony.Sms.Intents.WAP_PUSH_RECEIVED_ACTION.equals(intent.getAction())
&& ContentType.MMS_MESSAGE.equals(intent.getType())) {
final byte[] data = intent.getByteArrayExtra("data");
- final PduParser parser = new PduParser(data);
+ final PduParser parser = new PduParser(
+ data, PduParserUtil.shouldParseContentDisposition());
GenericPdu pdu = null;
try {
pdu = parser.parse();
diff --git a/samples/ApiDemos/src/com/example/android/apis/os/PduParserUtil.java b/samples/ApiDemos/src/com/example/android/apis/os/PduParserUtil.java
new file mode 100644
index 000000000..541854e6e
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/os/PduParserUtil.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 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.apis.os;
+
+import android.telephony.SmsManager;
+
+/**
+ * Util methods for PduParser
+ */
+public class PduParserUtil {
+ /**
+ * Get the config of whether Content-Disposition header is supported
+ * for default carrier using new SmsManager API
+ *
+ * @return true if supported, false otherwise
+ */
+ public static boolean shouldParseContentDisposition() {
+ return SmsManager
+ .getDefault()
+ .getCarrierConfigValues()
+ .getBoolean(SmsManager.MMS_CONFIG_SUPPORT_MMS_CONTENT_DISPOSITION, true);
+ }
+}
diff --git a/samples/SoftKeyboard/src/com/example/android/softkeyboard/ImePreferences.java b/samples/SoftKeyboard/src/com/example/android/softkeyboard/ImePreferences.java
index db6c1d984..14c67b70d 100644
--- a/samples/SoftKeyboard/src/com/example/android/softkeyboard/ImePreferences.java
+++ b/samples/SoftKeyboard/src/com/example/android/softkeyboard/ImePreferences.java
@@ -41,6 +41,11 @@ public class ImePreferences extends PreferenceActivity {
setTitle(R.string.settings_name);
}
+ @Override
+ protected boolean isValidFragment(final String fragmentName) {
+ return Settings.class.getName().equals(fragmentName);
+ }
+
public static class Settings extends InputMethodSettingsFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
diff --git a/samples/Support7Demos/AndroidManifest.xml b/samples/Support7Demos/AndroidManifest.xml
index 4077bb110..1d087a470 100644
--- a/samples/Support7Demos/AndroidManifest.xml
+++ b/samples/Support7Demos/AndroidManifest.xml
@@ -31,7 +31,7 @@
reading images from the media store from API v19+. -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
- <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="17" />
+ <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="21" />
<!-- The smallest screen this app works on is a phone. The app will
scale its UI to larger screens but doesn't make good use of them
@@ -86,6 +86,14 @@
</intent-filter>
</activity>
+ <activity android:name=".media.SampleMediaRouteSettingsActivity"
+ android:label="@string/sample_media_route_settings_activity"
+ android:theme="@style/Theme.AppCompat.Light">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ </intent-filter>
+ </activity>
+
<service android:name=".media.SampleMediaRouteProviderService"
android:label="@string/sample_media_route_provider_service"
android:process=":mrp">
@@ -130,6 +138,16 @@
</intent-filter>
</activity>
+ <activity android:name=".app.SearchActivity">
+ <intent-filter>
+ <action android:name="android.intent.action.SEARCH" />
+ </intent-filter>
+
+ <meta-data android:name="android.app.searchable"
+ android:resource="@xml/searchable" />
+
+ </activity>
+
<activity android:name=".app.ActionBarUsage"
android:label="@string/action_bar_usage"
android:theme="@style/Theme.AppCompat">
@@ -151,7 +169,7 @@
<activity android:name=".app.ActionBarTabs"
android:label="@string/action_bar_tabs"
- android:theme="@style/Theme.AppCompat">
+ android:theme="@style/Theme.Custom">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="com.example.android.supportv7.SAMPLE_CODE" />
@@ -160,7 +178,7 @@
<activity android:name=".app.ActionBarSettingsActionProviderActivity"
android:label="@string/action_bar_settings_action_provider"
- android:theme="@style/Theme.AppCompat">
+ android:theme="@style/Theme.AppCompat.Light.DarkActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="com.example.android.supportv7.SAMPLE_CODE" />
@@ -177,15 +195,49 @@
</activity>
<activity android:name=".app.ActionBarWithDrawerLayout"
- android:label="@string/action_bar_with_navigation_drawer"
- android:theme="@style/Theme.AppCompat"
- >
+ android:label="@string/action_bar_with_navigation_drawer"
+ android:theme="@style/Theme.AppCompat"
+ >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="com.example.android.supportv7.SAMPLE_CODE"/>
+ </intent-filter>
+ </activity>
+
+ <activity android:name=".app.ToolbarUsage"
+ android:label="@string/toolbar_usage"
+ android:theme="@style/Theme.Custom.NoActionBar">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="com.example.android.supportv7.SAMPLE_CODE" />
+ </intent-filter>
+
+ <meta-data
+ android:name="android.app.default_searchable"
+ android:value=".app.SearchActivity" />
+ </activity>
+
+ <activity android:name=".app.ToolbarDisplayOptions"
+ android:label="@string/toolbar_display_options"
+ android:theme="@style/Theme.AppCompat.Light.NoActionBar">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="com.example.android.supportv7.SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
+
+ <activity android:name=".app.ToolbarFragmentPagerMenu"
+ android:label="@string/toolbar_fragment_pager"
+ android:theme="@style/Theme.AppCompat.Light.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="com.example.android.supportv7.SAMPLE_CODE" />
</intent-filter>
</activity>
+ <provider android:name=".app.RecentSuggestionsProvider"
+ android:authorities="com.example.android.supportv7.RecentSuggestionsProvider" />
+
<!-- RecyclerView samples -->
<activity android:name=".widget.RecyclerViewActivity"
android:label="@string/recycler_view"
diff --git a/samples/Support7Demos/res/layout/activity_card_view.xml b/samples/Support7Demos/res/layout/activity_card_view.xml
index cfd307142..9b985f70e 100644
--- a/samples/Support7Demos/res/layout/activity_card_view.xml
+++ b/samples/Support7Demos/res/layout/activity_card_view.xml
@@ -123,14 +123,62 @@
android:layout_height="wrap_content"
android:layout_toRightOf="@id/alpha_label"
android:layout_alignTop="@id/alpha_label"/>
-
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="5dp"
+ android:id="@+id/color_label"
+ android:textColor="@android:color/black"
+ android:text="@string/card_view_bg_color"
+ android:layout_below="@id/alpha_label"
+ android:layout_alignRight="@id/alpha_label"/>
<RadioGroup
- android:id="@+id/select_target_radio"
+ android:id="@+id/select_bg_color_radio"
+ android:layout_toRightOf="@id/color_label"
+ android:layout_alignTop="@id/color_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_below="@id/alpha_seek_bar">
<RadioButton
+ android:id="@+id/def"
+ android:layout_width="40dp"
+ android:layout_height="wrap_content"
+ android:background="@color/cardview_light_background"
+ android:checked="true"/>
+ <RadioButton
+ android:id="@+id/yellow"
+ android:layout_width="40dp"
+ android:layout_height="wrap_content"
+ android:background="@color/card_yellow"/>
+ <RadioButton
+ android:id="@+id/aquatic"
+ android:layout_width="40dp"
+ android:layout_height="wrap_content"
+ android:background="@color/card_aquatic"/>
+ <RadioButton
+ android:id="@+id/classic"
+ android:layout_width="40dp"
+ android:layout_height="wrap_content"
+ android:background="@color/card_classic"/>
+ <RadioButton
+ android:id="@+id/sunbrite"
+ android:layout_width="40dp"
+ android:layout_height="wrap_content"
+ android:background="@color/card_sunbrite"/>
+ <RadioButton
+ android:id="@+id/tropical"
+ android:layout_width="40dp"
+ android:layout_height="wrap_content"
+ android:background="@color/card_tropical"/>
+ </RadioGroup>
+ <RadioGroup
+ android:id="@+id/select_target_radio"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:layout_below="@id/color_label">
+ <RadioButton
android:id="@+id/resize_card_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -144,7 +192,6 @@
android:textColor="@android:color/black"
android:text="@string/card_view_resize_content"/>
</RadioGroup>
-
</RelativeLayout>
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="match_parent">
@@ -155,9 +202,10 @@
card_view:cardElevation="10dp">
<TextView
android:id="@+id/info_text"
+ android:text="@string/card_view"
android:textColor="@android:color/black"
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
</android.support.v7.widget.CardView>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="@string/card_view_sample_text"
diff --git a/samples/Support7Demos/res/layout/toolbar_display_options.xml b/samples/Support7Demos/res/layout/toolbar_display_options.xml
new file mode 100644
index 000000000..cc3e66c5a
--- /dev/null
+++ b/samples/Support7Demos/res/layout/toolbar_display_options.xml
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <android.support.v7.widget.Toolbar
+ android:id="@+id/toolbar"
+ android:layout_height="wrap_content"
+ android:layout_width="match_parent"
+ android:minHeight="?attr/actionBarSize"
+ android:background="?attr/colorPrimary" />
+
+ <ScrollView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <Button
+ android:id="@+id/toggle_home_as_up"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/toggle_home_as_up"/>
+
+ <Button
+ android:id="@+id/toggle_show_home"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/toggle_show_home"/>
+
+ <Button
+ android:id="@+id/toggle_use_logo"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/toggle_use_logo"/>
+
+ <Button
+ android:id="@+id/toggle_show_title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/toggle_show_title"/>
+
+ <Button
+ android:id="@+id/toggle_show_custom"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/toggle_show_custom"/>
+
+ <Button
+ android:id="@+id/cycle_custom_gravity"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/cycle_custom_gravity"/>
+
+ <Button
+ android:id="@+id/toggle_visibility"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/toggle_visibility"/>
+
+ </LinearLayout>
+
+ </ScrollView>
+
+</LinearLayout> \ No newline at end of file
diff --git a/samples/Support7Demos/res/layout/toolbar_fragment_pager.xml b/samples/Support7Demos/res/layout/toolbar_fragment_pager.xml
new file mode 100644
index 000000000..9f56f194b
--- /dev/null
+++ b/samples/Support7Demos/res/layout/toolbar_fragment_pager.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <android.support.v7.widget.Toolbar
+ android:id="@+id/toolbar"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:minHeight="?actionBarSize"
+ android:background="?attr/colorPrimaryDark" />
+
+ <android.support.v4.view.ViewPager
+ android:id="@+id/viewpager"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"/>
+
+</LinearLayout> \ No newline at end of file
diff --git a/samples/Support7Demos/res/layout/toolbar_usage.xml b/samples/Support7Demos/res/layout/toolbar_usage.xml
new file mode 100644
index 000000000..b202e1f68
--- /dev/null
+++ b/samples/Support7Demos/res/layout/toolbar_usage.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <android.support.v7.widget.Toolbar
+ android:id="@+id/toolbar"
+ android:layout_height="wrap_content"
+ android:layout_width="match_parent"
+ android:minHeight="?attr/actionBarSize"
+ android:background="?attr/colorPrimaryDark"
+ app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
+ app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:text="Your content"
+ android:gravity="center"
+ android:textAppearance="?android:attr/textAppearanceLarge"/>
+
+</LinearLayout> \ No newline at end of file
diff --git a/samples/Support7Demos/res/menu/actions.xml b/samples/Support7Demos/res/menu/actions.xml
index 38d291ebc..43605fd3c 100644
--- a/samples/Support7Demos/res/menu/actions.xml
+++ b/samples/Support7Demos/res/menu/actions.xml
@@ -16,9 +16,9 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/action_search"
- android:icon="@android:drawable/ic_menu_search"
android:title="@string/action_bar_search"
- app:showAsAction="ifRoom"
+ android:icon="@drawable/abc_ic_search_api_mtrl_alpha"
+ app:showAsAction="ifRoom|collapseActionView"
app:actionViewClass="android.support.v7.widget.SearchView" />
<item android:id="@+id/action_add"
android:icon="@android:drawable/ic_menu_add"
@@ -30,6 +30,7 @@
<item android:id="@+id/action_share"
android:icon="@android:drawable/ic_menu_share"
android:title="@string/action_bar_share"
+ android:enabled="false"
app:showAsAction="ifRoom" />
<item android:id="@+id/action_sort"
android:icon="@android:drawable/ic_menu_sort_by_size"
@@ -38,12 +39,10 @@
<menu>
<item android:id="@+id/action_sort_size"
android:icon="@android:drawable/ic_menu_sort_by_size"
- android:title="@string/action_bar_sort_size"
- android:onClick="onSort" />
+ android:title="@string/action_bar_sort_size" />
<item android:id="@+id/action_sort_alpha"
android:icon="@android:drawable/ic_menu_sort_alphabetically"
- android:title="@string/action_bar_sort_alpha"
- android:onClick="onSort" />
+ android:title="@string/action_bar_sort_alpha" />
</menu>
</item>
</menu>
diff --git a/samples/Support7Demos/res/values/colors.xml b/samples/Support7Demos/res/values/colors.xml
index b129b8de6..c8c67a0a2 100644
--- a/samples/Support7Demos/res/values/colors.xml
+++ b/samples/Support7Demos/res/values/colors.xml
@@ -16,4 +16,9 @@
<resources>
<drawable name="blue">#770000ff</drawable>
+ <color name="card_yellow">#FCF0AD</color>
+ <color name="card_aquatic">#FCF0AD</color>
+ <color name="card_classic">#BAB7A9</color>
+ <color name="card_sunbrite">#F9D6AC</color>
+ <color name="card_tropical">#56C4E8</color>
</resources>
diff --git a/samples/Support7Demos/res/values/strings.xml b/samples/Support7Demos/res/values/strings.xml
index 14569a53d..4b3a28fd7 100644
--- a/samples/Support7Demos/res/values/strings.xml
+++ b/samples/Support7Demos/res/values/strings.xml
@@ -25,6 +25,7 @@
<string name="sample_media_router_text">This activity demonstrates how to
use MediaRouter from the support library. Select a route from the action bar.</string>
<string name="media_route_menu_title">Play on...</string>
+ <string name="sample_media_route_settings_activity">Sample route settings</string>
<string name="library_tab_text">Library</string>
<string name="playlist_tab_text">Playlist</string>
@@ -121,6 +122,9 @@
necessary.
</string>
+ <string name="toolbar_usage">AppCompat/Toolbar/Toolbar as Action Bar</string>
+ <string name="toolbar_display_options">AppCompat/Toolbar/Toolbar Display Options</string>
+ <string name="toolbar_fragment_pager">AppCompat/Toolbar/Toolbar Fragment ViewPager</string>
<string name="sample_media_route_provider_remote">Remote Playback (Simulated)</string>
<string name="sample_media_route_activity_local">Local Playback</string>
@@ -147,6 +151,7 @@
<string name="card_view_radius">Radius</string>
<string name="card_view_width">Width</string>
<string name="card_view_height">Height</string>
+ <string name="card_view_bg_color">Background</string>
<string name="card_view_elevation">Elevation</string>
<string name="card_view_max_elevation">Max Elevation</string>
<string name="card_view_alpha">Alpha</string>
@@ -156,5 +161,6 @@
<string name="palette">Palette</string>
<string name="palette_all_colors">Full color palette</string>
+ <string name="search_hint">Search...</string>
</resources>
diff --git a/samples/Support7Demos/res/values/styles.xml b/samples/Support7Demos/res/values/styles.xml
new file mode 100644
index 000000000..f085fa5f0
--- /dev/null
+++ b/samples/Support7Demos/res/values/styles.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014 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.Custom" parent="Theme.AppCompat.Light.DarkActionBar">
+ <item name="colorPrimary">#ff00bcd4</item>
+ <item name="colorPrimaryDark">#00838f</item>
+ <item name="colorAccent">#ffff00</item>
+ </style>
+
+ <style name="Theme.Custom.NoActionBar" parent="Theme.AppCompat.Light.NoActionBar">
+ <item name="colorPrimary">#ff00bcd4</item>
+ <item name="colorPrimaryDark">#00838f</item>
+ <item name="colorAccent">#ffff00</item>
+ </style>
+
+</resources> \ No newline at end of file
diff --git a/samples/Support7Demos/res/xml/searchable.xml b/samples/Support7Demos/res/xml/searchable.xml
new file mode 100644
index 000000000..7f0fa74d5
--- /dev/null
+++ b/samples/Support7Demos/res/xml/searchable.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014 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.
+-->
+
+<searchable xmlns:android="http://schemas.android.com/apk/res/android"
+ android:label="@string/activity_sample_code"
+ android:hint="@string/search_hint"
+ android:searchSuggestAuthority="com.example.android.supportv7.RecentSuggestionsProvider"
+ android:searchSuggestSelection=" ?" /> \ No newline at end of file
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarDisplayOptions.java b/samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarDisplayOptions.java
index b7b25e8f8..ebda99905 100644
--- a/samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarDisplayOptions.java
+++ b/samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarDisplayOptions.java
@@ -15,6 +15,8 @@
*/
package com.example.android.supportv7.app;
+import com.example.android.supportv7.R;
+
import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.ActionBar;
@@ -24,8 +26,8 @@ import android.view.Gravity;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
-
-import com.example.android.supportv7.R;
+import android.widget.ArrayAdapter;
+import android.widget.Toast;
/**
* This demo shows how various action bar display option flags can be combined and their effects.
@@ -59,6 +61,21 @@ public class ActionBarDisplayOptions extends ActionBarActivity
bar.addTab(bar.newTab().setText("Tab 1").setTabListener(this));
bar.addTab(bar.newTab().setText("Tab 2").setTabListener(this));
bar.addTab(bar.newTab().setText("Tab 3").setTabListener(this));
+
+ final ArrayAdapter<String> listAdapter = new ArrayAdapter<String>(bar.getThemedContext(),
+ R.layout.support_simple_spinner_dropdown_item,
+ new String[] { "Item 1", "Item 2", "Item 3" });
+ bar.setListNavigationCallbacks(listAdapter, new ActionBar.OnNavigationListener() {
+ @Override
+ public boolean onNavigationItemSelected(int itemPosition, long itemId) {
+ Toast.makeText(ActionBarDisplayOptions.this,
+ listAdapter.getItem(itemPosition),
+ Toast.LENGTH_SHORT).show();
+ return true;
+ }
+ });
+
+ bar.setLogo(R.drawable.ic_media_play);
}
@Override
@@ -94,10 +111,17 @@ public class ActionBarDisplayOptions extends ActionBarActivity
flags = ActionBar.DISPLAY_SHOW_CUSTOM;
break;
case R.id.toggle_navigation:
- bar.setNavigationMode(
- bar.getNavigationMode() == ActionBar.NAVIGATION_MODE_STANDARD
- ? ActionBar.NAVIGATION_MODE_TABS
- : ActionBar.NAVIGATION_MODE_STANDARD);
+ switch (bar.getNavigationMode()) {
+ case ActionBar.NAVIGATION_MODE_STANDARD:
+ bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
+ break;
+ case ActionBar.NAVIGATION_MODE_TABS:
+ bar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
+ break;
+ case ActionBar.NAVIGATION_MODE_LIST:
+ bar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
+ break;
+ }
return;
case R.id.cycle_custom_gravity: {
ActionBar.LayoutParams lp = mCustomViewLayoutParams;
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarTabs.java b/samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarTabs.java
index aaa916cf3..4bfea5010 100644
--- a/samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarTabs.java
+++ b/samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarTabs.java
@@ -36,7 +36,6 @@ public class ActionBarTabs extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
-
setContentView(R.layout.action_bar_tabs);
}
@@ -61,10 +60,8 @@ public class ActionBarTabs extends ActionBarActivity {
if (bar.getNavigationMode() == ActionBar.NAVIGATION_MODE_TABS) {
bar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
- bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE);
} else {
bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
- bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE);
}
}
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarUsage.java b/samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarUsage.java
index 6ed59fbbe..f8c29caed 100644
--- a/samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarUsage.java
+++ b/samples/Support7Demos/src/com/example/android/supportv7/app/ActionBarUsage.java
@@ -67,14 +67,19 @@ public class ActionBarUsage extends ActionBarActivity {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.action_sort_alpha:
+ case R.id.action_sort_size:
+ onSort(item);
+ break;
+ }
+
Toast.makeText(this, "Selected Item: " + item.getTitle(), Toast.LENGTH_SHORT).show();
+
return true;
}
- // This method is specified as an onClick handler in the menu xml and will
- // take precedence over the Activity's onOptionsItemSelected method.
- // See res/menu/actions.xml for more info.
- public void onSort(MenuItem item) {
+ private void onSort(MenuItem item) {
mSortMode = item.getItemId();
// Request a call to onPrepareOptionsMenu so we can change the sort icon
supportInvalidateOptionsMenu();
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/app/RecentSuggestionsProvider.java b/samples/Support7Demos/src/com/example/android/supportv7/app/RecentSuggestionsProvider.java
new file mode 100644
index 000000000..8d6666d1a
--- /dev/null
+++ b/samples/Support7Demos/src/com/example/android/supportv7/app/RecentSuggestionsProvider.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2014 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.supportv7.app;
+
+import android.content.SearchRecentSuggestionsProvider;
+
+public class RecentSuggestionsProvider extends SearchRecentSuggestionsProvider {
+ public final static String AUTHORITY = "com.example.android.supportv7.RecentSuggestionsProvider";
+ public final static int MODE = DATABASE_MODE_QUERIES;
+
+ public RecentSuggestionsProvider() {
+ setupSuggestions(AUTHORITY, MODE);
+ }
+} \ No newline at end of file
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/app/SearchActivity.java b/samples/Support7Demos/src/com/example/android/supportv7/app/SearchActivity.java
new file mode 100644
index 000000000..622516f7a
--- /dev/null
+++ b/samples/Support7Demos/src/com/example/android/supportv7/app/SearchActivity.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2014 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.supportv7.app;
+
+import android.app.Activity;
+import android.app.SearchManager;
+import android.content.Intent;
+import android.os.Bundle;
+import android.provider.SearchRecentSuggestions;
+
+/**
+ * An Activity which is only used for recieving ACTION_SEARCH intents, saving any queries
+ * to our SearchRecentSuggestions so that SearchView's can display suggestions.
+ */
+public class SearchActivity extends Activity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ // Get the intent, verify the action and get the query
+ Intent intent = getIntent();
+ if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
+ String query = intent.getStringExtra(SearchManager.QUERY);
+ SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this,
+ RecentSuggestionsProvider.AUTHORITY, RecentSuggestionsProvider.MODE);
+ suggestions.saveRecentQuery(query, null);
+ finish();
+ }
+ }
+}
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/app/ToolbarDisplayOptions.java b/samples/Support7Demos/src/com/example/android/supportv7/app/ToolbarDisplayOptions.java
new file mode 100644
index 000000000..f5c3d7587
--- /dev/null
+++ b/samples/Support7Demos/src/com/example/android/supportv7/app/ToolbarDisplayOptions.java
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2014 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.supportv7.app;
+
+import com.example.android.supportv7.R;
+
+import android.os.Bundle;
+import android.support.v4.app.FragmentTransaction;
+import android.support.v7.app.ActionBar;
+import android.support.v7.app.ActionBar.Tab;
+import android.support.v7.app.ActionBarActivity;
+import android.support.v7.widget.Toolbar;
+import android.view.Gravity;
+import android.view.Menu;
+import android.view.View;
+import android.view.ViewGroup.LayoutParams;
+import android.widget.ArrayAdapter;
+import android.widget.Toast;
+
+/**
+ * This demo shows how various action bar display option flags can be combined and their effects
+ * when used on a Toolbar-provided Action Bar
+ */
+public class ToolbarDisplayOptions extends ActionBarActivity
+ implements View.OnClickListener {
+
+ private View mCustomView;
+ private ActionBar.LayoutParams mCustomViewLayoutParams;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.toolbar_display_options);
+
+ Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
+ setSupportActionBar(toolbar);
+
+ findViewById(R.id.toggle_home_as_up).setOnClickListener(this);
+ findViewById(R.id.toggle_show_home).setOnClickListener(this);
+ findViewById(R.id.toggle_use_logo).setOnClickListener(this);
+ findViewById(R.id.toggle_show_title).setOnClickListener(this);
+ findViewById(R.id.toggle_show_custom).setOnClickListener(this);
+ findViewById(R.id.cycle_custom_gravity).setOnClickListener(this);
+ findViewById(R.id.toggle_visibility).setOnClickListener(this);
+
+ // Configure several action bar elements that will be toggled by display options.
+ mCustomView = getLayoutInflater().inflate(R.layout.action_bar_display_options_custom, null);
+ mCustomViewLayoutParams = new ActionBar.LayoutParams(
+ LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.display_options_actions, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onSupportNavigateUp() {
+ finish();
+ return true;
+ }
+
+ @Override
+ public void onClick(View v) {
+ final ActionBar bar = getSupportActionBar();
+ int flags = 0;
+ switch (v.getId()) {
+ case R.id.toggle_home_as_up:
+ flags = ActionBar.DISPLAY_HOME_AS_UP;
+ break;
+ case R.id.toggle_show_home:
+ flags = ActionBar.DISPLAY_SHOW_HOME;
+ break;
+ case R.id.toggle_use_logo:
+ flags = ActionBar.DISPLAY_USE_LOGO;
+ getSupportActionBar().setLogo(R.drawable.ic_media_play);
+ break;
+ case R.id.toggle_show_title:
+ flags = ActionBar.DISPLAY_SHOW_TITLE;
+ break;
+ case R.id.toggle_show_custom:
+ flags = ActionBar.DISPLAY_SHOW_CUSTOM;
+ break;
+ case R.id.cycle_custom_gravity: {
+ ActionBar.LayoutParams lp = mCustomViewLayoutParams;
+ int newGravity = 0;
+ switch (lp.gravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
+ case Gravity.LEFT:
+ newGravity = Gravity.CENTER_HORIZONTAL;
+ break;
+ case Gravity.CENTER_HORIZONTAL:
+ newGravity = Gravity.RIGHT;
+ break;
+ case Gravity.RIGHT:
+ newGravity = Gravity.LEFT;
+ break;
+ }
+ lp.gravity = lp.gravity & ~Gravity.HORIZONTAL_GRAVITY_MASK | newGravity;
+ bar.setCustomView(mCustomView, lp);
+ return;
+ }
+ case R.id.toggle_visibility:
+ if (bar.isShowing()) {
+ bar.hide();
+ } else {
+ bar.show();
+ }
+ return;
+ }
+
+ int change = bar.getDisplayOptions() ^ flags;
+ bar.setDisplayOptions(change, flags);
+ }
+}
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/app/ToolbarFragmentPagerMenu.java b/samples/Support7Demos/src/com/example/android/supportv7/app/ToolbarFragmentPagerMenu.java
new file mode 100644
index 000000000..9b579338c
--- /dev/null
+++ b/samples/Support7Demos/src/com/example/android/supportv7/app/ToolbarFragmentPagerMenu.java
@@ -0,0 +1,171 @@
+/*
+ * Copyright (C) 2014 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.supportv7.app;
+
+import com.example.android.supportv7.R;
+
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentManager;
+import android.support.v4.app.FragmentPagerAdapter;
+import android.support.v4.app.FragmentTransaction;
+import android.support.v4.view.MenuItemCompat;
+import android.support.v4.view.ViewPager;
+import android.support.v7.app.ActionBarActivity;
+import android.support.v7.widget.Toolbar;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup;
+import android.widget.CheckBox;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Demonstrates how fragments can participate in the options menu from within a {@link ViewPager}.
+ */
+public class ToolbarFragmentPagerMenu extends ActionBarActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.toolbar_fragment_pager);
+
+ Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
+ setSupportActionBar(toolbar);
+
+ ViewPager vp = (ViewPager) findViewById(R.id.viewpager);
+ PagerAdapter adapter = new PagerAdapter(getSupportFragmentManager(),
+ new MenuFragment(), new Menu2Fragment());
+ vp.setAdapter(adapter);
+ }
+
+ private static class PagerAdapter extends FragmentPagerAdapter {
+ private final List<Fragment> mFragments;
+
+ public PagerAdapter(FragmentManager fm, Fragment... fragments) {
+ super(fm);
+
+ mFragments = new ArrayList<Fragment>();
+ for (Fragment fragment : fragments) {
+ mFragments.add(fragment);
+ }
+ }
+
+ @Override
+ public Fragment getItem(int position) {
+ return mFragments.get(position);
+ }
+
+ @Override
+ public int getCount() {
+ return mFragments.size();
+ }
+ }
+
+ /**
+ * A fragment that displays a menu. This fragment happens to not
+ * have a UI (it does not implement onCreateView), but it could also
+ * have one if it wanted.
+ */
+ public static class MenuFragment extends Fragment {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setHasOptionsMenu(true);
+ }
+
+ @Override
+ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
+ MenuItemCompat.setShowAsAction(menu.add("Menu 1a"), MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
+ MenuItemCompat.setShowAsAction(menu.add("Menu 1b"), MenuItemCompat.SHOW_AS_ACTION_NEVER);
+ super.onCreateOptionsMenu(menu, inflater);
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
+ @Nullable Bundle savedInstanceState) {
+ TextView textView = new TextView(container.getContext());
+
+ textView.setText(getClass().getSimpleName());
+ textView.setGravity(Gravity.CENTER);
+ textView.setLayoutParams(new ViewGroup.LayoutParams(
+ ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
+
+ return textView;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ if (item.getTitle().equals("Menu 1a")) {
+ Toast.makeText(getActivity(), "Selected Menu 1a.", Toast.LENGTH_SHORT).show();
+ return true;
+ }
+ if (item.getTitle().equals("Menu 1b")) {
+ Toast.makeText(getActivity(), "Selected Menu 1b.", Toast.LENGTH_SHORT).show();
+ return true;
+ }
+ return super.onOptionsItemSelected(item);
+ }
+ }
+
+ /**
+ * Second fragment with a menu.
+ */
+ public static class Menu2Fragment extends Fragment {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setHasOptionsMenu(true);
+ }
+
+ @Override
+ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
+ MenuItemCompat.setShowAsAction(menu.add("Menu 2"), MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
+ @Nullable Bundle savedInstanceState) {
+ TextView textView = new TextView(container.getContext());
+
+ textView.setText(getClass().getSimpleName());
+ textView.setGravity(Gravity.CENTER);
+ textView.setLayoutParams(new ViewGroup.LayoutParams(
+ ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
+
+ return textView;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ if (item.getTitle().equals("Menu 2")) {
+ Toast.makeText(getActivity(), "Selected Menu 2.", Toast.LENGTH_SHORT).show();
+ return true;
+ }
+ return false;
+ }
+ }
+}
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/app/ToolbarUsage.java b/samples/Support7Demos/src/com/example/android/supportv7/app/ToolbarUsage.java
new file mode 100644
index 000000000..f5ac03b84
--- /dev/null
+++ b/samples/Support7Demos/src/com/example/android/supportv7/app/ToolbarUsage.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2014 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.supportv7.app;
+
+import com.example.android.supportv7.R;
+
+import android.app.SearchManager;
+import android.content.Context;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.os.Handler;
+import android.support.annotation.Nullable;
+import android.support.v4.app.Fragment;
+import android.support.v4.view.MenuItemCompat;
+import android.support.v7.app.ActionBarActivity;
+import android.support.v7.view.ActionMode;
+import android.support.v7.widget.PopupMenu;
+import android.support.v7.widget.SearchView;
+import android.support.v7.widget.Toolbar;
+import android.text.TextUtils;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.TextView;
+import android.widget.Toast;
+
+/**
+ * This demonstrates idiomatic usage of the Toolbar as the action bar.
+ */
+public class ToolbarUsage extends ActionBarActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.toolbar_usage);
+
+ // Retrieve the Toolbar from our content view, and set it as the action bar
+ Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
+ setSupportActionBar(toolbar);
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.actions, menu);
+
+ // Retrieve the SearchView and plug it into SearchManager
+ final SearchView searchView = (SearchView) MenuItemCompat
+ .getActionView(menu.findItem(R.id.action_search));
+
+ SearchManager searchManager = (SearchManager) getSystemService(SEARCH_SERVICE);
+ searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
+
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ Toast.makeText(this, "Selected Item: " + item.getTitle(), Toast.LENGTH_SHORT).show();
+ return true;
+ }
+
+}
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/media/LocalPlayer.java b/samples/Support7Demos/src/com/example/android/supportv7/media/LocalPlayer.java
index 806df257d..b3c14c26b 100644
--- a/samples/Support7Demos/src/com/example/android/supportv7/media/LocalPlayer.java
+++ b/samples/Support7Demos/src/com/example/android/supportv7/media/LocalPlayer.java
@@ -28,6 +28,7 @@ import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.SystemClock;
+import android.support.v4.media.session.MediaSessionCompat;
import android.support.v7.media.MediaRouter.RouteInfo;
import android.support.v7.media.MediaItemStatus;
import android.util.Log;
@@ -56,12 +57,6 @@ public abstract class LocalPlayer extends Player implements
private static final String TAG = "LocalPlayer";
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
- private static final int STATE_IDLE = 0;
- private static final int STATE_PLAY_PENDING = 1;
- private static final int STATE_READY = 2;
- private static final int STATE_PLAYING = 3;
- private static final int STATE_PAUSED = 4;
-
private final Context mContext;
private final Handler mHandler = new Handler();
private MediaPlayer mMediaPlayer;
@@ -109,6 +104,11 @@ public abstract class LocalPlayer extends Player implements
}
}
+ @Override
+ public MediaSessionCompat getMediaSession() {
+ return mMediaSession;
+ }
+
// Player
@Override
public void play(final PlaylistItem item) {
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/media/Player.java b/samples/Support7Demos/src/com/example/android/supportv7/media/Player.java
index 32b128588..fcab57dd9 100644
--- a/samples/Support7Demos/src/com/example/android/supportv7/media/Player.java
+++ b/samples/Support7Demos/src/com/example/android/supportv7/media/Player.java
@@ -16,11 +16,17 @@
package com.example.android.supportv7.media;
-import android.net.Uri;
+import android.app.PendingIntent;
+import android.content.ComponentName;
import android.content.Context;
+import android.content.Intent;
import android.graphics.Bitmap;
+import android.support.v4.media.MediaMetadataCompat;
+import android.support.v4.media.session.MediaSessionCompat;
+import android.support.v4.media.session.PlaybackStateCompat;
import android.support.v7.media.MediaControlIntent;
import android.support.v7.media.MediaRouter.RouteInfo;
+import android.util.Log;
/**
* Abstraction of common playback operations of media items, such as play,
@@ -28,7 +34,18 @@ import android.support.v7.media.MediaRouter.RouteInfo;
* of media items.
*/
public abstract class Player {
+ private static final String TAG = "SampleMediaRoutePlayer";
+ protected static final int STATE_IDLE = 0;
+ protected static final int STATE_PLAY_PENDING = 1;
+ protected static final int STATE_READY = 2;
+ protected static final int STATE_PLAYING = 3;
+ protected static final int STATE_PAUSED = 4;
+
+ private static final long PLAYBACK_ACTIONS = PlaybackStateCompat.ACTION_PAUSE
+ | PlaybackStateCompat.ACTION_PLAY;
+
protected Callback mCallback;
+ protected MediaSessionCompat mMediaSession;
public abstract boolean isRemotePlayback();
public abstract boolean isQueuingSupported();
@@ -61,7 +78,7 @@ public abstract class Player {
mCallback = callback;
}
- public static Player create(Context context, RouteInfo route) {
+ public static Player create(Context context, RouteInfo route, MediaSessionCompat session) {
Player player;
if (route != null && route.supportsControlCategory(
MediaControlIntent.CATEGORY_REMOTE_PLAYBACK)) {
@@ -71,10 +88,62 @@ public abstract class Player {
} else {
player = new LocalPlayer.OverlayPlayer(context);
}
+ player.initMediaSession(session);
player.connect(route);
return player;
}
+ public MediaSessionCompat getMediaSession() {
+ return mMediaSession;
+ }
+
+ protected void updateMetadata() {
+ if (mMediaSession == null) {
+ return;
+ }
+ MediaMetadataCompat.Builder bob = new MediaMetadataCompat.Builder();
+ bob.putString(MediaMetadataCompat.METADATA_KEY_DISPLAY_TITLE, getDescription());
+ bob.putString(MediaMetadataCompat.METADATA_KEY_DISPLAY_SUBTITLE, "Subtitle of the thing");
+ bob.putString(MediaMetadataCompat.METADATA_KEY_DISPLAY_DESCRIPTION,
+ "Description of the thing");
+ bob.putBitmap(MediaMetadataCompat.METADATA_KEY_DISPLAY_ICON, getSnapshot());
+ mMediaSession.setMetadata(bob.build());
+ }
+
+ protected void publishState(int state) {
+ if (mMediaSession == null) {
+ return;
+ }
+ PlaybackStateCompat.Builder bob = new PlaybackStateCompat.Builder();
+ bob.setActions(PLAYBACK_ACTIONS);
+ switch (state) {
+ case STATE_PLAYING:
+ bob.setState(PlaybackStateCompat.STATE_PLAYING, -1, 1);
+ break;
+ case STATE_READY:
+ case STATE_PAUSED:
+ bob.setState(PlaybackStateCompat.STATE_PAUSED, -1, 0);
+ break;
+ case STATE_IDLE:
+ bob.setState(PlaybackStateCompat.STATE_STOPPED, -1, 0);
+ break;
+ }
+ PlaybackStateCompat pbState = bob.build();
+ Log.d(TAG, "Setting state to " + pbState);
+ mMediaSession.setPlaybackState(pbState);
+ if (state != STATE_IDLE) {
+ mMediaSession.setActive(true);
+ } else {
+ mMediaSession.setActive(false);
+ }
+ }
+
+ private void initMediaSession(MediaSessionCompat session) {
+ mMediaSession = session;
+ updateMetadata();
+ }
+
+
public interface Callback {
void onError();
void onCompletion();
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/media/RemotePlayer.java b/samples/Support7Demos/src/com/example/android/supportv7/media/RemotePlayer.java
index 5020c371b..d47c26069 100644
--- a/samples/Support7Demos/src/com/example/android/supportv7/media/RemotePlayer.java
+++ b/samples/Support7Demos/src/com/example/android/supportv7/media/RemotePlayer.java
@@ -140,6 +140,9 @@ public class RemotePlayer extends Player {
}
if (item.getState() == MediaItemStatus.PLAYBACK_STATE_PAUSED) {
pause();
+ publishState(STATE_PAUSED);
+ } else {
+ publishState(STATE_PLAYING);
}
if (mCallback != null) {
mCallback.onPlaylistChanged();
@@ -214,6 +217,7 @@ public class RemotePlayer extends Player {
if (mCallback != null) {
mCallback.onPlaylistChanged();
}
+ publishState(STATE_PAUSED);
}
@Override
@@ -239,6 +243,7 @@ public class RemotePlayer extends Player {
if (mCallback != null) {
mCallback.onPlaylistChanged();
}
+ publishState(STATE_PLAYING);
}
@Override
@@ -254,6 +259,7 @@ public class RemotePlayer extends Player {
// ignore if no session
return;
}
+ publishState(STATE_IDLE);
if (DEBUG) {
Log.d(TAG, "stop");
}
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouteControllerDialog.java b/samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouteControllerDialog.java
deleted file mode 100644
index a2cacc3f0..000000000
--- a/samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouteControllerDialog.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.example.android.supportv7.media;
-
-import com.example.android.supportv7.R;
-
-import android.app.Dialog;
-import android.content.Context;
-import android.content.Intent;
-import android.graphics.Bitmap;
-import android.os.Bundle;
-import android.support.v7.app.MediaRouteControllerDialog;
-import android.support.v7.media.MediaRouteSelector;
-import android.support.v7.media.MediaRouter;
-import android.util.Log;
-import android.view.KeyEvent;
-import android.view.MotionEvent;
-import android.view.View;
-import android.widget.ImageButton;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-
-/**
- * This class serves as an example on how to customize the media router control
- * dialog. It is derived from the standard MediaRouteControllerDialog with the
- * following overrides:
- *
- * 1. Shows thumbnail/snapshot of the current item
- *
- * 2. For variable volume routes, only allow volume control via Volume Up/Down
- * keys (to prevent accidental tapping on the volume adjust seekbar that sets
- * volume to maximum)
- *
- * 3. Provides transport control buttons (play/pause, stop)
- */
-public class SampleMediaRouteControllerDialog extends MediaRouteControllerDialog {
- private static final String TAG = "SampleMediaRouteControllerDialog";
- private final SampleMediaRouterActivity mActivity;
- private final SessionManager mSessionManager;
- private final Player mPlayer;
- private ImageButton mPauseResumeButton;
- private ImageButton mStopButton;
- private ImageView mThumbnail;
- private TextView mTextView;
- private LinearLayout mInfoLayout;
- private LinearLayout mVolumeLayout;
-
- public SampleMediaRouteControllerDialog(Context context,
- SessionManager manager, Player player) {
- super(context);
- mActivity = (SampleMediaRouterActivity) context;
- mSessionManager = manager;
- mPlayer = player;
- }
-
- @Override
- public View onCreateMediaControlView(Bundle savedInstanceState) {
- // Thumbnail and Track info
- View v = getLayoutInflater().inflate(R.layout.sample_media_controller, null);
- mInfoLayout = (LinearLayout)v.findViewById(R.id.media_route_info);
- mTextView = (TextView)v.findViewById(R.id.track_info);
- mThumbnail = (ImageView)v.findViewById(R.id.snapshot);
-
- // Transport controls
- mPauseResumeButton = (ImageButton)v.findViewById(R.id.pause_resume_button);
- mPauseResumeButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (mActivity != null) {
- mActivity.handleMediaKey(new KeyEvent(KeyEvent.ACTION_DOWN,
- KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE));
- }
- }
- });
-
- mStopButton = (ImageButton)v.findViewById(R.id.stop_button);
- mStopButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (mActivity != null) {
- mActivity.handleMediaKey(new KeyEvent(KeyEvent.ACTION_DOWN,
- KeyEvent.KEYCODE_MEDIA_STOP));
- }
- }
- });
-
- // update session status (will callback to updateUi at the end)
- mSessionManager.updateStatus();
- return v;
- }
-
- public void updateUi() {
- String trackInfo = mPlayer.getDescription();
- Bitmap snapshot = mPlayer.getSnapshot();
- if (mPlayer.isRemotePlayback() && !trackInfo.isEmpty() && snapshot != null) {
- mInfoLayout.setVisibility(View.VISIBLE);
- mThumbnail.setImageBitmap(snapshot);
- mTextView.setText(trackInfo);
- } else {
- mInfoLayout.setVisibility(View.GONE);
- }
- // show pause or resume icon depending on current state
- mPauseResumeButton.setImageResource(mSessionManager.isPaused() ?
- R.drawable.ic_media_play : R.drawable.ic_media_pause);
- }
-}
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouteProvider.java b/samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouteProvider.java
index 8a205649f..15cf19b7d 100644
--- a/samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouteProvider.java
+++ b/samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouteProvider.java
@@ -22,6 +22,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.IntentFilter.MalformedMimeTypeException;
+import android.content.IntentSender;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.media.AudioManager;
@@ -173,6 +174,10 @@ final class SampleMediaRouteProvider extends MediaRouteProvider {
private void publishRoutes() {
Resources r = getContext().getResources();
+ Intent settingsIntent = new Intent(Intent.ACTION_MAIN);
+ settingsIntent.setClass(getContext(), SampleMediaRouteSettingsActivity.class);
+ IntentSender is = PendingIntent.getActivity(getContext(), 99, settingsIntent,
+ Intent.FLAG_ACTIVITY_NEW_TASK).getIntentSender();
MediaRouteDescriptor routeDescriptor1 = new MediaRouteDescriptor.Builder(
FIXED_VOLUME_ROUTE_ID,
@@ -183,6 +188,8 @@ final class SampleMediaRouteProvider extends MediaRouteProvider {
.setPlaybackType(MediaRouter.RouteInfo.PLAYBACK_TYPE_REMOTE)
.setVolumeHandling(MediaRouter.RouteInfo.PLAYBACK_VOLUME_FIXED)
.setVolume(VOLUME_MAX)
+ .setCanDisconnect(true)
+ .setSettingsActivity(is)
.build();
MediaRouteDescriptor routeDescriptor2 = new MediaRouteDescriptor.Builder(
@@ -195,6 +202,7 @@ final class SampleMediaRouteProvider extends MediaRouteProvider {
.setVolumeHandling(MediaRouter.RouteInfo.PLAYBACK_VOLUME_VARIABLE)
.setVolumeMax(VOLUME_MAX)
.setVolume(mVolume)
+ .setSettingsActivity(is)
.build();
MediaRouteDescriptor routeDescriptor3 = new MediaRouteDescriptor.Builder(
@@ -207,6 +215,7 @@ final class SampleMediaRouteProvider extends MediaRouteProvider {
.setVolumeHandling(MediaRouter.RouteInfo.PLAYBACK_VOLUME_VARIABLE)
.setVolumeMax(VOLUME_MAX)
.setVolume(mVolume)
+ .setCanDisconnect(true)
.build();
MediaRouteDescriptor routeDescriptor4 = new MediaRouteDescriptor.Builder(
@@ -239,7 +248,7 @@ final class SampleMediaRouteProvider extends MediaRouteProvider {
public SampleRouteController(String routeId) {
mRouteId = routeId;
- mPlayer = Player.create(getContext(), null);
+ mPlayer = Player.create(getContext(), null, null);
mSessionManager.setPlayer(mPlayer);
mSessionManager.setCallback(new SessionManager.Callback() {
@Override
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouteSettingsActivity.java b/samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouteSettingsActivity.java
new file mode 100644
index 000000000..a1d07fb56
--- /dev/null
+++ b/samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouteSettingsActivity.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2014 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.supportv7.media;
+
+import android.support.v7.app.ActionBarActivity;
+
+/**
+ * This activity is a dummy settings activity for the
+ * {@link SampleMediaRouteProvider}.
+ */
+public class SampleMediaRouteSettingsActivity extends ActionBarActivity {
+
+}
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouterActivity.java b/samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouterActivity.java
index dfa14163c..ba1949965 100644
--- a/samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouterActivity.java
+++ b/samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouterActivity.java
@@ -20,6 +20,7 @@ import com.example.android.supportv7.R;
import android.content.ComponentName;
import android.content.Context;
+import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Resources;
import android.app.PendingIntent;
@@ -34,9 +35,11 @@ import android.os.Handler;
import android.os.Bundle;
import android.os.SystemClock;
import android.support.v4.app.FragmentManager;
+import android.support.v4.media.session.MediaSessionCompat;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.MediaRouteActionProvider;
+import android.support.v7.app.MediaRouteButton;
import android.support.v7.app.MediaRouteControllerDialog;
import android.support.v7.app.MediaRouteControllerDialogFragment;
import android.support.v7.app.MediaRouteDiscoveryFragment;
@@ -66,6 +69,7 @@ import android.widget.TabHost.TabSpec;
import android.widget.TabHost.OnTabChangeListener;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
+
import java.io.File;
/**
@@ -93,7 +97,6 @@ public class SampleMediaRouterActivity extends ActionBarActivity {
private SeekBar mSeekBar;
private boolean mNeedResume;
private boolean mSeeking;
- private SampleMediaRouteControllerDialog mControllerDialog;
private final Handler mHandler = new Handler();
private final Runnable mUpdateSeekRunnable = new Runnable() {
@@ -130,19 +133,18 @@ public class SampleMediaRouterActivity extends ActionBarActivity {
public void onRouteSelected(MediaRouter router, RouteInfo route) {
Log.d(TAG, "onRouteSelected: route=" + route);
- mPlayer = Player.create(SampleMediaRouterActivity.this, route);
+ mPlayer = Player.create(SampleMediaRouterActivity.this, route, mMediaSession);
mPlayer.updatePresentation();
mSessionManager.setPlayer(mPlayer);
mSessionManager.unsuspend();
- registerRCC();
updateUi();
}
@Override
public void onRouteUnselected(MediaRouter router, RouteInfo route) {
Log.d(TAG, "onRouteUnselected: route=" + route);
- unregisterRCC();
+ mMediaSession.setActive(false);
PlaylistItem item = getCheckedPlaylistItem();
if (item != null) {
@@ -152,7 +154,6 @@ public class SampleMediaRouterActivity extends ActionBarActivity {
}
mPlayer.updatePresentation();
mPlayer.release();
- mControllerDialog = null;
}
@Override
@@ -183,7 +184,7 @@ public class SampleMediaRouterActivity extends ActionBarActivity {
}
};
- private RemoteControlClient mRemoteControlClient;
+ private MediaSessionCompat mMediaSession;
private ComponentName mEventReceiver;
private AudioManager mAudioManager;
private PendingIntent mMediaPendingIntent;
@@ -367,11 +368,13 @@ public class SampleMediaRouterActivity extends ActionBarActivity {
mMediaPendingIntent = PendingIntent.getBroadcast(this, 0, mediaButtonIntent, 0);
// Create and register the remote control client
- registerRCC();
+ createMediaSession();
+ mMediaRouter.setMediaSessionCompat(mMediaSession);
// Set up playback manager and player
mPlayer = Player.create(SampleMediaRouterActivity.this,
- mMediaRouter.getSelectedRoute());
+ mMediaRouter.getSelectedRoute(), mMediaSession);
+
mSessionManager.setPlayer(mPlayer);
mSessionManager.setCallback(new SessionManager.Callback() {
@Override
@@ -387,40 +390,42 @@ public class SampleMediaRouterActivity extends ActionBarActivity {
updateUi();
}
- private void registerRCC() {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
- // Create the RCC and register with AudioManager and MediaRouter
- mAudioManager.requestAudioFocus(mAfChangeListener,
- AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN);
- mAudioManager.registerMediaButtonEventReceiver(mEventReceiver);
- mRemoteControlClient = new RemoteControlClient(mMediaPendingIntent);
- mAudioManager.registerRemoteControlClient(mRemoteControlClient);
- mMediaRouter.addRemoteControlClient(mRemoteControlClient);
- SampleMediaButtonReceiver.setActivity(SampleMediaRouterActivity.this);
- mRemoteControlClient.setTransportControlFlags(
- RemoteControlClient.FLAG_KEY_MEDIA_PLAY_PAUSE);
- mRemoteControlClient.setPlaybackState(
- RemoteControlClient.PLAYSTATE_PLAYING);
- }
- }
+ private void createMediaSession() {
+ // Create the MediaSession
+ mMediaSession = new MediaSessionCompat(this, "SampleMediaRouter", mEventReceiver,
+ mMediaPendingIntent);
+ mMediaSession.setFlags(MediaSessionCompat.FLAG_HANDLES_MEDIA_BUTTONS
+ | MediaSessionCompat.FLAG_HANDLES_TRANSPORT_CONTROLS);
+ mMediaSession.setCallback(new MediaSessionCompat.Callback() {
+ @Override
+ public boolean onMediaButtonEvent(Intent mediaButtonEvent) {
+ if (mediaButtonEvent != null) {
+ return handleMediaKey(
+ (KeyEvent) mediaButtonEvent.getParcelableExtra(Intent.EXTRA_KEY_EVENT));
+ }
+ return super.onMediaButtonEvent(mediaButtonEvent);
+ }
- private void unregisterRCC() {
- // Unregister the RCC with AudioManager and MediaRouter
- if (mRemoteControlClient != null) {
- mRemoteControlClient.setTransportControlFlags(0);
- mAudioManager.abandonAudioFocus(mAfChangeListener);
- mAudioManager.unregisterMediaButtonEventReceiver(mEventReceiver);
- mAudioManager.unregisterRemoteControlClient(mRemoteControlClient);
- mMediaRouter.removeRemoteControlClient(mRemoteControlClient);
- SampleMediaButtonReceiver.setActivity(null);
- mRemoteControlClient = null;
- }
+ @Override
+ public void onPlay() {
+ mSessionManager.resume();
+ }
+
+ @Override
+ public void onPause() {
+ mSessionManager.pause();
+ }
+ });
+
+ SampleMediaButtonReceiver.setActivity(SampleMediaRouterActivity.this);
}
public boolean handleMediaKey(KeyEvent event) {
- if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) {
+ if (event != null && event.getAction() == KeyEvent.ACTION_DOWN
+ && event.getRepeatCount() == 0) {
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
+ case KeyEvent.KEYCODE_HEADSETHOOK:
{
Log.d(TAG, "Received Play/Pause event from RemoteControlClient");
if (mSessionManager.isPaused()) {
@@ -497,11 +502,9 @@ public class SampleMediaRouterActivity extends ActionBarActivity {
@Override
public void onDestroy() {
- // Unregister the remote control client
- unregisterRCC();
-
mSessionManager.stop();
mPlayer.release();
+ mMediaSession.release();
super.onDestroy();
}
@@ -520,15 +523,7 @@ public class SampleMediaRouterActivity extends ActionBarActivity {
mediaRouteActionProvider.setDialogFactory(new MediaRouteDialogFactory() {
@Override
public MediaRouteControllerDialogFragment onCreateControllerDialogFragment() {
- return new MediaRouteControllerDialogFragment() {
- @Override
- public MediaRouteControllerDialog onCreateControllerDialog(
- Context context, Bundle savedInstanceState) {
- mControllerDialog = new SampleMediaRouteControllerDialog(
- context, mSessionManager, mPlayer);
- return mControllerDialog;
- }
- };
+ return new ControllerDialogFragment(mPlayer);
}
});
@@ -564,8 +559,8 @@ public class SampleMediaRouterActivity extends ActionBarActivity {
updatePlaylist();
updateRouteDescription();
updateButtons();
- if (mControllerDialog != null) {
- mControllerDialog.updateUi();
+ if (mPlayer != null) {
+ mPlayer.updateMetadata();
}
}
@@ -593,11 +588,6 @@ public class SampleMediaRouterActivity extends ActionBarActivity {
// only enable seek bar when duration is known
PlaylistItem item = getCheckedPlaylistItem();
mSeekBar.setEnabled(item != null && item.getDuration() > 0);
- if (mRemoteControlClient != null) {
- mRemoteControlClient.setPlaybackState(mSessionManager.isPaused() ?
- RemoteControlClient.PLAYSTATE_PAUSED :
- RemoteControlClient.PLAYSTATE_PLAYING);
- }
}
private PlaylistItem getCheckedPlaylistItem() {
@@ -745,4 +735,35 @@ public class SampleMediaRouterActivity extends ActionBarActivity {
*/
public static class LightWithDarkActionBar extends SampleMediaRouterActivity {
}
+
+ public static class ControllerDialogFragment extends MediaRouteControllerDialogFragment {
+ private MediaRouteControllerDialog mControllerDialog;
+ private Player mPlayer;
+
+ public ControllerDialogFragment() {
+ super();
+ }
+
+ public ControllerDialogFragment(Player player) {
+ mPlayer = player;
+ }
+
+ @Override
+ public MediaRouteControllerDialog onCreateControllerDialog(
+ Context context, Bundle savedInstanceState) {
+ mControllerDialog = super.onCreateControllerDialog(context,
+ savedInstanceState);
+ mControllerDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
+ @Override
+ public void onDismiss(DialogInterface dialog) {
+ mControllerDialog = null;
+ }
+ });
+ return mControllerDialog;
+ }
+
+ public void setPlayer(Player player) {
+ mPlayer = player;
+ }
+ }
}
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/view/CardViewActivity.java b/samples/Support7Demos/src/com/example/android/supportv7/view/CardViewActivity.java
index ba4f0cb1d..ca0c08aac 100644
--- a/samples/Support7Demos/src/com/example/android/supportv7/view/CardViewActivity.java
+++ b/samples/Support7Demos/src/com/example/android/supportv7/view/CardViewActivity.java
@@ -16,6 +16,8 @@
package com.example.android.supportv7.view;
import android.app.Activity;
+import android.graphics.drawable.ColorDrawable;
+import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.view.ViewCompat;
@@ -25,8 +27,11 @@ import android.view.ViewGroup;
import android.widget.RadioGroup;
import android.widget.SeekBar;
import android.widget.TextView;
+
import com.example.android.supportv7.R;
+import java.lang.reflect.Field;
+
public class CardViewActivity extends Activity {
CardView mCardView;
@@ -84,7 +89,7 @@ public class CardViewActivity extends Activity {
lp = setViewBounds(mInfoText);
}
mInfoText.setText("radius: " + mCornerRadiusSeekBar.getProgress()
- +", alpha: " + mAlphaSeekBar.getProgress()
+ + ", alpha: " + mAlphaSeekBar.getProgress()
+ "\n w: " + lp.width + "\nh: " + lp.height
+ "\nelevation: " + mCardView.getCardElevation() + " of "
+ mCardView.getMaxCardElevation());
@@ -143,15 +148,42 @@ public class CardViewActivity extends Activity {
}
});
- update();
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
View content = findViewById(android.R.id.content);
+ mWidthSeekBar.setProgress(mCardView.getWidth());
+ mHeightSeekBar.setProgress(mCardView.getHeight());
mWidthSeekBar.setMax(content.getWidth());
mHeightSeekBar.setMax(content.getHeight());
+ update();
}
}, 100);
+
+ ((RadioGroup) findViewById(R.id.select_bg_color_radio))
+ .setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(RadioGroup group, int checkedId) {
+ mCardView.setCardBackgroundColor(
+ getResources().getColor(getColorId(checkedId)));
+ }
+ });
}
+ private int getColorId(int id) {
+ switch (id) {
+ case R.id.yellow:
+ return R.color.card_yellow;
+ case R.id.aquatic:
+ return R.color.card_aquatic;
+ case R.id.classic:
+ return R.color.card_classic;
+ case R.id.sunbrite:
+ return R.color.card_sunbrite;
+ case R.id.tropical:
+ return R.color.card_tropical;
+ default:
+ return R.color.cardview_light_background;
+ }
+ }
}
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/widget/AnimatedRecyclerView.java b/samples/Support7Demos/src/com/example/android/supportv7/widget/AnimatedRecyclerView.java
index 50fe1e1a8..4c56933e7 100644
--- a/samples/Support7Demos/src/com/example/android/supportv7/widget/AnimatedRecyclerView.java
+++ b/samples/Support7Demos/src/com/example/android/supportv7/widget/AnimatedRecyclerView.java
@@ -124,8 +124,12 @@ public class AnimatedRecyclerView extends Activity {
public void itemClicked(View view) {
ViewGroup parent = (ViewGroup) view;
MyViewHolder holder = (MyViewHolder) mRecyclerView.getChildViewHolder(parent);
+ final int position = holder.getAdapterPosition();
+ if (position == RecyclerView.NO_POSITION) {
+ return;
+ }
mAdapter.toggleExpanded(holder);
- mAdapter.notifyItemChanged(holder.getPosition());
+ mAdapter.notifyItemChanged(position);
}
public void deleteItem(View view) {
@@ -240,7 +244,7 @@ public class AnimatedRecyclerView extends Activity {
if (lastVisibleView != null) {
RecyclerView.LayoutParams lastParams =
(RecyclerView.LayoutParams) lastVisibleView.getLayoutParams();
- int lastPosition = lastParams.getViewPosition();
+ int lastPosition = lastParams.getViewLayoutPosition();
final List<RecyclerView.ViewHolder> previousViews = recycler.getScrapList();
count = previousViews.size();
for (int i = 0; i < count; ++i) {
@@ -250,7 +254,7 @@ public class AnimatedRecyclerView extends Activity {
if (params.isItemRemoved()) {
continue;
}
- int position = params.getViewPosition();
+ int position = params.getViewLayoutPosition();
int newTop;
if (position < mFirstPosition) {
newTop = view.getHeight() * (position - mFirstPosition);
@@ -480,7 +484,7 @@ public class AnimatedRecyclerView extends Activity {
}
public void selectItem(MyViewHolder holder, boolean selected) {
- mSelected.put((String) holder.textView.getText(), selected);
+ mSelected.put((String) holder.textView.getText().toString(), selected);
}
public void toggleExpanded(MyViewHolder holder) {
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/widget/BaseLayoutManagerActivity.java b/samples/Support7Demos/src/com/example/android/supportv7/widget/BaseLayoutManagerActivity.java
index 0a6ac6d36..4bb64f4b1 100644
--- a/samples/Support7Demos/src/com/example/android/supportv7/widget/BaseLayoutManagerActivity.java
+++ b/samples/Support7Demos/src/com/example/android/supportv7/widget/BaseLayoutManagerActivity.java
@@ -84,11 +84,10 @@ abstract public class BaseLayoutManagerActivity<T extends RecyclerView.LayoutMan
vh.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- final int pos = vh.getPosition();
- if (pos + 1 < getItemCount()) {
+ final int pos = vh.getAdapterPosition();
+ if (pos != RecyclerView.NO_POSITION && pos + 1 < getItemCount()) {
swap(pos, pos + 1);
}
- notifyItemChanged(pos);
}
});
return vh;
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/widget/GridLayoutManagerActivity.java b/samples/Support7Demos/src/com/example/android/supportv7/widget/GridLayoutManagerActivity.java
index 00cfbf86a..ef25c0b0e 100644
--- a/samples/Support7Demos/src/com/example/android/supportv7/widget/GridLayoutManagerActivity.java
+++ b/samples/Support7Demos/src/com/example/android/supportv7/widget/GridLayoutManagerActivity.java
@@ -119,11 +119,13 @@ public class GridLayoutManagerActivity extends BaseLayoutManagerActivity<GridLay
vh.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- final int pos = vh.getPosition();
+ final int pos = vh.getAdapterPosition();
+ if (pos == RecyclerView.NO_POSITION) {
+ return;
+ }
if (pos + 1 < getItemCount()) {
swap(pos, pos + 1);
}
- notifyItemChanged(pos);
}
});
return vh;
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/widget/RecyclerViewActivity.java b/samples/Support7Demos/src/com/example/android/supportv7/widget/RecyclerViewActivity.java
index 747992b19..38b50bd3a 100644
--- a/samples/Support7Demos/src/com/example/android/supportv7/widget/RecyclerViewActivity.java
+++ b/samples/Support7Demos/src/com/example/android/supportv7/widget/RecyclerViewActivity.java
@@ -56,7 +56,10 @@ public class RecyclerViewActivity extends Activity {
vh.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- final int pos = vh.getPosition();
+ final int pos = vh.getAdapterPosition();
+ if (pos == RecyclerView.NO_POSITION) {
+ return;
+ }
if (pos + 1 < getItemCount()) {
swap(pos, pos + 1);
}
diff --git a/samples/SupportLeanbackDemos/AndroidManifest.xml b/samples/SupportLeanbackDemos/AndroidManifest.xml
index 95f7a2c0e..391bcb752 100644
--- a/samples/SupportLeanbackDemos/AndroidManifest.xml
+++ b/samples/SupportLeanbackDemos/AndroidManifest.xml
@@ -10,10 +10,12 @@
android:label="@string/app_name"
android:icon="@drawable/ic_launcher"
android:banner="@drawable/ic_launcher"
+ android:supportsRtl="true"
android:theme="@style/Theme.Example.Leanback">
<activity android:name="MainActivity"
- android:label="@string/app_name">
+ android:label="@string/app_name"
+ android:theme="@style/Theme.Example.Leanback.Browse">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
@@ -25,6 +27,11 @@
</activity>
<activity android:name="DetailsActivity"
+ android:theme="@style/Theme.Example.Leanback.Details"
+ android:exported="true" />
+
+ <activity android:name="RowsActivity"
+ android:theme="@style/Theme.Example.Leanback.Rows"
android:exported="true" />
<activity android:name="PlaybackOverlayActivity"
@@ -39,5 +46,7 @@
<activity android:name="BrowseErrorActivity"
android:exported="true" />
+ <activity android:name="HorizontalGridTestActivity"
+ android:exported="true" />
</application>
</manifest>
diff --git a/samples/SupportLeanbackDemos/res/layout/horizontal_grid.xml b/samples/SupportLeanbackDemos/res/layout/horizontal_grid.xml
new file mode 100644
index 000000000..7faea03f7
--- /dev/null
+++ b/samples/SupportLeanbackDemos/res/layout/horizontal_grid.xml
@@ -0,0 +1,23 @@
+<RelativeLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:lb="http://schemas.android.com/apk/res-auto"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ >
+ <android.support.v17.leanback.widget.HorizontalGridView
+ android:id="@+id/gridview"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:clipToPadding="false"
+ android:focusable="true"
+ android:focusableInTouchMode="true"
+ android:background="#00ffff"
+ lb:horizontalMargin="12dip"
+ lb:verticalMargin="24dip"
+ lb:numberOfRows="3"
+ lb:rowHeight="150dip"
+ android:paddingBottom="12dip"
+ android:paddingLeft="12dip"
+ android:paddingRight="12dip"
+ android:paddingTop="12dip" />
+</RelativeLayout>
diff --git a/samples/SupportLeanbackDemos/res/layout/rows.xml b/samples/SupportLeanbackDemos/res/layout/rows.xml
new file mode 100644
index 000000000..d77f7cacc
--- /dev/null
+++ b/samples/SupportLeanbackDemos/res/layout/rows.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014 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.
+-->
+
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/rows_frame"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <TextView
+ android:id="@+id/rows_title"
+ android:text="RowsFragment"
+ style="?attr/browseTitleTextStyle"
+ android:paddingStart="?attr/browsePaddingStart"
+ android:paddingEnd="?attr/browsePaddingEnd"
+ android:paddingTop="?attr/browsePaddingTop"
+ android:paddingBottom="10dp"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+ <fragment
+ android:name="com.example.android.leanback.RowsFragment"
+ android:id="@+id/main_rows_fragment"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ />
+
+</FrameLayout>
diff --git a/samples/SupportLeanbackDemos/res/values/styles.xml b/samples/SupportLeanbackDemos/res/values/styles.xml
new file mode 100644
index 000000000..17ea0efad
--- /dev/null
+++ b/samples/SupportLeanbackDemos/res/values/styles.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014 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 xmlns:android="http://schemas.android.com/apk/res/android">
+ <style name="Widget.Example.Leanback.Title.Text" parent="Widget.Leanback.Title.Text" >
+ </style>
+ <style name="Widget.Example.Leanback.Rows.VerticalGridView" parent="Widget.Leanback.Rows.VerticalGridView">
+ <item name="android:paddingTop">96dp</item>
+ </style>
+</resources> \ No newline at end of file
diff --git a/samples/SupportLeanbackDemos/res/values/themes.xml b/samples/SupportLeanbackDemos/res/values/themes.xml
index 121e25cca..22a41f06d 100644
--- a/samples/SupportLeanbackDemos/res/values/themes.xml
+++ b/samples/SupportLeanbackDemos/res/values/themes.xml
@@ -1,13 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014 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.Example.Leanback" parent="Theme.Leanback">
-<!-- uncomment to override default transition settings:
- <item name="android:windowEnterTransition">@android:transition/fade</item>
- <item name="android:windowExitTransition">@android:transition/fade</item>
- <item name="android:windowSharedElementExitTransition">@android:transition/move</item>
- <item name="android:windowSharedElementEnterTransition">@android:transition/move</item>
- <item name="android:windowAllowExitTransitionOverlap">true</item>
- <item name="android:windowAllowEnterTransitionOverlap">false</item>
- <item name="android:windowContentTransitions">true</item>
- -->
+ </style>
+ <style name="Theme.Example.Leanback.Browse" parent="Theme.Leanback.Browse">
+ </style>
+ <style name="Theme.Example.Leanback.Details" parent="Theme.Leanback.Details">
+ </style>
+ <style name="Theme.Example.Leanback.Rows" parent="Theme.Leanback">
+ <item name="browseTitleTextStyle">@style/Widget.Example.Leanback.Title.Text</item>
+ <item name="rowsVerticalGridStyle">@style/Widget.Example.Leanback.Rows.VerticalGridView</item>
</style>
</resources>
diff --git a/samples/SupportLeanbackDemos/src/com/example/android/leanback/BrowseAnimationFragment.java b/samples/SupportLeanbackDemos/src/com/example/android/leanback/BrowseAnimationFragment.java
index e6b92c46b..3883081c9 100644
--- a/samples/SupportLeanbackDemos/src/com/example/android/leanback/BrowseAnimationFragment.java
+++ b/samples/SupportLeanbackDemos/src/com/example/android/leanback/BrowseAnimationFragment.java
@@ -23,6 +23,7 @@ import android.support.v17.leanback.widget.OnItemClickedListener;
import android.support.v17.leanback.widget.Row;
import android.util.Log;
import android.view.View;
+import android.os.Handler;
import java.util.Random;
@@ -76,13 +77,13 @@ public class BrowseAnimationFragment extends
mRowsAdapter = new ArrayObjectAdapter(lrp);
for (int i = 0; i < NUM_ROWS; ++i) {
mRowsAdapter.add(
- createRandomRow(new HeaderItem(i, "Row " + i, null)));
+ createRandomRow(new HeaderItem(i, "Row " + i)));
}
setAdapter(mRowsAdapter);
}
Item createRandomItem() {
- switch (sRand.nextInt(13)) {
+ switch (sRand.nextInt(15)) {
default:
case 0:
return new Item("Remove Item before", new OnItemClickedListener() {
@@ -198,7 +199,7 @@ public class BrowseAnimationFragment extends
if (index >= 0) {
int headerId = sRand.nextInt();
mRowsAdapter.add(index, createRandomRow(new HeaderItem(
- headerId, "Row " + headerId, null)));
+ headerId, "Row " + headerId)));
}
}
});
@@ -211,7 +212,7 @@ public class BrowseAnimationFragment extends
int headerId = sRand.nextInt();
mRowsAdapter.add(
index + 1, createRandomRow(new HeaderItem(
- headerId, "Row " + headerId, null)));
+ headerId, "Row " + headerId)));
}
}
});
@@ -242,6 +243,35 @@ public class BrowseAnimationFragment extends
}
}
});
+ case 13:
+ return new Item("Replace Item before", new OnItemClickedListener() {
+ @Override
+ public void onItemClicked(Object item, Row row) {
+ ArrayObjectAdapter adapter = ((ArrayObjectAdapter) ((ListRow) row)
+ .getAdapter());
+ int index = adapter.indexOf(item);
+ if (index >= 0) {
+ if (index > 0)
+ index--;
+ adapter.replace(index, createRandomItem());
+ }
+ }
+ });
+ case 14:
+ return new Item("Remove all then re-add", new OnItemClickedListener() {
+ @Override
+ public void onItemClicked(Object item, Row row) {
+ final ArrayObjectAdapter adapter = ((ArrayObjectAdapter) ((ListRow) row)
+ .getAdapter());
+ adapter.clear();
+ new Handler().postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ adapter.add(0, createRandomItem());
+ }
+ }, 1000);
+ }
+ });
}
}
diff --git a/samples/SupportLeanbackDemos/src/com/example/android/leanback/BrowseErrorActivity.java b/samples/SupportLeanbackDemos/src/com/example/android/leanback/BrowseErrorActivity.java
index a35ab5ef7..f2f61925f 100644
--- a/samples/SupportLeanbackDemos/src/com/example/android/leanback/BrowseErrorActivity.java
+++ b/samples/SupportLeanbackDemos/src/com/example/android/leanback/BrowseErrorActivity.java
@@ -50,6 +50,9 @@ public class BrowseErrorActivity extends Activity
handler.postDelayed(new Runnable() {
@Override
public void run() {
+ if (getFragmentManager().isDestroyed()) {
+ return;
+ }
getFragmentManager().beginTransaction().remove(mSpinnerFragment).commit();
mErrorFragment.setErrorContent(getResources());
}
diff --git a/samples/SupportLeanbackDemos/src/com/example/android/leanback/BrowseFragment.java b/samples/SupportLeanbackDemos/src/com/example/android/leanback/BrowseFragment.java
index abf82e385..91fec5fdc 100644
--- a/samples/SupportLeanbackDemos/src/com/example/android/leanback/BrowseFragment.java
+++ b/samples/SupportLeanbackDemos/src/com/example/android/leanback/BrowseFragment.java
@@ -15,6 +15,7 @@ package com.example.android.leanback;
import android.content.Intent;
import android.os.Bundle;
+import android.os.Handler;
import android.support.v4.app.ActivityOptionsCompat;
import android.support.v17.leanback.widget.ArrayObjectAdapter;
import android.support.v17.leanback.widget.HeaderItem;
@@ -33,6 +34,7 @@ import android.view.ViewGroup;
public class BrowseFragment extends android.support.v17.leanback.app.BrowseFragment {
private static final String TAG = "leanback.BrowseFragment";
+ private static final boolean TEST_ENTRANCE_TRANSITION = true;
private static final int NUM_ROWS = 10;
private ArrayObjectAdapter mRowsAdapter;
@@ -62,6 +64,18 @@ public class BrowseFragment extends android.support.v17.leanback.app.BrowseFragm
Log.i(TAG, "onItemSelected: " + item + " row " + row);
}
});
+ if (TEST_ENTRANCE_TRANSITION) {
+ // don't run entrance transition if Activity is restored.
+ if (savedInstanceState == null) {
+ prepareEntranceTransition();
+ }
+ // simulate delay loading data
+ new Handler().postDelayed(new Runnable() {
+ public void run() {
+ startEntranceTransition();
+ }
+ }, 2000);
+ }
}
private void setupRows() {
@@ -78,14 +92,14 @@ public class BrowseFragment extends android.support.v17.leanback.app.BrowseFragm
for (int i = 0; i < NUM_ROWS; ++i) {
ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(cardPresenter);
listRowAdapter.add(new PhotoItem("Hello world", R.drawable.gallery_photo_1));
- listRowAdapter.add(new PhotoItem("This is a test", R.drawable.gallery_photo_2));
- listRowAdapter.add(new PhotoItem("Android TV", R.drawable.gallery_photo_3));
+ listRowAdapter.add(new PhotoItem("This is a test", "Only a test", R.drawable.gallery_photo_2));
+ listRowAdapter.add(new PhotoItem("Android TV", "by Google", R.drawable.gallery_photo_3));
listRowAdapter.add(new PhotoItem("Leanback", R.drawable.gallery_photo_4));
listRowAdapter.add(new PhotoItem("Hello world", R.drawable.gallery_photo_5));
- listRowAdapter.add(new PhotoItem("This is a test", R.drawable.gallery_photo_6));
- listRowAdapter.add(new PhotoItem("Android TV", R.drawable.gallery_photo_7));
- listRowAdapter.add(new PhotoItem("Leanback", R.drawable.gallery_photo_8));
- HeaderItem header = new HeaderItem(i, "Row " + i, null);
+ listRowAdapter.add(new PhotoItem("This is a test", "Only a test", R.drawable.gallery_photo_6));
+ listRowAdapter.add(new PhotoItem("Android TV", "open RowsActivity", R.drawable.gallery_photo_7));
+ listRowAdapter.add(new PhotoItem("Leanback", "open MainActivity", R.drawable.gallery_photo_8));
+ HeaderItem header = new HeaderItem(i, "Row " + i);
mRowsAdapter.add(new ListRow(header, listRowAdapter));
}
@@ -96,13 +110,25 @@ public class BrowseFragment extends android.support.v17.leanback.app.BrowseFragm
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
RowPresenter.ViewHolder rowViewHolder, Row row) {
- Intent intent = new Intent(getActivity(), DetailsActivity.class);
- intent.putExtra(DetailsActivity.EXTRA_ITEM, (PhotoItem) item);
- Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
- getActivity(),
- ((ImageCardView)itemViewHolder.view).getMainImageView(),
- DetailsActivity.SHARED_ELEMENT_NAME).toBundle();
+ Intent intent;
+ Bundle bundle;
+ if ( ((PhotoItem) item).getImageResourceId() == R.drawable.gallery_photo_8) {
+ intent = new Intent(getActivity(), MainActivity.class);
+ bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity())
+ .toBundle();
+ } else if ( ((PhotoItem) item).getImageResourceId() == R.drawable.gallery_photo_7) {
+ intent = new Intent(getActivity(), RowsActivity.class);
+ bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity())
+ .toBundle();
+ } else {
+ intent = new Intent(getActivity(), DetailsActivity.class);
+ intent.putExtra(DetailsActivity.EXTRA_ITEM, (PhotoItem) item);
+ bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
+ getActivity(),
+ ((ImageCardView)itemViewHolder.view).getMainImageView(),
+ DetailsActivity.SHARED_ELEMENT_NAME).toBundle();
+ }
getActivity().startActivity(intent, bundle);
}
}
diff --git a/samples/SupportLeanbackDemos/src/com/example/android/leanback/CardPresenter.java b/samples/SupportLeanbackDemos/src/com/example/android/leanback/CardPresenter.java
index 4c5334288..f5e486b86 100644
--- a/samples/SupportLeanbackDemos/src/com/example/android/leanback/CardPresenter.java
+++ b/samples/SupportLeanbackDemos/src/com/example/android/leanback/CardPresenter.java
@@ -17,17 +17,21 @@ import android.content.Context;
import android.graphics.drawable.Drawable;
import android.support.v17.leanback.widget.ImageCardView;
import android.support.v17.leanback.widget.Presenter;
+import android.text.TextUtils;
import android.util.Log;
import android.view.ViewGroup;
import android.view.View.MeasureSpec;
import android.view.ViewGroup.LayoutParams;
import android.widget.TextView;
+import java.util.Random;
+
public class CardPresenter extends Presenter {
private static final String TAG = "CardPresenter";
private static final int IMAGE_HEIGHT_DP = 120;
+ private static Random sRand = new Random();
private static int sRowHeight = 0;
private static int sExpandedRowHeight = 0;
@@ -62,8 +66,17 @@ public class CardPresenter extends Presenter {
ImageCardView v = new ImageCardView(parent.getContext());
v.setFocusable(true);
v.setFocusableInTouchMode(true);
- v.setMainImageAdjustViewBounds(true);
- v.setMainImageDimensions(LayoutParams.WRAP_CONTENT, getRowHeight(parent.getContext()));
+ // Randomly makes image view crop as a square or just stretch to original
+ // aspect ratio.
+ if (sRand.nextBoolean()) {
+ v.setMainImageAdjustViewBounds(false);
+ v.setMainImageDimensions(getRowHeight(parent.getContext()),
+ getRowHeight(parent.getContext()));
+ } else {
+ v.setMainImageAdjustViewBounds(true);
+ v.setMainImageDimensions(LayoutParams.WRAP_CONTENT,
+ getRowHeight(parent.getContext()));
+ }
return new ViewHolder(v);
}
@@ -75,6 +88,9 @@ public class CardPresenter extends Presenter {
.getDrawable(photoItem.getImageResourceId());
((ImageCardView) viewHolder.view).setMainImage(drawable);
((ImageCardView) viewHolder.view).setTitleText(photoItem.getTitle());
+ if (!TextUtils.isEmpty(photoItem.getContent())) {
+ ((ImageCardView) viewHolder.view).setContentText(photoItem.getContent());
+ }
}
@Override
diff --git a/samples/SupportLeanbackDemos/src/com/example/android/leanback/DetailsFragment.java b/samples/SupportLeanbackDemos/src/com/example/android/leanback/DetailsFragment.java
index 5cf086793..bc88e2109 100644
--- a/samples/SupportLeanbackDemos/src/com/example/android/leanback/DetailsFragment.java
+++ b/samples/SupportLeanbackDemos/src/com/example/android/leanback/DetailsFragment.java
@@ -16,9 +16,8 @@ package com.example.android.leanback;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
-import android.support.v4.app.ActivityCompat;
+import android.os.Handler;
import android.support.v4.app.ActivityOptionsCompat;
-import android.support.v4.view.ViewCompat;
import android.support.v17.leanback.widget.Action;
import android.support.v17.leanback.widget.ArrayObjectAdapter;
import android.support.v17.leanback.widget.ClassPresenterSelector;
@@ -35,13 +34,8 @@ import android.support.v17.leanback.widget.Presenter;
import android.support.v17.leanback.widget.Row;
import android.support.v17.leanback.widget.RowPresenter;
import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
import android.widget.Toast;
-import java.util.ArrayList;
-
public class DetailsFragment extends android.support.v17.leanback.app.DetailsFragment {
private static final String TAG = "leanback.DetailsFragment";
private static final String ITEM = "item";
@@ -49,6 +43,17 @@ public class DetailsFragment extends android.support.v17.leanback.app.DetailsFra
private static final int NUM_ROWS = 3;
private ArrayObjectAdapter mRowsAdapter;
private PhotoItem mPhotoItem;
+ final CardPresenter cardPresenter = new CardPresenter();
+
+ private static final int ACTION_BUY = 1;
+ private static final int ACTION_RENT = 2;
+ private static final int ACTION_PLAY = 3;
+
+ private static final boolean TEST_SHARED_ELEMENT_TRANSITION = true;
+ private static final boolean TEST_ENTRANCE_TRANSITION = true;
+
+ private static final long TIME_TO_LOAD_OVERVIEW_ROW_MS = 1000;
+ private static final long TIME_TO_LOAD_RELATED_ROWS_MS = 2000;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -59,8 +64,24 @@ public class DetailsFragment extends android.support.v17.leanback.app.DetailsFra
DetailsOverviewRowPresenter dorPresenter =
new DetailsOverviewRowPresenter(new DetailsDescriptionPresenter());
dorPresenter.setOnActionClickedListener(new OnActionClickedListener() {
+ @Override
public void onActionClicked(Action action) {
Toast.makeText(getActivity(), action.toString(), Toast.LENGTH_SHORT).show();
+ if (action.getId() == ACTION_BUY) {
+ DetailsOverviewRow dor = new DetailsOverviewRow(mPhotoItem.getTitle() + "(Owned)");
+ dor.setImageDrawable(getResources().getDrawable(mPhotoItem.getImageResourceId()));
+ dor.addAction(new Action(ACTION_PLAY, "Play"));
+ mRowsAdapter.replace(0, dor);
+ } else if (action.getId() == ACTION_RENT) {
+ DetailsOverviewRow dor = new DetailsOverviewRow(mPhotoItem.getTitle() + "(Rented)");
+ dor.setImageDrawable(getResources().getDrawable(mPhotoItem.getImageResourceId()));
+ dor.addAction(new Action(ACTION_PLAY, "Play"));
+ dor.addAction(new Action(ACTION_BUY, "Buy $9.99"));
+ mRowsAdapter.replace(0, dor);
+ } else if (action.getId() == ACTION_PLAY) {
+ Intent intent = new Intent(getActivity(), PlaybackOverlayActivity.class);
+ getActivity().startActivity(intent);
+ }
}
});
@@ -74,8 +95,6 @@ public class DetailsFragment extends android.support.v17.leanback.app.DetailsFra
if (item != null) {
setItem(item);
}
- dorPresenter.setSharedElementEnterTransition(getActivity(),
- DetailsActivity.SHARED_ELEMENT_NAME);
setOnItemViewClickedListener(new OnItemViewClickedListener() {
@Override
@@ -101,6 +120,17 @@ public class DetailsFragment extends android.support.v17.leanback.app.DetailsFra
Log.i(TAG, "onItemSelected: " + item + " row " + row);
}
});
+
+ if (TEST_SHARED_ELEMENT_TRANSITION) {
+ dorPresenter.setSharedElementEnterTransition(getActivity(),
+ DetailsActivity.SHARED_ELEMENT_NAME);
+ }
+ if (TEST_ENTRANCE_TRANSITION) {
+ // don't run entrance transition if Activity is restored.
+ if (savedInstanceState == null) {
+ prepareEntranceTransition();
+ }
+ }
}
@Override
@@ -113,24 +143,34 @@ public class DetailsFragment extends android.support.v17.leanback.app.DetailsFra
mPhotoItem = photoItem;
mRowsAdapter.clear();
- Resources res = getActivity().getResources();
- DetailsOverviewRow dor = new DetailsOverviewRow("Details Overview");
- dor.setImageDrawable(res.getDrawable(photoItem.getImageResourceId()));
- dor.addAction(new Action(1, "Buy $9.99"));
- dor.addAction(new Action(2, "Rent", "$3.99", res.getDrawable(R.drawable.ic_action_a)));
- mRowsAdapter.add(dor);
-
- final CardPresenter cardPresenter = new CardPresenter();
- for (int i = 0; i < NUM_ROWS; ++i) {
- ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(cardPresenter);
- listRowAdapter.add(new PhotoItem("Hello world", R.drawable.gallery_photo_1));
- listRowAdapter.add(new PhotoItem("This is a test", R.drawable.gallery_photo_2));
- listRowAdapter.add(new PhotoItem("Android TV", R.drawable.gallery_photo_3));
- listRowAdapter.add(new PhotoItem("Leanback", R.drawable.gallery_photo_4));
- HeaderItem header = new HeaderItem(i, "Row " + i, null);
- mRowsAdapter.add(new ListRow(header, listRowAdapter));
- }
-
+ new Handler().postDelayed(new Runnable() {
+ public void run() {
+ Resources res = getActivity().getResources();
+ DetailsOverviewRow dor = new DetailsOverviewRow(mPhotoItem.getTitle());
+ dor.setImageDrawable(res.getDrawable(mPhotoItem.getImageResourceId()));
+ dor.addAction(new Action(ACTION_BUY, "Buy $9.99"));
+ dor.addAction(new Action(ACTION_RENT, "Rent", "$3.99", res.getDrawable(R.drawable.ic_action_a)));
+ mRowsAdapter.add(0, dor);
+ setSelectedPosition(0, false);
+ }
+ }, TIME_TO_LOAD_OVERVIEW_ROW_MS);
+
+ new Handler().postDelayed(new Runnable() {
+ public void run() {
+ for (int i = 0; i < NUM_ROWS; ++i) {
+ ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(cardPresenter);
+ listRowAdapter.add(new PhotoItem("Hello world", R.drawable.gallery_photo_1));
+ listRowAdapter.add(new PhotoItem("This is a test", R.drawable.gallery_photo_2));
+ listRowAdapter.add(new PhotoItem("Android TV", R.drawable.gallery_photo_3));
+ listRowAdapter.add(new PhotoItem("Leanback", R.drawable.gallery_photo_4));
+ HeaderItem header = new HeaderItem(i, "Row " + i);
+ mRowsAdapter.add(new ListRow(header, listRowAdapter));
+ }
+ if (TEST_ENTRANCE_TRANSITION) {
+ startEntranceTransition();
+ }
+ }
+ }, TIME_TO_LOAD_RELATED_ROWS_MS);
setAdapter(mRowsAdapter);
}
diff --git a/samples/SupportLeanbackDemos/src/com/example/android/leanback/HorizontalGridTestActivity.java b/samples/SupportLeanbackDemos/src/com/example/android/leanback/HorizontalGridTestActivity.java
new file mode 100644
index 000000000..59155afdf
--- /dev/null
+++ b/samples/SupportLeanbackDemos/src/com/example/android/leanback/HorizontalGridTestActivity.java
@@ -0,0 +1,172 @@
+/*
+ * 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.leanback;
+
+import android.support.v7.widget.RecyclerView;
+import android.support.v17.leanback.widget.HorizontalGridView;
+import android.support.v17.leanback.widget.OnChildSelectedListener;
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.graphics.BitmapFactory;
+import android.graphics.Color;
+import android.graphics.drawable.ColorDrawable;
+import android.graphics.drawable.Drawable;
+import android.net.Uri;
+import android.os.Bundle;
+import android.util.Log;
+import android.util.SparseArray;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.View.OnFocusChangeListener;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import java.io.File;
+
+public class HorizontalGridTestActivity extends Activity {
+ private static final String TAG = "HorizontalGridTestActivity";
+ private static final boolean DEBUG = true;
+ private static final String SELECT_ACTION = "android.test.leanback.widget.SELECT";
+ private static final int NUM_ITEMS = 100;
+ private static final boolean STAGGERED = true;
+
+ private HorizontalGridView mHorizontalGridView;
+ private int mScrollState = RecyclerView.SCROLL_STATE_IDLE;
+
+ private RecyclerView.OnScrollListener mScrollListener = new RecyclerView.OnScrollListener() {
+ @Override
+ public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
+ if (DEBUG) {
+ final String[] stateNames = { "IDLE", "DRAGGING", "SETTLING" };
+ Log.v(TAG, "onScrollStateChanged "
+ + (newState < stateNames.length ? stateNames[newState] : newState));
+ }
+ mScrollState = newState;
+ }
+ };
+
+ private View createView() {
+ View view = getLayoutInflater().inflate(R.layout.horizontal_grid, null, false);
+ mHorizontalGridView = (HorizontalGridView) view.findViewById(R.id.gridview);
+
+ mHorizontalGridView.setWindowAlignment(HorizontalGridView.WINDOW_ALIGN_BOTH_EDGE);
+ mHorizontalGridView.setWindowAlignmentOffsetPercent(35);
+ mHorizontalGridView.setOnChildSelectedListener(new OnChildSelectedListener() {
+ @Override
+ public void onChildSelected(ViewGroup parent, View view, int position, long id) {
+ if (DEBUG) Log.d(TAG, "onChildSelected position=" + position + " id="+id);
+ }
+ });
+ return view;
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ if (DEBUG) Log.v(TAG, "onCreate");
+
+ RecyclerView.Adapter adapter = new MyAdapter();
+
+ View view = createView();
+
+ mHorizontalGridView.setAdapter(new MyAdapter());
+ setContentView(view);
+
+ mHorizontalGridView.setOnScrollListener(mScrollListener);
+ }
+
+ @Override
+ protected void onNewIntent(Intent intent) {
+ if (DEBUG) Log.v(TAG, "onNewIntent " + intent);
+ if (intent.getAction().equals(SELECT_ACTION)) {
+ int position = intent.getIntExtra("SELECT_POSITION", -1);
+ if (position >= 0) {
+ mHorizontalGridView.setSelectedPosition(position);
+ }
+ }
+ super.onNewIntent(intent);
+ }
+
+ private OnFocusChangeListener mItemFocusChangeListener = new OnFocusChangeListener() {
+
+ @Override
+ public void onFocusChange(View v, boolean hasFocus) {
+ if (hasFocus) {
+ v.setBackgroundColor(Color.YELLOW);
+ } else {
+ v.setBackgroundColor(Color.LTGRAY);
+ }
+ }
+ };
+
+ private OnClickListener mItemClickListener = new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ mHorizontalGridView.getAdapter().notifyDataSetChanged();
+ }
+ };
+
+ class MyAdapter extends RecyclerView.Adapter {
+
+ private int[] mItemLengths;
+
+ MyAdapter() {
+ mItemLengths = new int[NUM_ITEMS];
+ for (int i = 0; i < mItemLengths.length; i++) {
+ mItemLengths[i] = STAGGERED ? (int)(Math.random() * 180) + 180 : 240;
+ }
+ }
+
+ @Override
+ public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
+ if (DEBUG) Log.v(TAG, "createViewHolder " + viewType);
+ TextView textView = new TextView(parent.getContext());
+ textView.setTextColor(Color.BLACK);
+ textView.setFocusable(true);
+ textView.setFocusableInTouchMode(true);
+ textView.setOnFocusChangeListener(mItemFocusChangeListener);
+ textView.setOnClickListener(mItemClickListener);
+ return new ViewHolder(textView);
+ }
+
+ @Override
+ public void onBindViewHolder(RecyclerView.ViewHolder baseHolder, int position) {
+ if (DEBUG) Log.v(TAG, "bindViewHolder " + position + " " + baseHolder);
+ ViewHolder holder = (ViewHolder) baseHolder;
+ ((TextView) holder.itemView).setText("Item "+position);
+ holder.itemView.setBackgroundColor(Color.LTGRAY);
+ holder.itemView.setLayoutParams(new ViewGroup.MarginLayoutParams(mItemLengths[position],
+ 80));
+ }
+
+ @Override
+ public int getItemCount() {
+ return mItemLengths.length;
+ }
+ }
+
+ static class ViewHolder extends RecyclerView.ViewHolder {
+
+ public ViewHolder(View v) {
+ super(v);
+ }
+ }
+}
diff --git a/samples/SupportLeanbackDemos/src/com/example/android/leanback/PhotoItem.java b/samples/SupportLeanbackDemos/src/com/example/android/leanback/PhotoItem.java
index be3c8a6b1..adde7d350 100644
--- a/samples/SupportLeanbackDemos/src/com/example/android/leanback/PhotoItem.java
+++ b/samples/SupportLeanbackDemos/src/com/example/android/leanback/PhotoItem.java
@@ -19,10 +19,16 @@ import android.os.Parcelable;
public class PhotoItem implements Parcelable {
private String mTitle;
+ private String mContent;
private int mImageResourceId;
public PhotoItem(String title, int imageResourceId) {
+ this(title, null, imageResourceId);
+ }
+
+ public PhotoItem(String title, String content, int imageResourceId) {
mTitle = title;
+ mContent = content;
mImageResourceId = imageResourceId;
}
@@ -34,6 +40,10 @@ public class PhotoItem implements Parcelable {
return mTitle;
}
+ public String getContent() {
+ return mContent;
+ }
+
@Override
public String toString() {
return mTitle;
diff --git a/samples/SupportLeanbackDemos/src/com/example/android/leanback/PlaybackOverlayFragment.java b/samples/SupportLeanbackDemos/src/com/example/android/leanback/PlaybackOverlayFragment.java
index ed3d64f10..c37ca204e 100644
--- a/samples/SupportLeanbackDemos/src/com/example/android/leanback/PlaybackOverlayFragment.java
+++ b/samples/SupportLeanbackDemos/src/com/example/android/leanback/PlaybackOverlayFragment.java
@@ -13,299 +13,395 @@
*/
package com.example.android.leanback;
-import java.util.ArrayList;
-
import android.content.Context;
-import android.content.res.Resources;
import android.graphics.drawable.Drawable;
+import android.media.session.MediaController;
+import android.media.session.MediaSessionManager;
+import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
+import android.os.RemoteException;
+import android.support.v17.leanback.app.MediaControllerGlue;
+import android.support.v17.leanback.app.PlaybackControlGlue;
import android.support.v17.leanback.widget.Action;
import android.support.v17.leanback.widget.ArrayObjectAdapter;
-import android.support.v17.leanback.widget.ClassPresenterSelector;
-import android.support.v17.leanback.widget.AbstractDetailsDescriptionPresenter;
import android.support.v17.leanback.widget.PlaybackControlsRow;
-import android.support.v17.leanback.widget.PlaybackControlsRow.PlayPauseAction;
import android.support.v17.leanback.widget.PlaybackControlsRow.RepeatAction;
import android.support.v17.leanback.widget.PlaybackControlsRow.ThumbsUpAction;
import android.support.v17.leanback.widget.PlaybackControlsRow.ThumbsDownAction;
-import android.support.v17.leanback.widget.PlaybackControlsRow.ShuffleAction;
-import android.support.v17.leanback.widget.PlaybackControlsRow.SkipNextAction;
-import android.support.v17.leanback.widget.PlaybackControlsRow.SkipPreviousAction;
import android.support.v17.leanback.widget.PlaybackControlsRowPresenter;
import android.support.v17.leanback.widget.HeaderItem;
-import android.support.v17.leanback.widget.VerticalGridView;
+import android.support.v17.leanback.widget.PresenterSelector;
import android.support.v17.leanback.widget.Row;
import android.support.v17.leanback.widget.ListRow;
import android.support.v17.leanback.widget.Presenter;
import android.support.v17.leanback.widget.RowPresenter;
import android.support.v17.leanback.widget.ListRowPresenter;
-import android.support.v17.leanback.widget.OnActionClickedListener;
import android.support.v17.leanback.widget.OnItemViewSelectedListener;
import android.support.v17.leanback.widget.OnItemViewClickedListener;
import android.support.v17.leanback.widget.ControlButtonPresenterSelector;
+import android.support.v17.leanback.widget.SparseArrayObjectAdapter;
+import android.support.v4.media.session.MediaControllerCompat;
+import android.support.v4.media.session.MediaSessionCompat;
import android.util.Log;
import android.widget.Toast;
+import java.util.List;
+
public class PlaybackOverlayFragment extends android.support.v17.leanback.app.PlaybackOverlayFragment {
private static final String TAG = "leanback.PlaybackControlsFragment";
- private static final boolean SHOW_DETAIL = true;
- private static final boolean HIDE_MORE_ACTIONS = false;
- private static final int PRIMARY_CONTROLS = 5;
- private static final boolean SHOW_IMAGE = PRIMARY_CONTROLS <= 5;
+ /**
+ * Change this to choose a different overlay background.
+ */
private static final int BACKGROUND_TYPE = PlaybackOverlayFragment.BG_LIGHT;
- private static final int MORE_ROWS = 3;
- private ArrayObjectAdapter mRowsAdapter;
- private ArrayObjectAdapter mPrimaryActionsAdapter;
- private ArrayObjectAdapter mSecondaryActionsAdapter;
- private PlayPauseAction mPlayPauseAction;
+ /**
+ * Change the number of related content rows.
+ */
+ private static final int RELATED_CONTENT_ROWS = 3;
+
+ /**
+ * Change the location of the thumbs up/down controls
+ */
+ private static final boolean THUMBS_PRIMARY = true;
+
+ /**
+ * Change this to select hidden
+ */
+ private static final boolean SECONDARY_HIDDEN = false;
+
+ private static final String FAUX_TITLE = "A short song of silence";
+ private static final String FAUX_SUBTITLE = "2014";
+ private static final int FAUX_DURATION = 33 * 1000;
+
+ private static final int ROW_CONTROLS = 0;
+
+ private PlaybackControlGlue mGlue;
+ private PlaybackControlsRowPresenter mPlaybackControlsRowPresenter;
+ private ListRowPresenter mListRowPresenter;
+
private RepeatAction mRepeatAction;
private ThumbsUpAction mThumbsUpAction;
private ThumbsDownAction mThumbsDownAction;
- private ShuffleAction mShuffleAction;
- private SkipNextAction mSkipNextAction;
- private SkipPreviousAction mSkipPreviousAction;
- private PlaybackControlsRow mPlaybackControlsRow;
- private ArrayList<MediaItem> mItems = new ArrayList<MediaItem>();
- private int mCurrentItem;
private Handler mHandler;
- private Runnable mRunnable;
+
+ // These should match the playback service FF behavior
+ private int[] mFastForwardSpeeds = { 2, 3, 4, 5 };
+
+ private OnItemViewClickedListener mOnItemViewClickedListener = new OnItemViewClickedListener() {
+ @Override
+ public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
+ RowPresenter.ViewHolder rowViewHolder, Row row) {
+ if (item instanceof Action) {
+ onActionClicked((Action) item);
+ }
+ }
+ };
+
+ private OnItemViewSelectedListener mOnItemViewSelectedListener = new OnItemViewSelectedListener() {
+ @Override
+ public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item,
+ RowPresenter.ViewHolder rowViewHolder, Row row) {
+ Log.i(TAG, "onItemSelected: " + item + " row " + row);
+ }
+ };
+
+ final Runnable mUpdateProgressRunnable = new Runnable() {
+ @Override
+ public void run() {
+ mGlue.updateProgress();
+ mHandler.postDelayed(this, mGlue.getUpdatePeriod());
+ }
+ };
+
+ public SparseArrayObjectAdapter getAdapter() {
+ return (SparseArrayObjectAdapter) super.getAdapter();
+ }
@Override
public void onCreate(Bundle savedInstanceState) {
Log.i(TAG, "onCreate");
super.onCreate(savedInstanceState);
+ setBackgroundType(BACKGROUND_TYPE);
+ setOnItemViewSelectedListener(mOnItemViewSelectedListener);
+
+ createComponents(getActivity());
+ }
+
+ private void createComponents(Context context) {
mHandler = new Handler();
+ mThumbsUpAction = new PlaybackControlsRow.ThumbsUpAction(context);
+ mThumbsUpAction.setIndex(ThumbsUpAction.OUTLINE);
+ mThumbsDownAction = new PlaybackControlsRow.ThumbsDownAction(context);
+ mThumbsDownAction.setIndex(ThumbsDownAction.OUTLINE);
+ mRepeatAction = new PlaybackControlsRow.RepeatAction(context);
+
+ mGlue = new PlaybackControlGlue(context, this, mFastForwardSpeeds) {
+ private boolean mIsPlaying;
+ private int mSpeed = PlaybackControlGlue.PLAYBACK_SPEED_PAUSED;
+ private long mStartTime;
+ private long mStartPosition = 0;
- setBackgroundType(BACKGROUND_TYPE);
- setFadingEnabled(false);
+ @Override
+ protected SparseArrayObjectAdapter createPrimaryActionsAdapter(
+ PresenterSelector presenterSelector) {
+ return PlaybackOverlayFragment.this.createPrimaryActionsAdapter(
+ presenterSelector);
+ }
- setupRows();
+ @Override
+ public boolean hasValidMedia() {
+ return true;
+ }
- setOnItemViewSelectedListener(new OnItemViewSelectedListener() {
@Override
- public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item,
- RowPresenter.ViewHolder rowViewHolder, Row row) {
- Log.i(TAG, "onItemSelected: " + item + " row " + row);
+ public boolean isMediaPlaying() {
+ return mIsPlaying;
}
- });
- setOnItemViewClickedListener(new OnItemViewClickedListener() {
+
@Override
- public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
- RowPresenter.ViewHolder rowViewHolder, Row row) {
- Log.i(TAG, "onItemClicked: " + item + " row " + row);
+ public CharSequence getMediaTitle() {
+ return FAUX_TITLE;
}
- });
- }
+ @Override
+ public CharSequence getMediaSubtitle() {
+ return FAUX_SUBTITLE;
+ }
+
+ @Override
+ public int getMediaDuration() {
+ return FAUX_DURATION;
+ }
- private void setupRows() {
- ClassPresenterSelector ps = new ClassPresenterSelector();
+ @Override
+ public Drawable getMediaArt() {
+ return null;
+ }
- PlaybackControlsRowPresenter playbackControlsRowPresenter;
- if (SHOW_DETAIL) {
- playbackControlsRowPresenter = new PlaybackControlsRowPresenter(
- new DescriptionPresenter());
- } else {
- playbackControlsRowPresenter = new PlaybackControlsRowPresenter();
- }
- playbackControlsRowPresenter.setOnActionClickedListener(new OnActionClickedListener() {
- public void onActionClicked(Action action) {
- if (action.getId() == mPlayPauseAction.getId()) {
- if (mPlayPauseAction.getIndex() == PlayPauseAction.PLAY) {
- startProgressAutomation();
- setFadingEnabled(true);
- } else {
- stopProgressAutomation();
- setFadingEnabled(false);
+ @Override
+ public long getSupportedActions() {
+ return PlaybackControlGlue.ACTION_PLAY_PAUSE |
+ PlaybackControlGlue.ACTION_FAST_FORWARD |
+ PlaybackControlGlue.ACTION_REWIND;
+ }
+
+ @Override
+ public int getCurrentSpeedId() {
+ return mSpeed;
+ }
+
+ @Override
+ public int getCurrentPosition() {
+ int speed;
+ if (mSpeed == PlaybackControlGlue.PLAYBACK_SPEED_PAUSED) {
+ speed = 0;
+ } else if (mSpeed == PlaybackControlGlue.PLAYBACK_SPEED_NORMAL) {
+ speed = 1;
+ } else if (mSpeed >= PlaybackControlGlue.PLAYBACK_SPEED_FAST_L0) {
+ int index = mSpeed - PlaybackControlGlue.PLAYBACK_SPEED_FAST_L0;
+ speed = getFastForwardSpeeds()[index];
+ } else if (mSpeed <= -PlaybackControlGlue.PLAYBACK_SPEED_FAST_L0) {
+ int index = -mSpeed - PlaybackControlGlue.PLAYBACK_SPEED_FAST_L0;
+ speed = -getRewindSpeeds()[index];
+ } else {
+ return -1;
+ }
+ long position = mStartPosition +
+ (System.currentTimeMillis() - mStartTime) * speed;
+ if (position > getMediaDuration()) {
+ position = getMediaDuration();
+ onPlaybackComplete(true);
+ } else if (position < 0) {
+ position = 0;
+ onPlaybackComplete(false);
+ }
+ return (int) position;
+ }
+
+ void onPlaybackComplete(final boolean ended) {
+ mHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ if (mRepeatAction.getIndex() == RepeatAction.NONE) {
+ pausePlayback();
+ } else {
+ startPlayback(PlaybackControlGlue.PLAYBACK_SPEED_NORMAL);
+ }
+ mStartPosition = 0;
+ onStateChanged();
}
- } else if (action.getId() == mSkipNextAction.getId()) {
- next();
- } else if (action.getId() == mSkipPreviousAction.getId()) {
- Toast.makeText(getActivity(), "TODO", Toast.LENGTH_SHORT).show();
+ });
+ }
+
+ @Override
+ protected void startPlayback(int speed) {
+ if (speed == mSpeed) {
+ return;
}
- if (action instanceof PlaybackControlsRow.MultiAction) {
- ((PlaybackControlsRow.MultiAction) action).nextIndex();
- notifyChanged(action);
+ mStartPosition = getCurrentPosition();
+ mSpeed = speed;
+ mIsPlaying = true;
+ mStartTime = System.currentTimeMillis();
+ }
+
+ @Override
+ protected void pausePlayback() {
+ if (mSpeed == PlaybackControlGlue.PLAYBACK_SPEED_PAUSED) {
+ return;
}
+ mStartPosition = getCurrentPosition();
+ mSpeed = PlaybackControlGlue.PLAYBACK_SPEED_PAUSED;
+ mIsPlaying = false;
}
- });
- playbackControlsRowPresenter.setSecondaryActionsHidden(HIDE_MORE_ACTIONS);
- ps.addClassPresenter(PlaybackControlsRow.class, playbackControlsRowPresenter);
- ps.addClassPresenter(ListRow.class, new ListRowPresenter());
- mRowsAdapter = new ArrayObjectAdapter(ps);
+ @Override
+ protected void skipToNext() {
+ // Not supported
+ }
- addPlaybackControlsRow();
- addOtherRows();
+ @Override
+ protected void skipToPrevious() {
+ // Not supported
+ }
- setAdapter(mRowsAdapter);
- }
+ @Override
+ protected void onRowChanged(PlaybackControlsRow row) {
+ PlaybackOverlayFragment.this.onRowChanged(row);
+ }
- private void addPlaybackControlsRow() {
- Context context = getActivity();
+ @Override
+ public void enableProgressUpdating(boolean enable) {
+ PlaybackOverlayFragment.this.enableProgressUpdating(enable);
+ }
- if (SHOW_DETAIL) {
- mPlaybackControlsRow = new PlaybackControlsRow(new MediaItem());
- } else {
- mPlaybackControlsRow = new PlaybackControlsRow();
- }
- mRowsAdapter.add(mPlaybackControlsRow);
-
- mItems = new ArrayList<MediaItem>();
- mItems.add(new MediaItem("Awesome Tune", "The More Awesome Band", R.drawable.details_img, 15*1000));
- mItems.add(new MediaItem("Pretty nice Tune", "The Nice Guys", R.drawable.details_img, 10*1000));
- mCurrentItem = 1;
- updatePlaybackRow(mCurrentItem);
-
- ControlButtonPresenterSelector presenterSelector = new ControlButtonPresenterSelector();
- mPrimaryActionsAdapter = new ArrayObjectAdapter(presenterSelector);
- mSecondaryActionsAdapter = new ArrayObjectAdapter(presenterSelector);
- mPlaybackControlsRow.setPrimaryActionsAdapter(mPrimaryActionsAdapter);
- mPlaybackControlsRow.setSecondaryActionsAdapter(mSecondaryActionsAdapter);
-
- mPlayPauseAction = new PlayPauseAction(context);
- mRepeatAction = new RepeatAction(context);
- mThumbsUpAction = new ThumbsUpAction(context);
- mThumbsDownAction = new ThumbsDownAction(context);
- mShuffleAction = new ShuffleAction(context);
- mSkipNextAction = new PlaybackControlsRow.SkipNextAction(context);
- mSkipPreviousAction = new PlaybackControlsRow.SkipPreviousAction(context);
-
- if (PRIMARY_CONTROLS > 5) {
- mPrimaryActionsAdapter.add(mThumbsUpAction);
- } else {
- mSecondaryActionsAdapter.add(mThumbsUpAction);
- }
- mPrimaryActionsAdapter.add(mSkipPreviousAction);
- if (PRIMARY_CONTROLS > 3) {
- mPrimaryActionsAdapter.add(new PlaybackControlsRow.RewindAction(context));
+ @Override
+ public int getUpdatePeriod() {
+ return PlaybackOverlayFragment.this.getUpdatePeriod();
+ }
+ };
+
+ mGlue.setOnItemViewClickedListener(mOnItemViewClickedListener);
+
+ mPlaybackControlsRowPresenter = mGlue.createControlsRowAndPresenter();
+ mPlaybackControlsRowPresenter.setSecondaryActionsHidden(SECONDARY_HIDDEN);
+ mListRowPresenter = new ListRowPresenter();
+
+ setAdapter(new SparseArrayObjectAdapter(new PresenterSelector() {
+ @Override
+ public Presenter getPresenter(Object object) {
+ if (object instanceof PlaybackControlsRow) {
+ return mPlaybackControlsRowPresenter;
+ } else if (object instanceof ListRow) {
+ return mListRowPresenter;
+ }
+ throw new IllegalArgumentException("Unhandled object: " + object);
+ }
+ }));
+
+ // Set secondary control actions
+ PlaybackControlsRow controlsRow = mGlue.getControlsRow();
+ ArrayObjectAdapter adapter = new ArrayObjectAdapter(new ControlButtonPresenterSelector());
+ controlsRow.setSecondaryActionsAdapter(adapter);
+ if (!THUMBS_PRIMARY) {
+ adapter.add(mThumbsDownAction);
}
- mPrimaryActionsAdapter.add(mPlayPauseAction);
- if (PRIMARY_CONTROLS > 3) {
- mPrimaryActionsAdapter.add(new PlaybackControlsRow.FastForwardAction(context));
+ adapter.add(mRepeatAction);
+ if (!THUMBS_PRIMARY) {
+ adapter.add(mThumbsUpAction);
}
- mPrimaryActionsAdapter.add(mSkipNextAction);
- mSecondaryActionsAdapter.add(mRepeatAction);
- mSecondaryActionsAdapter.add(mShuffleAction);
- if (PRIMARY_CONTROLS > 5) {
- mPrimaryActionsAdapter.add(mThumbsDownAction);
- } else {
- mSecondaryActionsAdapter.add(mThumbsDownAction);
+ // Add the controls row
+ getAdapter().set(ROW_CONTROLS, controlsRow);
+
+ // Add related content rows
+ for (int i = 0; i < RELATED_CONTENT_ROWS; ++i) {
+ ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new StringPresenter());
+ listRowAdapter.add("Some related content");
+ listRowAdapter.add("Other related content");
+ HeaderItem header = new HeaderItem(i, "Row " + i);
+ getAdapter().set(ROW_CONTROLS + 1 + i, new ListRow(header, listRowAdapter));
}
- mSecondaryActionsAdapter.add(new PlaybackControlsRow.HighQualityAction(context));
- mSecondaryActionsAdapter.add(new PlaybackControlsRow.ClosedCaptioningAction(context));
}
- private void notifyChanged(Action action) {
- ArrayObjectAdapter adapter = mPrimaryActionsAdapter;
- if (adapter.indexOf(action) >= 0) {
- adapter.notifyArrayItemRangeChanged(adapter.indexOf(action), 1);
- return;
- }
- adapter = mSecondaryActionsAdapter;
- if (adapter.indexOf(action) >= 0) {
- adapter.notifyArrayItemRangeChanged(adapter.indexOf(action), 1);
- return;
+ private SparseArrayObjectAdapter createPrimaryActionsAdapter(
+ PresenterSelector presenterSelector) {
+ SparseArrayObjectAdapter adapter = new SparseArrayObjectAdapter(presenterSelector);
+ if (THUMBS_PRIMARY) {
+ adapter.set(PlaybackControlGlue.ACTION_CUSTOM_LEFT_FIRST, mThumbsUpAction);
+ adapter.set(PlaybackControlGlue.ACTION_CUSTOM_RIGHT_FIRST, mThumbsDownAction);
}
+ return adapter;
}
- private void updatePlaybackRow(int index) {
- if (mPlaybackControlsRow.getItem() != null) {
- MediaItem item = (MediaItem) mPlaybackControlsRow.getItem();
- item.title = mItems.get(index).title;
- item.subtitle = mItems.get(index).subtitle;
+ private void onRowChanged(PlaybackControlsRow row) {
+ if (getAdapter() == null) {
+ return;
}
- if (SHOW_IMAGE) {
- mPlaybackControlsRow.setImageDrawable(getResources().getDrawable(
- mItems.get(mCurrentItem).imageResId));
+ int index = getAdapter().indexOf(row);
+ if (index >= 0) {
+ getAdapter().notifyArrayItemRangeChanged(index, 1);
}
- mRowsAdapter.notifyArrayItemRangeChanged(0, 1);
-
- mPlaybackControlsRow.setTotalTime(mItems.get(mCurrentItem).durationMs);
- mPlaybackControlsRow.setCurrentTime(0);
- mPlaybackControlsRow.setBufferedProgress(75 * 1000);
}
- private void addOtherRows() {
- for (int i = 0; i < MORE_ROWS; ++i) {
- ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new StringPresenter());
- listRowAdapter.add("Some related content");
- listRowAdapter.add("Other related content");
- HeaderItem header = new HeaderItem(i, "Row " + i, null);
- mRowsAdapter.add(new ListRow(header, listRowAdapter));
+ private void enableProgressUpdating(boolean enable) {
+ Log.v(TAG, "enableProgressUpdating " + enable + " this " + this);
+ mHandler.removeCallbacks(mUpdateProgressRunnable);
+ if (enable) {
+ mUpdateProgressRunnable.run();
}
}
private int getUpdatePeriod() {
- if (getView() == null || mPlaybackControlsRow.getTotalTime() <= 0) {
+ int totalTime = mGlue.getControlsRow().getTotalTime();
+ if (getView() == null || totalTime <= 0) {
return 1000;
}
- return Math.max(16, mPlaybackControlsRow.getTotalTime() / getView().getWidth());
+ return Math.max(16, totalTime / getView().getWidth());
}
- private void startProgressAutomation() {
- mRunnable = new Runnable() {
- @Override
- public void run() {
- int updatePeriod = getUpdatePeriod();
- int currentTime = mPlaybackControlsRow.getCurrentTime() + updatePeriod;
- int totalTime = mPlaybackControlsRow.getTotalTime();
- mPlaybackControlsRow.setCurrentTime(currentTime);
- if (totalTime > 0 && totalTime <= currentTime) {
- next();
- }
- mHandler.postDelayed(this, updatePeriod);
- }
- };
- mHandler.postDelayed(mRunnable, getUpdatePeriod());
- }
-
- private void next() {
- if (++mCurrentItem >= mItems.size()) {
- mCurrentItem = 0;
+ private void onActionClicked(Action action) {
+ Log.v(TAG, "onActionClicked " + action);
+ Toast.makeText(getActivity(), action.toString(), Toast.LENGTH_SHORT).show();
+ if (action instanceof PlaybackControlsRow.MultiAction) {
+ PlaybackControlsRow.MultiAction multiAction = (PlaybackControlsRow.MultiAction) action;
+ multiAction.nextIndex();
+ notifyActionChanged(multiAction);
}
- updatePlaybackRow(mCurrentItem);
}
- private void stopProgressAutomation() {
- if (mHandler != null && mRunnable != null) {
- mHandler.removeCallbacks(mRunnable);
- }
+ private SparseArrayObjectAdapter getPrimaryActionsAdapter() {
+ return (SparseArrayObjectAdapter) mGlue.getControlsRow().getPrimaryActionsAdapter();
}
- @Override
- public void onStop() {
- stopProgressAutomation();
- super.onStop();
+ private ArrayObjectAdapter getSecondaryActionsAdapter() {
+ return (ArrayObjectAdapter) mGlue.getControlsRow().getSecondaryActionsAdapter();
}
- static class MediaItem {
- String title;
- String subtitle;
- int imageResId;
- int durationMs;
-
- MediaItem() {
+ private void notifyActionChanged(PlaybackControlsRow.MultiAction action) {
+ int index;
+ index = getPrimaryActionsAdapter().indexOf(action);
+ if (index >= 0) {
+ getPrimaryActionsAdapter().notifyArrayItemRangeChanged(index, 1);
+ } else {
+ index = getSecondaryActionsAdapter().indexOf(action);
+ if (index >= 0) {
+ getSecondaryActionsAdapter().notifyArrayItemRangeChanged(index, 1);
+ }
}
+ }
- MediaItem(String title, String subtitle, int imageResId, int durationMs) {
- this.title = title;
- this.subtitle = subtitle;
- this.imageResId = imageResId;
- this.durationMs = durationMs;
- }
+ @Override
+ public void onStart() {
+ super.onStart();
+ mGlue.enableProgressUpdating(mGlue.hasValidMedia() && mGlue.isMediaPlaying());
}
- static class DescriptionPresenter extends AbstractDetailsDescriptionPresenter {
- @Override
- protected void onBindDescription(ViewHolder vh, Object item) {
- vh.getTitle().setText(((MediaItem) item).title);
- vh.getSubtitle().setText(((MediaItem) item).subtitle);
- }
+ @Override
+ public void onStop() {
+ mGlue.enableProgressUpdating(false);
+ super.onStop();
}
}
diff --git a/samples/SupportLeanbackDemos/src/com/example/android/leanback/RowsActivity.java b/samples/SupportLeanbackDemos/src/com/example/android/leanback/RowsActivity.java
new file mode 100644
index 000000000..133e99506
--- /dev/null
+++ b/samples/SupportLeanbackDemos/src/com/example/android/leanback/RowsActivity.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2014 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.leanback;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.support.v17.leanback.R;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+public class RowsActivity extends Activity implements RowsFragment.OnRowsFirstLineSelectedListener
+{
+ TextView mTitleView;
+ /** Called when the activity is first created. */
+ @Override
+ public void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.rows);
+ mTitleView = (TextView) findViewById(R.id.rows_title);
+ }
+
+ @Override
+ public void onSelectedFirstRow(boolean firstRow) {
+ mTitleView.setVisibility(firstRow ? View.VISIBLE : View.INVISIBLE);
+ }
+}
diff --git a/samples/SupportLeanbackDemos/src/com/example/android/leanback/RowsFragment.java b/samples/SupportLeanbackDemos/src/com/example/android/leanback/RowsFragment.java
new file mode 100644
index 000000000..2509bfc01
--- /dev/null
+++ b/samples/SupportLeanbackDemos/src/com/example/android/leanback/RowsFragment.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) 2014 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.leanback;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.v4.app.ActivityOptionsCompat;
+import android.support.v17.leanback.R;
+import android.support.v17.leanback.widget.ArrayObjectAdapter;
+import android.support.v17.leanback.widget.HeaderItem;
+import android.support.v17.leanback.widget.ImageCardView;
+import android.support.v17.leanback.widget.ListRow;
+import android.support.v17.leanback.widget.ListRowPresenter;
+import android.support.v17.leanback.widget.OnItemViewClickedListener;
+import android.support.v17.leanback.widget.OnItemViewSelectedListener;
+import android.support.v17.leanback.widget.Presenter;
+import android.support.v17.leanback.widget.Row;
+import android.support.v17.leanback.widget.RowPresenter;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+public class RowsFragment extends android.support.v17.leanback.app.RowsFragment {
+
+ public static interface OnRowsFirstLineSelectedListener {
+ void onSelectedFirstRow(boolean firstRow);
+ }
+
+ private static final String TAG = "leanback.RowsFragment";
+
+ private static final int NUM_ROWS = 10;
+ private ArrayObjectAdapter mRowsAdapter;
+ private OnRowsFirstLineSelectedListener mCallback;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ Log.i(TAG, "onCreate");
+ super.onCreate(savedInstanceState);
+
+ setupRows();
+ setOnItemViewClickedListener(new ItemViewClickedListener());
+ setOnItemViewSelectedListener(new OnItemViewSelectedListener() {
+ @Override
+ public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item,
+ RowPresenter.ViewHolder rowViewHolder, Row row) {
+ Log.i(TAG, "onItemSelected: " + item + " row " + row);
+ if (mCallback == null) {
+ return;
+ }
+ if (mRowsAdapter != null && mRowsAdapter.size() > 0 && row != null &&
+ row != mRowsAdapter.get(0)) {
+ mCallback.onSelectedFirstRow(false);
+ } else {
+ mCallback.onSelectedFirstRow(true);
+ }
+ }
+ });
+ }
+
+ @Override
+ public void onAttach(Activity activity) {
+ super.onAttach(activity);
+ // This makes sure that the container activity has implemented
+ if (activity instanceof OnRowsFirstLineSelectedListener) {
+ mCallback = (OnRowsFirstLineSelectedListener) activity;
+ }
+ }
+
+ private void setupRows() {
+ ListRowPresenter lrp = new ListRowPresenter();
+ lrp.setRowHeight(CardPresenter.getRowHeight(getActivity()));
+ lrp.setExpandedRowHeight(CardPresenter.getExpandedRowHeight(getActivity()));
+
+ mRowsAdapter = new ArrayObjectAdapter(lrp);
+
+ // For good performance, it's important to use a single instance of
+ // a card presenter for all rows using that presenter.
+ final CardPresenter cardPresenter = new CardPresenter();
+
+ for (int i = 0; i < NUM_ROWS; ++i) {
+ ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(cardPresenter);
+ listRowAdapter.add(new PhotoItem("Hello world", R.drawable.gallery_photo_1));
+ listRowAdapter.add(new PhotoItem("This is a test", R.drawable.gallery_photo_2));
+ listRowAdapter.add(new PhotoItem("Android TV", R.drawable.gallery_photo_3));
+ listRowAdapter.add(new PhotoItem("Leanback", R.drawable.gallery_photo_4));
+ listRowAdapter.add(new PhotoItem("Hello world", R.drawable.gallery_photo_5));
+ listRowAdapter.add(new PhotoItem("This is a test", R.drawable.gallery_photo_6));
+ listRowAdapter.add(new PhotoItem("Android TV", R.drawable.gallery_photo_7));
+ listRowAdapter.add(new PhotoItem("Leanback", R.drawable.gallery_photo_8));
+ HeaderItem header = new HeaderItem(i, "Row " + i);
+ mRowsAdapter.add(new ListRow(header, listRowAdapter));
+ }
+
+ setAdapter(mRowsAdapter);
+ }
+
+ private final class ItemViewClickedListener implements OnItemViewClickedListener {
+ @Override
+ public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
+ RowPresenter.ViewHolder rowViewHolder, Row row) {
+ Intent intent = new Intent(getActivity(), DetailsActivity.class);
+ intent.putExtra(DetailsActivity.EXTRA_ITEM, (PhotoItem) item);
+
+ Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
+ getActivity(),
+ ((ImageCardView)itemViewHolder.view).getMainImageView(),
+ DetailsActivity.SHARED_ELEMENT_NAME).toBundle();
+ getActivity().startActivity(intent, bundle);
+ }
+ }
+}
diff --git a/samples/SupportLeanbackDemos/src/com/example/android/leanback/SearchFragment.java b/samples/SupportLeanbackDemos/src/com/example/android/leanback/SearchFragment.java
index c271bc114..b55b82ffe 100644
--- a/samples/SupportLeanbackDemos/src/com/example/android/leanback/SearchFragment.java
+++ b/samples/SupportLeanbackDemos/src/com/example/android/leanback/SearchFragment.java
@@ -73,7 +73,7 @@ public class SearchFragment extends android.support.v17.leanback.app.SearchFragm
ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new CardPresenter());
listRowAdapter.add(new PhotoItem("Hello world", R.drawable.gallery_photo_1));
listRowAdapter.add(new PhotoItem("This is a test", R.drawable.gallery_photo_2));
- HeaderItem header = new HeaderItem(i, mQuery + " results row " + i, null);
+ HeaderItem header = new HeaderItem(i, mQuery + " results row " + i);
mRowsAdapter.add(new ListRow(header, listRowAdapter));
}
}
diff --git a/samples/SupportLeanbackDemos/src/com/example/android/leanback/VerticalGridFragment.java b/samples/SupportLeanbackDemos/src/com/example/android/leanback/VerticalGridFragment.java
index ae41b119c..9ffaf66f5 100644
--- a/samples/SupportLeanbackDemos/src/com/example/android/leanback/VerticalGridFragment.java
+++ b/samples/SupportLeanbackDemos/src/com/example/android/leanback/VerticalGridFragment.java
@@ -35,7 +35,15 @@ public class VerticalGridFragment extends android.support.v17.leanback.app.Verti
private static final int NUM_ITEMS = 50;
private static final int HEIGHT = 200;
- private ArrayObjectAdapter mAdapter;
+ private static class Adapter extends ArrayObjectAdapter {
+ public Adapter(StringPresenter presenter) {
+ super(presenter);
+ }
+ public void callNotifyChanged() {
+ super.notifyChanged();
+ }
+ }
+ private Adapter mAdapter;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -53,7 +61,7 @@ public class VerticalGridFragment extends android.support.v17.leanback.app.Verti
gridPresenter.setNumberOfColumns(NUM_COLUMNS);
setGridPresenter(gridPresenter);
- mAdapter = new ArrayObjectAdapter(new StringPresenter());
+ mAdapter = new Adapter(new StringPresenter());
for (int i = 0; i < NUM_ITEMS; i++) {
mAdapter.add(Integer.toString(i));
}
@@ -72,6 +80,7 @@ public class VerticalGridFragment extends android.support.v17.leanback.app.Verti
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
RowPresenter.ViewHolder rowViewHolder, Row row) {
Log.i(TAG, "onItemClicked: " + item + " row " + row);
+ mAdapter.callNotifyChanged();
}
});
setOnSearchClickedListener(new View.OnClickListener() {
diff --git a/samples/browseable/ActionBarCompat-Basic/AndroidManifest.xml b/samples/browseable/ActionBarCompat-Basic/AndroidManifest.xml
index 332c055be..2e19220d2 100644
--- a/samples/browseable/ActionBarCompat-Basic/AndroidManifest.xml
+++ b/samples/browseable/ActionBarCompat-Basic/AndroidManifest.xml
@@ -21,9 +21,7 @@
android:versionName="1.0">
<!-- ActionBarCompat provides an Action Bar from API v7 onwards -->
- <uses-sdk
- android:minSdkVersion="7"
- android:targetSdkVersion="17" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<application
android:icon="@drawable/ic_launcher"
diff --git a/samples/browseable/ActionBarCompat-Basic/_index.jd b/samples/browseable/ActionBarCompat-Basic/_index.jd
index 4e7737126..0d3a2d878 100644
--- a/samples/browseable/ActionBarCompat-Basic/_index.jd
+++ b/samples/browseable/ActionBarCompat-Basic/_index.jd
@@ -1,15 +1,12 @@
-
-
-
page.tags="ActionBarCompat-Basic"
sample.group=UI
@jd:body
-<p>This sample demonstrates how to create a basic action bar that displays
-action items. The sample shows how to inflate items from a menu resource, and
-how to add items programatically. To reduce clutter, rarely used actions are
-displayed in an action bar overflow.</p>
-<p>The activity in this sample extends from
-{@link android.support.v7.app.ActionBarActivity}, which provides the
-functionality necessary to display a compatible action bar on devices
-running Android 2.1 and higher.</p>
+<p>
+
+ This sample shows you how to use ActionBarCompat to create a basic Activity which
+ displays action items. It covers inflating items from a menu resource, as well as adding
+ an item in code. Items that are not shown as action items on the Action Bar are
+ displayed in the action bar overflow.
+
+ </p>
diff --git a/samples/browseable/ActionBarCompat-Basic/res/values-v21/base-colors.xml b/samples/browseable/ActionBarCompat-Basic/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/ActionBarCompat-Basic/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/ActionBarCompat-Basic/res/values-v21/base-template-styles.xml b/samples/browseable/ActionBarCompat-Basic/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/ActionBarCompat-Basic/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/ActionBarCompat-Basic/res/values/base-strings.xml b/samples/browseable/ActionBarCompat-Basic/res/values/base-strings.xml
index 8edd1b232..18f71a67d 100644
--- a/samples/browseable/ActionBarCompat-Basic/res/values/base-strings.xml
+++ b/samples/browseable/ActionBarCompat-Basic/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">ActionBarCompat-Basic</string>
<string name="intro_message">
diff --git a/samples/browseable/ActionBarCompat-ListPopupMenu/AndroidManifest.xml b/samples/browseable/ActionBarCompat-ListPopupMenu/AndroidManifest.xml
index 114053ed6..695d4e07e 100644
--- a/samples/browseable/ActionBarCompat-ListPopupMenu/AndroidManifest.xml
+++ b/samples/browseable/ActionBarCompat-ListPopupMenu/AndroidManifest.xml
@@ -21,9 +21,7 @@
android:versionName="1.0">
<!-- ActionBarCompat provides an implementation of Popup Menu from API v7 onwards -->
- <uses-sdk
- android:minSdkVersion="7"
- android:targetSdkVersion="17" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<application
android:icon="@drawable/ic_launcher"
diff --git a/samples/browseable/ActionBarCompat-ListPopupMenu/_index.jd b/samples/browseable/ActionBarCompat-ListPopupMenu/_index.jd
index 9da5bdd19..8696da2ff 100644
--- a/samples/browseable/ActionBarCompat-ListPopupMenu/_index.jd
+++ b/samples/browseable/ActionBarCompat-ListPopupMenu/_index.jd
@@ -1,14 +1,10 @@
-
-
-
page.tags="ActionBarCompat-ListPopupMenu"
sample.group=UI
@jd:body
-<p>This sample demonstrates how to use a backward compatible
-{@link android.support.v7.widget.PopupMenu PopupMenu} to create a list, where
-each list item contains a dropdown menu.</p>
-<p>The activity in this sample extends from
-{@link android.support.v7.app.ActionBarActivity}, which provides the
-functionality necessary to display a compatible action bar on devices
-running Android 2.1 and higher.</p>
+<p>
+
+ This sample shows you how to use {@link android.support.v7.widget.PopupMenu PopupMenu}
+ from ActionBarCompat to create a list, with each item having a dropdown menu.
+
+ </p>
diff --git a/samples/browseable/ActionBarCompat-ListPopupMenu/res/values-v21/base-colors.xml b/samples/browseable/ActionBarCompat-ListPopupMenu/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/ActionBarCompat-ListPopupMenu/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/ActionBarCompat-ListPopupMenu/res/values-v21/base-template-styles.xml b/samples/browseable/ActionBarCompat-ListPopupMenu/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/ActionBarCompat-ListPopupMenu/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/ActionBarCompat-ListPopupMenu/res/values/base-strings.xml b/samples/browseable/ActionBarCompat-ListPopupMenu/res/values/base-strings.xml
index 130e2daa3..db43f8c6c 100644
--- a/samples/browseable/ActionBarCompat-ListPopupMenu/res/values/base-strings.xml
+++ b/samples/browseable/ActionBarCompat-ListPopupMenu/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">ActionBarCompat-ListPopupMenu</string>
<string name="intro_message">
diff --git a/samples/browseable/ActionBarCompat-ShareActionProvider/AndroidManifest.xml b/samples/browseable/ActionBarCompat-ShareActionProvider/AndroidManifest.xml
index be1ed4961..18dfc27fd 100644
--- a/samples/browseable/ActionBarCompat-ShareActionProvider/AndroidManifest.xml
+++ b/samples/browseable/ActionBarCompat-ShareActionProvider/AndroidManifest.xml
@@ -23,9 +23,7 @@
<!--
ActionBarCompat provides an Action Bar from API v7 onwards
-->
- <uses-sdk
- android:minSdkVersion="7"
- android:targetSdkVersion="17" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<application
android:icon="@drawable/ic_launcher"
diff --git a/samples/browseable/ActionBarCompat-ShareActionProvider/_index.jd b/samples/browseable/ActionBarCompat-ShareActionProvider/_index.jd
index 63ac59ade..6752a39a4 100644
--- a/samples/browseable/ActionBarCompat-ShareActionProvider/_index.jd
+++ b/samples/browseable/ActionBarCompat-ShareActionProvider/_index.jd
@@ -1,14 +1,10 @@
-
-
-
page.tags="ActionBarCompat-ShareActionProvider"
sample.group=UI
@jd:body
-<p>This sample demonstrates how to use a
-context-sensitive {@link android.support.v7.widget.ShareActionProvider} that is
-backward compatible.</p>
-<p>The activity in this sample extends from
-{@link android.support.v7.app.ActionBarActivity}, which provides the
-functionality necessary to display a compatible action bar on devices
-running Android 2.1 and higher.</p>
+<p>
+
+ This sample shows you how a provide a context-sensitive ShareActionProvider with
+ ActionBarCompat, backwards compatible to API v7.
+
+ </p>
diff --git a/samples/browseable/ActionBarCompat-ShareActionProvider/res/values-v21/base-colors.xml b/samples/browseable/ActionBarCompat-ShareActionProvider/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/ActionBarCompat-ShareActionProvider/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/ActionBarCompat-ShareActionProvider/res/values-v21/base-template-styles.xml b/samples/browseable/ActionBarCompat-ShareActionProvider/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/ActionBarCompat-ShareActionProvider/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/ActionBarCompat-ShareActionProvider/res/values/base-strings.xml b/samples/browseable/ActionBarCompat-ShareActionProvider/res/values/base-strings.xml
index 904f4f1b2..2e0aae49d 100644
--- a/samples/browseable/ActionBarCompat-ShareActionProvider/res/values/base-strings.xml
+++ b/samples/browseable/ActionBarCompat-ShareActionProvider/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">ActionBarCompat-ShareActionProvider</string>
<string name="intro_message">
diff --git a/samples/browseable/ActionBarCompat-ShareActionProvider/src/com.example.android.actionbarcompat.shareactionprovider/MainActivity.java b/samples/browseable/ActionBarCompat-ShareActionProvider/src/com.example.android.actionbarcompat.shareactionprovider/MainActivity.java
index b8cc900b5..545764cad 100644
--- a/samples/browseable/ActionBarCompat-ShareActionProvider/src/com.example.android.actionbarcompat.shareactionprovider/MainActivity.java
+++ b/samples/browseable/ActionBarCompat-ShareActionProvider/src/com.example.android.actionbarcompat.shareactionprovider/MainActivity.java
@@ -83,6 +83,10 @@ public class MainActivity extends ActionBarActivity {
// Now get the ShareActionProvider from the item
mShareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(shareItem);
+ // Get the ViewPager's current item position and set its ShareIntent.
+ int currentViewPagerItem = ((ViewPager) findViewById(R.id.viewpager)).getCurrentItem();
+ setShareIntent(currentViewPagerItem);
+
return super.onCreateOptionsMenu(menu);
}
// END_INCLUDE(get_sap)
@@ -151,6 +155,19 @@ public class MainActivity extends ActionBarActivity {
}
};
+ private void setShareIntent(int position) {
+ // BEGIN_INCLUDE(update_sap)
+ if (mShareActionProvider != null) {
+ // Get the currently selected item, and retrieve it's share intent
+ ContentItem item = mItems.get(position);
+ Intent shareIntent = item.getShareIntent(MainActivity.this);
+
+ // Now update the ShareActionProvider with the new share intent
+ mShareActionProvider.setShareIntent(shareIntent);
+ }
+ // END_INCLUDE(update_sap)
+ }
+
/**
* A OnPageChangeListener used to update the ShareActionProvider's share intent when a new item
* is selected in the ViewPager.
@@ -165,16 +182,7 @@ public class MainActivity extends ActionBarActivity {
@Override
public void onPageSelected(int position) {
- // BEGIN_INCLUDE(update_sap)
- if (mShareActionProvider != null) {
- // Get the currently selected item, and retrieve it's share intent
- ContentItem item = mItems.get(position);
- Intent shareIntent = item.getShareIntent(MainActivity.this);
-
- // Now update the ShareActionProvider with the new share intent
- mShareActionProvider.setShareIntent(shareIntent);
- }
- // END_INCLUDE(update_sap)
+ setShareIntent(position);
}
@Override
diff --git a/samples/browseable/ActionBarCompat-Styled/AndroidManifest.xml b/samples/browseable/ActionBarCompat-Styled/AndroidManifest.xml
index 06394c705..b9d266cf3 100644
--- a/samples/browseable/ActionBarCompat-Styled/AndroidManifest.xml
+++ b/samples/browseable/ActionBarCompat-Styled/AndroidManifest.xml
@@ -20,9 +20,7 @@
android:versionCode="1"
android:versionName="1.0" >
- <uses-sdk
- android:minSdkVersion="7"
- android:targetSdkVersion="17" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<!--
Theme is set on the application so that our custom theme is used by
diff --git a/samples/browseable/ActionBarCompat-Styled/_index.jd b/samples/browseable/ActionBarCompat-Styled/_index.jd
index 06fee1aaa..f2f3b3c33 100644
--- a/samples/browseable/ActionBarCompat-Styled/_index.jd
+++ b/samples/browseable/ActionBarCompat-Styled/_index.jd
@@ -1,13 +1,10 @@
-
-
-
page.tags="ActionBarCompat-Styled"
sample.group=UI
@jd:body
-<p>This sample demonstrates how to use a backward compatible
-{@link android.support.v7.app.ActionBar} with a customized theme.</p>
-<p>The activity in this sample extends from
-{@link android.support.v7.app.ActionBarActivity}, which provides the
-functionality necessary to display a compatible action bar on devices
-running Android 2.1 and higher.</p>
+<p>
+
+ This sample shows you how to use ActionBarCompat with a customized theme. It utilizes a
+ split action bar when running on a device with a narrow display, and show three tabs.
+
+ </p>
diff --git a/samples/browseable/ActionBarCompat-Styled/res/values-v21/base-colors.xml b/samples/browseable/ActionBarCompat-Styled/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/ActionBarCompat-Styled/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/ActionBarCompat-Styled/res/values-v21/base-template-styles.xml b/samples/browseable/ActionBarCompat-Styled/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/ActionBarCompat-Styled/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/ActionBarCompat-Styled/res/values/base-strings.xml b/samples/browseable/ActionBarCompat-Styled/res/values/base-strings.xml
index 7adb0c6eb..324726d76 100644
--- a/samples/browseable/ActionBarCompat-Styled/res/values/base-strings.xml
+++ b/samples/browseable/ActionBarCompat-Styled/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">ActionBarCompat-Styled</string>
<string name="intro_message">
diff --git a/samples/browseable/ActivityInstrumentation/AndroidManifest.xml b/samples/browseable/ActivityInstrumentation/AndroidManifest.xml
index 547d95ee7..da5c824e8 100644
--- a/samples/browseable/ActivityInstrumentation/AndroidManifest.xml
+++ b/samples/browseable/ActivityInstrumentation/AndroidManifest.xml
@@ -22,7 +22,7 @@
android:versionCode="1"
android:versionName="1.0">
- <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="17" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<application android:allowBackup="true"
android:label="@string/app_name"
diff --git a/samples/browseable/ActivityInstrumentation/_index.jd b/samples/browseable/ActivityInstrumentation/_index.jd
index 369ff7eb6..77f1e2479 100644
--- a/samples/browseable/ActivityInstrumentation/_index.jd
+++ b/samples/browseable/ActivityInstrumentation/_index.jd
@@ -1,13 +1,10 @@
-
-
-
page.tags="ActivityInstrumentation"
sample.group=Testing
@jd:body
-<p>This sample demonstrates how to use an
-{@link android.test.InstrumentationTestCase} to test the internal state of an
-{@link android.app.Activity}.</p>
-<p>To learn more about using Android's custom testing framework, see
-<a href="{@docRoot}training/activity-testing/index.html">Testing Your
-Android Activity</a>.</p>
+<p>
+
+ This sample provides a basic example of using an InstrumentationTest to probe the
+ internal state of an Activity.
+
+ </p>
diff --git a/samples/browseable/ActivityInstrumentation/res/values-v21/base-colors.xml b/samples/browseable/ActivityInstrumentation/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/ActivityInstrumentation/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/ActivityInstrumentation/res/values-v21/base-template-styles.xml b/samples/browseable/ActivityInstrumentation/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/ActivityInstrumentation/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/ActivityInstrumentation/res/values/base-strings.xml b/samples/browseable/ActivityInstrumentation/res/values/base-strings.xml
index dfe40f4f6..2b3f65692 100644
--- a/samples/browseable/ActivityInstrumentation/res/values/base-strings.xml
+++ b/samples/browseable/ActivityInstrumentation/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">ActivityInstrumentation</string>
<string name="intro_message">
diff --git a/samples/browseable/ActivitySceneTransitionBasic/_index.jd b/samples/browseable/ActivitySceneTransitionBasic/_index.jd
index 1053a7d5b..fd2e0c79d 100644
--- a/samples/browseable/ActivitySceneTransitionBasic/_index.jd
+++ b/samples/browseable/ActivitySceneTransitionBasic/_index.jd
@@ -5,8 +5,8 @@ sample.group=UI
<p>
Demonstrates how to the use Activity scene transitions when transitions
- from one Activity to another. Uses a combination of moveImage and changeBounds
- to nicely transition a grid of images to an Activity with a large image and detail
- text.
+ from one Activity to another. Uses a combination of changeImageTransform and
+ changeBounds to nicely transition a grid of images to an Activity with a large image
+ and detail text.
</p>
diff --git a/samples/browseable/ActivitySceneTransitionBasic/res/layout/details.xml b/samples/browseable/ActivitySceneTransitionBasic/res/layout/details.xml
index e61212ed2..8ca463482 100644
--- a/samples/browseable/ActivitySceneTransitionBasic/res/layout/details.xml
+++ b/samples/browseable/ActivitySceneTransitionBasic/res/layout/details.xml
@@ -27,7 +27,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
- <com.android.volley.toolbox.NetworkImageView
+ <ImageView
android:id="@+id/imageview_header"
android:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/samples/browseable/ActivitySceneTransitionBasic/res/layout/grid_item.xml b/samples/browseable/ActivitySceneTransitionBasic/res/layout/grid_item.xml
index 1d28dbada..e79f0eb30 100644
--- a/samples/browseable/ActivitySceneTransitionBasic/res/layout/grid_item.xml
+++ b/samples/browseable/ActivitySceneTransitionBasic/res/layout/grid_item.xml
@@ -23,7 +23,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
- <com.android.volley.toolbox.NetworkImageView
+ <ImageView
android:id="@+id/imageview_item"
android:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/samples/browseable/ActivitySceneTransitionBasic/res/transition/grid_detail_transition.xml b/samples/browseable/ActivitySceneTransitionBasic/res/transition/grid_detail_transition.xml
index 40be3d468..3091cd266 100644
--- a/samples/browseable/ActivitySceneTransitionBasic/res/transition/grid_detail_transition.xml
+++ b/samples/browseable/ActivitySceneTransitionBasic/res/transition/grid_detail_transition.xml
@@ -16,33 +16,15 @@
<!--
The transitions which us used for the entrance and exit of shared elements. Here we declare
- two different transitions which are targeting to specific views.
+ two different transitions which are targeting specific views.
-->
<transitionSet xmlns:android="http://schemas.android.com/apk/res/android">
<!-- changeBounds is used for the TextViews which are shared -->
- <changeBounds>
- <!--
- Set this transitions target IDs to be those which point to the TextViews in both the
- starting and result Activities
- -->
- <targets>
- <target android:targetId="@id/textview_name" />
- <target android:targetId="@id/textview_title" />
- </targets>
- </changeBounds>
-
- <!-- moveImage is used for the ImageViews which are shared -->
- <moveImage>
- <!--
- Set this transitions target IDs to be those which point to the ImageViews in both the
- starting and result Activities
- -->
- <targets>
- <target android:targetId="@id/imageview_header" />
- <target android:targetId="@id/imageview_item" />
- </targets>
- </moveImage>
+ <changeBounds />
+
+ <!-- changeImageTransform is used for the ImageViews which are shared -->
+ <changeImageTransform />
</transitionSet>
diff --git a/samples/browseable/ActivitySceneTransitionBasic/res/values-v21/base-colors.xml b/samples/browseable/ActivitySceneTransitionBasic/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/ActivitySceneTransitionBasic/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/ActivitySceneTransitionBasic/res/values-v21/base-template-styles.xml b/samples/browseable/ActivitySceneTransitionBasic/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/ActivitySceneTransitionBasic/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/ActivitySceneTransitionBasic/res/values-v21/styles.xml b/samples/browseable/ActivitySceneTransitionBasic/res/values-v21/styles.xml
index fd212b395..4fee48dd8 100644
--- a/samples/browseable/ActivitySceneTransitionBasic/res/values-v21/styles.xml
+++ b/samples/browseable/ActivitySceneTransitionBasic/res/values-v21/styles.xml
@@ -17,9 +17,6 @@
<resources>
<style name="Theme.Sample" parent="Theme.Base">
- <!-- Set the windowContentTransitions flag to enable Activity scene transitions -->
- <item name="android:windowContentTransitions">true</item>
-
<!-- Set the transitions which are used for the entrance and exit of shared elements -->
<item name="android:windowSharedElementEnterTransition">
@transition/grid_detail_transition
diff --git a/samples/browseable/ActivitySceneTransitionBasic/res/values-v21/template-styles.xml b/samples/browseable/ActivitySceneTransitionBasic/res/values-v21/template-styles.xml
deleted file mode 100644
index 134fcd9d3..000000000
--- a/samples/browseable/ActivitySceneTransitionBasic/res/values-v21/template-styles.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<!--
- Copyright 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<resources>
-
- <!-- Activity themes -->
- <style name="Theme.Base" parent="android:Theme.Material.Light" />
-
-</resources>
diff --git a/samples/browseable/ActivitySceneTransitionBasic/res/values/base-strings.xml b/samples/browseable/ActivitySceneTransitionBasic/res/values/base-strings.xml
index 989fe00d7..35860cb2d 100644
--- a/samples/browseable/ActivitySceneTransitionBasic/res/values/base-strings.xml
+++ b/samples/browseable/ActivitySceneTransitionBasic/res/values/base-strings.xml
@@ -21,9 +21,9 @@
Demonstrates how to the use Activity scene transitions when transitions
- from one Activity to another. Uses a combination of moveImage and changeBounds
- to nicely transition a grid of images to an Activity with a large image and detail
- text.
+ from one Activity to another. Uses a combination of changeImageTransform and
+ changeBounds to nicely transition a grid of images to an Activity with a large image
+ and detail text.
]]>
diff --git a/samples/browseable/ActivitySceneTransitionBasic/res/values/strings.xml b/samples/browseable/ActivitySceneTransitionBasic/res/values/strings.xml
index 2aa0d3b5f..669c1270e 100644
--- a/samples/browseable/ActivitySceneTransitionBasic/res/values/strings.xml
+++ b/samples/browseable/ActivitySceneTransitionBasic/res/values/strings.xml
@@ -1,4 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
<resources>
<string name="bacon_ipsum">
diff --git a/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.activityscenetransitionbasic/DetailActivity.java b/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.activityscenetransitionbasic/DetailActivity.java
index 741cd26ea..17d1b2a7b 100644
--- a/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.activityscenetransitionbasic/DetailActivity.java
+++ b/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.activityscenetransitionbasic/DetailActivity.java
@@ -16,13 +16,14 @@
package com.example.android.activityscenetransitionbasic;
-import com.android.volley.toolbox.ImageLoader;
-import com.android.volley.toolbox.NetworkImageView;
-import com.android.volley.toolbox.Volley;
+import com.squareup.picasso.Picasso;
import android.app.Activity;
-import android.graphics.Bitmap;
+import android.os.Build;
import android.os.Bundle;
+import android.support.v4.view.ViewCompat;
+import android.transition.Transition;
+import android.widget.ImageView;
import android.widget.TextView;
/**
@@ -40,23 +41,20 @@ public class DetailActivity extends Activity {
// View name of the header title. Used for activity scene transitions
public static final String VIEW_NAME_HEADER_TITLE = "detail:header:title";
- private NetworkImageView mHeaderImageView;
+ private ImageView mHeaderImageView;
private TextView mHeaderTitle;
- private ImageLoader mImageLoader;
+ private Item mItem;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.details);
- // Construct an ImageLoader instance so that we can load images from the network
- mImageLoader = new ImageLoader(Volley.newRequestQueue(this), ImageMemoryCache.INSTANCE);
-
// Retrieve the correct Item instance, using the ID provided in the Intent
- Item item = Item.getItem(getIntent().getIntExtra(EXTRA_PARAM_ID, 0));
+ mItem = Item.getItem(getIntent().getIntExtra(EXTRA_PARAM_ID, 0));
- mHeaderImageView = (NetworkImageView) findViewById(R.id.imageview_header);
+ mHeaderImageView = (ImageView) findViewById(R.id.imageview_header);
mHeaderTitle = (TextView) findViewById(R.id.textview_title);
// BEGIN_INCLUDE(detail_set_view_name)
@@ -65,31 +63,97 @@ public class DetailActivity extends Activity {
* This could be done in the layout XML, but exposing it via static variables allows easy
* querying from other Activities
*/
- mHeaderImageView.setViewName(VIEW_NAME_HEADER_IMAGE);
- mHeaderTitle.setViewName(VIEW_NAME_HEADER_TITLE);
+ ViewCompat.setTransitionName(mHeaderImageView, VIEW_NAME_HEADER_IMAGE);
+ ViewCompat.setTransitionName(mHeaderTitle, VIEW_NAME_HEADER_TITLE);
// END_INCLUDE(detail_set_view_name)
- loadItem(item);
+ loadItem();
}
- private void loadItem(Item item) {
+ private void loadItem() {
// Set the title TextView to the item's name and author
- mHeaderTitle.setText(getString(R.string.image_header, item.getName(), item.getAuthor()));
+ mHeaderTitle.setText(getString(R.string.image_header, mItem.getName(), mItem.getAuthor()));
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && addTransitionListener()) {
+ // If we're running on Lollipop and we have added a listener to the shared element
+ // transition, load the thumbnail. The listener will load the full-size image when
+ // the transition is complete.
+ loadThumbnail();
+ } else {
+ // If all other cases we should just load the full-size image now
+ loadFullSizeImage();
+ }
+ }
- final ImageMemoryCache cache = ImageMemoryCache.INSTANCE;
- Bitmap thumbnailImage = cache.getBitmapFromUrl(item.getThumbnailUrl());
+ /**
+ * Load the item's thumbnail image into our {@link ImageView}.
+ */
+ private void loadThumbnail() {
+ Picasso.with(mHeaderImageView.getContext())
+ .load(mItem.getThumbnailUrl())
+ .noFade()
+ .into(mHeaderImageView);
+ }
+
+ /**
+ * Load the item's full-size image into our {@link ImageView}.
+ */
+ private void loadFullSizeImage() {
+ Picasso.with(mHeaderImageView.getContext())
+ .load(mItem.getPhotoUrl())
+ .noFade()
+ .noPlaceholder()
+ .into(mHeaderImageView);
+ }
- // Check to see if we already have the thumbnail sized image in the cache. If so, start
- // loading the full size image and display the thumbnail as a placeholder.
- if (thumbnailImage != null) {
- mHeaderImageView.setImageUrl(item.getPhotoUrl(), mImageLoader);
- mHeaderImageView.setImageBitmap(thumbnailImage);
- return;
+ /**
+ * Try and add a {@link Transition.TransitionListener} to the entering shared element
+ * {@link Transition}. We do this so that we can load the full-size image after the transition
+ * has completed.
+ *
+ * @return true if we were successful in adding a listener to the enter transition
+ */
+ private boolean addTransitionListener() {
+ final Transition transition = getWindow().getSharedElementEnterTransition();
+
+ if (transition != null) {
+ // There is an entering shared element transition so add a listener to it
+ transition.addListener(new Transition.TransitionListener() {
+ @Override
+ public void onTransitionEnd(Transition transition) {
+ // As the transition has ended, we can now load the full-size image
+ loadFullSizeImage();
+
+ // Make sure we remove ourselves as a listener
+ transition.removeListener(this);
+ }
+
+ @Override
+ public void onTransitionStart(Transition transition) {
+ // No-op
+ }
+
+ @Override
+ public void onTransitionCancel(Transition transition) {
+ // Make sure we remove ourselves as a listener
+ transition.removeListener(this);
+ }
+
+ @Override
+ public void onTransitionPause(Transition transition) {
+ // No-op
+ }
+
+ @Override
+ public void onTransitionResume(Transition transition) {
+ // No-op
+ }
+ });
+ return true;
}
- // If we get here then we do not have either the full size or the thumbnail in the cache.
- // Here we just load the full size and make do.
- mHeaderImageView.setImageUrl(item.getPhotoUrl(), mImageLoader);
+ // If we reach here then we have not added a listener
+ return false;
}
}
diff --git a/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.activityscenetransitionbasic/ImageMemoryCache.java b/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.activityscenetransitionbasic/ImageMemoryCache.java
deleted file mode 100644
index 53d47bae1..000000000
--- a/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.activityscenetransitionbasic/ImageMemoryCache.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2014 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.activityscenetransitionbasic;
-
-import com.android.volley.toolbox.ImageLoader;
-
-import android.graphics.Bitmap;
-import android.util.LruCache;
-
-import java.util.Map;
-
-/**
- * An image memory cache implementation for Volley which allows the retrieval of entires via a URL.
- * Volley internally inserts items with a key which is a combination of a the size of the image,
- * and the url.
- *
- * This class provide the method {@link #getBitmapFromUrl(String)} which allows the retrieval of
- * a bitmap solely on the URL.
- */
-public class ImageMemoryCache extends LruCache<String, Bitmap> implements ImageLoader.ImageCache {
-
- /**
- * Singleton instance which has it's maximum size set to be 1/8th of the allowed memory size.
- */
- public static final ImageMemoryCache INSTANCE = new ImageMemoryCache(
- (int) (Runtime.getRuntime().maxMemory() / 8));
-
- // Cache the last created snapshot
- private Map<String, Bitmap> mLastSnapshot;
-
- private ImageMemoryCache(int maxSize) {
- super(maxSize);
- }
-
- public Bitmap getBitmapFromUrl(String url) {
- // If we do not have a snapshot to use, generate one
- if (mLastSnapshot == null) {
- mLastSnapshot = snapshot();
- }
-
- // Iterate through the snapshot to find any entries which match our url
- for (Map.Entry<String, Bitmap> entry : mLastSnapshot.entrySet()) {
- if (url.equals(extractUrl(entry.getKey()))) {
- // We've found an entry with the same url, return the bitmap
- return entry.getValue();
- }
- }
-
- // We didn't find an entry, so return null
- return null;
- }
-
- @Override
- public Bitmap getBitmap(String key) {
- return get(key);
- }
-
- @Override
- public void putBitmap(String key, Bitmap bitmap) {
- put(key, bitmap);
-
- // An entry has been added, so invalidate the snapshot
- mLastSnapshot = null;
- }
-
- @Override
- protected void entryRemoved(boolean evicted, String key, Bitmap oldValue, Bitmap newValue) {
- super.entryRemoved(evicted, key, oldValue, newValue);
-
- // An entry has been removed, so invalidate the snapshot
- mLastSnapshot = null;
- }
-
- private static String extractUrl(String key) {
- return key.substring(key.indexOf("http"));
- }
-
- @Override
- protected int sizeOf(String key, Bitmap value) {
- return value.getAllocationByteCount();
- }
-}
diff --git a/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.activityscenetransitionbasic/MainActivity.java b/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.activityscenetransitionbasic/MainActivity.java
index 363099038..9eed44a3d 100644
--- a/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.activityscenetransitionbasic/MainActivity.java
+++ b/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.activityscenetransitionbasic/MainActivity.java
@@ -16,20 +16,20 @@
package com.example.android.activityscenetransitionbasic;
-import com.android.volley.toolbox.ImageLoader;
-import com.android.volley.toolbox.NetworkImageView;
-import com.android.volley.toolbox.Volley;
+import com.squareup.picasso.Picasso;
import android.app.Activity;
-import android.app.ActivityOptions;
import android.content.Intent;
import android.os.Bundle;
-import android.util.Pair;
+import android.support.v4.app.ActivityCompat;
+import android.support.v4.app.ActivityOptionsCompat;
+import android.support.v4.util.Pair;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.GridView;
+import android.widget.ImageView;
import android.widget.TextView;
/**
@@ -42,16 +42,11 @@ public class MainActivity extends Activity implements AdapterView.OnItemClickLis
private GridView mGridView;
private GridAdapter mAdapter;
- private ImageLoader mImageLoader;
-
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.grid);
- // Retrieve the ImageLoader we are going to use for NetworkImageView
- mImageLoader = new ImageLoader(Volley.newRequestQueue(this), ImageMemoryCache.INSTANCE);
-
// Setup the GridView and set the adapter
mGridView = (GridView) findViewById(R.id.grid);
mGridView.setOnItemClickListener(this);
@@ -74,23 +69,21 @@ public class MainActivity extends Activity implements AdapterView.OnItemClickLis
// BEGIN_INCLUDE(start_activity)
/**
* Now create an {@link android.app.ActivityOptions} instance using the
- * {@link android.app.ActivityOptions#makeSceneTransitionAnimation(android.app.Activity, android.util.Pair[])} factory method.
+ * {@link ActivityOptionsCompat#makeSceneTransitionAnimation(Activity, Pair[])} factory
+ * method.
*/
- ActivityOptions activityOptions = ActivityOptions.makeSceneTransitionAnimation(
+ ActivityOptionsCompat activityOptions = ActivityOptionsCompat.makeSceneTransitionAnimation(
this,
// Now we provide a list of Pair items which contain the view we can transitioning
// from, and the name of the view it is transitioning to, in the launched activity
- new Pair<View, String>(
- view.findViewById(R.id.imageview_item),
+ new Pair<View, String>(view.findViewById(R.id.imageview_item),
DetailActivity.VIEW_NAME_HEADER_IMAGE),
- new Pair<View, String>(
- view.findViewById(R.id.textview_name),
- DetailActivity.VIEW_NAME_HEADER_TITLE)
- );
+ new Pair<View, String>(view.findViewById(R.id.textview_name),
+ DetailActivity.VIEW_NAME_HEADER_TITLE));
// Now we can start the Activity, providing the activity options as a bundle
- startActivity(intent, activityOptions.toBundle());
+ ActivityCompat.startActivity(this, intent, activityOptions.toBundle());
// END_INCLUDE(start_activity)
}
@@ -123,22 +116,13 @@ public class MainActivity extends Activity implements AdapterView.OnItemClickLis
final Item item = getItem(position);
// Load the thumbnail image
- NetworkImageView image = (NetworkImageView) view.findViewById(R.id.imageview_item);
- image.setImageUrl(item.getThumbnailUrl(), mImageLoader);
+ ImageView image = (ImageView) view.findViewById(R.id.imageview_item);
+ Picasso.with(image.getContext()).load(item.getThumbnailUrl()).into(image);
// Set the TextView's contents
TextView name = (TextView) view.findViewById(R.id.textview_name);
name.setText(item.getName());
- // BEGIN_INCLUDE(grid_set_view_name)
- /**
- * As we're in an adapter we need to set each view's name dynamically, using the
- * item's ID so that the names are unique.
- */
- image.setViewName("grid:image:" + item.getId());
- name.setViewName("grid:name:" + item.getId());
- // END_INCLUDE(grid_set_view_name)
-
return view;
}
}
diff --git a/samples/browseable/AdapterTransition/AndroidManifest.xml b/samples/browseable/AdapterTransition/AndroidManifest.xml
index 01b414d9c..a998a4c7a 100644
--- a/samples/browseable/AdapterTransition/AndroidManifest.xml
+++ b/samples/browseable/AdapterTransition/AndroidManifest.xml
@@ -19,9 +19,7 @@ limitations under the License.
android:versionCode="1"
android:versionName="1.0">
- <uses-sdk
- android:minSdkVersion="19"
- android:targetSdkVersion="19"/>
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<application
android:allowBackup="true"
diff --git a/samples/browseable/AdapterTransition/_index.jd b/samples/browseable/AdapterTransition/_index.jd
index d5c48a392..a2d134ac5 100644
--- a/samples/browseable/AdapterTransition/_index.jd
+++ b/samples/browseable/AdapterTransition/_index.jd
@@ -1,12 +1,9 @@
-
-
-
page.tags="AdapterTransition"
sample.group=UI
@jd:body
<p>
-{@link android.transition.Transition Transition} cannot be directly applied to
-{@link android.widget.AdapterView AdapterView}s. This sample demonstrates how to
-create a overlay layout and how to run a transition on it.
-</p>
+
+ Transition cannot be directly applied to AdapterViews. In this sample, we demonstrate how to create an overlay layout and run a Transition on it. Press the action bar button to toggle between ListView and GridView.
+
+ </p>
diff --git a/samples/browseable/AdapterTransition/res/values-v21/base-colors.xml b/samples/browseable/AdapterTransition/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/AdapterTransition/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/AdapterTransition/res/values-v21/base-template-styles.xml b/samples/browseable/AdapterTransition/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/AdapterTransition/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/AdapterTransition/res/values/base-strings.xml b/samples/browseable/AdapterTransition/res/values/base-strings.xml
index ee0c4bd59..09f86cdfe 100644
--- a/samples/browseable/AdapterTransition/res/values/base-strings.xml
+++ b/samples/browseable/AdapterTransition/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">AdapterTransition</string>
<string name="intro_message">
diff --git a/samples/browseable/AdapterTransition/res/values/strings.xml b/samples/browseable/AdapterTransition/res/values/strings.xml
index 02b87cf79..02b87cf79 100755..100644
--- a/samples/browseable/AdapterTransition/res/values/strings.xml
+++ b/samples/browseable/AdapterTransition/res/values/strings.xml
diff --git a/samples/browseable/AdapterTransition/src/com.example.android.adaptertransition/MainActivity.java b/samples/browseable/AdapterTransition/src/com.example.android.adaptertransition/MainActivity.java
index a45632c70..0adb84284 100644
--- a/samples/browseable/AdapterTransition/src/com.example.android.adaptertransition/MainActivity.java
+++ b/samples/browseable/AdapterTransition/src/com.example.android.adaptertransition/MainActivity.java
@@ -14,9 +14,6 @@
* limitations under the License.
*/
-
-
-
package com.example.android.adaptertransition;
import android.os.Bundle;
@@ -50,10 +47,12 @@ public class MainActivity extends SampleActivityBase {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
- FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
- AdapterTransitionFragment fragment = new AdapterTransitionFragment();
- transaction.replace(R.id.sample_content_fragment, fragment);
- transaction.commit();
+ if (savedInstanceState == null) {
+ FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
+ AdapterTransitionFragment fragment = new AdapterTransitionFragment();
+ transaction.replace(R.id.sample_content_fragment, fragment);
+ transaction.commit();
+ }
}
@Override
diff --git a/samples/browseable/AdvancedImmersiveMode/AndroidManifest.xml b/samples/browseable/AdvancedImmersiveMode/AndroidManifest.xml
index 1d01856c8..a96ebb429 100644
--- a/samples/browseable/AdvancedImmersiveMode/AndroidManifest.xml
+++ b/samples/browseable/AdvancedImmersiveMode/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- This sample is to demonstrate features released in API 19.
So while it would technically run on an earlier version of Android,
there wouldn't be much point) -->
- <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="19" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<!-- allowBackup declares if the app can be part of device-wide backups such as "adb backup" -->
<!-- theme is a way of applying UI decisions across your entire application. You can also
define it on a per-application basis. -->
diff --git a/samples/browseable/AdvancedImmersiveMode/_index.jd b/samples/browseable/AdvancedImmersiveMode/_index.jd
index 7048fe838..ee91eb7e3 100644
--- a/samples/browseable/AdvancedImmersiveMode/_index.jd
+++ b/samples/browseable/AdvancedImmersiveMode/_index.jd
@@ -1,19 +1,12 @@
-
-
-
page.tags="AdvancedImmersiveMode"
sample.group=UI
@jd:body
<p>
-Android 4.4 introduces a way for you to provide a more immersive screen
-experience in your app by letting users show or hide the status bar and
-the navigation bar with a swipe.
-</p>
-
-<p>
-This sample demonstrates how this feature interacts with some of the other
-UI flags related to full-screen apps. The sample also shows how to implement a
-"sticky" mode, which re-hides the bars a few seconds after the user swipes
-them back in.
-</p> \ No newline at end of file
+
+ \n\n\n\"Immersive Mode\", added in Android 4.4, improves the \"hide full screen\" and
+ \"hide nav bar\" modes, by letting users swipe the bars in and out. This sample
+ lets the user experiment with immersive mode by seeing how it interacts
+ with some of the other UI flags related to full-screen apps.
+
+ </p>
diff --git a/samples/browseable/AdvancedImmersiveMode/res/values-v21/base-colors.xml b/samples/browseable/AdvancedImmersiveMode/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/AdvancedImmersiveMode/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/AdvancedImmersiveMode/res/values-v21/base-template-styles.xml b/samples/browseable/AdvancedImmersiveMode/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/AdvancedImmersiveMode/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/AdvancedImmersiveMode/res/values/base-strings.xml b/samples/browseable/AdvancedImmersiveMode/res/values/base-strings.xml
index 8e4c710cf..b1c7f5e87 100644
--- a/samples/browseable/AdvancedImmersiveMode/res/values/base-strings.xml
+++ b/samples/browseable/AdvancedImmersiveMode/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">AdvancedImmersiveMode</string>
<string name="intro_message">
diff --git a/samples/browseable/AdvancedImmersiveMode/src/com.example.android.advancedimmersivemode/MainActivity.java b/samples/browseable/AdvancedImmersiveMode/src/com.example.android.advancedimmersivemode/MainActivity.java
index e32355760..4fc40afa7 100644
--- a/samples/browseable/AdvancedImmersiveMode/src/com.example.android.advancedimmersivemode/MainActivity.java
+++ b/samples/browseable/AdvancedImmersiveMode/src/com.example.android.advancedimmersivemode/MainActivity.java
@@ -14,9 +14,6 @@
* limitations under the License.
*/
-
-
-
package com.example.android.advancedimmersivemode;
import android.os.Bundle;
@@ -50,10 +47,12 @@ public class MainActivity extends SampleActivityBase {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
- FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
- AdvancedImmersiveModeFragment fragment = new AdvancedImmersiveModeFragment();
- transaction.replace(R.id.sample_content_fragment, fragment);
- transaction.commit();
+ if (savedInstanceState == null) {
+ FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
+ AdvancedImmersiveModeFragment fragment = new AdvancedImmersiveModeFragment();
+ transaction.replace(R.id.sample_content_fragment, fragment);
+ transaction.commit();
+ }
}
@Override
diff --git a/samples/browseable/AgendaData/Application/AndroidManifest.xml b/samples/browseable/AgendaData/Application/AndroidManifest.xml
new file mode 100644
index 000000000..aa8a14a0a
--- /dev/null
+++ b/samples/browseable/AgendaData/Application/AndroidManifest.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.wearable.agendadata">
+
+ <uses-sdk android:minSdkVersion="18"
+ android:targetSdkVersion="21" />
+
+ <uses-permission android:name="android.permission.READ_CALENDAR" />
+ <uses-permission android:name="android.permission.READ_CONTACTS" />
+
+ <application
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@android:style/Theme.Holo.Light"
+ >
+
+ <meta-data
+ android:name="com.google.android.gms.version"
+ android:value="@integer/google_play_services_version" />
+
+ <activity
+ android:name="com.example.android.wearable.agendadata.MainActivity"
+ android:label="@string/app_name"
+ android:configChanges="keyboardHidden|orientation|screenSize">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="android.intent.category.LAUNCHER"/>
+ </intent-filter>
+ </activity>
+
+ <service android:name="com.example.android.wearable.agendadata.CalendarQueryService"/>
+ </application>
+</manifest>
diff --git a/samples/wearable/AgendaData/Application/src/main/res/drawable-hdpi/ic_launcher.png b/samples/browseable/AgendaData/Application/res/drawable-hdpi/ic_launcher.png
index 0564717bb..0564717bb 100644
--- a/samples/wearable/AgendaData/Application/src/main/res/drawable-hdpi/ic_launcher.png
+++ b/samples/browseable/AgendaData/Application/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/DoneBar/res/drawable-xhdpi/sample_dashboard_item_background.9.png b/samples/browseable/AgendaData/Application/res/drawable-hdpi/tile.9.png
index 135862883..135862883 100644
--- a/samples/browseable/DoneBar/res/drawable-xhdpi/sample_dashboard_item_background.9.png
+++ b/samples/browseable/AgendaData/Application/res/drawable-hdpi/tile.9.png
Binary files differ
diff --git a/samples/wearable/AgendaData/Application/src/main/res/drawable-mdpi/ic_launcher.png b/samples/browseable/AgendaData/Application/res/drawable-mdpi/ic_launcher.png
index 0f4034743..0f4034743 100644
--- a/samples/wearable/AgendaData/Application/src/main/res/drawable-mdpi/ic_launcher.png
+++ b/samples/browseable/AgendaData/Application/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/AgendaData/Application/src/main/res/drawable-nodpi/nobody.png b/samples/browseable/AgendaData/Application/res/drawable-nodpi/nobody.png
index 5a33d60e0..5a33d60e0 100644
--- a/samples/wearable/AgendaData/Application/src/main/res/drawable-nodpi/nobody.png
+++ b/samples/browseable/AgendaData/Application/res/drawable-nodpi/nobody.png
Binary files differ
diff --git a/samples/wearable/AgendaData/Application/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/AgendaData/Application/res/drawable-xhdpi/ic_launcher.png
index d7705cfb0..d7705cfb0 100644
--- a/samples/wearable/AgendaData/Application/src/main/res/drawable-xhdpi/ic_launcher.png
+++ b/samples/browseable/AgendaData/Application/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/AgendaData/Application/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/AgendaData/Application/res/drawable-xxhdpi/ic_launcher.png
index f07299fd2..f07299fd2 100644
--- a/samples/wearable/AgendaData/Application/src/main/res/drawable-xxhdpi/ic_launcher.png
+++ b/samples/browseable/AgendaData/Application/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/AgendaData/Application/res/layout/activity_main.xml b/samples/browseable/AgendaData/Application/res/layout/activity_main.xml
new file mode 100755
index 000000000..be1aa49d9
--- /dev/null
+++ b/samples/browseable/AgendaData/Application/res/layout/activity_main.xml
@@ -0,0 +1,36 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <LinearLayout style="@style/Widget.SampleMessageTile"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView style="@style/Widget.SampleMessage"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="@dimen/horizontal_page_margin"
+ android:layout_marginRight="@dimen/horizontal_page_margin"
+ android:layout_marginTop="@dimen/vertical_page_margin"
+ android:layout_marginBottom="@dimen/vertical_page_margin"
+ android:text="@string/intro_message" />
+ </LinearLayout>
+</LinearLayout>
diff --git a/samples/wearable/AgendaData/Application/src/main/res/layout/main.xml b/samples/browseable/AgendaData/Application/res/layout/main.xml
index 8e82cdd45..8e82cdd45 100644
--- a/samples/wearable/AgendaData/Application/src/main/res/layout/main.xml
+++ b/samples/browseable/AgendaData/Application/res/layout/main.xml
diff --git a/samples/browseable/AgendaData/Application/res/values-sw600dp/template-dimens.xml b/samples/browseable/AgendaData/Application/res/values-sw600dp/template-dimens.xml
new file mode 100644
index 000000000..22074a2bd
--- /dev/null
+++ b/samples/browseable/AgendaData/Application/res/values-sw600dp/template-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>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_huge</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/AgendaData/Application/res/values-sw600dp/template-styles.xml b/samples/browseable/AgendaData/Application/res/values-sw600dp/template-styles.xml
new file mode 100644
index 000000000..03d197418
--- /dev/null
+++ b/samples/browseable/AgendaData/Application/res/values-sw600dp/template-styles.xml
@@ -0,0 +1,25 @@
+<!--
+ 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.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceLarge</item>
+ <item name="android:lineSpacingMultiplier">1.2</item>
+ <item name="android:shadowDy">-6.5</item>
+ </style>
+
+</resources>
diff --git a/samples/browseable/AgendaData/Application/res/values-v11/template-styles.xml b/samples/browseable/AgendaData/Application/res/values-v11/template-styles.xml
new file mode 100644
index 000000000..8c1ea66f2
--- /dev/null
+++ b/samples/browseable/AgendaData/Application/res/values-v11/template-styles.xml
@@ -0,0 +1,22 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Holo.Light" />
+
+</resources>
diff --git a/samples/browseable/AgendaData/Application/res/values-v21/base-colors.xml b/samples/browseable/AgendaData/Application/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/AgendaData/Application/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/AgendaData/Application/res/values-v21/base-template-styles.xml b/samples/browseable/AgendaData/Application/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/AgendaData/Application/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/AgendaData/Application/res/values/base-strings.xml b/samples/browseable/AgendaData/Application/res/values/base-strings.xml
new file mode 100644
index 000000000..7f057a01d
--- /dev/null
+++ b/samples/browseable/AgendaData/Application/res/values/base-strings.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<resources>
+ <string name="app_name">AgendaData</string>
+ <string name="intro_message">
+ <![CDATA[
+
+
+ Syncs calendar events to your wearable at the press of a button, using the Wearable
+ DataApi to transmit data such as event time, description, and background image. The DataItems can be
+ deleted individually via an action on the event notifications, or all at once via a button on the
+ companion. When deleted using the notification action, a ConfirmationActivity is used to indicate
+ success or failure.
+
+
+ ]]>
+ </string>
+</resources>
diff --git a/samples/browseable/AgendaData/Application/res/values/strings.xml b/samples/browseable/AgendaData/Application/res/values/strings.xml
new file mode 100644
index 000000000..9969f4f24
--- /dev/null
+++ b/samples/browseable/AgendaData/Application/res/values/strings.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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 xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="get_events">Sync calendar events to wearable</string>
+ <string name="delete_events">Delete calendar events from wearable</string>
+ <string name="log">Log</string>
+</resources>
diff --git a/samples/browseable/AgendaData/Application/res/values/template-dimens.xml b/samples/browseable/AgendaData/Application/res/values/template-dimens.xml
new file mode 100644
index 000000000..39e710b5c
--- /dev/null
+++ b/samples/browseable/AgendaData/Application/res/values/template-dimens.xml
@@ -0,0 +1,32 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Define standard dimensions to comply with Holo-style grids and rhythm. -->
+
+ <dimen name="margin_tiny">4dp</dimen>
+ <dimen name="margin_small">8dp</dimen>
+ <dimen name="margin_medium">16dp</dimen>
+ <dimen name="margin_large">32dp</dimen>
+ <dimen name="margin_huge">64dp</dimen>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_medium</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/AgendaData/Application/res/values/template-styles.xml b/samples/browseable/AgendaData/Application/res/values/template-styles.xml
new file mode 100644
index 000000000..6e7d593dd
--- /dev/null
+++ b/samples/browseable/AgendaData/Application/res/values/template-styles.xml
@@ -0,0 +1,42 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+
+ <style name="Theme.Base" parent="android:Theme.Light" />
+
+ <style name="Theme.Sample" parent="Theme.Base" />
+
+ <style name="AppTheme" parent="Theme.Sample" />
+ <!-- Widget styling -->
+
+ <style name="Widget" />
+
+ <style name="Widget.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceMedium</item>
+ <item name="android:lineSpacingMultiplier">1.1</item>
+ </style>
+
+ <style name="Widget.SampleMessageTile">
+ <item name="android:background">@drawable/tile</item>
+ <item name="android:shadowColor">#7F000000</item>
+ <item name="android:shadowDy">-3.5</item>
+ <item name="android:shadowRadius">2</item>
+ </style>
+
+</resources>
diff --git a/samples/wearable/AgendaData/Application/src/main/java/com/example/android/wearable/agendadata/CalendarQueryService.java b/samples/browseable/AgendaData/Application/src/com.example.android.wearable.agendadata/CalendarQueryService.java
index c39a5ed1b..c39a5ed1b 100644
--- a/samples/wearable/AgendaData/Application/src/main/java/com/example/android/wearable/agendadata/CalendarQueryService.java
+++ b/samples/browseable/AgendaData/Application/src/com.example.android.wearable.agendadata/CalendarQueryService.java
diff --git a/samples/wearable/AgendaData/Application/src/main/java/com/example/android/wearable/agendadata/Constants.java b/samples/browseable/AgendaData/Application/src/com.example.android.wearable.agendadata/Constants.java
index 6dc6952ca..6dc6952ca 100644
--- a/samples/wearable/AgendaData/Application/src/main/java/com/example/android/wearable/agendadata/Constants.java
+++ b/samples/browseable/AgendaData/Application/src/com.example.android.wearable.agendadata/Constants.java
diff --git a/samples/wearable/AgendaData/Application/src/main/java/com/example/android/wearable/agendadata/MainActivity.java b/samples/browseable/AgendaData/Application/src/com.example.android.wearable.agendadata/MainActivity.java
index 8e4063d8c..8e4063d8c 100644
--- a/samples/wearable/AgendaData/Application/src/main/java/com/example/android/wearable/agendadata/MainActivity.java
+++ b/samples/browseable/AgendaData/Application/src/com.example.android.wearable.agendadata/MainActivity.java
diff --git a/samples/browseable/AgendaData/Wearable/AndroidManifest.xml b/samples/browseable/AgendaData/Wearable/AndroidManifest.xml
new file mode 100644
index 000000000..dcab6227a
--- /dev/null
+++ b/samples/browseable/AgendaData/Wearable/AndroidManifest.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.wearable.agendadata" >
+
+ <uses-sdk android:minSdkVersion="20"
+ android:targetSdkVersion="21" />
+
+ <uses-feature android:name="android.hardware.type.watch" />
+
+ <application
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ >
+
+ <meta-data
+ android:name="com.google.android.gms.version"
+ android:value="@integer/google_play_services_version" />
+
+ <service
+ android:name="com.example.android.wearable.agendadata.HomeListenerService" >
+ <intent-filter>
+ <action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
+ </intent-filter>
+ </service>
+
+ <service android:name="com.example.android.wearable.agendadata.DeleteService"/>
+
+ <activity android:name="android.support.wearable.activity.ConfirmationActivity"/>
+
+ </application>
+</manifest>
diff --git a/samples/wearable/AgendaData/Wearable/src/main/res/drawable-hdpi/ic_launcher.png b/samples/browseable/AgendaData/Wearable/res/drawable-hdpi/ic_launcher.png
index 0564717bb..0564717bb 100644
--- a/samples/wearable/AgendaData/Wearable/src/main/res/drawable-hdpi/ic_launcher.png
+++ b/samples/browseable/AgendaData/Wearable/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/AgendaData/Wearable/src/main/res/drawable-hdpi/ic_menu_delete.png b/samples/browseable/AgendaData/Wearable/res/drawable-hdpi/ic_menu_delete.png
index 24d8f6a4b..24d8f6a4b 100644
--- a/samples/wearable/AgendaData/Wearable/src/main/res/drawable-hdpi/ic_menu_delete.png
+++ b/samples/browseable/AgendaData/Wearable/res/drawable-hdpi/ic_menu_delete.png
Binary files differ
diff --git a/samples/wearable/AgendaData/Wearable/src/main/res/drawable-mdpi/ic_launcher.png b/samples/browseable/AgendaData/Wearable/res/drawable-mdpi/ic_launcher.png
index 0f4034743..0f4034743 100644
--- a/samples/wearable/AgendaData/Wearable/src/main/res/drawable-mdpi/ic_launcher.png
+++ b/samples/browseable/AgendaData/Wearable/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/AgendaData/Wearable/src/main/res/drawable-mdpi/ic_menu_delete.png b/samples/browseable/AgendaData/Wearable/res/drawable-mdpi/ic_menu_delete.png
index e2c8700c3..e2c8700c3 100644
--- a/samples/wearable/AgendaData/Wearable/src/main/res/drawable-mdpi/ic_menu_delete.png
+++ b/samples/browseable/AgendaData/Wearable/res/drawable-mdpi/ic_menu_delete.png
Binary files differ
diff --git a/samples/wearable/AgendaData/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/AgendaData/Wearable/res/drawable-xhdpi/ic_launcher.png
index d7705cfb0..d7705cfb0 100644
--- a/samples/wearable/AgendaData/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png
+++ b/samples/browseable/AgendaData/Wearable/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/AgendaData/Wearable/src/main/res/drawable-xhdpi/ic_menu_delete.png b/samples/browseable/AgendaData/Wearable/res/drawable-xhdpi/ic_menu_delete.png
index 65b9caed1..65b9caed1 100644
--- a/samples/wearable/AgendaData/Wearable/src/main/res/drawable-xhdpi/ic_menu_delete.png
+++ b/samples/browseable/AgendaData/Wearable/res/drawable-xhdpi/ic_menu_delete.png
Binary files differ
diff --git a/samples/wearable/AgendaData/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/AgendaData/Wearable/res/drawable-xxhdpi/ic_launcher.png
index f07299fd2..f07299fd2 100644
--- a/samples/wearable/AgendaData/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png
+++ b/samples/browseable/AgendaData/Wearable/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/AgendaData/Wearable/src/main/res/drawable-xxhdpi/ic_menu_delete.png b/samples/browseable/AgendaData/Wearable/res/drawable-xxhdpi/ic_menu_delete.png
index 8e9e78d43..8e9e78d43 100644
--- a/samples/wearable/AgendaData/Wearable/src/main/res/drawable-xxhdpi/ic_menu_delete.png
+++ b/samples/browseable/AgendaData/Wearable/res/drawable-xxhdpi/ic_menu_delete.png
Binary files differ
diff --git a/samples/wearable/AgendaData/Wearable/src/main/res/values/strings.xml b/samples/browseable/AgendaData/Wearable/res/values/strings.xml
index 10ef53c4a..10ef53c4a 100644
--- a/samples/wearable/AgendaData/Wearable/src/main/res/values/strings.xml
+++ b/samples/browseable/AgendaData/Wearable/res/values/strings.xml
diff --git a/samples/wearable/AgendaData/Wearable/src/main/java/com/example/android/wearable/agendadata/Constants.java b/samples/browseable/AgendaData/Wearable/src/com.example.android.wearable.agendadata/Constants.java
index 176a21eb1..176a21eb1 100644
--- a/samples/wearable/AgendaData/Wearable/src/main/java/com/example/android/wearable/agendadata/Constants.java
+++ b/samples/browseable/AgendaData/Wearable/src/com.example.android.wearable.agendadata/Constants.java
diff --git a/samples/wearable/AgendaData/Wearable/src/main/java/com/example/android/wearable/agendadata/DeleteService.java b/samples/browseable/AgendaData/Wearable/src/com.example.android.wearable.agendadata/DeleteService.java
index 86aafe03d..86aafe03d 100644
--- a/samples/wearable/AgendaData/Wearable/src/main/java/com/example/android/wearable/agendadata/DeleteService.java
+++ b/samples/browseable/AgendaData/Wearable/src/com.example.android.wearable.agendadata/DeleteService.java
diff --git a/samples/wearable/AgendaData/Wearable/src/main/java/com/example/android/wearable/agendadata/HomeListenerService.java b/samples/browseable/AgendaData/Wearable/src/com.example.android.wearable.agendadata/HomeListenerService.java
index ef47977e3..ef47977e3 100644
--- a/samples/wearable/AgendaData/Wearable/src/main/java/com/example/android/wearable/agendadata/HomeListenerService.java
+++ b/samples/browseable/AgendaData/Wearable/src/com.example.android.wearable.agendadata/HomeListenerService.java
diff --git a/samples/browseable/AgendaData/_index.jd b/samples/browseable/AgendaData/_index.jd
new file mode 100644
index 000000000..7586b50ef
--- /dev/null
+++ b/samples/browseable/AgendaData/_index.jd
@@ -0,0 +1,13 @@
+page.tags="AgendaData"
+sample.group=Wearable
+@jd:body
+
+<p>
+
+ Syncs calendar events to your wearable at the press of a button, using the Wearable
+ DataApi to transmit data such as event time, description, and background image. The DataItems can be
+ deleted individually via an action on the event notifications, or all at once via a button on the
+ companion. When deleted using the notification action, a ConfirmationActivity is used to indicate
+ success or failure.
+
+ </p>
diff --git a/samples/browseable/AppRestrictionEnforcer/res/values-v21/base-colors.xml b/samples/browseable/AppRestrictionEnforcer/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/AppRestrictionEnforcer/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/AppRestrictionEnforcer/res/values-v21/base-template-styles.xml b/samples/browseable/AppRestrictionEnforcer/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/AppRestrictionEnforcer/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/AppRestrictionEnforcer/res/values-v21/template-styles.xml b/samples/browseable/AppRestrictionEnforcer/res/values-v21/template-styles.xml
deleted file mode 100644
index 134fcd9d3..000000000
--- a/samples/browseable/AppRestrictionEnforcer/res/values-v21/template-styles.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<!--
- Copyright 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<resources>
-
- <!-- Activity themes -->
- <style name="Theme.Base" parent="android:Theme.Material.Light" />
-
-</resources>
diff --git a/samples/browseable/AppRestrictionSchema/res/values-v21/base-colors.xml b/samples/browseable/AppRestrictionSchema/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/AppRestrictionSchema/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/AppRestrictionSchema/res/values-v21/base-template-styles.xml b/samples/browseable/AppRestrictionSchema/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/AppRestrictionSchema/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/AppRestrictionSchema/res/values-v21/template-styles.xml b/samples/browseable/AppRestrictionSchema/res/values-v21/template-styles.xml
deleted file mode 100644
index 134fcd9d3..000000000
--- a/samples/browseable/AppRestrictionSchema/res/values-v21/template-styles.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<!--
- Copyright 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<resources>
-
- <!-- Activity themes -->
- <style name="Theme.Base" parent="android:Theme.Material.Light" />
-
-</resources>
diff --git a/samples/browseable/AppRestrictions/AndroidManifest.xml b/samples/browseable/AppRestrictions/AndroidManifest.xml
index b492bbfce..ddac9cfd1 100644
--- a/samples/browseable/AppRestrictions/AndroidManifest.xml
+++ b/samples/browseable/AppRestrictions/AndroidManifest.xml
@@ -22,7 +22,7 @@
android:versionCode="1"
android:versionName="1.0">
- <uses-sdk android:minSdkVersion="18" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<application android:label="@string/app_name"
android:icon="@drawable/ic_launcher">
diff --git a/samples/browseable/AppRestrictions/_index.jd b/samples/browseable/AppRestrictions/_index.jd
index 83aa08cb7..e0c8b2df8 100644
--- a/samples/browseable/AppRestrictions/_index.jd
+++ b/samples/browseable/AppRestrictions/_index.jd
@@ -1,6 +1,3 @@
-
-
-
page.tags="AppRestrictions"
sample.group=Content
@jd:body
diff --git a/samples/browseable/AppRestrictions/res/values-v21/base-colors.xml b/samples/browseable/AppRestrictions/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/AppRestrictions/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/AppRestrictions/res/values-v21/base-template-styles.xml b/samples/browseable/AppRestrictions/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/AppRestrictions/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/AppRestrictions/res/values/base-strings.xml b/samples/browseable/AppRestrictions/res/values/base-strings.xml
index 08a466397..d90326c59 100644
--- a/samples/browseable/AppRestrictions/res/values/base-strings.xml
+++ b/samples/browseable/AppRestrictions/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">AppRestrictions</string>
<string name="intro_message">
diff --git a/samples/browseable/BasicAccessibility/AndroidManifest.xml b/samples/browseable/BasicAccessibility/AndroidManifest.xml
index d61d7899e..281114db3 100644
--- a/samples/browseable/BasicAccessibility/AndroidManifest.xml
+++ b/samples/browseable/BasicAccessibility/AndroidManifest.xml
@@ -22,9 +22,7 @@
android:versionCode="1"
android:versionName="1.0">
- <uses-sdk
- android:minSdkVersion="11"
- android:targetSdkVersion="16" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<application
android:allowBackup="true"
diff --git a/samples/browseable/BasicAccessibility/_index.jd b/samples/browseable/BasicAccessibility/_index.jd
index 761aa117e..91c34ec21 100644
--- a/samples/browseable/BasicAccessibility/_index.jd
+++ b/samples/browseable/BasicAccessibility/_index.jd
@@ -1,12 +1,9 @@
-
-
-
page.tags="BasicAccessibility"
sample.group=UI
@jd:body
-<p>This sample demonstrates how to create applications that are accessible for
-users with visual or physical disabilities.</p>
-<p>To learn how to make the most of the accessibility features built into
-the Android framework, see
-<a href="{@docRoot}training/accessibility/index.html">Implementing Accessibility</a>.</p>
+<p>
+
+ This sample demonstrates how to create an accessible application, using a mix of different widgets demonstrating different ways of adding accessibility markup to a UI.
+
+ </p>
diff --git a/samples/browseable/BasicAccessibility/res/drawable-hdpi/ic_launcher.png b/samples/browseable/BasicAccessibility/res/drawable-hdpi/ic_launcher.png
index 6c0b5ee4e..c8342cb3c 100644
--- a/samples/browseable/BasicAccessibility/res/drawable-hdpi/ic_launcher.png
+++ b/samples/browseable/BasicAccessibility/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/BasicAccessibility/res/drawable-mdpi/ic_launcher.png b/samples/browseable/BasicAccessibility/res/drawable-mdpi/ic_launcher.png
index 4ce0b8226..0e883dd9b 100644
--- a/samples/browseable/BasicAccessibility/res/drawable-mdpi/ic_launcher.png
+++ b/samples/browseable/BasicAccessibility/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/BasicAccessibility/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/BasicAccessibility/res/drawable-xhdpi/ic_launcher.png
index 6ded70731..4096b65b6 100644
--- a/samples/browseable/BasicAccessibility/res/drawable-xhdpi/ic_launcher.png
+++ b/samples/browseable/BasicAccessibility/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/BasicAccessibility/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/BasicAccessibility/res/drawable-xxhdpi/ic_launcher.png
index 74ae891e3..b00fc9bc8 100644
--- a/samples/browseable/BasicAccessibility/res/drawable-xxhdpi/ic_launcher.png
+++ b/samples/browseable/BasicAccessibility/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/BasicAccessibility/res/values-v21/base-colors.xml b/samples/browseable/BasicAccessibility/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/BasicAccessibility/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/BasicAccessibility/res/values-v21/base-template-styles.xml b/samples/browseable/BasicAccessibility/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/BasicAccessibility/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/BasicAccessibility/res/values/base-strings.xml b/samples/browseable/BasicAccessibility/res/values/base-strings.xml
index 20790c75d..ac4db70ad 100644
--- a/samples/browseable/BasicAccessibility/res/values/base-strings.xml
+++ b/samples/browseable/BasicAccessibility/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">BasicAccessibility</string>
<string name="intro_message">
diff --git a/samples/browseable/BasicAndroidKeyStore/AndroidManifest.xml b/samples/browseable/BasicAndroidKeyStore/AndroidManifest.xml
index 28d256c2d..1c3b255fa 100644
--- a/samples/browseable/BasicAndroidKeyStore/AndroidManifest.xml
+++ b/samples/browseable/BasicAndroidKeyStore/AndroidManifest.xml
@@ -22,7 +22,7 @@
android:versionCode="1"
android:versionName="1.0">
- <uses-sdk android:minSdkVersion="18" android:targetSdkVersion="19" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<application android:allowBackup="true"
android:label="@string/app_name"
diff --git a/samples/browseable/BasicAndroidKeyStore/_index.jd b/samples/browseable/BasicAndroidKeyStore/_index.jd
index 5b7af605c..5eedee8fa 100644
--- a/samples/browseable/BasicAndroidKeyStore/_index.jd
+++ b/samples/browseable/BasicAndroidKeyStore/_index.jd
@@ -1,15 +1,15 @@
-
-
-
page.tags="BasicAndroidKeyStore"
sample.group=Security
@jd:body
-<p>This sample demonstrates how to use a {java.security.KeyStore} to
-safely create and store encryption keys that only your application can access.
-You can also sign data using those keys.</p>
-<p>To see this in action, run the sample application and click:</p>
-<ul>
-<li><strong>Create</strong> to create a new KeyPair.</li>
-<li><strong>Sign</strong> to sign some data using a KeyPair.</li>
-<li><strong>Verify</strong> to verify the data using the signature provided.</li>
+<p>
+
+Welcome to the <b>Basic Android Key Store</b> sample!\n\n
+This sample demonstrates how to use the Android Key Store to safely create and store
+encryption keys that only your application can access. You can also sign data
+using those keys.\n\n
+To create a new KeyPair, click \"Create\".\n\n
+To sign some data using a KeyPair, click \"Sign\".\n\n
+To verify the data using the signature provided, click \"Verify\".\n\n
+
+ </p>
diff --git a/samples/browseable/BasicAndroidKeyStore/res/layout-sw600dp-land/activity_main.xml b/samples/browseable/BasicAndroidKeyStore/res/layout-sw600dp-land/activity_main.xml
index 653454bb2..8fed5f746 100644
--- a/samples/browseable/BasicAndroidKeyStore/res/layout-sw600dp-land/activity_main.xml
+++ b/samples/browseable/BasicAndroidKeyStore/res/layout-sw600dp-land/activity_main.xml
@@ -13,25 +13,30 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<LinearLayout
+<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="horizontal"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:fillViewport="true"
android:id="@+id/sample_main_layout">
- <TextView android:id="@+id/sample_output"
- style="@style/Widget.SampleMessage"
- android:background="@android:color/white"
- android:layout_weight="1"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:text="@string/intro_message"
- android:layout_margin="16dp" />
- <fragment
- android:name="com.example.android.common.logger.LogFragment"
- android:id="@+id/log_fragment"
- android:layout_weight="1"
+ <LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_margin="16dp" />
-</LinearLayout>
+ android:orientation="vertical">
+ <TextView android:id="@+id/sample_output"
+ style="@style/Widget.SampleMessage"
+ android:background="@android:color/white"
+ android:layout_weight="1"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:text="@string/intro_message"
+ android:layout_margin="16dp" />
+ <fragment
+ android:name="com.example.android.common.logger.LogFragment"
+ android:id="@+id/log_fragment"
+ android:layout_weight="1"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_margin="16dp" />
+ </LinearLayout>
+</ScrollView>
diff --git a/samples/browseable/BasicAndroidKeyStore/res/layout-sw600dp/activity_main.xml b/samples/browseable/BasicAndroidKeyStore/res/layout-sw600dp/activity_main.xml
index 11cd71b8e..f811ef7dc 100644
--- a/samples/browseable/BasicAndroidKeyStore/res/layout-sw600dp/activity_main.xml
+++ b/samples/browseable/BasicAndroidKeyStore/res/layout-sw600dp/activity_main.xml
@@ -13,24 +13,28 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<LinearLayout
+<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:fillViewport="true"
android:id="@+id/sample_main_layout">
- <TextView android:id="@+id/sample_output"
- style="@style/Widget.SampleMessage"
- android:background="@android:color/white"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="@string/intro_message"
- android:padding="16dp"
- android:layout_margin="16dp"/>
- <fragment
- android:name="com.example.android.common.logger.LogFragment"
- android:id="@+id/log_fragment"
+ <LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_margin="16dp" />
-</LinearLayout>
+ android:orientation="vertical">
+ <TextView android:id="@+id/sample_output"
+ style="@style/Widget.SampleMessage"
+ android:background="@android:color/white"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:padding="16dp"
+ android:layout_margin="16dp"/>
+ <fragment
+ android:name="com.example.android.common.logger.LogFragment"
+ android:id="@+id/log_fragment"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_margin="16dp" />
+ </LinearLayout>
+</ScrollView>
diff --git a/samples/browseable/BasicAndroidKeyStore/res/layout/activity_main.xml b/samples/browseable/BasicAndroidKeyStore/res/layout/activity_main.xml
index 6f41369cf..d17095875 100644
--- a/samples/browseable/BasicAndroidKeyStore/res/layout/activity_main.xml
+++ b/samples/browseable/BasicAndroidKeyStore/res/layout/activity_main.xml
@@ -13,27 +13,31 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<LinearLayout
+<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:fillViewport="true"
android:id="@+id/sample_main_layout">
- <TextView android:id="@+id/sample_output"
- style="@style/Widget.SampleMessage"
- android:layout_weight="1"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:text="@string/intro_message"
- android:padding="16dp" />
- <View
- android:layout_width="fill_parent"
- android:layout_height="1dp"
- android:background="@android:color/darker_gray"/>
- <fragment
- android:name="com.example.android.common.logger.LogFragment"
- android:id="@+id/log_fragment"
- android:layout_weight="1"
+ <LinearLayout
android:layout_width="match_parent"
- android:layout_height="match_parent" />
-</LinearLayout>
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+ <TextView android:id="@+id/sample_output"
+ style="@style/Widget.SampleMessage"
+ android:layout_weight="1"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:padding="16dp" />
+ <View
+ android:layout_width="fill_parent"
+ android:layout_height="1dp"
+ android:background="@android:color/darker_gray"/>
+ <fragment
+ android:name="com.example.android.common.logger.LogFragment"
+ android:id="@+id/log_fragment"
+ android:layout_weight="1"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" />
+ </LinearLayout>
+</ScrollView>
diff --git a/samples/browseable/BasicAndroidKeyStore/res/values-v21/base-colors.xml b/samples/browseable/BasicAndroidKeyStore/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/BasicAndroidKeyStore/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/BasicAndroidKeyStore/res/values-v21/base-template-styles.xml b/samples/browseable/BasicAndroidKeyStore/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/BasicAndroidKeyStore/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/BasicAndroidKeyStore/res/values/base-strings.xml b/samples/browseable/BasicAndroidKeyStore/res/values/base-strings.xml
index 0699a4aee..7a83818c1 100644
--- a/samples/browseable/BasicAndroidKeyStore/res/values/base-strings.xml
+++ b/samples/browseable/BasicAndroidKeyStore/res/values/base-strings.xml
@@ -14,22 +14,20 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">BasicAndroidKeyStore</string>
<string name="intro_message">
<![CDATA[
-
- Welcome to the <b>Basic Android Key Store</b> sample!\n\n
- This sample demonstrates how to use the Android Key Store to safely create and store
- encryption keys that only your application can access. You can also sign data
- using those keys.\n\n
- To create a new KeyPair, click \"Create\".\n\n
- To sign some data using a KeyPair, click \"Sign\".\n\n
- To verify the data using the signature provided, click \"Verify\".\n\n
+
+Welcome to the <b>Basic Android Key Store</b> sample!\n\n
+This sample demonstrates how to use the Android Key Store to safely create and store
+encryption keys that only your application can access. You can also sign data
+using those keys.\n\n
+To create a new KeyPair, click \"Create\".\n\n
+To sign some data using a KeyPair, click \"Sign\".\n\n
+To verify the data using the signature provided, click \"Verify\".\n\n
+
]]>
</string>
diff --git a/samples/browseable/BasicAndroidKeyStore/src/com.example.android.basicandroidkeystore/MainActivity.java b/samples/browseable/BasicAndroidKeyStore/src/com.example.android.basicandroidkeystore/MainActivity.java
index 7711f3506..f322af57f 100644
--- a/samples/browseable/BasicAndroidKeyStore/src/com.example.android.basicandroidkeystore/MainActivity.java
+++ b/samples/browseable/BasicAndroidKeyStore/src/com.example.android.basicandroidkeystore/MainActivity.java
@@ -14,14 +14,13 @@
* limitations under the License.
*/
-
-
-
package com.example.android.basicandroidkeystore;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;
+import android.text.Html;
+import android.widget.TextView;
import android.view.Menu;
import com.example.android.common.activities.SampleActivityBase;
@@ -44,6 +43,8 @@ public class MainActivity extends SampleActivityBase {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
+ TextView sampleOutput = (TextView) findViewById(R.id.sample_output);
+ sampleOutput.setText(Html.fromHtml(getString(R.string.intro_message)));
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
BasicAndroidKeyStoreFragment fragment = new BasicAndroidKeyStoreFragment();
@@ -78,4 +79,4 @@ public class MainActivity extends SampleActivityBase {
Log.i(TAG, "Ready");
}
-} \ No newline at end of file
+}
diff --git a/samples/browseable/BasicContactables/AndroidManifest.xml b/samples/browseable/BasicContactables/AndroidManifest.xml
index 62b9812cc..079db2334 100644
--- a/samples/browseable/BasicContactables/AndroidManifest.xml
+++ b/samples/browseable/BasicContactables/AndroidManifest.xml
@@ -23,9 +23,7 @@
<!-- BEGIN_INCLUDE(contacts_permission) -->
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<!-- END_INCLUDE(contacts_permission) -->
- <uses-sdk
- android:minSdkVersion="18"
- android:targetSdkVersion="18" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<permission android:name="android"></permission>
<application
diff --git a/samples/browseable/BasicContactables/_index.jd b/samples/browseable/BasicContactables/_index.jd
index f5bb3fce4..8a0a506a3 100644
--- a/samples/browseable/BasicContactables/_index.jd
+++ b/samples/browseable/BasicContactables/_index.jd
@@ -1,13 +1,11 @@
-
-
-
page.tags="BasicContactables"
sample.group=Content
@jd:body
-<p>This sample demonstrates how to use the
-{@link android.provider.ContactsContract.Data} table to search for contacts.</p>
-<p>The sample sends consolidated query strings to the
-{@link android.provider.ContactsContract.Data} table to match both contact
-names and phone numbers. This approach helps to reduce the number of
-queries needed when searching the contacts database.</p>
+<p>
+
+ This sample demonstrates how to use the Contactables table to search for contacts.
+ \n\nQuery strings sent to the Contactables table will match both contact names and phone numbers,
+ reducing the number of queries your application needs to use when searching the contacts database!
+
+ </p>
diff --git a/samples/browseable/BasicContactables/res/values-v21/base-colors.xml b/samples/browseable/BasicContactables/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/BasicContactables/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/BasicContactables/res/values-v21/base-template-styles.xml b/samples/browseable/BasicContactables/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/BasicContactables/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/BasicContactables/res/values/base-strings.xml b/samples/browseable/BasicContactables/res/values/base-strings.xml
index 0fc07ef4a..acbaaf5d4 100644
--- a/samples/browseable/BasicContactables/res/values/base-strings.xml
+++ b/samples/browseable/BasicContactables/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">BasicContactables</string>
<string name="intro_message">
diff --git a/samples/browseable/BasicGestureDetect/AndroidManifest.xml b/samples/browseable/BasicGestureDetect/AndroidManifest.xml
index 87ed60345..aaa4f41c1 100644
--- a/samples/browseable/BasicGestureDetect/AndroidManifest.xml
+++ b/samples/browseable/BasicGestureDetect/AndroidManifest.xml
@@ -22,7 +22,7 @@
android:versionCode="1"
android:versionName="1.0">
- <uses-sdk android:minSdkVersion="13" android:targetSdkVersion="17" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<application android:allowBackup="true"
android:label="@string/app_name"
diff --git a/samples/browseable/BasicGestureDetect/_index.jd b/samples/browseable/BasicGestureDetect/_index.jd
index 762217ad6..1e5d0d26c 100644
--- a/samples/browseable/BasicGestureDetect/_index.jd
+++ b/samples/browseable/BasicGestureDetect/_index.jd
@@ -1,12 +1,10 @@
-
-
-
page.tags="BasicGestureDetect"
sample.group=Input
@jd:body
-<p>This sample demonstrates how to use the {@link android.view.GestureDetector}
-API to detect simple dragging and tapping gestures.</p>
-<p>To learn more about detecting basic touch gestures such as scrolling,
-flinging, and double-tapping, see
-<a href="{@docRoot}training/gestures/detector.html">Detecting Common Gestures</a>.</p>
+<p>
+
+ Welcome to Basic Gesture Detect!
+ In order to try this sample out, try dragging or tapping this text to see what happens!
+
+ </p>
diff --git a/samples/browseable/BasicGestureDetect/res/values-v21/base-colors.xml b/samples/browseable/BasicGestureDetect/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/BasicGestureDetect/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/BasicGestureDetect/res/values-v21/base-template-styles.xml b/samples/browseable/BasicGestureDetect/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/BasicGestureDetect/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/BasicGestureDetect/res/values/base-strings.xml b/samples/browseable/BasicGestureDetect/res/values/base-strings.xml
index e9ce7cd0d..8b96af7a1 100644
--- a/samples/browseable/BasicGestureDetect/res/values/base-strings.xml
+++ b/samples/browseable/BasicGestureDetect/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">BasicGestureDetect</string>
<string name="intro_message">
diff --git a/samples/browseable/BasicGestureDetect/res/values/strings.xml b/samples/browseable/BasicGestureDetect/res/values/strings.xml
index c047c4fcc..826d90f15 100644
--- a/samples/browseable/BasicGestureDetect/res/values/strings.xml
+++ b/samples/browseable/BasicGestureDetect/res/values/strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="sample_action">Clear Text</string>
</resources>
diff --git a/samples/browseable/BasicGestureDetect/src/com.example.android.basicgesturedetect/MainActivity.java b/samples/browseable/BasicGestureDetect/src/com.example.android.basicgesturedetect/MainActivity.java
index de4a39f82..57d935447 100644
--- a/samples/browseable/BasicGestureDetect/src/com.example.android.basicgesturedetect/MainActivity.java
+++ b/samples/browseable/BasicGestureDetect/src/com.example.android.basicgesturedetect/MainActivity.java
@@ -14,9 +14,6 @@
* limitations under the License.
*/
-
-
-
package com.example.android.basicgesturedetect;
import android.graphics.Color;
diff --git a/samples/browseable/BasicImmersiveMode/AndroidManifest.xml b/samples/browseable/BasicImmersiveMode/AndroidManifest.xml
index 00b4e3c64..d483d5bf0 100644
--- a/samples/browseable/BasicImmersiveMode/AndroidManifest.xml
+++ b/samples/browseable/BasicImmersiveMode/AndroidManifest.xml
@@ -19,7 +19,7 @@
android:versionCode="1"
android:versionName="1.0">
- <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="19" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<application android:allowBackup="true"
android:label="@string/app_name"
diff --git a/samples/browseable/BasicImmersiveMode/_index.jd b/samples/browseable/BasicImmersiveMode/_index.jd
index 625e7a2ac..15298470c 100644
--- a/samples/browseable/BasicImmersiveMode/_index.jd
+++ b/samples/browseable/BasicImmersiveMode/_index.jd
@@ -1,12 +1,11 @@
-
-
-
page.tags="BasicImmersiveMode"
sample.group=UI
@jd:body
-<p>Android 4.4 introduces a way for you to provide a more immersive screen
-experience in your app, by letting users show or hide the status bar and
-navigation bar with a swipe.</p>
-<p>This sample demonstrates how to enable and disable this feature
-programmatically.</p>
+<p>
+
+ \"Immersive Mode\" is a new UI mode which improves \"hide full screen\" and
+ \"hide nav bar\" modes, by letting users swipe the bars in and out. This sample
+ demonstrates how to enable and disable immersive mode programmatically.
+
+ </p>
diff --git a/samples/browseable/BasicImmersiveMode/res/values-v21/base-colors.xml b/samples/browseable/BasicImmersiveMode/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/BasicImmersiveMode/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/BasicImmersiveMode/res/values-v21/base-template-styles.xml b/samples/browseable/BasicImmersiveMode/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/BasicImmersiveMode/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/BasicImmersiveMode/res/values/base-strings.xml b/samples/browseable/BasicImmersiveMode/res/values/base-strings.xml
index 20a06479b..46ee0f5d3 100644
--- a/samples/browseable/BasicImmersiveMode/res/values/base-strings.xml
+++ b/samples/browseable/BasicImmersiveMode/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">BasicImmersiveMode</string>
<string name="intro_message">
diff --git a/samples/browseable/BasicImmersiveMode/res/values/strings.xml b/samples/browseable/BasicImmersiveMode/res/values/strings.xml
index e845261aa..dc12528d2 100644
--- a/samples/browseable/BasicImmersiveMode/res/values/strings.xml
+++ b/samples/browseable/BasicImmersiveMode/res/values/strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="sample_action">Toggle Immersive Mode!</string>
</resources>
diff --git a/samples/browseable/BasicImmersiveMode/src/com.example.android.basicimmersivemode/MainActivity.java b/samples/browseable/BasicImmersiveMode/src/com.example.android.basicimmersivemode/MainActivity.java
index 0c1bcefed..5ffe90295 100644
--- a/samples/browseable/BasicImmersiveMode/src/com.example.android.basicimmersivemode/MainActivity.java
+++ b/samples/browseable/BasicImmersiveMode/src/com.example.android.basicimmersivemode/MainActivity.java
@@ -14,9 +14,6 @@
* limitations under the License.
*/
-
-
-
package com.example.android.basicimmersivemode;
import android.graphics.Color;
diff --git a/samples/browseable/BasicManagedProfile/res/values-v21/base-colors.xml b/samples/browseable/BasicManagedProfile/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/BasicManagedProfile/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/BasicManagedProfile/res/values-v21/base-template-styles.xml b/samples/browseable/BasicManagedProfile/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/BasicManagedProfile/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/BasicManagedProfile/res/values-v21/template-styles.xml b/samples/browseable/BasicManagedProfile/res/values-v21/template-styles.xml
deleted file mode 100644
index 134fcd9d3..000000000
--- a/samples/browseable/BasicManagedProfile/res/values-v21/template-styles.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<!--
- Copyright 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<resources>
-
- <!-- Activity themes -->
- <style name="Theme.Base" parent="android:Theme.Material.Light" />
-
-</resources>
diff --git a/samples/browseable/BasicMediaDecoder/AndroidManifest.xml b/samples/browseable/BasicMediaDecoder/AndroidManifest.xml
index d19149110..02a674e77 100644
--- a/samples/browseable/BasicMediaDecoder/AndroidManifest.xml
+++ b/samples/browseable/BasicMediaDecoder/AndroidManifest.xml
@@ -20,7 +20,8 @@
android:versionCode="1"
android:versionName="1.0">
- <uses-sdk android:minSdkVersion="17"/>
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
+
<application
android:label="@string/app_name" android:icon="@drawable/ic_launcher">
<activity
diff --git a/samples/browseable/BasicMediaDecoder/_index.jd b/samples/browseable/BasicMediaDecoder/_index.jd
index 3d1a33c21..769d8a666 100644
--- a/samples/browseable/BasicMediaDecoder/_index.jd
+++ b/samples/browseable/BasicMediaDecoder/_index.jd
@@ -1,9 +1,10 @@
-
-
-
page.tags="BasicMediaDecoder"
sample.group=Media
@jd:body
-<p>This sample demonstrates how to decode a video using
-the {@link android.media.MediaCodec} API and render in an activity.</p>
+<p>
+
+ This activity uses a TextureView to render the frames of a video decoded using the
+ MediaCodec API.
+
+ </p>
diff --git a/samples/browseable/BasicMediaDecoder/res/values-v21/base-colors.xml b/samples/browseable/BasicMediaDecoder/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/BasicMediaDecoder/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/BasicMediaDecoder/res/values-v21/base-template-styles.xml b/samples/browseable/BasicMediaDecoder/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/BasicMediaDecoder/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/BasicMediaDecoder/res/values/base-strings.xml b/samples/browseable/BasicMediaDecoder/res/values/base-strings.xml
index 94d02a896..73405222b 100644
--- a/samples/browseable/BasicMediaDecoder/res/values/base-strings.xml
+++ b/samples/browseable/BasicMediaDecoder/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">BasicMediaDecoder</string>
<string name="intro_message">
diff --git a/samples/browseable/BasicMediaRouter/AndroidManifest.xml b/samples/browseable/BasicMediaRouter/AndroidManifest.xml
index 33c20d582..f84b7dfea 100644
--- a/samples/browseable/BasicMediaRouter/AndroidManifest.xml
+++ b/samples/browseable/BasicMediaRouter/AndroidManifest.xml
@@ -20,9 +20,7 @@
android:versionCode="1"
android:versionName="1.0" >
- <uses-sdk
- android:minSdkVersion="17"
- android:targetSdkVersion="17" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<application
android:allowBackup="true"
diff --git a/samples/browseable/BasicMediaRouter/_index.jd b/samples/browseable/BasicMediaRouter/_index.jd
index 54081ede7..9d2f3f5b9 100644
--- a/samples/browseable/BasicMediaRouter/_index.jd
+++ b/samples/browseable/BasicMediaRouter/_index.jd
@@ -1,18 +1,14 @@
-
-
-
page.tags="BasicMediaRouter"
sample.group=Media
@jd:body
-<p>This sample demonstrates how to use the {@link android.media.MediaRouter}
-API to display content on a secondary display.</p>
-<p>To see this in action, run the sample and use the
-<strong>Media Route Action Item</strong> in the action bar to select an
-output device. If your device supports Miracast wireless displays, you may
-need to enable <strong>Wireless Display</strong> functionality in the
-system settings.</p>
-<p>You can also enable secondary screen simulation from the
-<em>Developer options</em> in the system Settings. Once
-connected, use the <strong>Change Color</strong> button to change the
-background color of the secondary screen.</p>
+<p>
+
+ This sample demonstrates the use of the MediaRouter API to display
+ content on a secondary display.\n\nUse the "Media Route Action Item" in the ActionBar
+ to select an output device. If your device supports Miracast wireless displays,
+ you may need to enable "Wireless Display" functionality in the system settings.
+ Secondary screen simulation can also be enabled from the "Developer Options".\n\n
+Once connected, use the "Change Color" button to change the background color of the secondary screen.
+
+ </p>
diff --git a/samples/browseable/BasicMediaRouter/res/values-v21/base-colors.xml b/samples/browseable/BasicMediaRouter/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/BasicMediaRouter/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/BasicMediaRouter/res/values-v21/base-template-styles.xml b/samples/browseable/BasicMediaRouter/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/BasicMediaRouter/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/BasicMediaRouter/res/values/base-strings.xml b/samples/browseable/BasicMediaRouter/res/values/base-strings.xml
index 211577118..6f16407f3 100644
--- a/samples/browseable/BasicMediaRouter/res/values/base-strings.xml
+++ b/samples/browseable/BasicMediaRouter/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">BasicMediaRouter</string>
<string name="intro_message">
diff --git a/samples/browseable/BasicMultitouch/AndroidManifest.xml b/samples/browseable/BasicMultitouch/AndroidManifest.xml
index 043345c19..fc11177cf 100644
--- a/samples/browseable/BasicMultitouch/AndroidManifest.xml
+++ b/samples/browseable/BasicMultitouch/AndroidManifest.xml
@@ -20,9 +20,7 @@
android:versionCode="1"
android:versionName="1.0" >
- <uses-sdk
- android:minSdkVersion="8"
- android:targetSdkVersion="17" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<application
android:allowBackup="true"
diff --git a/samples/browseable/BasicMultitouch/_index.jd b/samples/browseable/BasicMultitouch/_index.jd
index 43a1e9020..f09a7f433 100644
--- a/samples/browseable/BasicMultitouch/_index.jd
+++ b/samples/browseable/BasicMultitouch/_index.jd
@@ -1,12 +1,12 @@
-
-
-
page.tags="BasicMultitouch"
sample.group=Input
@jd:body
-<p>This samples demonstrates how to use the {@link android.view.MotionEvent}
-API to keep track of individual touches across multiple touch events.</p>
-<p>To see this in action, run the sample and touch the screen with multiple
-fingers to show that the pointer id (also represented by a colour) does not
-change as new touch events are received.</p>
+<p>
+
+This samples demonstrates the use of MotionEvent properties to keep track of individual touches
+across multiple touch events.
+\n\nTouch the screen with multiple fingers to show that the pointer id
+(also represented by a colour) does not change as new touch events are received.</string>
+
+ </p>
diff --git a/samples/browseable/BasicMultitouch/res/values-v21/base-colors.xml b/samples/browseable/BasicMultitouch/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/BasicMultitouch/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/BasicMultitouch/res/values-v21/base-template-styles.xml b/samples/browseable/BasicMultitouch/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/BasicMultitouch/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/BasicMultitouch/res/values/base-strings.xml b/samples/browseable/BasicMultitouch/res/values/base-strings.xml
index a5388a7d6..9079d1ed7 100644
--- a/samples/browseable/BasicMultitouch/res/values/base-strings.xml
+++ b/samples/browseable/BasicMultitouch/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">BasicMultitouch</string>
<string name="intro_message">
diff --git a/samples/browseable/BasicNetworking/AndroidManifest.xml b/samples/browseable/BasicNetworking/AndroidManifest.xml
index 48bfeac46..b51279007 100644
--- a/samples/browseable/BasicNetworking/AndroidManifest.xml
+++ b/samples/browseable/BasicNetworking/AndroidManifest.xml
@@ -20,7 +20,7 @@
android:versionCode="1"
android:versionName="1.0">
- <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
diff --git a/samples/browseable/BasicNetworking/_index.jd b/samples/browseable/BasicNetworking/_index.jd
index 223ba765a..3d17e0ad6 100644
--- a/samples/browseable/BasicNetworking/_index.jd
+++ b/samples/browseable/BasicNetworking/_index.jd
@@ -1,10 +1,12 @@
-
-
-
page.tags="BasicNetworking"
sample.group=Connectivity
@jd:body
-<p>This sample demonstrates how to use the
-{@link android.net.ConnectivityManager} to determine if the device has an
-active network connection, and if so, retrieve the connection type.</p>
+<p>
+
+ 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.
+
+ </p>
diff --git a/samples/browseable/BasicNetworking/res/drawable-hdpi/ic_launcher.png b/samples/browseable/BasicNetworking/res/drawable-hdpi/ic_launcher.png
index 22ce60611..fad6812b3 100755
--- a/samples/browseable/BasicNetworking/res/drawable-hdpi/ic_launcher.png
+++ b/samples/browseable/BasicNetworking/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/BasicNetworking/res/drawable-mdpi/ic_launcher.png b/samples/browseable/BasicNetworking/res/drawable-mdpi/ic_launcher.png
index f21e17b65..04cf11522 100755
--- a/samples/browseable/BasicNetworking/res/drawable-mdpi/ic_launcher.png
+++ b/samples/browseable/BasicNetworking/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/BasicNetworking/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/BasicNetworking/res/drawable-xhdpi/ic_launcher.png
index 64b805902..53736dfe1 100755
--- a/samples/browseable/BasicNetworking/res/drawable-xhdpi/ic_launcher.png
+++ b/samples/browseable/BasicNetworking/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/BasicNetworking/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/BasicNetworking/res/drawable-xxhdpi/ic_launcher.png
index 6b4434a87..6afbfca32 100755
--- a/samples/browseable/BasicNetworking/res/drawable-xxhdpi/ic_launcher.png
+++ b/samples/browseable/BasicNetworking/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/BasicNetworking/res/values-v21/base-colors.xml b/samples/browseable/BasicNetworking/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/BasicNetworking/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/BasicNetworking/res/values-v21/base-template-styles.xml b/samples/browseable/BasicNetworking/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/BasicNetworking/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/BasicNetworking/res/values/base-strings.xml b/samples/browseable/BasicNetworking/res/values/base-strings.xml
index 668bcdfb6..ddd695f95 100644
--- a/samples/browseable/BasicNetworking/res/values/base-strings.xml
+++ b/samples/browseable/BasicNetworking/res/values/base-strings.xml
@@ -14,19 +14,16 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">BasicNetworking</string>
<string name="intro_message">
<![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.
+ 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.
]]>
diff --git a/samples/browseable/BasicNotifications/AndroidManifest.xml b/samples/browseable/BasicNotifications/AndroidManifest.xml
index 1e37d0bf6..01f8e3a7a 100644
--- a/samples/browseable/BasicNotifications/AndroidManifest.xml
+++ b/samples/browseable/BasicNotifications/AndroidManifest.xml
@@ -20,9 +20,7 @@
android:versionCode="1"
android:versionName="1.0">
- <uses-sdk
- android:minSdkVersion="8"
- android:targetSdkVersion="17"/>
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<application
android:allowBackup="true"
diff --git a/samples/browseable/BasicNotifications/_index.jd b/samples/browseable/BasicNotifications/_index.jd
index 02a9b5677..d34b8fbc0 100644
--- a/samples/browseable/BasicNotifications/_index.jd
+++ b/samples/browseable/BasicNotifications/_index.jd
@@ -1,10 +1,11 @@
-
-
-
page.tags="BasicNotifications"
-sample.group=UI
+sample.group=Notification
@jd:body
-<p>This sample demonstrates how to display events in the system's notification
-bar. The {@link android.support.v4.app.NotificationCompat} API is used for
-compatibility with devices running Android 2.2 or higher.</p>
+<p>
+
+ This sample demonstrates how to display events in the system\'s notification bar. The
+ NotificationCompat API is used for compatibility with older devices, running Android
+ 2.2 (Froyo) or newer.
+
+ </p>
diff --git a/samples/browseable/BasicNotifications/res/values-v21/base-colors.xml b/samples/browseable/BasicNotifications/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/BasicNotifications/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/BasicNotifications/res/values-v21/base-template-styles.xml b/samples/browseable/BasicNotifications/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/BasicNotifications/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/BasicNotifications/res/values/base-strings.xml b/samples/browseable/BasicNotifications/res/values/base-strings.xml
index 15dafec61..87f5bf0c9 100644
--- a/samples/browseable/BasicNotifications/res/values/base-strings.xml
+++ b/samples/browseable/BasicNotifications/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">BasicNotifications</string>
<string name="intro_message">
diff --git a/samples/browseable/BasicRenderScript/AndroidManifest.xml b/samples/browseable/BasicRenderScript/AndroidManifest.xml
index e1e2dfc1b..3bc65ffa4 100644
--- a/samples/browseable/BasicRenderScript/AndroidManifest.xml
+++ b/samples/browseable/BasicRenderScript/AndroidManifest.xml
@@ -20,9 +20,7 @@
android:versionCode="1"
android:versionName="1.0">
- <uses-sdk
- android:minSdkVersion="8"
- android:targetSdkVersion="19" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<application
android:allowBackup="true"
diff --git a/samples/browseable/BasicRenderScript/_index.jd b/samples/browseable/BasicRenderScript/_index.jd
index a40a26422..3a4ffe0ff 100644
--- a/samples/browseable/BasicRenderScript/_index.jd
+++ b/samples/browseable/BasicRenderScript/_index.jd
@@ -1,13 +1,10 @@
-
-
-
page.tags="BasicRenderScript"
sample.group=RenderScript
@jd:body
<p>
- This sample demonstrates the basic steps for using RenderScript. In this
- example, the app uses <a href=
- "{@docRoot}guide/topics/renderscript/compute.html">RenderScript</a> to
- perform graphical filter operations on a image.
-</p>
+
+ BasicRenderScript sample demonstrates basic steps how to use renderScript.
+ In the sample, it performs graphical filter operation on a image with renderScript.
+
+ </p>
diff --git a/samples/browseable/BasicRenderScript/res/values-v21/base-colors.xml b/samples/browseable/BasicRenderScript/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/BasicRenderScript/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/BasicRenderScript/res/values-v21/base-template-styles.xml b/samples/browseable/BasicRenderScript/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/BasicRenderScript/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/BasicRenderScript/res/values/base-strings.xml b/samples/browseable/BasicRenderScript/res/values/base-strings.xml
index a35b3206f..36c701597 100644
--- a/samples/browseable/BasicRenderScript/res/values/base-strings.xml
+++ b/samples/browseable/BasicRenderScript/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">BasicRenderScript</string>
<string name="intro_message">
diff --git a/samples/browseable/BasicRenderScript/src/com.example.android.common.media/MediaCodecWrapper.java b/samples/browseable/BasicRenderScript/src/com.example.android.common.media/MediaCodecWrapper.java
index a511221f5..a48337404 100644
--- a/samples/browseable/BasicRenderScript/src/com.example.android.common.media/MediaCodecWrapper.java
+++ b/samples/browseable/BasicRenderScript/src/com.example.android.common.media/MediaCodecWrapper.java
@@ -21,6 +21,7 @@ import android.os.Handler;
import android.os.Looper;
import android.view.Surface;
+import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.ArrayDeque;
import java.util.Queue;
@@ -136,7 +137,7 @@ public class MediaCodecWrapper {
* @return
*/
public static MediaCodecWrapper fromVideoFormat(final MediaFormat trackFormat,
- Surface surface) {
+ Surface surface) throws IOException {
MediaCodecWrapper result = null;
MediaCodec videoCodec = null;
diff --git a/samples/browseable/BasicSyncAdapter/AndroidManifest.xml b/samples/browseable/BasicSyncAdapter/AndroidManifest.xml
index dd59b066a..4222b4790 100644
--- a/samples/browseable/BasicSyncAdapter/AndroidManifest.xml
+++ b/samples/browseable/BasicSyncAdapter/AndroidManifest.xml
@@ -23,9 +23,7 @@
android:versionName="1.0">
<!-- SyncAdapters are available in API 5 and above. We use API 7 as a baseline for samples. -->
- <uses-sdk
- android:minSdkVersion="7"
- android:targetSdkVersion="17" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<!-- Required for fetching feed data. -->
<uses-permission android:name="android.permission.INTERNET"/>
diff --git a/samples/browseable/BasicSyncAdapter/_index.jd b/samples/browseable/BasicSyncAdapter/_index.jd
index 7217e9a56..a079768e9 100644
--- a/samples/browseable/BasicSyncAdapter/_index.jd
+++ b/samples/browseable/BasicSyncAdapter/_index.jd
@@ -1,14 +1,14 @@
-
-
-
page.tags="BasicSyncAdapter"
sample.group=Connectivity
@jd:body
-<p>This sample demonstrates how to implement a sync adapter to fetch background
-data for an app that doesn't require a user-visible account type or two-way
-synchronization.</p>
-<p>The sample periodically downloads the feed from the <a href="http://android-developers.blogspot.com/">Android Developers Blog</a> and caches the data in a content provider. At runtime, the cached feed data is
-displayed inside a {@link android.widget.ListView}.</p>
-<p>To learn more about creating and using sync adapters, see
-<a href="{@docRoot}training/sync-adapters/index.html">Transferring Data Using Sync Adapters</a>.</p>
+<p>
+
+ 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.
+
+ </p>
diff --git a/samples/browseable/BasicSyncAdapter/res/drawable-hdpi/ic_launcher.png b/samples/browseable/BasicSyncAdapter/res/drawable-hdpi/ic_launcher.png
index a0f7005a3..7920c98ea 100644
--- a/samples/browseable/BasicSyncAdapter/res/drawable-hdpi/ic_launcher.png
+++ b/samples/browseable/BasicSyncAdapter/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/BasicSyncAdapter/res/drawable-mdpi/ic_launcher.png b/samples/browseable/BasicSyncAdapter/res/drawable-mdpi/ic_launcher.png
index a085462c2..1de60fe41 100644
--- a/samples/browseable/BasicSyncAdapter/res/drawable-mdpi/ic_launcher.png
+++ b/samples/browseable/BasicSyncAdapter/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/BasicSyncAdapter/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/BasicSyncAdapter/res/drawable-xhdpi/ic_launcher.png
index 4f78eb846..fc4bfebd5 100644
--- a/samples/browseable/BasicSyncAdapter/res/drawable-xhdpi/ic_launcher.png
+++ b/samples/browseable/BasicSyncAdapter/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/BasicSyncAdapter/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/BasicSyncAdapter/res/drawable-xxhdpi/ic_launcher.png
index b198ee3e9..646ce941d 100644
--- a/samples/browseable/BasicSyncAdapter/res/drawable-xxhdpi/ic_launcher.png
+++ b/samples/browseable/BasicSyncAdapter/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/BasicSyncAdapter/res/values-v21/base-colors.xml b/samples/browseable/BasicSyncAdapter/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/BasicSyncAdapter/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/BasicSyncAdapter/res/values-v21/base-template-styles.xml b/samples/browseable/BasicSyncAdapter/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/BasicSyncAdapter/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/BasicSyncAdapter/res/values/base-strings.xml b/samples/browseable/BasicSyncAdapter/res/values/base-strings.xml
index 26704848d..849d026e7 100644
--- a/samples/browseable/BasicSyncAdapter/res/values/base-strings.xml
+++ b/samples/browseable/BasicSyncAdapter/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">BasicSyncAdapter</string>
<string name="intro_message">
diff --git a/samples/browseable/BasicTransition/AndroidManifest.xml b/samples/browseable/BasicTransition/AndroidManifest.xml
index b4698d688..435f5e0c2 100644
--- a/samples/browseable/BasicTransition/AndroidManifest.xml
+++ b/samples/browseable/BasicTransition/AndroidManifest.xml
@@ -19,7 +19,7 @@
android:versionCode="1"
android:versionName="1.0">
- <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="19" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<application
android:allowBackup="true"
diff --git a/samples/browseable/BasicTransition/_index.jd b/samples/browseable/BasicTransition/_index.jd
index af2a6e739..16415f685 100644
--- a/samples/browseable/BasicTransition/_index.jd
+++ b/samples/browseable/BasicTransition/_index.jd
@@ -1,12 +1,10 @@
-
-
-
page.tags="BasicTransition"
sample.group=UI
@jd:body
<p>
-This sample demonstrates the basic use of the transition framework introduced in KitKat.
-Select each of the radio buttons to switch between the
-{@link android.transition.Scene Scene}s.
-</p>
+
+ This sample demonstrates the basic use of the transition framework introduced in KitKat.
+ Select each of the RadioButtons to switch between the Scenes.
+
+ </p>
diff --git a/samples/browseable/BasicTransition/res/values-v21/base-colors.xml b/samples/browseable/BasicTransition/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/BasicTransition/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/BasicTransition/res/values-v21/base-template-styles.xml b/samples/browseable/BasicTransition/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/BasicTransition/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/BasicTransition/res/values/base-strings.xml b/samples/browseable/BasicTransition/res/values/base-strings.xml
index 466e59069..d14eb5465 100644
--- a/samples/browseable/BasicTransition/res/values/base-strings.xml
+++ b/samples/browseable/BasicTransition/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">BasicTransition</string>
<string name="intro_message">
diff --git a/samples/browseable/BasicTransition/res/values/strings.xml b/samples/browseable/BasicTransition/res/values/strings.xml
index 319cf3151..319cf3151 100755..100644
--- a/samples/browseable/BasicTransition/res/values/strings.xml
+++ b/samples/browseable/BasicTransition/res/values/strings.xml
diff --git a/samples/browseable/BasicTransition/src/com.example.android.basictransition/MainActivity.java b/samples/browseable/BasicTransition/src/com.example.android.basictransition/MainActivity.java
index 1e7c3017b..7eeac2e6d 100644
--- a/samples/browseable/BasicTransition/src/com.example.android.basictransition/MainActivity.java
+++ b/samples/browseable/BasicTransition/src/com.example.android.basictransition/MainActivity.java
@@ -14,9 +14,6 @@
* limitations under the License.
*/
-
-
-
package com.example.android.basictransition;
import android.os.Bundle;
@@ -50,10 +47,12 @@ public class MainActivity extends SampleActivityBase {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
- FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
- BasicTransitionFragment fragment = new BasicTransitionFragment();
- transaction.replace(R.id.sample_content_fragment, fragment);
- transaction.commit();
+ if (savedInstanceState == null) {
+ FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
+ BasicTransitionFragment fragment = new BasicTransitionFragment();
+ transaction.replace(R.id.sample_content_fragment, fragment);
+ transaction.commit();
+ }
}
@Override
diff --git a/samples/browseable/BatchStepSensor/AndroidManifest.xml b/samples/browseable/BatchStepSensor/AndroidManifest.xml
index 2c4e4f296..9063770f3 100644
--- a/samples/browseable/BatchStepSensor/AndroidManifest.xml
+++ b/samples/browseable/BatchStepSensor/AndroidManifest.xml
@@ -23,7 +23,7 @@
android:versionName="1.0">
<!-- This sample requires at least Android KitKat for sensor batching support -->
- <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="19" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<!-- Require the step counter and step detector sensors.
See the method BatchStepSensorFragment#isKitkatWithStepSensor() for a programmatic check if
diff --git a/samples/browseable/BatchStepSensor/_index.jd b/samples/browseable/BatchStepSensor/_index.jd
index a361294a4..9a4f0b02e 100644
--- a/samples/browseable/BatchStepSensor/_index.jd
+++ b/samples/browseable/BatchStepSensor/_index.jd
@@ -1,27 +1,20 @@
-
-
-
page.tags="BatchStepSensor"
sample.group=Sensors
@jd:body
<p>
- This sample demonstrates the use of the two step sensors (step detector and
- counter) and sensor batching. It shows how to register a {@link
- android.hardware.SensorEventListener} with and without batching and shows how
- these events are received.
-</p>
-
-<p>
- The Step Detector sensor fires an event when a step is detected, while the
- step counter returns the total number of steps since a listener was first
- registered for this sensor. Both sensors only count steps while a listener is
- registered.
-</p>
-
-<p>
- This sample only covers the basic case, where a listener is only registered
- while the app is running. Likewise, batched sensors can be used in the
- background (when the CPU is suspended), which requires manually flushing the
- sensor event queue before it overflows, which is not covered in this sample.
-</p>
+
+ <p>This sample demonstrates the use of the two step sensors (step detector and counter) and
+ sensor batching.</p>
+ <p>It shows how to register a SensorEventListener with and without
+ batching and shows how these events are received.</p>
+ <p>The Step Detector sensor fires an
+ event when a step is detected, while the step counter returns the total number of
+ steps since a listener was first registered for this sensor.
+ Both sensors only count steps while a listener is registered. This sample only covers the
+ basic case, where a listener is only registered while the app is running. Likewise,
+ batched sensors can be used in the background (when the CPU is suspended), which
+ requires manually flushing the sensor event queue before it overflows, which is not
+ covered in this sample.</p>
+
+ </p>
diff --git a/samples/browseable/BatchStepSensor/res/drawable-v21/card_action_bg.xml b/samples/browseable/BatchStepSensor/res/drawable-v21/card_action_bg.xml
new file mode 100644
index 000000000..978415a75
--- /dev/null
+++ b/samples/browseable/BatchStepSensor/res/drawable-v21/card_action_bg.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 2014 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.
+-->
+<ripple xmlns:android="http://schemas.android.com/apk/res/android"
+ android:color="@color/card_action_ripple">
+ <item android:drawable="@color/card_action_item_bg" />
+</ripple>
diff --git a/samples/browseable/BatchStepSensor/res/drawable-v21/card_action_bg_negative.xml b/samples/browseable/BatchStepSensor/res/drawable-v21/card_action_bg_negative.xml
new file mode 100644
index 000000000..feed3c6db
--- /dev/null
+++ b/samples/browseable/BatchStepSensor/res/drawable-v21/card_action_bg_negative.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 2014 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.
+-->
+<ripple xmlns:android="http://schemas.android.com/apk/res/android"
+ android:color="@color/card_action_negative_ripple">
+ <item android:drawable="@color/card_action_item_bg" />
+</ripple>
diff --git a/samples/browseable/BatchStepSensor/res/drawable-v21/card_action_bg_positive.xml b/samples/browseable/BatchStepSensor/res/drawable-v21/card_action_bg_positive.xml
new file mode 100644
index 000000000..0d568cee6
--- /dev/null
+++ b/samples/browseable/BatchStepSensor/res/drawable-v21/card_action_bg_positive.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 2014 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.
+-->
+<ripple xmlns:android="http://schemas.android.com/apk/res/android"
+ android:color="@color/card_action_positive_ripple">
+ <item android:drawable="@color/card_action_item_bg" />
+</ripple>
diff --git a/samples/browseable/BatchStepSensor/res/layout/activity_main.xml b/samples/browseable/BatchStepSensor/res/layout/activity_main.xml
index 63f129787..a3c1fa9d0 100755
--- a/samples/browseable/BatchStepSensor/res/layout/activity_main.xml
+++ b/samples/browseable/BatchStepSensor/res/layout/activity_main.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<fragment
android:id="@+id/fragment_cardstream"
android:name="com.example.android.batchstepsensor.cardstream.CardStreamFragment"
diff --git a/samples/browseable/BatchStepSensor/res/layout/card.xml b/samples/browseable/BatchStepSensor/res/layout/card.xml
index 5deb6f5bb..6350e6a3d 100644
--- a/samples/browseable/BatchStepSensor/res/layout/card.xml
+++ b/samples/browseable/BatchStepSensor/res/layout/card.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<com.example.android.batchstepsensor.cardstream.CardLayout
android:id="@+id/card_layout"
style="@style/Card"
diff --git a/samples/browseable/BatchStepSensor/res/layout/card_button_negative.xml b/samples/browseable/BatchStepSensor/res/layout/card_button_negative.xml
index 7ca967720..86d9c2d2e 100644
--- a/samples/browseable/BatchStepSensor/res/layout/card_button_negative.xml
+++ b/samples/browseable/BatchStepSensor/res/layout/card_button_negative.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<com.example.android.batchstepsensor.cardstream.CardActionButton xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/card_button"
style="@style/CardActionNegative"
diff --git a/samples/browseable/BatchStepSensor/res/layout/card_button_neutral.xml b/samples/browseable/BatchStepSensor/res/layout/card_button_neutral.xml
index da7444870..c993df85d 100644
--- a/samples/browseable/BatchStepSensor/res/layout/card_button_neutral.xml
+++ b/samples/browseable/BatchStepSensor/res/layout/card_button_neutral.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<com.example.android.batchstepsensor.cardstream.CardActionButton xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/card_button"
style="@style/CardActionNeutral"
diff --git a/samples/browseable/BatchStepSensor/res/layout/card_button_positive.xml b/samples/browseable/BatchStepSensor/res/layout/card_button_positive.xml
index afbda8acf..7a3baf68c 100644
--- a/samples/browseable/BatchStepSensor/res/layout/card_button_positive.xml
+++ b/samples/browseable/BatchStepSensor/res/layout/card_button_positive.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<com.example.android.batchstepsensor.cardstream.CardActionButton xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/card_button"
style="@style/CardActionPositive"
diff --git a/samples/browseable/BatchStepSensor/res/layout/cardstream.xml b/samples/browseable/BatchStepSensor/res/layout/cardstream.xml
index a6b917bc0..889d69cbb 100644
--- a/samples/browseable/BatchStepSensor/res/layout/cardstream.xml
+++ b/samples/browseable/BatchStepSensor/res/layout/cardstream.xml
@@ -14,9 +14,6 @@
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:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/samples/browseable/BatchStepSensor/res/values-v21/base-colors.xml b/samples/browseable/BatchStepSensor/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/BatchStepSensor/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/BatchStepSensor/res/values-v21/base-template-styles.xml b/samples/browseable/BatchStepSensor/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/BatchStepSensor/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/BatchStepSensor/res/values/base-strings.xml b/samples/browseable/BatchStepSensor/res/values/base-strings.xml
index 341b6bc7b..3ff4b3d60 100644
--- a/samples/browseable/BatchStepSensor/res/values/base-strings.xml
+++ b/samples/browseable/BatchStepSensor/res/values/base-strings.xml
@@ -14,25 +14,24 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">BatchStepSensor</string>
<string name="intro_message">
<![CDATA[
- This sample demonstrates the use of the two step sensors (step detector and counter) and
- sensor batching.\n\n It shows how to register a SensorEventListener with and without
- batching and shows how these events are received.\n\nThe Step Detector sensor fires an
+ <p>This sample demonstrates the use of the two step sensors (step detector and counter) and
+ sensor batching.</p>
+ <p>It shows how to register a SensorEventListener with and without
+ batching and shows how these events are received.</p>
+ <p>The Step Detector sensor fires an
event when a step is detected, while the step counter returns the total number of
steps since a listener was first registered for this sensor.
Both sensors only count steps while a listener is registered. This sample only covers the
basic case, where a listener is only registered while the app is running. Likewise,
batched sensors can be used in the background (when the CPU is suspended), which
requires manually flushing the sensor event queue before it overflows, which is not
- covered in this sample.
+ covered in this sample.</p>
]]>
diff --git a/samples/browseable/BatchStepSensor/res/values/color.xml b/samples/browseable/BatchStepSensor/res/values/color.xml
index 98717d8d8..593ccfdfa 100644
--- a/samples/browseable/BatchStepSensor/res/values/color.xml
+++ b/samples/browseable/BatchStepSensor/res/values/color.xml
@@ -11,12 +11,15 @@
<!-- Neutral Actions -->
<color name="card_action_focused">#FFE3F4FC</color>
<color name="card_action">#FF47B4EA</color>
+ <color name="card_action_ripple">#CC47B4EA</color>
<!-- Negative Actions -->
<color name="card_action_negative_focused">#FFFBCBCA</color>
<color name="card_action_negative">#FFF64940</color>
+ <color name="card_action_negative_ripple">#CCF64940</color>
<!-- Positive Actions -->
<color name="card_action_positive_focused">#FFE4F0AF</color>
<color name="card_action_positive">#FFA0CC00</color>
-</resources> \ No newline at end of file
+ <color name="card_action_positive_ripple">#CCA0CC00</color>
+</resources>
diff --git a/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/MainActivity.java b/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/MainActivity.java
index 5e4f7e3e7..536269387 100644
--- a/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/MainActivity.java
+++ b/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/MainActivity.java
@@ -13,9 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-
-
package com.example.android.batchstepsensor;
import android.os.Bundle;
@@ -58,7 +55,7 @@ public class MainActivity extends SampleActivityBase implements CardStream {
}
// Use fragment as click listener for cards, but must implement correct interface
- if(!(fragment instanceof OnCardClickListener)){
+ if (!(fragment instanceof OnCardClickListener)){
throw new ClassCastException("BatchStepSensorFragment must " +
"implement OnCardClickListener interface.");
}
diff --git a/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/Card.java b/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/Card.java
index a3723e80c..2a342f6bd 100644
--- a/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/Card.java
+++ b/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/Card.java
@@ -14,9 +14,6 @@
* limitations under the License.
*/
-
-
-
package com.example.android.batchstepsensor.cardstream;
import android.animation.Animator;
diff --git a/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/CardActionButton.java b/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/CardActionButton.java
index 01c7094fb..054cc7248 100644
--- a/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/CardActionButton.java
+++ b/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/CardActionButton.java
@@ -14,12 +14,11 @@
* limitations under the License.
*/
-
-
-
package com.example.android.batchstepsensor.cardstream;
import android.content.Context;
+import android.os.Build;
+import android.support.v4.view.ViewCompat;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.animation.BounceInterpolator;
@@ -46,20 +45,28 @@ public class CardActionButton extends Button {
@Override
public boolean onTouchEvent(MotionEvent event) {
- switch(event.getAction()){
- case MotionEvent.ACTION_DOWN:
+ switch (event.getAction()) {
+ case MotionEvent.ACTION_DOWN: {
setPressed(true);
- animate().scaleX(0.98f).scaleY(0.98f).alpha(0.8f).setDuration(100).
- setInterpolator(new DecelerateInterpolator());
+ if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
+ animate().scaleX(0.98f).scaleY(0.98f).setDuration(100)
+ .setInterpolator(new DecelerateInterpolator());
+ } else {
+ ViewCompat.setElevation(this, 8.f);
+ }
break;
+ }
case MotionEvent.ACTION_UP:
- animate().scaleX(1.0f).scaleY(1.f).alpha(1.0f).setDuration(50).
- setInterpolator(new BounceInterpolator());
- break;
- case MotionEvent.ACTION_CANCEL:
- animate().scaleX(1.0f).scaleY(1.f).alpha(1.0f).setDuration(50).
- setInterpolator(new BounceInterpolator());
+ case MotionEvent.ACTION_CANCEL: {
+ setPressed(false);
+ if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
+ animate().scaleX(1.f).scaleY(1.f).setDuration(50)
+ .setInterpolator(new BounceInterpolator());
+ } else {
+ ViewCompat.setElevation(this, 0.f);
+ }
break;
+ }
}
return super.onTouchEvent(event);
diff --git a/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/CardLayout.java b/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/CardLayout.java
index ce20f7f36..84ee7b5d3 100644
--- a/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/CardLayout.java
+++ b/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/CardLayout.java
@@ -14,9 +14,6 @@
* limitations under the License.
*/
-
-
-
package com.example.android.batchstepsensor.cardstream;
import android.content.Context;
diff --git a/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/CardStream.java b/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/CardStream.java
index 70cc5dd41..6e4e10ab8 100644
--- a/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/CardStream.java
+++ b/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/CardStream.java
@@ -14,9 +14,6 @@
* limitations under the License.
*/
-
-
-
package com.example.android.batchstepsensor.cardstream;
public interface CardStream {
diff --git a/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/CardStreamAnimator.java b/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/CardStreamAnimator.java
index de06cf658..91a05aeeb 100644
--- a/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/CardStreamAnimator.java
+++ b/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/CardStreamAnimator.java
@@ -14,9 +14,6 @@
* limitations under the License.
*/
-
-
-
package com.example.android.batchstepsensor.cardstream;
import android.animation.ObjectAnimator;
diff --git a/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/CardStreamFragment.java b/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/CardStreamFragment.java
index 5388cd9ce..82ea62249 100644
--- a/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/CardStreamFragment.java
+++ b/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/CardStreamFragment.java
@@ -14,9 +14,6 @@
* limitations under the License.
*/
-
-
-
package com.example.android.batchstepsensor.cardstream;
import android.os.Bundle;
diff --git a/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/CardStreamLinearLayout.java b/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/CardStreamLinearLayout.java
index 5e4ba158a..9515c007d 100644
--- a/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/CardStreamLinearLayout.java
+++ b/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/CardStreamLinearLayout.java
@@ -14,9 +14,6 @@
* limitations under the License.
*/
-
-
-
package com.example.android.batchstepsensor.cardstream;
import android.animation.Animator;
diff --git a/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/CardStreamState.java b/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/CardStreamState.java
index 57ba177ab..59f337c50 100644
--- a/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/CardStreamState.java
+++ b/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/CardStreamState.java
@@ -14,9 +14,6 @@
* limitations under the License.
*/
-
-
-
package com.example.android.batchstepsensor.cardstream;
import java.util.HashSet;
diff --git a/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/DefaultCardStreamAnimator.java b/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/DefaultCardStreamAnimator.java
index 21e54d3a0..9f085535d 100644
--- a/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/DefaultCardStreamAnimator.java
+++ b/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/DefaultCardStreamAnimator.java
@@ -14,9 +14,6 @@
* limitations under the License.
*/
-
-
-
package com.example.android.batchstepsensor.cardstream;
import android.animation.ObjectAnimator;
diff --git a/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/OnCardClickListener.java b/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/OnCardClickListener.java
index 90ba21e03..31da7cd09 100644
--- a/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/OnCardClickListener.java
+++ b/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/OnCardClickListener.java
@@ -14,9 +14,6 @@
* limitations under the License.
*/
-
-
-
package com.example.android.batchstepsensor.cardstream;
public interface OnCardClickListener {
diff --git a/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/StreamRetentionFragment.java b/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/StreamRetentionFragment.java
index 51d5428a3..71d2a880c 100644
--- a/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/StreamRetentionFragment.java
+++ b/samples/browseable/BatchStepSensor/src/com.example.android.batchstepsensor/cardstream/StreamRetentionFragment.java
@@ -13,9 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-
-
package com.example.android.batchstepsensor.cardstream;
import android.os.Bundle;
diff --git a/samples/browseable/BluetoothChat/AndroidManifest.xml b/samples/browseable/BluetoothChat/AndroidManifest.xml
new file mode 100644
index 000000000..53dc5ab29
--- /dev/null
+++ b/samples/browseable/BluetoothChat/AndroidManifest.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest
+ package="com.example.android.bluetoothchat"
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:versionCode="1"
+ android:versionName="1.0">
+
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
+
+ <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
+ <uses-permission android:name="android.permission.BLUETOOTH"/>
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@style/AppTheme">
+
+ <activity
+ android:name=".MainActivity"
+ android:configChanges="orientation|keyboardHidden"
+ android:label="@string/app_name">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="android.intent.category.LAUNCHER"/>
+ </intent-filter>
+ </activity>
+
+ <activity
+ android:name=".DeviceListActivity"
+ android:configChanges="orientation|keyboardHidden"
+ android:label="@string/select_device"
+ android:theme="@android:style/Theme.Holo.Dialog"/>
+
+ </application>
+
+</manifest>
diff --git a/samples/browseable/BluetoothChat/_index.jd b/samples/browseable/BluetoothChat/_index.jd
new file mode 100644
index 000000000..6d1e37a41
--- /dev/null
+++ b/samples/browseable/BluetoothChat/_index.jd
@@ -0,0 +1,15 @@
+page.tags="BluetoothChat"
+sample.group=Connectivity
+@jd:body
+
+<p>
+
+ This application allows two Android devices to carry out two-way text chat over
+ Bluetooth. It demonstrates all the fundamental Bluetooth API capabilites, such as:
+ (1) Scanning for other Bluetooth devices
+ (2) Querying the local Bluetooth adapter for paired Bluetooth devices
+ (3) Establishing RFCOMM channels/sockets
+ (4) Connecting to a remote device
+ (5) Transfering data over Bluetooth
+
+ </p>
diff --git a/samples/browseable/BluetoothChat/res/drawable-hdpi/ic_action_device_access_bluetooth_searching.png b/samples/browseable/BluetoothChat/res/drawable-hdpi/ic_action_device_access_bluetooth_searching.png
new file mode 100755
index 000000000..fc0491e63
--- /dev/null
+++ b/samples/browseable/BluetoothChat/res/drawable-hdpi/ic_action_device_access_bluetooth_searching.png
Binary files differ
diff --git a/samples/browseable/BluetoothChat/res/drawable-hdpi/ic_launcher.png b/samples/browseable/BluetoothChat/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 000000000..092887b72
--- /dev/null
+++ b/samples/browseable/BluetoothChat/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/NavigationDrawer/res/drawable-xhdpi/sample_dashboard_item_background.9.png b/samples/browseable/BluetoothChat/res/drawable-hdpi/tile.9.png
index 135862883..135862883 100644
--- a/samples/browseable/NavigationDrawer/res/drawable-xhdpi/sample_dashboard_item_background.9.png
+++ b/samples/browseable/BluetoothChat/res/drawable-hdpi/tile.9.png
Binary files differ
diff --git a/samples/browseable/BluetoothChat/res/drawable-mdpi/ic_action_device_access_bluetooth_searching.png b/samples/browseable/BluetoothChat/res/drawable-mdpi/ic_action_device_access_bluetooth_searching.png
new file mode 100755
index 000000000..d65de0251
--- /dev/null
+++ b/samples/browseable/BluetoothChat/res/drawable-mdpi/ic_action_device_access_bluetooth_searching.png
Binary files differ
diff --git a/samples/browseable/BluetoothChat/res/drawable-mdpi/ic_launcher.png b/samples/browseable/BluetoothChat/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 000000000..1c51ccd7c
--- /dev/null
+++ b/samples/browseable/BluetoothChat/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/BluetoothChat/res/drawable-xhdpi/ic_action_device_access_bluetooth_searching.png b/samples/browseable/BluetoothChat/res/drawable-xhdpi/ic_action_device_access_bluetooth_searching.png
new file mode 100755
index 000000000..c4b236eea
--- /dev/null
+++ b/samples/browseable/BluetoothChat/res/drawable-xhdpi/ic_action_device_access_bluetooth_searching.png
Binary files differ
diff --git a/samples/browseable/BluetoothChat/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/BluetoothChat/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 000000000..3fa260b7c
--- /dev/null
+++ b/samples/browseable/BluetoothChat/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/BluetoothChat/res/drawable-xxhdpi/ic_action_device_access_bluetooth_searching.png b/samples/browseable/BluetoothChat/res/drawable-xxhdpi/ic_action_device_access_bluetooth_searching.png
new file mode 100755
index 000000000..de264301c
--- /dev/null
+++ b/samples/browseable/BluetoothChat/res/drawable-xxhdpi/ic_action_device_access_bluetooth_searching.png
Binary files differ
diff --git a/samples/browseable/BluetoothChat/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/BluetoothChat/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 000000000..6beccf392
--- /dev/null
+++ b/samples/browseable/BluetoothChat/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/BluetoothChat/res/layout-w720dp/activity_main.xml b/samples/browseable/BluetoothChat/res/layout-w720dp/activity_main.xml
new file mode 100755
index 000000000..c9a52f621
--- /dev/null
+++ b/samples/browseable/BluetoothChat/res/layout-w720dp/activity_main.xml
@@ -0,0 +1,73 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:id="@+id/sample_main_layout">
+
+ <LinearLayout
+ android:id="@+id/sample_output"
+ android:layout_width="0px"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:orientation="vertical">
+
+ <FrameLayout
+ style="@style/Widget.SampleMessageTile"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <TextView
+ style="@style/Widget.SampleMessage"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingLeft="@dimen/margin_medium"
+ android:paddingRight="@dimen/margin_medium"
+ android:paddingTop="@dimen/margin_large"
+ android:paddingBottom="@dimen/margin_large"
+ android:text="@string/intro_message" />
+ </FrameLayout>
+
+ <View
+ android:layout_width="match_parent"
+ android:layout_height="1dp"
+ android:background="@android:color/darker_gray" />
+
+ <fragment
+ android:name="com.example.android.common.logger.LogFragment"
+ android:id="@+id/log_fragment"
+ android:layout_width="match_parent"
+ android:layout_height="0px"
+ android:layout_weight="1" />
+
+ </LinearLayout>
+
+ <View
+ android:layout_width="1dp"
+ android:layout_height="match_parent"
+ android:background="@android:color/darker_gray" />
+
+ <FrameLayout
+ android:id="@+id/sample_content_fragment"
+ android:layout_weight="2"
+ android:layout_width="0px"
+ android:layout_height="match_parent" />
+
+</LinearLayout>
+
+
diff --git a/samples/browseable/BluetoothChat/res/layout/activity_device_list.xml b/samples/browseable/BluetoothChat/res/layout/activity_device_list.xml
new file mode 100644
index 000000000..ae7242cf9
--- /dev/null
+++ b/samples/browseable/BluetoothChat/res/layout/activity_device_list.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ >
+
+ <TextView
+ android:id="@+id/title_paired_devices"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="#666"
+ android:paddingLeft="5dp"
+ android:text="@string/title_paired_devices"
+ android:textColor="#fff"
+ android:visibility="gone"
+ />
+
+ <ListView
+ android:id="@+id/paired_devices"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:stackFromBottom="true"
+ />
+
+ <TextView
+ android:id="@+id/title_new_devices"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="#666"
+ android:paddingLeft="5dp"
+ android:text="@string/title_other_devices"
+ android:textColor="#fff"
+ android:visibility="gone"
+ />
+
+ <ListView
+ android:id="@+id/new_devices"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="2"
+ android:stackFromBottom="true"
+ />
+
+ <Button
+ android:id="@+id/button_scan"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/button_scan"
+ />
+</LinearLayout>
diff --git a/samples/browseable/BluetoothChat/res/layout/activity_main.xml b/samples/browseable/BluetoothChat/res/layout/activity_main.xml
new file mode 100755
index 000000000..1ae4f981e
--- /dev/null
+++ b/samples/browseable/BluetoothChat/res/layout/activity_main.xml
@@ -0,0 +1,65 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:id="@+id/sample_main_layout">
+
+ <ViewAnimator
+ android:id="@+id/sample_output"
+ android:layout_width="match_parent"
+ android:layout_height="0px"
+ android:layout_weight="1">
+
+ <ScrollView
+ style="@style/Widget.SampleMessageTile"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <TextView
+ style="@style/Widget.SampleMessage"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingLeft="@dimen/horizontal_page_margin"
+ android:paddingRight="@dimen/horizontal_page_margin"
+ android:paddingTop="@dimen/vertical_page_margin"
+ android:paddingBottom="@dimen/vertical_page_margin"
+ android:text="@string/intro_message" />
+ </ScrollView>
+
+ <fragment
+ android:name="com.example.android.common.logger.LogFragment"
+ android:id="@+id/log_fragment"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" />
+
+ </ViewAnimator>
+
+ <View
+ android:layout_width="match_parent"
+ android:layout_height="1dp"
+ android:background="@android:color/darker_gray" />
+
+ <FrameLayout
+ android:id="@+id/sample_content_fragment"
+ android:layout_weight="2"
+ android:layout_width="match_parent"
+ android:layout_height="0px" />
+
+</LinearLayout>
+
diff --git a/samples/browseable/BluetoothChat/res/layout/device_name.xml b/samples/browseable/BluetoothChat/res/layout/device_name.xml
new file mode 100644
index 000000000..28f57cca0
--- /dev/null
+++ b/samples/browseable/BluetoothChat/res/layout/device_name.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:padding="5dp"
+ android:textSize="18sp"
+ />
diff --git a/samples/browseable/BluetoothChat/res/layout/fragment_bluetooth_chat.xml b/samples/browseable/BluetoothChat/res/layout/fragment_bluetooth_chat.xml
new file mode 100644
index 000000000..91bad206f
--- /dev/null
+++ b/samples/browseable/BluetoothChat/res/layout/fragment_bluetooth_chat.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical" >
+
+ <ListView
+ android:id="@+id/in"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:stackFromBottom="true"
+ android:transcriptMode="alwaysScroll" />
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal" >
+
+ <EditText
+ android:id="@+id/edit_text_out"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="bottom"
+ android:layout_weight="1" />
+
+ <Button
+ android:id="@+id/button_send"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/send" />
+ </LinearLayout>
+
+</LinearLayout>
diff --git a/samples/browseable/BluetoothChat/res/layout/message.xml b/samples/browseable/BluetoothChat/res/layout/message.xml
new file mode 100644
index 000000000..28f57cca0
--- /dev/null
+++ b/samples/browseable/BluetoothChat/res/layout/message.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:padding="5dp"
+ android:textSize="18sp"
+ />
diff --git a/samples/browseable/BluetoothChat/res/menu/bluetooth_chat.xml b/samples/browseable/BluetoothChat/res/menu/bluetooth_chat.xml
new file mode 100644
index 000000000..a965104b5
--- /dev/null
+++ b/samples/browseable/BluetoothChat/res/menu/bluetooth_chat.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <item
+ android:id="@+id/secure_connect_scan"
+ android:icon="@drawable/ic_action_device_access_bluetooth_searching"
+ android:showAsAction="ifRoom"
+ android:title="@string/secure_connect"/>
+
+ <item
+ android:id="@+id/insecure_connect_scan"
+ android:showAsAction="never"
+ android:title="@string/insecure_connect"/>
+
+ <item
+ android:id="@+id/discoverable"
+ android:showAsAction="never"
+ android:title="@string/discoverable"/>
+
+</menu>
diff --git a/samples/browseable/BluetoothChat/res/menu/main.xml b/samples/browseable/BluetoothChat/res/menu/main.xml
new file mode 100644
index 000000000..b49c2c526
--- /dev/null
+++ b/samples/browseable/BluetoothChat/res/menu/main.xml
@@ -0,0 +1,21 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:id="@+id/menu_toggle_log"
+ android:showAsAction="always"
+ android:title="@string/sample_show_log" />
+</menu>
diff --git a/samples/browseable/BluetoothChat/res/values-sw600dp/template-dimens.xml b/samples/browseable/BluetoothChat/res/values-sw600dp/template-dimens.xml
new file mode 100644
index 000000000..22074a2bd
--- /dev/null
+++ b/samples/browseable/BluetoothChat/res/values-sw600dp/template-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>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_huge</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/BluetoothChat/res/values-sw600dp/template-styles.xml b/samples/browseable/BluetoothChat/res/values-sw600dp/template-styles.xml
new file mode 100644
index 000000000..03d197418
--- /dev/null
+++ b/samples/browseable/BluetoothChat/res/values-sw600dp/template-styles.xml
@@ -0,0 +1,25 @@
+<!--
+ 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.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceLarge</item>
+ <item name="android:lineSpacingMultiplier">1.2</item>
+ <item name="android:shadowDy">-6.5</item>
+ </style>
+
+</resources>
diff --git a/samples/browseable/BluetoothChat/res/values-v11/template-styles.xml b/samples/browseable/BluetoothChat/res/values-v11/template-styles.xml
new file mode 100644
index 000000000..8c1ea66f2
--- /dev/null
+++ b/samples/browseable/BluetoothChat/res/values-v11/template-styles.xml
@@ -0,0 +1,22 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Holo.Light" />
+
+</resources>
diff --git a/samples/browseable/BluetoothChat/res/values-v21/base-colors.xml b/samples/browseable/BluetoothChat/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/BluetoothChat/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/BluetoothChat/res/values-v21/base-template-styles.xml b/samples/browseable/BluetoothChat/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/BluetoothChat/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/BluetoothChat/res/values/base-strings.xml b/samples/browseable/BluetoothChat/res/values/base-strings.xml
new file mode 100644
index 000000000..fe175fbe3
--- /dev/null
+++ b/samples/browseable/BluetoothChat/res/values/base-strings.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<resources>
+ <string name="app_name">BluetoothChat</string>
+ <string name="intro_message">
+ <![CDATA[
+
+
+ This application allows two Android devices to carry out two-way text chat over
+ Bluetooth. It demonstrates all the fundamental Bluetooth API capabilites, such as:
+ (1) Scanning for other Bluetooth devices
+ (2) Querying the local Bluetooth adapter for paired Bluetooth devices
+ (3) Establishing RFCOMM channels/sockets
+ (4) Connecting to a remote device
+ (5) Transfering data over Bluetooth
+
+
+ ]]>
+ </string>
+</resources>
diff --git a/samples/browseable/AdvancedImmersiveMode/res/values/strings.xml b/samples/browseable/BluetoothChat/res/values/fragmentview_strings.xml
index 7b9d9ec4f..7b9d9ec4f 100755
--- a/samples/browseable/AdvancedImmersiveMode/res/values/strings.xml
+++ b/samples/browseable/BluetoothChat/res/values/fragmentview_strings.xml
diff --git a/samples/browseable/BluetoothChat/res/values/strings.xml b/samples/browseable/BluetoothChat/res/values/strings.xml
new file mode 100644
index 000000000..a38d82daf
--- /dev/null
+++ b/samples/browseable/BluetoothChat/res/values/strings.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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 xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <!-- BluetoothChat -->
+ <string name="send">Send</string>
+ <string name="not_connected">You are not connected to a device</string>
+ <string name="bt_not_enabled_leaving">Bluetooth was not enabled. Leaving Bluetooth Chat.</string>
+ <string name="title_connecting">connecting...</string>
+ <string name="title_connected_to">connected to <xliff:g id="device_name">%1$s</xliff:g></string>
+ <string name="title_not_connected">not connected</string>
+
+ <!-- DeviceListActivity -->
+ <string name="scanning">scanning for devices...</string>
+ <string name="select_device">select a device to connect</string>
+ <string name="none_paired">No devices have been paired</string>
+ <string name="none_found">No devices found</string>
+ <string name="title_paired_devices">Paired Devices</string>
+ <string name="title_other_devices">Other Available Devices</string>
+ <string name="button_scan">Scan for devices</string>
+
+ <!-- Options Menu -->
+ <string name="secure_connect">Connect a device - Secure</string>
+ <string name="insecure_connect">Connect a device - Insecure</string>
+ <string name="discoverable">Make discoverable</string>
+
+</resources>
diff --git a/samples/browseable/BluetoothChat/res/values/template-dimens.xml b/samples/browseable/BluetoothChat/res/values/template-dimens.xml
new file mode 100644
index 000000000..39e710b5c
--- /dev/null
+++ b/samples/browseable/BluetoothChat/res/values/template-dimens.xml
@@ -0,0 +1,32 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Define standard dimensions to comply with Holo-style grids and rhythm. -->
+
+ <dimen name="margin_tiny">4dp</dimen>
+ <dimen name="margin_small">8dp</dimen>
+ <dimen name="margin_medium">16dp</dimen>
+ <dimen name="margin_large">32dp</dimen>
+ <dimen name="margin_huge">64dp</dimen>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_medium</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/BluetoothChat/res/values/template-styles.xml b/samples/browseable/BluetoothChat/res/values/template-styles.xml
new file mode 100644
index 000000000..6e7d593dd
--- /dev/null
+++ b/samples/browseable/BluetoothChat/res/values/template-styles.xml
@@ -0,0 +1,42 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+
+ <style name="Theme.Base" parent="android:Theme.Light" />
+
+ <style name="Theme.Sample" parent="Theme.Base" />
+
+ <style name="AppTheme" parent="Theme.Sample" />
+ <!-- Widget styling -->
+
+ <style name="Widget" />
+
+ <style name="Widget.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceMedium</item>
+ <item name="android:lineSpacingMultiplier">1.1</item>
+ </style>
+
+ <style name="Widget.SampleMessageTile">
+ <item name="android:background">@drawable/tile</item>
+ <item name="android:shadowColor">#7F000000</item>
+ <item name="android:shadowDy">-3.5</item>
+ <item name="android:shadowRadius">2</item>
+ </style>
+
+</resources>
diff --git a/samples/browseable/BluetoothChat/src/com.example.android.bluetoothchat/BluetoothChatFragment.java b/samples/browseable/BluetoothChat/src/com.example.android.bluetoothchat/BluetoothChatFragment.java
new file mode 100644
index 000000000..8ee906246
--- /dev/null
+++ b/samples/browseable/BluetoothChat/src/com.example.android.bluetoothchat/BluetoothChatFragment.java
@@ -0,0 +1,402 @@
+/*
+ * Copyright (C) 2014 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.bluetoothchat;
+
+import android.app.ActionBar;
+import android.app.Activity;
+import android.bluetooth.BluetoothAdapter;
+import android.bluetooth.BluetoothDevice;
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.support.annotation.Nullable;
+import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentActivity;
+import android.view.KeyEvent;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.inputmethod.EditorInfo;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.ListView;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.example.android.common.logger.Log;
+
+/**
+ * This fragment controls Bluetooth to communicate with other devices.
+ */
+public class BluetoothChatFragment extends Fragment {
+
+ private static final String TAG = "BluetoothChatFragment";
+
+ // Intent request codes
+ private static final int REQUEST_CONNECT_DEVICE_SECURE = 1;
+ private static final int REQUEST_CONNECT_DEVICE_INSECURE = 2;
+ private static final int REQUEST_ENABLE_BT = 3;
+
+ // Layout Views
+ private ListView mConversationView;
+ private EditText mOutEditText;
+ private Button mSendButton;
+
+ /**
+ * Name of the connected device
+ */
+ private String mConnectedDeviceName = null;
+
+ /**
+ * Array adapter for the conversation thread
+ */
+ private ArrayAdapter<String> mConversationArrayAdapter;
+
+ /**
+ * String buffer for outgoing messages
+ */
+ private StringBuffer mOutStringBuffer;
+
+ /**
+ * Local Bluetooth adapter
+ */
+ private BluetoothAdapter mBluetoothAdapter = null;
+
+ /**
+ * Member object for the chat services
+ */
+ private BluetoothChatService mChatService = null;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setHasOptionsMenu(true);
+ // Get local Bluetooth adapter
+ mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
+
+ // If the adapter is null, then Bluetooth is not supported
+ if (mBluetoothAdapter == null) {
+ FragmentActivity activity = getActivity();
+ Toast.makeText(activity, "Bluetooth is not available", Toast.LENGTH_LONG).show();
+ activity.finish();
+ }
+ }
+
+
+ @Override
+ public void onStart() {
+ super.onStart();
+ // If BT is not on, request that it be enabled.
+ // setupChat() will then be called during onActivityResult
+ if (!mBluetoothAdapter.isEnabled()) {
+ Intent enableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
+ startActivityForResult(enableIntent, REQUEST_ENABLE_BT);
+ // Otherwise, setup the chat session
+ } else if (mChatService == null) {
+ setupChat();
+ }
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ if (mChatService != null) {
+ mChatService.stop();
+ }
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+
+ // Performing this check in onResume() covers the case in which BT was
+ // not enabled during onStart(), so we were paused to enable it...
+ // onResume() will be called when ACTION_REQUEST_ENABLE activity returns.
+ if (mChatService != null) {
+ // Only if the state is STATE_NONE, do we know that we haven't started already
+ if (mChatService.getState() == BluetoothChatService.STATE_NONE) {
+ // Start the Bluetooth chat services
+ mChatService.start();
+ }
+ }
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
+ @Nullable Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.fragment_bluetooth_chat, container, false);
+ }
+
+ @Override
+ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
+ mConversationView = (ListView) view.findViewById(R.id.in);
+ mOutEditText = (EditText) view.findViewById(R.id.edit_text_out);
+ mSendButton = (Button) view.findViewById(R.id.button_send);
+ }
+
+ /**
+ * Set up the UI and background operations for chat.
+ */
+ private void setupChat() {
+ Log.d(TAG, "setupChat()");
+
+ // Initialize the array adapter for the conversation thread
+ mConversationArrayAdapter = new ArrayAdapter<String>(getActivity(), R.layout.message);
+
+ mConversationView.setAdapter(mConversationArrayAdapter);
+
+ // Initialize the compose field with a listener for the return key
+ mOutEditText.setOnEditorActionListener(mWriteListener);
+
+ // Initialize the send button with a listener that for click events
+ mSendButton.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ // Send a message using content of the edit text widget
+ View view = getView();
+ if (null != view) {
+ TextView textView = (TextView) view.findViewById(R.id.edit_text_out);
+ String message = textView.getText().toString();
+ sendMessage(message);
+ }
+ }
+ });
+
+ // Initialize the BluetoothChatService to perform bluetooth connections
+ mChatService = new BluetoothChatService(getActivity(), mHandler);
+
+ // Initialize the buffer for outgoing messages
+ mOutStringBuffer = new StringBuffer("");
+ }
+
+ /**
+ * Makes this device discoverable.
+ */
+ private void ensureDiscoverable() {
+ if (mBluetoothAdapter.getScanMode() !=
+ BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE) {
+ Intent discoverableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE);
+ discoverableIntent.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 300);
+ startActivity(discoverableIntent);
+ }
+ }
+
+ /**
+ * Sends a message.
+ *
+ * @param message A string of text to send.
+ */
+ private void sendMessage(String message) {
+ // Check that we're actually connected before trying anything
+ if (mChatService.getState() != BluetoothChatService.STATE_CONNECTED) {
+ Toast.makeText(getActivity(), R.string.not_connected, Toast.LENGTH_SHORT).show();
+ return;
+ }
+
+ // Check that there's actually something to send
+ if (message.length() > 0) {
+ // Get the message bytes and tell the BluetoothChatService to write
+ byte[] send = message.getBytes();
+ mChatService.write(send);
+
+ // Reset out string buffer to zero and clear the edit text field
+ mOutStringBuffer.setLength(0);
+ mOutEditText.setText(mOutStringBuffer);
+ }
+ }
+
+ /**
+ * The action listener for the EditText widget, to listen for the return key
+ */
+ private TextView.OnEditorActionListener mWriteListener
+ = new TextView.OnEditorActionListener() {
+ public boolean onEditorAction(TextView view, int actionId, KeyEvent event) {
+ // If the action is a key-up event on the return key, send the message
+ if (actionId == EditorInfo.IME_NULL && event.getAction() == KeyEvent.ACTION_UP) {
+ String message = view.getText().toString();
+ sendMessage(message);
+ }
+ return true;
+ }
+ };
+
+ /**
+ * Updates the status on the action bar.
+ *
+ * @param resId a string resource ID
+ */
+ private void setStatus(int resId) {
+ FragmentActivity activity = getActivity();
+ if (null == activity) {
+ return;
+ }
+ final ActionBar actionBar = activity.getActionBar();
+ if (null == actionBar) {
+ return;
+ }
+ actionBar.setSubtitle(resId);
+ }
+
+ /**
+ * Updates the status on the action bar.
+ *
+ * @param subTitle status
+ */
+ private void setStatus(CharSequence subTitle) {
+ FragmentActivity activity = getActivity();
+ if (null == activity) {
+ return;
+ }
+ final ActionBar actionBar = activity.getActionBar();
+ if (null == actionBar) {
+ return;
+ }
+ actionBar.setSubtitle(subTitle);
+ }
+
+ /**
+ * The Handler that gets information back from the BluetoothChatService
+ */
+ private final Handler mHandler = new Handler() {
+ @Override
+ public void handleMessage(Message msg) {
+ FragmentActivity activity = getActivity();
+ switch (msg.what) {
+ case Constants.MESSAGE_STATE_CHANGE:
+ switch (msg.arg1) {
+ case BluetoothChatService.STATE_CONNECTED:
+ setStatus(getString(R.string.title_connected_to, mConnectedDeviceName));
+ mConversationArrayAdapter.clear();
+ break;
+ case BluetoothChatService.STATE_CONNECTING:
+ setStatus(R.string.title_connecting);
+ break;
+ case BluetoothChatService.STATE_LISTEN:
+ case BluetoothChatService.STATE_NONE:
+ setStatus(R.string.title_not_connected);
+ break;
+ }
+ break;
+ case Constants.MESSAGE_WRITE:
+ byte[] writeBuf = (byte[]) msg.obj;
+ // construct a string from the buffer
+ String writeMessage = new String(writeBuf);
+ mConversationArrayAdapter.add("Me: " + writeMessage);
+ break;
+ case Constants.MESSAGE_READ:
+ byte[] readBuf = (byte[]) msg.obj;
+ // construct a string from the valid bytes in the buffer
+ String readMessage = new String(readBuf, 0, msg.arg1);
+ mConversationArrayAdapter.add(mConnectedDeviceName + ": " + readMessage);
+ break;
+ case Constants.MESSAGE_DEVICE_NAME:
+ // save the connected device's name
+ mConnectedDeviceName = msg.getData().getString(Constants.DEVICE_NAME);
+ if (null != activity) {
+ Toast.makeText(activity, "Connected to "
+ + mConnectedDeviceName, Toast.LENGTH_SHORT).show();
+ }
+ break;
+ case Constants.MESSAGE_TOAST:
+ if (null != activity) {
+ Toast.makeText(activity, msg.getData().getString(Constants.TOAST),
+ Toast.LENGTH_SHORT).show();
+ }
+ break;
+ }
+ }
+ };
+
+ public void onActivityResult(int requestCode, int resultCode, Intent data) {
+ switch (requestCode) {
+ case REQUEST_CONNECT_DEVICE_SECURE:
+ // When DeviceListActivity returns with a device to connect
+ if (resultCode == Activity.RESULT_OK) {
+ connectDevice(data, true);
+ }
+ break;
+ case REQUEST_CONNECT_DEVICE_INSECURE:
+ // When DeviceListActivity returns with a device to connect
+ if (resultCode == Activity.RESULT_OK) {
+ connectDevice(data, false);
+ }
+ break;
+ case REQUEST_ENABLE_BT:
+ // When the request to enable Bluetooth returns
+ if (resultCode == Activity.RESULT_OK) {
+ // Bluetooth is now enabled, so set up a chat session
+ setupChat();
+ } else {
+ // User did not enable Bluetooth or an error occurred
+ Log.d(TAG, "BT not enabled");
+ Toast.makeText(getActivity(), R.string.bt_not_enabled_leaving,
+ Toast.LENGTH_SHORT).show();
+ getActivity().finish();
+ }
+ }
+ }
+
+ /**
+ * Establish connection with other divice
+ *
+ * @param data An {@link Intent} with {@link DeviceListActivity#EXTRA_DEVICE_ADDRESS} extra.
+ * @param secure Socket Security type - Secure (true) , Insecure (false)
+ */
+ private void connectDevice(Intent data, boolean secure) {
+ // Get the device MAC address
+ String address = data.getExtras()
+ .getString(DeviceListActivity.EXTRA_DEVICE_ADDRESS);
+ // Get the BluetoothDevice object
+ BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(address);
+ // Attempt to connect to the device
+ mChatService.connect(device, secure);
+ }
+
+ @Override
+ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
+ inflater.inflate(R.menu.bluetooth_chat, menu);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.secure_connect_scan: {
+ // Launch the DeviceListActivity to see devices and do scan
+ Intent serverIntent = new Intent(getActivity(), DeviceListActivity.class);
+ startActivityForResult(serverIntent, REQUEST_CONNECT_DEVICE_SECURE);
+ return true;
+ }
+ case R.id.insecure_connect_scan: {
+ // Launch the DeviceListActivity to see devices and do scan
+ Intent serverIntent = new Intent(getActivity(), DeviceListActivity.class);
+ startActivityForResult(serverIntent, REQUEST_CONNECT_DEVICE_INSECURE);
+ return true;
+ }
+ case R.id.discoverable: {
+ // Ensure this device is discoverable by others
+ ensureDiscoverable();
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/samples/browseable/BluetoothChat/src/com.example.android.bluetoothchat/BluetoothChatService.java b/samples/browseable/BluetoothChat/src/com.example.android.bluetoothchat/BluetoothChatService.java
new file mode 100644
index 000000000..b88b160d2
--- /dev/null
+++ b/samples/browseable/BluetoothChat/src/com.example.android.bluetoothchat/BluetoothChatService.java
@@ -0,0 +1,519 @@
+/*
+ * Copyright (C) 2014 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.bluetoothchat;
+
+import android.bluetooth.BluetoothAdapter;
+import android.bluetooth.BluetoothDevice;
+import android.bluetooth.BluetoothServerSocket;
+import android.bluetooth.BluetoothSocket;
+import android.content.Context;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+
+import com.example.android.common.logger.Log;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.UUID;
+
+/**
+ * This class does all the work for setting up and managing Bluetooth
+ * connections with other devices. It has a thread that listens for
+ * incoming connections, a thread for connecting with a device, and a
+ * thread for performing data transmissions when connected.
+ */
+public class BluetoothChatService {
+ // Debugging
+ private static final String TAG = "BluetoothChatService";
+
+ // Name for the SDP record when creating server socket
+ private static final String NAME_SECURE = "BluetoothChatSecure";
+ private static final String NAME_INSECURE = "BluetoothChatInsecure";
+
+ // Unique UUID for this application
+ private static final UUID MY_UUID_SECURE =
+ UUID.fromString("fa87c0d0-afac-11de-8a39-0800200c9a66");
+ private static final UUID MY_UUID_INSECURE =
+ UUID.fromString("8ce255c0-200a-11e0-ac64-0800200c9a66");
+
+ // Member fields
+ private final BluetoothAdapter mAdapter;
+ private final Handler mHandler;
+ private AcceptThread mSecureAcceptThread;
+ private AcceptThread mInsecureAcceptThread;
+ private ConnectThread mConnectThread;
+ private ConnectedThread mConnectedThread;
+ private int mState;
+
+ // Constants that indicate the current connection state
+ public static final int STATE_NONE = 0; // we're doing nothing
+ public static final int STATE_LISTEN = 1; // now listening for incoming connections
+ public static final int STATE_CONNECTING = 2; // now initiating an outgoing connection
+ public static final int STATE_CONNECTED = 3; // now connected to a remote device
+
+ /**
+ * Constructor. Prepares a new BluetoothChat session.
+ *
+ * @param context The UI Activity Context
+ * @param handler A Handler to send messages back to the UI Activity
+ */
+ public BluetoothChatService(Context context, Handler handler) {
+ mAdapter = BluetoothAdapter.getDefaultAdapter();
+ mState = STATE_NONE;
+ mHandler = handler;
+ }
+
+ /**
+ * Set the current state of the chat connection
+ *
+ * @param state An integer defining the current connection state
+ */
+ private synchronized void setState(int state) {
+ Log.d(TAG, "setState() " + mState + " -> " + state);
+ mState = state;
+
+ // Give the new state to the Handler so the UI Activity can update
+ mHandler.obtainMessage(Constants.MESSAGE_STATE_CHANGE, state, -1).sendToTarget();
+ }
+
+ /**
+ * Return the current connection state.
+ */
+ public synchronized int getState() {
+ return mState;
+ }
+
+ /**
+ * Start the chat service. Specifically start AcceptThread to begin a
+ * session in listening (server) mode. Called by the Activity onResume()
+ */
+ public synchronized void start() {
+ Log.d(TAG, "start");
+
+ // Cancel any thread attempting to make a connection
+ if (mConnectThread != null) {
+ mConnectThread.cancel();
+ mConnectThread = null;
+ }
+
+ // Cancel any thread currently running a connection
+ if (mConnectedThread != null) {
+ mConnectedThread.cancel();
+ mConnectedThread = null;
+ }
+
+ setState(STATE_LISTEN);
+
+ // Start the thread to listen on a BluetoothServerSocket
+ if (mSecureAcceptThread == null) {
+ mSecureAcceptThread = new AcceptThread(true);
+ mSecureAcceptThread.start();
+ }
+ if (mInsecureAcceptThread == null) {
+ mInsecureAcceptThread = new AcceptThread(false);
+ mInsecureAcceptThread.start();
+ }
+ }
+
+ /**
+ * Start the ConnectThread to initiate a connection to a remote device.
+ *
+ * @param device The BluetoothDevice to connect
+ * @param secure Socket Security type - Secure (true) , Insecure (false)
+ */
+ public synchronized void connect(BluetoothDevice device, boolean secure) {
+ Log.d(TAG, "connect to: " + device);
+
+ // Cancel any thread attempting to make a connection
+ if (mState == STATE_CONNECTING) {
+ if (mConnectThread != null) {
+ mConnectThread.cancel();
+ mConnectThread = null;
+ }
+ }
+
+ // Cancel any thread currently running a connection
+ if (mConnectedThread != null) {
+ mConnectedThread.cancel();
+ mConnectedThread = null;
+ }
+
+ // Start the thread to connect with the given device
+ mConnectThread = new ConnectThread(device, secure);
+ mConnectThread.start();
+ setState(STATE_CONNECTING);
+ }
+
+ /**
+ * Start the ConnectedThread to begin managing a Bluetooth connection
+ *
+ * @param socket The BluetoothSocket on which the connection was made
+ * @param device The BluetoothDevice that has been connected
+ */
+ public synchronized void connected(BluetoothSocket socket, BluetoothDevice
+ device, final String socketType) {
+ Log.d(TAG, "connected, Socket Type:" + socketType);
+
+ // Cancel the thread that completed the connection
+ if (mConnectThread != null) {
+ mConnectThread.cancel();
+ mConnectThread = null;
+ }
+
+ // Cancel any thread currently running a connection
+ if (mConnectedThread != null) {
+ mConnectedThread.cancel();
+ mConnectedThread = null;
+ }
+
+ // Cancel the accept thread because we only want to connect to one device
+ if (mSecureAcceptThread != null) {
+ mSecureAcceptThread.cancel();
+ mSecureAcceptThread = null;
+ }
+ if (mInsecureAcceptThread != null) {
+ mInsecureAcceptThread.cancel();
+ mInsecureAcceptThread = null;
+ }
+
+ // Start the thread to manage the connection and perform transmissions
+ mConnectedThread = new ConnectedThread(socket, socketType);
+ mConnectedThread.start();
+
+ // Send the name of the connected device back to the UI Activity
+ Message msg = mHandler.obtainMessage(Constants.MESSAGE_DEVICE_NAME);
+ Bundle bundle = new Bundle();
+ bundle.putString(Constants.DEVICE_NAME, device.getName());
+ msg.setData(bundle);
+ mHandler.sendMessage(msg);
+
+ setState(STATE_CONNECTED);
+ }
+
+ /**
+ * Stop all threads
+ */
+ public synchronized void stop() {
+ Log.d(TAG, "stop");
+
+ if (mConnectThread != null) {
+ mConnectThread.cancel();
+ mConnectThread = null;
+ }
+
+ if (mConnectedThread != null) {
+ mConnectedThread.cancel();
+ mConnectedThread = null;
+ }
+
+ if (mSecureAcceptThread != null) {
+ mSecureAcceptThread.cancel();
+ mSecureAcceptThread = null;
+ }
+
+ if (mInsecureAcceptThread != null) {
+ mInsecureAcceptThread.cancel();
+ mInsecureAcceptThread = null;
+ }
+ setState(STATE_NONE);
+ }
+
+ /**
+ * Write to the ConnectedThread in an unsynchronized manner
+ *
+ * @param out The bytes to write
+ * @see ConnectedThread#write(byte[])
+ */
+ public void write(byte[] out) {
+ // Create temporary object
+ ConnectedThread r;
+ // Synchronize a copy of the ConnectedThread
+ synchronized (this) {
+ if (mState != STATE_CONNECTED) return;
+ r = mConnectedThread;
+ }
+ // Perform the write unsynchronized
+ r.write(out);
+ }
+
+ /**
+ * Indicate that the connection attempt failed and notify the UI Activity.
+ */
+ private void connectionFailed() {
+ // Send a failure message back to the Activity
+ Message msg = mHandler.obtainMessage(Constants.MESSAGE_TOAST);
+ Bundle bundle = new Bundle();
+ bundle.putString(Constants.TOAST, "Unable to connect device");
+ msg.setData(bundle);
+ mHandler.sendMessage(msg);
+
+ // Start the service over to restart listening mode
+ BluetoothChatService.this.start();
+ }
+
+ /**
+ * Indicate that the connection was lost and notify the UI Activity.
+ */
+ private void connectionLost() {
+ // Send a failure message back to the Activity
+ Message msg = mHandler.obtainMessage(Constants.MESSAGE_TOAST);
+ Bundle bundle = new Bundle();
+ bundle.putString(Constants.TOAST, "Device connection was lost");
+ msg.setData(bundle);
+ mHandler.sendMessage(msg);
+
+ // Start the service over to restart listening mode
+ BluetoothChatService.this.start();
+ }
+
+ /**
+ * This thread runs while listening for incoming connections. It behaves
+ * like a server-side client. It runs until a connection is accepted
+ * (or until cancelled).
+ */
+ private class AcceptThread extends Thread {
+ // The local server socket
+ private final BluetoothServerSocket mmServerSocket;
+ private String mSocketType;
+
+ public AcceptThread(boolean secure) {
+ BluetoothServerSocket tmp = null;
+ mSocketType = secure ? "Secure" : "Insecure";
+
+ // Create a new listening server socket
+ try {
+ if (secure) {
+ tmp = mAdapter.listenUsingRfcommWithServiceRecord(NAME_SECURE,
+ MY_UUID_SECURE);
+ } else {
+ tmp = mAdapter.listenUsingInsecureRfcommWithServiceRecord(
+ NAME_INSECURE, MY_UUID_INSECURE);
+ }
+ } catch (IOException e) {
+ Log.e(TAG, "Socket Type: " + mSocketType + "listen() failed", e);
+ }
+ mmServerSocket = tmp;
+ }
+
+ public void run() {
+ Log.d(TAG, "Socket Type: " + mSocketType +
+ "BEGIN mAcceptThread" + this);
+ setName("AcceptThread" + mSocketType);
+
+ BluetoothSocket socket = null;
+
+ // Listen to the server socket if we're not connected
+ while (mState != STATE_CONNECTED) {
+ try {
+ // This is a blocking call and will only return on a
+ // successful connection or an exception
+ socket = mmServerSocket.accept();
+ } catch (IOException e) {
+ Log.e(TAG, "Socket Type: " + mSocketType + "accept() failed", e);
+ break;
+ }
+
+ // If a connection was accepted
+ if (socket != null) {
+ synchronized (BluetoothChatService.this) {
+ switch (mState) {
+ case STATE_LISTEN:
+ case STATE_CONNECTING:
+ // Situation normal. Start the connected thread.
+ connected(socket, socket.getRemoteDevice(),
+ mSocketType);
+ break;
+ case STATE_NONE:
+ case STATE_CONNECTED:
+ // Either not ready or already connected. Terminate new socket.
+ try {
+ socket.close();
+ } catch (IOException e) {
+ Log.e(TAG, "Could not close unwanted socket", e);
+ }
+ break;
+ }
+ }
+ }
+ }
+ Log.i(TAG, "END mAcceptThread, socket Type: " + mSocketType);
+
+ }
+
+ public void cancel() {
+ Log.d(TAG, "Socket Type" + mSocketType + "cancel " + this);
+ try {
+ mmServerSocket.close();
+ } catch (IOException e) {
+ Log.e(TAG, "Socket Type" + mSocketType + "close() of server failed", e);
+ }
+ }
+ }
+
+
+ /**
+ * This thread runs while attempting to make an outgoing connection
+ * with a device. It runs straight through; the connection either
+ * succeeds or fails.
+ */
+ private class ConnectThread extends Thread {
+ private final BluetoothSocket mmSocket;
+ private final BluetoothDevice mmDevice;
+ private String mSocketType;
+
+ public ConnectThread(BluetoothDevice device, boolean secure) {
+ mmDevice = device;
+ BluetoothSocket tmp = null;
+ mSocketType = secure ? "Secure" : "Insecure";
+
+ // Get a BluetoothSocket for a connection with the
+ // given BluetoothDevice
+ try {
+ if (secure) {
+ tmp = device.createRfcommSocketToServiceRecord(
+ MY_UUID_SECURE);
+ } else {
+ tmp = device.createInsecureRfcommSocketToServiceRecord(
+ MY_UUID_INSECURE);
+ }
+ } catch (IOException e) {
+ Log.e(TAG, "Socket Type: " + mSocketType + "create() failed", e);
+ }
+ mmSocket = tmp;
+ }
+
+ public void run() {
+ Log.i(TAG, "BEGIN mConnectThread SocketType:" + mSocketType);
+ setName("ConnectThread" + mSocketType);
+
+ // Always cancel discovery because it will slow down a connection
+ mAdapter.cancelDiscovery();
+
+ // Make a connection to the BluetoothSocket
+ try {
+ // This is a blocking call and will only return on a
+ // successful connection or an exception
+ mmSocket.connect();
+ } catch (IOException e) {
+ // Close the socket
+ try {
+ mmSocket.close();
+ } catch (IOException e2) {
+ Log.e(TAG, "unable to close() " + mSocketType +
+ " socket during connection failure", e2);
+ }
+ connectionFailed();
+ return;
+ }
+
+ // Reset the ConnectThread because we're done
+ synchronized (BluetoothChatService.this) {
+ mConnectThread = null;
+ }
+
+ // Start the connected thread
+ connected(mmSocket, mmDevice, mSocketType);
+ }
+
+ public void cancel() {
+ try {
+ mmSocket.close();
+ } catch (IOException e) {
+ Log.e(TAG, "close() of connect " + mSocketType + " socket failed", e);
+ }
+ }
+ }
+
+ /**
+ * This thread runs during a connection with a remote device.
+ * It handles all incoming and outgoing transmissions.
+ */
+ private class ConnectedThread extends Thread {
+ private final BluetoothSocket mmSocket;
+ private final InputStream mmInStream;
+ private final OutputStream mmOutStream;
+
+ public ConnectedThread(BluetoothSocket socket, String socketType) {
+ Log.d(TAG, "create ConnectedThread: " + socketType);
+ mmSocket = socket;
+ InputStream tmpIn = null;
+ OutputStream tmpOut = null;
+
+ // Get the BluetoothSocket input and output streams
+ try {
+ tmpIn = socket.getInputStream();
+ tmpOut = socket.getOutputStream();
+ } catch (IOException e) {
+ Log.e(TAG, "temp sockets not created", e);
+ }
+
+ mmInStream = tmpIn;
+ mmOutStream = tmpOut;
+ }
+
+ public void run() {
+ Log.i(TAG, "BEGIN mConnectedThread");
+ byte[] buffer = new byte[1024];
+ int bytes;
+
+ // Keep listening to the InputStream while connected
+ while (true) {
+ try {
+ // Read from the InputStream
+ bytes = mmInStream.read(buffer);
+
+ // Send the obtained bytes to the UI Activity
+ mHandler.obtainMessage(Constants.MESSAGE_READ, bytes, -1, buffer)
+ .sendToTarget();
+ } catch (IOException e) {
+ Log.e(TAG, "disconnected", e);
+ connectionLost();
+ // Start the service over to restart listening mode
+ BluetoothChatService.this.start();
+ break;
+ }
+ }
+ }
+
+ /**
+ * Write to the connected OutStream.
+ *
+ * @param buffer The bytes to write
+ */
+ public void write(byte[] buffer) {
+ try {
+ mmOutStream.write(buffer);
+
+ // Share the sent message back to the UI Activity
+ mHandler.obtainMessage(Constants.MESSAGE_WRITE, -1, -1, buffer)
+ .sendToTarget();
+ } catch (IOException e) {
+ Log.e(TAG, "Exception during write", e);
+ }
+ }
+
+ public void cancel() {
+ try {
+ mmSocket.close();
+ } catch (IOException e) {
+ Log.e(TAG, "close() of connect socket failed", e);
+ }
+ }
+ }
+}
diff --git a/samples/browseable/BluetoothChat/src/com.example.android.bluetoothchat/Constants.java b/samples/browseable/BluetoothChat/src/com.example.android.bluetoothchat/Constants.java
new file mode 100644
index 000000000..3500e8e70
--- /dev/null
+++ b/samples/browseable/BluetoothChat/src/com.example.android.bluetoothchat/Constants.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2014 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.bluetoothchat;
+
+/**
+ * Defines several constants used between {@link BluetoothChatService} and the UI.
+ */
+public interface Constants {
+
+ // Message types sent from the BluetoothChatService Handler
+ public static final int MESSAGE_STATE_CHANGE = 1;
+ public static final int MESSAGE_READ = 2;
+ public static final int MESSAGE_WRITE = 3;
+ public static final int MESSAGE_DEVICE_NAME = 4;
+ public static final int MESSAGE_TOAST = 5;
+
+ // Key names received from the BluetoothChatService Handler
+ public static final String DEVICE_NAME = "device_name";
+ public static final String TOAST = "toast";
+
+}
diff --git a/samples/browseable/BluetoothChat/src/com.example.android.bluetoothchat/DeviceListActivity.java b/samples/browseable/BluetoothChat/src/com.example.android.bluetoothchat/DeviceListActivity.java
new file mode 100644
index 000000000..8b70adc4c
--- /dev/null
+++ b/samples/browseable/BluetoothChat/src/com.example.android.bluetoothchat/DeviceListActivity.java
@@ -0,0 +1,216 @@
+/*
+ * Copyright (C) 2014 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.bluetoothchat;
+
+import android.app.Activity;
+import android.bluetooth.BluetoothAdapter;
+import android.bluetooth.BluetoothDevice;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.Bundle;
+import android.view.View;
+import android.view.Window;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.ListView;
+import android.widget.TextView;
+
+import com.example.android.common.logger.Log;
+
+import java.util.Set;
+
+/**
+ * This Activity appears as a dialog. It lists any paired devices and
+ * devices detected in the area after discovery. When a device is chosen
+ * by the user, the MAC address of the device is sent back to the parent
+ * Activity in the result Intent.
+ */
+public class DeviceListActivity extends Activity {
+
+ /**
+ * Tag for Log
+ */
+ private static final String TAG = "DeviceListActivity";
+
+ /**
+ * Return Intent extra
+ */
+ public static String EXTRA_DEVICE_ADDRESS = "device_address";
+
+ /**
+ * Member fields
+ */
+ private BluetoothAdapter mBtAdapter;
+
+ /**
+ * Newly discovered devices
+ */
+ private ArrayAdapter<String> mNewDevicesArrayAdapter;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ // Setup the window
+ requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
+ setContentView(R.layout.activity_device_list);
+
+ // Set result CANCELED in case the user backs out
+ setResult(Activity.RESULT_CANCELED);
+
+ // Initialize the button to perform device discovery
+ Button scanButton = (Button) findViewById(R.id.button_scan);
+ scanButton.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ doDiscovery();
+ v.setVisibility(View.GONE);
+ }
+ });
+
+ // Initialize array adapters. One for already paired devices and
+ // one for newly discovered devices
+ ArrayAdapter<String> pairedDevicesArrayAdapter =
+ new ArrayAdapter<String>(this, R.layout.device_name);
+ mNewDevicesArrayAdapter = new ArrayAdapter<String>(this, R.layout.device_name);
+
+ // Find and set up the ListView for paired devices
+ ListView pairedListView = (ListView) findViewById(R.id.paired_devices);
+ pairedListView.setAdapter(pairedDevicesArrayAdapter);
+ pairedListView.setOnItemClickListener(mDeviceClickListener);
+
+ // Find and set up the ListView for newly discovered devices
+ ListView newDevicesListView = (ListView) findViewById(R.id.new_devices);
+ newDevicesListView.setAdapter(mNewDevicesArrayAdapter);
+ newDevicesListView.setOnItemClickListener(mDeviceClickListener);
+
+ // Register for broadcasts when a device is discovered
+ IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND);
+ this.registerReceiver(mReceiver, filter);
+
+ // Register for broadcasts when discovery has finished
+ filter = new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
+ this.registerReceiver(mReceiver, filter);
+
+ // Get the local Bluetooth adapter
+ mBtAdapter = BluetoothAdapter.getDefaultAdapter();
+
+ // Get a set of currently paired devices
+ Set<BluetoothDevice> pairedDevices = mBtAdapter.getBondedDevices();
+
+ // If there are paired devices, add each one to the ArrayAdapter
+ if (pairedDevices.size() > 0) {
+ findViewById(R.id.title_paired_devices).setVisibility(View.VISIBLE);
+ for (BluetoothDevice device : pairedDevices) {
+ pairedDevicesArrayAdapter.add(device.getName() + "\n" + device.getAddress());
+ }
+ } else {
+ String noDevices = getResources().getText(R.string.none_paired).toString();
+ pairedDevicesArrayAdapter.add(noDevices);
+ }
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+
+ // Make sure we're not doing discovery anymore
+ if (mBtAdapter != null) {
+ mBtAdapter.cancelDiscovery();
+ }
+
+ // Unregister broadcast listeners
+ this.unregisterReceiver(mReceiver);
+ }
+
+ /**
+ * Start device discover with the BluetoothAdapter
+ */
+ private void doDiscovery() {
+ Log.d(TAG, "doDiscovery()");
+
+ // Indicate scanning in the title
+ setProgressBarIndeterminateVisibility(true);
+ setTitle(R.string.scanning);
+
+ // Turn on sub-title for new devices
+ findViewById(R.id.title_new_devices).setVisibility(View.VISIBLE);
+
+ // If we're already discovering, stop it
+ if (mBtAdapter.isDiscovering()) {
+ mBtAdapter.cancelDiscovery();
+ }
+
+ // Request discover from BluetoothAdapter
+ mBtAdapter.startDiscovery();
+ }
+
+ /**
+ * The on-click listener for all devices in the ListViews
+ */
+ private AdapterView.OnItemClickListener mDeviceClickListener
+ = new AdapterView.OnItemClickListener() {
+ public void onItemClick(AdapterView<?> av, View v, int arg2, long arg3) {
+ // Cancel discovery because it's costly and we're about to connect
+ mBtAdapter.cancelDiscovery();
+
+ // Get the device MAC address, which is the last 17 chars in the View
+ String info = ((TextView) v).getText().toString();
+ String address = info.substring(info.length() - 17);
+
+ // Create the result Intent and include the MAC address
+ Intent intent = new Intent();
+ intent.putExtra(EXTRA_DEVICE_ADDRESS, address);
+
+ // Set result and finish this Activity
+ setResult(Activity.RESULT_OK, intent);
+ finish();
+ }
+ };
+
+ /**
+ * The BroadcastReceiver that listens for discovered devices and changes the title when
+ * discovery is finished
+ */
+ private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ String action = intent.getAction();
+
+ // When discovery finds a device
+ if (BluetoothDevice.ACTION_FOUND.equals(action)) {
+ // Get the BluetoothDevice object from the Intent
+ BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
+ // If it's already paired, skip it, because it's been listed already
+ if (device.getBondState() != BluetoothDevice.BOND_BONDED) {
+ mNewDevicesArrayAdapter.add(device.getName() + "\n" + device.getAddress());
+ }
+ // When discovery is finished, change the Activity title
+ } else if (BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(action)) {
+ setProgressBarIndeterminateVisibility(false);
+ setTitle(R.string.select_device);
+ if (mNewDevicesArrayAdapter.getCount() == 0) {
+ String noDevices = getResources().getText(R.string.none_found).toString();
+ mNewDevicesArrayAdapter.add(noDevices);
+ }
+ }
+ }
+ };
+
+}
diff --git a/samples/browseable/BluetoothChat/src/com.example.android.bluetoothchat/MainActivity.java b/samples/browseable/BluetoothChat/src/com.example.android.bluetoothchat/MainActivity.java
new file mode 100644
index 000000000..cf4ec47e3
--- /dev/null
+++ b/samples/browseable/BluetoothChat/src/com.example.android.bluetoothchat/MainActivity.java
@@ -0,0 +1,109 @@
+/*
+* Copyright 2013 The Android Open Source Project
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package com.example.android.bluetoothchat;
+
+import android.os.Bundle;
+import android.support.v4.app.FragmentTransaction;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.widget.ViewAnimator;
+
+import com.example.android.common.activities.SampleActivityBase;
+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;
+
+/**
+ * A simple launcher activity containing a summary sample description, sample log and a custom
+ * {@link android.support.v4.app.Fragment} which can display a view.
+ * <p>
+ * For devices with displays with a width of 720dp or greater, the sample log is always visible,
+ * on other devices it's visibility is controlled by an item on the Action Bar.
+ */
+public class MainActivity extends SampleActivityBase {
+
+ public static final String TAG = "MainActivity";
+
+ // Whether the Log Fragment is currently shown
+ private boolean mLogShown;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+
+ if (savedInstanceState == null) {
+ FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
+ BluetoothChatFragment fragment = new BluetoothChatFragment();
+ transaction.replace(R.id.sample_content_fragment, fragment);
+ transaction.commit();
+ }
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.main, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onPrepareOptionsMenu(Menu menu) {
+ MenuItem logToggle = menu.findItem(R.id.menu_toggle_log);
+ logToggle.setVisible(findViewById(R.id.sample_output) instanceof ViewAnimator);
+ logToggle.setTitle(mLogShown ? R.string.sample_hide_log : R.string.sample_show_log);
+
+ return super.onPrepareOptionsMenu(menu);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch(item.getItemId()) {
+ case R.id.menu_toggle_log:
+ mLogShown = !mLogShown;
+ ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
+ if (mLogShown) {
+ output.setDisplayedChild(1);
+ } else {
+ output.setDisplayedChild(0);
+ }
+ supportInvalidateOptionsMenu();
+ return true;
+ }
+ return super.onOptionsItemSelected(item);
+ }
+
+ /** Create a chain of targets that will receive log data */
+ @Override
+ public void initializeLogging() {
+ // Wraps Android's native log framework.
+ LogWrapper logWrapper = new LogWrapper();
+ // Using Log, front-end to the logging chain, emulates android.util.log method signatures.
+ Log.setLogNode(logWrapper);
+
+ // Filter strips out everything except the message text.
+ MessageOnlyLogFilter msgFilter = new MessageOnlyLogFilter();
+ logWrapper.setNext(msgFilter);
+
+ // On screen logging via a fragment with a TextView.
+ LogFragment logFragment = (LogFragment) getSupportFragmentManager()
+ .findFragmentById(R.id.log_fragment);
+ msgFilter.setNext(logFragment.getLogView());
+
+ Log.i(TAG, "Ready");
+ }
+}
diff --git a/samples/browseable/BluetoothChat/src/com.example.android.common/activities/SampleActivityBase.java b/samples/browseable/BluetoothChat/src/com.example.android.common/activities/SampleActivityBase.java
new file mode 100644
index 000000000..3228927b7
--- /dev/null
+++ b/samples/browseable/BluetoothChat/src/com.example.android.common/activities/SampleActivityBase.java
@@ -0,0 +1,52 @@
+/*
+* Copyright 2013 The Android Open Source Project
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package com.example.android.common.activities;
+
+import android.os.Bundle;
+import android.support.v4.app.FragmentActivity;
+
+import com.example.android.common.logger.Log;
+import com.example.android.common.logger.LogWrapper;
+
+/**
+ * Base launcher activity, to handle most of the common plumbing for samples.
+ */
+public class SampleActivityBase extends FragmentActivity {
+
+ public static final String TAG = "SampleActivityBase";
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ }
+
+ @Override
+ protected void onStart() {
+ super.onStart();
+ initializeLogging();
+ }
+
+ /** Set up targets to receive log data */
+ public void initializeLogging() {
+ // Using Log, front-end to the logging chain, emulates android.util.log method signatures.
+ // Wraps Android's native log framework
+ LogWrapper logWrapper = new LogWrapper();
+ Log.setLogNode(logWrapper);
+
+ Log.i(TAG, "Ready");
+ }
+}
diff --git a/samples/browseable/BluetoothChat/src/com.example.android.common/logger/Log.java b/samples/browseable/BluetoothChat/src/com.example.android.common/logger/Log.java
new file mode 100644
index 000000000..17503c568
--- /dev/null
+++ b/samples/browseable/BluetoothChat/src/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);
+ }
+}
diff --git a/samples/browseable/BluetoothChat/src/com.example.android.common/logger/LogFragment.java b/samples/browseable/BluetoothChat/src/com.example.android.common/logger/LogFragment.java
new file mode 100644
index 000000000..b302acd4b
--- /dev/null
+++ b/samples/browseable/BluetoothChat/src/com.example.android.common/logger/LogFragment.java
@@ -0,0 +1,109 @@
+/*
+* 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 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.graphics.Typeface;
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ScrollView;
+
+/**
+ * Simple fraggment which contains a LogView and uses is to output log data it receives
+ * through the LogNode interface.
+ */
+public class LogFragment extends Fragment {
+
+ private LogView mLogView;
+ private ScrollView mScrollView;
+
+ public LogFragment() {}
+
+ public View inflateViews() {
+ mScrollView = new ScrollView(getActivity());
+ ViewGroup.LayoutParams scrollParams = new ViewGroup.LayoutParams(
+ ViewGroup.LayoutParams.MATCH_PARENT,
+ ViewGroup.LayoutParams.MATCH_PARENT);
+ mScrollView.setLayoutParams(scrollParams);
+
+ mLogView = new LogView(getActivity());
+ ViewGroup.LayoutParams logParams = new ViewGroup.LayoutParams(scrollParams);
+ logParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
+ mLogView.setLayoutParams(logParams);
+ mLogView.setClickable(true);
+ mLogView.setFocusable(true);
+ mLogView.setTypeface(Typeface.MONOSPACE);
+
+ // Want to set padding as 16 dips, setPadding takes pixels. Hooray math!
+ int paddingDips = 16;
+ double scale = getResources().getDisplayMetrics().density;
+ int paddingPixels = (int) ((paddingDips * (scale)) + .5);
+ mLogView.setPadding(paddingPixels, paddingPixels, paddingPixels, paddingPixels);
+ mLogView.setCompoundDrawablePadding(paddingPixels);
+
+ mLogView.setGravity(Gravity.BOTTOM);
+ mLogView.setTextAppearance(getActivity(), android.R.style.TextAppearance_Holo_Medium);
+
+ mScrollView.addView(mLogView);
+ return mScrollView;
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+
+ View result = inflateViews();
+
+ 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) {
+ mScrollView.fullScroll(ScrollView.FOCUS_DOWN);
+ }
+ });
+ return result;
+ }
+
+ public LogView getLogView() {
+ return mLogView;
+ }
+} \ No newline at end of file
diff --git a/samples/browseable/BluetoothChat/src/com.example.android.common/logger/LogNode.java b/samples/browseable/BluetoothChat/src/com.example.android.common/logger/LogNode.java
new file mode 100644
index 000000000..bc37cabc0
--- /dev/null
+++ b/samples/browseable/BluetoothChat/src/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/samples/browseable/BluetoothChat/src/com.example.android.common/logger/LogView.java b/samples/browseable/BluetoothChat/src/com.example.android.common/logger/LogView.java
new file mode 100644
index 000000000..c01542b91
--- /dev/null
+++ b/samples/browseable/BluetoothChat/src/com.example.android.common/logger/LogView.java
@@ -0,0 +1,145 @@
+/*
+ * 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.app.Activity;
+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.
+ final StringBuilder outputBuilder = new StringBuilder();
+
+ String delimiter = "\t";
+ appendIfNotNull(outputBuilder, priorityStr, delimiter);
+ appendIfNotNull(outputBuilder, tag, delimiter);
+ appendIfNotNull(outputBuilder, msg, delimiter);
+ appendIfNotNull(outputBuilder, exceptionStr, delimiter);
+
+ // In case this was originally called from an AsyncTask or some other off-UI thread,
+ // make sure the update occurs within the UI thread.
+ ((Activity) getContext()).runOnUiThread( (new Thread(new Runnable() {
+ @Override
+ public void run() {
+ // 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/samples/browseable/BluetoothChat/src/com.example.android.common/logger/LogWrapper.java b/samples/browseable/BluetoothChat/src/com.example.android.common/logger/LogWrapper.java
new file mode 100644
index 000000000..16a9e7ba2
--- /dev/null
+++ b/samples/browseable/BluetoothChat/src/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);
+ }
+ }
+}
diff --git a/samples/browseable/BluetoothChat/src/com.example.android.common/logger/MessageOnlyLogFilter.java b/samples/browseable/BluetoothChat/src/com.example.android.common/logger/MessageOnlyLogFilter.java
new file mode 100644
index 000000000..19967dcd4
--- /dev/null
+++ b/samples/browseable/BluetoothChat/src/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 chain.
+ */
+ public LogNode getNext() {
+ return mNext;
+ }
+
+ /**
+ * Sets the LogNode data will be sent to..
+ */
+ public void setNext(LogNode node) {
+ mNext = node;
+ }
+
+}
diff --git a/samples/browseable/BluetoothLeGatt/AndroidManifest.xml b/samples/browseable/BluetoothLeGatt/AndroidManifest.xml
index babd6df2d..d3cf25757 100644
--- a/samples/browseable/BluetoothLeGatt/AndroidManifest.xml
+++ b/samples/browseable/BluetoothLeGatt/AndroidManifest.xml
@@ -22,8 +22,8 @@
android:versionCode="1"
android:versionName="1.0">
- <uses-sdk android:minSdkVersion="18"
- android:targetSdkVersion="18"/>
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
+
<!-- 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
diff --git a/samples/browseable/BluetoothLeGatt/_index.jd b/samples/browseable/BluetoothLeGatt/_index.jd
index 6e8966940..13d9cb68c 100644
--- a/samples/browseable/BluetoothLeGatt/_index.jd
+++ b/samples/browseable/BluetoothLeGatt/_index.jd
@@ -1,12 +1,10 @@
-
-
-
page.tags="BluetoothLeGatt"
sample.group=Connectivity
@jd:body
-<p>This sample demonstrates how to use the Bluetooth Low Energy Generic
-Attribute Profile (GATT) to transmit arbitrary data between devices. For more
-information about using Android's suppport for Bluetooth Low Energy, see
-<a href="{@docRoot}guide/topics/connectivity/bluetooth-le.html">Bluetooth Low
-Energy</a>.</p>
+<p>
+
+ This sample demonstrates how to use the Bluetooth LE Generic Attribute Profile (GATT)
+ to transmit arbitrary data between devices.
+
+ </p>
diff --git a/samples/browseable/BluetoothLeGatt/res/values-v21/base-colors.xml b/samples/browseable/BluetoothLeGatt/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/BluetoothLeGatt/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/BluetoothLeGatt/res/values-v21/base-template-styles.xml b/samples/browseable/BluetoothLeGatt/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/BluetoothLeGatt/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/BluetoothLeGatt/res/values/base-strings.xml b/samples/browseable/BluetoothLeGatt/res/values/base-strings.xml
index 58b49a95f..f3b546cba 100644
--- a/samples/browseable/BluetoothLeGatt/res/values/base-strings.xml
+++ b/samples/browseable/BluetoothLeGatt/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">BluetoothLeGatt</string>
<string name="intro_message">
diff --git a/samples/browseable/BorderlessButtons/AndroidManifest.xml b/samples/browseable/BorderlessButtons/AndroidManifest.xml
index 34b28985d..90b92cfb5 100644
--- a/samples/browseable/BorderlessButtons/AndroidManifest.xml
+++ b/samples/browseable/BorderlessButtons/AndroidManifest.xml
@@ -28,7 +28,7 @@
This sample requires API 14 for use of theme attributes such as
?android:listPreferredItemPaddingLeft.
-->
- <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="17" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<application android:label="@string/app_name"
android:icon="@drawable/ic_launcher"
diff --git a/samples/browseable/BorderlessButtons/_index.jd b/samples/browseable/BorderlessButtons/_index.jd
index 0d43c98be..a940d1848 100644
--- a/samples/browseable/BorderlessButtons/_index.jd
+++ b/samples/browseable/BorderlessButtons/_index.jd
@@ -1,9 +1,10 @@
-
-
-
page.tags="BorderlessButtons"
sample.group=UI
@jd:body
-<p>This sample demonstrates how to apply borderless buttons, bottom button bars
-(OK and Cancel), and dividers to establish visual structure.</p>
+<p>
+
+ This sample demonstrates the use of borderless buttons, bottom button bars
+ (OK and Cancel) and dividers to establish visual structure.
+
+ </p>
diff --git a/samples/browseable/BorderlessButtons/res/values-v21/base-colors.xml b/samples/browseable/BorderlessButtons/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/BorderlessButtons/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/BorderlessButtons/res/values-v21/base-template-styles.xml b/samples/browseable/BorderlessButtons/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/BorderlessButtons/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/BorderlessButtons/res/values/base-strings.xml b/samples/browseable/BorderlessButtons/res/values/base-strings.xml
index efbd14d01..14f5df2d6 100644
--- a/samples/browseable/BorderlessButtons/res/values/base-strings.xml
+++ b/samples/browseable/BorderlessButtons/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">BorderlessButtons</string>
<string name="intro_message">
diff --git a/samples/browseable/Camera2Basic/res/values-v21/base-colors.xml b/samples/browseable/Camera2Basic/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/Camera2Basic/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/Camera2Basic/res/values-v21/base-template-styles.xml b/samples/browseable/Camera2Basic/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/Camera2Basic/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/Camera2Basic/res/values-v21/template-styles.xml b/samples/browseable/Camera2Basic/res/values-v21/template-styles.xml
deleted file mode 100644
index 134fcd9d3..000000000
--- a/samples/browseable/Camera2Basic/res/values-v21/template-styles.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<!--
- Copyright 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<resources>
-
- <!-- Activity themes -->
- <style name="Theme.Base" parent="android:Theme.Material.Light" />
-
-</resources>
diff --git a/samples/browseable/Camera2Basic/src/com.example.android.camera2basic/Camera2BasicFragment.java b/samples/browseable/Camera2Basic/src/com.example.android.camera2basic/Camera2BasicFragment.java
index f4bf2207c..4b5535859 100644
--- a/samples/browseable/Camera2Basic/src/com.example.android.camera2basic/Camera2BasicFragment.java
+++ b/samples/browseable/Camera2Basic/src/com.example.android.camera2basic/Camera2BasicFragment.java
@@ -266,8 +266,10 @@ public class Camera2BasicFragment extends Fragment implements View.OnClickListen
int afState = result.get(CaptureResult.CONTROL_AF_STATE);
if (CaptureResult.CONTROL_AF_STATE_FOCUSED_LOCKED == afState ||
CaptureResult.CONTROL_AF_STATE_NOT_FOCUSED_LOCKED == afState) {
- int aeState = result.get(CaptureResult.CONTROL_AE_STATE);
- if (aeState == CaptureResult.CONTROL_AE_STATE_CONVERGED) {
+ // CONTROL_AE_STATE can be null on some devices
+ Integer aeState = result.get(CaptureResult.CONTROL_AE_STATE);
+ if (aeState == null ||
+ aeState == CaptureResult.CONTROL_AE_STATE_CONVERGED) {
mState = STATE_WAITING_NON_PRECAPTURE;
captureStillPicture();
} else {
@@ -277,17 +279,19 @@ public class Camera2BasicFragment extends Fragment implements View.OnClickListen
break;
}
case STATE_WAITING_PRECAPTURE: {
- int aeState = result.get(CaptureResult.CONTROL_AE_STATE);
- if (CaptureResult.CONTROL_AE_STATE_PRECAPTURE == aeState) {
- mState = STATE_WAITING_NON_PRECAPTURE;
- } else if (CaptureRequest.CONTROL_AE_STATE_FLASH_REQUIRED == aeState) {
+ // CONTROL_AE_STATE can be null on some devices
+ Integer aeState = result.get(CaptureResult.CONTROL_AE_STATE);
+ if (aeState == null ||
+ aeState == CaptureResult.CONTROL_AE_STATE_PRECAPTURE ||
+ aeState == CaptureRequest.CONTROL_AE_STATE_FLASH_REQUIRED) {
mState = STATE_WAITING_NON_PRECAPTURE;
}
break;
}
case STATE_WAITING_NON_PRECAPTURE: {
- int aeState = result.get(CaptureResult.CONTROL_AE_STATE);
- if (CaptureResult.CONTROL_AE_STATE_PRECAPTURE != aeState) {
+ // CONTROL_AE_STATE can be null on some devices
+ Integer aeState = result.get(CaptureResult.CONTROL_AE_STATE);
+ if (aeState == null || aeState != CaptureResult.CONTROL_AE_STATE_PRECAPTURE) {
mState = STATE_PICTURE_TAKEN;
captureStillPicture();
}
diff --git a/samples/browseable/Camera2Video/res/values-v21/base-colors.xml b/samples/browseable/Camera2Video/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/Camera2Video/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/Camera2Video/res/values-v21/base-template-styles.xml b/samples/browseable/Camera2Video/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/Camera2Video/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/Camera2Video/res/values-v21/template-styles.xml b/samples/browseable/Camera2Video/res/values-v21/template-styles.xml
deleted file mode 100644
index 134fcd9d3..000000000
--- a/samples/browseable/Camera2Video/res/values-v21/template-styles.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<!--
- Copyright 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<resources>
-
- <!-- Activity themes -->
- <style name="Theme.Base" parent="android:Theme.Material.Light" />
-
-</resources>
diff --git a/samples/browseable/CardEmulation/AndroidManifest.xml b/samples/browseable/CardEmulation/AndroidManifest.xml
index 4a4af0882..fba9a74d7 100644
--- a/samples/browseable/CardEmulation/AndroidManifest.xml
+++ b/samples/browseable/CardEmulation/AndroidManifest.xml
@@ -21,7 +21,7 @@
android:versionName="1.0">
<!-- Card emulation was introduced in API 19. -->
- <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="19" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<uses-feature android:name="android.hardware.nfc.hce" android:required="true" />
<uses-permission android:name="android.permission.NFC" />
diff --git a/samples/browseable/CardEmulation/_index.jd b/samples/browseable/CardEmulation/_index.jd
index 1f3e3c7d3..6a4ce5d72 100644
--- a/samples/browseable/CardEmulation/_index.jd
+++ b/samples/browseable/CardEmulation/_index.jd
@@ -1,19 +1,14 @@
-
-
-
page.tags="CardEmulation"
sample.group=Connectivity
@jd:body
<p>
- This sample demonstrates how to emulate an NFC card, using the <a href=
- "{@docRoot}guide/topics/connectivity/nfc/hce.html">Host Card Emulation</a>
- feature added in Android 4.4. This sample makes the device appear as a
- loyalty card whenever the screen is on and the user taps their device on an
- appropriately configured NFC reader.
-</p>
-
-<p>
- The <a href="{@docRoot}samples/CardReader/index.html">CardReader</a> sample
- can be used to read the loyalty card implemented in this sample.
-</p>
+
+ This sample demonstrates how to emulate an NFC card, using the "host card emulation"
+ feature added in Android 4.4. This sample makes the device appear as a loyalty card
+ whenever the screen is on and the user taps their device on an appropriately configured
+ NFC reader.
+
+ The "CardReader" sample can be used to read the loyalty card implemented in this sample.
+
+ </p>
diff --git a/samples/browseable/CardEmulation/res/values-v21/base-colors.xml b/samples/browseable/CardEmulation/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/CardEmulation/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/CardEmulation/res/values-v21/base-template-styles.xml b/samples/browseable/CardEmulation/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/CardEmulation/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/CardEmulation/res/values/base-strings.xml b/samples/browseable/CardEmulation/res/values/base-strings.xml
index 9062a239a..8bd733216 100644
--- a/samples/browseable/CardEmulation/res/values/base-strings.xml
+++ b/samples/browseable/CardEmulation/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">CardEmulation</string>
<string name="intro_message">
diff --git a/samples/browseable/CardEmulation/res/values/strings.xml b/samples/browseable/CardEmulation/res/values/strings.xml
index f7082845f..f7082845f 100755..100644
--- a/samples/browseable/CardEmulation/res/values/strings.xml
+++ b/samples/browseable/CardEmulation/res/values/strings.xml
diff --git a/samples/browseable/CardEmulation/src/com.example.android.cardemulation/MainActivity.java b/samples/browseable/CardEmulation/src/com.example.android.cardemulation/MainActivity.java
index 0515609d0..af0b9f310 100644
--- a/samples/browseable/CardEmulation/src/com.example.android.cardemulation/MainActivity.java
+++ b/samples/browseable/CardEmulation/src/com.example.android.cardemulation/MainActivity.java
@@ -14,9 +14,6 @@
* limitations under the License.
*/
-
-
-
package com.example.android.cardemulation;
import android.os.Bundle;
@@ -50,10 +47,12 @@ public class MainActivity extends SampleActivityBase {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
- FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
- CardEmulationFragment fragment = new CardEmulationFragment();
- transaction.replace(R.id.sample_content_fragment, fragment);
- transaction.commit();
+ if (savedInstanceState == null) {
+ FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
+ CardEmulationFragment fragment = new CardEmulationFragment();
+ transaction.replace(R.id.sample_content_fragment, fragment);
+ transaction.commit();
+ }
}
@Override
diff --git a/samples/browseable/CardReader/AndroidManifest.xml b/samples/browseable/CardReader/AndroidManifest.xml
index a8ebd133a..ed25c6f56 100644
--- a/samples/browseable/CardReader/AndroidManifest.xml
+++ b/samples/browseable/CardReader/AndroidManifest.xml
@@ -21,7 +21,7 @@
android:versionName="1.0">
<!-- NFC Reader Mode was added in API 19. -->
- <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="19" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<uses-permission android:name="android.permission.NFC" />
<uses-feature android:name="android.hardware.nfc" android:required="true" />
diff --git a/samples/browseable/CardReader/_index.jd b/samples/browseable/CardReader/_index.jd
index 9ba051e19..4322b3fb6 100644
--- a/samples/browseable/CardReader/_index.jd
+++ b/samples/browseable/CardReader/_index.jd
@@ -1,20 +1,14 @@
-
-
-
page.tags="CardReader"
sample.group=Connectivity
@jd:body
<p>
- This sample demonstrates how to implement a low-level NFC card reader, for
- reading cards that do not contain NDEF or Android Beam data. This sample is
- designed to read the virtual loyalty card implemented in the <a href=
- "{@docRoot}samples/CardEmulation/index.html">CardEmulation</a> sample.
-</p>
-
-<p>
- In particular, this sample demonstrates how to disable Android Beam, select
- which AIDs the reader is interested in, and establish communication with the
- card. See <a href="{@docRoot}guide/topics/connectivity/nfc/hce.html">Host-based
- Card Emulation</a> for more information on the HCE APIs.
-</p>
+
+ This sample demonstrates how to implement a low-level NFC card reader, for reading cards
+ that do not contain NDEF or Android Beam data. This sample is designed to read the virtual
+ loyalty card implemented in the "CardEmulation" sample.\n\n
+
+ In particular, this sample demonstrates how to disable Android Beam, select which AIDs the
+ reader is interested, and establish communication with the card
+
+ </p>
diff --git a/samples/browseable/CardReader/res/values-v21/base-colors.xml b/samples/browseable/CardReader/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/CardReader/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/CardReader/res/values-v21/base-template-styles.xml b/samples/browseable/CardReader/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/CardReader/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/CardReader/res/values/base-strings.xml b/samples/browseable/CardReader/res/values/base-strings.xml
index ac1248054..efede3bce 100644
--- a/samples/browseable/CardReader/res/values/base-strings.xml
+++ b/samples/browseable/CardReader/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">CardReader</string>
<string name="intro_message">
diff --git a/samples/browseable/CardReader/res/values/strings.xml b/samples/browseable/CardReader/res/values/strings.xml
index b1b1a4954..b1b1a4954 100755..100644
--- a/samples/browseable/CardReader/res/values/strings.xml
+++ b/samples/browseable/CardReader/res/values/strings.xml
diff --git a/samples/browseable/CardReader/src/com.example.android.cardreader/MainActivity.java b/samples/browseable/CardReader/src/com.example.android.cardreader/MainActivity.java
index e0280e998..ac6327d30 100644
--- a/samples/browseable/CardReader/src/com.example.android.cardreader/MainActivity.java
+++ b/samples/browseable/CardReader/src/com.example.android.cardreader/MainActivity.java
@@ -14,9 +14,6 @@
* limitations under the License.
*/
-
-
-
package com.example.android.cardreader;
import android.os.Bundle;
@@ -50,10 +47,12 @@ public class MainActivity extends SampleActivityBase {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
- FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
- CardReaderFragment fragment = new CardReaderFragment();
- transaction.replace(R.id.sample_content_fragment, fragment);
- transaction.commit();
+ if (savedInstanceState == null) {
+ FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
+ CardReaderFragment fragment = new CardReaderFragment();
+ transaction.replace(R.id.sample_content_fragment, fragment);
+ transaction.commit();
+ }
}
@Override
diff --git a/samples/browseable/CardView/res/values-v21/base-colors.xml b/samples/browseable/CardView/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/CardView/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/CardView/res/values-v21/base-template-styles.xml b/samples/browseable/CardView/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/CardView/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/CardView/res/values-v21/template-styles.xml b/samples/browseable/CardView/res/values-v21/template-styles.xml
deleted file mode 100644
index 134fcd9d3..000000000
--- a/samples/browseable/CardView/res/values-v21/template-styles.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<!--
- Copyright 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<resources>
-
- <!-- Activity themes -->
- <style name="Theme.Base" parent="android:Theme.Material.Light" />
-
-</resources>
diff --git a/samples/browseable/ClippingBasic/res/values-v21/base-colors.xml b/samples/browseable/ClippingBasic/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/ClippingBasic/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/ClippingBasic/res/values-v21/base-template-styles.xml b/samples/browseable/ClippingBasic/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/ClippingBasic/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/ClippingBasic/res/values-v21/template-styles.xml b/samples/browseable/ClippingBasic/res/values-v21/template-styles.xml
deleted file mode 100644
index 134fcd9d3..000000000
--- a/samples/browseable/ClippingBasic/res/values-v21/template-styles.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<!--
- Copyright 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<resources>
-
- <!-- Activity themes -->
- <style name="Theme.Base" parent="android:Theme.Material.Light" />
-
-</resources>
diff --git a/samples/browseable/CustomChoiceList/AndroidManifest.xml b/samples/browseable/CustomChoiceList/AndroidManifest.xml
index 8c194f536..8b0653e57 100644
--- a/samples/browseable/CustomChoiceList/AndroidManifest.xml
+++ b/samples/browseable/CustomChoiceList/AndroidManifest.xml
@@ -19,7 +19,7 @@
android:versionCode="1"
android:versionName="1.0">
- <uses-sdk android:minSdkVersion="3" android:targetSdkVersion="17" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<application android:label="@string/app_name"
android:icon="@drawable/ic_launcher"
diff --git a/samples/browseable/CustomChoiceList/_index.jd b/samples/browseable/CustomChoiceList/_index.jd
index 67a23cc93..65ad14ff5 100644
--- a/samples/browseable/CustomChoiceList/_index.jd
+++ b/samples/browseable/CustomChoiceList/_index.jd
@@ -1,9 +1,10 @@
-
-
-
page.tags="CustomChoiceList"
sample.group=UI
@jd:body
-<p>This sample demonstrates how to implement a custom single-choice or
-multi-choice {@link android.widget.ListView} user interface.</p>
+<p>
+
+ This sample demonstrates how to create custom checkable layouts, for use with ListView\'s choiceMode
+ attribute.
+
+ </p>
diff --git a/samples/browseable/CustomChoiceList/res/values-v21/base-colors.xml b/samples/browseable/CustomChoiceList/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/CustomChoiceList/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/CustomChoiceList/res/values-v21/base-template-styles.xml b/samples/browseable/CustomChoiceList/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/CustomChoiceList/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/CustomChoiceList/res/values/base-strings.xml b/samples/browseable/CustomChoiceList/res/values/base-strings.xml
index e2890c46a..b5fdc00f9 100644
--- a/samples/browseable/CustomChoiceList/res/values/base-strings.xml
+++ b/samples/browseable/CustomChoiceList/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">CustomChoiceList</string>
<string name="intro_message">
diff --git a/samples/browseable/CustomNotifications/AndroidManifest.xml b/samples/browseable/CustomNotifications/AndroidManifest.xml
index b20a41196..3054ad7cf 100644
--- a/samples/browseable/CustomNotifications/AndroidManifest.xml
+++ b/samples/browseable/CustomNotifications/AndroidManifest.xml
@@ -22,9 +22,7 @@
android:versionCode="1"
android:versionName="1.0">
- <uses-sdk
- android:minSdkVersion="4"
- android:targetSdkVersion="18" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<application
android:allowBackup="true"
diff --git a/samples/browseable/CustomNotifications/_index.jd b/samples/browseable/CustomNotifications/_index.jd
index ab3499c1c..86c829a27 100644
--- a/samples/browseable/CustomNotifications/_index.jd
+++ b/samples/browseable/CustomNotifications/_index.jd
@@ -1,9 +1,9 @@
-
-
-
page.tags="CustomNotifications"
-sample.group=UI
+sample.group=Notification
@jd:body
-<p>This sample demonstrates how to implement expanded notifications that
-display custom views.</p>
+<p>
+
+ This sample demonstrates notifications with custom content views.
+
+ </p>
diff --git a/samples/browseable/CustomNotifications/res/values-v21/base-colors.xml b/samples/browseable/CustomNotifications/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/CustomNotifications/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/CustomNotifications/res/values-v21/base-template-styles.xml b/samples/browseable/CustomNotifications/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/CustomNotifications/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/CustomNotifications/res/values/base-strings.xml b/samples/browseable/CustomNotifications/res/values/base-strings.xml
index 7ddbc2dc2..ad3bb89cd 100644
--- a/samples/browseable/CustomNotifications/res/values/base-strings.xml
+++ b/samples/browseable/CustomNotifications/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">CustomNotifications</string>
<string name="intro_message">
diff --git a/samples/browseable/CustomTransition/AndroidManifest.xml b/samples/browseable/CustomTransition/AndroidManifest.xml
index b3328f19a..010cf7836 100644
--- a/samples/browseable/CustomTransition/AndroidManifest.xml
+++ b/samples/browseable/CustomTransition/AndroidManifest.xml
@@ -22,7 +22,7 @@
android:versionCode="1"
android:versionName="1.0">
- <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="19" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<application android:allowBackup="true"
android:label="@string/app_name"
diff --git a/samples/browseable/CustomTransition/_index.jd b/samples/browseable/CustomTransition/_index.jd
index c68a76201..f5f16feb3 100644
--- a/samples/browseable/CustomTransition/_index.jd
+++ b/samples/browseable/CustomTransition/_index.jd
@@ -1,8 +1,9 @@
-
-
-
page.tags="CustomTransition"
sample.group=UI
@jd:body
-<p>This sample demonstrates how to create and use a custom {@link android.transition.Transition}.</p>
+<p>
+
+ This sample demonstrates how to create and use a custom Transition.
+
+ </p>
diff --git a/samples/browseable/CustomTransition/res/values-v21/base-colors.xml b/samples/browseable/CustomTransition/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/CustomTransition/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/CustomTransition/res/values-v21/base-template-styles.xml b/samples/browseable/CustomTransition/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/CustomTransition/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/CustomTransition/res/values/base-strings.xml b/samples/browseable/CustomTransition/res/values/base-strings.xml
index 68c9c4146..ee1dad40a 100644
--- a/samples/browseable/CustomTransition/res/values/base-strings.xml
+++ b/samples/browseable/CustomTransition/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">CustomTransition</string>
<string name="intro_message">
diff --git a/samples/browseable/CustomTransition/src/com.example.android.customtransition/MainActivity.java b/samples/browseable/CustomTransition/src/com.example.android.customtransition/MainActivity.java
index 04c4e4d9b..bbb6dc06e 100644
--- a/samples/browseable/CustomTransition/src/com.example.android.customtransition/MainActivity.java
+++ b/samples/browseable/CustomTransition/src/com.example.android.customtransition/MainActivity.java
@@ -14,9 +14,6 @@
* limitations under the License.
*/
-
-
-
package com.example.android.customtransition;
import android.os.Bundle;
@@ -50,10 +47,12 @@ public class MainActivity extends SampleActivityBase {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
- FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
- CustomTransitionFragment fragment = new CustomTransitionFragment();
- transaction.replace(R.id.sample_content_fragment, fragment);
- transaction.commit();
+ if (savedInstanceState == null) {
+ FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
+ CustomTransitionFragment fragment = new CustomTransitionFragment();
+ transaction.replace(R.id.sample_content_fragment, fragment);
+ transaction.commit();
+ }
}
@Override
diff --git a/samples/browseable/DataLayer/Application/AndroidManifest.xml b/samples/browseable/DataLayer/Application/AndroidManifest.xml
new file mode 100644
index 000000000..6f7e81e8a
--- /dev/null
+++ b/samples/browseable/DataLayer/Application/AndroidManifest.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.wearable.datalayer" >
+
+ <uses-sdk android:minSdkVersion="18"
+ android:targetSdkVersion="21" />
+
+ <uses-feature android:name="android.hardware.camera" android:required="false" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name">
+
+ <meta-data
+ android:name="com.google.android.gms.version"
+ android:value="@integer/google_play_services_version" />
+
+ <activity
+ android:name=".MainActivity"
+ android:label="@string/app_name"
+ android:launchMode="singleTask" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+</manifest>
diff --git a/samples/wearable/DataLayer/Application/src/main/res/drawable-hdpi/ic_content_picture.png b/samples/browseable/DataLayer/Application/res/drawable-hdpi/ic_content_picture.png
index 597997ca3..597997ca3 100644
--- a/samples/wearable/DataLayer/Application/src/main/res/drawable-hdpi/ic_content_picture.png
+++ b/samples/browseable/DataLayer/Application/res/drawable-hdpi/ic_content_picture.png
Binary files differ
diff --git a/samples/wearable/DataLayer/Application/src/main/res/drawable-hdpi/ic_launcher.png b/samples/browseable/DataLayer/Application/res/drawable-hdpi/ic_launcher.png
index 589f229d1..589f229d1 100755
--- a/samples/wearable/DataLayer/Application/src/main/res/drawable-hdpi/ic_launcher.png
+++ b/samples/browseable/DataLayer/Application/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/DataLayer/Application/res/drawable-hdpi/tile.9.png b/samples/browseable/DataLayer/Application/res/drawable-hdpi/tile.9.png
new file mode 100644
index 000000000..135862883
--- /dev/null
+++ b/samples/browseable/DataLayer/Application/res/drawable-hdpi/tile.9.png
Binary files differ
diff --git a/samples/wearable/DataLayer/Application/src/main/res/drawable-mdpi/ic_content_picture.png b/samples/browseable/DataLayer/Application/res/drawable-mdpi/ic_content_picture.png
index c23f4c039..c23f4c039 100644
--- a/samples/wearable/DataLayer/Application/src/main/res/drawable-mdpi/ic_content_picture.png
+++ b/samples/browseable/DataLayer/Application/res/drawable-mdpi/ic_content_picture.png
Binary files differ
diff --git a/samples/wearable/DataLayer/Application/src/main/res/drawable-mdpi/ic_launcher.png b/samples/browseable/DataLayer/Application/res/drawable-mdpi/ic_launcher.png
index 77dd57139..77dd57139 100755
--- a/samples/wearable/DataLayer/Application/src/main/res/drawable-mdpi/ic_launcher.png
+++ b/samples/browseable/DataLayer/Application/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/DataLayer/Application/src/main/res/drawable-xhdpi/ic_content_picture.png b/samples/browseable/DataLayer/Application/res/drawable-xhdpi/ic_content_picture.png
index 289adf11a..289adf11a 100644
--- a/samples/wearable/DataLayer/Application/src/main/res/drawable-xhdpi/ic_content_picture.png
+++ b/samples/browseable/DataLayer/Application/res/drawable-xhdpi/ic_content_picture.png
Binary files differ
diff --git a/samples/wearable/DataLayer/Application/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/DataLayer/Application/res/drawable-xhdpi/ic_launcher.png
index fe34ebe13..fe34ebe13 100755
--- a/samples/wearable/DataLayer/Application/src/main/res/drawable-xhdpi/ic_launcher.png
+++ b/samples/browseable/DataLayer/Application/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/DataLayer/Application/src/main/res/drawable-xxhdpi/ic_content_picture.png b/samples/browseable/DataLayer/Application/res/drawable-xxhdpi/ic_content_picture.png
index 073ad553e..073ad553e 100644
--- a/samples/wearable/DataLayer/Application/src/main/res/drawable-xxhdpi/ic_content_picture.png
+++ b/samples/browseable/DataLayer/Application/res/drawable-xxhdpi/ic_content_picture.png
Binary files differ
diff --git a/samples/wearable/DataLayer/Application/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/DataLayer/Application/res/drawable-xxhdpi/ic_launcher.png
index ab80bcd13..ab80bcd13 100755
--- a/samples/wearable/DataLayer/Application/src/main/res/drawable-xxhdpi/ic_launcher.png
+++ b/samples/browseable/DataLayer/Application/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/DataLayer/Application/src/main/res/drawable/divider.xml b/samples/browseable/DataLayer/Application/res/drawable/divider.xml
index 95c4d33c6..95c4d33c6 100644
--- a/samples/wearable/DataLayer/Application/src/main/res/drawable/divider.xml
+++ b/samples/browseable/DataLayer/Application/res/drawable/divider.xml
diff --git a/samples/browseable/DataLayer/Application/res/layout/activity_main.xml b/samples/browseable/DataLayer/Application/res/layout/activity_main.xml
new file mode 100755
index 000000000..be1aa49d9
--- /dev/null
+++ b/samples/browseable/DataLayer/Application/res/layout/activity_main.xml
@@ -0,0 +1,36 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <LinearLayout style="@style/Widget.SampleMessageTile"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView style="@style/Widget.SampleMessage"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="@dimen/horizontal_page_margin"
+ android:layout_marginRight="@dimen/horizontal_page_margin"
+ android:layout_marginTop="@dimen/vertical_page_margin"
+ android:layout_marginBottom="@dimen/vertical_page_margin"
+ android:text="@string/intro_message" />
+ </LinearLayout>
+</LinearLayout>
diff --git a/samples/wearable/DataLayer/Application/src/main/res/layout/main_activity.xml b/samples/browseable/DataLayer/Application/res/layout/main_activity.xml
index 0412023d6..0412023d6 100644
--- a/samples/wearable/DataLayer/Application/src/main/res/layout/main_activity.xml
+++ b/samples/browseable/DataLayer/Application/res/layout/main_activity.xml
diff --git a/samples/browseable/DataLayer/Application/res/values-sw600dp/template-dimens.xml b/samples/browseable/DataLayer/Application/res/values-sw600dp/template-dimens.xml
new file mode 100644
index 000000000..22074a2bd
--- /dev/null
+++ b/samples/browseable/DataLayer/Application/res/values-sw600dp/template-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>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_huge</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/DataLayer/Application/res/values-sw600dp/template-styles.xml b/samples/browseable/DataLayer/Application/res/values-sw600dp/template-styles.xml
new file mode 100644
index 000000000..03d197418
--- /dev/null
+++ b/samples/browseable/DataLayer/Application/res/values-sw600dp/template-styles.xml
@@ -0,0 +1,25 @@
+<!--
+ 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.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceLarge</item>
+ <item name="android:lineSpacingMultiplier">1.2</item>
+ <item name="android:shadowDy">-6.5</item>
+ </style>
+
+</resources>
diff --git a/samples/browseable/DataLayer/Application/res/values-v11/template-styles.xml b/samples/browseable/DataLayer/Application/res/values-v11/template-styles.xml
new file mode 100644
index 000000000..8c1ea66f2
--- /dev/null
+++ b/samples/browseable/DataLayer/Application/res/values-v11/template-styles.xml
@@ -0,0 +1,22 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Holo.Light" />
+
+</resources>
diff --git a/samples/browseable/DataLayer/Application/res/values-v21/base-colors.xml b/samples/browseable/DataLayer/Application/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/DataLayer/Application/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/DataLayer/Application/res/values-v21/base-template-styles.xml b/samples/browseable/DataLayer/Application/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/DataLayer/Application/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/DataLayer/Application/res/values/base-strings.xml b/samples/browseable/DataLayer/Application/res/values/base-strings.xml
new file mode 100644
index 000000000..856ec5420
--- /dev/null
+++ b/samples/browseable/DataLayer/Application/res/values/base-strings.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<resources>
+ <string name="app_name">DataLayer</string>
+ <string name="intro_message">
+ <![CDATA[
+
+
+ Sample demonstrating the usage of the GoogleApiClient in order to send data
+ from a handheld device to a wearable. The data transmitted is a picture taken by
+ the user of the sample.
+
+
+ ]]>
+ </string>
+</resources>
diff --git a/samples/browseable/DataLayer/Application/res/values/strings.xml b/samples/browseable/DataLayer/Application/res/values/strings.xml
new file mode 100644
index 000000000..9eba46ce2
--- /dev/null
+++ b/samples/browseable/DataLayer/Application/res/values/strings.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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 xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="start_wearable_activity">Start Wearable Activity</string>
+ <string name="start">Start</string>
+ <string name="take_photo">Take a Photo</string>
+ <string name="send_photo">Send Photo</string>
+</resources>
diff --git a/samples/wearable/DataLayer/Application/src/main/res/values/style.xml b/samples/browseable/DataLayer/Application/res/values/style.xml
index 81d6799f2..81d6799f2 100644
--- a/samples/wearable/DataLayer/Application/src/main/res/values/style.xml
+++ b/samples/browseable/DataLayer/Application/res/values/style.xml
diff --git a/samples/browseable/DataLayer/Application/res/values/template-dimens.xml b/samples/browseable/DataLayer/Application/res/values/template-dimens.xml
new file mode 100644
index 000000000..39e710b5c
--- /dev/null
+++ b/samples/browseable/DataLayer/Application/res/values/template-dimens.xml
@@ -0,0 +1,32 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Define standard dimensions to comply with Holo-style grids and rhythm. -->
+
+ <dimen name="margin_tiny">4dp</dimen>
+ <dimen name="margin_small">8dp</dimen>
+ <dimen name="margin_medium">16dp</dimen>
+ <dimen name="margin_large">32dp</dimen>
+ <dimen name="margin_huge">64dp</dimen>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_medium</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/DataLayer/Application/res/values/template-styles.xml b/samples/browseable/DataLayer/Application/res/values/template-styles.xml
new file mode 100644
index 000000000..6e7d593dd
--- /dev/null
+++ b/samples/browseable/DataLayer/Application/res/values/template-styles.xml
@@ -0,0 +1,42 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+
+ <style name="Theme.Base" parent="android:Theme.Light" />
+
+ <style name="Theme.Sample" parent="Theme.Base" />
+
+ <style name="AppTheme" parent="Theme.Sample" />
+ <!-- Widget styling -->
+
+ <style name="Widget" />
+
+ <style name="Widget.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceMedium</item>
+ <item name="android:lineSpacingMultiplier">1.1</item>
+ </style>
+
+ <style name="Widget.SampleMessageTile">
+ <item name="android:background">@drawable/tile</item>
+ <item name="android:shadowColor">#7F000000</item>
+ <item name="android:shadowDy">-3.5</item>
+ <item name="android:shadowRadius">2</item>
+ </style>
+
+</resources>
diff --git a/samples/wearable/DataLayer/Application/src/main/java/com/example/android/wearable/datalayer/MainActivity.java b/samples/browseable/DataLayer/Application/src/com.example.android.wearable.datalayer/MainActivity.java
index 23bc696d3..23bc696d3 100644
--- a/samples/wearable/DataLayer/Application/src/main/java/com/example/android/wearable/datalayer/MainActivity.java
+++ b/samples/browseable/DataLayer/Application/src/com.example.android.wearable.datalayer/MainActivity.java
diff --git a/samples/browseable/DataLayer/Wearable/AndroidManifest.xml b/samples/browseable/DataLayer/Wearable/AndroidManifest.xml
new file mode 100644
index 000000000..4cc903409
--- /dev/null
+++ b/samples/browseable/DataLayer/Wearable/AndroidManifest.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.wearable.datalayer" >
+
+ <uses-sdk android:minSdkVersion="20"
+ android:targetSdkVersion="21" />
+
+ <uses-feature android:name="android.hardware.type.watch" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@android:style/Theme.DeviceDefault">
+
+ <meta-data
+ android:name="com.google.android.gms.version"
+ android:value="@integer/google_play_services_version" />
+
+ <service
+ android:name=".DataLayerListenerService" >
+ <intent-filter>
+ <action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
+ </intent-filter>
+ </service>
+
+ <activity
+ android:name=".MainActivity"
+ android:label="@string/app_name">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="android.intent.category.LAUNCHER"/>
+ </intent-filter>
+ <intent-filter>
+ <action android:name="com.example.android.wearable.datalayer.EXAMPLE"/>
+ <category android:name="android.intent.category.DEFAULT"/>
+ </intent-filter>
+ </activity>
+ </application>
+</manifest>
diff --git a/samples/wearable/DataLayer/Wearable/src/main/res/drawable-hdpi/ic_launcher.png b/samples/browseable/DataLayer/Wearable/res/drawable-hdpi/ic_launcher.png
index 589f229d1..589f229d1 100755
--- a/samples/wearable/DataLayer/Wearable/src/main/res/drawable-hdpi/ic_launcher.png
+++ b/samples/browseable/DataLayer/Wearable/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/DataLayer/Wearable/src/main/res/drawable-mdpi/ic_launcher.png b/samples/browseable/DataLayer/Wearable/res/drawable-mdpi/ic_launcher.png
index 77dd57139..77dd57139 100755
--- a/samples/wearable/DataLayer/Wearable/src/main/res/drawable-mdpi/ic_launcher.png
+++ b/samples/browseable/DataLayer/Wearable/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/DataLayer/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/DataLayer/Wearable/res/drawable-xhdpi/ic_launcher.png
index fe34ebe13..fe34ebe13 100755
--- a/samples/wearable/DataLayer/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png
+++ b/samples/browseable/DataLayer/Wearable/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/DataLayer/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/DataLayer/Wearable/res/drawable-xxhdpi/ic_launcher.png
index ab80bcd13..ab80bcd13 100755
--- a/samples/wearable/DataLayer/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png
+++ b/samples/browseable/DataLayer/Wearable/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/DataLayer/Wearable/src/main/res/layout/main_activity.xml b/samples/browseable/DataLayer/Wearable/res/layout/main_activity.xml
index f98e6672a..f98e6672a 100644
--- a/samples/wearable/DataLayer/Wearable/src/main/res/layout/main_activity.xml
+++ b/samples/browseable/DataLayer/Wearable/res/layout/main_activity.xml
diff --git a/samples/wearable/DataLayer/Wearable/src/main/res/values/strings.xml b/samples/browseable/DataLayer/Wearable/res/values/strings.xml
index 331e73604..331e73604 100644
--- a/samples/wearable/DataLayer/Wearable/src/main/res/values/strings.xml
+++ b/samples/browseable/DataLayer/Wearable/res/values/strings.xml
diff --git a/samples/wearable/DataLayer/Wearable/src/main/java/com/example/android/wearable/datalayer/DataLayerListenerService.java b/samples/browseable/DataLayer/Wearable/src/com.example.android.wearable.datalayer/DataLayerListenerService.java
index 64abaf54d..64abaf54d 100644
--- a/samples/wearable/DataLayer/Wearable/src/main/java/com/example/android/wearable/datalayer/DataLayerListenerService.java
+++ b/samples/browseable/DataLayer/Wearable/src/com.example.android.wearable.datalayer/DataLayerListenerService.java
diff --git a/samples/wearable/DataLayer/Wearable/src/main/java/com/example/android/wearable/datalayer/MainActivity.java b/samples/browseable/DataLayer/Wearable/src/com.example.android.wearable.datalayer/MainActivity.java
index b3121352e..b3121352e 100644
--- a/samples/wearable/DataLayer/Wearable/src/main/java/com/example/android/wearable/datalayer/MainActivity.java
+++ b/samples/browseable/DataLayer/Wearable/src/com.example.android.wearable.datalayer/MainActivity.java
diff --git a/samples/browseable/DataLayer/_index.jd b/samples/browseable/DataLayer/_index.jd
new file mode 100644
index 000000000..844210ff9
--- /dev/null
+++ b/samples/browseable/DataLayer/_index.jd
@@ -0,0 +1,11 @@
+page.tags="DataLayer"
+sample.group=Wearable
+@jd:body
+
+<p>
+
+ Sample demonstrating the usage of the GoogleApiClient in order to send data
+ from a handheld device to a wearable. The data transmitted is a picture taken by
+ the user of the sample.
+
+ </p>
diff --git a/samples/browseable/DelayedConfirmation/Application/AndroidManifest.xml b/samples/browseable/DelayedConfirmation/Application/AndroidManifest.xml
new file mode 100644
index 000000000..c9fdccbf1
--- /dev/null
+++ b/samples/browseable/DelayedConfirmation/Application/AndroidManifest.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.wearable.delayedconfirmation" >
+
+ <uses-sdk android:minSdkVersion="18"
+ android:targetSdkVersion="21" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name">
+
+ <meta-data
+ android:name="com.google.android.gms.version"
+ android:value="@integer/google_play_services_version" />
+
+ <activity
+ android:name=".MainActivity"
+ android:label="@string/app_name"
+ android:launchMode="singleTask" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+</manifest>
diff --git a/samples/wearable/DelayedConfirmation/Application/src/main/res/drawable-hdpi/ic_launcher.png b/samples/browseable/DelayedConfirmation/Application/res/drawable-hdpi/ic_launcher.png
index 589f229d1..589f229d1 100755
--- a/samples/wearable/DelayedConfirmation/Application/src/main/res/drawable-hdpi/ic_launcher.png
+++ b/samples/browseable/DelayedConfirmation/Application/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/DelayedConfirmation/Application/res/drawable-hdpi/tile.9.png b/samples/browseable/DelayedConfirmation/Application/res/drawable-hdpi/tile.9.png
new file mode 100644
index 000000000..135862883
--- /dev/null
+++ b/samples/browseable/DelayedConfirmation/Application/res/drawable-hdpi/tile.9.png
Binary files differ
diff --git a/samples/wearable/DelayedConfirmation/Application/src/main/res/drawable-mdpi/ic_launcher.png b/samples/browseable/DelayedConfirmation/Application/res/drawable-mdpi/ic_launcher.png
index 77dd57139..77dd57139 100755
--- a/samples/wearable/DelayedConfirmation/Application/src/main/res/drawable-mdpi/ic_launcher.png
+++ b/samples/browseable/DelayedConfirmation/Application/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/DelayedConfirmation/Application/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/DelayedConfirmation/Application/res/drawable-xhdpi/ic_launcher.png
index fe34ebe13..fe34ebe13 100755
--- a/samples/wearable/DelayedConfirmation/Application/src/main/res/drawable-xhdpi/ic_launcher.png
+++ b/samples/browseable/DelayedConfirmation/Application/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/DelayedConfirmation/Application/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/DelayedConfirmation/Application/res/drawable-xxhdpi/ic_launcher.png
index ab80bcd13..ab80bcd13 100755
--- a/samples/wearable/DelayedConfirmation/Application/src/main/res/drawable-xxhdpi/ic_launcher.png
+++ b/samples/browseable/DelayedConfirmation/Application/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/DelayedConfirmation/Application/res/layout/activity_main.xml b/samples/browseable/DelayedConfirmation/Application/res/layout/activity_main.xml
new file mode 100755
index 000000000..be1aa49d9
--- /dev/null
+++ b/samples/browseable/DelayedConfirmation/Application/res/layout/activity_main.xml
@@ -0,0 +1,36 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <LinearLayout style="@style/Widget.SampleMessageTile"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView style="@style/Widget.SampleMessage"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="@dimen/horizontal_page_margin"
+ android:layout_marginRight="@dimen/horizontal_page_margin"
+ android:layout_marginTop="@dimen/vertical_page_margin"
+ android:layout_marginBottom="@dimen/vertical_page_margin"
+ android:text="@string/intro_message" />
+ </LinearLayout>
+</LinearLayout>
diff --git a/samples/wearable/DelayedConfirmation/Application/src/main/res/layout/main_activity.xml b/samples/browseable/DelayedConfirmation/Application/res/layout/main_activity.xml
index cbc1874fe..cbc1874fe 100644
--- a/samples/wearable/DelayedConfirmation/Application/src/main/res/layout/main_activity.xml
+++ b/samples/browseable/DelayedConfirmation/Application/res/layout/main_activity.xml
diff --git a/samples/browseable/DelayedConfirmation/Application/res/values-sw600dp/template-dimens.xml b/samples/browseable/DelayedConfirmation/Application/res/values-sw600dp/template-dimens.xml
new file mode 100644
index 000000000..22074a2bd
--- /dev/null
+++ b/samples/browseable/DelayedConfirmation/Application/res/values-sw600dp/template-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>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_huge</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/DelayedConfirmation/Application/res/values-sw600dp/template-styles.xml b/samples/browseable/DelayedConfirmation/Application/res/values-sw600dp/template-styles.xml
new file mode 100644
index 000000000..03d197418
--- /dev/null
+++ b/samples/browseable/DelayedConfirmation/Application/res/values-sw600dp/template-styles.xml
@@ -0,0 +1,25 @@
+<!--
+ 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.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceLarge</item>
+ <item name="android:lineSpacingMultiplier">1.2</item>
+ <item name="android:shadowDy">-6.5</item>
+ </style>
+
+</resources>
diff --git a/samples/browseable/DelayedConfirmation/Application/res/values-v11/template-styles.xml b/samples/browseable/DelayedConfirmation/Application/res/values-v11/template-styles.xml
new file mode 100644
index 000000000..8c1ea66f2
--- /dev/null
+++ b/samples/browseable/DelayedConfirmation/Application/res/values-v11/template-styles.xml
@@ -0,0 +1,22 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Holo.Light" />
+
+</resources>
diff --git a/samples/browseable/DelayedConfirmation/Application/res/values-v21/base-colors.xml b/samples/browseable/DelayedConfirmation/Application/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/DelayedConfirmation/Application/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/DelayedConfirmation/Application/res/values-v21/base-template-styles.xml b/samples/browseable/DelayedConfirmation/Application/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/DelayedConfirmation/Application/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/DelayedConfirmation/Application/res/values/base-strings.xml b/samples/browseable/DelayedConfirmation/Application/res/values/base-strings.xml
new file mode 100644
index 000000000..b4e1a2e92
--- /dev/null
+++ b/samples/browseable/DelayedConfirmation/Application/res/values/base-strings.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.
+-->
+<resources>
+ <string name="app_name">DelayedConfirmation</string>
+ <string name="intro_message">
+ <![CDATA[
+
+
+ Demonstrates how to create a DelayedConfirmationView in your wearable app. In this
+ sample, pressing a button on the phone app sends a message to the wearable to start a simple
+ activity. This activity displays a DelayedConfirmationView that starts when the user presses "Start
+ Timer." Then, callbacks are implemented on both the wearable and phone to show when the timer is
+ selected or finishes. The activity on the wearable uses BoxInsetLayout to automatically apply
+ appropriate margins based on whether the display is square or circular.
+
+
+ ]]>
+ </string>
+</resources>
diff --git a/samples/browseable/DelayedConfirmation/Application/res/values/strings.xml b/samples/browseable/DelayedConfirmation/Application/res/values/strings.xml
new file mode 100644
index 000000000..170870532
--- /dev/null
+++ b/samples/browseable/DelayedConfirmation/Application/res/values/strings.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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 xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="start_wearable_activity">Start Wearable Activity</string>
+ <string name="start">Start</string>
+
+ <string name="toast_timer_selected">Timer Selected</string>
+ <string name="toast_timer_finished">Timer Finished</string>
+</resources>
diff --git a/samples/browseable/DelayedConfirmation/Application/res/values/template-dimens.xml b/samples/browseable/DelayedConfirmation/Application/res/values/template-dimens.xml
new file mode 100644
index 000000000..39e710b5c
--- /dev/null
+++ b/samples/browseable/DelayedConfirmation/Application/res/values/template-dimens.xml
@@ -0,0 +1,32 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Define standard dimensions to comply with Holo-style grids and rhythm. -->
+
+ <dimen name="margin_tiny">4dp</dimen>
+ <dimen name="margin_small">8dp</dimen>
+ <dimen name="margin_medium">16dp</dimen>
+ <dimen name="margin_large">32dp</dimen>
+ <dimen name="margin_huge">64dp</dimen>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_medium</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/DelayedConfirmation/Application/res/values/template-styles.xml b/samples/browseable/DelayedConfirmation/Application/res/values/template-styles.xml
new file mode 100644
index 000000000..6e7d593dd
--- /dev/null
+++ b/samples/browseable/DelayedConfirmation/Application/res/values/template-styles.xml
@@ -0,0 +1,42 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+
+ <style name="Theme.Base" parent="android:Theme.Light" />
+
+ <style name="Theme.Sample" parent="Theme.Base" />
+
+ <style name="AppTheme" parent="Theme.Sample" />
+ <!-- Widget styling -->
+
+ <style name="Widget" />
+
+ <style name="Widget.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceMedium</item>
+ <item name="android:lineSpacingMultiplier">1.1</item>
+ </style>
+
+ <style name="Widget.SampleMessageTile">
+ <item name="android:background">@drawable/tile</item>
+ <item name="android:shadowColor">#7F000000</item>
+ <item name="android:shadowDy">-3.5</item>
+ <item name="android:shadowRadius">2</item>
+ </style>
+
+</resources>
diff --git a/samples/wearable/DelayedConfirmation/Application/src/main/java/com/example/android/wearable/delayedconfirmation/MainActivity.java b/samples/browseable/DelayedConfirmation/Application/src/com.example.android.wearable.delayedconfirmation/MainActivity.java
index 3ffda5374..3ffda5374 100644
--- a/samples/wearable/DelayedConfirmation/Application/src/main/java/com/example/android/wearable/delayedconfirmation/MainActivity.java
+++ b/samples/browseable/DelayedConfirmation/Application/src/com.example.android.wearable.delayedconfirmation/MainActivity.java
diff --git a/samples/browseable/DelayedConfirmation/Wearable/AndroidManifest.xml b/samples/browseable/DelayedConfirmation/Wearable/AndroidManifest.xml
new file mode 100644
index 000000000..845c07048
--- /dev/null
+++ b/samples/browseable/DelayedConfirmation/Wearable/AndroidManifest.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.wearable.delayedconfirmation" >
+
+ <uses-sdk android:minSdkVersion="20"
+ android:targetSdkVersion="21" />
+
+ <uses-feature android:name="android.hardware.type.watch" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@android:style/Theme.DeviceDefault">
+
+ <meta-data
+ android:name="com.google.android.gms.version"
+ android:value="@integer/google_play_services_version" />
+
+ <service
+ android:name=".WearableMessageListenerService" >
+ <intent-filter>
+ <action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
+ </intent-filter>
+ </service>
+
+ <activity
+ android:name=".MainActivity"
+ android:label="@string/app_name">
+ </activity>
+ </application>
+</manifest>
diff --git a/samples/wearable/DelayedConfirmation/Wearable/src/main/res/drawable-hdpi/ic_launcher.png b/samples/browseable/DelayedConfirmation/Wearable/res/drawable-hdpi/ic_launcher.png
index 589f229d1..589f229d1 100755
--- a/samples/wearable/DelayedConfirmation/Wearable/src/main/res/drawable-hdpi/ic_launcher.png
+++ b/samples/browseable/DelayedConfirmation/Wearable/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/DelayedConfirmation/Wearable/src/main/res/drawable-mdpi/ic_launcher.png b/samples/browseable/DelayedConfirmation/Wearable/res/drawable-mdpi/ic_launcher.png
index 77dd57139..77dd57139 100755
--- a/samples/wearable/DelayedConfirmation/Wearable/src/main/res/drawable-mdpi/ic_launcher.png
+++ b/samples/browseable/DelayedConfirmation/Wearable/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/DelayedConfirmation/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/DelayedConfirmation/Wearable/res/drawable-xhdpi/ic_launcher.png
index fe34ebe13..fe34ebe13 100755
--- a/samples/wearable/DelayedConfirmation/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png
+++ b/samples/browseable/DelayedConfirmation/Wearable/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/DelayedConfirmation/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/DelayedConfirmation/Wearable/res/drawable-xxhdpi/ic_launcher.png
index ab80bcd13..ab80bcd13 100755
--- a/samples/wearable/DelayedConfirmation/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png
+++ b/samples/browseable/DelayedConfirmation/Wearable/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/DelayedConfirmation/Wearable/src/main/res/layout/main_activity.xml b/samples/browseable/DelayedConfirmation/Wearable/res/layout/main_activity.xml
index 1b9bcb3eb..1b9bcb3eb 100644
--- a/samples/wearable/DelayedConfirmation/Wearable/src/main/res/layout/main_activity.xml
+++ b/samples/browseable/DelayedConfirmation/Wearable/res/layout/main_activity.xml
diff --git a/samples/wearable/DelayedConfirmation/Wearable/src/main/res/values/dimens.xml b/samples/browseable/DelayedConfirmation/Wearable/res/values/dimens.xml
index 677a0f167..677a0f167 100644
--- a/samples/wearable/DelayedConfirmation/Wearable/src/main/res/values/dimens.xml
+++ b/samples/browseable/DelayedConfirmation/Wearable/res/values/dimens.xml
diff --git a/samples/wearable/DelayedConfirmation/Wearable/src/main/res/values/strings.xml b/samples/browseable/DelayedConfirmation/Wearable/res/values/strings.xml
index 46f5326bc..46f5326bc 100644
--- a/samples/wearable/DelayedConfirmation/Wearable/src/main/res/values/strings.xml
+++ b/samples/browseable/DelayedConfirmation/Wearable/res/values/strings.xml
diff --git a/samples/wearable/DelayedConfirmation/Wearable/src/main/java/com/example/android/wearable/delayedconfirmation/MainActivity.java b/samples/browseable/DelayedConfirmation/Wearable/src/com.example.android.wearable.delayedconfirmation/MainActivity.java
index f9b126db3..f9b126db3 100644
--- a/samples/wearable/DelayedConfirmation/Wearable/src/main/java/com/example/android/wearable/delayedconfirmation/MainActivity.java
+++ b/samples/browseable/DelayedConfirmation/Wearable/src/com.example.android.wearable.delayedconfirmation/MainActivity.java
diff --git a/samples/wearable/DelayedConfirmation/Wearable/src/main/java/com/example/android/wearable/delayedconfirmation/WearableMessageListenerService.java b/samples/browseable/DelayedConfirmation/Wearable/src/com.example.android.wearable.delayedconfirmation/WearableMessageListenerService.java
index bb2ec9193..bb2ec9193 100644
--- a/samples/wearable/DelayedConfirmation/Wearable/src/main/java/com/example/android/wearable/delayedconfirmation/WearableMessageListenerService.java
+++ b/samples/browseable/DelayedConfirmation/Wearable/src/com.example.android.wearable.delayedconfirmation/WearableMessageListenerService.java
diff --git a/samples/browseable/DelayedConfirmation/_index.jd b/samples/browseable/DelayedConfirmation/_index.jd
new file mode 100644
index 000000000..28db25aa1
--- /dev/null
+++ b/samples/browseable/DelayedConfirmation/_index.jd
@@ -0,0 +1,14 @@
+page.tags="DelayedConfirmation"
+sample.group=Wearable
+@jd:body
+
+<p>
+
+ Demonstrates how to create a DelayedConfirmationView in your wearable app. In this
+ sample, pressing a button on the phone app sends a message to the wearable to start a simple
+ activity. This activity displays a DelayedConfirmationView that starts when the user presses "Start
+ Timer." Then, callbacks are implemented on both the wearable and phone to show when the timer is
+ selected or finishes. The activity on the wearable uses BoxInsetLayout to automatically apply
+ appropriate margins based on whether the display is square or circular.
+
+ </p>
diff --git a/samples/browseable/DisplayingBitmaps/AndroidManifest.xml b/samples/browseable/DisplayingBitmaps/AndroidManifest.xml
index 23db308a3..a58027743 100644
--- a/samples/browseable/DisplayingBitmaps/AndroidManifest.xml
+++ b/samples/browseable/DisplayingBitmaps/AndroidManifest.xml
@@ -20,7 +20,7 @@
android:versionCode="1"
android:versionName="1.0">
- <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="19" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
diff --git a/samples/browseable/DisplayingBitmaps/_index.jd b/samples/browseable/DisplayingBitmaps/_index.jd
index eb880978f..e4b4f1570 100644
--- a/samples/browseable/DisplayingBitmaps/_index.jd
+++ b/samples/browseable/DisplayingBitmaps/_index.jd
@@ -1,21 +1,15 @@
-
-
-
page.tags="DisplayingBitmaps"
sample.group=UI
@jd:body
-<p>This is a sample application for the
-<a href="{@docRoot}training/displaying-bitmaps/index.html">Displaying
-Bitmaps Efficiently</a> Android Training class.</p>
-
<p>
-The sample demonstrates:
-</p>
-<ul>
-<li>Loading large bitmaps efficiently outside the main UI thread.</li>
-<li>Caching bitmaps (both in memory and on disk).</li>
-<li>Managing bitmap memory.</li>
-<li>Displaying bitmaps in UI elements (such as {@link android.support.v4.view.ViewPager ViewPager},
-{@link android.widget.ListView ListView}, and {@link android.widget.GridView GridView}).</li>
-</ul> \ No newline at end of file
+
+ This is a sample application for the Android Training class
+ &quot;Displaying Bitmaps Efficiently&quot;
+ (http://developer.android.com/training/displaying-bitmaps/).\n\n
+
+ It demonstrates how to load large bitmaps efficiently off the main UI thread, caching
+ bitmaps (both in memory and on disk), managing bitmap memory and displaying bitmaps
+ in UI elements such as ViewPager and ListView/GridView.
+
+ </p>
diff --git a/samples/browseable/DisplayingBitmaps/res/values-v21/base-colors.xml b/samples/browseable/DisplayingBitmaps/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/DisplayingBitmaps/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/DisplayingBitmaps/res/values-v21/base-template-styles.xml b/samples/browseable/DisplayingBitmaps/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/DisplayingBitmaps/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/DisplayingBitmaps/res/values/base-strings.xml b/samples/browseable/DisplayingBitmaps/res/values/base-strings.xml
index a6a8390a6..440137171 100644
--- a/samples/browseable/DisplayingBitmaps/res/values/base-strings.xml
+++ b/samples/browseable/DisplayingBitmaps/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">DisplayingBitmaps</string>
<string name="intro_message">
diff --git a/samples/browseable/DocumentCentricApps/res/values-v21/base-colors.xml b/samples/browseable/DocumentCentricApps/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/DocumentCentricApps/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/DocumentCentricApps/res/values-v21/base-template-styles.xml b/samples/browseable/DocumentCentricApps/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/DocumentCentricApps/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/DocumentCentricApps/res/values-v21/template-styles.xml b/samples/browseable/DocumentCentricApps/res/values-v21/template-styles.xml
deleted file mode 100644
index 134fcd9d3..000000000
--- a/samples/browseable/DocumentCentricApps/res/values-v21/template-styles.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<!--
- Copyright 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<resources>
-
- <!-- Activity themes -->
- <style name="Theme.Base" parent="android:Theme.Material.Light" />
-
-</resources>
diff --git a/samples/browseable/DocumentCentricRelinquishIdentity/res/values-v21/base-colors.xml b/samples/browseable/DocumentCentricRelinquishIdentity/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/DocumentCentricRelinquishIdentity/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/DocumentCentricRelinquishIdentity/res/values-v21/base-template-styles.xml b/samples/browseable/DocumentCentricRelinquishIdentity/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/DocumentCentricRelinquishIdentity/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/DocumentCentricRelinquishIdentity/res/values-v21/template-styles.xml b/samples/browseable/DocumentCentricRelinquishIdentity/res/values-v21/template-styles.xml
deleted file mode 100644
index 134fcd9d3..000000000
--- a/samples/browseable/DocumentCentricRelinquishIdentity/res/values-v21/template-styles.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<!--
- Copyright 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<resources>
-
- <!-- Activity themes -->
- <style name="Theme.Base" parent="android:Theme.Material.Light" />
-
-</resources>
diff --git a/samples/browseable/DoneBar/AndroidManifest.xml b/samples/browseable/DoneBar/AndroidManifest.xml
index 473111435..820fae590 100644
--- a/samples/browseable/DoneBar/AndroidManifest.xml
+++ b/samples/browseable/DoneBar/AndroidManifest.xml
@@ -22,7 +22,7 @@
android:versionCode="1"
android:versionName="1.0">
- <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="17" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<application android:label="@string/app_name"
android:icon="@drawable/ic_launcher"
diff --git a/samples/browseable/DoneBar/_index.jd b/samples/browseable/DoneBar/_index.jd
index 8ef219c9a..b692bb981 100644
--- a/samples/browseable/DoneBar/_index.jd
+++ b/samples/browseable/DoneBar/_index.jd
@@ -1,12 +1,15 @@
-
-
-
page.tags="DoneBar"
sample.group=UI
@jd:body
-<p>This sample demonstrates a user interface design pattern for simple data
-entry from an {@link android.app.ActionBar}. The sample implements a custom
-<strong>Done/Cancel</strong> bar to provide users with an easy way to directly
-save or cancel their changes. This design pattern is suitable for scenarios
-where no additional view details or actions are needed in the action bar.</p>
+<p>
+
+ This sample demonstrates two alternative presentations of the
+ action bar that are well-suited for simple data entry scenarios.
+
+ In this presentation, a done bar replaces the action
+ bar entirely, providing two direct actions to persist or dismiss changes. This is
+ suitable for cases where no additional view details or actions are needed in the
+ action bar.
+
+ </p>
diff --git a/samples/browseable/DoneBar/res/layout/sample_dashboard_item.xml b/samples/browseable/DoneBar/res/layout/sample_dashboard_item.xml
index 38987ee20..516d28989 100644
--- a/samples/browseable/DoneBar/res/layout/sample_dashboard_item.xml
+++ b/samples/browseable/DoneBar/res/layout/sample_dashboard_item.xml
@@ -14,19 +14,37 @@
limitations under the License.
-->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- style="@style/Widget.SampleDashboard.Item"
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical">
+ android:layout_height="wrap_content">
+ <!-- The CardView needs to be wrapped to ensure spacing is applied correctly. -->
- <TextView android:id="@android:id/text1"
- style="@style/Widget.SampleDashboard.Item.Title"
+ <android.support.v7.widget.CardView
+ style="@style/Widget.SampleDashboard.Card"
android:layout_width="match_parent"
- android:layout_height="wrap_content" />
+ android:layout_height="wrap_content">
- <TextView android:id="@android:id/text2"
- style="@style/Widget.SampleDashboard.Item.Description"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
-</LinearLayout>
+ <LinearLayout
+ style="@style/Widget.SampleDashboard.Item"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView
+ android:id="@android:id/text1"
+ style="@style/Widget.SampleDashboard.Item.Title"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="Hello world" />
+
+ <TextView
+ android:id="@android:id/text2"
+ style="@style/Widget.SampleDashboard.Item.Description"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+ </LinearLayout>
+
+ </android.support.v7.widget.CardView>
+
+</FrameLayout>
diff --git a/samples/browseable/DoneBar/res/values-v21/base-colors.xml b/samples/browseable/DoneBar/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/DoneBar/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/DoneBar/res/values-v21/base-template-styles.xml b/samples/browseable/DoneBar/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/DoneBar/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/DoneBar/res/values/activitycards-colors.xml b/samples/browseable/DoneBar/res/values/activitycards-colors.xml
new file mode 100644
index 000000000..79605c7c9
--- /dev/null
+++ b/samples/browseable/DoneBar/res/values/activitycards-colors.xml
@@ -0,0 +1,21 @@
+<!--
+ Copyright 2014 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>
+ <color name="teal">#009688</color>
+ <color name="black_87">#DD000000</color>
+ <color name="black_54">#89000000</color>
+</resources>
diff --git a/samples/browseable/DoneBar/res/values/activitycards-dimens.xml b/samples/browseable/DoneBar/res/values/activitycards-dimens.xml
new file mode 100644
index 000000000..714cb00f2
--- /dev/null
+++ b/samples/browseable/DoneBar/res/values/activitycards-dimens.xml
@@ -0,0 +1,22 @@
+<!--
+ 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>
+
+ <dimen name="card_padding">16dp</dimen>
+ <dimen name="card_margin">8dp</dimen>
+
+</resources> \ No newline at end of file
diff --git a/samples/browseable/DoneBar/res/values/activitycards-strings.xml b/samples/browseable/DoneBar/res/values/activitycards-strings.xml
index 5c2557c97..430286c31 100644
--- a/samples/browseable/DoneBar/res/values/activitycards-strings.xml
+++ b/samples/browseable/DoneBar/res/values/activitycards-strings.xml
@@ -15,9 +15,6 @@
limitations under the License.
-->
-
-
-
<resources>
<string name="donebaractivity_title">Done Bar</string>
<string name="donebaractivity_description">In this presentation, a done bar replaces the action bar entirely, providing
diff --git a/samples/browseable/DoneBar/res/values/base-strings.xml b/samples/browseable/DoneBar/res/values/base-strings.xml
index 22a4fae9f..f7e0540ca 100644
--- a/samples/browseable/DoneBar/res/values/base-strings.xml
+++ b/samples/browseable/DoneBar/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">DoneBar</string>
<string name="intro_message">
diff --git a/samples/browseable/DoneBar/res/values/template-styles.xml b/samples/browseable/DoneBar/res/values/template-styles.xml
index cafe531a4..374dc515d 100644
--- a/samples/browseable/DoneBar/res/values/template-styles.xml
+++ b/samples/browseable/DoneBar/res/values/template-styles.xml
@@ -34,9 +34,10 @@
<item name="android:paddingRight">@dimen/horizontal_page_margin</item>
</style>
- <style name="Widget.SampleMessage">
+<style name="Widget.SampleMessage">
<item name="android:textAppearance">?android:textAppearanceMedium</item>
<item name="android:lineSpacingMultiplier">1.1</item>
+ <item name="android:textColor">@color/black_54</item>
</style>
<style name="Widget.SampleDashboard.Grid" parent="Widget">
@@ -44,28 +45,32 @@
<item name="android:columnWidth">200dp</item>
<item name="android:numColumns">auto_fit</item>
<item name="android:drawSelectorOnTop">true</item>
- <item name="android:horizontalSpacing">@dimen/margin_medium</item>
- <item name="android:verticalSpacing">@dimen/margin_medium</item>
+ <item name="android:horizontalSpacing">0dp</item>
+ <item name="android:verticalSpacing">0dp</item>
+ </style>
+
+ <style name="Widget.SampleDashboard.Card" parent="Widget">
+ <item name="android:gravity">center</item>
+ <item name="android:layout_margin">@dimen/card_margin</item>
+ <item name="cardCornerRadius">4dp</item>
+ <item name="cardElevation">5dp</item>
+ <item name="contentPadding">@dimen/card_padding</item>
</style>
<style name="Widget.SampleDashboard.Item" parent="Widget">
- <item name="android:background">@drawable/sample_dashboard_item_background</item>
- <item name="android:paddingTop">@dimen/margin_small</item>
- <item name="android:paddingLeft">@dimen/margin_medium</item>
- <item name="android:paddingRight">@dimen/margin_medium</item>
- <item name="android:paddingBottom">@dimen/margin_medium</item>
</style>
<style name="Widget.SampleDashboard.Item.Title" parent="Widget">
<item name="android:layout_marginBottom">@dimen/margin_tiny</item>
<item name="android:textAppearance">?android:textAppearanceLarge</item>
- <item name="android:textColor">#09c</item>
- <item name="android:textStyle">bold</item>
+ <item name="android:textColor">@color/teal</item>
+ <item name="android:fontFamily">sans-serif</item>
<item name="android:textSize">24sp</item>
</style>
<style name="Widget.SampleDashboard.Item.Description" parent="Widget">
<item name="android:textAppearance">?android:textAppearanceSmall</item>
<item name="android:fontFamily">sans-serif-light</item>
+ <item name="android:textColor">@color/black_87</item>
</style>
</resources>
diff --git a/samples/browseable/DoneBar/src/com.example.android.donebar/MainActivity.java b/samples/browseable/DoneBar/src/com.example.android.donebar/MainActivity.java
index 8b1e8a469..c51996c4c 100644
--- a/samples/browseable/DoneBar/src/com.example.android.donebar/MainActivity.java
+++ b/samples/browseable/DoneBar/src/com.example.android.donebar/MainActivity.java
@@ -14,9 +14,6 @@
* limitations under the License.
*/
-
-
-
package com.example.android.donebar;
import android.app.Activity;
diff --git a/samples/browseable/DrawableTinting/res/values-v21/base-colors.xml b/samples/browseable/DrawableTinting/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/DrawableTinting/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/DrawableTinting/res/values-v21/base-template-styles.xml b/samples/browseable/DrawableTinting/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/DrawableTinting/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/DrawableTinting/res/values-v21/template-styles.xml b/samples/browseable/DrawableTinting/res/values-v21/template-styles.xml
deleted file mode 100644
index 134fcd9d3..000000000
--- a/samples/browseable/DrawableTinting/res/values-v21/template-styles.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<!--
- Copyright 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<resources>
-
- <!-- Activity themes -->
- <style name="Theme.Base" parent="android:Theme.Material.Light" />
-
-</resources>
diff --git a/samples/browseable/ElevationBasic/res/values-v21/base-colors.xml b/samples/browseable/ElevationBasic/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/ElevationBasic/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/ElevationBasic/res/values-v21/base-template-styles.xml b/samples/browseable/ElevationBasic/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/ElevationBasic/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/ElevationBasic/res/values-v21/template-styles.xml b/samples/browseable/ElevationBasic/res/values-v21/template-styles.xml
deleted file mode 100644
index 134fcd9d3..000000000
--- a/samples/browseable/ElevationBasic/res/values-v21/template-styles.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<!--
- Copyright 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<resources>
-
- <!-- Activity themes -->
- <style name="Theme.Base" parent="android:Theme.Material.Light" />
-
-</resources>
diff --git a/samples/browseable/ElevationDrag/res/values-v21/base-colors.xml b/samples/browseable/ElevationDrag/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/ElevationDrag/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/ElevationDrag/res/values-v21/base-template-styles.xml b/samples/browseable/ElevationDrag/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/ElevationDrag/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/ElevationDrag/res/values-v21/template-styles.xml b/samples/browseable/ElevationDrag/res/values-v21/template-styles.xml
deleted file mode 100644
index 134fcd9d3..000000000
--- a/samples/browseable/ElevationDrag/res/values-v21/template-styles.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<!--
- Copyright 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<resources>
-
- <!-- Activity themes -->
- <style name="Theme.Base" parent="android:Theme.Material.Light" />
-
-</resources>
diff --git a/samples/browseable/ElizaChat/Application/AndroidManifest.xml b/samples/browseable/ElizaChat/Application/AndroidManifest.xml
new file mode 100644
index 000000000..8f35c5651
--- /dev/null
+++ b/samples/browseable/ElizaChat/Application/AndroidManifest.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.wearable.elizachat" >
+
+ <uses-sdk android:minSdkVersion="18"
+ android:targetSdkVersion="21" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@mipmap/ic_app_eliza"
+ android:label="@string/app_name"
+ android:theme="@style/AppTheme" >
+ <activity
+ android:name=".MainActivity"
+ android:label="@string/app_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <service
+ android:name=".ResponderService">
+ <intent-filter>
+ <action android:name="com.example.android.wearable.elizachat.REPLY" />
+ <action android:name="com.example.android.wearable.elizachat.CONVERSATION" />
+ </intent-filter>
+ </service>
+ </application>
+
+</manifest>
diff --git a/samples/wearable/ElizaChat/Application/src/main/res/drawable-hdpi/ic_full_reply.png b/samples/browseable/ElizaChat/Application/res/drawable-hdpi/ic_full_reply.png
index 66388d5fa..66388d5fa 100644
--- a/samples/wearable/ElizaChat/Application/src/main/res/drawable-hdpi/ic_full_reply.png
+++ b/samples/browseable/ElizaChat/Application/res/drawable-hdpi/ic_full_reply.png
Binary files differ
diff --git a/samples/browseable/ElizaChat/Application/res/drawable-hdpi/tile.9.png b/samples/browseable/ElizaChat/Application/res/drawable-hdpi/tile.9.png
new file mode 100644
index 000000000..135862883
--- /dev/null
+++ b/samples/browseable/ElizaChat/Application/res/drawable-hdpi/tile.9.png
Binary files differ
diff --git a/samples/wearable/ElizaChat/Application/src/main/res/drawable-mdpi/ic_full_reply.png b/samples/browseable/ElizaChat/Application/res/drawable-mdpi/ic_full_reply.png
index 60ce9f9c5..60ce9f9c5 100644
--- a/samples/wearable/ElizaChat/Application/src/main/res/drawable-mdpi/ic_full_reply.png
+++ b/samples/browseable/ElizaChat/Application/res/drawable-mdpi/ic_full_reply.png
Binary files differ
diff --git a/samples/wearable/ElizaChat/Application/src/main/res/drawable-nodpi/bg_eliza.png b/samples/browseable/ElizaChat/Application/res/drawable-nodpi/bg_eliza.png
index 3bbdf48a8..3bbdf48a8 100644
--- a/samples/wearable/ElizaChat/Application/src/main/res/drawable-nodpi/bg_eliza.png
+++ b/samples/browseable/ElizaChat/Application/res/drawable-nodpi/bg_eliza.png
Binary files differ
diff --git a/samples/wearable/ElizaChat/Application/src/main/res/drawable-xhdpi/ic_full_reply.png b/samples/browseable/ElizaChat/Application/res/drawable-xhdpi/ic_full_reply.png
index dba6fa7b0..dba6fa7b0 100644
--- a/samples/wearable/ElizaChat/Application/src/main/res/drawable-xhdpi/ic_full_reply.png
+++ b/samples/browseable/ElizaChat/Application/res/drawable-xhdpi/ic_full_reply.png
Binary files differ
diff --git a/samples/browseable/ElizaChat/Application/res/layout/activity_main.xml b/samples/browseable/ElizaChat/Application/res/layout/activity_main.xml
new file mode 100755
index 000000000..be1aa49d9
--- /dev/null
+++ b/samples/browseable/ElizaChat/Application/res/layout/activity_main.xml
@@ -0,0 +1,36 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <LinearLayout style="@style/Widget.SampleMessageTile"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView style="@style/Widget.SampleMessage"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="@dimen/horizontal_page_margin"
+ android:layout_marginRight="@dimen/horizontal_page_margin"
+ android:layout_marginTop="@dimen/vertical_page_margin"
+ android:layout_marginBottom="@dimen/vertical_page_margin"
+ android:text="@string/intro_message" />
+ </LinearLayout>
+</LinearLayout>
diff --git a/samples/wearable/ElizaChat/Application/src/main/res/layout/activity_main.xml b/samples/browseable/ElizaChat/Application/res/layout/main.xml
index 6ffed8ea2..6ffed8ea2 100644
--- a/samples/wearable/ElizaChat/Application/src/main/res/layout/activity_main.xml
+++ b/samples/browseable/ElizaChat/Application/res/layout/main.xml
diff --git a/samples/wearable/ElizaChat/Application/src/main/res/menu/main.xml b/samples/browseable/ElizaChat/Application/res/menu/main.xml
index b8e1ef2a5..b8e1ef2a5 100644
--- a/samples/wearable/ElizaChat/Application/src/main/res/menu/main.xml
+++ b/samples/browseable/ElizaChat/Application/res/menu/main.xml
diff --git a/samples/wearable/ElizaChat/Application/src/main/res/mipmap-hdpi/ic_app_eliza.png b/samples/browseable/ElizaChat/Application/res/mipmap-hdpi/ic_app_eliza.png
index 1bdb14751..1bdb14751 100644
--- a/samples/wearable/ElizaChat/Application/src/main/res/mipmap-hdpi/ic_app_eliza.png
+++ b/samples/browseable/ElizaChat/Application/res/mipmap-hdpi/ic_app_eliza.png
Binary files differ
diff --git a/samples/wearable/ElizaChat/Application/src/main/res/mipmap-mdpi/ic_app_eliza.png b/samples/browseable/ElizaChat/Application/res/mipmap-mdpi/ic_app_eliza.png
index 2e0e1980c..2e0e1980c 100644
--- a/samples/wearable/ElizaChat/Application/src/main/res/mipmap-mdpi/ic_app_eliza.png
+++ b/samples/browseable/ElizaChat/Application/res/mipmap-mdpi/ic_app_eliza.png
Binary files differ
diff --git a/samples/wearable/ElizaChat/Application/src/main/res/mipmap-xhdpi/ic_app_eliza.png b/samples/browseable/ElizaChat/Application/res/mipmap-xhdpi/ic_app_eliza.png
index 8d0f43642..8d0f43642 100644
--- a/samples/wearable/ElizaChat/Application/src/main/res/mipmap-xhdpi/ic_app_eliza.png
+++ b/samples/browseable/ElizaChat/Application/res/mipmap-xhdpi/ic_app_eliza.png
Binary files differ
diff --git a/samples/wearable/ElizaChat/Application/src/main/res/mipmap-xxhdpi/ic_app_eliza.png b/samples/browseable/ElizaChat/Application/res/mipmap-xxhdpi/ic_app_eliza.png
index e72b96752..e72b96752 100644
--- a/samples/wearable/ElizaChat/Application/src/main/res/mipmap-xxhdpi/ic_app_eliza.png
+++ b/samples/browseable/ElizaChat/Application/res/mipmap-xxhdpi/ic_app_eliza.png
Binary files differ
diff --git a/samples/wearable/ElizaChat/Application/src/main/res/mipmap-xxxhdpi/ic_app_eliza.png b/samples/browseable/ElizaChat/Application/res/mipmap-xxxhdpi/ic_app_eliza.png
index 06ea0793c..06ea0793c 100644
--- a/samples/wearable/ElizaChat/Application/src/main/res/mipmap-xxxhdpi/ic_app_eliza.png
+++ b/samples/browseable/ElizaChat/Application/res/mipmap-xxxhdpi/ic_app_eliza.png
Binary files differ
diff --git a/samples/browseable/ElizaChat/Application/res/values-sw600dp/template-dimens.xml b/samples/browseable/ElizaChat/Application/res/values-sw600dp/template-dimens.xml
new file mode 100644
index 000000000..22074a2bd
--- /dev/null
+++ b/samples/browseable/ElizaChat/Application/res/values-sw600dp/template-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>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_huge</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/ElizaChat/Application/res/values-sw600dp/template-styles.xml b/samples/browseable/ElizaChat/Application/res/values-sw600dp/template-styles.xml
new file mode 100644
index 000000000..03d197418
--- /dev/null
+++ b/samples/browseable/ElizaChat/Application/res/values-sw600dp/template-styles.xml
@@ -0,0 +1,25 @@
+<!--
+ 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.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceLarge</item>
+ <item name="android:lineSpacingMultiplier">1.2</item>
+ <item name="android:shadowDy">-6.5</item>
+ </style>
+
+</resources>
diff --git a/samples/browseable/ElizaChat/Application/res/values-v11/template-styles.xml b/samples/browseable/ElizaChat/Application/res/values-v11/template-styles.xml
new file mode 100644
index 000000000..8c1ea66f2
--- /dev/null
+++ b/samples/browseable/ElizaChat/Application/res/values-v11/template-styles.xml
@@ -0,0 +1,22 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Holo.Light" />
+
+</resources>
diff --git a/samples/browseable/ElizaChat/Application/res/values-v21/base-colors.xml b/samples/browseable/ElizaChat/Application/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/ElizaChat/Application/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/ElizaChat/Application/res/values-v21/base-template-styles.xml b/samples/browseable/ElizaChat/Application/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/ElizaChat/Application/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/ElizaChat/Application/res/values/base-strings.xml b/samples/browseable/ElizaChat/Application/res/values/base-strings.xml
new file mode 100644
index 000000000..be29a5be2
--- /dev/null
+++ b/samples/browseable/ElizaChat/Application/res/values/base-strings.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<resources>
+ <string name="app_name">ElizaChat</string>
+ <string name="intro_message">
+ <![CDATA[
+
+
+ This sample is a phone application that provides a chat experience in which users can respond to
+ messages with a quick voice response. New messages create a notification with a "Reply" action.
+ The notification is bridged from phone to wearable, and selecting the "Reply" action on the
+ wearable opens the voice transcription UI allowing the user to speak a response.
+
+
+ ]]>
+ </string>
+</resources>
diff --git a/samples/wearable/ElizaChat/Application/src/main/res/values/dimens.xml b/samples/browseable/ElizaChat/Application/res/values/dimens.xml
index a1e9cfe8a..a1e9cfe8a 100644
--- a/samples/wearable/ElizaChat/Application/src/main/res/values/dimens.xml
+++ b/samples/browseable/ElizaChat/Application/res/values/dimens.xml
diff --git a/samples/browseable/ElizaChat/Application/res/values/strings.xml b/samples/browseable/ElizaChat/Application/res/values/strings.xml
new file mode 100644
index 000000000..9a5c9d770
--- /dev/null
+++ b/samples/browseable/ElizaChat/Application/res/values/strings.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+
+ <string name="send_notification">Send notification!</string>
+ <string name="eliza">Eliza</string>
+ <string name="answer_eliza">Answer Eliza</string>
+ <string name="reply">Reply</string>
+ <string name="stop_service">End Chat Session</string>
+
+</resources>
diff --git a/samples/browseable/ElizaChat/Application/res/values/template-dimens.xml b/samples/browseable/ElizaChat/Application/res/values/template-dimens.xml
new file mode 100644
index 000000000..39e710b5c
--- /dev/null
+++ b/samples/browseable/ElizaChat/Application/res/values/template-dimens.xml
@@ -0,0 +1,32 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Define standard dimensions to comply with Holo-style grids and rhythm. -->
+
+ <dimen name="margin_tiny">4dp</dimen>
+ <dimen name="margin_small">8dp</dimen>
+ <dimen name="margin_medium">16dp</dimen>
+ <dimen name="margin_large">32dp</dimen>
+ <dimen name="margin_huge">64dp</dimen>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_medium</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/ElizaChat/Application/res/values/template-styles.xml b/samples/browseable/ElizaChat/Application/res/values/template-styles.xml
new file mode 100644
index 000000000..6e7d593dd
--- /dev/null
+++ b/samples/browseable/ElizaChat/Application/res/values/template-styles.xml
@@ -0,0 +1,42 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+
+ <style name="Theme.Base" parent="android:Theme.Light" />
+
+ <style name="Theme.Sample" parent="Theme.Base" />
+
+ <style name="AppTheme" parent="Theme.Sample" />
+ <!-- Widget styling -->
+
+ <style name="Widget" />
+
+ <style name="Widget.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceMedium</item>
+ <item name="android:lineSpacingMultiplier">1.1</item>
+ </style>
+
+ <style name="Widget.SampleMessageTile">
+ <item name="android:background">@drawable/tile</item>
+ <item name="android:shadowColor">#7F000000</item>
+ <item name="android:shadowDy">-3.5</item>
+ <item name="android:shadowRadius">2</item>
+ </style>
+
+</resources>
diff --git a/samples/wearable/ElizaChat/Application/src/main/java/com/example/android/wearable/elizachat/ElizaResponder.java b/samples/browseable/ElizaChat/Application/src/com.example.android.wearable.elizachat/ElizaResponder.java
index e6c054251..e6c054251 100644
--- a/samples/wearable/ElizaChat/Application/src/main/java/com/example/android/wearable/elizachat/ElizaResponder.java
+++ b/samples/browseable/ElizaChat/Application/src/com.example.android.wearable.elizachat/ElizaResponder.java
diff --git a/samples/browseable/ElizaChat/Application/src/com.example.android.wearable.elizachat/MainActivity.java b/samples/browseable/ElizaChat/Application/src/com.example.android.wearable.elizachat/MainActivity.java
new file mode 100644
index 000000000..982e3def5
--- /dev/null
+++ b/samples/browseable/ElizaChat/Application/src/com.example.android.wearable.elizachat/MainActivity.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2014 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.wearable.elizachat;
+
+import android.app.Activity;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.Bundle;
+import android.support.v4.content.LocalBroadcastManager;
+import android.text.TextUtils;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.widget.TextView;
+
+public class MainActivity extends Activity {
+
+ @SuppressWarnings("unused")
+ private static final String TAG = "MainActivity";
+
+ public static final String EXTRA_MESSAGE = "message";
+
+ public static final String ACTION_NOTIFY = "com.example.android.wearable.elizachat.NOTIFY";
+
+ public static final String ACTION_GET_CONVERSATION
+ = "com.example.android.wearable.elizachat.CONVERSATION";
+
+ private BroadcastReceiver mReceiver;
+
+ private TextView mHistoryView;
+
+ @Override
+ protected void onCreate(Bundle saved) {
+ super.onCreate(saved);
+ setContentView(R.layout.main);
+ mReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ processMessage(intent);
+ }
+ };
+ mHistoryView = (TextView) findViewById(R.id.history);
+ startResponderService();
+ }
+
+ private void startResponderService() {
+ Intent serviceIntent = new Intent(ResponderService.ACTION_INCOMING);
+ startService(serviceIntent);
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ LocalBroadcastManager.getInstance(this).registerReceiver(mReceiver,
+ new IntentFilter(ACTION_NOTIFY));
+ mHistoryView.setText("");
+ Intent serviceIntent = new Intent(ACTION_GET_CONVERSATION);
+ startService(serviceIntent);
+
+ }
+
+ @Override
+ protected void onPause() {
+ LocalBroadcastManager.getInstance(this).unregisterReceiver(mReceiver);
+ super.onPause();
+ }
+
+ private void processMessage(Intent intent) {
+ String text = intent.getStringExtra(EXTRA_MESSAGE);
+ if (!TextUtils.isEmpty(text)) {
+ mHistoryView.append("\n" + text);
+ }
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ super.onCreateOptionsMenu(menu);
+ getMenuInflater().inflate(R.menu.main, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.action_stop_service:
+ stopService(new Intent(this, ResponderService.class));
+ finish();
+ break;
+ }
+ return true;
+ }
+}
diff --git a/samples/wearable/ElizaChat/Application/src/main/java/com/example/android/wearable/elizachat/ResponderService.java b/samples/browseable/ElizaChat/Application/src/com.example.android.wearable.elizachat/ResponderService.java
index 3bef19c6b..3bef19c6b 100644
--- a/samples/wearable/ElizaChat/Application/src/main/java/com/example/android/wearable/elizachat/ResponderService.java
+++ b/samples/browseable/ElizaChat/Application/src/com.example.android.wearable.elizachat/ResponderService.java
diff --git a/samples/browseable/ElizaChat/_index.jd b/samples/browseable/ElizaChat/_index.jd
new file mode 100644
index 000000000..a88371c8a
--- /dev/null
+++ b/samples/browseable/ElizaChat/_index.jd
@@ -0,0 +1,12 @@
+page.tags="ElizaChat"
+sample.group=Wearable
+@jd:body
+
+<p>
+
+ This sample is a phone application that provides a chat experience in which users can respond to
+ messages with a quick voice response. New messages create a notification with a "Reply" action.
+ The notification is bridged from phone to wearable, and selecting the "Reply" action on the
+ wearable opens the voice transcription UI allowing the user to speak a response.
+
+ </p>
diff --git a/samples/browseable/EmbeddedApp/Application/AndroidManifest.xml b/samples/browseable/EmbeddedApp/Application/AndroidManifest.xml
new file mode 100644
index 000000000..ee47ffeda
--- /dev/null
+++ b/samples/browseable/EmbeddedApp/Application/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.wearable.embeddedapp" >
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@android:style/Theme.DeviceDefault.Light" >
+ <activity
+ android:name=".PhoneActivity"
+ android:label="@string/app_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest>
diff --git a/samples/wearable/EmbeddedApp/Application/src/main/res/drawable-hdpi/ic_launcher.png b/samples/browseable/EmbeddedApp/Application/res/drawable-hdpi/ic_launcher.png
index 589f229d1..589f229d1 100755
--- a/samples/wearable/EmbeddedApp/Application/src/main/res/drawable-hdpi/ic_launcher.png
+++ b/samples/browseable/EmbeddedApp/Application/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/EmbeddedApp/Application/res/drawable-hdpi/tile.9.png b/samples/browseable/EmbeddedApp/Application/res/drawable-hdpi/tile.9.png
new file mode 100644
index 000000000..135862883
--- /dev/null
+++ b/samples/browseable/EmbeddedApp/Application/res/drawable-hdpi/tile.9.png
Binary files differ
diff --git a/samples/wearable/EmbeddedApp/Application/src/main/res/drawable-mdpi/ic_launcher.png b/samples/browseable/EmbeddedApp/Application/res/drawable-mdpi/ic_launcher.png
index 77dd57139..77dd57139 100755
--- a/samples/wearable/EmbeddedApp/Application/src/main/res/drawable-mdpi/ic_launcher.png
+++ b/samples/browseable/EmbeddedApp/Application/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/EmbeddedApp/Application/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/EmbeddedApp/Application/res/drawable-xhdpi/ic_launcher.png
index fe34ebe13..fe34ebe13 100755
--- a/samples/wearable/EmbeddedApp/Application/src/main/res/drawable-xhdpi/ic_launcher.png
+++ b/samples/browseable/EmbeddedApp/Application/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/EmbeddedApp/Application/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/EmbeddedApp/Application/res/drawable-xxhdpi/ic_launcher.png
index ab80bcd13..ab80bcd13 100755
--- a/samples/wearable/EmbeddedApp/Application/src/main/res/drawable-xxhdpi/ic_launcher.png
+++ b/samples/browseable/EmbeddedApp/Application/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/EmbeddedApp/Application/res/layout/activity_main.xml b/samples/browseable/EmbeddedApp/Application/res/layout/activity_main.xml
new file mode 100755
index 000000000..be1aa49d9
--- /dev/null
+++ b/samples/browseable/EmbeddedApp/Application/res/layout/activity_main.xml
@@ -0,0 +1,36 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <LinearLayout style="@style/Widget.SampleMessageTile"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView style="@style/Widget.SampleMessage"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="@dimen/horizontal_page_margin"
+ android:layout_marginRight="@dimen/horizontal_page_margin"
+ android:layout_marginTop="@dimen/vertical_page_margin"
+ android:layout_marginBottom="@dimen/vertical_page_margin"
+ android:text="@string/intro_message" />
+ </LinearLayout>
+</LinearLayout>
diff --git a/samples/wearable/EmbeddedApp/Application/src/main/res/layout/activity_phone.xml b/samples/browseable/EmbeddedApp/Application/res/layout/activity_phone.xml
index 54ca57e56..54ca57e56 100644
--- a/samples/wearable/EmbeddedApp/Application/src/main/res/layout/activity_phone.xml
+++ b/samples/browseable/EmbeddedApp/Application/res/layout/activity_phone.xml
diff --git a/samples/browseable/EmbeddedApp/Application/res/values-sw600dp/template-dimens.xml b/samples/browseable/EmbeddedApp/Application/res/values-sw600dp/template-dimens.xml
new file mode 100644
index 000000000..22074a2bd
--- /dev/null
+++ b/samples/browseable/EmbeddedApp/Application/res/values-sw600dp/template-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>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_huge</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/EmbeddedApp/Application/res/values-sw600dp/template-styles.xml b/samples/browseable/EmbeddedApp/Application/res/values-sw600dp/template-styles.xml
new file mode 100644
index 000000000..03d197418
--- /dev/null
+++ b/samples/browseable/EmbeddedApp/Application/res/values-sw600dp/template-styles.xml
@@ -0,0 +1,25 @@
+<!--
+ 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.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceLarge</item>
+ <item name="android:lineSpacingMultiplier">1.2</item>
+ <item name="android:shadowDy">-6.5</item>
+ </style>
+
+</resources>
diff --git a/samples/browseable/EmbeddedApp/Application/res/values-v11/template-styles.xml b/samples/browseable/EmbeddedApp/Application/res/values-v11/template-styles.xml
new file mode 100644
index 000000000..8c1ea66f2
--- /dev/null
+++ b/samples/browseable/EmbeddedApp/Application/res/values-v11/template-styles.xml
@@ -0,0 +1,22 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Holo.Light" />
+
+</resources>
diff --git a/samples/browseable/EmbeddedApp/Application/res/values-v21/base-colors.xml b/samples/browseable/EmbeddedApp/Application/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/EmbeddedApp/Application/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/EmbeddedApp/Application/res/values-v21/base-template-styles.xml b/samples/browseable/EmbeddedApp/Application/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/EmbeddedApp/Application/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/EmbeddedApp/Application/res/values/base-strings.xml b/samples/browseable/EmbeddedApp/Application/res/values/base-strings.xml
new file mode 100644
index 000000000..46059edda
--- /dev/null
+++ b/samples/browseable/EmbeddedApp/Application/res/values/base-strings.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>
+ <string name="app_name">EmbeddedApp</string>
+ <string name="intro_message">
+ <![CDATA[
+
+
+ This simple app demonstrates how to embed a wearable app into a phone app.
+
+
+ ]]>
+ </string>
+</resources>
diff --git a/samples/wearable/EmbeddedApp/Application/src/main/res/values/dimens.xml b/samples/browseable/EmbeddedApp/Application/res/values/dimens.xml
index a1e9cfe8a..a1e9cfe8a 100644
--- a/samples/wearable/EmbeddedApp/Application/src/main/res/values/dimens.xml
+++ b/samples/browseable/EmbeddedApp/Application/res/values/dimens.xml
diff --git a/samples/browseable/EmbeddedApp/Application/res/values/strings.xml b/samples/browseable/EmbeddedApp/Application/res/values/strings.xml
new file mode 100644
index 000000000..05b6f1215
--- /dev/null
+++ b/samples/browseable/EmbeddedApp/Application/res/values/strings.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+
+ <string name="welcome_message">
+ By installing the release build of this application, the corresponding wearable app should
+ automatically be installed on any connected wearable devices.
+ </string>
+
+</resources>
diff --git a/samples/browseable/EmbeddedApp/Application/res/values/template-dimens.xml b/samples/browseable/EmbeddedApp/Application/res/values/template-dimens.xml
new file mode 100644
index 000000000..39e710b5c
--- /dev/null
+++ b/samples/browseable/EmbeddedApp/Application/res/values/template-dimens.xml
@@ -0,0 +1,32 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Define standard dimensions to comply with Holo-style grids and rhythm. -->
+
+ <dimen name="margin_tiny">4dp</dimen>
+ <dimen name="margin_small">8dp</dimen>
+ <dimen name="margin_medium">16dp</dimen>
+ <dimen name="margin_large">32dp</dimen>
+ <dimen name="margin_huge">64dp</dimen>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_medium</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/EmbeddedApp/Application/res/values/template-styles.xml b/samples/browseable/EmbeddedApp/Application/res/values/template-styles.xml
new file mode 100644
index 000000000..6e7d593dd
--- /dev/null
+++ b/samples/browseable/EmbeddedApp/Application/res/values/template-styles.xml
@@ -0,0 +1,42 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+
+ <style name="Theme.Base" parent="android:Theme.Light" />
+
+ <style name="Theme.Sample" parent="Theme.Base" />
+
+ <style name="AppTheme" parent="Theme.Sample" />
+ <!-- Widget styling -->
+
+ <style name="Widget" />
+
+ <style name="Widget.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceMedium</item>
+ <item name="android:lineSpacingMultiplier">1.1</item>
+ </style>
+
+ <style name="Widget.SampleMessageTile">
+ <item name="android:background">@drawable/tile</item>
+ <item name="android:shadowColor">#7F000000</item>
+ <item name="android:shadowDy">-3.5</item>
+ <item name="android:shadowRadius">2</item>
+ </style>
+
+</resources>
diff --git a/samples/wearable/EmbeddedApp/Application/src/main/java/com/example/android/wearable/embeddedapp/PhoneActivity.java b/samples/browseable/EmbeddedApp/Application/src/com.example.android.wearable.embeddedapp/PhoneActivity.java
index 5a2f5ca3a..5a2f5ca3a 100644
--- a/samples/wearable/EmbeddedApp/Application/src/main/java/com/example/android/wearable/embeddedapp/PhoneActivity.java
+++ b/samples/browseable/EmbeddedApp/Application/src/com.example.android.wearable.embeddedapp/PhoneActivity.java
diff --git a/samples/browseable/EmbeddedApp/Wearable/AndroidManifest.xml b/samples/browseable/EmbeddedApp/Wearable/AndroidManifest.xml
new file mode 100644
index 000000000..4863d66e1
--- /dev/null
+++ b/samples/browseable/EmbeddedApp/Wearable/AndroidManifest.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.wearable.embeddedapp" >
+
+ <uses-sdk android:minSdkVersion="20"
+ android:targetSdkVersion="21" />
+
+ <uses-feature android:name="android.hardware.type.watch" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@android:style/Theme.DeviceDefault.Light" >
+ <activity
+ android:name=".WearableActivity"
+ android:label="@string/app_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest>
diff --git a/samples/wearable/EmbeddedApp/Wearable/src/main/res/drawable-hdpi/ic_launcher.png b/samples/browseable/EmbeddedApp/Wearable/res/drawable-hdpi/ic_launcher.png
index 589f229d1..589f229d1 100755
--- a/samples/wearable/EmbeddedApp/Wearable/src/main/res/drawable-hdpi/ic_launcher.png
+++ b/samples/browseable/EmbeddedApp/Wearable/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/EmbeddedApp/Wearable/src/main/res/drawable-mdpi/ic_launcher.png b/samples/browseable/EmbeddedApp/Wearable/res/drawable-mdpi/ic_launcher.png
index 77dd57139..77dd57139 100755
--- a/samples/wearable/EmbeddedApp/Wearable/src/main/res/drawable-mdpi/ic_launcher.png
+++ b/samples/browseable/EmbeddedApp/Wearable/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/EmbeddedApp/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/EmbeddedApp/Wearable/res/drawable-xhdpi/ic_launcher.png
index fe34ebe13..fe34ebe13 100755
--- a/samples/wearable/EmbeddedApp/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png
+++ b/samples/browseable/EmbeddedApp/Wearable/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/EmbeddedApp/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/EmbeddedApp/Wearable/res/drawable-xxhdpi/ic_launcher.png
index ab80bcd13..ab80bcd13 100755
--- a/samples/wearable/EmbeddedApp/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png
+++ b/samples/browseable/EmbeddedApp/Wearable/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/EmbeddedApp/Wearable/src/main/res/layout/activity_wearable.xml b/samples/browseable/EmbeddedApp/Wearable/res/layout/activity_wearable.xml
index 1f6a78a97..1f6a78a97 100644
--- a/samples/wearable/EmbeddedApp/Wearable/src/main/res/layout/activity_wearable.xml
+++ b/samples/browseable/EmbeddedApp/Wearable/res/layout/activity_wearable.xml
diff --git a/samples/wearable/EmbeddedApp/Wearable/src/main/res/values/strings.xml b/samples/browseable/EmbeddedApp/Wearable/res/values/strings.xml
index 1823c573d..1823c573d 100644
--- a/samples/wearable/EmbeddedApp/Wearable/src/main/res/values/strings.xml
+++ b/samples/browseable/EmbeddedApp/Wearable/res/values/strings.xml
diff --git a/samples/wearable/EmbeddedApp/Wearable/src/main/java/com/example/android/wearable/embeddedapp/WearableActivity.java b/samples/browseable/EmbeddedApp/Wearable/src/com.example.android.wearable.embeddedapp/WearableActivity.java
index 3703f3425..3703f3425 100644
--- a/samples/wearable/EmbeddedApp/Wearable/src/main/java/com/example/android/wearable/embeddedapp/WearableActivity.java
+++ b/samples/browseable/EmbeddedApp/Wearable/src/com.example.android.wearable.embeddedapp/WearableActivity.java
diff --git a/samples/browseable/EmbeddedApp/_index.jd b/samples/browseable/EmbeddedApp/_index.jd
new file mode 100644
index 000000000..b8d047f1f
--- /dev/null
+++ b/samples/browseable/EmbeddedApp/_index.jd
@@ -0,0 +1,9 @@
+page.tags="EmbeddedApp"
+sample.group=Wearable
+@jd:body
+
+<p>
+
+ This simple app demonstrates how to embed a wearable app into a phone app.
+
+ </p>
diff --git a/samples/browseable/FindMyPhone/Application/AndroidManifest.xml b/samples/browseable/FindMyPhone/Application/AndroidManifest.xml
new file mode 100644
index 000000000..8cb70d188
--- /dev/null
+++ b/samples/browseable/FindMyPhone/Application/AndroidManifest.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.wearable.findphone">
+
+ <uses-sdk android:minSdkVersion="18"
+ android:targetSdkVersion="21" />
+
+ <uses-permission android:name="android.permission.VIBRATE" />
+ <application
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@android:style/Theme.Holo.Light"
+ android:allowBackup="true">
+
+ <meta-data
+ android:name="com.google.android.gms.version"
+ android:value="@integer/google_play_services_version" />
+
+ <service
+ android:name="com.example.android.wearable.findphone.SoundAlarmListenerService" >
+ <intent-filter>
+ <action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
+ </intent-filter>
+ </service>
+
+ </application>
+</manifest>
diff --git a/samples/wearable/FindMyPhone/Application/src/main/res/drawable-hdpi/ic_launcher.png b/samples/browseable/FindMyPhone/Application/res/drawable-hdpi/ic_launcher.png
index 43254bd67..43254bd67 100644
--- a/samples/wearable/FindMyPhone/Application/src/main/res/drawable-hdpi/ic_launcher.png
+++ b/samples/browseable/FindMyPhone/Application/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/FindMyPhone/Application/res/drawable-hdpi/tile.9.png b/samples/browseable/FindMyPhone/Application/res/drawable-hdpi/tile.9.png
new file mode 100644
index 000000000..135862883
--- /dev/null
+++ b/samples/browseable/FindMyPhone/Application/res/drawable-hdpi/tile.9.png
Binary files differ
diff --git a/samples/wearable/FindMyPhone/Application/src/main/res/drawable-mdpi/ic_launcher.png b/samples/browseable/FindMyPhone/Application/res/drawable-mdpi/ic_launcher.png
index de255d6bb..de255d6bb 100644
--- a/samples/wearable/FindMyPhone/Application/src/main/res/drawable-mdpi/ic_launcher.png
+++ b/samples/browseable/FindMyPhone/Application/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/FindMyPhone/Application/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/FindMyPhone/Application/res/drawable-xhdpi/ic_launcher.png
index 5a849da2e..5a849da2e 100644
--- a/samples/wearable/FindMyPhone/Application/src/main/res/drawable-xhdpi/ic_launcher.png
+++ b/samples/browseable/FindMyPhone/Application/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/FindMyPhone/Application/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/FindMyPhone/Application/res/drawable-xxhdpi/ic_launcher.png
index 96a7cb8e1..96a7cb8e1 100644
--- a/samples/wearable/FindMyPhone/Application/src/main/res/drawable-xxhdpi/ic_launcher.png
+++ b/samples/browseable/FindMyPhone/Application/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/FindMyPhone/Application/res/layout/activity_main.xml b/samples/browseable/FindMyPhone/Application/res/layout/activity_main.xml
new file mode 100755
index 000000000..be1aa49d9
--- /dev/null
+++ b/samples/browseable/FindMyPhone/Application/res/layout/activity_main.xml
@@ -0,0 +1,36 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <LinearLayout style="@style/Widget.SampleMessageTile"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView style="@style/Widget.SampleMessage"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="@dimen/horizontal_page_margin"
+ android:layout_marginRight="@dimen/horizontal_page_margin"
+ android:layout_marginTop="@dimen/vertical_page_margin"
+ android:layout_marginBottom="@dimen/vertical_page_margin"
+ android:text="@string/intro_message" />
+ </LinearLayout>
+</LinearLayout>
diff --git a/samples/browseable/FindMyPhone/Application/res/values-sw600dp/template-dimens.xml b/samples/browseable/FindMyPhone/Application/res/values-sw600dp/template-dimens.xml
new file mode 100644
index 000000000..22074a2bd
--- /dev/null
+++ b/samples/browseable/FindMyPhone/Application/res/values-sw600dp/template-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>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_huge</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/FindMyPhone/Application/res/values-sw600dp/template-styles.xml b/samples/browseable/FindMyPhone/Application/res/values-sw600dp/template-styles.xml
new file mode 100644
index 000000000..03d197418
--- /dev/null
+++ b/samples/browseable/FindMyPhone/Application/res/values-sw600dp/template-styles.xml
@@ -0,0 +1,25 @@
+<!--
+ 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.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceLarge</item>
+ <item name="android:lineSpacingMultiplier">1.2</item>
+ <item name="android:shadowDy">-6.5</item>
+ </style>
+
+</resources>
diff --git a/samples/browseable/FindMyPhone/Application/res/values-v11/template-styles.xml b/samples/browseable/FindMyPhone/Application/res/values-v11/template-styles.xml
new file mode 100644
index 000000000..8c1ea66f2
--- /dev/null
+++ b/samples/browseable/FindMyPhone/Application/res/values-v11/template-styles.xml
@@ -0,0 +1,22 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Holo.Light" />
+
+</resources>
diff --git a/samples/browseable/FindMyPhone/Application/res/values-v21/base-colors.xml b/samples/browseable/FindMyPhone/Application/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/FindMyPhone/Application/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/FindMyPhone/Application/res/values-v21/base-template-styles.xml b/samples/browseable/FindMyPhone/Application/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/FindMyPhone/Application/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/FindMyPhone/Application/res/values/base-strings.xml b/samples/browseable/FindMyPhone/Application/res/values/base-strings.xml
new file mode 100644
index 000000000..e2e3722b4
--- /dev/null
+++ b/samples/browseable/FindMyPhone/Application/res/values/base-strings.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<resources>
+ <string name="app_name">FindMyPhone</string>
+ <string name="intro_message">
+ <![CDATA[
+
+
+ This sample application notifies you when you may have left your phone behind
+ (specifically, when your companion and wearable disconnect). If you have misplaced your phone, but
+ it is still connected to your wearable, you can also start an activity on the wearable to sound an
+ alarm on your phone.
+
+
+ ]]>
+ </string>
+</resources>
diff --git a/samples/browseable/FindMyPhone/Application/res/values/strings.xml b/samples/browseable/FindMyPhone/Application/res/values/strings.xml
new file mode 100644
index 000000000..64163c27c
--- /dev/null
+++ b/samples/browseable/FindMyPhone/Application/res/values/strings.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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>
+</resources>
diff --git a/samples/browseable/FindMyPhone/Application/res/values/template-dimens.xml b/samples/browseable/FindMyPhone/Application/res/values/template-dimens.xml
new file mode 100644
index 000000000..39e710b5c
--- /dev/null
+++ b/samples/browseable/FindMyPhone/Application/res/values/template-dimens.xml
@@ -0,0 +1,32 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Define standard dimensions to comply with Holo-style grids and rhythm. -->
+
+ <dimen name="margin_tiny">4dp</dimen>
+ <dimen name="margin_small">8dp</dimen>
+ <dimen name="margin_medium">16dp</dimen>
+ <dimen name="margin_large">32dp</dimen>
+ <dimen name="margin_huge">64dp</dimen>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_medium</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/FindMyPhone/Application/res/values/template-styles.xml b/samples/browseable/FindMyPhone/Application/res/values/template-styles.xml
new file mode 100644
index 000000000..6e7d593dd
--- /dev/null
+++ b/samples/browseable/FindMyPhone/Application/res/values/template-styles.xml
@@ -0,0 +1,42 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+
+ <style name="Theme.Base" parent="android:Theme.Light" />
+
+ <style name="Theme.Sample" parent="Theme.Base" />
+
+ <style name="AppTheme" parent="Theme.Sample" />
+ <!-- Widget styling -->
+
+ <style name="Widget" />
+
+ <style name="Widget.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceMedium</item>
+ <item name="android:lineSpacingMultiplier">1.1</item>
+ </style>
+
+ <style name="Widget.SampleMessageTile">
+ <item name="android:background">@drawable/tile</item>
+ <item name="android:shadowColor">#7F000000</item>
+ <item name="android:shadowDy">-3.5</item>
+ <item name="android:shadowRadius">2</item>
+ </style>
+
+</resources>
diff --git a/samples/wearable/FindMyPhone/Application/src/main/java/com/example/android/wearable/findphone/SoundAlarmListenerService.java b/samples/browseable/FindMyPhone/Application/src/com.example.android.wearable.findphone/SoundAlarmListenerService.java
index c89db9d3c..c89db9d3c 100644
--- a/samples/wearable/FindMyPhone/Application/src/main/java/com/example/android/wearable/findphone/SoundAlarmListenerService.java
+++ b/samples/browseable/FindMyPhone/Application/src/com.example.android.wearable.findphone/SoundAlarmListenerService.java
diff --git a/samples/browseable/FindMyPhone/Wearable/AndroidManifest.xml b/samples/browseable/FindMyPhone/Wearable/AndroidManifest.xml
new file mode 100644
index 000000000..18b5209d6
--- /dev/null
+++ b/samples/browseable/FindMyPhone/Wearable/AndroidManifest.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.wearable.findphone" >
+
+ <uses-sdk android:minSdkVersion="20"
+ android:targetSdkVersion="21" />
+
+ <uses-permission android:name="android.permission.VIBRATE" />
+ <uses-feature android:name="android.hardware.type.watch" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@android:style/Theme.DeviceDefault" >
+
+ <meta-data
+ android:name="com.google.android.gms.version"
+ android:value="@integer/google_play_services_version" />
+
+ <service android:name=".DisconnectListenerService" >
+ <intent-filter>
+ <action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
+ </intent-filter>
+ </service>
+
+ <service android:name="com.example.android.wearable.findphone.FindPhoneService"/>
+
+ <activity
+ android:name=".FindPhoneActivity"
+ android:label="@string/app_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="android.intent.category.LAUNCHER"/>
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest>
diff --git a/samples/wearable/FindMyPhone/Wearable/src/main/res/drawable-hdpi/alarm_action_icon.png b/samples/browseable/FindMyPhone/Wearable/res/drawable-hdpi/alarm_action_icon.png
index 4331a5121..4331a5121 100644
--- a/samples/wearable/FindMyPhone/Wearable/src/main/res/drawable-hdpi/alarm_action_icon.png
+++ b/samples/browseable/FindMyPhone/Wearable/res/drawable-hdpi/alarm_action_icon.png
Binary files differ
diff --git a/samples/wearable/FindMyPhone/Wearable/src/main/res/drawable-hdpi/ic_launcher.png b/samples/browseable/FindMyPhone/Wearable/res/drawable-hdpi/ic_launcher.png
index 43254bd67..43254bd67 100644
--- a/samples/wearable/FindMyPhone/Wearable/src/main/res/drawable-hdpi/ic_launcher.png
+++ b/samples/browseable/FindMyPhone/Wearable/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/FindMyPhone/Wearable/src/main/res/drawable-mdpi/ic_launcher.png b/samples/browseable/FindMyPhone/Wearable/res/drawable-mdpi/ic_launcher.png
index de255d6bb..de255d6bb 100644
--- a/samples/wearable/FindMyPhone/Wearable/src/main/res/drawable-mdpi/ic_launcher.png
+++ b/samples/browseable/FindMyPhone/Wearable/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/FindMyPhone/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/FindMyPhone/Wearable/res/drawable-xhdpi/ic_launcher.png
index 5a849da2e..5a849da2e 100644
--- a/samples/wearable/FindMyPhone/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png
+++ b/samples/browseable/FindMyPhone/Wearable/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/FindMyPhone/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/FindMyPhone/Wearable/res/drawable-xxhdpi/ic_launcher.png
index 96a7cb8e1..96a7cb8e1 100644
--- a/samples/wearable/FindMyPhone/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png
+++ b/samples/browseable/FindMyPhone/Wearable/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/FindMyPhone/Wearable/src/main/res/values/strings.xml b/samples/browseable/FindMyPhone/Wearable/res/values/strings.xml
index 5c6debe44..5c6debe44 100644
--- a/samples/wearable/FindMyPhone/Wearable/src/main/res/values/strings.xml
+++ b/samples/browseable/FindMyPhone/Wearable/res/values/strings.xml
diff --git a/samples/wearable/FindMyPhone/Wearable/src/main/java/com/example/android/wearable/findphone/DisconnectListenerService.java b/samples/browseable/FindMyPhone/Wearable/src/com.example.android.wearable.findphone/DisconnectListenerService.java
index 42237de3e..42237de3e 100644
--- a/samples/wearable/FindMyPhone/Wearable/src/main/java/com/example/android/wearable/findphone/DisconnectListenerService.java
+++ b/samples/browseable/FindMyPhone/Wearable/src/com.example.android.wearable.findphone/DisconnectListenerService.java
diff --git a/samples/wearable/FindMyPhone/Wearable/src/main/java/com/example/android/wearable/findphone/FindPhoneActivity.java b/samples/browseable/FindMyPhone/Wearable/src/com.example.android.wearable.findphone/FindPhoneActivity.java
index d4eb18bf4..d4eb18bf4 100644
--- a/samples/wearable/FindMyPhone/Wearable/src/main/java/com/example/android/wearable/findphone/FindPhoneActivity.java
+++ b/samples/browseable/FindMyPhone/Wearable/src/com.example.android.wearable.findphone/FindPhoneActivity.java
diff --git a/samples/wearable/FindMyPhone/Wearable/src/main/java/com/example/android/wearable/findphone/FindPhoneService.java b/samples/browseable/FindMyPhone/Wearable/src/com.example.android.wearable.findphone/FindPhoneService.java
index e5fa6c0ca..e5fa6c0ca 100644
--- a/samples/wearable/FindMyPhone/Wearable/src/main/java/com/example/android/wearable/findphone/FindPhoneService.java
+++ b/samples/browseable/FindMyPhone/Wearable/src/com.example.android.wearable.findphone/FindPhoneService.java
diff --git a/samples/browseable/FindMyPhone/_index.jd b/samples/browseable/FindMyPhone/_index.jd
new file mode 100644
index 000000000..ed504c9a1
--- /dev/null
+++ b/samples/browseable/FindMyPhone/_index.jd
@@ -0,0 +1,12 @@
+page.tags="FindMyPhone"
+sample.group=Wearable
+@jd:body
+
+<p>
+
+ This sample application notifies you when you may have left your phone behind
+ (specifically, when your companion and wearable disconnect). If you have misplaced your phone, but
+ it is still connected to your wearable, you can also start an activity on the wearable to sound an
+ alarm on your phone.
+
+ </p>
diff --git a/samples/browseable/Flashlight/Application/AndroidManifest.xml b/samples/browseable/Flashlight/Application/AndroidManifest.xml
new file mode 100644
index 000000000..925d11b28
--- /dev/null
+++ b/samples/browseable/Flashlight/Application/AndroidManifest.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.wearable.flashlight">
+
+ <uses-sdk android:minSdkVersion="18"
+ android:targetSdkVersion="21" />
+
+ <application android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name">
+ </application>
+
+</manifest>
+
diff --git a/samples/wearable/Flashlight/Wearable/src/main/res/drawable-hdpi/ic_launcher.png b/samples/browseable/Flashlight/Application/res/drawable-hdpi/ic_launcher.png
index 589f229d1..589f229d1 100755
--- a/samples/wearable/Flashlight/Wearable/src/main/res/drawable-hdpi/ic_launcher.png
+++ b/samples/browseable/Flashlight/Application/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/Flashlight/Application/res/drawable-hdpi/tile.9.png b/samples/browseable/Flashlight/Application/res/drawable-hdpi/tile.9.png
new file mode 100644
index 000000000..135862883
--- /dev/null
+++ b/samples/browseable/Flashlight/Application/res/drawable-hdpi/tile.9.png
Binary files differ
diff --git a/samples/wearable/Flashlight/Wearable/src/main/res/drawable-mdpi/ic_launcher.png b/samples/browseable/Flashlight/Application/res/drawable-mdpi/ic_launcher.png
index 77dd57139..77dd57139 100755
--- a/samples/wearable/Flashlight/Wearable/src/main/res/drawable-mdpi/ic_launcher.png
+++ b/samples/browseable/Flashlight/Application/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/Flashlight/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/Flashlight/Application/res/drawable-xhdpi/ic_launcher.png
index fe34ebe13..fe34ebe13 100755
--- a/samples/wearable/Flashlight/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png
+++ b/samples/browseable/Flashlight/Application/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/Flashlight/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/Flashlight/Application/res/drawable-xxhdpi/ic_launcher.png
index ab80bcd13..ab80bcd13 100755
--- a/samples/wearable/Flashlight/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png
+++ b/samples/browseable/Flashlight/Application/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/Flashlight/Application/res/layout/activity_main.xml b/samples/browseable/Flashlight/Application/res/layout/activity_main.xml
new file mode 100755
index 000000000..be1aa49d9
--- /dev/null
+++ b/samples/browseable/Flashlight/Application/res/layout/activity_main.xml
@@ -0,0 +1,36 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <LinearLayout style="@style/Widget.SampleMessageTile"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView style="@style/Widget.SampleMessage"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="@dimen/horizontal_page_margin"
+ android:layout_marginRight="@dimen/horizontal_page_margin"
+ android:layout_marginTop="@dimen/vertical_page_margin"
+ android:layout_marginBottom="@dimen/vertical_page_margin"
+ android:text="@string/intro_message" />
+ </LinearLayout>
+</LinearLayout>
diff --git a/samples/browseable/Flashlight/Application/res/values-sw600dp/template-dimens.xml b/samples/browseable/Flashlight/Application/res/values-sw600dp/template-dimens.xml
new file mode 100644
index 000000000..22074a2bd
--- /dev/null
+++ b/samples/browseable/Flashlight/Application/res/values-sw600dp/template-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>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_huge</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/Flashlight/Application/res/values-sw600dp/template-styles.xml b/samples/browseable/Flashlight/Application/res/values-sw600dp/template-styles.xml
new file mode 100644
index 000000000..03d197418
--- /dev/null
+++ b/samples/browseable/Flashlight/Application/res/values-sw600dp/template-styles.xml
@@ -0,0 +1,25 @@
+<!--
+ 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.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceLarge</item>
+ <item name="android:lineSpacingMultiplier">1.2</item>
+ <item name="android:shadowDy">-6.5</item>
+ </style>
+
+</resources>
diff --git a/samples/browseable/Flashlight/Application/res/values-v11/template-styles.xml b/samples/browseable/Flashlight/Application/res/values-v11/template-styles.xml
new file mode 100644
index 000000000..8c1ea66f2
--- /dev/null
+++ b/samples/browseable/Flashlight/Application/res/values-v11/template-styles.xml
@@ -0,0 +1,22 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Holo.Light" />
+
+</resources>
diff --git a/samples/browseable/Flashlight/Application/res/values-v21/base-colors.xml b/samples/browseable/Flashlight/Application/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/Flashlight/Application/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/Flashlight/Application/res/values-v21/base-template-styles.xml b/samples/browseable/Flashlight/Application/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/Flashlight/Application/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/Flashlight/Application/res/values/base-strings.xml b/samples/browseable/Flashlight/Application/res/values/base-strings.xml
new file mode 100644
index 000000000..f0f3d9d64
--- /dev/null
+++ b/samples/browseable/Flashlight/Application/res/values/base-strings.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>
+ <string name="app_name">Flashlight</string>
+ <string name="intro_message">
+ <![CDATA[
+
+
+ Wearable activity that uses your wearable screen as a flashlight. There is also
+ a party-mode option, if you want to make things interesting.
+
+
+ ]]>
+ </string>
+</resources>
diff --git a/samples/browseable/Flashlight/Application/res/values/template-dimens.xml b/samples/browseable/Flashlight/Application/res/values/template-dimens.xml
new file mode 100644
index 000000000..39e710b5c
--- /dev/null
+++ b/samples/browseable/Flashlight/Application/res/values/template-dimens.xml
@@ -0,0 +1,32 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Define standard dimensions to comply with Holo-style grids and rhythm. -->
+
+ <dimen name="margin_tiny">4dp</dimen>
+ <dimen name="margin_small">8dp</dimen>
+ <dimen name="margin_medium">16dp</dimen>
+ <dimen name="margin_large">32dp</dimen>
+ <dimen name="margin_huge">64dp</dimen>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_medium</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/Flashlight/Application/res/values/template-styles.xml b/samples/browseable/Flashlight/Application/res/values/template-styles.xml
new file mode 100644
index 000000000..6e7d593dd
--- /dev/null
+++ b/samples/browseable/Flashlight/Application/res/values/template-styles.xml
@@ -0,0 +1,42 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+
+ <style name="Theme.Base" parent="android:Theme.Light" />
+
+ <style name="Theme.Sample" parent="Theme.Base" />
+
+ <style name="AppTheme" parent="Theme.Sample" />
+ <!-- Widget styling -->
+
+ <style name="Widget" />
+
+ <style name="Widget.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceMedium</item>
+ <item name="android:lineSpacingMultiplier">1.1</item>
+ </style>
+
+ <style name="Widget.SampleMessageTile">
+ <item name="android:background">@drawable/tile</item>
+ <item name="android:shadowColor">#7F000000</item>
+ <item name="android:shadowDy">-3.5</item>
+ <item name="android:shadowRadius">2</item>
+ </style>
+
+</resources>
diff --git a/samples/browseable/Flashlight/Application/src/com.example.android.common/activities/SampleActivityBase.java b/samples/browseable/Flashlight/Application/src/com.example.android.common/activities/SampleActivityBase.java
new file mode 100644
index 000000000..3228927b7
--- /dev/null
+++ b/samples/browseable/Flashlight/Application/src/com.example.android.common/activities/SampleActivityBase.java
@@ -0,0 +1,52 @@
+/*
+* Copyright 2013 The Android Open Source Project
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package com.example.android.common.activities;
+
+import android.os.Bundle;
+import android.support.v4.app.FragmentActivity;
+
+import com.example.android.common.logger.Log;
+import com.example.android.common.logger.LogWrapper;
+
+/**
+ * Base launcher activity, to handle most of the common plumbing for samples.
+ */
+public class SampleActivityBase extends FragmentActivity {
+
+ public static final String TAG = "SampleActivityBase";
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ }
+
+ @Override
+ protected void onStart() {
+ super.onStart();
+ initializeLogging();
+ }
+
+ /** Set up targets to receive log data */
+ public void initializeLogging() {
+ // Using Log, front-end to the logging chain, emulates android.util.log method signatures.
+ // Wraps Android's native log framework
+ LogWrapper logWrapper = new LogWrapper();
+ Log.setLogNode(logWrapper);
+
+ Log.i(TAG, "Ready");
+ }
+}
diff --git a/samples/browseable/Flashlight/Application/src/com.example.android.common/logger/Log.java b/samples/browseable/Flashlight/Application/src/com.example.android.common/logger/Log.java
new file mode 100644
index 000000000..17503c568
--- /dev/null
+++ b/samples/browseable/Flashlight/Application/src/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);
+ }
+}
diff --git a/samples/browseable/Flashlight/Application/src/com.example.android.common/logger/LogFragment.java b/samples/browseable/Flashlight/Application/src/com.example.android.common/logger/LogFragment.java
new file mode 100644
index 000000000..b302acd4b
--- /dev/null
+++ b/samples/browseable/Flashlight/Application/src/com.example.android.common/logger/LogFragment.java
@@ -0,0 +1,109 @@
+/*
+* 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 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.graphics.Typeface;
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ScrollView;
+
+/**
+ * Simple fraggment which contains a LogView and uses is to output log data it receives
+ * through the LogNode interface.
+ */
+public class LogFragment extends Fragment {
+
+ private LogView mLogView;
+ private ScrollView mScrollView;
+
+ public LogFragment() {}
+
+ public View inflateViews() {
+ mScrollView = new ScrollView(getActivity());
+ ViewGroup.LayoutParams scrollParams = new ViewGroup.LayoutParams(
+ ViewGroup.LayoutParams.MATCH_PARENT,
+ ViewGroup.LayoutParams.MATCH_PARENT);
+ mScrollView.setLayoutParams(scrollParams);
+
+ mLogView = new LogView(getActivity());
+ ViewGroup.LayoutParams logParams = new ViewGroup.LayoutParams(scrollParams);
+ logParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
+ mLogView.setLayoutParams(logParams);
+ mLogView.setClickable(true);
+ mLogView.setFocusable(true);
+ mLogView.setTypeface(Typeface.MONOSPACE);
+
+ // Want to set padding as 16 dips, setPadding takes pixels. Hooray math!
+ int paddingDips = 16;
+ double scale = getResources().getDisplayMetrics().density;
+ int paddingPixels = (int) ((paddingDips * (scale)) + .5);
+ mLogView.setPadding(paddingPixels, paddingPixels, paddingPixels, paddingPixels);
+ mLogView.setCompoundDrawablePadding(paddingPixels);
+
+ mLogView.setGravity(Gravity.BOTTOM);
+ mLogView.setTextAppearance(getActivity(), android.R.style.TextAppearance_Holo_Medium);
+
+ mScrollView.addView(mLogView);
+ return mScrollView;
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+
+ View result = inflateViews();
+
+ 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) {
+ mScrollView.fullScroll(ScrollView.FOCUS_DOWN);
+ }
+ });
+ return result;
+ }
+
+ public LogView getLogView() {
+ return mLogView;
+ }
+} \ No newline at end of file
diff --git a/samples/browseable/Flashlight/Application/src/com.example.android.common/logger/LogNode.java b/samples/browseable/Flashlight/Application/src/com.example.android.common/logger/LogNode.java
new file mode 100644
index 000000000..bc37cabc0
--- /dev/null
+++ b/samples/browseable/Flashlight/Application/src/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/samples/browseable/Flashlight/Application/src/com.example.android.common/logger/LogView.java b/samples/browseable/Flashlight/Application/src/com.example.android.common/logger/LogView.java
new file mode 100644
index 000000000..c01542b91
--- /dev/null
+++ b/samples/browseable/Flashlight/Application/src/com.example.android.common/logger/LogView.java
@@ -0,0 +1,145 @@
+/*
+ * 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.app.Activity;
+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.
+ final StringBuilder outputBuilder = new StringBuilder();
+
+ String delimiter = "\t";
+ appendIfNotNull(outputBuilder, priorityStr, delimiter);
+ appendIfNotNull(outputBuilder, tag, delimiter);
+ appendIfNotNull(outputBuilder, msg, delimiter);
+ appendIfNotNull(outputBuilder, exceptionStr, delimiter);
+
+ // In case this was originally called from an AsyncTask or some other off-UI thread,
+ // make sure the update occurs within the UI thread.
+ ((Activity) getContext()).runOnUiThread( (new Thread(new Runnable() {
+ @Override
+ public void run() {
+ // 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/samples/browseable/Flashlight/Application/src/com.example.android.common/logger/LogWrapper.java b/samples/browseable/Flashlight/Application/src/com.example.android.common/logger/LogWrapper.java
new file mode 100644
index 000000000..16a9e7ba2
--- /dev/null
+++ b/samples/browseable/Flashlight/Application/src/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);
+ }
+ }
+}
diff --git a/samples/browseable/Flashlight/Application/src/com.example.android.common/logger/MessageOnlyLogFilter.java b/samples/browseable/Flashlight/Application/src/com.example.android.common/logger/MessageOnlyLogFilter.java
new file mode 100644
index 000000000..19967dcd4
--- /dev/null
+++ b/samples/browseable/Flashlight/Application/src/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 chain.
+ */
+ public LogNode getNext() {
+ return mNext;
+ }
+
+ /**
+ * Sets the LogNode data will be sent to..
+ */
+ public void setNext(LogNode node) {
+ mNext = node;
+ }
+
+}
diff --git a/samples/browseable/Flashlight/Wearable/AndroidManifest.xml b/samples/browseable/Flashlight/Wearable/AndroidManifest.xml
new file mode 100644
index 000000000..738ba9d37
--- /dev/null
+++ b/samples/browseable/Flashlight/Wearable/AndroidManifest.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.wearable.flashlight" >
+
+ <uses-sdk android:minSdkVersion="20"
+ android:targetSdkVersion="21" />
+
+ <uses-feature android:name="android.hardware.type.watch" />
+
+ <application
+ android:label="@string/app_name"
+ android:icon="@drawable/ic_launcher"
+ android:theme="@android:style/Theme.DeviceDefault" >
+ <activity android:name=".MainActivity"
+ android:label="@string/app_name"
+ android:launchMode="singleTop"
+ android:configChanges="orientation|keyboardHidden">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ </activity>
+ </application>
+</manifest>
diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-hdpi/ic_launcher.png b/samples/browseable/Flashlight/Wearable/res/drawable-hdpi/ic_launcher.png
index 589f229d1..589f229d1 100644..100755
--- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-hdpi/ic_launcher.png
+++ b/samples/browseable/Flashlight/Wearable/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-mdpi/ic_launcher.png b/samples/browseable/Flashlight/Wearable/res/drawable-mdpi/ic_launcher.png
index 77dd57139..77dd57139 100644..100755
--- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-mdpi/ic_launcher.png
+++ b/samples/browseable/Flashlight/Wearable/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/Flashlight/Wearable/res/drawable-xhdpi/ic_launcher.png
index fe34ebe13..fe34ebe13 100644..100755
--- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png
+++ b/samples/browseable/Flashlight/Wearable/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/Flashlight/Wearable/res/drawable-xxhdpi/ic_launcher.png
index ab80bcd13..ab80bcd13 100755
--- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png
+++ b/samples/browseable/Flashlight/Wearable/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/Flashlight/Wearable/src/main/res/layout/main.xml b/samples/browseable/Flashlight/Wearable/res/layout/main.xml
index 1e10f5a4a..1e10f5a4a 100644
--- a/samples/wearable/Flashlight/Wearable/src/main/res/layout/main.xml
+++ b/samples/browseable/Flashlight/Wearable/res/layout/main.xml
diff --git a/samples/wearable/Flashlight/Wearable/src/main/res/layout/party_light.xml b/samples/browseable/Flashlight/Wearable/res/layout/party_light.xml
index b29ef9491..b29ef9491 100644
--- a/samples/wearable/Flashlight/Wearable/src/main/res/layout/party_light.xml
+++ b/samples/browseable/Flashlight/Wearable/res/layout/party_light.xml
diff --git a/samples/wearable/Flashlight/Wearable/src/main/res/layout/white_light.xml b/samples/browseable/Flashlight/Wearable/res/layout/white_light.xml
index 94353a2b0..94353a2b0 100644
--- a/samples/wearable/Flashlight/Wearable/src/main/res/layout/white_light.xml
+++ b/samples/browseable/Flashlight/Wearable/res/layout/white_light.xml
diff --git a/samples/wearable/Flashlight/Wearable/src/main/res/values/strings.xml b/samples/browseable/Flashlight/Wearable/res/values/strings.xml
index 6790e2d61..6790e2d61 100644
--- a/samples/wearable/Flashlight/Wearable/src/main/res/values/strings.xml
+++ b/samples/browseable/Flashlight/Wearable/res/values/strings.xml
diff --git a/samples/wearable/Flashlight/Wearable/src/main/java/com/example/android/wearable/flashlight/MainActivity.java b/samples/browseable/Flashlight/Wearable/src/com.example.android.wearable.flashlight/MainActivity.java
index f87cae878..f87cae878 100644
--- a/samples/wearable/Flashlight/Wearable/src/main/java/com/example/android/wearable/flashlight/MainActivity.java
+++ b/samples/browseable/Flashlight/Wearable/src/com.example.android.wearable.flashlight/MainActivity.java
diff --git a/samples/wearable/Flashlight/Wearable/src/main/java/com/example/android/wearable/flashlight/PartyLightView.java b/samples/browseable/Flashlight/Wearable/src/com.example.android.wearable.flashlight/PartyLightView.java
index 33f061e15..33f061e15 100644
--- a/samples/wearable/Flashlight/Wearable/src/main/java/com/example/android/wearable/flashlight/PartyLightView.java
+++ b/samples/browseable/Flashlight/Wearable/src/com.example.android.wearable.flashlight/PartyLightView.java
diff --git a/samples/browseable/Flashlight/_index.jd b/samples/browseable/Flashlight/_index.jd
new file mode 100644
index 000000000..d691b73a5
--- /dev/null
+++ b/samples/browseable/Flashlight/_index.jd
@@ -0,0 +1,10 @@
+page.tags="Flashlight"
+sample.group=Wearable
+@jd:body
+
+<p>
+
+ Wearable activity that uses your wearable screen as a flashlight. There is also
+ a party-mode option, if you want to make things interesting.
+
+ </p>
diff --git a/samples/browseable/FloatingActionButtonBasic/res/values-v21/base-colors.xml b/samples/browseable/FloatingActionButtonBasic/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/FloatingActionButtonBasic/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/FloatingActionButtonBasic/res/values-v21/base-template-styles.xml b/samples/browseable/FloatingActionButtonBasic/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/FloatingActionButtonBasic/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/FloatingActionButtonBasic/res/values-v21/template-styles.xml b/samples/browseable/FloatingActionButtonBasic/res/values-v21/template-styles.xml
deleted file mode 100644
index 134fcd9d3..000000000
--- a/samples/browseable/FloatingActionButtonBasic/res/values-v21/template-styles.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<!--
- Copyright 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<resources>
-
- <!-- Activity themes -->
- <style name="Theme.Base" parent="android:Theme.Material.Light" />
-
-</resources>
diff --git a/samples/browseable/FloatingActionButtonBasic/res/values/dimens.xml b/samples/browseable/FloatingActionButtonBasic/res/values/dimens.xml
index f063937a7..5a9d68440 100644
--- a/samples/browseable/FloatingActionButtonBasic/res/values/dimens.xml
+++ b/samples/browseable/FloatingActionButtonBasic/res/values/dimens.xml
@@ -15,8 +15,8 @@
limitations under the License.
-->
<resources>
- <dimen name="fab_elevation">2dp</dimen>
- <dimen name="fab_press_translation_z">2dp</dimen>
+ <dimen name="fab_elevation">8dp</dimen>
+ <dimen name="fab_press_translation_z">9dp</dimen>
<dimen name="fab_size">56dp</dimen>
<dimen name="fab_size_small">40dp</dimen>
<dimen name="fab_icon_size">24dp</dimen>
diff --git a/samples/browseable/FragmentTransition/AndroidManifest.xml b/samples/browseable/FragmentTransition/AndroidManifest.xml
index 8d02eb0a4..2cfe40604 100644
--- a/samples/browseable/FragmentTransition/AndroidManifest.xml
+++ b/samples/browseable/FragmentTransition/AndroidManifest.xml
@@ -19,7 +19,7 @@
android:versionCode="1"
android:versionName="1.0">
- <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="19" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<application
android:allowBackup="true"
diff --git a/samples/browseable/FragmentTransition/_index.jd b/samples/browseable/FragmentTransition/_index.jd
index f0efe32fd..afab623ea 100644
--- a/samples/browseable/FragmentTransition/_index.jd
+++ b/samples/browseable/FragmentTransition/_index.jd
@@ -1,8 +1,9 @@
-
-
-
page.tags="FragmentTransition"
sample.group=UI
@jd:body
-<p>This sample demonstrates how to start a transition right after a fragment transaction.</p>
+<p>
+
+ This sample demonstrates how to start a transition right after a fragment transaction.
+
+ </p>
diff --git a/samples/browseable/FragmentTransition/res/values-v21/base-colors.xml b/samples/browseable/FragmentTransition/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/FragmentTransition/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/FragmentTransition/res/values-v21/base-template-styles.xml b/samples/browseable/FragmentTransition/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/FragmentTransition/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/FragmentTransition/res/values/base-strings.xml b/samples/browseable/FragmentTransition/res/values/base-strings.xml
index 933e1f28e..92707c9ef 100644
--- a/samples/browseable/FragmentTransition/res/values/base-strings.xml
+++ b/samples/browseable/FragmentTransition/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">FragmentTransition</string>
<string name="intro_message">
diff --git a/samples/browseable/FragmentTransition/res/values/strings.xml b/samples/browseable/FragmentTransition/res/values/strings.xml
index 5f7778987..5f7778987 100755..100644
--- a/samples/browseable/FragmentTransition/res/values/strings.xml
+++ b/samples/browseable/FragmentTransition/res/values/strings.xml
diff --git a/samples/browseable/FragmentTransition/src/com.example.android.fragmenttransition/MainActivity.java b/samples/browseable/FragmentTransition/src/com.example.android.fragmenttransition/MainActivity.java
index 7d6ca6f4d..fa019bee4 100644
--- a/samples/browseable/FragmentTransition/src/com.example.android.fragmenttransition/MainActivity.java
+++ b/samples/browseable/FragmentTransition/src/com.example.android.fragmenttransition/MainActivity.java
@@ -14,9 +14,6 @@
* limitations under the License.
*/
-
-
-
package com.example.android.fragmenttransition;
import android.os.Bundle;
@@ -50,10 +47,12 @@ public class MainActivity extends SampleActivityBase {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
- FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
- FragmentTransitionFragment fragment = new FragmentTransitionFragment();
- transaction.replace(R.id.sample_content_fragment, fragment);
- transaction.commit();
+ if (savedInstanceState == null) {
+ FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
+ FragmentTransitionFragment fragment = new FragmentTransitionFragment();
+ transaction.replace(R.id.sample_content_fragment, fragment);
+ transaction.commit();
+ }
}
@Override
diff --git a/samples/browseable/Geofencing/Application/AndroidManifest.xml b/samples/browseable/Geofencing/Application/AndroidManifest.xml
new file mode 100644
index 000000000..d07a2659f
--- /dev/null
+++ b/samples/browseable/Geofencing/Application/AndroidManifest.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.wearable.geofencing">
+
+ <uses-sdk android:minSdkVersion="18"
+ android:targetSdkVersion="21" />
+
+ <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
+
+ <application
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@android:style/Theme.Holo.Light"
+ android:allowBackup="true">
+
+ <meta-data
+ android:name="com.google.android.gms.version"
+ android:value="@integer/google_play_services_version"/>
+
+ <activity
+ android:name=".MainActivity"
+ android:label="@string/app_name"
+ android:theme="@android:style/Theme.Translucent.NoTitleBar"
+ android:excludeFromRecents="true">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="android.intent.category.LAUNCHER"/>
+ </intent-filter>
+ </activity>
+
+ <service
+ android:name=".GeofenceTransitionsIntentService"
+ android:exported="false">
+ </service>
+ </application>
+</manifest>
diff --git a/samples/wearable/Geofencing/Application/src/main/res/drawable-hdpi/ic_launcher.png b/samples/browseable/Geofencing/Application/res/drawable-hdpi/ic_launcher.png
index 4e3e000b0..4e3e000b0 100644
--- a/samples/wearable/Geofencing/Application/src/main/res/drawable-hdpi/ic_launcher.png
+++ b/samples/browseable/Geofencing/Application/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/Geofencing/Application/res/drawable-hdpi/tile.9.png b/samples/browseable/Geofencing/Application/res/drawable-hdpi/tile.9.png
new file mode 100644
index 000000000..135862883
--- /dev/null
+++ b/samples/browseable/Geofencing/Application/res/drawable-hdpi/tile.9.png
Binary files differ
diff --git a/samples/wearable/Geofencing/Application/src/main/res/drawable-mdpi/ic_launcher.png b/samples/browseable/Geofencing/Application/res/drawable-mdpi/ic_launcher.png
index b405cb2e8..b405cb2e8 100644
--- a/samples/wearable/Geofencing/Application/src/main/res/drawable-mdpi/ic_launcher.png
+++ b/samples/browseable/Geofencing/Application/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/Geofencing/Application/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/Geofencing/Application/res/drawable-xhdpi/ic_launcher.png
index 61f9d889c..61f9d889c 100644
--- a/samples/wearable/Geofencing/Application/src/main/res/drawable-xhdpi/ic_launcher.png
+++ b/samples/browseable/Geofencing/Application/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/Geofencing/Application/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/Geofencing/Application/res/drawable-xxhdpi/ic_launcher.png
index 81c10085a..81c10085a 100644
--- a/samples/wearable/Geofencing/Application/src/main/res/drawable-xxhdpi/ic_launcher.png
+++ b/samples/browseable/Geofencing/Application/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/Geofencing/Application/res/layout/activity_main.xml b/samples/browseable/Geofencing/Application/res/layout/activity_main.xml
new file mode 100755
index 000000000..be1aa49d9
--- /dev/null
+++ b/samples/browseable/Geofencing/Application/res/layout/activity_main.xml
@@ -0,0 +1,36 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <LinearLayout style="@style/Widget.SampleMessageTile"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView style="@style/Widget.SampleMessage"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="@dimen/horizontal_page_margin"
+ android:layout_marginRight="@dimen/horizontal_page_margin"
+ android:layout_marginTop="@dimen/vertical_page_margin"
+ android:layout_marginBottom="@dimen/vertical_page_margin"
+ android:text="@string/intro_message" />
+ </LinearLayout>
+</LinearLayout>
diff --git a/samples/browseable/Geofencing/Application/res/values-sw600dp/template-dimens.xml b/samples/browseable/Geofencing/Application/res/values-sw600dp/template-dimens.xml
new file mode 100644
index 000000000..22074a2bd
--- /dev/null
+++ b/samples/browseable/Geofencing/Application/res/values-sw600dp/template-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>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_huge</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/Geofencing/Application/res/values-sw600dp/template-styles.xml b/samples/browseable/Geofencing/Application/res/values-sw600dp/template-styles.xml
new file mode 100644
index 000000000..03d197418
--- /dev/null
+++ b/samples/browseable/Geofencing/Application/res/values-sw600dp/template-styles.xml
@@ -0,0 +1,25 @@
+<!--
+ 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.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceLarge</item>
+ <item name="android:lineSpacingMultiplier">1.2</item>
+ <item name="android:shadowDy">-6.5</item>
+ </style>
+
+</resources>
diff --git a/samples/browseable/Geofencing/Application/res/values-v11/template-styles.xml b/samples/browseable/Geofencing/Application/res/values-v11/template-styles.xml
new file mode 100644
index 000000000..8c1ea66f2
--- /dev/null
+++ b/samples/browseable/Geofencing/Application/res/values-v11/template-styles.xml
@@ -0,0 +1,22 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Holo.Light" />
+
+</resources>
diff --git a/samples/browseable/Geofencing/Application/res/values-v21/base-colors.xml b/samples/browseable/Geofencing/Application/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/Geofencing/Application/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/Geofencing/Application/res/values-v21/base-template-styles.xml b/samples/browseable/Geofencing/Application/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/Geofencing/Application/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/Geofencing/Application/res/values/base-strings.xml b/samples/browseable/Geofencing/Application/res/values/base-strings.xml
new file mode 100644
index 000000000..5a6693146
--- /dev/null
+++ b/samples/browseable/Geofencing/Application/res/values/base-strings.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<resources>
+ <string name="app_name">Geofencing</string>
+ <string name="intro_message">
+ <![CDATA[
+
+
+ When a user enters the vicinity of the Android building (B44) or the Yerba Buena
+ Gardens near the Moscone center in San Francisco, a notification silently appears on his/her
+ wearable with an option to check in. This notification automatically disappears when he/she leaves
+ the area, and reappears the next time he/she is at one of these locations.
+
+
+ ]]>
+ </string>
+</resources>
diff --git a/samples/browseable/Geofencing/Application/res/values/strings.xml b/samples/browseable/Geofencing/Application/res/values/strings.xml
new file mode 100644
index 000000000..610661e99
--- /dev/null
+++ b/samples/browseable/Geofencing/Application/res/values/strings.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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 xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="start_geofence_service">Starting geofence transition service</string>
+ <string name="entering_geofence">Entering the GeoFence zone</string>
+ <string name="exiting_geofence">Exiting the GeoFence zone</string>
+</resources>
diff --git a/samples/browseable/Geofencing/Application/res/values/template-dimens.xml b/samples/browseable/Geofencing/Application/res/values/template-dimens.xml
new file mode 100644
index 000000000..39e710b5c
--- /dev/null
+++ b/samples/browseable/Geofencing/Application/res/values/template-dimens.xml
@@ -0,0 +1,32 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Define standard dimensions to comply with Holo-style grids and rhythm. -->
+
+ <dimen name="margin_tiny">4dp</dimen>
+ <dimen name="margin_small">8dp</dimen>
+ <dimen name="margin_medium">16dp</dimen>
+ <dimen name="margin_large">32dp</dimen>
+ <dimen name="margin_huge">64dp</dimen>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_medium</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/Geofencing/Application/res/values/template-styles.xml b/samples/browseable/Geofencing/Application/res/values/template-styles.xml
new file mode 100644
index 000000000..6e7d593dd
--- /dev/null
+++ b/samples/browseable/Geofencing/Application/res/values/template-styles.xml
@@ -0,0 +1,42 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+
+ <style name="Theme.Base" parent="android:Theme.Light" />
+
+ <style name="Theme.Sample" parent="Theme.Base" />
+
+ <style name="AppTheme" parent="Theme.Sample" />
+ <!-- Widget styling -->
+
+ <style name="Widget" />
+
+ <style name="Widget.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceMedium</item>
+ <item name="android:lineSpacingMultiplier">1.1</item>
+ </style>
+
+ <style name="Widget.SampleMessageTile">
+ <item name="android:background">@drawable/tile</item>
+ <item name="android:shadowColor">#7F000000</item>
+ <item name="android:shadowDy">-3.5</item>
+ <item name="android:shadowRadius">2</item>
+ </style>
+
+</resources>
diff --git a/samples/wearable/Geofencing/Application/src/main/java/com/example/android/wearable/geofencing/Constants.java b/samples/browseable/Geofencing/Application/src/com.example.android.wearable.geofencing/Constants.java
index 6da9151dc..6da9151dc 100644
--- a/samples/wearable/Geofencing/Application/src/main/java/com/example/android/wearable/geofencing/Constants.java
+++ b/samples/browseable/Geofencing/Application/src/com.example.android.wearable.geofencing/Constants.java
diff --git a/samples/browseable/Geofencing/Application/src/com.example.android.wearable.geofencing/GeofenceTransitionsIntentService.java b/samples/browseable/Geofencing/Application/src/com.example.android.wearable.geofencing/GeofenceTransitionsIntentService.java
new file mode 100644
index 000000000..8ae0cbc1e
--- /dev/null
+++ b/samples/browseable/Geofencing/Application/src/com.example.android.wearable.geofencing/GeofenceTransitionsIntentService.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright (C) 2014 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.wearable.geofencing;
+
+import static com.example.android.wearable.geofencing.Constants.CONNECTION_TIME_OUT_MS;
+import static com.example.android.wearable.geofencing.Constants.GEOFENCE_DATA_ITEM_PATH;
+import static com.example.android.wearable.geofencing.Constants.GEOFENCE_DATA_ITEM_URI;
+import static com.example.android.wearable.geofencing.Constants.KEY_GEOFENCE_ID;
+import static com.example.android.wearable.geofencing.Constants.TAG;
+
+import android.app.IntentService;
+import android.content.Intent;
+import android.os.Bundle;
+import android.util.Log;
+import android.widget.Toast;
+
+import com.google.android.gms.common.ConnectionResult;
+import com.google.android.gms.common.api.GoogleApiClient;
+import com.google.android.gms.location.Geofence;
+import com.google.android.gms.location.GeofencingEvent;
+import com.google.android.gms.wearable.PutDataMapRequest;
+import com.google.android.gms.wearable.Wearable;
+
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Listens for geofence transition changes.
+ */
+public class GeofenceTransitionsIntentService extends IntentService
+ implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
+
+ private GoogleApiClient mGoogleApiClient;
+
+ public GeofenceTransitionsIntentService() {
+ super(GeofenceTransitionsIntentService.class.getSimpleName());
+ }
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ mGoogleApiClient = new GoogleApiClient.Builder(this)
+ .addApi(Wearable.API)
+ .addConnectionCallbacks(this)
+ .addOnConnectionFailedListener(this)
+ .build();
+ }
+
+ /**
+ * Handles incoming intents.
+ * @param intent The Intent sent by Location Services. This Intent is provided to Location
+ * Services (inside a PendingIntent) when addGeofences() is called.
+ */
+ @Override
+ protected void onHandleIntent(Intent intent) {
+ GeofencingEvent geoFenceEvent = GeofencingEvent.fromIntent(intent);
+ if (geoFenceEvent.hasError()) {
+ int errorCode = geoFenceEvent.getErrorCode();
+ Log.e(TAG, "Location Services error: " + errorCode);
+ } else {
+
+ int transitionType = geoFenceEvent.getGeofenceTransition();
+ if (Geofence.GEOFENCE_TRANSITION_ENTER == transitionType) {
+ // Connect to the Google Api service in preparation for sending a DataItem.
+ mGoogleApiClient.blockingConnect(CONNECTION_TIME_OUT_MS, TimeUnit.MILLISECONDS);
+ // Get the geofence id triggered. Note that only one geofence can be triggered at a
+ // time in this example, but in some cases you might want to consider the full list
+ // of geofences triggered.
+ String triggeredGeoFenceId = geoFenceEvent.getTriggeringGeofences().get(0)
+ .getRequestId();
+ // Create a DataItem with this geofence's id. The wearable can use this to create
+ // a notification.
+ final PutDataMapRequest putDataMapRequest =
+ PutDataMapRequest.create(GEOFENCE_DATA_ITEM_PATH);
+ putDataMapRequest.getDataMap().putString(KEY_GEOFENCE_ID, triggeredGeoFenceId);
+ if (mGoogleApiClient.isConnected()) {
+ Wearable.DataApi.putDataItem(
+ mGoogleApiClient, putDataMapRequest.asPutDataRequest()).await();
+ } else {
+ Log.e(TAG, "Failed to send data item: " + putDataMapRequest
+ + " - Client disconnected from Google Play Services");
+ }
+ Toast.makeText(this, getString(R.string.entering_geofence),
+ Toast.LENGTH_SHORT).show();
+ mGoogleApiClient.disconnect();
+ } else if (Geofence.GEOFENCE_TRANSITION_EXIT == transitionType) {
+ // Delete the data item when leaving a geofence region.
+ mGoogleApiClient.blockingConnect(CONNECTION_TIME_OUT_MS, TimeUnit.MILLISECONDS);
+ Wearable.DataApi.deleteDataItems(mGoogleApiClient, GEOFENCE_DATA_ITEM_URI).await();
+ Toast.makeText(this, getString(R.string.exiting_geofence),
+ Toast.LENGTH_SHORT).show();
+ mGoogleApiClient.disconnect();
+ }
+ }
+ }
+
+ @Override
+ public void onConnected(Bundle connectionHint) {
+ }
+
+ @Override
+ public void onConnectionSuspended(int cause) {
+ }
+
+ @Override
+ public void onConnectionFailed(ConnectionResult result) {
+ }
+
+}
diff --git a/samples/browseable/Geofencing/Application/src/com.example.android.wearable.geofencing/MainActivity.java b/samples/browseable/Geofencing/Application/src/com.example.android.wearable.geofencing/MainActivity.java
new file mode 100644
index 000000000..350c9c53d
--- /dev/null
+++ b/samples/browseable/Geofencing/Application/src/com.example.android.wearable.geofencing/MainActivity.java
@@ -0,0 +1,198 @@
+/*
+ * Copyright (C) 2014 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.wearable.geofencing;
+
+import static com.example.android.wearable.geofencing.Constants.ANDROID_BUILDING_ID;
+import static com.example.android.wearable.geofencing.Constants.ANDROID_BUILDING_LATITUDE;
+import static com.example.android.wearable.geofencing.Constants.ANDROID_BUILDING_LONGITUDE;
+import static com.example.android.wearable.geofencing.Constants.ANDROID_BUILDING_RADIUS_METERS;
+import static com.example.android.wearable.geofencing.Constants.CONNECTION_FAILURE_RESOLUTION_REQUEST;
+import static com.example.android.wearable.geofencing.Constants.GEOFENCE_EXPIRATION_TIME;
+import static com.example.android.wearable.geofencing.Constants.TAG;
+import static com.example.android.wearable.geofencing.Constants.YERBA_BUENA_ID;
+import static com.example.android.wearable.geofencing.Constants.YERBA_BUENA_LATITUDE;
+import static com.example.android.wearable.geofencing.Constants.YERBA_BUENA_LONGITUDE;
+import static com.example.android.wearable.geofencing.Constants.YERBA_BUENA_RADIUS_METERS;
+
+import android.app.Activity;
+import android.app.PendingIntent;
+import android.content.Intent;
+import android.content.IntentSender;
+import android.os.Bundle;
+import android.util.Log;
+import android.widget.Toast;
+
+import com.google.android.gms.common.ConnectionResult;
+import com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks;
+import com.google.android.gms.common.GooglePlayServicesUtil;
+import com.google.android.gms.common.api.GoogleApiClient;
+import com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener;
+import com.google.android.gms.location.Geofence;
+import com.google.android.gms.location.LocationServices;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class MainActivity extends Activity implements ConnectionCallbacks,
+ OnConnectionFailedListener, GoogleApiClient.ConnectionCallbacks {
+
+ // Internal List of Geofence objects. In a real app, these might be provided by an API based on
+ // locations within the user's proximity.
+ List<Geofence> mGeofenceList;
+
+ // These will store hard-coded geofences in this sample app.
+ private SimpleGeofence mAndroidBuildingGeofence;
+ private SimpleGeofence mYerbaBuenaGeofence;
+
+ // Persistent storage for geofences.
+ private SimpleGeofenceStore mGeofenceStorage;
+
+ private LocationServices mLocationService;
+ // Stores the PendingIntent used to request geofence monitoring.
+ private PendingIntent mGeofenceRequestIntent;
+ private GoogleApiClient mApiClient;
+
+ // Defines the allowable request types (in this example, we only add geofences).
+ private enum REQUEST_TYPE {ADD}
+ private REQUEST_TYPE mRequestType;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ // Rather than displayng this activity, simply display a toast indicating that the geofence
+ // service is being created. This should happen in less than a second.
+ if (!isGooglePlayServicesAvailable()) {
+ Log.e(TAG, "Google Play services unavailable.");
+ finish();
+ return;
+ }
+
+ mApiClient = new GoogleApiClient.Builder(this)
+ .addApi(LocationServices.API)
+ .addConnectionCallbacks(this)
+ .addOnConnectionFailedListener(this)
+ .build();
+
+ mApiClient.connect();
+
+ // Instantiate a new geofence storage area.
+ mGeofenceStorage = new SimpleGeofenceStore(this);
+ // Instantiate the current List of geofences.
+ mGeofenceList = new ArrayList<Geofence>();
+ createGeofences();
+ }
+
+ /**
+ * In this sample, the geofences are predetermined and are hard-coded here. A real app might
+ * dynamically create geofences based on the user's location.
+ */
+ public void createGeofences() {
+ // Create internal "flattened" objects containing the geofence data.
+ mAndroidBuildingGeofence = new SimpleGeofence(
+ ANDROID_BUILDING_ID, // geofenceId.
+ ANDROID_BUILDING_LATITUDE,
+ ANDROID_BUILDING_LONGITUDE,
+ ANDROID_BUILDING_RADIUS_METERS,
+ GEOFENCE_EXPIRATION_TIME,
+ Geofence.GEOFENCE_TRANSITION_ENTER | Geofence.GEOFENCE_TRANSITION_EXIT
+ );
+ mYerbaBuenaGeofence = new SimpleGeofence(
+ YERBA_BUENA_ID, // geofenceId.
+ YERBA_BUENA_LATITUDE,
+ YERBA_BUENA_LONGITUDE,
+ YERBA_BUENA_RADIUS_METERS,
+ GEOFENCE_EXPIRATION_TIME,
+ Geofence.GEOFENCE_TRANSITION_ENTER | Geofence.GEOFENCE_TRANSITION_EXIT
+ );
+
+ // Store these flat versions in SharedPreferences and add them to the geofence list.
+ mGeofenceStorage.setGeofence(ANDROID_BUILDING_ID, mAndroidBuildingGeofence);
+ mGeofenceStorage.setGeofence(YERBA_BUENA_ID, mYerbaBuenaGeofence);
+ mGeofenceList.add(mAndroidBuildingGeofence.toGeofence());
+ mGeofenceList.add(mYerbaBuenaGeofence.toGeofence());
+ }
+
+
+ @Override
+ public void onConnectionFailed(ConnectionResult connectionResult) {
+ // If the error has a resolution, start a Google Play services activity to resolve it.
+ if (connectionResult.hasResolution()) {
+ try {
+ connectionResult.startResolutionForResult(this,
+ CONNECTION_FAILURE_RESOLUTION_REQUEST);
+ } catch (IntentSender.SendIntentException e) {
+ Log.e(TAG, "Exception while resolving connection error.", e);
+ }
+ } else {
+ int errorCode = connectionResult.getErrorCode();
+ Log.e(TAG, "Connection to Google Play services failed with error code " + errorCode);
+ }
+ }
+
+ @Override
+ public void onDisconnected() {
+ }
+
+ /**
+ * Once the connection is available, send a request to add the Geofences.
+ */
+ @Override
+ public void onConnected(Bundle connectionHint) {
+ // Get the PendingIntent for the geofence monitoring request.
+ // Send a request to add the current geofences.
+ mGeofenceRequestIntent = getGeofenceTransitionPendingIntent();
+ LocationServices.GeofencingApi.addGeofences(mApiClient, mGeofenceList,
+ mGeofenceRequestIntent);
+ Toast.makeText(this, getString(R.string.start_geofence_service), Toast.LENGTH_SHORT).show();
+ finish();
+ }
+
+ @Override
+ public void onConnectionSuspended(int i) {
+ if (null != mGeofenceRequestIntent) {
+ LocationServices.GeofencingApi.removeGeofences(mApiClient, mGeofenceRequestIntent);
+ }
+ }
+
+
+ /**
+ * Checks if Google Play services is available.
+ * @return true if it is.
+ */
+ private boolean isGooglePlayServicesAvailable() {
+ int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
+ if (ConnectionResult.SUCCESS == resultCode) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "Google Play services is available.");
+ }
+ return true;
+ } else {
+ Log.e(TAG, "Google Play services is unavailable.");
+ return false;
+ }
+ }
+
+ /**
+ * Create a PendingIntent that triggers GeofenceTransitionIntentService when a geofence
+ * transition occurs.
+ */
+ private PendingIntent getGeofenceTransitionPendingIntent() {
+ Intent intent = new Intent(this, GeofenceTransitionsIntentService.class);
+ return PendingIntent.getService(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
+ }
+
+}
diff --git a/samples/wearable/Geofencing/Application/src/main/java/com/example/android/wearable/geofencing/SimpleGeofence.java b/samples/browseable/Geofencing/Application/src/com.example.android.wearable.geofencing/SimpleGeofence.java
index 50f02c371..50f02c371 100644
--- a/samples/wearable/Geofencing/Application/src/main/java/com/example/android/wearable/geofencing/SimpleGeofence.java
+++ b/samples/browseable/Geofencing/Application/src/com.example.android.wearable.geofencing/SimpleGeofence.java
diff --git a/samples/wearable/Geofencing/Application/src/main/java/com/example/android/wearable/geofencing/SimpleGeofenceStore.java b/samples/browseable/Geofencing/Application/src/com.example.android.wearable.geofencing/SimpleGeofenceStore.java
index 47584f5a3..47584f5a3 100644
--- a/samples/wearable/Geofencing/Application/src/main/java/com/example/android/wearable/geofencing/SimpleGeofenceStore.java
+++ b/samples/browseable/Geofencing/Application/src/com.example.android.wearable.geofencing/SimpleGeofenceStore.java
diff --git a/samples/browseable/Geofencing/Wearable/AndroidManifest.xml b/samples/browseable/Geofencing/Wearable/AndroidManifest.xml
new file mode 100644
index 000000000..082f396b6
--- /dev/null
+++ b/samples/browseable/Geofencing/Wearable/AndroidManifest.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.wearable.geofencing" >
+
+ <uses-sdk android:minSdkVersion="20"
+ android:targetSdkVersion="21" />
+
+ <uses-feature android:name="android.hardware.type.watch" />
+
+ <application
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:allowBackup="true">
+
+ <meta-data
+ android:name="com.google.android.gms.version"
+ android:value="@integer/google_play_services_version" />
+
+ <service
+ android:name="com.example.android.wearable.geofencing.HomeListenerService" >
+ <intent-filter>
+ <action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
+ </intent-filter>
+ </service>
+ <service android:name=".CheckInAndDeleteDataItemsService"/>
+
+ <activity android:name="android.support.wearable.activity.ConfirmationActivity"/>
+ </application>
+</manifest>
diff --git a/samples/wearable/Geofencing/Wearable/src/main/res/drawable-hdpi/ic_action_check_in.png b/samples/browseable/Geofencing/Wearable/res/drawable-hdpi/ic_action_check_in.png
index f94a1c4c9..f94a1c4c9 100644
--- a/samples/wearable/Geofencing/Wearable/src/main/res/drawable-hdpi/ic_action_check_in.png
+++ b/samples/browseable/Geofencing/Wearable/res/drawable-hdpi/ic_action_check_in.png
Binary files differ
diff --git a/samples/wearable/Geofencing/Wearable/src/main/res/drawable-hdpi/ic_launcher.png b/samples/browseable/Geofencing/Wearable/res/drawable-hdpi/ic_launcher.png
index 4e3e000b0..4e3e000b0 100644
--- a/samples/wearable/Geofencing/Wearable/src/main/res/drawable-hdpi/ic_launcher.png
+++ b/samples/browseable/Geofencing/Wearable/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/Geofencing/Wearable/src/main/res/drawable-mdpi/ic_launcher.png b/samples/browseable/Geofencing/Wearable/res/drawable-mdpi/ic_launcher.png
index b405cb2e8..b405cb2e8 100644
--- a/samples/wearable/Geofencing/Wearable/src/main/res/drawable-mdpi/ic_launcher.png
+++ b/samples/browseable/Geofencing/Wearable/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/Geofencing/Wearable/src/main/res/drawable-nodpi/android_building.png b/samples/browseable/Geofencing/Wearable/res/drawable-nodpi/android_building.png
index 2a28bd425..2a28bd425 100644
--- a/samples/wearable/Geofencing/Wearable/src/main/res/drawable-nodpi/android_building.png
+++ b/samples/browseable/Geofencing/Wearable/res/drawable-nodpi/android_building.png
Binary files differ
diff --git a/samples/wearable/Geofencing/Wearable/src/main/res/drawable-nodpi/yerba_buena.png b/samples/browseable/Geofencing/Wearable/res/drawable-nodpi/yerba_buena.png
index 04f39f87f..04f39f87f 100644
--- a/samples/wearable/Geofencing/Wearable/src/main/res/drawable-nodpi/yerba_buena.png
+++ b/samples/browseable/Geofencing/Wearable/res/drawable-nodpi/yerba_buena.png
Binary files differ
diff --git a/samples/wearable/Geofencing/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/Geofencing/Wearable/res/drawable-xhdpi/ic_launcher.png
index 61f9d889c..61f9d889c 100644
--- a/samples/wearable/Geofencing/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png
+++ b/samples/browseable/Geofencing/Wearable/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/Geofencing/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/Geofencing/Wearable/res/drawable-xxhdpi/ic_launcher.png
index 81c10085a..81c10085a 100644
--- a/samples/wearable/Geofencing/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png
+++ b/samples/browseable/Geofencing/Wearable/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/Geofencing/Wearable/src/main/res/values/strings.xml b/samples/browseable/Geofencing/Wearable/res/values/strings.xml
index 49fb2b324..49fb2b324 100644
--- a/samples/wearable/Geofencing/Wearable/src/main/res/values/strings.xml
+++ b/samples/browseable/Geofencing/Wearable/res/values/strings.xml
diff --git a/samples/wearable/Geofencing/Wearable/src/main/java/com/example/android/wearable/geofencing/CheckInAndDeleteDataItemsService.java b/samples/browseable/Geofencing/Wearable/src/com.example.android.wearable.geofencing/CheckInAndDeleteDataItemsService.java
index 7b8ba1150..7b8ba1150 100644
--- a/samples/wearable/Geofencing/Wearable/src/main/java/com/example/android/wearable/geofencing/CheckInAndDeleteDataItemsService.java
+++ b/samples/browseable/Geofencing/Wearable/src/com.example.android.wearable.geofencing/CheckInAndDeleteDataItemsService.java
diff --git a/samples/wearable/Geofencing/Wearable/src/main/java/com/example/android/wearable/geofencing/Constants.java b/samples/browseable/Geofencing/Wearable/src/com.example.android.wearable.geofencing/Constants.java
index ef6e8c6ed..ef6e8c6ed 100644
--- a/samples/wearable/Geofencing/Wearable/src/main/java/com/example/android/wearable/geofencing/Constants.java
+++ b/samples/browseable/Geofencing/Wearable/src/com.example.android.wearable.geofencing/Constants.java
diff --git a/samples/wearable/Geofencing/Wearable/src/main/java/com/example/android/wearable/geofencing/HomeListenerService.java b/samples/browseable/Geofencing/Wearable/src/com.example.android.wearable.geofencing/HomeListenerService.java
index 415fc46aa..415fc46aa 100644
--- a/samples/wearable/Geofencing/Wearable/src/main/java/com/example/android/wearable/geofencing/HomeListenerService.java
+++ b/samples/browseable/Geofencing/Wearable/src/com.example.android.wearable.geofencing/HomeListenerService.java
diff --git a/samples/browseable/Geofencing/_index.jd b/samples/browseable/Geofencing/_index.jd
new file mode 100644
index 000000000..497a5b11f
--- /dev/null
+++ b/samples/browseable/Geofencing/_index.jd
@@ -0,0 +1,12 @@
+page.tags="Geofencing"
+sample.group=Wearable
+@jd:body
+
+<p>
+
+ When a user enters the vicinity of the Android building (B44) or the Yerba Buena
+ Gardens near the Moscone center in San Francisco, a notification silently appears on his/her
+ wearable with an option to check in. This notification automatically disappears when he/she leaves
+ the area, and reappears the next time he/she is at one of these locations.
+
+ </p>
diff --git a/samples/browseable/GridViewPager/Application/AndroidManifest.xml b/samples/browseable/GridViewPager/Application/AndroidManifest.xml
new file mode 100644
index 000000000..b6092c545
--- /dev/null
+++ b/samples/browseable/GridViewPager/Application/AndroidManifest.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.wearable.gridviewpager">
+
+ <uses-sdk android:minSdkVersion="18"
+ android:targetSdkVersion="21" />
+
+ <application android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name">
+ </application>
+
+</manifest>
+
diff --git a/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/drawable-hdpi/ic_launcher.png b/samples/browseable/GridViewPager/Application/res/drawable-hdpi/ic_launcher.png
index 589f229d1..589f229d1 100755
--- a/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/drawable-hdpi/ic_launcher.png
+++ b/samples/browseable/GridViewPager/Application/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/GridViewPager/Application/res/drawable-hdpi/tile.9.png b/samples/browseable/GridViewPager/Application/res/drawable-hdpi/tile.9.png
new file mode 100644
index 000000000..135862883
--- /dev/null
+++ b/samples/browseable/GridViewPager/Application/res/drawable-hdpi/tile.9.png
Binary files differ
diff --git a/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/drawable-mdpi/ic_launcher.png b/samples/browseable/GridViewPager/Application/res/drawable-mdpi/ic_launcher.png
index 77dd57139..77dd57139 100755
--- a/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/drawable-mdpi/ic_launcher.png
+++ b/samples/browseable/GridViewPager/Application/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/GridViewPager/Application/res/drawable-xhdpi/ic_launcher.png
index fe34ebe13..fe34ebe13 100755
--- a/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png
+++ b/samples/browseable/GridViewPager/Application/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/GridViewPager/Application/res/drawable-xxhdpi/ic_launcher.png
index ab80bcd13..ab80bcd13 100755
--- a/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png
+++ b/samples/browseable/GridViewPager/Application/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/GridViewPager/Application/res/layout/activity_main.xml b/samples/browseable/GridViewPager/Application/res/layout/activity_main.xml
new file mode 100755
index 000000000..be1aa49d9
--- /dev/null
+++ b/samples/browseable/GridViewPager/Application/res/layout/activity_main.xml
@@ -0,0 +1,36 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <LinearLayout style="@style/Widget.SampleMessageTile"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView style="@style/Widget.SampleMessage"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="@dimen/horizontal_page_margin"
+ android:layout_marginRight="@dimen/horizontal_page_margin"
+ android:layout_marginTop="@dimen/vertical_page_margin"
+ android:layout_marginBottom="@dimen/vertical_page_margin"
+ android:text="@string/intro_message" />
+ </LinearLayout>
+</LinearLayout>
diff --git a/samples/browseable/GridViewPager/Application/res/values-sw600dp/template-dimens.xml b/samples/browseable/GridViewPager/Application/res/values-sw600dp/template-dimens.xml
new file mode 100644
index 000000000..22074a2bd
--- /dev/null
+++ b/samples/browseable/GridViewPager/Application/res/values-sw600dp/template-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>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_huge</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/GridViewPager/Application/res/values-sw600dp/template-styles.xml b/samples/browseable/GridViewPager/Application/res/values-sw600dp/template-styles.xml
new file mode 100644
index 000000000..03d197418
--- /dev/null
+++ b/samples/browseable/GridViewPager/Application/res/values-sw600dp/template-styles.xml
@@ -0,0 +1,25 @@
+<!--
+ 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.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceLarge</item>
+ <item name="android:lineSpacingMultiplier">1.2</item>
+ <item name="android:shadowDy">-6.5</item>
+ </style>
+
+</resources>
diff --git a/samples/browseable/GridViewPager/Application/res/values-v11/template-styles.xml b/samples/browseable/GridViewPager/Application/res/values-v11/template-styles.xml
new file mode 100644
index 000000000..8c1ea66f2
--- /dev/null
+++ b/samples/browseable/GridViewPager/Application/res/values-v11/template-styles.xml
@@ -0,0 +1,22 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Holo.Light" />
+
+</resources>
diff --git a/samples/browseable/GridViewPager/Application/res/values-v21/base-colors.xml b/samples/browseable/GridViewPager/Application/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/GridViewPager/Application/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/GridViewPager/Application/res/values-v21/base-template-styles.xml b/samples/browseable/GridViewPager/Application/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/GridViewPager/Application/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/GridViewPager/Application/res/values/base-strings.xml b/samples/browseable/GridViewPager/Application/res/values/base-strings.xml
new file mode 100644
index 000000000..c5f91223c
--- /dev/null
+++ b/samples/browseable/GridViewPager/Application/res/values/base-strings.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>
+ <string name="app_name">GridViewPager</string>
+ <string name="intro_message">
+ <![CDATA[
+
+
+ Demonstrates how to implement a GridViewPager in your wearable app.
+
+
+ ]]>
+ </string>
+</resources>
diff --git a/samples/browseable/GridViewPager/Application/res/values/template-dimens.xml b/samples/browseable/GridViewPager/Application/res/values/template-dimens.xml
new file mode 100644
index 000000000..39e710b5c
--- /dev/null
+++ b/samples/browseable/GridViewPager/Application/res/values/template-dimens.xml
@@ -0,0 +1,32 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Define standard dimensions to comply with Holo-style grids and rhythm. -->
+
+ <dimen name="margin_tiny">4dp</dimen>
+ <dimen name="margin_small">8dp</dimen>
+ <dimen name="margin_medium">16dp</dimen>
+ <dimen name="margin_large">32dp</dimen>
+ <dimen name="margin_huge">64dp</dimen>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_medium</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/GridViewPager/Application/res/values/template-styles.xml b/samples/browseable/GridViewPager/Application/res/values/template-styles.xml
new file mode 100644
index 000000000..6e7d593dd
--- /dev/null
+++ b/samples/browseable/GridViewPager/Application/res/values/template-styles.xml
@@ -0,0 +1,42 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+
+ <style name="Theme.Base" parent="android:Theme.Light" />
+
+ <style name="Theme.Sample" parent="Theme.Base" />
+
+ <style name="AppTheme" parent="Theme.Sample" />
+ <!-- Widget styling -->
+
+ <style name="Widget" />
+
+ <style name="Widget.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceMedium</item>
+ <item name="android:lineSpacingMultiplier">1.1</item>
+ </style>
+
+ <style name="Widget.SampleMessageTile">
+ <item name="android:background">@drawable/tile</item>
+ <item name="android:shadowColor">#7F000000</item>
+ <item name="android:shadowDy">-3.5</item>
+ <item name="android:shadowRadius">2</item>
+ </style>
+
+</resources>
diff --git a/samples/browseable/GridViewPager/Wearable/AndroidManifest.xml b/samples/browseable/GridViewPager/Wearable/AndroidManifest.xml
new file mode 100644
index 000000000..5c362dcb5
--- /dev/null
+++ b/samples/browseable/GridViewPager/Wearable/AndroidManifest.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.wearable.gridviewpager" >
+
+ <uses-sdk android:minSdkVersion="20"
+ android:targetSdkVersion="21" />
+
+ <uses-feature android:name="android.hardware.type.watch" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@android:style/Theme.DeviceDefault.Light" >
+ <activity
+ android:name="com.example.android.wearable.gridviewpager.MainActivity"
+ android:label="@string/app_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest>
diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-hdpi/bugdroid.png b/samples/browseable/GridViewPager/Wearable/res/drawable-hdpi/bugdroid.png
index 7cbe66153..7cbe66153 100644
--- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-hdpi/bugdroid.png
+++ b/samples/browseable/GridViewPager/Wearable/res/drawable-hdpi/bugdroid.png
Binary files differ
diff --git a/samples/wearable/WatchViewStub/Wearable/src/main/res/drawable-hdpi/ic_launcher.png b/samples/browseable/GridViewPager/Wearable/res/drawable-hdpi/ic_launcher.png
index 589f229d1..589f229d1 100755..100644
--- a/samples/wearable/WatchViewStub/Wearable/src/main/res/drawable-hdpi/ic_launcher.png
+++ b/samples/browseable/GridViewPager/Wearable/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-hdpi/ic_swipe_arrow_left.png b/samples/browseable/GridViewPager/Wearable/res/drawable-hdpi/ic_swipe_arrow_left.png
index 88a497f81..88a497f81 100644
--- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-hdpi/ic_swipe_arrow_left.png
+++ b/samples/browseable/GridViewPager/Wearable/res/drawable-hdpi/ic_swipe_arrow_left.png
Binary files differ
diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-hdpi/ic_swipe_arrow_right.png b/samples/browseable/GridViewPager/Wearable/res/drawable-hdpi/ic_swipe_arrow_right.png
index 5bf0e477e..5bf0e477e 100644
--- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-hdpi/ic_swipe_arrow_right.png
+++ b/samples/browseable/GridViewPager/Wearable/res/drawable-hdpi/ic_swipe_arrow_right.png
Binary files differ
diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-hdpi/ic_swipe_arrow_up.png b/samples/browseable/GridViewPager/Wearable/res/drawable-hdpi/ic_swipe_arrow_up.png
index 9a3256a67..9a3256a67 100644
--- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-hdpi/ic_swipe_arrow_up.png
+++ b/samples/browseable/GridViewPager/Wearable/res/drawable-hdpi/ic_swipe_arrow_up.png
Binary files differ
diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-mdpi/bugdroid.png b/samples/browseable/GridViewPager/Wearable/res/drawable-mdpi/bugdroid.png
index 8bf759608..8bf759608 100644
--- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-mdpi/bugdroid.png
+++ b/samples/browseable/GridViewPager/Wearable/res/drawable-mdpi/bugdroid.png
Binary files differ
diff --git a/samples/wearable/WatchViewStub/Wearable/src/main/res/drawable-mdpi/ic_launcher.png b/samples/browseable/GridViewPager/Wearable/res/drawable-mdpi/ic_launcher.png
index 77dd57139..77dd57139 100755..100644
--- a/samples/wearable/WatchViewStub/Wearable/src/main/res/drawable-mdpi/ic_launcher.png
+++ b/samples/browseable/GridViewPager/Wearable/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-mdpi/ic_swipe_arrow_left.png b/samples/browseable/GridViewPager/Wearable/res/drawable-mdpi/ic_swipe_arrow_left.png
index ba36d9dea..ba36d9dea 100644
--- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-mdpi/ic_swipe_arrow_left.png
+++ b/samples/browseable/GridViewPager/Wearable/res/drawable-mdpi/ic_swipe_arrow_left.png
Binary files differ
diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-mdpi/ic_swipe_arrow_right.png b/samples/browseable/GridViewPager/Wearable/res/drawable-mdpi/ic_swipe_arrow_right.png
index e5930ac8c..e5930ac8c 100644
--- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-mdpi/ic_swipe_arrow_right.png
+++ b/samples/browseable/GridViewPager/Wearable/res/drawable-mdpi/ic_swipe_arrow_right.png
Binary files differ
diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-mdpi/ic_swipe_arrow_up.png b/samples/browseable/GridViewPager/Wearable/res/drawable-mdpi/ic_swipe_arrow_up.png
index 5ded1c36b..5ded1c36b 100644
--- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-mdpi/ic_swipe_arrow_up.png
+++ b/samples/browseable/GridViewPager/Wearable/res/drawable-mdpi/ic_swipe_arrow_up.png
Binary files differ
diff --git a/samples/browseable/GridViewPager/Wearable/res/drawable-nodpi/bugdroid_large.png b/samples/browseable/GridViewPager/Wearable/res/drawable-nodpi/bugdroid_large.png
new file mode 100644
index 000000000..7b393b21d
--- /dev/null
+++ b/samples/browseable/GridViewPager/Wearable/res/drawable-nodpi/bugdroid_large.png
Binary files differ
diff --git a/samples/wearable/WatchViewStub/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/GridViewPager/Wearable/res/drawable-xhdpi/ic_launcher.png
index fe34ebe13..fe34ebe13 100755..100644
--- a/samples/wearable/WatchViewStub/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png
+++ b/samples/browseable/GridViewPager/Wearable/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-xhdpi/ic_swipe_arrow_left.png b/samples/browseable/GridViewPager/Wearable/res/drawable-xhdpi/ic_swipe_arrow_left.png
index f02901b6d..f02901b6d 100644
--- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-xhdpi/ic_swipe_arrow_left.png
+++ b/samples/browseable/GridViewPager/Wearable/res/drawable-xhdpi/ic_swipe_arrow_left.png
Binary files differ
diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-xhdpi/ic_swipe_arrow_right.png b/samples/browseable/GridViewPager/Wearable/res/drawable-xhdpi/ic_swipe_arrow_right.png
index 154a87e0b..154a87e0b 100644
--- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-xhdpi/ic_swipe_arrow_right.png
+++ b/samples/browseable/GridViewPager/Wearable/res/drawable-xhdpi/ic_swipe_arrow_right.png
Binary files differ
diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-xhdpi/ic_swipe_arrow_up.png b/samples/browseable/GridViewPager/Wearable/res/drawable-xhdpi/ic_swipe_arrow_up.png
index e99d98273..e99d98273 100644
--- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-xhdpi/ic_swipe_arrow_up.png
+++ b/samples/browseable/GridViewPager/Wearable/res/drawable-xhdpi/ic_swipe_arrow_up.png
Binary files differ
diff --git a/samples/wearable/WatchViewStub/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/GridViewPager/Wearable/res/drawable-xxhdpi/ic_launcher.png
index ab80bcd13..ab80bcd13 100755
--- a/samples/wearable/WatchViewStub/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png
+++ b/samples/browseable/GridViewPager/Wearable/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable/debug_background_1.png b/samples/browseable/GridViewPager/Wearable/res/drawable/debug_background_1.png
index 7e6437bb4..7e6437bb4 100644
--- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable/debug_background_1.png
+++ b/samples/browseable/GridViewPager/Wearable/res/drawable/debug_background_1.png
Binary files differ
diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable/debug_background_2.png b/samples/browseable/GridViewPager/Wearable/res/drawable/debug_background_2.png
index 4fdc5c9a0..4fdc5c9a0 100644
--- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable/debug_background_2.png
+++ b/samples/browseable/GridViewPager/Wearable/res/drawable/debug_background_2.png
Binary files differ
diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable/debug_background_3.png b/samples/browseable/GridViewPager/Wearable/res/drawable/debug_background_3.png
index 20faf46a9..20faf46a9 100644
--- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable/debug_background_3.png
+++ b/samples/browseable/GridViewPager/Wearable/res/drawable/debug_background_3.png
Binary files differ
diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable/debug_background_4.png b/samples/browseable/GridViewPager/Wearable/res/drawable/debug_background_4.png
index 1fd25c68d..1fd25c68d 100644
--- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable/debug_background_4.png
+++ b/samples/browseable/GridViewPager/Wearable/res/drawable/debug_background_4.png
Binary files differ
diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable/debug_background_5.png b/samples/browseable/GridViewPager/Wearable/res/drawable/debug_background_5.png
index eecdb2cd7..eecdb2cd7 100644
--- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable/debug_background_5.png
+++ b/samples/browseable/GridViewPager/Wearable/res/drawable/debug_background_5.png
Binary files differ
diff --git a/samples/browseable/GridViewPager/Wearable/res/drawable/gradient.xml b/samples/browseable/GridViewPager/Wearable/res/drawable/gradient.xml
new file mode 100644
index 000000000..70770436e
--- /dev/null
+++ b/samples/browseable/GridViewPager/Wearable/res/drawable/gradient.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle" >
+
+ <gradient
+ android:angle="45"
+ android:endColor="#87CEEB"
+ android:centerColor="#768087"
+ android:startColor="#000"
+ android:type="linear" />
+
+</shape>
diff --git a/samples/browseable/GridViewPager/Wearable/res/drawable/shape.xml b/samples/browseable/GridViewPager/Wearable/res/drawable/shape.xml
new file mode 100644
index 000000000..a6306c726
--- /dev/null
+++ b/samples/browseable/GridViewPager/Wearable/res/drawable/shape.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle" >
+
+ <stroke
+ android:dashGap="4dp"
+ android:dashWidth="10dp"
+ android:width="6dp"
+ android:color="@color/black" />
+
+ <solid android:color="@color/white" />
+
+ <padding
+ android:bottom="20dp"
+ android:left="20dp"
+ android:right="20dp"
+ android:top="20dp" />
+
+</shape>
diff --git a/samples/browseable/GridViewPager/Wearable/res/layout/activity_main.xml b/samples/browseable/GridViewPager/Wearable/res/layout/activity_main.xml
new file mode 100644
index 000000000..8c077aba2
--- /dev/null
+++ b/samples/browseable/GridViewPager/Wearable/res/layout/activity_main.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" >
+
+ <android.support.wearable.view.GridViewPager
+ android:id="@+id/pager"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:keepScreenOn="true" />
+
+ <android.support.wearable.view.DotsPageIndicator
+ android:id="@+id/page_indicator"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal|bottom">
+ </android.support.wearable.view.DotsPageIndicator>
+
+</FrameLayout> \ No newline at end of file
diff --git a/samples/browseable/GridViewPager/Wearable/res/layout/custom_fragment.xml b/samples/browseable/GridViewPager/Wearable/res/layout/custom_fragment.xml
new file mode 100644
index 000000000..13b02f20d
--- /dev/null
+++ b/samples/browseable/GridViewPager/Wearable/res/layout/custom_fragment.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@drawable/gradient" >
+
+ <TextView
+ android:id="@+id/text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:layout_margin="8dp"
+ android:background="@drawable/shape"
+ android:text="@string/custom_fragment_text"
+ android:textColor="@color/primary_text_light"/>
+
+</FrameLayout>
diff --git a/samples/browseable/GridViewPager/Wearable/res/values/dimens.xml b/samples/browseable/GridViewPager/Wearable/res/values/dimens.xml
new file mode 100644
index 000000000..dd6ad2d02
--- /dev/null
+++ b/samples/browseable/GridViewPager/Wearable/res/values/dimens.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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>
+ <dimen name="page_row_margin">100dp</dimen>
+ <dimen name="page_column_margin">10dp</dimen>
+ <dimen name="page_column_margin_round">50dp</dimen>
+ <dimen name="card_margin_bottom">3dp</dimen>
+</resources>
diff --git a/samples/browseable/GridViewPager/Wearable/res/values/strings.xml b/samples/browseable/GridViewPager/Wearable/res/values/strings.xml
new file mode 100644
index 000000000..ab4e663b1
--- /dev/null
+++ b/samples/browseable/GridViewPager/Wearable/res/values/strings.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+
+ <string name="app_name">GridViewPager Sample</string>
+ <string name="welcome_title">GridViewPager</string>
+ <string name="welcome_text">Sample App</string>
+
+ <string name="about_title">About</string>
+ <string name="about_text">Content is organized into multiple pages. Swipe between cards to view other content.</string>
+
+ <string name="cards_title">Cards</string>
+ <string name="cards_text">Each page is created using a CardFragment. A layout is placed inside the card and the rest is handled automatically.</string>
+
+ <string name="expansion_title">Expansion</string>
+ <string name="expansion_text">By default, each card will grow taller to accommodate extra content. Tall cards can be scrolled through like any scrollable view. The maximum height is controlled by setExpansionFactor() with a default of 10 pages. After that you\'ll notice a faded edge to indicate there is more. Expansion can be disabled completely using setExpansionEnabled(false). With this, the content will be clipped if it\'s taller than one page.</string>
+
+ <string name="backgrounds_title">Backgrounds</string>
+ <string name="backgrounds_text">Backgrounds are supplied by the adapter\'s getBackground method. Parallax and crossfade effects are applied automatically.</string>
+
+ <string name="columns_title">Columns</string>
+ <string name="columns_text">When moving between rows, the pager always returns to column 0. This is adjustable in the adapter. See method getCurrentColumnForRow().</string>
+
+ <string name="dismiss_title">Dismiss</string>
+ <string name="dismiss_text">To exit the application, swipe from left to right.</string>
+ <string name="custom_fragment_text">"GridViewPager will accept any fragment. This is an example of a custom fragment with it's own background."</string>
+
+</resources>
diff --git a/samples/browseable/GridViewPager/Wearable/src/com.example.android.wearable.gridviewpager/CustomFragment.java b/samples/browseable/GridViewPager/Wearable/src/com.example.android.wearable.gridviewpager/CustomFragment.java
new file mode 100644
index 000000000..aff3665c3
--- /dev/null
+++ b/samples/browseable/GridViewPager/Wearable/src/com.example.android.wearable.gridviewpager/CustomFragment.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2014 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.wearable.gridviewpager;
+
+import android.app.Fragment;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+public class CustomFragment extends Fragment {
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.custom_fragment, container, false);
+ }
+}
diff --git a/samples/browseable/GridViewPager/Wearable/src/com.example.android.wearable.gridviewpager/MainActivity.java b/samples/browseable/GridViewPager/Wearable/src/com.example.android.wearable.gridviewpager/MainActivity.java
new file mode 100644
index 000000000..6abb58bf6
--- /dev/null
+++ b/samples/browseable/GridViewPager/Wearable/src/com.example.android.wearable.gridviewpager/MainActivity.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2014 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.wearable.gridviewpager;
+
+import android.app.Activity;
+import android.content.res.Resources;
+import android.os.Bundle;
+import android.support.wearable.view.DotsPageIndicator;
+import android.support.wearable.view.GridViewPager;
+import android.view.View;
+import android.view.View.OnApplyWindowInsetsListener;
+import android.view.WindowInsets;
+
+public class MainActivity extends Activity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+ final Resources res = getResources();
+ final GridViewPager pager = (GridViewPager) findViewById(R.id.pager);
+ pager.setOnApplyWindowInsetsListener(new OnApplyWindowInsetsListener() {
+ @Override
+ public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
+ // Adjust page margins:
+ // A little extra horizontal spacing between pages looks a bit
+ // less crowded on a round display.
+ final boolean round = insets.isRound();
+ int rowMargin = res.getDimensionPixelOffset(R.dimen.page_row_margin);
+ int colMargin = res.getDimensionPixelOffset(round ?
+ R.dimen.page_column_margin_round : R.dimen.page_column_margin);
+ pager.setPageMargins(rowMargin, colMargin);
+
+ // GridViewPager relies on insets to properly handle
+ // layout for round displays. They must be explicitly
+ // applied since this listener has taken them over.
+ pager.onApplyWindowInsets(insets);
+ return insets;
+ }
+ });
+ pager.setAdapter(new SampleGridPagerAdapter(this, getFragmentManager()));
+ DotsPageIndicator dotsPageIndicator = (DotsPageIndicator) findViewById(R.id.page_indicator);
+ dotsPageIndicator.setPager(pager);
+ }
+}
diff --git a/samples/browseable/GridViewPager/Wearable/src/com.example.android.wearable.gridviewpager/SampleGridPagerAdapter.java b/samples/browseable/GridViewPager/Wearable/src/com.example.android.wearable.gridviewpager/SampleGridPagerAdapter.java
new file mode 100644
index 000000000..b56cc6a85
--- /dev/null
+++ b/samples/browseable/GridViewPager/Wearable/src/com.example.android.wearable.gridviewpager/SampleGridPagerAdapter.java
@@ -0,0 +1,198 @@
+/*
+ * Copyright (C) 2014 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.wearable.gridviewpager;
+
+import android.app.Fragment;
+import android.app.FragmentManager;
+import android.content.Context;
+import android.content.res.Resources;
+import android.graphics.Point;
+import android.graphics.drawable.ColorDrawable;
+import android.graphics.drawable.Drawable;
+import android.graphics.drawable.TransitionDrawable;
+import android.os.AsyncTask;
+import android.support.v4.util.LruCache;
+import android.support.wearable.view.CardFragment;
+import android.support.wearable.view.FragmentGridPagerAdapter;
+import android.support.wearable.view.GridPagerAdapter;
+import android.util.Log;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Constructs fragments as requested by the GridViewPager. For each row a different background is
+ * provided.
+ * <p>
+ * Always avoid loading resources from the main thread. In this sample, the background images are
+ * loaded from an background task and then updated using {@link #notifyRowBackgroundChanged(int)}
+ * and {@link #notifyPageBackgroundChanged(int, int)}.
+ */
+public class SampleGridPagerAdapter extends FragmentGridPagerAdapter {
+ private static final int TRANSITION_DURATION_MILLIS = 100;
+
+ private final Context mContext;
+ private List<Row> mRows;
+ private ColorDrawable mDefaultBg;
+
+ private ColorDrawable mClearBg;
+
+ public SampleGridPagerAdapter(Context ctx, FragmentManager fm) {
+ super(fm);
+ mContext = ctx;
+
+ mRows = new ArrayList<SampleGridPagerAdapter.Row>();
+
+ mRows.add(new Row(cardFragment(R.string.welcome_title, R.string.welcome_text)));
+ mRows.add(new Row(cardFragment(R.string.about_title, R.string.about_text)));
+ mRows.add(new Row(
+ cardFragment(R.string.cards_title, R.string.cards_text),
+ cardFragment(R.string.expansion_title, R.string.expansion_text)));
+ mRows.add(new Row(
+ cardFragment(R.string.backgrounds_title, R.string.backgrounds_text),
+ cardFragment(R.string.columns_title, R.string.columns_text)));
+ mRows.add(new Row(new CustomFragment()));
+ mRows.add(new Row(cardFragment(R.string.dismiss_title, R.string.dismiss_text)));
+ mDefaultBg = new ColorDrawable(R.color.dark_grey);
+ mClearBg = new ColorDrawable(android.R.color.transparent);
+ }
+
+ LruCache<Integer, Drawable> mRowBackgrounds = new LruCache<Integer, Drawable>(3) {
+ @Override
+ protected Drawable create(final Integer row) {
+ int resid = BG_IMAGES[row % BG_IMAGES.length];
+ new DrawableLoadingTask(mContext) {
+ @Override
+ protected void onPostExecute(Drawable result) {
+ TransitionDrawable background = new TransitionDrawable(new Drawable[] {
+ mDefaultBg,
+ result
+ });
+ mRowBackgrounds.put(row, background);
+ notifyRowBackgroundChanged(row);
+ background.startTransition(TRANSITION_DURATION_MILLIS);
+ }
+ }.execute(resid);
+ return mDefaultBg;
+ }
+ };
+
+ LruCache<Point, Drawable> mPageBackgrounds = new LruCache<Point, Drawable>(3) {
+ @Override
+ protected Drawable create(final Point page) {
+ // place bugdroid as the background at row 2, column 1
+ if (page.y == 2 && page.x == 1) {
+ int resid = R.drawable.bugdroid_large;
+ new DrawableLoadingTask(mContext) {
+ @Override
+ protected void onPostExecute(Drawable result) {
+ TransitionDrawable background = new TransitionDrawable(new Drawable[] {
+ mClearBg,
+ result
+ });
+ mPageBackgrounds.put(page, background);
+ notifyPageBackgroundChanged(page.y, page.x);
+ background.startTransition(TRANSITION_DURATION_MILLIS);
+ }
+ }.execute(resid);
+ }
+ return GridPagerAdapter.BACKGROUND_NONE;
+ }
+ };
+
+ private Fragment cardFragment(int titleRes, int textRes) {
+ Resources res = mContext.getResources();
+ CardFragment fragment =
+ CardFragment.create(res.getText(titleRes), res.getText(textRes));
+ // Add some extra bottom margin to leave room for the page indicator
+ fragment.setCardMarginBottom(
+ res.getDimensionPixelSize(R.dimen.card_margin_bottom));
+ return fragment;
+ }
+
+ static final int[] BG_IMAGES = new int[] {
+ R.drawable.debug_background_1,
+ R.drawable.debug_background_2,
+ R.drawable.debug_background_3,
+ R.drawable.debug_background_4,
+ R.drawable.debug_background_5
+ };
+
+ /** A convenient container for a row of fragments. */
+ private class Row {
+ final List<Fragment> columns = new ArrayList<Fragment>();
+
+ public Row(Fragment... fragments) {
+ for (Fragment f : fragments) {
+ add(f);
+ }
+ }
+
+ public void add(Fragment f) {
+ columns.add(f);
+ }
+
+ Fragment getColumn(int i) {
+ return columns.get(i);
+ }
+
+ public int getColumnCount() {
+ return columns.size();
+ }
+ }
+
+ @Override
+ public Fragment getFragment(int row, int col) {
+ Row adapterRow = mRows.get(row);
+ return adapterRow.getColumn(col);
+ }
+
+ @Override
+ public Drawable getBackgroundForRow(final int row) {
+ return mRowBackgrounds.get(row);
+ }
+
+ @Override
+ public Drawable getBackgroundForPage(final int row, final int column) {
+ return mPageBackgrounds.get(new Point(column, row));
+ }
+
+ @Override
+ public int getRowCount() {
+ return mRows.size();
+ }
+
+ @Override
+ public int getColumnCount(int rowNum) {
+ return mRows.get(rowNum).getColumnCount();
+ }
+
+ class DrawableLoadingTask extends AsyncTask<Integer, Void, Drawable> {
+ private static final String TAG = "Loader";
+ private Context context;
+
+ DrawableLoadingTask(Context context) {
+ this.context = context;
+ }
+
+ @Override
+ protected Drawable doInBackground(Integer... params) {
+ Log.d(TAG, "Loading asset 0x" + Integer.toHexString(params[0]));
+ return context.getResources().getDrawable(params[0]);
+ }
+ }
+}
diff --git a/samples/browseable/GridViewPager/_index.jd b/samples/browseable/GridViewPager/_index.jd
new file mode 100644
index 000000000..0abe7549e
--- /dev/null
+++ b/samples/browseable/GridViewPager/_index.jd
@@ -0,0 +1,9 @@
+page.tags="GridViewPager"
+sample.group=Wearable
+@jd:body
+
+<p>
+
+ Demonstrates how to implement a GridViewPager in your wearable app.
+
+ </p>
diff --git a/samples/browseable/HdrViewfinder/res/values-v21/base-colors.xml b/samples/browseable/HdrViewfinder/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/HdrViewfinder/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/HdrViewfinder/res/values-v21/base-template-styles.xml b/samples/browseable/HdrViewfinder/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/HdrViewfinder/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/HdrViewfinder/res/values-v21/template-styles.xml b/samples/browseable/HdrViewfinder/res/values-v21/template-styles.xml
deleted file mode 100644
index 134fcd9d3..000000000
--- a/samples/browseable/HdrViewfinder/res/values-v21/template-styles.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<!--
- Copyright 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<resources>
-
- <!-- Activity themes -->
- <style name="Theme.Base" parent="android:Theme.Material.Light" />
-
-</resources>
diff --git a/samples/browseable/HorizontalPaging/AndroidManifest.xml b/samples/browseable/HorizontalPaging/AndroidManifest.xml
index 33b9e15b9..1f6fdd2a0 100644
--- a/samples/browseable/HorizontalPaging/AndroidManifest.xml
+++ b/samples/browseable/HorizontalPaging/AndroidManifest.xml
@@ -22,9 +22,7 @@
<!-- While ViewPager will work on API 4 or above, tabs require an ActionBar. ActionBar is only
available in API 11 or above. -->
- <uses-sdk
- android:minSdkVersion="11"
- android:targetSdkVersion="16" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<application
android:allowBackup="true"
diff --git a/samples/browseable/HorizontalPaging/_index.jd b/samples/browseable/HorizontalPaging/_index.jd
index acdc1b148..4e4ba00a2 100644
--- a/samples/browseable/HorizontalPaging/_index.jd
+++ b/samples/browseable/HorizontalPaging/_index.jd
@@ -1,10 +1,10 @@
-
-
-
page.tags="HorizontalPaging"
sample.group=UI
@jd:body
-<p>This sample demonstrates how to implement horizontal paging between
-fragments in an application that has an {@link android.app.ActionBar}, using a
-{@link android.support.v4.view.ViewPager} widget.</p>
+<p>
+
+ This sample demonstrates how to implement horizontal paging between fragments in
+ applications that use ActionBar, using a ViewPager widget.
+
+ </p>
diff --git a/samples/browseable/HorizontalPaging/res/drawable-hdpi/ic_launcher.png b/samples/browseable/HorizontalPaging/res/drawable-hdpi/ic_launcher.png
index 96a442e5b..800427741 100755..100644
--- a/samples/browseable/HorizontalPaging/res/drawable-hdpi/ic_launcher.png
+++ b/samples/browseable/HorizontalPaging/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/HorizontalPaging/res/drawable-mdpi/ic_launcher.png b/samples/browseable/HorizontalPaging/res/drawable-mdpi/ic_launcher.png
index 359047dfa..eb49a8677 100755..100644
--- a/samples/browseable/HorizontalPaging/res/drawable-mdpi/ic_launcher.png
+++ b/samples/browseable/HorizontalPaging/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/HorizontalPaging/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/HorizontalPaging/res/drawable-xhdpi/ic_launcher.png
index 71c6d760f..1d159e9bb 100755..100644
--- a/samples/browseable/HorizontalPaging/res/drawable-xhdpi/ic_launcher.png
+++ b/samples/browseable/HorizontalPaging/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/HorizontalPaging/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/HorizontalPaging/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 000000000..ba543fef2
--- /dev/null
+++ b/samples/browseable/HorizontalPaging/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/HorizontalPaging/res/values-v21/base-colors.xml b/samples/browseable/HorizontalPaging/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/HorizontalPaging/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/HorizontalPaging/res/values-v21/base-template-styles.xml b/samples/browseable/HorizontalPaging/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/HorizontalPaging/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/HorizontalPaging/res/values/base-strings.xml b/samples/browseable/HorizontalPaging/res/values/base-strings.xml
index 70484bcb4..3f5d5a9cb 100644
--- a/samples/browseable/HorizontalPaging/res/values/base-strings.xml
+++ b/samples/browseable/HorizontalPaging/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">HorizontalPaging</string>
<string name="intro_message">
diff --git a/samples/browseable/ImmersiveMode/AndroidManifest.xml b/samples/browseable/ImmersiveMode/AndroidManifest.xml
index 72a60ce15..b558db6d4 100644
--- a/samples/browseable/ImmersiveMode/AndroidManifest.xml
+++ b/samples/browseable/ImmersiveMode/AndroidManifest.xml
@@ -19,7 +19,7 @@
android:versionCode="1"
android:versionName="1.0">
- <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="19" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<application android:allowBackup="true"
android:label="@string/app_name"
diff --git a/samples/browseable/ImmersiveMode/_index.jd b/samples/browseable/ImmersiveMode/_index.jd
index ab3b7182d..38c7fbdd0 100644
--- a/samples/browseable/ImmersiveMode/_index.jd
+++ b/samples/browseable/ImmersiveMode/_index.jd
@@ -1,12 +1,11 @@
-
-
-
page.tags="ImmersiveMode"
sample.group=UI
@jd:body
-<p>Android 4.4 introduces a way for you to provide a more immersive screen
-experience in your app, by letting users show or hide the status bar and
-navigation bar with a swipe.</p>
-<p>This sample demonstrates how to enable toggling of this feature in a
-{@link android.support.v4.app.Fragment}.</p>
+<p>
+
+ One of the features introduced in KitKat is "immersive mode". Immersive mode gives the
+ user the ability to show/hide the status bar and navigation bar with a swipe. To try,
+ click the "Toggle immersive mode" button, then try swiping the bar in and out!
+
+ </p>
diff --git a/samples/browseable/ImmersiveMode/res/values-v21/base-colors.xml b/samples/browseable/ImmersiveMode/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/ImmersiveMode/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/ImmersiveMode/res/values-v21/base-template-styles.xml b/samples/browseable/ImmersiveMode/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/ImmersiveMode/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/ImmersiveMode/res/values/base-strings.xml b/samples/browseable/ImmersiveMode/res/values/base-strings.xml
index 2092f63a4..a247c6bfc 100644
--- a/samples/browseable/ImmersiveMode/res/values/base-strings.xml
+++ b/samples/browseable/ImmersiveMode/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">ImmersiveMode</string>
<string name="intro_message">
diff --git a/samples/browseable/ImmersiveMode/res/values/strings.xml b/samples/browseable/ImmersiveMode/res/values/strings.xml
index 8a1e9e16f..65ee47d33 100644
--- a/samples/browseable/ImmersiveMode/res/values/strings.xml
+++ b/samples/browseable/ImmersiveMode/res/values/strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="sample_action">Toggle immersive mode!</string>
</resources>
diff --git a/samples/browseable/ImmersiveMode/src/com.example.android.immersivemode/MainActivity.java b/samples/browseable/ImmersiveMode/src/com.example.android.immersivemode/MainActivity.java
index 8fb6e345c..645e92f8a 100644
--- a/samples/browseable/ImmersiveMode/src/com.example.android.immersivemode/MainActivity.java
+++ b/samples/browseable/ImmersiveMode/src/com.example.android.immersivemode/MainActivity.java
@@ -14,9 +14,6 @@
* limitations under the License.
*/
-
-
-
package com.example.android.immersivemode;
import android.graphics.Color;
diff --git a/samples/browseable/Interpolator/res/values-v21/base-colors.xml b/samples/browseable/Interpolator/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/Interpolator/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/Interpolator/res/values-v21/base-template-styles.xml b/samples/browseable/Interpolator/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/Interpolator/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/Interpolator/res/values-v21/template-styles.xml b/samples/browseable/Interpolator/res/values-v21/template-styles.xml
deleted file mode 100644
index 134fcd9d3..000000000
--- a/samples/browseable/Interpolator/res/values-v21/template-styles.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<!--
- Copyright 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<resources>
-
- <!-- Activity themes -->
- <style name="Theme.Base" parent="android:Theme.Material.Light" />
-
-</resources>
diff --git a/samples/browseable/JobScheduler/res/values-v21/base-colors.xml b/samples/browseable/JobScheduler/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/JobScheduler/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/JobScheduler/res/values-v21/base-template-styles.xml b/samples/browseable/JobScheduler/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/JobScheduler/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/JobScheduler/res/values-v21/template-styles.xml b/samples/browseable/JobScheduler/res/values-v21/template-styles.xml
deleted file mode 100644
index 134fcd9d3..000000000
--- a/samples/browseable/JobScheduler/res/values-v21/template-styles.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<!--
- Copyright 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<resources>
-
- <!-- Activity themes -->
- <style name="Theme.Base" parent="android:Theme.Material.Light" />
-
-</resources>
diff --git a/samples/browseable/JobScheduler/src/com.example.android.jobscheduler/MainActivity.java b/samples/browseable/JobScheduler/src/com.example.android.jobscheduler/MainActivity.java
index f495bf1b6..624e22d02 100644
--- a/samples/browseable/JobScheduler/src/com.example.android.jobscheduler/MainActivity.java
+++ b/samples/browseable/JobScheduler/src/com.example.android.jobscheduler/MainActivity.java
@@ -140,9 +140,9 @@ public class MainActivity extends Activity {
boolean requiresUnmetered = mWiFiConnectivityRadioButton.isChecked();
boolean requiresAnyConnectivity = mAnyConnectivityRadioButton.isChecked();
if (requiresUnmetered) {
- builder.setRequiredNetworkCapabilities(JobInfo.NetworkType.UNMETERED);
+ builder.setRequiredNetworkType(JobInfo.NETWORK_TYPE_UNMETERED);
} else if (requiresAnyConnectivity) {
- builder.setRequiredNetworkCapabilities(JobInfo.NetworkType.ANY);
+ builder.setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY);
}
builder.setRequiresDeviceIdle(mRequiresIdleCheckbox.isChecked());
builder.setRequiresCharging(mRequiresChargingCheckBox.isChecked());
diff --git a/samples/browseable/JumpingJack/Application/AndroidManifest.xml b/samples/browseable/JumpingJack/Application/AndroidManifest.xml
new file mode 100644
index 000000000..8605fb038
--- /dev/null
+++ b/samples/browseable/JumpingJack/Application/AndroidManifest.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.wearable.jumpingjack">
+
+ <uses-sdk android:minSdkVersion="18"
+ android:targetSdkVersion="21" />
+ <uses-permission android:name="android.permission.VIBRATE"/>
+
+ <application android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name">
+ </application>
+
+</manifest>
+
diff --git a/samples/browseable/JumpingJack/Application/res/drawable-hdpi/ic_launcher.png b/samples/browseable/JumpingJack/Application/res/drawable-hdpi/ic_launcher.png
new file mode 100755
index 000000000..589f229d1
--- /dev/null
+++ b/samples/browseable/JumpingJack/Application/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/JumpingJack/Application/res/drawable-hdpi/tile.9.png b/samples/browseable/JumpingJack/Application/res/drawable-hdpi/tile.9.png
new file mode 100644
index 000000000..135862883
--- /dev/null
+++ b/samples/browseable/JumpingJack/Application/res/drawable-hdpi/tile.9.png
Binary files differ
diff --git a/samples/browseable/JumpingJack/Application/res/drawable-mdpi/ic_launcher.png b/samples/browseable/JumpingJack/Application/res/drawable-mdpi/ic_launcher.png
new file mode 100755
index 000000000..77dd57139
--- /dev/null
+++ b/samples/browseable/JumpingJack/Application/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/JumpingJack/Application/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/JumpingJack/Application/res/drawable-xhdpi/ic_launcher.png
new file mode 100755
index 000000000..fe34ebe13
--- /dev/null
+++ b/samples/browseable/JumpingJack/Application/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/JumpingJack/Application/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/JumpingJack/Application/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 000000000..ab80bcd13
--- /dev/null
+++ b/samples/browseable/JumpingJack/Application/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/JumpingJack/Application/res/layout/activity_main.xml b/samples/browseable/JumpingJack/Application/res/layout/activity_main.xml
new file mode 100755
index 000000000..be1aa49d9
--- /dev/null
+++ b/samples/browseable/JumpingJack/Application/res/layout/activity_main.xml
@@ -0,0 +1,36 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <LinearLayout style="@style/Widget.SampleMessageTile"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView style="@style/Widget.SampleMessage"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="@dimen/horizontal_page_margin"
+ android:layout_marginRight="@dimen/horizontal_page_margin"
+ android:layout_marginTop="@dimen/vertical_page_margin"
+ android:layout_marginBottom="@dimen/vertical_page_margin"
+ android:text="@string/intro_message" />
+ </LinearLayout>
+</LinearLayout>
diff --git a/samples/browseable/JumpingJack/Application/res/values-sw600dp/template-dimens.xml b/samples/browseable/JumpingJack/Application/res/values-sw600dp/template-dimens.xml
new file mode 100644
index 000000000..22074a2bd
--- /dev/null
+++ b/samples/browseable/JumpingJack/Application/res/values-sw600dp/template-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>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_huge</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/JumpingJack/Application/res/values-sw600dp/template-styles.xml b/samples/browseable/JumpingJack/Application/res/values-sw600dp/template-styles.xml
new file mode 100644
index 000000000..03d197418
--- /dev/null
+++ b/samples/browseable/JumpingJack/Application/res/values-sw600dp/template-styles.xml
@@ -0,0 +1,25 @@
+<!--
+ 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.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceLarge</item>
+ <item name="android:lineSpacingMultiplier">1.2</item>
+ <item name="android:shadowDy">-6.5</item>
+ </style>
+
+</resources>
diff --git a/samples/browseable/JumpingJack/Application/res/values-v11/template-styles.xml b/samples/browseable/JumpingJack/Application/res/values-v11/template-styles.xml
new file mode 100644
index 000000000..8c1ea66f2
--- /dev/null
+++ b/samples/browseable/JumpingJack/Application/res/values-v11/template-styles.xml
@@ -0,0 +1,22 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Holo.Light" />
+
+</resources>
diff --git a/samples/browseable/JumpingJack/Application/res/values-v21/base-colors.xml b/samples/browseable/JumpingJack/Application/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/JumpingJack/Application/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/JumpingJack/Application/res/values-v21/base-template-styles.xml b/samples/browseable/JumpingJack/Application/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/JumpingJack/Application/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/JumpingJack/Application/res/values/base-strings.xml b/samples/browseable/JumpingJack/Application/res/values/base-strings.xml
new file mode 100644
index 000000000..7553d3e84
--- /dev/null
+++ b/samples/browseable/JumpingJack/Application/res/values/base-strings.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>
+ <string name="app_name">JumpingJack</string>
+ <string name="intro_message">
+ <![CDATA[
+
+
+ Uses the Gravity sensor to count how many jumping jacks you have performed.
+
+
+ ]]>
+ </string>
+</resources>
diff --git a/samples/browseable/JumpingJack/Application/res/values/template-dimens.xml b/samples/browseable/JumpingJack/Application/res/values/template-dimens.xml
new file mode 100644
index 000000000..39e710b5c
--- /dev/null
+++ b/samples/browseable/JumpingJack/Application/res/values/template-dimens.xml
@@ -0,0 +1,32 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Define standard dimensions to comply with Holo-style grids and rhythm. -->
+
+ <dimen name="margin_tiny">4dp</dimen>
+ <dimen name="margin_small">8dp</dimen>
+ <dimen name="margin_medium">16dp</dimen>
+ <dimen name="margin_large">32dp</dimen>
+ <dimen name="margin_huge">64dp</dimen>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_medium</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/JumpingJack/Application/res/values/template-styles.xml b/samples/browseable/JumpingJack/Application/res/values/template-styles.xml
new file mode 100644
index 000000000..6e7d593dd
--- /dev/null
+++ b/samples/browseable/JumpingJack/Application/res/values/template-styles.xml
@@ -0,0 +1,42 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+
+ <style name="Theme.Base" parent="android:Theme.Light" />
+
+ <style name="Theme.Sample" parent="Theme.Base" />
+
+ <style name="AppTheme" parent="Theme.Sample" />
+ <!-- Widget styling -->
+
+ <style name="Widget" />
+
+ <style name="Widget.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceMedium</item>
+ <item name="android:lineSpacingMultiplier">1.1</item>
+ </style>
+
+ <style name="Widget.SampleMessageTile">
+ <item name="android:background">@drawable/tile</item>
+ <item name="android:shadowColor">#7F000000</item>
+ <item name="android:shadowDy">-3.5</item>
+ <item name="android:shadowRadius">2</item>
+ </style>
+
+</resources>
diff --git a/samples/browseable/JumpingJack/Application/src/com.example.android.common/activities/SampleActivityBase.java b/samples/browseable/JumpingJack/Application/src/com.example.android.common/activities/SampleActivityBase.java
new file mode 100644
index 000000000..3228927b7
--- /dev/null
+++ b/samples/browseable/JumpingJack/Application/src/com.example.android.common/activities/SampleActivityBase.java
@@ -0,0 +1,52 @@
+/*
+* Copyright 2013 The Android Open Source Project
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package com.example.android.common.activities;
+
+import android.os.Bundle;
+import android.support.v4.app.FragmentActivity;
+
+import com.example.android.common.logger.Log;
+import com.example.android.common.logger.LogWrapper;
+
+/**
+ * Base launcher activity, to handle most of the common plumbing for samples.
+ */
+public class SampleActivityBase extends FragmentActivity {
+
+ public static final String TAG = "SampleActivityBase";
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ }
+
+ @Override
+ protected void onStart() {
+ super.onStart();
+ initializeLogging();
+ }
+
+ /** Set up targets to receive log data */
+ public void initializeLogging() {
+ // Using Log, front-end to the logging chain, emulates android.util.log method signatures.
+ // Wraps Android's native log framework
+ LogWrapper logWrapper = new LogWrapper();
+ Log.setLogNode(logWrapper);
+
+ Log.i(TAG, "Ready");
+ }
+}
diff --git a/samples/browseable/JumpingJack/Application/src/com.example.android.common/logger/Log.java b/samples/browseable/JumpingJack/Application/src/com.example.android.common/logger/Log.java
new file mode 100644
index 000000000..17503c568
--- /dev/null
+++ b/samples/browseable/JumpingJack/Application/src/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);
+ }
+}
diff --git a/samples/browseable/JumpingJack/Application/src/com.example.android.common/logger/LogFragment.java b/samples/browseable/JumpingJack/Application/src/com.example.android.common/logger/LogFragment.java
new file mode 100644
index 000000000..b302acd4b
--- /dev/null
+++ b/samples/browseable/JumpingJack/Application/src/com.example.android.common/logger/LogFragment.java
@@ -0,0 +1,109 @@
+/*
+* 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 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.graphics.Typeface;
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ScrollView;
+
+/**
+ * Simple fraggment which contains a LogView and uses is to output log data it receives
+ * through the LogNode interface.
+ */
+public class LogFragment extends Fragment {
+
+ private LogView mLogView;
+ private ScrollView mScrollView;
+
+ public LogFragment() {}
+
+ public View inflateViews() {
+ mScrollView = new ScrollView(getActivity());
+ ViewGroup.LayoutParams scrollParams = new ViewGroup.LayoutParams(
+ ViewGroup.LayoutParams.MATCH_PARENT,
+ ViewGroup.LayoutParams.MATCH_PARENT);
+ mScrollView.setLayoutParams(scrollParams);
+
+ mLogView = new LogView(getActivity());
+ ViewGroup.LayoutParams logParams = new ViewGroup.LayoutParams(scrollParams);
+ logParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
+ mLogView.setLayoutParams(logParams);
+ mLogView.setClickable(true);
+ mLogView.setFocusable(true);
+ mLogView.setTypeface(Typeface.MONOSPACE);
+
+ // Want to set padding as 16 dips, setPadding takes pixels. Hooray math!
+ int paddingDips = 16;
+ double scale = getResources().getDisplayMetrics().density;
+ int paddingPixels = (int) ((paddingDips * (scale)) + .5);
+ mLogView.setPadding(paddingPixels, paddingPixels, paddingPixels, paddingPixels);
+ mLogView.setCompoundDrawablePadding(paddingPixels);
+
+ mLogView.setGravity(Gravity.BOTTOM);
+ mLogView.setTextAppearance(getActivity(), android.R.style.TextAppearance_Holo_Medium);
+
+ mScrollView.addView(mLogView);
+ return mScrollView;
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+
+ View result = inflateViews();
+
+ 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) {
+ mScrollView.fullScroll(ScrollView.FOCUS_DOWN);
+ }
+ });
+ return result;
+ }
+
+ public LogView getLogView() {
+ return mLogView;
+ }
+} \ No newline at end of file
diff --git a/samples/browseable/JumpingJack/Application/src/com.example.android.common/logger/LogNode.java b/samples/browseable/JumpingJack/Application/src/com.example.android.common/logger/LogNode.java
new file mode 100644
index 000000000..bc37cabc0
--- /dev/null
+++ b/samples/browseable/JumpingJack/Application/src/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/samples/browseable/JumpingJack/Application/src/com.example.android.common/logger/LogView.java b/samples/browseable/JumpingJack/Application/src/com.example.android.common/logger/LogView.java
new file mode 100644
index 000000000..c01542b91
--- /dev/null
+++ b/samples/browseable/JumpingJack/Application/src/com.example.android.common/logger/LogView.java
@@ -0,0 +1,145 @@
+/*
+ * 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.app.Activity;
+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.
+ final StringBuilder outputBuilder = new StringBuilder();
+
+ String delimiter = "\t";
+ appendIfNotNull(outputBuilder, priorityStr, delimiter);
+ appendIfNotNull(outputBuilder, tag, delimiter);
+ appendIfNotNull(outputBuilder, msg, delimiter);
+ appendIfNotNull(outputBuilder, exceptionStr, delimiter);
+
+ // In case this was originally called from an AsyncTask or some other off-UI thread,
+ // make sure the update occurs within the UI thread.
+ ((Activity) getContext()).runOnUiThread( (new Thread(new Runnable() {
+ @Override
+ public void run() {
+ // 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/samples/browseable/JumpingJack/Application/src/com.example.android.common/logger/LogWrapper.java b/samples/browseable/JumpingJack/Application/src/com.example.android.common/logger/LogWrapper.java
new file mode 100644
index 000000000..16a9e7ba2
--- /dev/null
+++ b/samples/browseable/JumpingJack/Application/src/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);
+ }
+ }
+}
diff --git a/samples/browseable/JumpingJack/Application/src/com.example.android.common/logger/MessageOnlyLogFilter.java b/samples/browseable/JumpingJack/Application/src/com.example.android.common/logger/MessageOnlyLogFilter.java
new file mode 100644
index 000000000..19967dcd4
--- /dev/null
+++ b/samples/browseable/JumpingJack/Application/src/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 chain.
+ */
+ public LogNode getNext() {
+ return mNext;
+ }
+
+ /**
+ * Sets the LogNode data will be sent to..
+ */
+ public void setNext(LogNode node) {
+ mNext = node;
+ }
+
+}
diff --git a/samples/browseable/JumpingJack/Wearable/AndroidManifest.xml b/samples/browseable/JumpingJack/Wearable/AndroidManifest.xml
new file mode 100644
index 000000000..02b7a4fff
--- /dev/null
+++ b/samples/browseable/JumpingJack/Wearable/AndroidManifest.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.wearable.jumpingjack">
+
+ <uses-sdk android:minSdkVersion="20"
+ android:targetSdkVersion="21" />
+
+ <uses-feature android:name="android.hardware.type.watch" />
+
+ <uses-permission android:name="android.permission.VIBRATE"/>
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@android:style/Theme.DeviceDefault.Light">
+ <activity
+ android:name=".MainActivity"
+ android:label="@string/app_name">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="android.intent.category.LAUNCHER"/>
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest>
diff --git a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable-hdpi/btn_reset_normal_200.png b/samples/browseable/JumpingJack/Wearable/res/drawable-hdpi/btn_reset_normal_200.png
index e58520274..e58520274 100644
--- a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable-hdpi/btn_reset_normal_200.png
+++ b/samples/browseable/JumpingJack/Wearable/res/drawable-hdpi/btn_reset_normal_200.png
Binary files differ
diff --git a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable-hdpi/btn_reset_pressed_200.png b/samples/browseable/JumpingJack/Wearable/res/drawable-hdpi/btn_reset_pressed_200.png
index 0b83b6d66..0b83b6d66 100644
--- a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable-hdpi/btn_reset_pressed_200.png
+++ b/samples/browseable/JumpingJack/Wearable/res/drawable-hdpi/btn_reset_pressed_200.png
Binary files differ
diff --git a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable-hdpi/ic_launcher.png b/samples/browseable/JumpingJack/Wearable/res/drawable-hdpi/ic_launcher.png
index 2d0c37d0e..2d0c37d0e 100644
--- a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable-hdpi/ic_launcher.png
+++ b/samples/browseable/JumpingJack/Wearable/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable-mdpi/ic_launcher.png b/samples/browseable/JumpingJack/Wearable/res/drawable-mdpi/ic_launcher.png
index 3211c9e8b..3211c9e8b 100644
--- a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable-mdpi/ic_launcher.png
+++ b/samples/browseable/JumpingJack/Wearable/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/JumpingJack/Wearable/res/drawable-xhdpi/ic_launcher.png
index 4ead8a29f..4ead8a29f 100644
--- a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png
+++ b/samples/browseable/JumpingJack/Wearable/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/JumpingJack/Wearable/res/drawable-xxhdpi/ic_launcher.png
index 8b357e4d5..8b357e4d5 100644
--- a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png
+++ b/samples/browseable/JumpingJack/Wearable/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable-xxxhdpi/ic_launcher.png b/samples/browseable/JumpingJack/Wearable/res/drawable-xxxhdpi/ic_launcher.png
index da3c00a9a..da3c00a9a 100644
--- a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable-xxxhdpi/ic_launcher.png
+++ b/samples/browseable/JumpingJack/Wearable/res/drawable-xxxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable/empty_10.png b/samples/browseable/JumpingJack/Wearable/res/drawable/empty_10.png
index 78ee76bb1..78ee76bb1 100644
--- a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable/empty_10.png
+++ b/samples/browseable/JumpingJack/Wearable/res/drawable/empty_10.png
Binary files differ
diff --git a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable/full_10.png b/samples/browseable/JumpingJack/Wearable/res/drawable/full_10.png
index 53b799ebc..53b799ebc 100644
--- a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable/full_10.png
+++ b/samples/browseable/JumpingJack/Wearable/res/drawable/full_10.png
Binary files differ
diff --git a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable/jump_down_50.png b/samples/browseable/JumpingJack/Wearable/res/drawable/jump_down_50.png
index 28980f808..28980f808 100644
--- a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable/jump_down_50.png
+++ b/samples/browseable/JumpingJack/Wearable/res/drawable/jump_down_50.png
Binary files differ
diff --git a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable/jump_up_50.png b/samples/browseable/JumpingJack/Wearable/res/drawable/jump_up_50.png
index 86dcef593..86dcef593 100644
--- a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable/jump_up_50.png
+++ b/samples/browseable/JumpingJack/Wearable/res/drawable/jump_up_50.png
Binary files differ
diff --git a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable/submit_button.xml b/samples/browseable/JumpingJack/Wearable/res/drawable/submit_button.xml
index 2ab9ba565..2ab9ba565 100644
--- a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable/submit_button.xml
+++ b/samples/browseable/JumpingJack/Wearable/res/drawable/submit_button.xml
diff --git a/samples/wearable/JumpingJack/Wearable/src/main/res/layout/counter_layout.xml b/samples/browseable/JumpingJack/Wearable/res/layout/counter_layout.xml
index e443e342b..e443e342b 100644
--- a/samples/wearable/JumpingJack/Wearable/src/main/res/layout/counter_layout.xml
+++ b/samples/browseable/JumpingJack/Wearable/res/layout/counter_layout.xml
diff --git a/samples/wearable/JumpingJack/Wearable/src/main/res/layout/jj_layout.xml b/samples/browseable/JumpingJack/Wearable/res/layout/jj_layout.xml
index 73af6e318..73af6e318 100644
--- a/samples/wearable/JumpingJack/Wearable/src/main/res/layout/jj_layout.xml
+++ b/samples/browseable/JumpingJack/Wearable/res/layout/jj_layout.xml
diff --git a/samples/wearable/JumpingJack/Wearable/src/main/res/layout/setting_layout.xml b/samples/browseable/JumpingJack/Wearable/res/layout/setting_layout.xml
index 129840958..129840958 100644
--- a/samples/wearable/JumpingJack/Wearable/src/main/res/layout/setting_layout.xml
+++ b/samples/browseable/JumpingJack/Wearable/res/layout/setting_layout.xml
diff --git a/samples/wearable/JumpingJack/Wearable/src/main/res/values/colors.xml b/samples/browseable/JumpingJack/Wearable/res/values/colors.xml
index eccbe6d75..eccbe6d75 100644
--- a/samples/wearable/JumpingJack/Wearable/src/main/res/values/colors.xml
+++ b/samples/browseable/JumpingJack/Wearable/res/values/colors.xml
diff --git a/samples/wearable/JumpingJack/Wearable/src/main/res/values/dimens.xml b/samples/browseable/JumpingJack/Wearable/res/values/dimens.xml
index a1e9cfe8a..a1e9cfe8a 100644
--- a/samples/wearable/JumpingJack/Wearable/src/main/res/values/dimens.xml
+++ b/samples/browseable/JumpingJack/Wearable/res/values/dimens.xml
diff --git a/samples/wearable/JumpingJack/Wearable/src/main/res/values/strings.xml b/samples/browseable/JumpingJack/Wearable/res/values/strings.xml
index 8ab0f86aa..8ab0f86aa 100644
--- a/samples/wearable/JumpingJack/Wearable/src/main/res/values/strings.xml
+++ b/samples/browseable/JumpingJack/Wearable/res/values/strings.xml
diff --git a/samples/browseable/JumpingJack/Wearable/src/com.example.android.wearable.jumpingjack/MainActivity.java b/samples/browseable/JumpingJack/Wearable/src/com.example.android.wearable.jumpingjack/MainActivity.java
new file mode 100644
index 000000000..f1589c73d
--- /dev/null
+++ b/samples/browseable/JumpingJack/Wearable/src/com.example.android.wearable.jumpingjack/MainActivity.java
@@ -0,0 +1,257 @@
+/*
+ * Copyright (C) 2014 Google Inc. All Rights Reserved.
+ *
+ * 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.wearable.jumpingjack;
+
+import com.example.android.wearable.jumpingjack.fragments.CounterFragment;
+import com.example.android.wearable.jumpingjack.fragments.SettingsFragment;
+
+import android.app.Activity;
+import android.content.Context;
+import android.hardware.Sensor;
+import android.hardware.SensorEvent;
+import android.hardware.SensorEventListener;
+import android.hardware.SensorManager;
+import android.os.Bundle;
+import android.os.Handler;
+import android.support.v4.view.ViewPager;
+import android.util.Log;
+import android.view.WindowManager;
+import android.widget.ImageView;
+
+import java.util.Timer;
+import java.util.TimerTask;
+
+/**
+ * The main activity for the Jumping Jack application. This activity registers itself to receive
+ * sensor values. Since on wearable devices a full screen activity is very short-lived, we set the
+ * FLAG_KEEP_SCREEN_ON to give user adequate time for taking actions but since we don't want to
+ * keep screen on for an extended period of time, there is a SCREEN_ON_TIMEOUT_MS that is enforced
+ * if no interaction is discovered.
+ *
+ * This activity includes a {@link android.support.v4.view.ViewPager} with two pages, one that
+ * shows the current count and one that allows user to reset the counter. the current value of the
+ * counter is persisted so that upon re-launch, the counter picks up from the last value. At any
+ * stage, user can set this counter to 0.
+ */
+public class MainActivity extends Activity
+ implements SensorEventListener {
+
+ private static final String TAG = "JJMainActivity";
+
+ /** How long to keep the screen on when no activity is happening **/
+ private static final long SCREEN_ON_TIMEOUT_MS = 20000; // in milliseconds
+
+ /** an up-down movement that takes more than this will not be registered as such **/
+ private static final long TIME_THRESHOLD_NS = 2000000000; // in nanoseconds (= 2sec)
+
+ /**
+ * Earth gravity is around 9.8 m/s^2 but user may not completely direct his/her hand vertical
+ * during the exercise so we leave some room. Basically if the x-component of gravity, as
+ * measured by the Gravity sensor, changes with a variation (delta) > GRAVITY_THRESHOLD,
+ * we consider that a successful count.
+ */
+ private static final float GRAVITY_THRESHOLD = 7.0f;
+
+ private SensorManager mSensorManager;
+ private Sensor mSensor;
+ private long mLastTime = 0;
+ private boolean mUp = false;
+ private int mJumpCounter = 0;
+ private ViewPager mPager;
+ private CounterFragment mCounterPage;
+ private SettingsFragment mSettingPage;
+ private ImageView mSecondIndicator;
+ private ImageView mFirstIndicator;
+ private Timer mTimer;
+ private TimerTask mTimerTask;
+ private Handler mHandler;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.jj_layout);
+ setupViews();
+ mHandler = new Handler();
+ mJumpCounter = Utils.getCounterFromPreference(this);
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
+ renewTimer();
+ mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
+ mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_GRAVITY);
+ }
+
+ private void setupViews() {
+ mPager = (ViewPager) findViewById(R.id.pager);
+ mFirstIndicator = (ImageView) findViewById(R.id.indicator_0);
+ mSecondIndicator = (ImageView) findViewById(R.id.indicator_1);
+ final PagerAdapter adapter = new PagerAdapter(getFragmentManager());
+ mCounterPage = new CounterFragment();
+ mSettingPage = new SettingsFragment();
+ adapter.addFragment(mCounterPage);
+ adapter.addFragment(mSettingPage);
+ setIndicator(0);
+ mPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
+ @Override
+ public void onPageScrolled(int i, float v, int i2) {
+ }
+
+ @Override
+ public void onPageSelected(int i) {
+ setIndicator(i);
+ renewTimer();
+ }
+
+ @Override
+ public void onPageScrollStateChanged(int i) {
+ }
+ });
+
+ mPager.setAdapter(adapter);
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ if (mSensorManager.registerListener(this, mSensor,
+ SensorManager.SENSOR_DELAY_NORMAL)) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "Successfully registered for the sensor updates");
+ }
+ }
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ mSensorManager.unregisterListener(this);
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "Unregistered for sensor events");
+ }
+ }
+
+ @Override
+ public void onSensorChanged(SensorEvent event) {
+ detectJump(event.values[0], event.timestamp);
+ }
+
+ @Override
+ public void onAccuracyChanged(Sensor sensor, int accuracy) {
+ }
+
+ /**
+ * A simple algorithm to detect a successful up-down movement of hand(s). The algorithm is
+ * based on the assumption that when a person is wearing the watch, the x-component of gravity
+ * as measured by the Gravity Sensor is +9.8 when the hand is downward and -9.8 when the hand
+ * is upward (signs are reversed if the watch is worn on the right hand). Since the upward or
+ * downward may not be completely accurate, we leave some room and instead of 9.8, we use
+ * GRAVITY_THRESHOLD. We also consider the up <-> down movement successful if it takes less than
+ * TIME_THRESHOLD_NS.
+ */
+ private void detectJump(float xValue, long timestamp) {
+ if ((Math.abs(xValue) > GRAVITY_THRESHOLD)) {
+ if(timestamp - mLastTime < TIME_THRESHOLD_NS && mUp != (xValue > 0)) {
+ onJumpDetected(!mUp);
+ }
+ mUp = xValue > 0;
+ mLastTime = timestamp;
+ }
+ }
+
+ /**
+ * Called on detection of a successful down -> up or up -> down movement of hand.
+ */
+ private void onJumpDetected(boolean up) {
+ // we only count a pair of up and down as one successful movement
+ if (up) {
+ return;
+ }
+ mJumpCounter++;
+ setCounter(mJumpCounter);
+ renewTimer();
+ }
+
+ /**
+ * Updates the counter on UI, saves it to preferences and vibrates the watch when counter
+ * reaches a multiple of 10.
+ */
+ private void setCounter(int i) {
+ mCounterPage.setCounter(i);
+ Utils.saveCounterToPreference(this, i);
+ if (i > 0 && i % 10 == 0) {
+ Utils.vibrate(this, 0);
+ }
+ }
+
+ public void resetCounter() {
+ setCounter(0);
+ renewTimer();
+ }
+
+ /**
+ * Starts a timer to clear the flag FLAG_KEEP_SCREEN_ON.
+ */
+ private void renewTimer() {
+ if (null != mTimer) {
+ mTimer.cancel();
+ }
+ mTimerTask = new TimerTask() {
+ @Override
+ public void run() {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG,
+ "Removing the FLAG_KEEP_SCREEN_ON flag to allow going to background");
+ }
+ resetFlag();
+ }
+ };
+ mTimer = new Timer();
+ mTimer.schedule(mTimerTask, SCREEN_ON_TIMEOUT_MS);
+ }
+
+ /**
+ * Resets the FLAG_KEEP_SCREEN_ON flag so activity can go into background.
+ */
+ private void resetFlag() {
+ mHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "Resetting FLAG_KEEP_SCREEN_ON flag to allow going to background");
+ }
+ getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
+ finish();
+ }
+ });
+ }
+
+ /**
+ * Sets the page indicator for the ViewPager.
+ */
+ private void setIndicator(int i) {
+ switch (i) {
+ case 0:
+ mFirstIndicator.setImageResource(R.drawable.full_10);
+ mSecondIndicator.setImageResource(R.drawable.empty_10);
+ break;
+ case 1:
+ mFirstIndicator.setImageResource(R.drawable.empty_10);
+ mSecondIndicator.setImageResource(R.drawable.full_10);
+ break;
+ }
+ }
+
+
+}
diff --git a/samples/wearable/JumpingJack/Wearable/src/main/java/com/example/android/wearable/jumpingjack/PagerAdapter.java b/samples/browseable/JumpingJack/Wearable/src/com.example.android.wearable.jumpingjack/PagerAdapter.java
index f7ac2b010..f7ac2b010 100644
--- a/samples/wearable/JumpingJack/Wearable/src/main/java/com/example/android/wearable/jumpingjack/PagerAdapter.java
+++ b/samples/browseable/JumpingJack/Wearable/src/com.example.android.wearable.jumpingjack/PagerAdapter.java
diff --git a/samples/wearable/JumpingJack/Wearable/src/main/java/com/example/android/wearable/jumpingjack/Utils.java b/samples/browseable/JumpingJack/Wearable/src/com.example.android.wearable.jumpingjack/Utils.java
index 4db66c9a8..4db66c9a8 100644
--- a/samples/wearable/JumpingJack/Wearable/src/main/java/com/example/android/wearable/jumpingjack/Utils.java
+++ b/samples/browseable/JumpingJack/Wearable/src/com.example.android.wearable.jumpingjack/Utils.java
diff --git a/samples/wearable/JumpingJack/Wearable/src/main/java/com/example/android/wearable/jumpingjack/fragments/CounterFragment.java b/samples/browseable/JumpingJack/Wearable/src/com.example.android.wearable.jumpingjack/fragments/CounterFragment.java
index c55eb9b04..c55eb9b04 100644
--- a/samples/wearable/JumpingJack/Wearable/src/main/java/com/example/android/wearable/jumpingjack/fragments/CounterFragment.java
+++ b/samples/browseable/JumpingJack/Wearable/src/com.example.android.wearable.jumpingjack/fragments/CounterFragment.java
diff --git a/samples/browseable/JumpingJack/Wearable/src/com.example.android.wearable.jumpingjack/fragments/SettingsFragment.java b/samples/browseable/JumpingJack/Wearable/src/com.example.android.wearable.jumpingjack/fragments/SettingsFragment.java
new file mode 100644
index 000000000..771abd3ea
--- /dev/null
+++ b/samples/browseable/JumpingJack/Wearable/src/com.example.android.wearable.jumpingjack/fragments/SettingsFragment.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2014 Google Inc. All Rights Reserved.
+ *
+ * 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.wearable.jumpingjack.fragments;
+
+import com.example.android.wearable.jumpingjack.MainActivity;
+import com.example.android.wearable.jumpingjack.R;
+
+import android.app.Fragment;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+
+/**
+ * A simple fragment that shows a button to reset the counter
+ */
+public class SettingsFragment extends Fragment {
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ View view = inflater.inflate(R.layout.setting_layout, container, false);
+ Button button = (Button) view.findViewById(R.id.btn);
+ button.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ ((MainActivity) getActivity()).resetCounter();
+ }
+ });
+ return view;
+ }
+
+}
diff --git a/samples/browseable/JumpingJack/_index.jd b/samples/browseable/JumpingJack/_index.jd
new file mode 100644
index 000000000..d742e9ef5
--- /dev/null
+++ b/samples/browseable/JumpingJack/_index.jd
@@ -0,0 +1,9 @@
+page.tags="JumpingJack"
+sample.group=Wearable
+@jd:body
+
+<p>
+
+ Uses the Gravity sensor to count how many jumping jacks you have performed.
+
+ </p>
diff --git a/samples/browseable/LNotifications/_index.jd b/samples/browseable/LNotifications/_index.jd
index a993bb7c9..d156267db 100644
--- a/samples/browseable/LNotifications/_index.jd
+++ b/samples/browseable/LNotifications/_index.jd
@@ -1,5 +1,5 @@
page.tags="LNotifications Sample"
-sample.group=UI
+sample.group=Notification
@jd:body
<p>
diff --git a/samples/browseable/LNotifications/res/values-v21/base-colors.xml b/samples/browseable/LNotifications/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/LNotifications/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/LNotifications/res/values-v21/base-template-styles.xml b/samples/browseable/LNotifications/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/LNotifications/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/LNotifications/res/values-v21/template-styles.xml b/samples/browseable/LNotifications/res/values-v21/template-styles.xml
deleted file mode 100644
index 134fcd9d3..000000000
--- a/samples/browseable/LNotifications/res/values-v21/template-styles.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<!--
- Copyright 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<resources>
-
- <!-- Activity themes -->
- <style name="Theme.Base" parent="android:Theme.Material.Light" />
-
-</resources>
diff --git a/samples/browseable/MediaBrowserService/AndroidManifest.xml b/samples/browseable/MediaBrowserService/AndroidManifest.xml
new file mode 100644
index 000000000..6d05c2791
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/AndroidManifest.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.mediabrowserservice"
+ android:versionCode="1"
+ android:versionName="1.0" >
+
+ <uses-permission android:name="android.permission.INTERNET" />
+ <uses-permission android:name="android.permission.WAKE_LOCK" />
+
+ <uses-sdk
+ android:minSdkVersion="21"
+ android:targetSdkVersion="21" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@style/AppTheme">
+
+ <meta-data android:name="com.google.android.gms.car.application"
+ android:resource="@xml/automotive_app_desc"/>
+
+
+ <activity android:name="com.example.android.mediabrowserservice.MusicPlayerActivity"
+ android:label="@string/app_name">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+
+ <!-- (OPTIONAL) use this meta data to indicate which icon should be used in media
+ notifications (for example, when the music changes and the user is
+ looking at another app) -->
+ <meta-data
+ android:name="com.google.android.gms.car.notification.SmallIcon"
+ android:resource="@drawable/ic_notification" />
+
+ <service
+ android:name="com.example.android.mediabrowserservice.MusicService"
+ android:exported="true"
+ >
+ <intent-filter>
+ <action android:name="android.media.browse.MediaBrowserService" />
+ </intent-filter>
+ </service>
+
+ </application>
+
+</manifest>
diff --git a/samples/browseable/MediaBrowserService/_index.jd b/samples/browseable/MediaBrowserService/_index.jd
new file mode 100644
index 000000000..f7454ecee
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/_index.jd
@@ -0,0 +1,17 @@
+page.tags="MediaBrowserService"
+sample.group=Media
+@jd:body
+
+<p>
+
+This sample shows how to implement an audio media app that provides
+media library metadata and playback controls through a standard
+service. It exposes a simple music library through the new
+MediaBrowserService and provides MediaSession callbacks. This allows
+it to be used in Android Auto, for example.
+When not connected to a car, the app has a very simple UI that browses
+the media library and provides simple playback controls. When
+connected to Android Auto, the same service provides data and callback
+to the Android Auto UI in the same manner as it provides them to the
+local UI.
+</p>
diff --git a/samples/browseable/MediaBrowserService/res/drawable-hdpi/ic_launcher.png b/samples/browseable/MediaBrowserService/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 000000000..05ef6f658
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/MediaBrowserService/res/drawable-hdpi/ic_notification.png b/samples/browseable/MediaBrowserService/res/drawable-hdpi/ic_notification.png
new file mode 100644
index 000000000..d8ea5a906
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/res/drawable-hdpi/ic_notification.png
Binary files differ
diff --git a/samples/browseable/MediaBrowserService/res/drawable-hdpi/ic_pause_white_24dp.png b/samples/browseable/MediaBrowserService/res/drawable-hdpi/ic_pause_white_24dp.png
new file mode 100644
index 000000000..b4bdbb558
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/res/drawable-hdpi/ic_pause_white_24dp.png
Binary files differ
diff --git a/samples/browseable/MediaBrowserService/res/drawable-hdpi/ic_play_arrow_white_24dp.png b/samples/browseable/MediaBrowserService/res/drawable-hdpi/ic_play_arrow_white_24dp.png
new file mode 100644
index 000000000..164385d04
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/res/drawable-hdpi/ic_play_arrow_white_24dp.png
Binary files differ
diff --git a/samples/browseable/MediaBrowserService/res/drawable-hdpi/ic_shuffle_white_24dp.png b/samples/browseable/MediaBrowserService/res/drawable-hdpi/ic_shuffle_white_24dp.png
new file mode 100644
index 000000000..3eeb0ef5b
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/res/drawable-hdpi/ic_shuffle_white_24dp.png
Binary files differ
diff --git a/samples/browseable/MediaBrowserService/res/drawable-hdpi/ic_skip_next_white_24dp.png b/samples/browseable/MediaBrowserService/res/drawable-hdpi/ic_skip_next_white_24dp.png
new file mode 100644
index 000000000..4eaf7caab
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/res/drawable-hdpi/ic_skip_next_white_24dp.png
Binary files differ
diff --git a/samples/browseable/MediaBrowserService/res/drawable-hdpi/ic_skip_previous_white_24dp.png b/samples/browseable/MediaBrowserService/res/drawable-hdpi/ic_skip_previous_white_24dp.png
new file mode 100644
index 000000000..e59dedb62
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/res/drawable-hdpi/ic_skip_previous_white_24dp.png
Binary files differ
diff --git a/samples/browseable/MediaBrowserService/res/drawable-mdpi/ic_launcher.png b/samples/browseable/MediaBrowserService/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 000000000..f894fb841
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/MediaBrowserService/res/drawable-xhdpi/ic_equalizer_white_24dp.png b/samples/browseable/MediaBrowserService/res/drawable-xhdpi/ic_equalizer_white_24dp.png
new file mode 100644
index 000000000..dbba844df
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/res/drawable-xhdpi/ic_equalizer_white_24dp.png
Binary files differ
diff --git a/samples/browseable/MediaBrowserService/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/MediaBrowserService/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 000000000..43ade5e69
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/MediaBrowserService/res/drawable-xhdpi/ic_pause_white_24dp.png b/samples/browseable/MediaBrowserService/res/drawable-xhdpi/ic_pause_white_24dp.png
new file mode 100644
index 000000000..14b6d17d4
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/res/drawable-xhdpi/ic_pause_white_24dp.png
Binary files differ
diff --git a/samples/browseable/MediaBrowserService/res/drawable-xhdpi/ic_play_arrow_white_24dp.png b/samples/browseable/MediaBrowserService/res/drawable-xhdpi/ic_play_arrow_white_24dp.png
new file mode 100644
index 000000000..a55d19922
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/res/drawable-xhdpi/ic_play_arrow_white_24dp.png
Binary files differ
diff --git a/samples/browseable/MediaBrowserService/res/drawable-xhdpi/ic_shuffle_white_24dp.png b/samples/browseable/MediaBrowserService/res/drawable-xhdpi/ic_shuffle_white_24dp.png
new file mode 100644
index 000000000..8ce3a6008
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/res/drawable-xhdpi/ic_shuffle_white_24dp.png
Binary files differ
diff --git a/samples/browseable/MediaBrowserService/res/drawable-xhdpi/ic_skip_next_white_24dp.png b/samples/browseable/MediaBrowserService/res/drawable-xhdpi/ic_skip_next_white_24dp.png
new file mode 100644
index 000000000..f282b9245
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/res/drawable-xhdpi/ic_skip_next_white_24dp.png
Binary files differ
diff --git a/samples/browseable/MediaBrowserService/res/drawable-xhdpi/ic_skip_previous_white_24dp.png b/samples/browseable/MediaBrowserService/res/drawable-xhdpi/ic_skip_previous_white_24dp.png
new file mode 100644
index 000000000..2522877df
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/res/drawable-xhdpi/ic_skip_previous_white_24dp.png
Binary files differ
diff --git a/samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_by_genre.png b/samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_by_genre.png
new file mode 100644
index 000000000..da3b4a74c
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_by_genre.png
Binary files differ
diff --git a/samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_default_art.png b/samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_default_art.png
new file mode 100644
index 000000000..dfb9e670a
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_default_art.png
Binary files differ
diff --git a/samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_equalizer_white_24dp.png b/samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_equalizer_white_24dp.png
new file mode 100644
index 000000000..b82a8d98d
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_equalizer_white_24dp.png
Binary files differ
diff --git a/samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 000000000..3058c27f1
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_pause_white_24dp.png b/samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_pause_white_24dp.png
new file mode 100644
index 000000000..72dfa9fa6
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_pause_white_24dp.png
Binary files differ
diff --git a/samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_play_arrow_white_24dp.png b/samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_play_arrow_white_24dp.png
new file mode 100644
index 000000000..043acd808
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_play_arrow_white_24dp.png
Binary files differ
diff --git a/samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_shuffle_white_24dp.png b/samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_shuffle_white_24dp.png
new file mode 100644
index 000000000..718b6b5ce
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_shuffle_white_24dp.png
Binary files differ
diff --git a/samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_skip_next_white_24dp.png b/samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_skip_next_white_24dp.png
new file mode 100644
index 000000000..4fe60888b
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_skip_next_white_24dp.png
Binary files differ
diff --git a/samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_skip_previous_white_24dp.png b/samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_skip_previous_white_24dp.png
new file mode 100644
index 000000000..2c9310af9
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_skip_previous_white_24dp.png
Binary files differ
diff --git a/samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_star_off.png b/samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_star_off.png
new file mode 100644
index 000000000..fb7afb0c9
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_star_off.png
Binary files differ
diff --git a/samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_star_on.png b/samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_star_on.png
new file mode 100644
index 000000000..6f7fc75e1
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/res/drawable-xxhdpi/ic_star_on.png
Binary files differ
diff --git a/samples/browseable/MediaBrowserService/res/drawable-xxxhdpi/ic_launcher.png b/samples/browseable/MediaBrowserService/res/drawable-xxxhdpi/ic_launcher.png
new file mode 100644
index 000000000..6b4e4a219
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/res/drawable-xxxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/MediaBrowserService/res/layout/activity_player.xml b/samples/browseable/MediaBrowserService/res/layout/activity_player.xml
new file mode 100644
index 000000000..21cdbbd9c
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/res/layout/activity_player.xml
@@ -0,0 +1,22 @@
+<!--
+ Copyright (C) 2014 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.
+ -->
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/container"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context=".MusicPlayerActivity"
+ tools:ignore="MergeRootFrame" />
diff --git a/samples/browseable/MediaBrowserService/res/layout/fragment_list.xml b/samples/browseable/MediaBrowserService/res/layout/fragment_list.xml
new file mode 100644
index 000000000..c169fec97
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/res/layout/fragment_list.xml
@@ -0,0 +1,60 @@
+<!--
+ Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:padding="@dimen/fragment_list_padding">
+
+ <LinearLayout
+ android:id="@+id/controls"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+
+ <ImageButton
+ android:id="@+id/skip_previous"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:src="@drawable/ic_skip_previous_white_24dp"
+ android:contentDescription="@string/skip_previous"/>
+
+ <ImageButton
+ android:id="@+id/play_pause"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:src="@drawable/ic_play_arrow_white_24dp"
+ android:contentDescription="@string/play_pause"/>
+
+ <ImageButton
+ android:id="@+id/skip_next"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:src="@drawable/ic_skip_next_white_24dp"
+ android:contentDescription="@string/skip_next"/>
+
+ </LinearLayout>
+
+ <ListView
+ android:id="@+id/list_view"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ </ListView>
+
+</LinearLayout>
diff --git a/samples/browseable/MediaBrowserService/res/layout/media_list_item.xml b/samples/browseable/MediaBrowserService/res/layout/media_list_item.xml
new file mode 100644
index 000000000..72c0ccf35
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/res/layout/media_list_item.xml
@@ -0,0 +1,55 @@
+<!--
+ Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:minHeight="?android:listPreferredItemHeight"
+ android:orientation="horizontal">
+
+ <ImageView
+ android:id="@+id/play_eq"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:contentDescription="@string/play_item"
+ android:src="@drawable/ic_play_arrow_white_24dp"/>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:minHeight="?android:attr/listPreferredItemHeight"
+ android:mode="twoLine"
+ android:padding="@dimen/list_item_padding"
+ android:orientation="vertical">
+
+ <TextView
+ android:id="@+id/title"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="@dimen/margin_text_view"
+ android:layout_marginTop="@dimen/margin_text_view"
+ android:textAppearance="?android:attr/textAppearanceMedium"/>
+
+ <TextView
+ android:id="@+id/description"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="@dimen/margin_text_view"
+ android:layout_marginTop="@dimen/margin_text_view"
+ android:textAppearance="?android:attr/textAppearanceSmall"/>
+
+ </LinearLayout>
+
+</LinearLayout>
diff --git a/samples/browseable/MediaBrowserService/res/values-v21/styles.xml b/samples/browseable/MediaBrowserService/res/values-v21/styles.xml
new file mode 100644
index 000000000..21bb211b7
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/res/values-v21/styles.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014 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="AppBaseTheme" parent="android:Theme.Material">
+ <!-- colorPrimary is used for Notification icon and bottom facet bar icons
+ and overflow actions -->
+ <item name="android:colorPrimary">#ffff5722</item>
+
+ <!-- colorPrimaryDark is used for background -->
+ <item name="android:colorPrimaryDark">#ffbf360c</item>
+
+ <!-- colorAccent is sparingly used for accents, like floating action button highlight,
+ progress on playbar-->
+ <item name="android:colorAccent">#ffff5722</item>
+
+ </style>
+
+</resources>
diff --git a/samples/browseable/MediaBrowserService/res/values/dimens.xml b/samples/browseable/MediaBrowserService/res/values/dimens.xml
new file mode 100644
index 000000000..e57a8c919
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/res/values/dimens.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014 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>
+ <dimen name="fragment_list_padding">16dp</dimen>
+ <dimen name="list_item_padding">4dp</dimen>
+ <dimen name="margin_text_view">6dp</dimen>
+</resources>
diff --git a/samples/browseable/MediaBrowserService/res/values/strings.xml b/samples/browseable/MediaBrowserService/res/values/strings.xml
new file mode 100644
index 000000000..8c88fe3e9
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/res/values/strings.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<resources>
+
+ <string name="app_name">MediaBrowserService Sample</string>
+ <string name="favorite">Favorite</string>
+ <string name="error_no_metadata">Unable to retrieve metadata.</string>
+ <string name="browse_genres">Genres</string>
+ <string name="browse_genre_subtitle">Songs by genre</string>
+ <string name="browse_musics_by_genre_subtitle">%1$s songs</string>
+ <string name="random_queue_title">Random music</string>
+ <string name="error_cannot_skip">Cannot skip</string>
+ <string name="error_loading_media">Error Loading Media</string>
+ <string name="play_item">Play item</string>
+ <string name="skip_previous">Skip to previous</string>
+ <string name="play_pause">play or pause</string>
+ <string name="skip_next">Skip to next</string>
+
+</resources>
diff --git a/samples/browseable/MediaBrowserService/res/values/strings_notifications.xml b/samples/browseable/MediaBrowserService/res/values/strings_notifications.xml
new file mode 100644
index 000000000..f406ba667
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/res/values/strings_notifications.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<resources>
+
+ <string name="label_pause">Pause</string>
+ <string name="label_play">Play</string>
+ <string name="label_previous">Previous</string>
+ <string name="label_next">Next</string>
+ <string name="error_empty_metadata">Empty metadata!</string>
+</resources>
diff --git a/samples/browseable/MediaBrowserService/res/values/styles.xml b/samples/browseable/MediaBrowserService/res/values/styles.xml
new file mode 100644
index 000000000..3be59c152
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/res/values/styles.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014 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="AppTheme" parent="AppBaseTheme">
+ </style>
+
+ <style name="AppBaseTheme" parent="android:Theme.Light">
+ </style>
+
+</resources> \ No newline at end of file
diff --git a/samples/browseable/MediaBrowserService/res/xml/automotive_app_desc.xml b/samples/browseable/MediaBrowserService/res/xml/automotive_app_desc.xml
new file mode 100644
index 000000000..a84750b04
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/res/xml/automotive_app_desc.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014 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.
+ -->
+<automotiveApp>
+ <uses name="media"/>
+</automotiveApp>
diff --git a/samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/BrowseFragment.java b/samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/BrowseFragment.java
new file mode 100644
index 000000000..726ae15b6
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/BrowseFragment.java
@@ -0,0 +1,210 @@
+/*
+ * Copyright (C) 2014 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.mediabrowserservice;
+
+import android.app.Fragment;
+import android.content.ComponentName;
+import android.content.Context;
+import android.media.browse.MediaBrowser;
+import android.media.session.MediaController;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.ImageView;
+import android.widget.ListView;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.example.android.mediabrowserservice.utils.LogHelper;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * A Fragment that lists all the various browsable queues available
+ * from a {@link android.service.media.MediaBrowserService}.
+ * <p/>
+ * It uses a {@link MediaBrowser} to connect to the {@link MusicService}. Once connected,
+ * the fragment subscribes to get all the children. All {@link MediaBrowser.MediaItem}'s
+ * that can be browsed are shown in a ListView.
+ */
+public class BrowseFragment extends Fragment {
+
+ private static final String TAG = BrowseFragment.class.getSimpleName();
+
+ public static final String ARG_MEDIA_ID = "media_id";
+
+ public static interface FragmentDataHelper {
+ void onMediaItemSelected(MediaBrowser.MediaItem item);
+ }
+
+ // The mediaId to be used for subscribing for children using the MediaBrowser.
+ private String mMediaId;
+
+ private MediaBrowser mMediaBrowser;
+ private BrowseAdapter mBrowserAdapter;
+
+ private MediaBrowser.SubscriptionCallback mSubscriptionCallback = new MediaBrowser.SubscriptionCallback() {
+
+ @Override
+ public void onChildrenLoaded(String parentId, List<MediaBrowser.MediaItem> children) {
+ mBrowserAdapter.clear();
+ mBrowserAdapter.notifyDataSetInvalidated();
+ for (MediaBrowser.MediaItem item : children) {
+ mBrowserAdapter.add(item);
+ }
+ mBrowserAdapter.notifyDataSetChanged();
+ }
+
+ @Override
+ public void onError(String id) {
+ Toast.makeText(getActivity(), R.string.error_loading_media,
+ Toast.LENGTH_LONG).show();
+ }
+ };
+
+ private MediaBrowser.ConnectionCallback mConnectionCallback =
+ new MediaBrowser.ConnectionCallback() {
+ @Override
+ public void onConnected() {
+ LogHelper.d(TAG, "onConnected: session token " + mMediaBrowser.getSessionToken());
+
+ if (mMediaId == null) {
+ mMediaId = mMediaBrowser.getRoot();
+ }
+ mMediaBrowser.subscribe(mMediaId, mSubscriptionCallback);
+ if (mMediaBrowser.getSessionToken() == null) {
+ throw new IllegalArgumentException("No Session token");
+ }
+ MediaController mediaController = new MediaController(getActivity(),
+ mMediaBrowser.getSessionToken());
+ getActivity().setMediaController(mediaController);
+ }
+
+ @Override
+ public void onConnectionFailed() {
+ LogHelper.d(TAG, "onConnectionFailed");
+ }
+
+ @Override
+ public void onConnectionSuspended() {
+ LogHelper.d(TAG, "onConnectionSuspended");
+ getActivity().setMediaController(null);
+ }
+ };
+
+ public static BrowseFragment newInstance(String mediaId) {
+ Bundle args = new Bundle();
+ args.putString(ARG_MEDIA_ID, mediaId);
+ BrowseFragment fragment = new BrowseFragment();
+ fragment.setArguments(args);
+ return fragment;
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ View rootView = inflater.inflate(R.layout.fragment_list, container, false);
+
+ mBrowserAdapter = new BrowseAdapter(getActivity());
+
+ View controls = rootView.findViewById(R.id.controls);
+ controls.setVisibility(View.GONE);
+
+ ListView listView = (ListView) rootView.findViewById(R.id.list_view);
+ listView.setAdapter(mBrowserAdapter);
+ listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+ @Override
+ public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+ MediaBrowser.MediaItem item = mBrowserAdapter.getItem(position);
+ try {
+ FragmentDataHelper listener = (FragmentDataHelper) getActivity();
+ listener.onMediaItemSelected(item);
+ } catch (ClassCastException ex) {
+ Log.e(TAG, "Exception trying to cast to FragmentDataHelper", ex);
+ }
+ }
+ });
+
+ Bundle args = getArguments();
+ mMediaId = args.getString(ARG_MEDIA_ID, null);
+
+ mMediaBrowser = new MediaBrowser(getActivity(),
+ new ComponentName(getActivity(), MusicService.class),
+ mConnectionCallback, null);
+
+ return rootView;
+ }
+
+ @Override
+ public void onStart() {
+ super.onStart();
+ mMediaBrowser.connect();
+ }
+
+ @Override
+ public void onStop() {
+ super.onStop();
+ mMediaBrowser.disconnect();
+ }
+
+ // An adapter for showing the list of browsed MediaItem's
+ private static class BrowseAdapter extends ArrayAdapter<MediaBrowser.MediaItem> {
+
+ public BrowseAdapter(Context context) {
+ super(context, R.layout.media_list_item, new ArrayList<MediaBrowser.MediaItem>());
+ }
+
+ static class ViewHolder {
+ ImageView mImageView;
+ TextView mTitleView;
+ TextView mDescriptionView;
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+
+ ViewHolder holder;
+
+ if (convertView == null) {
+ convertView = LayoutInflater.from(getContext())
+ .inflate(R.layout.media_list_item, parent, false);
+ holder = new ViewHolder();
+ holder.mImageView = (ImageView) convertView.findViewById(R.id.play_eq);
+ holder.mImageView.setVisibility(View.GONE);
+ holder.mTitleView = (TextView) convertView.findViewById(R.id.title);
+ holder.mDescriptionView = (TextView) convertView.findViewById(R.id.description);
+ convertView.setTag(holder);
+ } else {
+ holder = (ViewHolder) convertView.getTag();
+ }
+
+ MediaBrowser.MediaItem item = getItem(position);
+ holder.mTitleView.setText(item.getDescription().getTitle());
+ holder.mDescriptionView.setText(item.getDescription().getDescription());
+ if (item.isPlayable()) {
+ holder.mImageView.setImageDrawable(
+ getContext().getDrawable(R.drawable.ic_play_arrow_white_24dp));
+ holder.mImageView.setVisibility(View.VISIBLE);
+ }
+ return convertView;
+ }
+ }
+}
diff --git a/samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/MediaNotification.java b/samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/MediaNotification.java
new file mode 100644
index 000000000..68727239a
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/MediaNotification.java
@@ -0,0 +1,381 @@
+/*
+ * Copyright (C) 2014 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.mediabrowserservice;
+
+import android.app.Notification;
+import android.app.NotificationManager;
+import android.app.PendingIntent;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
+import android.content.res.Resources;
+import android.content.res.TypedArray;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.graphics.Color;
+import android.media.MediaDescription;
+import android.media.MediaMetadata;
+import android.media.session.MediaController;
+import android.media.session.MediaSession;
+import android.media.session.PlaybackState;
+import android.os.AsyncTask;
+import android.util.LruCache;
+
+import com.example.android.mediabrowserservice.utils.BitmapHelper;
+import com.example.android.mediabrowserservice.utils.LogHelper;
+
+import java.io.IOException;
+
+/**
+ * Keeps track of a notification and updates it automatically for a given
+ * MediaSession. Maintaining a visible notification (usually) guarantees that the music service
+ * won't be killed during playback.
+ */
+public class MediaNotification extends BroadcastReceiver {
+ private static final String TAG = "MediaNotification";
+
+ private static final int NOTIFICATION_ID = 412;
+
+ public static final String ACTION_PAUSE = "com.example.android.mediabrowserservice.pause";
+ public static final String ACTION_PLAY = "com.example.android.mediabrowserservice.play";
+ public static final String ACTION_PREV = "com.example.android.mediabrowserservice.prev";
+ public static final String ACTION_NEXT = "com.example.android.mediabrowserservice.next";
+
+ private static final int MAX_ALBUM_ART_CACHE_SIZE = 1024*1024;
+
+ private final MusicService mService;
+ private MediaSession.Token mSessionToken;
+ private MediaController mController;
+ private MediaController.TransportControls mTransportControls;
+ private final LruCache<String, Bitmap> mAlbumArtCache;
+
+ private PlaybackState mPlaybackState;
+ private MediaMetadata mMetadata;
+
+ private Notification.Builder mNotificationBuilder;
+ private NotificationManager mNotificationManager;
+ private Notification.Action mPlayPauseAction;
+
+ private PendingIntent mPauseIntent, mPlayIntent, mPreviousIntent, mNextIntent;
+
+ private String mCurrentAlbumArt;
+ private int mNotificationColor;
+
+ private boolean mStarted = false;
+
+ public MediaNotification(MusicService service) {
+ mService = service;
+ updateSessionToken();
+
+ // simple album art cache that holds no more than
+ // MAX_ALBUM_ART_CACHE_SIZE bytes:
+ mAlbumArtCache = new LruCache<String, Bitmap>(MAX_ALBUM_ART_CACHE_SIZE) {
+ @Override
+ protected int sizeOf(String key, Bitmap value) {
+ return value.getByteCount();
+ }
+ };
+
+ mNotificationColor = getNotificationColor();
+
+ mNotificationManager = (NotificationManager) mService
+ .getSystemService(Context.NOTIFICATION_SERVICE);
+
+ String pkg = mService.getPackageName();
+ mPauseIntent = PendingIntent.getBroadcast(mService, 100,
+ new Intent(ACTION_PAUSE).setPackage(pkg), PendingIntent.FLAG_CANCEL_CURRENT);
+ mPlayIntent = PendingIntent.getBroadcast(mService, 100,
+ new Intent(ACTION_PLAY).setPackage(pkg), PendingIntent.FLAG_CANCEL_CURRENT);
+ mPreviousIntent = PendingIntent.getBroadcast(mService, 100,
+ new Intent(ACTION_PREV).setPackage(pkg), PendingIntent.FLAG_CANCEL_CURRENT);
+ mNextIntent = PendingIntent.getBroadcast(mService, 100,
+ new Intent(ACTION_NEXT).setPackage(pkg), PendingIntent.FLAG_CANCEL_CURRENT);
+ }
+
+ protected int getNotificationColor() {
+ int notificationColor = 0;
+ String packageName = mService.getPackageName();
+ try {
+ Context packageContext = mService.createPackageContext(packageName, 0);
+ ApplicationInfo applicationInfo =
+ mService.getPackageManager().getApplicationInfo(packageName, 0);
+ packageContext.setTheme(applicationInfo.theme);
+ Resources.Theme theme = packageContext.getTheme();
+ TypedArray ta = theme.obtainStyledAttributes(
+ new int[] {android.R.attr.colorPrimary});
+ notificationColor = ta.getColor(0, Color.DKGRAY);
+ ta.recycle();
+ } catch (PackageManager.NameNotFoundException e) {
+ e.printStackTrace();
+ }
+ return notificationColor;
+ }
+
+ /**
+ * Posts the notification and starts tracking the session to keep it
+ * updated. The notification will automatically be removed if the session is
+ * destroyed before {@link #stopNotification} is called.
+ */
+ public void startNotification() {
+ if (!mStarted) {
+ mController.registerCallback(mCb);
+ IntentFilter filter = new IntentFilter();
+ filter.addAction(ACTION_NEXT);
+ filter.addAction(ACTION_PAUSE);
+ filter.addAction(ACTION_PLAY);
+ filter.addAction(ACTION_PREV);
+ mService.registerReceiver(this, filter);
+
+ mMetadata = mController.getMetadata();
+ mPlaybackState = mController.getPlaybackState();
+
+ mStarted = true;
+ // The notification must be updated after setting started to true
+ updateNotificationMetadata();
+ }
+ }
+
+ /**
+ * Removes the notification and stops tracking the session. If the session
+ * was destroyed this has no effect.
+ */
+ public void stopNotification() {
+ mStarted = false;
+ mController.unregisterCallback(mCb);
+ try {
+ mNotificationManager.cancel(NOTIFICATION_ID);
+ mService.unregisterReceiver(this);
+ } catch (IllegalArgumentException ex) {
+ // ignore if the receiver is not registered.
+ }
+ mService.stopForeground(true);
+ }
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ final String action = intent.getAction();
+ LogHelper.d(TAG, "Received intent with action " + action);
+ if (ACTION_PAUSE.equals(action)) {
+ mTransportControls.pause();
+ } else if (ACTION_PLAY.equals(action)) {
+ mTransportControls.play();
+ } else if (ACTION_NEXT.equals(action)) {
+ mTransportControls.skipToNext();
+ } else if (ACTION_PREV.equals(action)) {
+ mTransportControls.skipToPrevious();
+ }
+ }
+
+ /**
+ * Update the state based on a change on the session token. Called either when
+ * we are running for the first time or when the media session owner has destroyed the session
+ * (see {@link android.media.session.MediaController.Callback#onSessionDestroyed()})
+ */
+ private void updateSessionToken() {
+ MediaSession.Token freshToken = mService.getSessionToken();
+ if (mSessionToken == null || !mSessionToken.equals(freshToken)) {
+ if (mController != null) {
+ mController.unregisterCallback(mCb);
+ }
+ mSessionToken = freshToken;
+ mController = new MediaController(mService, mSessionToken);
+ mTransportControls = mController.getTransportControls();
+ if (mStarted) {
+ mController.registerCallback(mCb);
+ }
+ }
+ }
+
+ private final MediaController.Callback mCb = new MediaController.Callback() {
+ @Override
+ public void onPlaybackStateChanged(PlaybackState state) {
+ mPlaybackState = state;
+ LogHelper.d(TAG, "Received new playback state", state);
+ updateNotificationPlaybackState();
+ }
+
+ @Override
+ public void onMetadataChanged(MediaMetadata metadata) {
+ mMetadata = metadata;
+ LogHelper.d(TAG, "Received new metadata ", metadata);
+ updateNotificationMetadata();
+ }
+
+ @Override
+ public void onSessionDestroyed() {
+ super.onSessionDestroyed();
+ LogHelper.d(TAG, "Session was destroyed, resetting to the new session token");
+ updateSessionToken();
+ }
+ };
+
+ private void updateNotificationMetadata() {
+ LogHelper.d(TAG, "updateNotificationMetadata. mMetadata=" + mMetadata);
+ if (mMetadata == null || mPlaybackState == null) {
+ return;
+ }
+
+ updatePlayPauseAction();
+
+ mNotificationBuilder = new Notification.Builder(mService);
+ int playPauseActionIndex = 0;
+
+ // If skip to previous action is enabled
+ if ((mPlaybackState.getActions() & PlaybackState.ACTION_SKIP_TO_PREVIOUS) != 0) {
+ mNotificationBuilder
+ .addAction(R.drawable.ic_skip_previous_white_24dp,
+ mService.getString(R.string.label_previous), mPreviousIntent);
+ playPauseActionIndex = 1;
+ }
+
+ mNotificationBuilder.addAction(mPlayPauseAction);
+
+ // If skip to next action is enabled
+ if ((mPlaybackState.getActions() & PlaybackState.ACTION_SKIP_TO_NEXT) != 0) {
+ mNotificationBuilder.addAction(R.drawable.ic_skip_next_white_24dp,
+ mService.getString(R.string.label_next), mNextIntent);
+ }
+
+ MediaDescription description = mMetadata.getDescription();
+
+ String fetchArtUrl = null;
+ Bitmap art = description.getIconBitmap();
+ if (art == null && description.getIconUri() != null) {
+ // This sample assumes the iconUri will be a valid URL formatted String, but
+ // it can actually be any valid Android Uri formatted String.
+ // async fetch the album art icon
+ String artUrl = description.getIconUri().toString();
+ art = mAlbumArtCache.get(artUrl);
+ if (art == null) {
+ fetchArtUrl = artUrl;
+ // use a placeholder art while the remote art is being downloaded
+ art = BitmapFactory.decodeResource(mService.getResources(), R.drawable.ic_default_art);
+ }
+ }
+
+ mNotificationBuilder
+ .setStyle(new Notification.MediaStyle()
+ .setShowActionsInCompactView(playPauseActionIndex) // only show play/pause in compact view
+ .setMediaSession(mSessionToken))
+ .setColor(mNotificationColor)
+ .setSmallIcon(R.drawable.ic_notification)
+ .setVisibility(Notification.VISIBILITY_PUBLIC)
+ .setUsesChronometer(true)
+ .setContentTitle(description.getTitle())
+ .setContentText(description.getSubtitle())
+ .setLargeIcon(art);
+
+ updateNotificationPlaybackState();
+
+ mService.startForeground(NOTIFICATION_ID, mNotificationBuilder.build());
+ if (fetchArtUrl != null) {
+ fetchBitmapFromURLAsync(fetchArtUrl);
+ }
+ }
+
+ private void updatePlayPauseAction() {
+ LogHelper.d(TAG, "updatePlayPauseAction");
+ String label;
+ int icon;
+ PendingIntent intent;
+ if (mPlaybackState.getState() == PlaybackState.STATE_PLAYING) {
+ label = mService.getString(R.string.label_pause);
+ icon = R.drawable.ic_pause_white_24dp;
+ intent = mPauseIntent;
+ } else {
+ label = mService.getString(R.string.label_play);
+ icon = R.drawable.ic_play_arrow_white_24dp;
+ intent = mPlayIntent;
+ }
+ if (mPlayPauseAction == null) {
+ mPlayPauseAction = new Notification.Action(icon, label, intent);
+ } else {
+ mPlayPauseAction.icon = icon;
+ mPlayPauseAction.title = label;
+ mPlayPauseAction.actionIntent = intent;
+ }
+ }
+
+ private void updateNotificationPlaybackState() {
+ LogHelper.d(TAG, "updateNotificationPlaybackState. mPlaybackState=" + mPlaybackState);
+ if (mPlaybackState == null || !mStarted) {
+ LogHelper.d(TAG, "updateNotificationPlaybackState. cancelling notification!");
+ mService.stopForeground(true);
+ return;
+ }
+ if (mNotificationBuilder == null) {
+ LogHelper.d(TAG, "updateNotificationPlaybackState. there is no notificationBuilder. Ignoring request to update state!");
+ return;
+ }
+ if (mPlaybackState.getPosition() >= 0) {
+ LogHelper.d(TAG, "updateNotificationPlaybackState. updating playback position to ",
+ (System.currentTimeMillis() - mPlaybackState.getPosition()) / 1000, " seconds");
+ mNotificationBuilder
+ .setWhen(System.currentTimeMillis() - mPlaybackState.getPosition())
+ .setShowWhen(true)
+ .setUsesChronometer(true);
+ mNotificationBuilder.setShowWhen(true);
+ } else {
+ LogHelper.d(TAG, "updateNotificationPlaybackState. hiding playback position");
+ mNotificationBuilder
+ .setWhen(0)
+ .setShowWhen(false)
+ .setUsesChronometer(false);
+ }
+
+ updatePlayPauseAction();
+
+ // Make sure that the notification can be dismissed by the user when we are not playing:
+ mNotificationBuilder.setOngoing(mPlaybackState.getState() == PlaybackState.STATE_PLAYING);
+
+ mNotificationManager.notify(NOTIFICATION_ID, mNotificationBuilder.build());
+ }
+
+ public void fetchBitmapFromURLAsync(final String source) {
+ LogHelper.d(TAG, "getBitmapFromURLAsync: starting asynctask to fetch ", source);
+ new AsyncTask<Void, Void, Bitmap>() {
+ @Override
+ protected Bitmap doInBackground(Void[] objects) {
+ Bitmap bitmap = null;
+ try {
+ bitmap = BitmapHelper.fetchAndRescaleBitmap(source,
+ BitmapHelper.MEDIA_ART_BIG_WIDTH, BitmapHelper.MEDIA_ART_BIG_HEIGHT);
+ mAlbumArtCache.put(source, bitmap);
+ } catch (IOException e) {
+ LogHelper.e(TAG, e, "getBitmapFromURLAsync: " + source);
+ }
+ return bitmap;
+ }
+
+ @Override
+ protected void onPostExecute(Bitmap bitmap) {
+ if (bitmap != null && mMetadata != null &&
+ mNotificationBuilder != null && mMetadata.getDescription() != null &&
+ !source.equals(mMetadata.getDescription().getIconUri())) {
+ // If the media is still the same, update the notification:
+ LogHelper.d(TAG, "getBitmapFromURLAsync: set bitmap to ", source);
+ mNotificationBuilder.setLargeIcon(bitmap);
+ mNotificationManager.notify(NOTIFICATION_ID, mNotificationBuilder.build());
+ }
+ }
+ }.execute();
+ }
+
+}
diff --git a/samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/MusicPlayerActivity.java b/samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/MusicPlayerActivity.java
new file mode 100644
index 000000000..394b01ad2
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/MusicPlayerActivity.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2014 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.mediabrowserservice;
+
+import android.app.Activity;
+import android.media.browse.MediaBrowser;
+import android.os.Bundle;
+
+/**
+ * Main activity for the music player.
+ */
+public class MusicPlayerActivity extends Activity
+ implements BrowseFragment.FragmentDataHelper {
+
+ private static final String TAG = MusicPlayerActivity.class.getSimpleName();
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_player);
+ if (savedInstanceState == null) {
+ getFragmentManager().beginTransaction()
+ .add(R.id.container, BrowseFragment.newInstance(null))
+ .commit();
+ }
+ }
+
+ @Override
+ public void onMediaItemSelected(MediaBrowser.MediaItem item) {
+ if (item.isPlayable()) {
+ getMediaController().getTransportControls().playFromMediaId(item.getMediaId(), null);
+ QueueFragment queueFragment = QueueFragment.newInstance();
+ getFragmentManager().beginTransaction()
+ .replace(R.id.container, queueFragment)
+ .addToBackStack(null)
+ .commit();
+ } else if (item.isBrowsable()) {
+ getFragmentManager().beginTransaction()
+ .replace(R.id.container, BrowseFragment.newInstance(item.getMediaId()))
+ .addToBackStack(null)
+ .commit();
+ }
+ }
+}
diff --git a/samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/MusicService.java b/samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/MusicService.java
new file mode 100644
index 000000000..b48242664
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/MusicService.java
@@ -0,0 +1,947 @@
+/*
+ * Copyright (C) 2014 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.mediabrowserservice;
+
+import android.content.Context;
+import android.content.Intent;
+import android.media.AudioManager;
+import android.media.MediaDescription;
+import android.media.MediaMetadata;
+import android.media.MediaPlayer;
+import android.media.MediaPlayer.OnCompletionListener;
+import android.media.MediaPlayer.OnErrorListener;
+import android.media.MediaPlayer.OnPreparedListener;
+import android.media.browse.MediaBrowser;
+import android.media.browse.MediaBrowser.MediaItem;
+import android.media.session.MediaSession;
+import android.media.session.PlaybackState;
+import android.net.Uri;
+import android.net.wifi.WifiManager;
+import android.net.wifi.WifiManager.WifiLock;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.os.PowerManager;
+import android.os.SystemClock;
+import android.service.media.MediaBrowserService;
+
+import com.example.android.mediabrowserservice.model.MusicProvider;
+import com.example.android.mediabrowserservice.utils.LogHelper;
+import com.example.android.mediabrowserservice.utils.MediaIDHelper;
+import com.example.android.mediabrowserservice.utils.QueueHelper;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import static com.example.android.mediabrowserservice.utils.MediaIDHelper.MEDIA_ID_MUSICS_BY_GENRE;
+import static com.example.android.mediabrowserservice.utils.MediaIDHelper.MEDIA_ID_ROOT;
+import static com.example.android.mediabrowserservice.utils.MediaIDHelper.createBrowseCategoryMediaID;
+import static com.example.android.mediabrowserservice.utils.MediaIDHelper.extractBrowseCategoryFromMediaID;
+
+/**
+ * This class provides a MediaBrowser through a service. It exposes the media library to a browsing
+ * client, through the onGetRoot and onLoadChildren methods. It also creates a MediaSession and
+ * exposes it through its MediaSession.Token, which allows the client to create a MediaController
+ * that connects to and send control commands to the MediaSession remotely. This is useful for
+ * user interfaces that need to interact with your media session, like Android Auto. You can
+ * (should) also use the same service from your app's UI, which gives a seamless playback
+ * experience to the user.
+ *
+ * To implement a MediaBrowserService, you need to:
+ *
+ * <ul>
+ *
+ * <li> Extend {@link android.service.media.MediaBrowserService}, implementing the media browsing
+ * related methods {@link android.service.media.MediaBrowserService#onGetRoot} and
+ * {@link android.service.media.MediaBrowserService#onLoadChildren};
+ * <li> In onCreate, start a new {@link android.media.session.MediaSession} and notify its parent
+ * with the session's token {@link android.service.media.MediaBrowserService#setSessionToken};
+ *
+ * <li> Set a callback on the
+ * {@link android.media.session.MediaSession#setCallback(android.media.session.MediaSession.Callback)}.
+ * The callback will receive all the user's actions, like play, pause, etc;
+ *
+ * <li> Handle all the actual music playing using any method your app prefers (for example,
+ * {@link android.media.MediaPlayer})
+ *
+ * <li> Update playbackState, "now playing" metadata and queue, using MediaSession proper methods
+ * {@link android.media.session.MediaSession#setPlaybackState(android.media.session.PlaybackState)}
+ * {@link android.media.session.MediaSession#setMetadata(android.media.MediaMetadata)} and
+ * {@link android.media.session.MediaSession#setQueue(java.util.List)})
+ *
+ * <li> Declare and export the service in AndroidManifest with an intent receiver for the action
+ * android.media.browse.MediaBrowserService
+ *
+ * </ul>
+ *
+ * To make your app compatible with Android Auto, you also need to:
+ *
+ * <ul>
+ *
+ * <li> Declare a meta-data tag in AndroidManifest.xml linking to a xml resource
+ * with a &lt;automotiveApp&gt; root element. For a media app, this must include
+ * an &lt;uses name="media"/&gt; element as a child.
+ * For example, in AndroidManifest.xml:
+ * &lt;meta-data android:name="com.google.android.gms.car.application"
+ * android:resource="@xml/automotive_app_desc"/&gt;
+ * And in res/values/automotive_app_desc.xml:
+ * &lt;automotiveApp&gt;
+ * &lt;uses name="media"/&gt;
+ * &lt;/automotiveApp&gt;
+ *
+ * </ul>
+
+ * @see <a href="README.md">README.md</a> for more details.
+ *
+ */
+
+public class MusicService extends MediaBrowserService implements OnPreparedListener,
+ OnCompletionListener, OnErrorListener, AudioManager.OnAudioFocusChangeListener {
+
+ private static final String TAG = "MusicService";
+
+ // Action to thumbs up a media item
+ private static final String CUSTOM_ACTION_THUMBS_UP = "thumbs_up";
+ // Delay stopSelf by using a handler.
+ private static final int STOP_DELAY = 30000;
+
+ // The volume we set the media player to when we lose audio focus, but are
+ // allowed to reduce the volume instead of stopping playback.
+ public static final float VOLUME_DUCK = 0.2f;
+
+ // The volume we set the media player when we have audio focus.
+ public static final float VOLUME_NORMAL = 1.0f;
+ public static final String ANDROID_AUTO_PACKAGE_NAME = "com.google.android.projection.gearhead";
+ public static final String ANDROID_AUTO_SIMULATOR_PACKAGE_NAME = "com.google.android.mediasimulator";
+
+ // Music catalog manager
+ private MusicProvider mMusicProvider;
+
+ private MediaSession mSession;
+ private MediaPlayer mMediaPlayer;
+
+ // "Now playing" queue:
+ private List<MediaSession.QueueItem> mPlayingQueue;
+ private int mCurrentIndexOnQueue;
+
+ // Current local media player state
+ private int mState = PlaybackState.STATE_NONE;
+
+ // Wifi lock that we hold when streaming files from the internet, in order
+ // to prevent the device from shutting off the Wifi radio
+ private WifiLock mWifiLock;
+
+ private MediaNotification mMediaNotification;
+
+ // Indicates whether the service was started.
+ private boolean mServiceStarted;
+
+ enum AudioFocus {
+ NoFocusNoDuck, // we don't have audio focus, and can't duck
+ NoFocusCanDuck, // we don't have focus, but can play at a low volume
+ // ("ducking")
+ Focused // we have full audio focus
+ }
+
+ // Type of audio focus we have:
+ private AudioFocus mAudioFocus = AudioFocus.NoFocusNoDuck;
+ private AudioManager mAudioManager;
+
+ // Indicates if we should start playing immediately after we gain focus.
+ private boolean mPlayOnFocusGain;
+
+ private Handler mDelayedStopHandler = new Handler() {
+ @Override
+ public void handleMessage(Message msg) {
+ if ((mMediaPlayer != null && mMediaPlayer.isPlaying()) ||
+ mPlayOnFocusGain) {
+ LogHelper.d(TAG, "Ignoring delayed stop since the media player is in use.");
+ return;
+ }
+ LogHelper.d(TAG, "Stopping service with delay handler.");
+ stopSelf();
+ mServiceStarted = false;
+ }
+ };
+
+ /*
+ * (non-Javadoc)
+ * @see android.app.Service#onCreate()
+ */
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ LogHelper.d(TAG, "onCreate");
+
+ mPlayingQueue = new ArrayList<>();
+
+ // Create the Wifi lock (this does not acquire the lock, this just creates it)
+ mWifiLock = ((WifiManager) getSystemService(Context.WIFI_SERVICE))
+ .createWifiLock(WifiManager.WIFI_MODE_FULL, "MusicDemo_lock");
+
+
+ // Create the music catalog metadata provider
+ mMusicProvider = new MusicProvider();
+ mMusicProvider.retrieveMedia(new MusicProvider.Callback() {
+ @Override
+ public void onMusicCatalogReady(boolean success) {
+ mState = success ? PlaybackState.STATE_NONE : PlaybackState.STATE_ERROR;
+ }
+ });
+
+ mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
+
+ // Start a new MediaSession
+ mSession = new MediaSession(this, "MusicService");
+ setSessionToken(mSession.getSessionToken());
+ mSession.setCallback(new MediaSessionCallback());
+ mSession.setFlags(MediaSession.FLAG_HANDLES_MEDIA_BUTTONS |
+ MediaSession.FLAG_HANDLES_TRANSPORT_CONTROLS);
+
+ // Use these extras to reserve space for the corresponding actions, even when they are disabled
+ // in the playbackstate, so the custom actions don't reflow.
+ Bundle extras = new Bundle();
+ extras.putBoolean(
+ "com.google.android.gms.car.media.ALWAYS_RESERVE_SPACE_FOR.ACTION_SKIP_TO_NEXT",
+ true);
+ extras.putBoolean(
+ "com.google.android.gms.car.media.ALWAYS_RESERVE_SPACE_FOR.ACTION_SKIP_TO_PREVIOUS",
+ true);
+ // If you want to reserve the Queue slot when there is no queue
+ // (mSession.setQueue(emptylist)), uncomment the lines below:
+ // extras.putBoolean(
+ // "com.google.android.gms.car.media.ALWAYS_RESERVE_SPACE_FOR.ACTION_QUEUE",
+ // true);
+ mSession.setExtras(extras);
+
+ updatePlaybackState(null);
+
+ mMediaNotification = new MediaNotification(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see android.app.Service#onDestroy()
+ */
+ @Override
+ public void onDestroy() {
+ LogHelper.d(TAG, "onDestroy");
+
+ // Service is being killed, so make sure we release our resources
+ handleStopRequest(null);
+
+ mDelayedStopHandler.removeCallbacksAndMessages(null);
+ // In particular, always release the MediaSession to clean up resources
+ // and notify associated MediaController(s).
+ mSession.release();
+ }
+
+
+ @Override
+ public BrowserRoot onGetRoot(String clientPackageName, int clientUid, Bundle rootHints) {
+ LogHelper.d(TAG, "OnGetRoot: clientPackageName=" + clientPackageName,
+ "; clientUid=" + clientUid + " ; rootHints=", rootHints);
+ // To ensure you are not allowing any arbitrary app to browse your app's contents, you
+ // need to check the origin:
+ if (!PackageValidator.isCallerAllowed(this, clientPackageName, clientUid)) {
+ // If the request comes from an untrusted package, return null. No further calls will
+ // be made to other media browsing methods.
+ LogHelper.w(TAG, "OnGetRoot: IGNORING request from untrusted package "
+ + clientPackageName);
+ return null;
+ }
+ if (ANDROID_AUTO_PACKAGE_NAME.equals(clientPackageName)) {
+ // Optional: if your app needs to adapt ads, music library or anything else that
+ // needs to run differently when connected to the car, this is where you should handle
+ // it.
+ }
+ return new BrowserRoot(MEDIA_ID_ROOT, null);
+ }
+
+ @Override
+ public void onLoadChildren(final String parentMediaId, final Result<List<MediaItem>> result) {
+ if (!mMusicProvider.isInitialized()) {
+ // Use result.detach to allow calling result.sendResult from another thread:
+ result.detach();
+
+ mMusicProvider.retrieveMedia(new MusicProvider.Callback() {
+ @Override
+ public void onMusicCatalogReady(boolean success) {
+ if (success) {
+ loadChildrenImpl(parentMediaId, result);
+ } else {
+ updatePlaybackState(getString(R.string.error_no_metadata));
+ result.sendResult(new ArrayList<MediaItem>());
+ }
+ }
+ });
+
+ } else {
+ // If our music catalog is already loaded/cached, load them into result immediately
+ loadChildrenImpl(parentMediaId, result);
+ }
+ }
+
+ /**
+ * Actual implementation of onLoadChildren that assumes that MusicProvider is already
+ * initialized.
+ */
+ private void loadChildrenImpl(final String parentMediaId,
+ final Result<List<MediaBrowser.MediaItem>> result) {
+ LogHelper.d(TAG, "OnLoadChildren: parentMediaId=", parentMediaId);
+
+ List<MediaBrowser.MediaItem> mediaItems = new ArrayList<>();
+
+ if (MEDIA_ID_ROOT.equals(parentMediaId)) {
+ LogHelper.d(TAG, "OnLoadChildren.ROOT");
+ mediaItems.add(new MediaBrowser.MediaItem(
+ new MediaDescription.Builder()
+ .setMediaId(MEDIA_ID_MUSICS_BY_GENRE)
+ .setTitle(getString(R.string.browse_genres))
+ .setIconUri(Uri.parse("android.resource://" +
+ "com.example.android.mediabrowserservice/drawable/ic_by_genre"))
+ .setSubtitle(getString(R.string.browse_genre_subtitle))
+ .build(), MediaBrowser.MediaItem.FLAG_BROWSABLE
+ ));
+
+ } else if (MEDIA_ID_MUSICS_BY_GENRE.equals(parentMediaId)) {
+ LogHelper.d(TAG, "OnLoadChildren.GENRES");
+ for (String genre: mMusicProvider.getGenres()) {
+ MediaBrowser.MediaItem item = new MediaBrowser.MediaItem(
+ new MediaDescription.Builder()
+ .setMediaId(createBrowseCategoryMediaID(MEDIA_ID_MUSICS_BY_GENRE, genre))
+ .setTitle(genre)
+ .setSubtitle(getString(R.string.browse_musics_by_genre_subtitle, genre))
+ .build(), MediaBrowser.MediaItem.FLAG_BROWSABLE
+ );
+ mediaItems.add(item);
+ }
+
+ } else if (parentMediaId.startsWith(MEDIA_ID_MUSICS_BY_GENRE)) {
+ String genre = extractBrowseCategoryFromMediaID(parentMediaId)[1];
+ LogHelper.d(TAG, "OnLoadChildren.SONGS_BY_GENRE genre=", genre);
+ for (MediaMetadata track: mMusicProvider.getMusicsByGenre(genre)) {
+ // Since mediaMetadata fields are immutable, we need to create a copy, so we
+ // can set a hierarchy-aware mediaID. We will need to know the media hierarchy
+ // when we get a onPlayFromMusicID call, so we can create the proper queue based
+ // on where the music was selected from (by artist, by genre, random, etc)
+ String hierarchyAwareMediaID = MediaIDHelper.createTrackMediaID(
+ MEDIA_ID_MUSICS_BY_GENRE, genre, track);
+ MediaMetadata trackCopy = new MediaMetadata.Builder(track)
+ .putString(MediaMetadata.METADATA_KEY_MEDIA_ID, hierarchyAwareMediaID)
+ .build();
+ MediaBrowser.MediaItem bItem = new MediaBrowser.MediaItem(
+ trackCopy.getDescription(), MediaItem.FLAG_PLAYABLE);
+ mediaItems.add(bItem);
+ }
+ } else {
+ LogHelper.w(TAG, "Skipping unmatched parentMediaId: ", parentMediaId);
+ }
+ result.sendResult(mediaItems);
+ }
+
+
+
+ private final class MediaSessionCallback extends MediaSession.Callback {
+ @Override
+ public void onPlay() {
+ LogHelper.d(TAG, "play");
+
+ if (mPlayingQueue == null || mPlayingQueue.isEmpty()) {
+ mPlayingQueue = QueueHelper.getRandomQueue(mMusicProvider);
+ mSession.setQueue(mPlayingQueue);
+ mSession.setQueueTitle(getString(R.string.random_queue_title));
+ // start playing from the beginning of the queue
+ mCurrentIndexOnQueue = 0;
+ }
+
+ if (mPlayingQueue != null && !mPlayingQueue.isEmpty()) {
+ handlePlayRequest();
+ }
+ }
+
+ @Override
+ public void onSkipToQueueItem(long queueId) {
+ LogHelper.d(TAG, "OnSkipToQueueItem:" + queueId);
+
+ if (mState == PlaybackState.STATE_PAUSED) {
+ mState = PlaybackState.STATE_STOPPED;
+ }
+
+ if (mPlayingQueue != null && !mPlayingQueue.isEmpty()) {
+
+ // set the current index on queue from the music Id:
+ mCurrentIndexOnQueue = QueueHelper.getMusicIndexOnQueue(mPlayingQueue, queueId);
+
+ // play the music
+ handlePlayRequest();
+ }
+ }
+
+ @Override
+ public void onPlayFromMediaId(String mediaId, Bundle extras) {
+ LogHelper.d(TAG, "playFromMediaId mediaId:", mediaId, " extras=", extras);
+
+ if (mState == PlaybackState.STATE_PAUSED) {
+ mState = PlaybackState.STATE_STOPPED;
+ }
+
+ // The mediaId used here is not the unique musicId. This one comes from the
+ // MediaBrowser, and is actually a "hierarchy-aware mediaID": a concatenation of
+ // the hierarchy in MediaBrowser and the actual unique musicID. This is necessary
+ // so we can build the correct playing queue, based on where the track was
+ // selected from.
+ mPlayingQueue = QueueHelper.getPlayingQueue(mediaId, mMusicProvider);
+ mSession.setQueue(mPlayingQueue);
+ String queueTitle = getString(R.string.browse_musics_by_genre_subtitle,
+ MediaIDHelper.extractBrowseCategoryValueFromMediaID(mediaId));
+ mSession.setQueueTitle(queueTitle);
+
+ if (mPlayingQueue != null && !mPlayingQueue.isEmpty()) {
+ String uniqueMusicID = MediaIDHelper.extractMusicIDFromMediaID(mediaId);
+
+ // set the current index on queue from the music Id:
+ mCurrentIndexOnQueue = QueueHelper.getMusicIndexOnQueue(
+ mPlayingQueue, uniqueMusicID);
+
+ // play the music
+ handlePlayRequest();
+ }
+ }
+
+ @Override
+ public void onPause() {
+ LogHelper.d(TAG, "pause. current state=" + mState);
+ handlePauseRequest();
+ }
+
+ @Override
+ public void onStop() {
+ LogHelper.d(TAG, "stop. current state=" + mState);
+ handleStopRequest(null);
+ }
+
+ @Override
+ public void onSkipToNext() {
+ LogHelper.d(TAG, "skipToNext");
+ mCurrentIndexOnQueue++;
+ if (mPlayingQueue != null && mCurrentIndexOnQueue >= mPlayingQueue.size()) {
+ mCurrentIndexOnQueue = 0;
+ }
+ if (QueueHelper.isIndexPlayable(mCurrentIndexOnQueue, mPlayingQueue)) {
+ mState = PlaybackState.STATE_STOPPED;
+ handlePlayRequest();
+ } else {
+ LogHelper.e(TAG, "skipToNext: cannot skip to next. next Index=" +
+ mCurrentIndexOnQueue + " queue length=" +
+ (mPlayingQueue == null ? "null" : mPlayingQueue.size()));
+ handleStopRequest("Cannot skip");
+ }
+ }
+
+ @Override
+ public void onSkipToPrevious() {
+ LogHelper.d(TAG, "skipToPrevious");
+ mCurrentIndexOnQueue--;
+ if (mPlayingQueue != null && mCurrentIndexOnQueue < 0) {
+ // This sample's behavior: skipping to previous when in first song restarts the
+ // first song.
+ mCurrentIndexOnQueue = 0;
+ }
+ if (QueueHelper.isIndexPlayable(mCurrentIndexOnQueue, mPlayingQueue)) {
+ mState = PlaybackState.STATE_STOPPED;
+ handlePlayRequest();
+ } else {
+ LogHelper.e(TAG, "skipToPrevious: cannot skip to previous. previous Index=" +
+ mCurrentIndexOnQueue + " queue length=" +
+ (mPlayingQueue == null ? "null" : mPlayingQueue.size()));
+ handleStopRequest("Cannot skip");
+ }
+ }
+
+ @Override
+ public void onCustomAction(String action, Bundle extras) {
+ if (CUSTOM_ACTION_THUMBS_UP.equals(action)) {
+ LogHelper.i(TAG, "onCustomAction: favorite for current track");
+ MediaMetadata track = getCurrentPlayingMusic();
+ if (track != null) {
+ String mediaId = track.getString(MediaMetadata.METADATA_KEY_MEDIA_ID);
+ mMusicProvider.setFavorite(mediaId, !mMusicProvider.isFavorite(mediaId));
+ }
+ updatePlaybackState(null);
+ } else {
+ LogHelper.e(TAG, "Unsupported action: ", action);
+ }
+
+ }
+
+ @Override
+ public void onPlayFromSearch(String query, Bundle extras) {
+ LogHelper.d(TAG, "playFromSearch query=", query);
+
+ if (mState == PlaybackState.STATE_PAUSED) {
+ mState = PlaybackState.STATE_STOPPED;
+ }
+
+ mPlayingQueue = QueueHelper.getPlayingQueueFromSearch(query, mMusicProvider);
+ LogHelper.d(TAG, "playFromSearch playqueue.length=" + mPlayingQueue.size());
+ mSession.setQueue(mPlayingQueue);
+
+ if (mPlayingQueue != null && !mPlayingQueue.isEmpty()) {
+ // start playing from the beginning of the queue
+ mCurrentIndexOnQueue = 0;
+
+ handlePlayRequest();
+ }
+ }
+ }
+
+
+
+ /*
+ * Called when media player is done playing current song.
+ * @see android.media.MediaPlayer.OnCompletionListener
+ */
+ @Override
+ public void onCompletion(MediaPlayer player) {
+ LogHelper.d(TAG, "onCompletion from MediaPlayer");
+ // The media player finished playing the current song, so we go ahead
+ // and start the next.
+ if (mPlayingQueue != null && !mPlayingQueue.isEmpty()) {
+ // In this sample, we restart the playing queue when it gets to the end:
+ mCurrentIndexOnQueue++;
+ if (mCurrentIndexOnQueue >= mPlayingQueue.size()) {
+ mCurrentIndexOnQueue = 0;
+ }
+ handlePlayRequest();
+ } else {
+ // If there is nothing to play, we stop and release the resources:
+ handleStopRequest(null);
+ }
+ }
+
+ /*
+ * Called when media player is done preparing.
+ * @see android.media.MediaPlayer.OnPreparedListener
+ */
+ @Override
+ public void onPrepared(MediaPlayer player) {
+ LogHelper.d(TAG, "onPrepared from MediaPlayer");
+ // The media player is done preparing. That means we can start playing if we
+ // have audio focus.
+ configMediaPlayerState();
+ }
+
+ /**
+ * Called when there's an error playing media. When this happens, the media
+ * player goes to the Error state. We warn the user about the error and
+ * reset the media player.
+ *
+ * @see android.media.MediaPlayer.OnErrorListener
+ */
+ @Override
+ public boolean onError(MediaPlayer mp, int what, int extra) {
+ LogHelper.e(TAG, "Media player error: what=" + what + ", extra=" + extra);
+ handleStopRequest("MediaPlayer error " + what + " (" + extra + ")");
+ return true; // true indicates we handled the error
+ }
+
+
+
+
+ /**
+ * Called by AudioManager on audio focus changes.
+ */
+ @Override
+ public void onAudioFocusChange(int focusChange) {
+ LogHelper.d(TAG, "onAudioFocusChange. focusChange=" + focusChange);
+ if (focusChange == AudioManager.AUDIOFOCUS_GAIN) {
+ // We have gained focus:
+ mAudioFocus = AudioFocus.Focused;
+
+ } else if (focusChange == AudioManager.AUDIOFOCUS_LOSS ||
+ focusChange == AudioManager.AUDIOFOCUS_LOSS_TRANSIENT ||
+ focusChange == AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK) {
+ // We have lost focus. If we can duck (low playback volume), we can keep playing.
+ // Otherwise, we need to pause the playback.
+ boolean canDuck = focusChange == AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK;
+ mAudioFocus = canDuck ? AudioFocus.NoFocusCanDuck : AudioFocus.NoFocusNoDuck;
+
+ // If we are playing, we need to reset media player by calling configMediaPlayerState
+ // with mAudioFocus properly set.
+ if (mState == PlaybackState.STATE_PLAYING && !canDuck) {
+ // If we don't have audio focus and can't duck, we save the information that
+ // we were playing, so that we can resume playback once we get the focus back.
+ mPlayOnFocusGain = true;
+ }
+ } else {
+ LogHelper.e(TAG, "onAudioFocusChange: Ignoring unsupported focusChange: " + focusChange);
+ }
+
+ configMediaPlayerState();
+ }
+
+
+
+ /**
+ * Handle a request to play music
+ */
+ private void handlePlayRequest() {
+ LogHelper.d(TAG, "handlePlayRequest: mState=" + mState);
+
+ mDelayedStopHandler.removeCallbacksAndMessages(null);
+ if (!mServiceStarted) {
+ LogHelper.v(TAG, "Starting service");
+ // The MusicService needs to keep running even after the calling MediaBrowser
+ // is disconnected. Call startService(Intent) and then stopSelf(..) when we no longer
+ // need to play media.
+ startService(new Intent(getApplicationContext(), MusicService.class));
+ mServiceStarted = true;
+ }
+
+ mPlayOnFocusGain = true;
+ tryToGetAudioFocus();
+
+ if (!mSession.isActive()) {
+ mSession.setActive(true);
+ }
+
+ // actually play the song
+ if (mState == PlaybackState.STATE_PAUSED) {
+ // If we're paused, just continue playback and restore the
+ // 'foreground service' state.
+ configMediaPlayerState();
+ } else {
+ // If we're stopped or playing a song,
+ // just go ahead to the new song and (re)start playing
+ playCurrentSong();
+ }
+ }
+
+
+ /**
+ * Handle a request to pause music
+ */
+ private void handlePauseRequest() {
+ LogHelper.d(TAG, "handlePauseRequest: mState=" + mState);
+
+ if (mState == PlaybackState.STATE_PLAYING) {
+ // Pause media player and cancel the 'foreground service' state.
+ mState = PlaybackState.STATE_PAUSED;
+ if (mMediaPlayer.isPlaying()) {
+ mMediaPlayer.pause();
+ }
+ // while paused, retain the MediaPlayer but give up audio focus
+ relaxResources(false);
+ giveUpAudioFocus();
+ }
+ updatePlaybackState(null);
+ }
+
+ /**
+ * Handle a request to stop music
+ */
+ private void handleStopRequest(String withError) {
+ LogHelper.d(TAG, "handleStopRequest: mState=" + mState + " error=", withError);
+ mState = PlaybackState.STATE_STOPPED;
+
+ // let go of all resources...
+ relaxResources(true);
+ giveUpAudioFocus();
+ updatePlaybackState(withError);
+
+ mMediaNotification.stopNotification();
+
+ // service is no longer necessary. Will be started again if needed.
+ stopSelf();
+ mServiceStarted = false;
+ }
+
+ /**
+ * Releases resources used by the service for playback. This includes the
+ * "foreground service" status, the wake locks and possibly the MediaPlayer.
+ *
+ * @param releaseMediaPlayer Indicates whether the Media Player should also
+ * be released or not
+ */
+ private void relaxResources(boolean releaseMediaPlayer) {
+ LogHelper.d(TAG, "relaxResources. releaseMediaPlayer=" + releaseMediaPlayer);
+ // stop being a foreground service
+ stopForeground(true);
+
+ // reset the delayed stop handler.
+ mDelayedStopHandler.removeCallbacksAndMessages(null);
+ mDelayedStopHandler.sendEmptyMessageDelayed(0, STOP_DELAY);
+
+ // stop and release the Media Player, if it's available
+ if (releaseMediaPlayer && mMediaPlayer != null) {
+ mMediaPlayer.reset();
+ mMediaPlayer.release();
+ mMediaPlayer = null;
+ }
+
+ // we can also release the Wifi lock, if we're holding it
+ if (mWifiLock.isHeld()) {
+ mWifiLock.release();
+ }
+ }
+
+ /**
+ * Reconfigures MediaPlayer according to audio focus settings and
+ * starts/restarts it. This method starts/restarts the MediaPlayer
+ * respecting the current audio focus state. So if we have focus, it will
+ * play normally; if we don't have focus, it will either leave the
+ * MediaPlayer paused or set it to a low volume, depending on what is
+ * allowed by the current focus settings. This method assumes mPlayer !=
+ * null, so if you are calling it, you have to do so from a context where
+ * you are sure this is the case.
+ */
+ private void configMediaPlayerState() {
+ LogHelper.d(TAG, "configAndStartMediaPlayer. mAudioFocus=" + mAudioFocus);
+ if (mAudioFocus == AudioFocus.NoFocusNoDuck) {
+ // If we don't have audio focus and can't duck, we have to pause,
+ if (mState == PlaybackState.STATE_PLAYING) {
+ handlePauseRequest();
+ }
+ } else { // we have audio focus:
+ if (mAudioFocus == AudioFocus.NoFocusCanDuck) {
+ mMediaPlayer.setVolume(VOLUME_DUCK, VOLUME_DUCK); // we'll be relatively quiet
+ } else {
+ mMediaPlayer.setVolume(VOLUME_NORMAL, VOLUME_NORMAL); // we can be loud again
+ }
+ // If we were playing when we lost focus, we need to resume playing.
+ if (mPlayOnFocusGain) {
+ if (!mMediaPlayer.isPlaying()) {
+ LogHelper.d(TAG, "configAndStartMediaPlayer startMediaPlayer.");
+ mMediaPlayer.start();
+ }
+ mPlayOnFocusGain = false;
+ mState = PlaybackState.STATE_PLAYING;
+ }
+ }
+ updatePlaybackState(null);
+ }
+
+ /**
+ * Makes sure the media player exists and has been reset. This will create
+ * the media player if needed, or reset the existing media player if one
+ * already exists.
+ */
+ private void createMediaPlayerIfNeeded() {
+ LogHelper.d(TAG, "createMediaPlayerIfNeeded. needed? " + (mMediaPlayer==null));
+ if (mMediaPlayer == null) {
+ mMediaPlayer = new MediaPlayer();
+
+ // Make sure the media player will acquire a wake-lock while
+ // playing. If we don't do that, the CPU might go to sleep while the
+ // song is playing, causing playback to stop.
+ mMediaPlayer.setWakeMode(getApplicationContext(), PowerManager.PARTIAL_WAKE_LOCK);
+
+ // we want the media player to notify us when it's ready preparing,
+ // and when it's done playing:
+ mMediaPlayer.setOnPreparedListener(this);
+ mMediaPlayer.setOnCompletionListener(this);
+ mMediaPlayer.setOnErrorListener(this);
+ } else {
+ mMediaPlayer.reset();
+ }
+ }
+
+ /**
+ * Starts playing the current song in the playing queue.
+ */
+ void playCurrentSong() {
+ MediaMetadata track = getCurrentPlayingMusic();
+ if (track == null) {
+ LogHelper.e(TAG, "playSong: ignoring request to play next song, because cannot" +
+ " find it." +
+ " currentIndex=" + mCurrentIndexOnQueue +
+ " playQueue.size=" + (mPlayingQueue==null?"null": mPlayingQueue.size()));
+ return;
+ }
+ String source = track.getString(MusicProvider.CUSTOM_METADATA_TRACK_SOURCE);
+ LogHelper.d(TAG, "playSong: current (" + mCurrentIndexOnQueue + ") in playingQueue. " +
+ " musicId=" + track.getString(MediaMetadata.METADATA_KEY_MEDIA_ID) +
+ " source=" + source);
+
+ mState = PlaybackState.STATE_STOPPED;
+ relaxResources(false); // release everything except MediaPlayer
+
+ try {
+ createMediaPlayerIfNeeded();
+
+ mState = PlaybackState.STATE_BUFFERING;
+
+ mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
+ mMediaPlayer.setDataSource(source);
+
+ // Starts preparing the media player in the background. When
+ // it's done, it will call our OnPreparedListener (that is,
+ // the onPrepared() method on this class, since we set the
+ // listener to 'this'). Until the media player is prepared,
+ // we *cannot* call start() on it!
+ mMediaPlayer.prepareAsync();
+
+ // If we are streaming from the internet, we want to hold a
+ // Wifi lock, which prevents the Wifi radio from going to
+ // sleep while the song is playing.
+ mWifiLock.acquire();
+
+ updatePlaybackState(null);
+ updateMetadata();
+
+ } catch (IOException ex) {
+ LogHelper.e(TAG, ex, "IOException playing song");
+ updatePlaybackState(ex.getMessage());
+ }
+ }
+
+
+
+ private void updateMetadata() {
+ if (!QueueHelper.isIndexPlayable(mCurrentIndexOnQueue, mPlayingQueue)) {
+ LogHelper.e(TAG, "Can't retrieve current metadata.");
+ mState = PlaybackState.STATE_ERROR;
+ updatePlaybackState(getResources().getString(R.string.error_no_metadata));
+ return;
+ }
+ MediaSession.QueueItem queueItem = mPlayingQueue.get(mCurrentIndexOnQueue);
+ String mediaId = queueItem.getDescription().getMediaId();
+ MediaMetadata track = mMusicProvider.getMusic(mediaId);
+ String trackId = track.getString(MediaMetadata.METADATA_KEY_MEDIA_ID);
+ if (!mediaId.equals(trackId)) {
+ throw new IllegalStateException("track ID (" + trackId + ") " +
+ "should match mediaId (" + mediaId + ")");
+ }
+ LogHelper.d(TAG, "Updating metadata for MusicID= " + mediaId);
+ mSession.setMetadata(track);
+ }
+
+
+ /**
+ * Update the current media player state, optionally showing an error message.
+ *
+ * @param error if not null, error message to present to the user.
+ *
+ */
+ private void updatePlaybackState(String error) {
+
+ LogHelper.d(TAG, "updatePlaybackState, setting session playback state to " + mState);
+ long position = PlaybackState.PLAYBACK_POSITION_UNKNOWN;
+ if (mMediaPlayer != null && mMediaPlayer.isPlaying()) {
+ position = mMediaPlayer.getCurrentPosition();
+ }
+ PlaybackState.Builder stateBuilder = new PlaybackState.Builder()
+ .setActions(getAvailableActions());
+
+ setCustomAction(stateBuilder);
+
+ // If there is an error message, send it to the playback state:
+ if (error != null) {
+ // Error states are really only supposed to be used for errors that cause playback to
+ // stop unexpectedly and persist until the user takes action to fix it.
+ stateBuilder.setErrorMessage(error);
+ mState = PlaybackState.STATE_ERROR;
+ }
+ stateBuilder.setState(mState, position, 1.0f, SystemClock.elapsedRealtime());
+
+ // Set the activeQueueItemId if the current index is valid.
+ if (QueueHelper.isIndexPlayable(mCurrentIndexOnQueue, mPlayingQueue)) {
+ MediaSession.QueueItem item = mPlayingQueue.get(mCurrentIndexOnQueue);
+ stateBuilder.setActiveQueueItemId(item.getQueueId());
+ }
+
+ mSession.setPlaybackState(stateBuilder.build());
+
+ if (mState == PlaybackState.STATE_PLAYING || mState == PlaybackState.STATE_PAUSED) {
+ mMediaNotification.startNotification();
+ }
+ }
+
+ private void setCustomAction(PlaybackState.Builder stateBuilder) {
+ MediaMetadata currentMusic = getCurrentPlayingMusic();
+ if (currentMusic != null) {
+ // Set appropriate "Favorite" icon on Custom action:
+ String mediaId = currentMusic.getString(MediaMetadata.METADATA_KEY_MEDIA_ID);
+ int favoriteIcon = R.drawable.ic_star_off;
+ if (mMusicProvider.isFavorite(mediaId)) {
+ favoriteIcon = R.drawable.ic_star_on;
+ }
+ LogHelper.d(TAG, "updatePlaybackState, setting Favorite custom action of music ",
+ mediaId, " current favorite=", mMusicProvider.isFavorite(mediaId));
+ stateBuilder.addCustomAction(CUSTOM_ACTION_THUMBS_UP, getString(R.string.favorite),
+ favoriteIcon);
+ }
+ }
+
+ private long getAvailableActions() {
+ long actions = PlaybackState.ACTION_PLAY | PlaybackState.ACTION_PLAY_FROM_MEDIA_ID |
+ PlaybackState.ACTION_PLAY_FROM_SEARCH;
+ if (mPlayingQueue == null || mPlayingQueue.isEmpty()) {
+ return actions;
+ }
+ if (mState == PlaybackState.STATE_PLAYING) {
+ actions |= PlaybackState.ACTION_PAUSE;
+ }
+ if (mCurrentIndexOnQueue > 0) {
+ actions |= PlaybackState.ACTION_SKIP_TO_PREVIOUS;
+ }
+ if (mCurrentIndexOnQueue < mPlayingQueue.size() - 1) {
+ actions |= PlaybackState.ACTION_SKIP_TO_NEXT;
+ }
+ return actions;
+ }
+
+ private MediaMetadata getCurrentPlayingMusic() {
+ if (QueueHelper.isIndexPlayable(mCurrentIndexOnQueue, mPlayingQueue)) {
+ MediaSession.QueueItem item = mPlayingQueue.get(mCurrentIndexOnQueue);
+ if (item != null) {
+ LogHelper.d(TAG, "getCurrentPlayingMusic for musicId=",
+ item.getDescription().getMediaId());
+ return mMusicProvider.getMusic(item.getDescription().getMediaId());
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Try to get the system audio focus.
+ */
+ void tryToGetAudioFocus() {
+ LogHelper.d(TAG, "tryToGetAudioFocus");
+ if (mAudioFocus != AudioFocus.Focused) {
+ int result = mAudioManager.requestAudioFocus(this, AudioManager.STREAM_MUSIC,
+ AudioManager.AUDIOFOCUS_GAIN);
+ if (result == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
+ mAudioFocus = AudioFocus.Focused;
+ }
+ }
+ }
+
+ /**
+ * Give up the audio focus.
+ */
+ void giveUpAudioFocus() {
+ LogHelper.d(TAG, "giveUpAudioFocus");
+ if (mAudioFocus == AudioFocus.Focused) {
+ if (mAudioManager.abandonAudioFocus(this) == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
+ mAudioFocus = AudioFocus.NoFocusNoDuck;
+ }
+ }
+ }
+}
diff --git a/samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/PackageValidator.java b/samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/PackageValidator.java
new file mode 100644
index 000000000..090b6a49f
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/PackageValidator.java
@@ -0,0 +1,216 @@
+/*
+ * Copyright (C) 2014 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.mediabrowserservice;
+
+import java.io.UnsupportedEncodingException;
+import java.util.Arrays;
+
+import android.content.Context;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.os.Build;
+import android.os.Process;
+import android.util.Base64;
+import android.util.Log;
+
+/**
+ * Validates that the calling package is authorized to use this
+ * {@link android.service.media.MediaBrowserService}.
+ */
+public class PackageValidator {
+ public static final String TAG = "PackageValidator";
+
+ // Replace with your package whitelist
+ static final byte[][] VALID_PUBLIC_SIGNATURES = new byte[][]{
+ // Android Auto release public key
+ extractKey(
+ "\060\202\003\275\060\202\002\245\240\003\002\001\002\002\011\000\307\217\236\113" +
+ "\223\101\060\006\060\015\006\011\052\206\110\206\367\015\001\001\005\005\000\060" +
+ "\165\061\013\060\011\006\003\125\004\006\023\002\125\123\061\023\060\021\006\003" +
+ "\125\004\010\014\012\103\141\154\151\146\157\162\156\151\141\061\026\060\024\006" +
+ "\003\125\004\007\014\015\115\157\165\156\164\141\151\156\040\126\151\145\167\061" +
+ "\024\060\022\006\003\125\004\012\014\013\107\157\157\147\154\145\040\111\156\143" +
+ "\056\061\020\060\016\006\003\125\004\013\014\007\101\156\144\162\157\151\144\061" +
+ "\021\060\017\006\003\125\004\003\014\010\147\145\141\162\150\145\141\144\060\036" +
+ "\027\015\061\064\060\065\062\067\062\063\060\065\063\064\132\027\015\064\061\061" +
+ "\060\061\062\062\063\060\065\063\064\132\060\165\061\013\060\011\006\003\125\004" +
+ "\006\023\002\125\123\061\023\060\021\006\003\125\004\010\014\012\103\141\154\151" +
+ "\146\157\162\156\151\141\061\026\060\024\006\003\125\004\007\014\015\115\157\165" +
+ "\156\164\141\151\156\040\126\151\145\167\061\024\060\022\006\003\125\004\012\014" +
+ "\013\107\157\157\147\154\145\040\111\156\143\056\061\020\060\016\006\003\125\004" +
+ "\013\014\007\101\156\144\162\157\151\144\061\021\060\017\006\003\125\004\003\014" +
+ "\010\147\145\141\162\150\145\141\144\060\202\001\042\060\015\006\011\052\206\110" +
+ "\206\367\015\001\001\001\005\000\003\202\001\017\000\060\202\001\012\002\202\001" +
+ "\001\000\323\235\027\016\103\110\261\124\114\137\154\023\275\132\145\244\053\270" +
+ "\072\331\362\064\255\257\344\036\317\113\340\340\202\141\366\312\346\142\302\224" +
+ "\356\255\322\203\103\324\175\123\074\107\365\116\045\260\057\246\043\025\344\210" +
+ "\026\012\041\143\125\200\313\142\116\014\144\023\056\334\201\153\335\140\170\015" +
+ "\142\221\156\360\214\131\051\200\362\135\353\076\323\152\137\276\233\272\334\302" +
+ "\001\017\363\347\275\121\142\246\215\150\122\266\337\172\330\376\232\272\004\246" +
+ "\071\300\357\130\024\113\103\244\370\176\227\131\153\046\157\314\105\035\005\114" +
+ "\241\225\204\043\073\024\047\151\341\233\301\034\234\371\000\075\363\131\000\157" +
+ "\276\134\263\321\072\204\120\011\253\060\311\213\035\343\142\156\140\003\367\013" +
+ "\006\156\204\067\024\154\305\246\223\272\301\213\320\125\103\310\046\222\266\360" +
+ "\252\217\170\003\272\222\264\265\051\334\334\202\232\122\222\130\166\231\323\224" +
+ "\254\244\103\360\261\367\055\221\255\050\134\156\133\206\004\372\353\261\014\013" +
+ "\064\076\142\301\115\326\202\121\057\264\052\372\143\020\214\122\154\337\002\003" +
+ "\001\000\001\243\120\060\116\060\035\006\003\125\035\016\004\026\004\024\032\360" +
+ "\137\140\327\256\350\224\211\122\162\131\012\046\201\032\311\327\316\333\060\037" +
+ "\006\003\125\035\043\004\030\060\026\200\024\032\360\137\140\327\256\350\224\211" +
+ "\122\162\131\012\046\201\032\311\327\316\333\060\014\006\003\125\035\023\004\005" +
+ "\060\003\001\001\377\060\015\006\011\052\206\110\206\367\015\001\001\005\005\000" +
+ "\003\202\001\001\000\224\153\003\143\101\017\273\163\101\110\176\144\352\054\077" +
+ "\300\230\175\173\174\114\301\055\173\022\262\206\226\034\226\242\014\111\063\062" +
+ "\343\000\336\240\321\240\217\037\020\170\320\204\002\373\312\200\227\344\113\355" +
+ "\124\061\352\214\155\265\375\046\337\134\224\031\003\334\065\206\355\330\054\101" +
+ "\114\040\053\363\316\150\054\256\155\331\060\042\346\324\063\205\336\231\021\210" +
+ "\241\131\045\026\121\337\327\360\024\021\242\354\133\242\313\075\101\260\100\376" +
+ "\042\061\320\352\103\153\030\200\162\256\302\157\256\323\205\345\331\017\021\256" +
+ "\103\307\346\035\206\313\307\316\051\022\371\267\015\003\201\374\262\014\222\112" +
+ "\120\111\361\002\325\377\250\077\134\301\336\352\317\123\367\122\274\100\377\054" +
+ "\050\016\166\272\161\147\227\142\355\054\022\312\347\276\126\257\323\145\014\267" +
+ "\342\323\362\200\114\303\331\337\041\026\130\177\311\370\126\220\310\263\071\342" +
+ "\027\161\254\225\001\007\115\237\234\351\006\113\232\313\133\044\030\350\320\103" +
+ "\231\023\154\067\003\316\050\016\331\035\253\252\176\207\011\337\145\345\235\026" +
+ "\041"),
+
+ // Android Auto debug public key
+ extractKey(
+ "\060\202\003\275\060\202\002\245\240\003\002\001\002\002\011\000\347\344\006\360" +
+ "\327\303\226\363\060\015\006\011\052\206\110\206\367\015\001\001\005\005\000\060" +
+ "\165\061\013\060\011\006\003\125\004\006\023\002\125\123\061\023\060\021\006\003" +
+ "\125\004\010\014\012\103\141\154\151\146\157\162\156\151\141\061\026\060\024\006" +
+ "\003\125\004\007\014\015\115\157\165\156\164\141\151\156\040\126\151\145\167\061" +
+ "\024\060\022\006\003\125\004\012\014\013\107\157\157\147\154\145\040\111\156\143" +
+ "\056\061\020\060\016\006\003\125\004\013\014\007\101\156\144\162\157\151\144\061" +
+ "\021\060\017\006\003\125\004\003\014\010\147\145\141\162\150\145\141\144\060\036" +
+ "\027\015\061\064\060\065\062\067\062\063\060\062\065\061\132\027\015\064\061\061" +
+ "\060\061\062\062\063\060\062\065\061\132\060\165\061\013\060\011\006\003\125\004" +
+ "\006\023\002\125\123\061\023\060\021\006\003\125\004\010\014\012\103\141\154\151" +
+ "\146\157\162\156\151\141\061\026\060\024\006\003\125\004\007\014\015\115\157\165" +
+ "\156\164\141\151\156\040\126\151\145\167\061\024\060\022\006\003\125\004\012\014" +
+ "\013\107\157\157\147\154\145\040\111\156\143\056\061\020\060\016\006\003\125\004" +
+ "\013\014\007\101\156\144\162\157\151\144\061\021\060\017\006\003\125\004\003\014" +
+ "\010\147\145\141\162\150\145\141\144\060\202\001\042\060\015\006\011\052\206\110" +
+ "\206\367\015\001\001\001\005\000\003\202\001\017\000\060\202\001\012\002\202\001" +
+ "\001\000\242\356\360\300\022\205\313\071\352\245\032\336\264\235\304\126\236\171" +
+ "\375\212\364\343\320\040\347\011\106\276\260\247\214\203\374\016\263\053\123\353" +
+ "\044\174\247\265\016\154\051\260\263\155\236\030\142\064\177\211\323\115\013\242" +
+ "\115\341\163\310\335\130\247\212\072\212\163\050\140\315\274\277\307\276\164\273" +
+ "\321\234\244\333\250\043\366\073\114\060\174\375\331\246\135\246\154\003\353\261" +
+ "\115\231\071\106\330\121\021\257\344\360\060\076\132\201\243\347\260\124\166\316" +
+ "\126\272\272\005\057\034\154\363\353\226\003\306\220\231\261\017\323\243\014\203" +
+ "\056\174\140\061\250\057\206\364\276\071\354\167\312\035\205\067\272\111\177\004" +
+ "\264\334\247\106\166\105\217\154\272\237\364\127\246\323\333\071\216\067\231\133" +
+ "\363\267\106\011\312\241\023\310\047\204\013\053\275\036\176\060\031\250\234\201" +
+ "\031\300\331\311\003\060\072\317\274\034\211\047\255\247\374\371\304\131\044\074" +
+ "\352\073\036\353\266\331\174\063\162\206\007\141\005\226\064\351\353\361\162\304" +
+ "\222\347\002\216\220\225\171\373\032\266\032\225\062\064\310\265\075\165\002\003" +
+ "\001\000\001\243\120\060\116\060\035\006\003\125\035\016\004\026\004\024\365\003" +
+ "\311\347\022\104\014\017\014\015\003\053\217\110\146\333\360\066\005\031\060\037" +
+ "\006\003\125\035\043\004\030\060\026\200\024\365\003\311\347\022\104\014\017\014" +
+ "\015\003\053\217\110\146\333\360\066\005\031\060\014\006\003\125\035\023\004\005" +
+ "\060\003\001\001\377\060\015\006\011\052\206\110\206\367\015\001\001\005\005\000" +
+ "\003\202\001\001\000\015\312\371\207\121\121\360\212\146\067\210\122\261\100\075" +
+ "\112\160\220\127\045\332\324\144\041\316\224\040\105\261\176\236\231\040\072\175" +
+ "\214\171\272\174\155\335\274\126\227\340\242\200\366\070\023\120\134\045\034\146" +
+ "\111\373\245\150\376\372\353\175\036\023\233\035\126\225\344\123\140\322\227\103" +
+ "\250\271\332\365\006\175\143\212\022\371\232\342\214\256\364\135\237\304\216\126" +
+ "\024\036\370\156\322\222\043\144\006\303\360\051\202\026\132\060\111\036\171\250" +
+ "\044\243\063\230\222\337\262\331\007\175\222\062\275\101\006\046\053\064\013\347" +
+ "\160\250\330\101\122\274\162\324\321\316\032\115\101\003\301\201\160\100\367\305" +
+ "\345\371\335\103\077\055\064\045\144\056\027\113\054\232\022\234\046\353\337\164" +
+ "\111\305\027\261\357\153\034\377\200\044\075\237\066\253\100\215\302\044\037\035" +
+ "\071\165\160\027\311\234\310\064\101\317\202\121\371\200\351\136\216\201\017\347" +
+ "\306\267\136\150\277\354\346\250\057\061\151\077\117\327\362\140\240\065\342\062" +
+ "\034\277\352\274\040\166\057\126\304\367\374\231\276\323\234\020\276\012\113\027" +
+ "\320"),
+ };
+
+ /**
+ * Disallow instantiation of this helper class.
+ */
+ private PackageValidator() {}
+
+ /**
+ * Throws when the caller is not authorized to get data from this MediaBrowserService
+ */
+ public static void checkCallerAllowed(Context context, String callingPackage, int callingUid) {
+ if (!isCallerAllowed(context, callingPackage, callingUid)) {
+ throw new SecurityException("signature check failed.");
+ }
+ }
+
+ /**
+ * @return false if the caller is not authorized to get data from this MediaBrowserService
+ */
+ public static boolean isCallerAllowed(Context context, String callingPackage, int callingUid) {
+ // Always allow calls from the framework or development environment.
+ if (Process.SYSTEM_UID == callingUid || Process.myUid() == callingUid) {
+ return true;
+ }
+ if (BuildConfig.DEBUG) {
+ // When your app is built in debug mode, any app is allowed to connect to it and browse
+ // its media library. If you want to test the behavior of your app when it gets
+ // released, either build a release version or remove this clause.
+ Log.i(TAG, "Allowing caller '"+callingPackage+" because app was built in debug mode.");
+ return true;
+ }
+ PackageInfo packageInfo;
+ final PackageManager packageManager = context.getPackageManager();
+ try {
+ packageInfo = packageManager.getPackageInfo(
+ callingPackage, PackageManager.GET_SIGNATURES);
+ } catch (PackageManager.NameNotFoundException ignored) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "Package manager can't find package " + callingPackage
+ + ", defaulting to false");
+ }
+ return false;
+ }
+ if (packageInfo == null) {
+ Log.w(TAG, "Package manager can't find package: " + callingPackage);
+ return false;
+ }
+
+ if (packageInfo.signatures.length != 1) {
+ Log.w(TAG, "Package has more than one signature.");
+ return false;
+ }
+ final byte[] signature = packageInfo.signatures[0].toByteArray();
+
+ for (int i = 0; i < VALID_PUBLIC_SIGNATURES.length; i++) {
+ byte[] validSignature = VALID_PUBLIC_SIGNATURES[i];
+ if (Arrays.equals(validSignature, signature)) {
+ return true;
+ }
+ }
+
+ if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ Log.v(TAG, "Signature not valid. Found: \n" +
+ Base64.encodeToString(signature, 0));
+ }
+ return false;
+ }
+
+ private static byte[] extractKey(String keyString) {
+ try {
+ return keyString.getBytes("ISO-8859-1");
+ } catch (UnsupportedEncodingException e) {
+ throw new AssertionError(e);
+ }
+ }
+}
diff --git a/samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/QueueAdapter.java b/samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/QueueAdapter.java
new file mode 100644
index 000000000..4f24e9944
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/QueueAdapter.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2014 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.mediabrowserservice;
+
+import android.app.Activity;
+import android.media.session.MediaSession;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import java.util.ArrayList;
+
+/**
+ * A list adapter for items in a queue
+ */
+public class QueueAdapter extends ArrayAdapter<MediaSession.QueueItem> {
+
+ // The currently selected/active queue item Id.
+ private long mActiveQueueItemId = MediaSession.QueueItem.UNKNOWN_ID;
+
+ public QueueAdapter(Activity context) {
+ super(context, R.layout.media_list_item, new ArrayList<MediaSession.QueueItem>());
+ }
+
+ public void setActiveQueueItemId(long id) {
+ this.mActiveQueueItemId = id;
+ }
+
+ private static class ViewHolder {
+ ImageView mImageView;
+ TextView mTitleView;
+ TextView mDescriptionView;
+ }
+
+ public View getView(int position, View convertView, ViewGroup parent) {
+ ViewHolder holder;
+
+ if (convertView == null) {
+ convertView = LayoutInflater.from(getContext())
+ .inflate(R.layout.media_list_item, parent, false);
+ holder = new ViewHolder();
+ holder.mImageView = (ImageView) convertView.findViewById(R.id.play_eq);
+ holder.mTitleView = (TextView) convertView.findViewById(R.id.title);
+ holder.mDescriptionView = (TextView) convertView.findViewById(R.id.description);
+ convertView.setTag(holder);
+ } else {
+ holder = (ViewHolder) convertView.getTag();
+ }
+
+ MediaSession.QueueItem item = getItem(position);
+ holder.mTitleView.setText(item.getDescription().getTitle());
+ if (item.getDescription().getDescription() != null) {
+ holder.mDescriptionView.setText(item.getDescription().getDescription());
+ }
+
+ // If the itemId matches the active Id then use a different icon
+ if (mActiveQueueItemId == item.getQueueId()) {
+ holder.mImageView.setImageDrawable(
+ getContext().getDrawable(R.drawable.ic_equalizer_white_24dp));
+ } else {
+ holder.mImageView.setImageDrawable(
+ getContext().getDrawable(R.drawable.ic_play_arrow_white_24dp));
+ }
+ return convertView;
+ }
+}
diff --git a/samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/QueueFragment.java b/samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/QueueFragment.java
new file mode 100644
index 000000000..f6076bc88
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/QueueFragment.java
@@ -0,0 +1,295 @@
+/*
+ * Copyright (C) 2014 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.mediabrowserservice;
+
+import android.app.Fragment;
+import android.content.ComponentName;
+import android.media.browse.MediaBrowser;
+import android.media.session.MediaController;
+import android.media.session.MediaSession;
+import android.media.session.PlaybackState;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.ImageButton;
+import android.widget.ListView;
+
+import com.example.android.mediabrowserservice.utils.LogHelper;
+
+import java.util.List;
+
+/**
+ * A class that shows the Media Queue to the user.
+ */
+public class QueueFragment extends Fragment {
+
+ private static final String TAG = QueueFragment.class.getSimpleName();
+
+ private ImageButton mSkipNext;
+ private ImageButton mSkipPrevious;
+ private ImageButton mPlayPause;
+
+ private MediaBrowser mMediaBrowser;
+ private MediaController.TransportControls mTransportControls;
+ private MediaController mMediaController;
+ private PlaybackState mPlaybackState;
+
+ private QueueAdapter mQueueAdapter;
+
+ private MediaBrowser.ConnectionCallback mConnectionCallback =
+ new MediaBrowser.ConnectionCallback() {
+ @Override
+ public void onConnected() {
+ LogHelper.d(TAG, "onConnected: session token ", mMediaBrowser.getSessionToken());
+
+ if (mMediaBrowser.getSessionToken() == null) {
+ throw new IllegalArgumentException("No Session token");
+ }
+
+ mMediaController = new MediaController(getActivity(),
+ mMediaBrowser.getSessionToken());
+ mTransportControls = mMediaController.getTransportControls();
+ mMediaController.registerCallback(mSessionCallback);
+
+ getActivity().setMediaController(mMediaController);
+ mPlaybackState = mMediaController.getPlaybackState();
+
+ List<MediaSession.QueueItem> queue = mMediaController.getQueue();
+ if (queue != null) {
+ mQueueAdapter.clear();
+ mQueueAdapter.notifyDataSetInvalidated();
+ mQueueAdapter.addAll(queue);
+ mQueueAdapter.notifyDataSetChanged();
+ }
+ onPlaybackStateChanged(mPlaybackState);
+ }
+
+ @Override
+ public void onConnectionFailed() {
+ LogHelper.d(TAG, "onConnectionFailed");
+ }
+
+ @Override
+ public void onConnectionSuspended() {
+ LogHelper.d(TAG, "onConnectionSuspended");
+ mMediaController.unregisterCallback(mSessionCallback);
+ mTransportControls = null;
+ mMediaController = null;
+ getActivity().setMediaController(null);
+ }
+ };
+
+ // Receive callbacks from the MediaController. Here we update our state such as which queue
+ // is being shown, the current title and description and the PlaybackState.
+ private MediaController.Callback mSessionCallback = new MediaController.Callback() {
+
+ @Override
+ public void onSessionDestroyed() {
+ LogHelper.d(TAG, "Session destroyed. Need to fetch a new Media Session");
+ }
+
+ @Override
+ public void onPlaybackStateChanged(PlaybackState state) {
+ if (state == null) {
+ return;
+ }
+ LogHelper.d(TAG, "Received playback state change to state ", state.getState());
+ mPlaybackState = state;
+ QueueFragment.this.onPlaybackStateChanged(state);
+ }
+
+ @Override
+ public void onQueueChanged(List<MediaSession.QueueItem> queue) {
+ LogHelper.d(TAG, "onQueueChanged ", queue);
+ if (queue != null) {
+ mQueueAdapter.clear();
+ mQueueAdapter.notifyDataSetInvalidated();
+ mQueueAdapter.addAll(queue);
+ mQueueAdapter.notifyDataSetChanged();
+ }
+ }
+ };
+
+ public static QueueFragment newInstance() {
+ return new QueueFragment();
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ View rootView = inflater.inflate(R.layout.fragment_list, container, false);
+
+ mSkipPrevious = (ImageButton) rootView.findViewById(R.id.skip_previous);
+ mSkipPrevious.setEnabled(false);
+ mSkipPrevious.setOnClickListener(mButtonListener);
+
+ mSkipNext = (ImageButton) rootView.findViewById(R.id.skip_next);
+ mSkipNext.setEnabled(false);
+ mSkipNext.setOnClickListener(mButtonListener);
+
+ mPlayPause = (ImageButton) rootView.findViewById(R.id.play_pause);
+ mPlayPause.setEnabled(true);
+ mPlayPause.setOnClickListener(mButtonListener);
+
+ mQueueAdapter = new QueueAdapter(getActivity());
+
+ ListView mListView = (ListView) rootView.findViewById(R.id.list_view);
+ mListView.setAdapter(mQueueAdapter);
+ mListView.setFocusable(true);
+ mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+ @Override
+ public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+ MediaSession.QueueItem item = mQueueAdapter.getItem(position);
+ mTransportControls.skipToQueueItem(item.getQueueId());
+ }
+ });
+
+ mMediaBrowser = new MediaBrowser(getActivity(),
+ new ComponentName(getActivity(), MusicService.class),
+ mConnectionCallback, null);
+
+ return rootView;
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ if (mMediaBrowser != null) {
+ mMediaBrowser.connect();
+ }
+ }
+
+ @Override
+ public void onPause() {
+ super.onPause();
+ if (mMediaController != null) {
+ mMediaController.unregisterCallback(mSessionCallback);
+ }
+ if (mMediaBrowser != null) {
+ mMediaBrowser.disconnect();
+ }
+ }
+
+
+ private void onPlaybackStateChanged(PlaybackState state) {
+ LogHelper.d(TAG, "onPlaybackStateChanged ", state);
+ if (state == null) {
+ return;
+ }
+ mQueueAdapter.setActiveQueueItemId(state.getActiveQueueItemId());
+ mQueueAdapter.notifyDataSetChanged();
+ boolean enablePlay = false;
+ StringBuilder statusBuilder = new StringBuilder();
+ switch (state.getState()) {
+ case PlaybackState.STATE_PLAYING:
+ statusBuilder.append("playing");
+ enablePlay = false;
+ break;
+ case PlaybackState.STATE_PAUSED:
+ statusBuilder.append("paused");
+ enablePlay = true;
+ break;
+ case PlaybackState.STATE_STOPPED:
+ statusBuilder.append("ended");
+ enablePlay = true;
+ break;
+ case PlaybackState.STATE_ERROR:
+ statusBuilder.append("error: ").append(state.getErrorMessage());
+ break;
+ case PlaybackState.STATE_BUFFERING:
+ statusBuilder.append("buffering");
+ break;
+ case PlaybackState.STATE_NONE:
+ statusBuilder.append("none");
+ enablePlay = false;
+ break;
+ case PlaybackState.STATE_CONNECTING:
+ statusBuilder.append("connecting");
+ break;
+ default:
+ statusBuilder.append(mPlaybackState);
+ }
+ statusBuilder.append(" -- At position: ").append(state.getPosition());
+ LogHelper.d(TAG, statusBuilder.toString());
+
+ if (enablePlay) {
+ mPlayPause.setImageDrawable(
+ getActivity().getDrawable(R.drawable.ic_play_arrow_white_24dp));
+ } else {
+ mPlayPause.setImageDrawable(getActivity().getDrawable(R.drawable.ic_pause_white_24dp));
+ }
+
+ mSkipPrevious.setEnabled((state.getActions() & PlaybackState.ACTION_SKIP_TO_PREVIOUS) != 0);
+ mSkipNext.setEnabled((state.getActions() & PlaybackState.ACTION_SKIP_TO_NEXT) != 0);
+
+ LogHelper.d(TAG, "Queue From MediaController *** Title " +
+ mMediaController.getQueueTitle() + "\n: Queue: " + mMediaController.getQueue() +
+ "\n Metadata " + mMediaController.getMetadata());
+ }
+
+ private View.OnClickListener mButtonListener = new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ final int state = mPlaybackState == null ?
+ PlaybackState.STATE_NONE : mPlaybackState.getState();
+ switch (v.getId()) {
+ case R.id.play_pause:
+ LogHelper.d(TAG, "Play button pressed, in state " + state);
+ if (state == PlaybackState.STATE_PAUSED ||
+ state == PlaybackState.STATE_STOPPED ||
+ state == PlaybackState.STATE_NONE) {
+ playMedia();
+ } else if (state == PlaybackState.STATE_PLAYING) {
+ pauseMedia();
+ }
+ break;
+ case R.id.skip_previous:
+ LogHelper.d(TAG, "Start button pressed, in state " + state);
+ skipToPrevious();
+ break;
+ case R.id.skip_next:
+ skipToNext();
+ break;
+ }
+ }
+ };
+
+ private void playMedia() {
+ if (mTransportControls != null) {
+ mTransportControls.play();
+ }
+ }
+
+ private void pauseMedia() {
+ if (mTransportControls != null) {
+ mTransportControls.pause();
+ }
+ }
+
+ private void skipToPrevious() {
+ if (mTransportControls != null) {
+ mTransportControls.skipToPrevious();
+ }
+ }
+
+ private void skipToNext() {
+ if (mTransportControls != null) {
+ mTransportControls.skipToNext();
+ }
+ }
+}
diff --git a/samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/model/MusicProvider.java b/samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/model/MusicProvider.java
new file mode 100644
index 000000000..d0e2e0be3
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/model/MusicProvider.java
@@ -0,0 +1,296 @@
+/*
+ * Copyright (C) 2014 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.mediabrowserservice.model;
+
+import android.media.MediaMetadata;
+import android.os.AsyncTask;
+
+import com.example.android.mediabrowserservice.utils.LogHelper;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URLConnection;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.concurrent.locks.ReentrantLock;
+
+/**
+ * Utility class to get a list of MusicTrack's based on a server-side JSON
+ * configuration.
+ */
+public class MusicProvider {
+
+ private static final String TAG = "MusicProvider";
+
+ private static final String CATALOG_URL = "http://storage.googleapis.com/automotive-media/music.json";
+
+ public static final String CUSTOM_METADATA_TRACK_SOURCE = "__SOURCE__";
+
+ private static String JSON_MUSIC = "music";
+ private static String JSON_TITLE = "title";
+ private static String JSON_ALBUM = "album";
+ private static String JSON_ARTIST = "artist";
+ private static String JSON_GENRE = "genre";
+ private static String JSON_SOURCE = "source";
+ private static String JSON_IMAGE = "image";
+ private static String JSON_TRACK_NUMBER = "trackNumber";
+ private static String JSON_TOTAL_TRACK_COUNT = "totalTrackCount";
+ private static String JSON_DURATION = "duration";
+
+ private final ReentrantLock initializationLock = new ReentrantLock();
+
+ // Categorized caches for music track data:
+ private final HashMap<String, List<MediaMetadata>> mMusicListByGenre;
+ private final HashMap<String, MediaMetadata> mMusicListById;
+
+ private final HashSet<String> mFavoriteTracks;
+
+ enum State {
+ NON_INITIALIZED, INITIALIZING, INITIALIZED;
+ }
+
+ private State mCurrentState = State.NON_INITIALIZED;
+
+
+ public interface Callback {
+ void onMusicCatalogReady(boolean success);
+ }
+
+ public MusicProvider() {
+ mMusicListByGenre = new HashMap<>();
+ mMusicListById = new HashMap<>();
+ mFavoriteTracks = new HashSet<>();
+ }
+
+ /**
+ * Get an iterator over the list of genres
+ *
+ * @return
+ */
+ public Iterable<String> getGenres() {
+ if (mCurrentState != State.INITIALIZED) {
+ return new ArrayList<String>(0);
+ }
+ return mMusicListByGenre.keySet();
+ }
+
+ /**
+ * Get music tracks of the given genre
+ *
+ * @return
+ */
+ public Iterable<MediaMetadata> getMusicsByGenre(String genre) {
+ if (mCurrentState != State.INITIALIZED || !mMusicListByGenre.containsKey(genre)) {
+ return new ArrayList<MediaMetadata>();
+ }
+ return mMusicListByGenre.get(genre);
+ }
+
+ /**
+ * Very basic implementation of a search that filter music tracks which title containing
+ * the given query.
+ *
+ * @return
+ */
+ public Iterable<MediaMetadata> searchMusics(String titleQuery) {
+ ArrayList<MediaMetadata> result = new ArrayList<>();
+ if (mCurrentState != State.INITIALIZED) {
+ return result;
+ }
+ titleQuery = titleQuery.toLowerCase();
+ for (MediaMetadata track: mMusicListById.values()) {
+ if (track.getString(MediaMetadata.METADATA_KEY_TITLE).toLowerCase()
+ .contains(titleQuery)) {
+ result.add(track);
+ }
+ }
+ return result;
+ }
+
+ public MediaMetadata getMusic(String mediaId) {
+ return mMusicListById.get(mediaId);
+ }
+
+ public void setFavorite(String mediaId, boolean favorite) {
+ if (favorite) {
+ mFavoriteTracks.add(mediaId);
+ } else {
+ mFavoriteTracks.remove(mediaId);
+ }
+ }
+
+ public boolean isFavorite(String musicId) {
+ return mFavoriteTracks.contains(musicId);
+ }
+
+ public boolean isInitialized() {
+ return mCurrentState == State.INITIALIZED;
+ }
+
+ /**
+ * Get the list of music tracks from a server and caches the track information
+ * for future reference, keying tracks by mediaId and grouping by genre.
+ *
+ * @return
+ */
+ public void retrieveMedia(final Callback callback) {
+
+ if (mCurrentState == State.INITIALIZED) {
+ // Nothing to do, execute callback immediately
+ callback.onMusicCatalogReady(true);
+ return;
+ }
+
+ // Asynchronously load the music catalog in a separate thread
+ new AsyncTask() {
+ @Override
+ protected Object doInBackground(Object[] objects) {
+ retrieveMediaAsync(callback);
+ return null;
+ }
+ }.execute();
+ }
+
+ private void retrieveMediaAsync(Callback callback) {
+ initializationLock.lock();
+
+ try {
+ if (mCurrentState == State.NON_INITIALIZED) {
+ mCurrentState = State.INITIALIZING;
+
+ int slashPos = CATALOG_URL.lastIndexOf('/');
+ String path = CATALOG_URL.substring(0, slashPos + 1);
+ JSONObject jsonObj = parseUrl(CATALOG_URL);
+
+ JSONArray tracks = jsonObj.getJSONArray(JSON_MUSIC);
+ if (tracks != null) {
+ for (int j = 0; j < tracks.length(); j++) {
+ MediaMetadata item = buildFromJSON(tracks.getJSONObject(j), path);
+ String genre = item.getString(MediaMetadata.METADATA_KEY_GENRE);
+ List<MediaMetadata> list = mMusicListByGenre.get(genre);
+ if (list == null) {
+ list = new ArrayList<>();
+ }
+ list.add(item);
+ mMusicListByGenre.put(genre, list);
+ mMusicListById.put(item.getString(MediaMetadata.METADATA_KEY_MEDIA_ID),
+ item);
+ }
+ }
+ mCurrentState = State.INITIALIZED;
+ }
+ } catch (RuntimeException | JSONException e) {
+ LogHelper.e(TAG, e, "Could not retrieve music list");
+ } finally {
+ if (mCurrentState != State.INITIALIZED) {
+ // Something bad happened, so we reset state to NON_INITIALIZED to allow
+ // retries (eg if the network connection is temporary unavailable)
+ mCurrentState = State.NON_INITIALIZED;
+ }
+ initializationLock.unlock();
+ if (callback != null) {
+ callback.onMusicCatalogReady(mCurrentState == State.INITIALIZED);
+ }
+ }
+ }
+
+ private MediaMetadata buildFromJSON(JSONObject json, String basePath) throws JSONException {
+ String title = json.getString(JSON_TITLE);
+ String album = json.getString(JSON_ALBUM);
+ String artist = json.getString(JSON_ARTIST);
+ String genre = json.getString(JSON_GENRE);
+ String source = json.getString(JSON_SOURCE);
+ String iconUrl = json.getString(JSON_IMAGE);
+ int trackNumber = json.getInt(JSON_TRACK_NUMBER);
+ int totalTrackCount = json.getInt(JSON_TOTAL_TRACK_COUNT);
+ int duration = json.getInt(JSON_DURATION) * 1000; // ms
+
+ LogHelper.d(TAG, "Found music track: ", json);
+
+ // Media is stored relative to JSON file
+ if (!source.startsWith("http")) {
+ source = basePath + source;
+ }
+ if (!iconUrl.startsWith("http")) {
+ iconUrl = basePath + iconUrl;
+ }
+ // Since we don't have a unique ID in the server, we fake one using the hashcode of
+ // the music source. In a real world app, this could come from the server.
+ String id = String.valueOf(source.hashCode());
+
+ // Adding the music source to the MediaMetadata (and consequently using it in the
+ // mediaSession.setMetadata) is not a good idea for a real world music app, because
+ // the session metadata can be accessed by notification listeners. This is done in this
+ // sample for convenience only.
+ return new MediaMetadata.Builder()
+ .putString(MediaMetadata.METADATA_KEY_MEDIA_ID, id)
+ .putString(CUSTOM_METADATA_TRACK_SOURCE, source)
+ .putString(MediaMetadata.METADATA_KEY_ALBUM, album)
+ .putString(MediaMetadata.METADATA_KEY_ARTIST, artist)
+ .putLong(MediaMetadata.METADATA_KEY_DURATION, duration)
+ .putString(MediaMetadata.METADATA_KEY_GENRE, genre)
+ .putString(MediaMetadata.METADATA_KEY_ALBUM_ART_URI, iconUrl)
+ .putString(MediaMetadata.METADATA_KEY_TITLE, title)
+ .putLong(MediaMetadata.METADATA_KEY_TRACK_NUMBER, trackNumber)
+ .putLong(MediaMetadata.METADATA_KEY_NUM_TRACKS, totalTrackCount)
+ .build();
+ }
+
+ /**
+ * Download a JSON file from a server, parse the content and return the JSON
+ * object.
+ *
+ * @param urlString
+ * @return
+ */
+ private JSONObject parseUrl(String urlString) {
+ InputStream is = null;
+ try {
+ java.net.URL url = new java.net.URL(urlString);
+ URLConnection urlConnection = url.openConnection();
+ is = new BufferedInputStream(urlConnection.getInputStream());
+ BufferedReader reader = new BufferedReader(new InputStreamReader(
+ urlConnection.getInputStream(), "iso-8859-1"));
+ StringBuilder sb = new StringBuilder();
+ String line = null;
+ while ((line = reader.readLine()) != null) {
+ sb.append(line);
+ }
+ return new JSONObject(sb.toString());
+ } catch (Exception e) {
+ LogHelper.e(TAG, "Failed to parse the json for media list", e);
+ return null;
+ } finally {
+ if (is != null) {
+ try {
+ is.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/utils/BitmapHelper.java b/samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/utils/BitmapHelper.java
new file mode 100644
index 000000000..5f0e76754
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/utils/BitmapHelper.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2014 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.mediabrowserservice.utils;
+
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+public class BitmapHelper {
+
+ // Bitmap size for album art in media notifications when there are more than 3 playback actions
+ public static final int MEDIA_ART_SMALL_WIDTH=64;
+ public static final int MEDIA_ART_SMALL_HEIGHT=64;
+
+ // Bitmap size for album art in media notifications when there are no more than 3 playback actions
+ public static final int MEDIA_ART_BIG_WIDTH=128;
+ public static final int MEDIA_ART_BIG_HEIGHT=128;
+
+ public static final Bitmap scaleBitmap(int scaleFactor, InputStream is) {
+ // Get the dimensions of the bitmap
+ BitmapFactory.Options bmOptions = new BitmapFactory.Options();
+
+ // Decode the image file into a Bitmap sized to fill the View
+ bmOptions.inJustDecodeBounds = false;
+ bmOptions.inSampleSize = scaleFactor;
+
+ Bitmap bitmap = BitmapFactory.decodeStream(is, null, bmOptions);
+ return bitmap;
+ }
+
+ public static final int findScaleFactor(int targetW, int targetH, InputStream is) {
+ // Get the dimensions of the bitmap
+ BitmapFactory.Options bmOptions = new BitmapFactory.Options();
+ bmOptions.inJustDecodeBounds = true;
+ BitmapFactory.decodeStream(is, null, bmOptions);
+ int actualW = bmOptions.outWidth;
+ int actualH = bmOptions.outHeight;
+
+ // Determine how much to scale down the image
+ return Math.min(actualW/targetW, actualH/targetH);
+ }
+
+ public static final Bitmap fetchAndRescaleBitmap(String uri, int width, int height)
+ throws IOException {
+ URL url = new URL(uri);
+ HttpURLConnection httpConnection = (HttpURLConnection) url.openConnection();
+ httpConnection.setDoInput(true);
+ httpConnection.connect();
+ InputStream inputStream = httpConnection.getInputStream();
+ int scaleFactor = findScaleFactor(width, height, inputStream);
+
+ httpConnection = (HttpURLConnection) url.openConnection();
+ httpConnection.setDoInput(true);
+ httpConnection.connect();
+ inputStream = httpConnection.getInputStream();
+ Bitmap bitmap = scaleBitmap(scaleFactor, inputStream);
+ return bitmap;
+ }
+
+}
diff --git a/samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/utils/LogHelper.java b/samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/utils/LogHelper.java
new file mode 100644
index 000000000..92b2e099e
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/utils/LogHelper.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2014 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.mediabrowserservice.utils;
+
+import android.util.Log;
+
+public class LogHelper {
+ public static void v(String tag, Object... messages) {
+ log(tag, Log.VERBOSE, null, messages);
+ }
+
+ public static void d(String tag, Object... messages) {
+ log(tag, Log.DEBUG, null, messages);
+ }
+
+ public static void i(String tag, Object... messages) {
+ log(tag, Log.INFO, null, messages);
+ }
+
+ public static void w(String tag, Object... messages) {
+ log(tag, Log.WARN, null, messages);
+ }
+
+ public static void w(String tag, Throwable t, Object... messages) {
+ log(tag, Log.WARN, t, messages);
+ }
+
+ public static void e(String tag, Object... messages) {
+ log(tag, Log.ERROR, null, messages);
+ }
+
+ public static void e(String tag, Throwable t, Object... messages) {
+ log(tag, Log.ERROR, t, messages);
+ }
+
+ public static void log(String tag, int level, Throwable t, Object... messages) {
+ if (messages != null && Log.isLoggable(tag, level)) {
+ String message;
+ if (messages.length == 1) {
+ message = messages[0] == null ? null : messages[0].toString();
+ } else {
+ StringBuilder sb = new StringBuilder();
+ for (Object m: messages) {
+ sb.append(m);
+ }
+ if (t != null) {
+ sb.append("\n").append(Log.getStackTraceString(t));
+ }
+ message = sb.toString();
+ }
+ Log.println(level, tag, message);
+ }
+ }
+}
diff --git a/samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/utils/MediaIDHelper.java b/samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/utils/MediaIDHelper.java
new file mode 100644
index 000000000..f66a010f7
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/utils/MediaIDHelper.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2014 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.mediabrowserservice.utils;
+
+import android.media.MediaMetadata;
+
+/**
+ * Utility class to help on queue related tasks.
+ */
+public class MediaIDHelper {
+
+ private static final String TAG = "MediaIDHelper";
+
+ // Media IDs used on browseable items of MediaBrowser
+ public static final String MEDIA_ID_ROOT = "__ROOT__";
+ public static final String MEDIA_ID_MUSICS_BY_GENRE = "__BY_GENRE__";
+
+ public static final String createTrackMediaID(String categoryType, String categoryValue,
+ MediaMetadata track) {
+ // MediaIDs are of the form <categoryType>/<categoryValue>|<musicUniqueId>, to make it easy to
+ // find the category (like genre) that a music was selected from, so we
+ // can correctly build the playing queue. This is specially useful when
+ // one music can appear in more than one list, like "by genre -> genre_1"
+ // and "by artist -> artist_1".
+ return categoryType + "/" + categoryValue + "|" +
+ track.getString(MediaMetadata.METADATA_KEY_MEDIA_ID);
+ }
+
+ public static final String createBrowseCategoryMediaID(String categoryType, String categoryValue) {
+ return categoryType + "/" + categoryValue;
+ }
+
+ /**
+ * Extracts unique musicID from the mediaID. mediaID is, by this sample's convention, a
+ * concatenation of category (eg "by_genre"), categoryValue (eg "Classical") and unique
+ * musicID. This is necessary so we know where the user selected the music from, when the music
+ * exists in more than one music list, and thus we are able to correctly build the playing queue.
+ *
+ * @param musicID
+ * @return
+ */
+ public static final String extractMusicIDFromMediaID(String musicID) {
+ String[] segments = musicID.split("\\|", 2);
+ return segments.length == 2 ? segments[1] : null;
+ }
+
+ /**
+ * Extracts category and categoryValue from the mediaID. mediaID is, by this sample's
+ * convention, a concatenation of category (eg "by_genre"), categoryValue (eg "Classical") and
+ * mediaID. This is necessary so we know where the user selected the music from, when the music
+ * exists in more than one music list, and thus we are able to correctly build the playing queue.
+ *
+ * @param mediaID
+ * @return
+ */
+ public static final String[] extractBrowseCategoryFromMediaID(String mediaID) {
+ if (mediaID.indexOf('|') >= 0) {
+ mediaID = mediaID.split("\\|")[0];
+ }
+ if (mediaID.indexOf('/') == 0) {
+ return new String[]{mediaID, null};
+ } else {
+ return mediaID.split("/", 2);
+ }
+ }
+
+ public static final String extractBrowseCategoryValueFromMediaID(String mediaID) {
+ String[] categoryAndValue = extractBrowseCategoryFromMediaID(mediaID);
+ if (categoryAndValue != null && categoryAndValue.length == 2) {
+ return categoryAndValue[1];
+ }
+ return null;
+ }
+} \ No newline at end of file
diff --git a/samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/utils/QueueHelper.java b/samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/utils/QueueHelper.java
new file mode 100644
index 000000000..980efaafb
--- /dev/null
+++ b/samples/browseable/MediaBrowserService/src/com.example.android.mediabrowserservice/utils/QueueHelper.java
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2014 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.mediabrowserservice.utils;
+
+import android.media.MediaMetadata;
+import android.media.session.MediaSession;
+
+import com.example.android.mediabrowserservice.model.MusicProvider;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import static com.example.android.mediabrowserservice.utils.MediaIDHelper.MEDIA_ID_MUSICS_BY_GENRE;
+
+/**
+ * Utility class to help on queue related tasks.
+ */
+public class QueueHelper {
+
+ private static final String TAG = "QueueHelper";
+
+ public static final List<MediaSession.QueueItem> getPlayingQueue(String mediaId,
+ MusicProvider musicProvider) {
+
+ // extract the category and unique music ID from the media ID:
+ String[] category = MediaIDHelper.extractBrowseCategoryFromMediaID(mediaId);
+
+ // This sample only supports genre category.
+ if (!category[0].equals(MEDIA_ID_MUSICS_BY_GENRE) || category.length != 2) {
+ LogHelper.e(TAG, "Could not build a playing queue for this mediaId: ", mediaId);
+ return null;
+ }
+
+ String categoryValue = category[1];
+ LogHelper.e(TAG, "Creating playing queue for musics of genre ", categoryValue);
+
+ List<MediaSession.QueueItem> queue = convertToQueue(
+ musicProvider.getMusicsByGenre(categoryValue));
+
+ return queue;
+ }
+
+ public static final List<MediaSession.QueueItem> getPlayingQueueFromSearch(String query,
+ MusicProvider musicProvider) {
+
+ LogHelper.e(TAG, "Creating playing queue for musics from search ", query);
+
+ return convertToQueue(musicProvider.searchMusics(query));
+ }
+
+
+ public static final int getMusicIndexOnQueue(Iterable<MediaSession.QueueItem> queue,
+ String mediaId) {
+ int index = 0;
+ for (MediaSession.QueueItem item: queue) {
+ if (mediaId.equals(item.getDescription().getMediaId())) {
+ return index;
+ }
+ index++;
+ }
+ return -1;
+ }
+
+ public static final int getMusicIndexOnQueue(Iterable<MediaSession.QueueItem> queue,
+ long queueId) {
+ int index = 0;
+ for (MediaSession.QueueItem item: queue) {
+ if (queueId == item.getQueueId()) {
+ return index;
+ }
+ index++;
+ }
+ return -1;
+ }
+
+ private static final List<MediaSession.QueueItem> convertToQueue(
+ Iterable<MediaMetadata> tracks) {
+ List<MediaSession.QueueItem> queue = new ArrayList<>();
+ int count = 0;
+ for (MediaMetadata track : tracks) {
+ // We don't expect queues to change after created, so we use the item index as the
+ // queueId. Any other number unique in the queue would work.
+ MediaSession.QueueItem item = new MediaSession.QueueItem(
+ track.getDescription(), count++);
+ queue.add(item);
+ }
+ return queue;
+
+ }
+
+ /**
+ * Create a random queue. For simplicity sake, instead of a random queue, we create a
+ * queue using the first genre,
+ *
+ * @param musicProvider
+ * @return
+ */
+ public static final List<MediaSession.QueueItem> getRandomQueue(MusicProvider musicProvider) {
+ Iterator<String> genres = musicProvider.getGenres().iterator();
+ if (!genres.hasNext()) {
+ return new ArrayList<>();
+ }
+ String genre = genres.next();
+ Iterable<MediaMetadata> tracks = musicProvider.getMusicsByGenre(genre);
+
+ return convertToQueue(tracks);
+ }
+
+
+
+ public static final boolean isIndexPlayable(int index, List<MediaSession.QueueItem> queue) {
+ return (queue != null && index >= 0 && index < queue.size());
+ }
+}
diff --git a/samples/browseable/MediaEffects/AndroidManifest.xml b/samples/browseable/MediaEffects/AndroidManifest.xml
new file mode 100644
index 000000000..556f3c196
--- /dev/null
+++ b/samples/browseable/MediaEffects/AndroidManifest.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest
+ package="com.example.android.mediaeffects"
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:versionCode="1"
+ android:versionName="1.0">
+
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@style/AppTheme">
+
+ <activity
+ android:name=".MainActivity"
+ android:label="@string/app_name">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="android.intent.category.LAUNCHER"/>
+ </intent-filter>
+ </activity>
+
+ </application>
+
+</manifest>
diff --git a/samples/browseable/MediaEffects/_index.jd b/samples/browseable/MediaEffects/_index.jd
new file mode 100644
index 000000000..76448c36d
--- /dev/null
+++ b/samples/browseable/MediaEffects/_index.jd
@@ -0,0 +1,12 @@
+page.tags="MediaEffects"
+sample.group=Media
+@jd:body
+
+<p>
+
+ This sample shows how to use the Media Effects APIs that were introduced in Android 4.0.
+ These APIs let you apply effects to image frames represented as OpenGL ES 2.0 textures.
+ Image frames can be images loaded from disk, frames from the device\'s camera, or other
+ video streams.
+
+ </p>
diff --git a/samples/browseable/MediaEffects/res/drawable-hdpi/ic_launcher.png b/samples/browseable/MediaEffects/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 000000000..950d67b29
--- /dev/null
+++ b/samples/browseable/MediaEffects/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/MediaEffects/res/drawable-hdpi/tile.9.png b/samples/browseable/MediaEffects/res/drawable-hdpi/tile.9.png
new file mode 100644
index 000000000..135862883
--- /dev/null
+++ b/samples/browseable/MediaEffects/res/drawable-hdpi/tile.9.png
Binary files differ
diff --git a/samples/browseable/MediaEffects/res/drawable-mdpi/ic_launcher.png b/samples/browseable/MediaEffects/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 000000000..cf01e9a29
--- /dev/null
+++ b/samples/browseable/MediaEffects/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/MediaEffects/res/drawable-nodpi/puppy.jpg b/samples/browseable/MediaEffects/res/drawable-nodpi/puppy.jpg
new file mode 100644
index 000000000..ef79be200
--- /dev/null
+++ b/samples/browseable/MediaEffects/res/drawable-nodpi/puppy.jpg
Binary files differ
diff --git a/samples/browseable/MediaEffects/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/MediaEffects/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 000000000..b66c0fd03
--- /dev/null
+++ b/samples/browseable/MediaEffects/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/MediaEffects/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/MediaEffects/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 000000000..1e0344e4a
--- /dev/null
+++ b/samples/browseable/MediaEffects/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/MediaEffects/res/layout-w720dp/activity_main.xml b/samples/browseable/MediaEffects/res/layout-w720dp/activity_main.xml
new file mode 100755
index 000000000..c9a52f621
--- /dev/null
+++ b/samples/browseable/MediaEffects/res/layout-w720dp/activity_main.xml
@@ -0,0 +1,73 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:id="@+id/sample_main_layout">
+
+ <LinearLayout
+ android:id="@+id/sample_output"
+ android:layout_width="0px"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:orientation="vertical">
+
+ <FrameLayout
+ style="@style/Widget.SampleMessageTile"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <TextView
+ style="@style/Widget.SampleMessage"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingLeft="@dimen/margin_medium"
+ android:paddingRight="@dimen/margin_medium"
+ android:paddingTop="@dimen/margin_large"
+ android:paddingBottom="@dimen/margin_large"
+ android:text="@string/intro_message" />
+ </FrameLayout>
+
+ <View
+ android:layout_width="match_parent"
+ android:layout_height="1dp"
+ android:background="@android:color/darker_gray" />
+
+ <fragment
+ android:name="com.example.android.common.logger.LogFragment"
+ android:id="@+id/log_fragment"
+ android:layout_width="match_parent"
+ android:layout_height="0px"
+ android:layout_weight="1" />
+
+ </LinearLayout>
+
+ <View
+ android:layout_width="1dp"
+ android:layout_height="match_parent"
+ android:background="@android:color/darker_gray" />
+
+ <FrameLayout
+ android:id="@+id/sample_content_fragment"
+ android:layout_weight="2"
+ android:layout_width="0px"
+ android:layout_height="match_parent" />
+
+</LinearLayout>
+
+
diff --git a/samples/browseable/MediaEffects/res/layout/activity_main.xml b/samples/browseable/MediaEffects/res/layout/activity_main.xml
new file mode 100755
index 000000000..1ae4f981e
--- /dev/null
+++ b/samples/browseable/MediaEffects/res/layout/activity_main.xml
@@ -0,0 +1,65 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:id="@+id/sample_main_layout">
+
+ <ViewAnimator
+ android:id="@+id/sample_output"
+ android:layout_width="match_parent"
+ android:layout_height="0px"
+ android:layout_weight="1">
+
+ <ScrollView
+ style="@style/Widget.SampleMessageTile"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <TextView
+ style="@style/Widget.SampleMessage"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingLeft="@dimen/horizontal_page_margin"
+ android:paddingRight="@dimen/horizontal_page_margin"
+ android:paddingTop="@dimen/vertical_page_margin"
+ android:paddingBottom="@dimen/vertical_page_margin"
+ android:text="@string/intro_message" />
+ </ScrollView>
+
+ <fragment
+ android:name="com.example.android.common.logger.LogFragment"
+ android:id="@+id/log_fragment"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" />
+
+ </ViewAnimator>
+
+ <View
+ android:layout_width="match_parent"
+ android:layout_height="1dp"
+ android:background="@android:color/darker_gray" />
+
+ <FrameLayout
+ android:id="@+id/sample_content_fragment"
+ android:layout_weight="2"
+ android:layout_width="match_parent"
+ android:layout_height="0px" />
+
+</LinearLayout>
+
diff --git a/samples/browseable/MediaEffects/res/layout/fragment_media_effects.xml b/samples/browseable/MediaEffects/res/layout/fragment_media_effects.xml
new file mode 100644
index 000000000..4fb1ce1bc
--- /dev/null
+++ b/samples/browseable/MediaEffects/res/layout/fragment_media_effects.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:orientation="vertical">
+
+ <android.opengl.GLSurfaceView
+ android:id="@+id/effectsview"
+ android:layout_width="fill_parent"
+ android:layout_height="0dp"
+ android:layout_weight="0.93"/>
+</LinearLayout>
diff --git a/samples/browseable/MediaEffects/res/menu/main.xml b/samples/browseable/MediaEffects/res/menu/main.xml
new file mode 100644
index 000000000..b49c2c526
--- /dev/null
+++ b/samples/browseable/MediaEffects/res/menu/main.xml
@@ -0,0 +1,21 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:id="@+id/menu_toggle_log"
+ android:showAsAction="always"
+ android:title="@string/sample_show_log" />
+</menu>
diff --git a/samples/browseable/MediaEffects/res/menu/media_effects.xml b/samples/browseable/MediaEffects/res/menu/media_effects.xml
new file mode 100644
index 000000000..c37a9ac6b
--- /dev/null
+++ b/samples/browseable/MediaEffects/res/menu/media_effects.xml
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:id="@+id/none"
+ android:title="@string/none"
+ android:showAsAction="never" />
+
+ <item android:id="@+id/autofix"
+ android:title="@string/autofix"
+ android:showAsAction="never" />
+
+ <item android:id="@+id/bw"
+ android:title="@string/bw"
+ android:showAsAction="never" />
+
+ <item android:id="@+id/brightness"
+ android:title="@string/brightness"
+ android:showAsAction="never" />
+
+ <item android:id="@+id/contrast"
+ android:title="@string/contrast"
+ android:showAsAction="never" />
+
+ <item android:id="@+id/crossprocess"
+ android:title="@string/crossprocess"
+ android:showAsAction="never" />
+
+ <item android:id="@+id/documentary"
+ android:title="@string/documentary"
+ android:showAsAction="never" />
+
+ <item android:id="@+id/duotone"
+ android:title="@string/duotone"
+ android:showAsAction="never" />
+
+ <item android:id="@+id/filllight"
+ android:title="@string/filllight"
+ android:showAsAction="never" />
+
+ <item android:id="@+id/fisheye"
+ android:title="@string/fisheye"
+ android:showAsAction="never" />
+
+ <item android:id="@+id/flipvert"
+ android:title="@string/flipvert"
+ android:showAsAction="never" />
+
+ <item android:id="@+id/fliphor"
+ android:title="@string/fliphor"
+ android:showAsAction="never" />
+
+ <item android:id="@+id/grain"
+ android:title="@string/grain"
+ android:showAsAction="never" />
+
+ <item android:id="@+id/grayscale"
+ android:title="@string/grayscale"
+ android:showAsAction="never" />
+
+ <item android:id="@+id/lomoish"
+ android:title="@string/lomoish"
+ android:showAsAction="never" />
+
+ <item android:id="@+id/negative"
+ android:title="@string/negative"
+ android:showAsAction="never" />
+
+ <item android:id="@+id/posterize"
+ android:title="@string/posterize"
+ android:showAsAction="never" />
+
+ <item android:id="@+id/rotate"
+ android:title="@string/rotate"
+ android:showAsAction="never" />
+
+ <item android:id="@+id/saturate"
+ android:title="@string/saturate"
+ android:showAsAction="never" />
+
+ <item android:id="@+id/sepia"
+ android:title="@string/sepia"
+ android:showAsAction="never" />
+
+ <item android:id="@+id/sharpen"
+ android:title="@string/sharpen"
+ android:showAsAction="never" />
+
+ <item android:id="@+id/temperature"
+ android:title="@string/temperature"
+ android:showAsAction="never" />
+
+ <item android:id="@+id/tint"
+ android:title="@string/tint"
+ android:showAsAction="never" />
+
+ <item android:id="@+id/vignette"
+ android:title="@string/vignette"
+ android:showAsAction="never" />
+</menu>
diff --git a/samples/browseable/MediaEffects/res/values-sw600dp/template-dimens.xml b/samples/browseable/MediaEffects/res/values-sw600dp/template-dimens.xml
new file mode 100644
index 000000000..22074a2bd
--- /dev/null
+++ b/samples/browseable/MediaEffects/res/values-sw600dp/template-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>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_huge</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/MediaEffects/res/values-sw600dp/template-styles.xml b/samples/browseable/MediaEffects/res/values-sw600dp/template-styles.xml
new file mode 100644
index 000000000..03d197418
--- /dev/null
+++ b/samples/browseable/MediaEffects/res/values-sw600dp/template-styles.xml
@@ -0,0 +1,25 @@
+<!--
+ 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.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceLarge</item>
+ <item name="android:lineSpacingMultiplier">1.2</item>
+ <item name="android:shadowDy">-6.5</item>
+ </style>
+
+</resources>
diff --git a/samples/browseable/MediaEffects/res/values-v11/template-styles.xml b/samples/browseable/MediaEffects/res/values-v11/template-styles.xml
new file mode 100644
index 000000000..8c1ea66f2
--- /dev/null
+++ b/samples/browseable/MediaEffects/res/values-v11/template-styles.xml
@@ -0,0 +1,22 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Holo.Light" />
+
+</resources>
diff --git a/samples/browseable/MediaEffects/res/values-v21/base-colors.xml b/samples/browseable/MediaEffects/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/MediaEffects/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/MediaEffects/res/values-v21/base-template-styles.xml b/samples/browseable/MediaEffects/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/MediaEffects/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/MediaEffects/res/values/base-strings.xml b/samples/browseable/MediaEffects/res/values/base-strings.xml
new file mode 100644
index 000000000..1acde2131
--- /dev/null
+++ b/samples/browseable/MediaEffects/res/values/base-strings.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<resources>
+ <string name="app_name">MediaEffects</string>
+ <string name="intro_message">
+ <![CDATA[
+
+
+ This sample shows how to use the Media Effects APIs that were introduced in Android 4.0.
+ These APIs let you apply effects to image frames represented as OpenGL ES 2.0 textures.
+ Image frames can be images loaded from disk, frames from the device\'s camera, or other
+ video streams.
+
+
+ ]]>
+ </string>
+</resources>
diff --git a/samples/browseable/CustomTransition/res/values/strings.xml b/samples/browseable/MediaEffects/res/values/fragmentview_strings.xml
index 7b9d9ec4f..7b9d9ec4f 100755
--- a/samples/browseable/CustomTransition/res/values/strings.xml
+++ b/samples/browseable/MediaEffects/res/values/fragmentview_strings.xml
diff --git a/samples/browseable/MediaEffects/res/values/strings.xml b/samples/browseable/MediaEffects/res/values/strings.xml
new file mode 100644
index 000000000..399cf6117
--- /dev/null
+++ b/samples/browseable/MediaEffects/res/values/strings.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<resources>
+ <string name="none">None</string>
+ <string name="autofix">Autofix</string>
+ <string name="bw">Min/Max Color Intensity</string>
+ <string name="brightness">Brightness</string>
+ <string name="contrast">Contrast</string>
+ <string name="crossprocess">Cross Process</string>
+ <string name="documentary">Documentary</string>
+ <string name="duotone">Duo Tone</string>
+ <string name="filllight">Fill Light</string>
+ <string name="fisheye">Fish Eye</string>
+ <string name="flipvert">Flip Vertical</string>
+ <string name="fliphor">Flip Horizontal</string>
+ <string name="grain">Grain</string>
+ <string name="grayscale">Grayscale</string>
+ <string name="lomoish">Lomoish</string>
+ <string name="negative">Negative</string>
+ <string name="posterize">Posterize</string>
+ <string name="rotate">Rotate</string>
+ <string name="saturate">Saturate</string>
+ <string name="sepia">Sepia</string>
+ <string name="sharpen">Sharpen</string>
+ <string name="temperature">Temperature</string>
+ <string name="tint">Tint</string>
+ <string name="vignette">Vignette</string>
+</resources>
diff --git a/samples/browseable/MediaEffects/res/values/template-dimens.xml b/samples/browseable/MediaEffects/res/values/template-dimens.xml
new file mode 100644
index 000000000..39e710b5c
--- /dev/null
+++ b/samples/browseable/MediaEffects/res/values/template-dimens.xml
@@ -0,0 +1,32 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Define standard dimensions to comply with Holo-style grids and rhythm. -->
+
+ <dimen name="margin_tiny">4dp</dimen>
+ <dimen name="margin_small">8dp</dimen>
+ <dimen name="margin_medium">16dp</dimen>
+ <dimen name="margin_large">32dp</dimen>
+ <dimen name="margin_huge">64dp</dimen>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_medium</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/MediaEffects/res/values/template-styles.xml b/samples/browseable/MediaEffects/res/values/template-styles.xml
new file mode 100644
index 000000000..6e7d593dd
--- /dev/null
+++ b/samples/browseable/MediaEffects/res/values/template-styles.xml
@@ -0,0 +1,42 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+
+ <style name="Theme.Base" parent="android:Theme.Light" />
+
+ <style name="Theme.Sample" parent="Theme.Base" />
+
+ <style name="AppTheme" parent="Theme.Sample" />
+ <!-- Widget styling -->
+
+ <style name="Widget" />
+
+ <style name="Widget.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceMedium</item>
+ <item name="android:lineSpacingMultiplier">1.1</item>
+ </style>
+
+ <style name="Widget.SampleMessageTile">
+ <item name="android:background">@drawable/tile</item>
+ <item name="android:shadowColor">#7F000000</item>
+ <item name="android:shadowDy">-3.5</item>
+ <item name="android:shadowRadius">2</item>
+ </style>
+
+</resources>
diff --git a/samples/browseable/MediaEffects/src/com.example.android.common/activities/SampleActivityBase.java b/samples/browseable/MediaEffects/src/com.example.android.common/activities/SampleActivityBase.java
new file mode 100644
index 000000000..3228927b7
--- /dev/null
+++ b/samples/browseable/MediaEffects/src/com.example.android.common/activities/SampleActivityBase.java
@@ -0,0 +1,52 @@
+/*
+* Copyright 2013 The Android Open Source Project
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package com.example.android.common.activities;
+
+import android.os.Bundle;
+import android.support.v4.app.FragmentActivity;
+
+import com.example.android.common.logger.Log;
+import com.example.android.common.logger.LogWrapper;
+
+/**
+ * Base launcher activity, to handle most of the common plumbing for samples.
+ */
+public class SampleActivityBase extends FragmentActivity {
+
+ public static final String TAG = "SampleActivityBase";
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ }
+
+ @Override
+ protected void onStart() {
+ super.onStart();
+ initializeLogging();
+ }
+
+ /** Set up targets to receive log data */
+ public void initializeLogging() {
+ // Using Log, front-end to the logging chain, emulates android.util.log method signatures.
+ // Wraps Android's native log framework
+ LogWrapper logWrapper = new LogWrapper();
+ Log.setLogNode(logWrapper);
+
+ Log.i(TAG, "Ready");
+ }
+}
diff --git a/samples/browseable/MediaEffects/src/com.example.android.common/logger/Log.java b/samples/browseable/MediaEffects/src/com.example.android.common/logger/Log.java
new file mode 100644
index 000000000..17503c568
--- /dev/null
+++ b/samples/browseable/MediaEffects/src/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);
+ }
+}
diff --git a/samples/browseable/MediaEffects/src/com.example.android.common/logger/LogFragment.java b/samples/browseable/MediaEffects/src/com.example.android.common/logger/LogFragment.java
new file mode 100644
index 000000000..b302acd4b
--- /dev/null
+++ b/samples/browseable/MediaEffects/src/com.example.android.common/logger/LogFragment.java
@@ -0,0 +1,109 @@
+/*
+* 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 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.graphics.Typeface;
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ScrollView;
+
+/**
+ * Simple fraggment which contains a LogView and uses is to output log data it receives
+ * through the LogNode interface.
+ */
+public class LogFragment extends Fragment {
+
+ private LogView mLogView;
+ private ScrollView mScrollView;
+
+ public LogFragment() {}
+
+ public View inflateViews() {
+ mScrollView = new ScrollView(getActivity());
+ ViewGroup.LayoutParams scrollParams = new ViewGroup.LayoutParams(
+ ViewGroup.LayoutParams.MATCH_PARENT,
+ ViewGroup.LayoutParams.MATCH_PARENT);
+ mScrollView.setLayoutParams(scrollParams);
+
+ mLogView = new LogView(getActivity());
+ ViewGroup.LayoutParams logParams = new ViewGroup.LayoutParams(scrollParams);
+ logParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
+ mLogView.setLayoutParams(logParams);
+ mLogView.setClickable(true);
+ mLogView.setFocusable(true);
+ mLogView.setTypeface(Typeface.MONOSPACE);
+
+ // Want to set padding as 16 dips, setPadding takes pixels. Hooray math!
+ int paddingDips = 16;
+ double scale = getResources().getDisplayMetrics().density;
+ int paddingPixels = (int) ((paddingDips * (scale)) + .5);
+ mLogView.setPadding(paddingPixels, paddingPixels, paddingPixels, paddingPixels);
+ mLogView.setCompoundDrawablePadding(paddingPixels);
+
+ mLogView.setGravity(Gravity.BOTTOM);
+ mLogView.setTextAppearance(getActivity(), android.R.style.TextAppearance_Holo_Medium);
+
+ mScrollView.addView(mLogView);
+ return mScrollView;
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+
+ View result = inflateViews();
+
+ 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) {
+ mScrollView.fullScroll(ScrollView.FOCUS_DOWN);
+ }
+ });
+ return result;
+ }
+
+ public LogView getLogView() {
+ return mLogView;
+ }
+} \ No newline at end of file
diff --git a/samples/browseable/MediaEffects/src/com.example.android.common/logger/LogNode.java b/samples/browseable/MediaEffects/src/com.example.android.common/logger/LogNode.java
new file mode 100644
index 000000000..bc37cabc0
--- /dev/null
+++ b/samples/browseable/MediaEffects/src/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/samples/browseable/MediaEffects/src/com.example.android.common/logger/LogView.java b/samples/browseable/MediaEffects/src/com.example.android.common/logger/LogView.java
new file mode 100644
index 000000000..c01542b91
--- /dev/null
+++ b/samples/browseable/MediaEffects/src/com.example.android.common/logger/LogView.java
@@ -0,0 +1,145 @@
+/*
+ * 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.app.Activity;
+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.
+ final StringBuilder outputBuilder = new StringBuilder();
+
+ String delimiter = "\t";
+ appendIfNotNull(outputBuilder, priorityStr, delimiter);
+ appendIfNotNull(outputBuilder, tag, delimiter);
+ appendIfNotNull(outputBuilder, msg, delimiter);
+ appendIfNotNull(outputBuilder, exceptionStr, delimiter);
+
+ // In case this was originally called from an AsyncTask or some other off-UI thread,
+ // make sure the update occurs within the UI thread.
+ ((Activity) getContext()).runOnUiThread( (new Thread(new Runnable() {
+ @Override
+ public void run() {
+ // 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/samples/browseable/MediaEffects/src/com.example.android.common/logger/LogWrapper.java b/samples/browseable/MediaEffects/src/com.example.android.common/logger/LogWrapper.java
new file mode 100644
index 000000000..16a9e7ba2
--- /dev/null
+++ b/samples/browseable/MediaEffects/src/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);
+ }
+ }
+}
diff --git a/samples/browseable/MediaEffects/src/com.example.android.common/logger/MessageOnlyLogFilter.java b/samples/browseable/MediaEffects/src/com.example.android.common/logger/MessageOnlyLogFilter.java
new file mode 100644
index 000000000..19967dcd4
--- /dev/null
+++ b/samples/browseable/MediaEffects/src/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 chain.
+ */
+ public LogNode getNext() {
+ return mNext;
+ }
+
+ /**
+ * Sets the LogNode data will be sent to..
+ */
+ public void setNext(LogNode node) {
+ mNext = node;
+ }
+
+}
diff --git a/samples/browseable/MediaEffects/src/com.example.android.mediaeffects/GLToolbox.java b/samples/browseable/MediaEffects/src/com.example.android.mediaeffects/GLToolbox.java
new file mode 100644
index 000000000..02a8c590d
--- /dev/null
+++ b/samples/browseable/MediaEffects/src/com.example.android.mediaeffects/GLToolbox.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2014 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.mediaeffects;
+
+import android.opengl.GLES20;
+
+public class GLToolbox {
+
+ public static int loadShader(int shaderType, String source) {
+ int shader = GLES20.glCreateShader(shaderType);
+ if (shader != 0) {
+ GLES20.glShaderSource(shader, source);
+ GLES20.glCompileShader(shader);
+ int[] compiled = new int[1];
+ GLES20.glGetShaderiv(shader, GLES20.GL_COMPILE_STATUS, compiled, 0);
+ if (compiled[0] == 0) {
+ String info = GLES20.glGetShaderInfoLog(shader);
+ GLES20.glDeleteShader(shader);
+ throw new RuntimeException("Could not compile shader " + shaderType + ":" + info);
+ }
+ }
+ return shader;
+ }
+
+ public static int createProgram(String vertexSource, String fragmentSource) {
+ int vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, vertexSource);
+ if (vertexShader == 0) {
+ return 0;
+ }
+ int pixelShader = loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentSource);
+ if (pixelShader == 0) {
+ return 0;
+ }
+
+ int program = GLES20.glCreateProgram();
+ if (program != 0) {
+ GLES20.glAttachShader(program, vertexShader);
+ checkGlError("glAttachShader");
+ GLES20.glAttachShader(program, pixelShader);
+ checkGlError("glAttachShader");
+ GLES20.glLinkProgram(program);
+ int[] linkStatus = new int[1];
+ GLES20.glGetProgramiv(program, GLES20.GL_LINK_STATUS, linkStatus,
+ 0);
+ if (linkStatus[0] != GLES20.GL_TRUE) {
+ String info = GLES20.glGetProgramInfoLog(program);
+ GLES20.glDeleteProgram(program);
+ throw new RuntimeException("Could not link program: " + info);
+ }
+ }
+ return program;
+ }
+
+ public static void checkGlError(String op) {
+ int error;
+ while ((error = GLES20.glGetError()) != GLES20.GL_NO_ERROR) {
+ throw new RuntimeException(op + ": glError " + error);
+ }
+ }
+
+ public static void initTexParams() {
+ GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D,
+ GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
+ GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D,
+ GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
+ GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S,
+ GLES20.GL_CLAMP_TO_EDGE);
+ GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T,
+ GLES20.GL_CLAMP_TO_EDGE);
+ }
+
+}
diff --git a/samples/browseable/MediaEffects/src/com.example.android.mediaeffects/MainActivity.java b/samples/browseable/MediaEffects/src/com.example.android.mediaeffects/MainActivity.java
new file mode 100644
index 000000000..be6224310
--- /dev/null
+++ b/samples/browseable/MediaEffects/src/com.example.android.mediaeffects/MainActivity.java
@@ -0,0 +1,109 @@
+/*
+* Copyright 2013 The Android Open Source Project
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package com.example.android.mediaeffects;
+
+import android.os.Bundle;
+import android.support.v4.app.FragmentTransaction;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.widget.ViewAnimator;
+
+import com.example.android.common.activities.SampleActivityBase;
+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;
+
+/**
+ * A simple launcher activity containing a summary sample description, sample log and a custom
+ * {@link android.support.v4.app.Fragment} which can display a view.
+ * <p>
+ * For devices with displays with a width of 720dp or greater, the sample log is always visible,
+ * on other devices it's visibility is controlled by an item on the Action Bar.
+ */
+public class MainActivity extends SampleActivityBase {
+
+ public static final String TAG = "MainActivity";
+
+ // Whether the Log Fragment is currently shown
+ private boolean mLogShown;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+
+ if (savedInstanceState == null) {
+ FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
+ MediaEffectsFragment fragment = new MediaEffectsFragment();
+ transaction.replace(R.id.sample_content_fragment, fragment);
+ transaction.commit();
+ }
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.main, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onPrepareOptionsMenu(Menu menu) {
+ MenuItem logToggle = menu.findItem(R.id.menu_toggle_log);
+ logToggle.setVisible(findViewById(R.id.sample_output) instanceof ViewAnimator);
+ logToggle.setTitle(mLogShown ? R.string.sample_hide_log : R.string.sample_show_log);
+
+ return super.onPrepareOptionsMenu(menu);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch(item.getItemId()) {
+ case R.id.menu_toggle_log:
+ mLogShown = !mLogShown;
+ ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
+ if (mLogShown) {
+ output.setDisplayedChild(1);
+ } else {
+ output.setDisplayedChild(0);
+ }
+ supportInvalidateOptionsMenu();
+ return true;
+ }
+ return super.onOptionsItemSelected(item);
+ }
+
+ /** Create a chain of targets that will receive log data */
+ @Override
+ public void initializeLogging() {
+ // Wraps Android's native log framework.
+ LogWrapper logWrapper = new LogWrapper();
+ // Using Log, front-end to the logging chain, emulates android.util.log method signatures.
+ Log.setLogNode(logWrapper);
+
+ // Filter strips out everything except the message text.
+ MessageOnlyLogFilter msgFilter = new MessageOnlyLogFilter();
+ logWrapper.setNext(msgFilter);
+
+ // On screen logging via a fragment with a TextView.
+ LogFragment logFragment = (LogFragment) getSupportFragmentManager()
+ .findFragmentById(R.id.log_fragment);
+ msgFilter.setNext(logFragment.getLogView());
+
+ Log.i(TAG, "Ready");
+ }
+}
diff --git a/samples/browseable/MediaEffects/src/com.example.android.mediaeffects/MediaEffectsFragment.java b/samples/browseable/MediaEffects/src/com.example.android.mediaeffects/MediaEffectsFragment.java
new file mode 100644
index 000000000..5af16845f
--- /dev/null
+++ b/samples/browseable/MediaEffects/src/com.example.android.mediaeffects/MediaEffectsFragment.java
@@ -0,0 +1,287 @@
+/*
+ * Copyright (C) 2014 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.mediaeffects;
+
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.graphics.Color;
+import android.media.effect.Effect;
+import android.media.effect.EffectContext;
+import android.media.effect.EffectFactory;
+import android.opengl.GLES20;
+import android.opengl.GLSurfaceView;
+import android.opengl.GLUtils;
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+import android.support.v4.app.Fragment;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.opengles.GL10;
+
+public class MediaEffectsFragment extends Fragment implements GLSurfaceView.Renderer {
+
+ private static final String STATE_CURRENT_EFFECT = "current_effect";
+
+ private GLSurfaceView mEffectView;
+ private int[] mTextures = new int[2];
+ private EffectContext mEffectContext;
+ private Effect mEffect;
+ private TextureRenderer mTexRenderer = new TextureRenderer();
+ private int mImageWidth;
+ private int mImageHeight;
+ private boolean mInitialized = false;
+ private int mCurrentEffect;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setHasOptionsMenu(true);
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
+ @Nullable Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.fragment_media_effects, container, false);
+ }
+
+ @Override
+ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
+ mEffectView = (GLSurfaceView) view.findViewById(R.id.effectsview);
+ mEffectView.setEGLContextClientVersion(2);
+ mEffectView.setRenderer(this);
+ mEffectView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
+ if (null != savedInstanceState && savedInstanceState.containsKey(STATE_CURRENT_EFFECT)) {
+ setCurrentEffect(savedInstanceState.getInt(STATE_CURRENT_EFFECT));
+ } else {
+ setCurrentEffect(R.id.none);
+ }
+ }
+
+ @Override
+ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
+ inflater.inflate(R.menu.media_effects, menu);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ setCurrentEffect(item.getItemId());
+ mEffectView.requestRender();
+ return true;
+ }
+
+ @Override
+ public void onSaveInstanceState(Bundle outState) {
+ outState.putInt(STATE_CURRENT_EFFECT, mCurrentEffect);
+ }
+
+ @Override
+ public void onSurfaceCreated(GL10 gl, EGLConfig eglConfig) {
+ // Nothing to do here
+ }
+
+ @Override
+ public void onSurfaceChanged(GL10 gl, int width, int height) {
+ if (mTexRenderer != null) {
+ mTexRenderer.updateViewSize(width, height);
+ }
+ }
+
+ @Override
+ public void onDrawFrame(GL10 gl) {
+ if (!mInitialized) {
+ //Only need to do this once
+ mEffectContext = EffectContext.createWithCurrentGlContext();
+ mTexRenderer.init();
+ loadTextures();
+ mInitialized = true;
+ }
+ if (mCurrentEffect != R.id.none) {
+ //if an effect is chosen initialize it and apply it to the texture
+ initEffect();
+ applyEffect();
+ }
+ renderResult();
+ }
+
+ private void setCurrentEffect(int effect) {
+ mCurrentEffect = effect;
+ }
+
+ private void loadTextures() {
+ // Generate textures
+ GLES20.glGenTextures(2, mTextures, 0);
+
+ // Load input bitmap
+ Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.puppy);
+ mImageWidth = bitmap.getWidth();
+ mImageHeight = bitmap.getHeight();
+ mTexRenderer.updateTextureSize(mImageWidth, mImageHeight);
+
+ // Upload to texture
+ GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTextures[0]);
+ GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmap, 0);
+
+ // Set texture parameters
+ GLToolbox.initTexParams();
+ }
+
+ private void initEffect() {
+ EffectFactory effectFactory = mEffectContext.getFactory();
+ if (mEffect != null) {
+ mEffect.release();
+ }
+ // Initialize the correct effect based on the selected menu/action item
+ switch (mCurrentEffect) {
+
+ case R.id.none:
+ break;
+
+ case R.id.autofix:
+ mEffect = effectFactory.createEffect(EffectFactory.EFFECT_AUTOFIX);
+ mEffect.setParameter("scale", 0.5f);
+ break;
+
+ case R.id.bw:
+ mEffect = effectFactory.createEffect(EffectFactory.EFFECT_BLACKWHITE);
+ mEffect.setParameter("black", .1f);
+ mEffect.setParameter("white", .7f);
+ break;
+
+ case R.id.brightness:
+ mEffect = effectFactory.createEffect(EffectFactory.EFFECT_BRIGHTNESS);
+ mEffect.setParameter("brightness", 2.0f);
+ break;
+
+ case R.id.contrast:
+ mEffect = effectFactory.createEffect(EffectFactory.EFFECT_CONTRAST);
+ mEffect.setParameter("contrast", 1.4f);
+ break;
+
+ case R.id.crossprocess:
+ mEffect = effectFactory.createEffect(EffectFactory.EFFECT_CROSSPROCESS);
+ break;
+
+ case R.id.documentary:
+ mEffect = effectFactory.createEffect(EffectFactory.EFFECT_DOCUMENTARY);
+ break;
+
+ case R.id.duotone:
+ mEffect = effectFactory.createEffect(EffectFactory.EFFECT_DUOTONE);
+ mEffect.setParameter("first_color", Color.YELLOW);
+ mEffect.setParameter("second_color", Color.DKGRAY);
+ break;
+
+ case R.id.filllight:
+ mEffect = effectFactory.createEffect(EffectFactory.EFFECT_FILLLIGHT);
+ mEffect.setParameter("strength", .8f);
+ break;
+
+ case R.id.fisheye:
+ mEffect = effectFactory.createEffect(EffectFactory.EFFECT_FISHEYE);
+ mEffect.setParameter("scale", .5f);
+ break;
+
+ case R.id.flipvert:
+ mEffect = effectFactory.createEffect(EffectFactory.EFFECT_FLIP);
+ mEffect.setParameter("vertical", true);
+ break;
+
+ case R.id.fliphor:
+ mEffect = effectFactory.createEffect(EffectFactory.EFFECT_FLIP);
+ mEffect.setParameter("horizontal", true);
+ break;
+
+ case R.id.grain:
+ mEffect = effectFactory.createEffect(EffectFactory.EFFECT_GRAIN);
+ mEffect.setParameter("strength", 1.0f);
+ break;
+
+ case R.id.grayscale:
+ mEffect = effectFactory.createEffect(EffectFactory.EFFECT_GRAYSCALE);
+ break;
+
+ case R.id.lomoish:
+ mEffect = effectFactory.createEffect(EffectFactory.EFFECT_LOMOISH);
+ break;
+
+ case R.id.negative:
+ mEffect = effectFactory.createEffect(EffectFactory.EFFECT_NEGATIVE);
+ break;
+
+ case R.id.posterize:
+ mEffect = effectFactory.createEffect(EffectFactory.EFFECT_POSTERIZE);
+ break;
+
+ case R.id.rotate:
+ mEffect = effectFactory.createEffect(EffectFactory.EFFECT_ROTATE);
+ mEffect.setParameter("angle", 180);
+ break;
+
+ case R.id.saturate:
+ mEffect = effectFactory.createEffect(EffectFactory.EFFECT_SATURATE);
+ mEffect.setParameter("scale", .5f);
+ break;
+
+ case R.id.sepia:
+ mEffect = effectFactory.createEffect(EffectFactory.EFFECT_SEPIA);
+ break;
+
+ case R.id.sharpen:
+ mEffect = effectFactory.createEffect(EffectFactory.EFFECT_SHARPEN);
+ break;
+
+ case R.id.temperature:
+ mEffect = effectFactory.createEffect(EffectFactory.EFFECT_TEMPERATURE);
+ mEffect.setParameter("scale", .9f);
+ break;
+
+ case R.id.tint:
+ mEffect = effectFactory.createEffect(EffectFactory.EFFECT_TINT);
+ mEffect.setParameter("tint", Color.MAGENTA);
+ break;
+
+ case R.id.vignette:
+ mEffect = effectFactory.createEffect(EffectFactory.EFFECT_VIGNETTE);
+ mEffect.setParameter("scale", .5f);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ private void applyEffect() {
+ mEffect.apply(mTextures[0], mImageWidth, mImageHeight, mTextures[1]);
+ }
+
+ private void renderResult() {
+ if (mCurrentEffect != R.id.none) {
+ // if no effect is chosen, just render the original bitmap
+ mTexRenderer.renderTexture(mTextures[1]);
+ } else {
+ // render the result of applyEffect()
+ mTexRenderer.renderTexture(mTextures[0]);
+ }
+ }
+
+}
diff --git a/samples/browseable/MediaEffects/src/com.example.android.mediaeffects/TextureRenderer.java b/samples/browseable/MediaEffects/src/com.example.android.mediaeffects/TextureRenderer.java
new file mode 100644
index 000000000..9c77927d2
--- /dev/null
+++ b/samples/browseable/MediaEffects/src/com.example.android.mediaeffects/TextureRenderer.java
@@ -0,0 +1,164 @@
+/*
+ * Copyright (C) 2014 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.mediaeffects;
+
+import android.opengl.GLES20;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.FloatBuffer;
+
+public class TextureRenderer {
+
+ private int mProgram;
+ private int mTexSamplerHandle;
+ private int mTexCoordHandle;
+ private int mPosCoordHandle;
+
+ private FloatBuffer mTexVertices;
+ private FloatBuffer mPosVertices;
+
+ private int mViewWidth;
+ private int mViewHeight;
+
+ private int mTexWidth;
+ private int mTexHeight;
+
+ private static final String VERTEX_SHADER =
+ "attribute vec4 a_position;\n" +
+ "attribute vec2 a_texcoord;\n" +
+ "varying vec2 v_texcoord;\n" +
+ "void main() {\n" +
+ " gl_Position = a_position;\n" +
+ " v_texcoord = a_texcoord;\n" +
+ "}\n";
+
+ private static final String FRAGMENT_SHADER =
+ "precision mediump float;\n" +
+ "uniform sampler2D tex_sampler;\n" +
+ "varying vec2 v_texcoord;\n" +
+ "void main() {\n" +
+ " gl_FragColor = texture2D(tex_sampler, v_texcoord);\n" +
+ "}\n";
+
+ private static final float[] TEX_VERTICES = {
+ 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f
+ };
+
+ private static final float[] POS_VERTICES = {
+ -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, 1.0f
+ };
+
+ private static final int FLOAT_SIZE_BYTES = 4;
+
+ public void init() {
+ // Create program
+ mProgram = GLToolbox.createProgram(VERTEX_SHADER, FRAGMENT_SHADER);
+
+ // Bind attributes and uniforms
+ mTexSamplerHandle = GLES20.glGetUniformLocation(mProgram,
+ "tex_sampler");
+ mTexCoordHandle = GLES20.glGetAttribLocation(mProgram, "a_texcoord");
+ mPosCoordHandle = GLES20.glGetAttribLocation(mProgram, "a_position");
+
+ // Setup coordinate buffers
+ mTexVertices = ByteBuffer.allocateDirect(
+ TEX_VERTICES.length * FLOAT_SIZE_BYTES)
+ .order(ByteOrder.nativeOrder()).asFloatBuffer();
+ mTexVertices.put(TEX_VERTICES).position(0);
+ mPosVertices = ByteBuffer.allocateDirect(
+ POS_VERTICES.length * FLOAT_SIZE_BYTES)
+ .order(ByteOrder.nativeOrder()).asFloatBuffer();
+ mPosVertices.put(POS_VERTICES).position(0);
+ }
+
+ public void tearDown() {
+ GLES20.glDeleteProgram(mProgram);
+ }
+
+ public void updateTextureSize(int texWidth, int texHeight) {
+ mTexWidth = texWidth;
+ mTexHeight = texHeight;
+ computeOutputVertices();
+ }
+
+ public void updateViewSize(int viewWidth, int viewHeight) {
+ mViewWidth = viewWidth;
+ mViewHeight = viewHeight;
+ computeOutputVertices();
+ }
+
+ public void renderTexture(int texId) {
+ // Bind default FBO
+ GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
+
+ // Use our shader program
+ GLES20.glUseProgram(mProgram);
+ GLToolbox.checkGlError("glUseProgram");
+
+ // Set viewport
+ GLES20.glViewport(0, 0, mViewWidth, mViewHeight);
+ GLToolbox.checkGlError("glViewport");
+
+ // Disable blending
+ GLES20.glDisable(GLES20.GL_BLEND);
+
+ // Set the vertex attributes
+ GLES20.glVertexAttribPointer(mTexCoordHandle, 2, GLES20.GL_FLOAT, false,
+ 0, mTexVertices);
+ GLES20.glEnableVertexAttribArray(mTexCoordHandle);
+ GLES20.glVertexAttribPointer(mPosCoordHandle, 2, GLES20.GL_FLOAT, false,
+ 0, mPosVertices);
+ GLES20.glEnableVertexAttribArray(mPosCoordHandle);
+ GLToolbox.checkGlError("vertex attribute setup");
+
+ // Set the input texture
+ GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
+ GLToolbox.checkGlError("glActiveTexture");
+ GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texId);
+ GLToolbox.checkGlError("glBindTexture");
+ GLES20.glUniform1i(mTexSamplerHandle, 0);
+
+ // Draw
+ GLES20.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
+ GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
+ GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
+ }
+
+ private void computeOutputVertices() {
+ if (mPosVertices != null) {
+ float imgAspectRatio = mTexWidth / (float)mTexHeight;
+ float viewAspectRatio = mViewWidth / (float)mViewHeight;
+ float relativeAspectRatio = viewAspectRatio / imgAspectRatio;
+ float x0, y0, x1, y1;
+ if (relativeAspectRatio > 1.0f) {
+ x0 = -1.0f / relativeAspectRatio;
+ y0 = -1.0f;
+ x1 = 1.0f / relativeAspectRatio;
+ y1 = 1.0f;
+ } else {
+ x0 = -1.0f;
+ y0 = -relativeAspectRatio;
+ x1 = 1.0f;
+ y1 = relativeAspectRatio;
+ }
+ float[] coords = new float[] { x0, y0, x1, y0, x0, y1, x1, y1 };
+ mPosVertices.put(coords).position(0);
+ }
+ }
+
+}
diff --git a/samples/browseable/MediaRecorder/AndroidManifest.xml b/samples/browseable/MediaRecorder/AndroidManifest.xml
index 32f88f64f..539dc2c3d 100644
--- a/samples/browseable/MediaRecorder/AndroidManifest.xml
+++ b/samples/browseable/MediaRecorder/AndroidManifest.xml
@@ -22,9 +22,7 @@
android:versionCode="1"
android:versionName="1.0">
- <uses-sdk
- android:minSdkVersion="14"
- android:targetSdkVersion="17" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<!-- This app records A/V content from camera and stores it to disk -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
diff --git a/samples/browseable/MediaRecorder/_index.jd b/samples/browseable/MediaRecorder/_index.jd
index dac835aa8..54b37c8f1 100644
--- a/samples/browseable/MediaRecorder/_index.jd
+++ b/samples/browseable/MediaRecorder/_index.jd
@@ -2,6 +2,10 @@ page.tags="MediaRecorder"
sample.group=Media
@jd:body
-<p>This sample demonstrates how to use the {@link android.media.MediaRecorder}
-API to record video from a camera or camcorder, and display a preview of the
-recording.</p>
+<p>
+
+This sample uses the camera/camcorder as the A/V source for the MediaRecorder API.
+A TextureView is used as the camera preview which limits the code to API 14+. This
+can be easily replaced with a SurfaceView to run on older devices.
+
+ </p>
diff --git a/samples/browseable/MediaRecorder/res/drawable-hdpi/ic_launcher.png b/samples/browseable/MediaRecorder/res/drawable-hdpi/ic_launcher.png
index 13cd1e8ec..bea32bc08 100644
--- a/samples/browseable/MediaRecorder/res/drawable-hdpi/ic_launcher.png
+++ b/samples/browseable/MediaRecorder/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/MediaRecorder/res/drawable-mdpi/ic_launcher.png b/samples/browseable/MediaRecorder/res/drawable-mdpi/ic_launcher.png
index 00b2bd9a4..2a3a4909a 100644
--- a/samples/browseable/MediaRecorder/res/drawable-mdpi/ic_launcher.png
+++ b/samples/browseable/MediaRecorder/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/MediaRecorder/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/MediaRecorder/res/drawable-xhdpi/ic_launcher.png
index 953f1cc53..9674428ee 100644
--- a/samples/browseable/MediaRecorder/res/drawable-xhdpi/ic_launcher.png
+++ b/samples/browseable/MediaRecorder/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/MediaRecorder/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/MediaRecorder/res/drawable-xxhdpi/ic_launcher.png
index f2ccb102a..61e322cff 100644
--- a/samples/browseable/MediaRecorder/res/drawable-xxhdpi/ic_launcher.png
+++ b/samples/browseable/MediaRecorder/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/MediaRecorder/res/values-v21/base-colors.xml b/samples/browseable/MediaRecorder/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/MediaRecorder/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/MediaRecorder/res/values-v21/base-template-styles.xml b/samples/browseable/MediaRecorder/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/MediaRecorder/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/MediaRecorder/res/values/base-strings.xml b/samples/browseable/MediaRecorder/res/values/base-strings.xml
index f9ade8c45..91a0b44ca 100644
--- a/samples/browseable/MediaRecorder/res/values/base-strings.xml
+++ b/samples/browseable/MediaRecorder/res/values/base-strings.xml
@@ -14,19 +14,16 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">MediaRecorder</string>
<string name="intro_message">
<![CDATA[
-
- This sample uses the camera/camcorder as the A/V source for the MediaRecorder API.
- A TextureView is used as the camera preview which limits the code to API 14+. This
- can be easily replaced with a SurfaceView to run on older devices.
-
+
+This sample uses the camera/camcorder as the A/V source for the MediaRecorder API.
+A TextureView is used as the camera preview which limits the code to API 14+. This
+can be easily replaced with a SurfaceView to run on older devices.
+
]]>
</string>
diff --git a/samples/browseable/MediaRecorder/src/com.example.android.common.media/MediaCodecWrapper.java b/samples/browseable/MediaRecorder/src/com.example.android.common.media/MediaCodecWrapper.java
index a511221f5..a48337404 100644
--- a/samples/browseable/MediaRecorder/src/com.example.android.common.media/MediaCodecWrapper.java
+++ b/samples/browseable/MediaRecorder/src/com.example.android.common.media/MediaCodecWrapper.java
@@ -21,6 +21,7 @@ import android.os.Handler;
import android.os.Looper;
import android.view.Surface;
+import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.ArrayDeque;
import java.util.Queue;
@@ -136,7 +137,7 @@ public class MediaCodecWrapper {
* @return
*/
public static MediaCodecWrapper fromVideoFormat(final MediaFormat trackFormat,
- Surface surface) {
+ Surface surface) throws IOException {
MediaCodecWrapper result = null;
MediaCodec videoCodec = null;
diff --git a/samples/browseable/MediaRouter/AndroidManifest.xml b/samples/browseable/MediaRouter/AndroidManifest.xml
index 0b5bec450..18057497c 100644
--- a/samples/browseable/MediaRouter/AndroidManifest.xml
+++ b/samples/browseable/MediaRouter/AndroidManifest.xml
@@ -28,9 +28,8 @@
remote display using system alert window. -->
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
- <uses-sdk android:targetSdkVersion="19"
- android:minSdkVersion="7"/>
-
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
+
<!-- The smallest screen this app works on is a phone. The app will
scale its UI to larger screens but doesn't make good use of them
so allow the compatibility mode button to be shown (mostly because
diff --git a/samples/browseable/MediaRouter/_index.jd b/samples/browseable/MediaRouter/_index.jd
index 5ca94679e..66ac11357 100644
--- a/samples/browseable/MediaRouter/_index.jd
+++ b/samples/browseable/MediaRouter/_index.jd
@@ -1,10 +1,7 @@
-
-
-
page.tags="MediaRouter"
sample.group=Media
@jd:body
<p>
-This sample demonstrates how to create a custom media route provider.
-</p> \ No newline at end of file
+ Demonstrates how to create a custom media route provider.
+ </p>
diff --git a/samples/browseable/MediaRouter/res/values-v21/base-colors.xml b/samples/browseable/MediaRouter/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/MediaRouter/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/MediaRouter/res/values-v21/base-template-styles.xml b/samples/browseable/MediaRouter/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/MediaRouter/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/MediaRouter/res/values/base-strings.xml b/samples/browseable/MediaRouter/res/values/base-strings.xml
index 8b494cc82..667c735f3 100644
--- a/samples/browseable/MediaRouter/res/values/base-strings.xml
+++ b/samples/browseable/MediaRouter/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">MediaRouter</string>
<string name="intro_message">
diff --git a/samples/browseable/MessagingService/AndroidManifest.xml b/samples/browseable/MessagingService/AndroidManifest.xml
new file mode 100644
index 000000000..f8a5850d1
--- /dev/null
+++ b/samples/browseable/MessagingService/AndroidManifest.xml
@@ -0,0 +1,52 @@
+<!--
+ Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.messagingservice">
+
+ <application android:allowBackup="true"
+ android:label="@string/app_name"
+ android:icon="@drawable/ic_launcher"
+ android:theme="@style/AppTheme">
+
+ <meta-data android:name="com.google.android.gms.car.application"
+ android:resource="@xml/automotive_app_desc"/>
+
+ <activity
+ android:name=".MainActivity"
+ android:label="@string/app_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+
+ <service android:name=".MessagingService">
+ </service>
+
+ <receiver android:name=".MessageReadReceiver">
+ <intent-filter>
+ <action android:name="com.example.android.messagingservice.ACTION_MESSAGE_READ"/>
+ </intent-filter>
+ </receiver>
+
+ <receiver android:name=".MessageReplyReceiver">
+ <intent-filter>
+ <action android:name="com.example.android.messagingservice.ACTION_MESSAGE_REPLY"/>
+ </intent-filter>
+ </receiver>
+ </application>
+</manifest>
diff --git a/samples/browseable/MessagingService/_index.jd b/samples/browseable/MessagingService/_index.jd
new file mode 100644
index 000000000..ceaba3440
--- /dev/null
+++ b/samples/browseable/MessagingService/_index.jd
@@ -0,0 +1,12 @@
+page.tags="MessagingService"
+sample.group=Notification
+@jd:body
+
+<p>
+
+This sample shows a simple service that sends notifications using
+NotificationCompat. In addition to sending a notification, it also extends
+the notification with a CarExtender to make it compatible with Android Auto.
+Each unread conversation from a user is sent as a distinct notification.
+
+ </p>
diff --git a/samples/browseable/MessagingService/res/drawable-hdpi/android_contact.png b/samples/browseable/MessagingService/res/drawable-hdpi/android_contact.png
new file mode 100644
index 000000000..00d0ec43a
--- /dev/null
+++ b/samples/browseable/MessagingService/res/drawable-hdpi/android_contact.png
Binary files differ
diff --git a/samples/browseable/MessagingService/res/drawable-hdpi/ic_launcher.png b/samples/browseable/MessagingService/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 000000000..506cbc5a8
--- /dev/null
+++ b/samples/browseable/MessagingService/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/MessagingService/res/drawable-hdpi/notification_icon.png b/samples/browseable/MessagingService/res/drawable-hdpi/notification_icon.png
new file mode 100644
index 000000000..9cdfca1e5
--- /dev/null
+++ b/samples/browseable/MessagingService/res/drawable-hdpi/notification_icon.png
Binary files differ
diff --git a/samples/browseable/MessagingService/res/drawable-mdpi/android_contact.png b/samples/browseable/MessagingService/res/drawable-mdpi/android_contact.png
new file mode 100644
index 000000000..771cb6bb8
--- /dev/null
+++ b/samples/browseable/MessagingService/res/drawable-mdpi/android_contact.png
Binary files differ
diff --git a/samples/browseable/MessagingService/res/drawable-mdpi/ic_launcher.png b/samples/browseable/MessagingService/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 000000000..6296a0366
--- /dev/null
+++ b/samples/browseable/MessagingService/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/MessagingService/res/drawable-mdpi/notification_icon.png b/samples/browseable/MessagingService/res/drawable-mdpi/notification_icon.png
new file mode 100644
index 000000000..d6069ebc9
--- /dev/null
+++ b/samples/browseable/MessagingService/res/drawable-mdpi/notification_icon.png
Binary files differ
diff --git a/samples/browseable/MessagingService/res/drawable-xhdpi/android_contact.png b/samples/browseable/MessagingService/res/drawable-xhdpi/android_contact.png
new file mode 100644
index 000000000..bdba57b6b
--- /dev/null
+++ b/samples/browseable/MessagingService/res/drawable-xhdpi/android_contact.png
Binary files differ
diff --git a/samples/browseable/MessagingService/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/MessagingService/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 000000000..52d3c5ec5
--- /dev/null
+++ b/samples/browseable/MessagingService/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/MessagingService/res/drawable-xhdpi/notification_icon.png b/samples/browseable/MessagingService/res/drawable-xhdpi/notification_icon.png
new file mode 100644
index 000000000..786ed17b7
--- /dev/null
+++ b/samples/browseable/MessagingService/res/drawable-xhdpi/notification_icon.png
Binary files differ
diff --git a/samples/browseable/MessagingService/res/drawable-xxhdpi/android_contact.png b/samples/browseable/MessagingService/res/drawable-xxhdpi/android_contact.png
new file mode 100644
index 000000000..b36ec1730
--- /dev/null
+++ b/samples/browseable/MessagingService/res/drawable-xxhdpi/android_contact.png
Binary files differ
diff --git a/samples/browseable/MessagingService/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/MessagingService/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 000000000..444fb390a
--- /dev/null
+++ b/samples/browseable/MessagingService/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/MessagingService/res/drawable-xxhdpi/notification_icon.png b/samples/browseable/MessagingService/res/drawable-xxhdpi/notification_icon.png
new file mode 100644
index 000000000..005207cc0
--- /dev/null
+++ b/samples/browseable/MessagingService/res/drawable-xxhdpi/notification_icon.png
Binary files differ
diff --git a/samples/browseable/MessagingService/res/layout-land/fragment_message_me.xml b/samples/browseable/MessagingService/res/layout-land/fragment_message_me.xml
new file mode 100644
index 000000000..6f4f88bac
--- /dev/null
+++ b/samples/browseable/MessagingService/res/layout-land/fragment_message_me.xml
@@ -0,0 +1,66 @@
+<!--
+ Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="center_horizontal"
+ android:orientation="horizontal"
+ android:paddingBottom="@dimen/activity_vertical_margin"
+ android:paddingLeft="@dimen/activity_horizontal_margin"
+ android:paddingRight="@dimen/activity_horizontal_margin"
+ android:paddingTop="@dimen/activity_vertical_margin">
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:orientation="vertical">
+ <Button
+ android:id="@+id/send_1_conversation"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/send_1_conversation"/>
+
+ <Button
+ android:id="@+id/send_2_conversations"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/send_2_conversations"/>
+
+ <Button
+ android:id="@+id/send_1_conversation_3_messages"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/send_1_conv_3_messages"/>
+ </LinearLayout>
+ <RelativeLayout
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="2">
+ <Button
+ android:id="@+id/clear"
+ android:layout_alignParentBottom="true"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/clear_log"/>
+
+ <TextView
+ android:id="@+id/data_port"
+ android:layout_above="@id/clear"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:scrollbars="vertical"/>
+ </RelativeLayout>
+</LinearLayout>
diff --git a/samples/browseable/MessagingService/res/layout/activity_main.xml b/samples/browseable/MessagingService/res/layout/activity_main.xml
new file mode 100644
index 000000000..59eec805e
--- /dev/null
+++ b/samples/browseable/MessagingService/res/layout/activity_main.xml
@@ -0,0 +1,22 @@
+<!--
+ Copyright (C) 2014 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.
+ -->
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/container"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context=".MainActivity"
+ tools:ignore="MergeRootFrame" />
diff --git a/samples/browseable/MessagingService/res/layout/fragment_message_me.xml b/samples/browseable/MessagingService/res/layout/fragment_message_me.xml
new file mode 100644
index 000000000..29a8c441a
--- /dev/null
+++ b/samples/browseable/MessagingService/res/layout/fragment_message_me.xml
@@ -0,0 +1,57 @@
+<!--
+ Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:gravity="center_horizontal"
+ android:paddingBottom="@dimen/activity_vertical_margin"
+ android:paddingLeft="@dimen/activity_horizontal_margin"
+ android:paddingRight="@dimen/activity_horizontal_margin"
+ android:paddingTop="@dimen/activity_vertical_margin">
+
+ <Button
+ android:id="@+id/send_1_conversation"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/send_1_conversation"/>
+
+ <Button
+ android:id="@+id/send_2_conversations"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/send_2_conversations"/>
+
+ <Button
+ android:id="@+id/send_1_conversation_3_messages"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/send_1_conv_3_messages"/>
+
+ <TextView
+ android:id="@+id/data_port"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:scrollbars="vertical"/>
+ <Button
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:id="@+id/clear"
+ android:text="@string/clear_log"/>
+
+</LinearLayout>
diff --git a/samples/browseable/MessagingService/res/values-v21/styles.xml b/samples/browseable/MessagingService/res/values-v21/styles.xml
new file mode 100644
index 000000000..f30c97a7a
--- /dev/null
+++ b/samples/browseable/MessagingService/res/values-v21/styles.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014 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="AppTheme" parent="android:Theme.Material.Light">
+ <item name="android:colorPrimary">@color/default_color_light</item>
+ <item name="android:colorPrimaryDark">@color/default_color_dark</item>
+ </style>
+</resources>
diff --git a/samples/browseable/MessagingService/res/values/colors.xml b/samples/browseable/MessagingService/res/values/colors.xml
new file mode 100644
index 000000000..0e6825b0e
--- /dev/null
+++ b/samples/browseable/MessagingService/res/values/colors.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014 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>
+ <color name="default_color_light">#ff4092c3</color>
+ <color name="default_color_dark">#ff241c99</color>
+</resources>
diff --git a/samples/browseable/MessagingService/res/values/dimens.xml b/samples/browseable/MessagingService/res/values/dimens.xml
new file mode 100644
index 000000000..574a35d20
--- /dev/null
+++ b/samples/browseable/MessagingService/res/values/dimens.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014 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>
+ <!-- Default screen margins, per the Android Design guidelines. -->
+ <dimen name="activity_horizontal_margin">16dp</dimen>
+ <dimen name="activity_vertical_margin">16dp</dimen>
+</resources>
diff --git a/samples/browseable/MessagingService/res/values/strings.xml b/samples/browseable/MessagingService/res/values/strings.xml
new file mode 100644
index 000000000..001b10eed
--- /dev/null
+++ b/samples/browseable/MessagingService/res/values/strings.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<resources>
+ <string name="app_name">Messaging Sample</string>
+ <string name="action_settings">Settings</string>
+ <string name="title">Messaging Sample</string>
+ <string name="notification_reply">Reply by Voice</string>
+ <string name="send_2_conversations">Send 2 conversations with 1 message</string>
+ <string name="send_1_conversation">Send 1 conversation with 1 message</string>
+ <string name="send_1_conv_3_messages">Send 1 conversation with 3 messages</string>
+ <string name="clear_log">Clear Log</string>
+</resources>
diff --git a/samples/browseable/MessagingService/res/values/styles.xml b/samples/browseable/MessagingService/res/values/styles.xml
new file mode 100644
index 000000000..3f1a6af88
--- /dev/null
+++ b/samples/browseable/MessagingService/res/values/styles.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014 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="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
+ </style>
+</resources>
diff --git a/samples/browseable/MessagingService/res/xml/automotive_app_desc.xml b/samples/browseable/MessagingService/res/xml/automotive_app_desc.xml
new file mode 100644
index 000000000..9e9f1741f
--- /dev/null
+++ b/samples/browseable/MessagingService/res/xml/automotive_app_desc.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014 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.
+ -->
+<automotiveApp>
+ <uses name="notification"/>
+</automotiveApp>
diff --git a/samples/browseable/MessagingService/src/com.example.android.messagingservice/Conversations.java b/samples/browseable/MessagingService/src/com.example.android.messagingservice/Conversations.java
new file mode 100644
index 000000000..7425df499
--- /dev/null
+++ b/samples/browseable/MessagingService/src/com.example.android.messagingservice/Conversations.java
@@ -0,0 +1,126 @@
+/*
+ * Copyright (C) 2014 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.messagingservice;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.ThreadLocalRandom;
+
+/**
+ * A simple class that denotes unread conversations and messages. In a real world application,
+ * this would be replaced by a content provider that actually gets the unread messages to be
+ * shown to the user.
+ */
+public class Conversations {
+
+ /**
+ * Set of strings used as messages by the sample.
+ */
+ private static final String[] MESSAGES = new String[]{
+ "Are you at home?",
+ "Can you give me a call?",
+ "Hey yt?",
+ "Don't forget to get some milk on your way back home",
+ "Is that project done?",
+ "Did you finish the Messaging app yet?"
+ };
+
+ /**
+ * Senders of the said messages.
+ */
+ private static final String[] PARTICIPANTS = new String[]{
+ "John Smith",
+ "Robert Lawrence",
+ "James Smith",
+ "Jane Doe"
+ };
+
+ static class Conversation {
+
+ private final int conversationId;
+
+ private final String participantName;
+
+ /**
+ * A given conversation can have a single or multiple messages.
+ * Note that the messages are sorted from *newest* to *oldest*
+ */
+ private final List<String> messages;
+
+ private final long timestamp;
+
+ public Conversation(int conversationId, String participantName,
+ List<String> messages) {
+ this.conversationId = conversationId;
+ this.participantName = participantName;
+ this.messages = messages == null ? Collections.<String>emptyList() : messages;
+ this.timestamp = System.currentTimeMillis();
+ }
+
+ public int getConversationId() {
+ return conversationId;
+ }
+
+ public String getParticipantName() {
+ return participantName;
+ }
+
+ public List<String> getMessages() {
+ return messages;
+ }
+
+ public long getTimestamp() {
+ return timestamp;
+ }
+
+ public String toString() {
+ return "[Conversation: conversationId=" + conversationId +
+ ", participantName=" + participantName +
+ ", messages=" + messages +
+ ", timestamp=" + timestamp + "]";
+ }
+ }
+
+ private Conversations() {
+ }
+
+ public static Conversation[] getUnreadConversations(int howManyConversations,
+ int messagesPerConversation) {
+ Conversation[] conversations = new Conversation[howManyConversations];
+ for (int i = 0; i < howManyConversations; i++) {
+ conversations[i] = new Conversation(
+ ThreadLocalRandom.current().nextInt(),
+ name(), makeMessages(messagesPerConversation));
+ }
+ return conversations;
+ }
+
+ private static List<String> makeMessages(int messagesPerConversation) {
+ int maxLen = MESSAGES.length;
+ List<String> messages = new ArrayList<>(messagesPerConversation);
+ for (int i = 0; i < messagesPerConversation; i++) {
+ messages.add(MESSAGES[ThreadLocalRandom.current().nextInt(0, maxLen)]);
+ }
+ return messages;
+ }
+
+ private static String name() {
+ return PARTICIPANTS[ThreadLocalRandom.current().nextInt(0, PARTICIPANTS.length)];
+ }
+}
diff --git a/samples/browseable/MessagingService/src/com.example.android.messagingservice/MainActivity.java b/samples/browseable/MessagingService/src/com.example.android.messagingservice/MainActivity.java
new file mode 100644
index 000000000..e558a64a8
--- /dev/null
+++ b/samples/browseable/MessagingService/src/com.example.android.messagingservice/MainActivity.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2014 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.messagingservice;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+public class MainActivity extends Activity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+ if (savedInstanceState == null) {
+ getFragmentManager().beginTransaction()
+ .add(R.id.container, new MessagingFragment())
+ .commit();
+ }
+ }
+}
diff --git a/samples/browseable/MessagingService/src/com.example.android.messagingservice/MessageLogger.java b/samples/browseable/MessagingService/src/com.example.android.messagingservice/MessageLogger.java
new file mode 100644
index 000000000..d1007b5ad
--- /dev/null
+++ b/samples/browseable/MessagingService/src/com.example.android.messagingservice/MessageLogger.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2014 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.messagingservice;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * A simple logger that uses shared preferences to log messages, their reads
+ * and replies. Don't use this in a real world application. This logger is only
+ * used for displaying the messages in the text view.
+ */
+public class MessageLogger {
+
+ private static final String PREF_MESSAGE = "MESSAGE_LOGGER";
+ private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+ public static final String LOG_KEY = "message_data";
+ public static final String LINE_BREAKS = "\n\n";
+
+ public static void logMessage(Context context, String message) {
+ SharedPreferences prefs = getPrefs(context);
+ message = DATE_FORMAT.format(new Date(System.currentTimeMillis())) + ": " + message;
+ prefs.edit()
+ .putString(LOG_KEY, prefs.getString(LOG_KEY, "") + LINE_BREAKS + message)
+ .apply();
+ }
+
+ public static SharedPreferences getPrefs(Context context) {
+ return context.getSharedPreferences(PREF_MESSAGE, Context.MODE_PRIVATE);
+ }
+
+ public static String getAllMessages(Context context) {
+ return getPrefs(context).getString(LOG_KEY, "");
+ }
+
+ public static void clear(Context context) {
+ getPrefs(context).edit().remove(LOG_KEY).apply();
+ }
+}
diff --git a/samples/browseable/MessagingService/src/com.example.android.messagingservice/MessageReadReceiver.java b/samples/browseable/MessagingService/src/com.example.android.messagingservice/MessageReadReceiver.java
new file mode 100644
index 000000000..f28a3a778
--- /dev/null
+++ b/samples/browseable/MessagingService/src/com.example.android.messagingservice/MessageReadReceiver.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2014 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.messagingservice;
+
+import android.app.NotificationManager;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.support.v4.app.NotificationManagerCompat;
+import android.util.Log;
+
+public class MessageReadReceiver extends BroadcastReceiver {
+ private static final String TAG = MessageReadReceiver.class.getSimpleName();
+
+ private static final String CONVERSATION_ID = "conversation_id";
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ Log.d(TAG, "onReceive");
+ int conversationId = intent.getIntExtra(CONVERSATION_ID, -1);
+ if (conversationId != -1) {
+ Log.d(TAG, "Conversation " + conversationId + " was read");
+ MessageLogger.logMessage(context, "Conversation " + conversationId + " was read.");
+ NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
+ notificationManager.cancel(conversationId);
+ }
+ }
+}
diff --git a/samples/browseable/MessagingService/src/com.example.android.messagingservice/MessageReplyReceiver.java b/samples/browseable/MessagingService/src/com.example.android.messagingservice/MessageReplyReceiver.java
new file mode 100644
index 000000000..0a3eba692
--- /dev/null
+++ b/samples/browseable/MessagingService/src/com.example.android.messagingservice/MessageReplyReceiver.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2014 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.messagingservice;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.v4.app.RemoteInput;
+import android.util.Log;
+
+/**
+ * A receiver that gets called when a reply is sent to a given conversationId
+ */
+public class MessageReplyReceiver extends BroadcastReceiver {
+
+ private static final String TAG = MessageReplyReceiver.class.getSimpleName();
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (MessagingService.REPLY_ACTION.equals(intent.getAction())) {
+ int conversationId = intent.getIntExtra(MessagingService.CONVERSATION_ID, -1);
+ CharSequence reply = getMessageText(intent);
+ if (conversationId != -1) {
+ Log.d(TAG, "Got reply (" + reply + ") for ConversationId " + conversationId);
+ MessageLogger.logMessage(context, "ConversationId: " + conversationId +
+ " received a reply: [" + reply + "]");
+ }
+ }
+ }
+
+ /**
+ * Get the message text from the intent.
+ * Note that you should call {@code RemoteInput#getResultsFromIntent(intent)} to process
+ * the RemoteInput.
+ */
+ private CharSequence getMessageText(Intent intent) {
+ Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
+ if (remoteInput != null) {
+ return remoteInput.getCharSequence(MessagingService.EXTRA_VOICE_REPLY);
+ }
+ return null;
+ }
+}
diff --git a/samples/browseable/MessagingService/src/com.example.android.messagingservice/MessagingFragment.java b/samples/browseable/MessagingService/src/com.example.android.messagingservice/MessagingFragment.java
new file mode 100644
index 000000000..f8efcc0c7
--- /dev/null
+++ b/samples/browseable/MessagingService/src/com.example.android.messagingservice/MessagingFragment.java
@@ -0,0 +1,170 @@
+/*
+ * Copyright (C) 2014 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.messagingservice;
+
+import android.app.Fragment;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.ServiceConnection;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.os.Message;
+import android.os.Messenger;
+import android.os.RemoteException;
+import android.text.method.ScrollingMovementMethod;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.TextView;
+
+/**
+ * The main fragment that shows the buttons and the text view containing the log.
+ */
+public class MessagingFragment extends Fragment implements View.OnClickListener {
+
+ private static final String TAG = MessagingFragment.class.getSimpleName();
+
+ private Button mSendSingleConversation;
+ private Button mSendTwoConversations;
+ private Button mSendConversationWithThreeMessages;
+ private TextView mDataPortView;
+ private Button mClearLogButton;
+
+ private Messenger mService;
+ private boolean mBound;
+
+ private ServiceConnection mConnection = new ServiceConnection() {
+ @Override
+ public void onServiceConnected(ComponentName componentName, IBinder service) {
+ mService = new Messenger(service);
+ mBound = true;
+ setButtonsState(true);
+ }
+
+ @Override
+ public void onServiceDisconnected(ComponentName componentName) {
+ mService = null;
+ mBound = false;
+ setButtonsState(false);
+ }
+ };
+
+ private SharedPreferences.OnSharedPreferenceChangeListener listener =
+ new SharedPreferences.OnSharedPreferenceChangeListener() {
+ @Override
+ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
+ if (MessageLogger.LOG_KEY.equals(key)) {
+ mDataPortView.setText(MessageLogger.getAllMessages(getActivity()));
+ }
+ }
+ };
+
+ public MessagingFragment() {
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ View rootView = inflater.inflate(R.layout.fragment_message_me, container, false);
+
+ mSendSingleConversation = (Button) rootView.findViewById(R.id.send_1_conversation);
+ mSendSingleConversation.setOnClickListener(this);
+
+ mSendTwoConversations = (Button) rootView.findViewById(R.id.send_2_conversations);
+ mSendTwoConversations.setOnClickListener(this);
+
+ mSendConversationWithThreeMessages =
+ (Button) rootView.findViewById(R.id.send_1_conversation_3_messages);
+ mSendConversationWithThreeMessages.setOnClickListener(this);
+
+ mDataPortView = (TextView) rootView.findViewById(R.id.data_port);
+ mDataPortView.setMovementMethod(new ScrollingMovementMethod());
+
+ mClearLogButton = (Button) rootView.findViewById(R.id.clear);
+ mClearLogButton.setOnClickListener(this);
+
+ setButtonsState(false);
+
+ return rootView;
+ }
+
+ @Override
+ public void onClick(View view) {
+ if (view == mSendSingleConversation) {
+ sendMsg(1, 1);
+ } else if (view == mSendTwoConversations) {
+ sendMsg(2, 1);
+ } else if (view == mSendConversationWithThreeMessages) {
+ sendMsg(1, 3);
+ } else if (view == mClearLogButton) {
+ MessageLogger.clear(getActivity());
+ mDataPortView.setText(MessageLogger.getAllMessages(getActivity()));
+ }
+ }
+
+ @Override
+ public void onStart() {
+ super.onStart();
+ getActivity().bindService(new Intent(getActivity(), MessagingService.class), mConnection,
+ Context.BIND_AUTO_CREATE);
+ }
+
+ @Override
+ public void onPause() {
+ super.onPause();
+ MessageLogger.getPrefs(getActivity()).unregisterOnSharedPreferenceChangeListener(listener);
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ mDataPortView.setText(MessageLogger.getAllMessages(getActivity()));
+ MessageLogger.getPrefs(getActivity()).registerOnSharedPreferenceChangeListener(listener);
+ }
+
+ @Override
+ public void onStop() {
+ super.onStop();
+ if (mBound) {
+ getActivity().unbindService(mConnection);
+ mBound = false;
+ }
+ }
+
+ private void sendMsg(int howManyConversations, int messagesPerConversation) {
+ if (mBound) {
+ Message msg = Message.obtain(null, MessagingService.MSG_SEND_NOTIFICATION,
+ howManyConversations, messagesPerConversation);
+ try {
+ mService.send(msg);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error sending a message", e);
+ MessageLogger.logMessage(getActivity(), "Error occurred while sending a message.");
+ }
+ }
+ }
+
+ private void setButtonsState(boolean enable) {
+ mSendSingleConversation.setEnabled(enable);
+ mSendTwoConversations.setEnabled(enable);
+ mSendConversationWithThreeMessages.setEnabled(enable);
+ }
+}
diff --git a/samples/browseable/MessagingService/src/com.example.android.messagingservice/MessagingService.java b/samples/browseable/MessagingService/src/com.example.android.messagingservice/MessagingService.java
new file mode 100644
index 000000000..f5900610d
--- /dev/null
+++ b/samples/browseable/MessagingService/src/com.example.android.messagingservice/MessagingService.java
@@ -0,0 +1,174 @@
+/*
+ * Copyright (C) 2014 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.messagingservice;
+
+import android.app.PendingIntent;
+import android.app.Service;
+import android.content.Intent;
+import android.graphics.BitmapFactory;
+import android.os.Handler;
+import android.os.IBinder;
+import android.os.Message;
+import android.os.Messenger;
+import android.support.v4.app.NotificationCompat.CarExtender;
+import android.support.v4.app.NotificationCompat.CarExtender.UnreadConversation;
+import android.support.v4.app.NotificationCompat;
+import android.support.v4.app.NotificationManagerCompat;
+import android.support.v4.app.RemoteInput;
+import android.util.Log;
+
+import java.util.Iterator;
+
+public class MessagingService extends Service {
+ private static final String TAG = MessagingService.class.getSimpleName();
+
+ public static final String READ_ACTION =
+ "com.example.android.messagingservice.ACTION_MESSAGE_READ";
+ public static final String REPLY_ACTION =
+ "com.example.android.messagingservice.ACTION_MESSAGE_REPLY";
+ public static final String CONVERSATION_ID = "conversation_id";
+ public static final String EXTRA_VOICE_REPLY = "extra_voice_reply";
+ public static final int MSG_SEND_NOTIFICATION = 1;
+ public static final String EOL = "\n";
+
+ private NotificationManagerCompat mNotificationManager;
+
+ private final Messenger mMessenger = new Messenger(new IncomingHandler());
+
+ /**
+ * Handler of incoming messages from clients.
+ */
+ class IncomingHandler extends Handler {
+ @Override
+ public void handleMessage(Message msg) {
+ switch (msg.what) {
+ case MSG_SEND_NOTIFICATION:
+ int howManyConversations = msg.arg1 <= 0 ? 1 : msg.arg1;
+ int messagesPerConv = msg.arg2 <= 0 ? 1 : msg.arg2;
+ sendNotification(howManyConversations, messagesPerConv);
+ break;
+ default:
+ super.handleMessage(msg);
+ }
+ }
+ }
+
+ @Override
+ public void onCreate() {
+ Log.d(TAG, "onCreate");
+ mNotificationManager = NotificationManagerCompat.from(getApplicationContext());
+ }
+
+ @Override
+ public IBinder onBind(Intent intent) {
+ Log.d(TAG, "onBind");
+ return mMessenger.getBinder();
+ }
+
+ @Override
+ public int onStartCommand(Intent intent, int flags, int startId) {
+ Log.d(TAG, "onStartCommand");
+ return START_STICKY;
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ Log.d(TAG, "onDestroy");
+ }
+
+ // Creates an intent that will be triggered when a message is marked as read.
+ private Intent getMessageReadIntent(int id) {
+ return new Intent()
+ .addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES)
+ .setAction(READ_ACTION)
+ .putExtra(CONVERSATION_ID, id);
+ }
+
+ // Creates an Intent that will be triggered when a voice reply is received.
+ private Intent getMessageReplyIntent(int conversationId) {
+ return new Intent()
+ .addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES)
+ .setAction(REPLY_ACTION)
+ .putExtra(CONVERSATION_ID, conversationId);
+ }
+
+ private void sendNotification(int howManyConversations, int messagesPerConversation) {
+ Conversations.Conversation[] conversations = Conversations.getUnreadConversations(
+ howManyConversations, messagesPerConversation);
+ for (Conversations.Conversation conv : conversations) {
+ sendNotificationForConversation(conv);
+ }
+ }
+
+ private void sendNotificationForConversation(Conversations.Conversation conversation) {
+ // A pending Intent for reads
+ PendingIntent readPendingIntent = PendingIntent.getBroadcast(getApplicationContext(),
+ conversation.getConversationId(),
+ getMessageReadIntent(conversation.getConversationId()),
+ PendingIntent.FLAG_UPDATE_CURRENT);
+
+ // Build a RemoteInput for receiving voice input in a Car Notification
+ RemoteInput remoteInput = new RemoteInput.Builder(EXTRA_VOICE_REPLY)
+ .setLabel(getApplicationContext().getString(R.string.notification_reply))
+ .build();
+
+ // Building a Pending Intent for the reply action to trigger
+ PendingIntent replyIntent = PendingIntent.getBroadcast(getApplicationContext(),
+ conversation.getConversationId(),
+ getMessageReplyIntent(conversation.getConversationId()),
+ PendingIntent.FLAG_UPDATE_CURRENT);
+
+ // Create the UnreadConversation and populate it with the participant name,
+ // read and reply intents.
+ UnreadConversation.Builder unreadConvBuilder =
+ new UnreadConversation.Builder(conversation.getParticipantName())
+ .setLatestTimestamp(conversation.getTimestamp())
+ .setReadPendingIntent(readPendingIntent)
+ .setReplyAction(replyIntent, remoteInput);
+
+ // Note: Add messages from oldest to newest to the UnreadConversation.Builder
+ StringBuilder messageForNotification = new StringBuilder();
+ for (Iterator<String> messages = conversation.getMessages().iterator();
+ messages.hasNext(); ) {
+ String message = messages.next();
+ unreadConvBuilder.addMessage(message);
+ messageForNotification.append(message);
+ if (messages.hasNext()) {
+ messageForNotification.append(EOL);
+ }
+ }
+
+ NotificationCompat.Builder builder = new NotificationCompat.Builder(getApplicationContext())
+ .setSmallIcon(R.drawable.notification_icon)
+ .setLargeIcon(BitmapFactory.decodeResource(
+ getApplicationContext().getResources(), R.drawable.android_contact))
+ .setContentText(messageForNotification.toString())
+ .setWhen(conversation.getTimestamp())
+ .setContentTitle(conversation.getParticipantName())
+ .setContentIntent(readPendingIntent)
+ .extend(new CarExtender()
+ .setUnreadConversation(unreadConvBuilder.build())
+ .setColor(getApplicationContext()
+ .getResources().getColor(R.color.default_color_light)));
+
+ MessageLogger.logMessage(getApplicationContext(), "Sending notification "
+ + conversation.getConversationId() + " conversation: " + conversation);
+
+ mNotificationManager.notify(conversation.getConversationId(), builder.build());
+ }
+}
diff --git a/samples/browseable/NavigationDrawer/res/values-v21/base-colors.xml b/samples/browseable/NavigationDrawer/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/NavigationDrawer/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/NavigationDrawer/res/values-v21/base-template-styles.xml b/samples/browseable/NavigationDrawer/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/NavigationDrawer/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/NavigationDrawer/res/values-v21/template-styles.xml b/samples/browseable/NavigationDrawer/res/values-v21/template-styles.xml
deleted file mode 100644
index 134fcd9d3..000000000
--- a/samples/browseable/NavigationDrawer/res/values-v21/template-styles.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<!--
- Copyright 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<resources>
-
- <!-- Activity themes -->
- <style name="Theme.Base" parent="android:Theme.Material.Light" />
-
-</resources>
diff --git a/samples/browseable/NetworkConnect/AndroidManifest.xml b/samples/browseable/NetworkConnect/AndroidManifest.xml
index 1ae29df9a..00ce7f3d0 100644
--- a/samples/browseable/NetworkConnect/AndroidManifest.xml
+++ b/samples/browseable/NetworkConnect/AndroidManifest.xml
@@ -23,7 +23,7 @@
android:versionCode="1"
android:versionName="1.0">
- <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
diff --git a/samples/browseable/NetworkConnect/_index.jd b/samples/browseable/NetworkConnect/_index.jd
index eaac88496..7d67dd3dd 100644
--- a/samples/browseable/NetworkConnect/_index.jd
+++ b/samples/browseable/NetworkConnect/_index.jd
@@ -1,10 +1,10 @@
-
-
-
page.tags="NetworkConnect"
sample.group=Connectivity
@jd:body
-<p>This sample demonstrates how to connect to the network and fetch raw HTML.
-The sample uses {@link android.os.AsyncTask} to perform the fetch on a
-background thread.</p>
+<p>
+
+ 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.
+
+ </p>
diff --git a/samples/browseable/NetworkConnect/res/values-v21/base-colors.xml b/samples/browseable/NetworkConnect/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/NetworkConnect/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/NetworkConnect/res/values-v21/base-template-styles.xml b/samples/browseable/NetworkConnect/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/NetworkConnect/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/NetworkConnect/res/values/base-strings.xml b/samples/browseable/NetworkConnect/res/values/base-strings.xml
index 0248814b8..75b3a8cb0 100644
--- a/samples/browseable/NetworkConnect/res/values/base-strings.xml
+++ b/samples/browseable/NetworkConnect/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">NetworkConnect</string>
<string name="intro_message">
diff --git a/samples/browseable/Notifications/Application/AndroidManifest.xml b/samples/browseable/Notifications/Application/AndroidManifest.xml
new file mode 100644
index 000000000..3f1274d87
--- /dev/null
+++ b/samples/browseable/Notifications/Application/AndroidManifest.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.support.wearable.notifications" >
+
+ <uses-sdk android:minSdkVersion="18"
+ android:targetSdkVersion="21" />
+
+ <uses-permission android:name="android.permission.VIBRATE" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@mipmap/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@style/AppTheme" >
+
+ <activity
+ android:name=".MainActivity"
+ android:label="@string/app_name"
+ android:windowSoftInputMode="stateHidden" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+
+ <receiver android:name=".NotificationIntentReceiver"
+ android:exported="false">
+ <intent-filter>
+ <action android:name="com.example.android.support.wearable.notifications.ACTION_EXAMPLE" />
+ <action android:name="com.example.android.support.wearable.notifications.ACTION_ENABLE_MESSAGES" />
+ <action android:name="com.example.android.support.wearable.notifications.ACTION_DISABLE_MESSAGES" />
+ </intent-filter>
+ </receiver>
+
+ </application>
+
+</manifest>
diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable-hdpi/example_large_icon.png b/samples/browseable/Notifications/Application/res/drawable-hdpi/example_large_icon.png
index 545f8cecb..545f8cecb 100644
--- a/samples/wearable/Notifications/Application/src/main/res/drawable-hdpi/example_large_icon.png
+++ b/samples/browseable/Notifications/Application/res/drawable-hdpi/example_large_icon.png
Binary files differ
diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable-hdpi/ic_full_action.png b/samples/browseable/Notifications/Application/res/drawable-hdpi/ic_full_action.png
index 1f274990c..1f274990c 100644
--- a/samples/wearable/Notifications/Application/src/main/res/drawable-hdpi/ic_full_action.png
+++ b/samples/browseable/Notifications/Application/res/drawable-hdpi/ic_full_action.png
Binary files differ
diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable-hdpi/ic_full_reply.png b/samples/browseable/Notifications/Application/res/drawable-hdpi/ic_full_reply.png
index 66388d5fa..66388d5fa 100644
--- a/samples/wearable/Notifications/Application/src/main/res/drawable-hdpi/ic_full_reply.png
+++ b/samples/browseable/Notifications/Application/res/drawable-hdpi/ic_full_reply.png
Binary files differ
diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable-hdpi/ic_result_open.png b/samples/browseable/Notifications/Application/res/drawable-hdpi/ic_result_open.png
index db8af57f7..db8af57f7 100644
--- a/samples/wearable/Notifications/Application/src/main/res/drawable-hdpi/ic_result_open.png
+++ b/samples/browseable/Notifications/Application/res/drawable-hdpi/ic_result_open.png
Binary files differ
diff --git a/samples/browseable/Notifications/Application/res/drawable-hdpi/tile.9.png b/samples/browseable/Notifications/Application/res/drawable-hdpi/tile.9.png
new file mode 100644
index 000000000..135862883
--- /dev/null
+++ b/samples/browseable/Notifications/Application/res/drawable-hdpi/tile.9.png
Binary files differ
diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable-mdpi/ic_full_action.png b/samples/browseable/Notifications/Application/res/drawable-mdpi/ic_full_action.png
index b70b74ff5..b70b74ff5 100644
--- a/samples/wearable/Notifications/Application/src/main/res/drawable-mdpi/ic_full_action.png
+++ b/samples/browseable/Notifications/Application/res/drawable-mdpi/ic_full_action.png
Binary files differ
diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable-mdpi/ic_full_reply.png b/samples/browseable/Notifications/Application/res/drawable-mdpi/ic_full_reply.png
index 60ce9f9c5..60ce9f9c5 100644
--- a/samples/wearable/Notifications/Application/src/main/res/drawable-mdpi/ic_full_reply.png
+++ b/samples/browseable/Notifications/Application/res/drawable-mdpi/ic_full_reply.png
Binary files differ
diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable-mdpi/ic_result_open.png b/samples/browseable/Notifications/Application/res/drawable-mdpi/ic_result_open.png
index 860d7de6c..860d7de6c 100644
--- a/samples/wearable/Notifications/Application/src/main/res/drawable-mdpi/ic_result_open.png
+++ b/samples/browseable/Notifications/Application/res/drawable-mdpi/ic_result_open.png
Binary files differ
diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/bg_1.png b/samples/browseable/Notifications/Application/res/drawable-nodpi/bg_1.png
index 9c807946d..9c807946d 100644
--- a/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/bg_1.png
+++ b/samples/browseable/Notifications/Application/res/drawable-nodpi/bg_1.png
Binary files differ
diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/bg_2.png b/samples/browseable/Notifications/Application/res/drawable-nodpi/bg_2.png
index 23d7062b3..23d7062b3 100644
--- a/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/bg_2.png
+++ b/samples/browseable/Notifications/Application/res/drawable-nodpi/bg_2.png
Binary files differ
diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/bg_3.png b/samples/browseable/Notifications/Application/res/drawable-nodpi/bg_3.png
index 588318ddd..588318ddd 100644
--- a/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/bg_3.png
+++ b/samples/browseable/Notifications/Application/res/drawable-nodpi/bg_3.png
Binary files differ
diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/bg_4.png b/samples/browseable/Notifications/Application/res/drawable-nodpi/bg_4.png
index bd1dfee00..bd1dfee00 100644
--- a/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/bg_4.png
+++ b/samples/browseable/Notifications/Application/res/drawable-nodpi/bg_4.png
Binary files differ
diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/bg_5.png b/samples/browseable/Notifications/Application/res/drawable-nodpi/bg_5.png
index aa1ad23af..aa1ad23af 100644
--- a/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/bg_5.png
+++ b/samples/browseable/Notifications/Application/res/drawable-nodpi/bg_5.png
Binary files differ
diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/content_icon_large.png b/samples/browseable/Notifications/Application/res/drawable-nodpi/content_icon_large.png
index 0eab3b10a..0eab3b10a 100644
--- a/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/content_icon_large.png
+++ b/samples/browseable/Notifications/Application/res/drawable-nodpi/content_icon_large.png
Binary files differ
diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/content_icon_small.png b/samples/browseable/Notifications/Application/res/drawable-nodpi/content_icon_small.png
index 9a9f4b4b5..9a9f4b4b5 100644
--- a/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/content_icon_small.png
+++ b/samples/browseable/Notifications/Application/res/drawable-nodpi/content_icon_small.png
Binary files differ
diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/example_big_picture.jpg b/samples/browseable/Notifications/Application/res/drawable-nodpi/example_big_picture.jpg
index 68473ba6c..68473ba6c 100644
--- a/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/example_big_picture.jpg
+++ b/samples/browseable/Notifications/Application/res/drawable-nodpi/example_big_picture.jpg
Binary files differ
diff --git a/samples/browseable/Notifications/Application/res/drawable-nodpi/qr_code.png b/samples/browseable/Notifications/Application/res/drawable-nodpi/qr_code.png
new file mode 100644
index 000000000..0dcd7b7f4
--- /dev/null
+++ b/samples/browseable/Notifications/Application/res/drawable-nodpi/qr_code.png
Binary files differ
diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable-xhdpi/ic_full_action.png b/samples/browseable/Notifications/Application/res/drawable-xhdpi/ic_full_action.png
index 6a769521b..6a769521b 100644
--- a/samples/wearable/Notifications/Application/src/main/res/drawable-xhdpi/ic_full_action.png
+++ b/samples/browseable/Notifications/Application/res/drawable-xhdpi/ic_full_action.png
Binary files differ
diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable-xhdpi/ic_full_reply.png b/samples/browseable/Notifications/Application/res/drawable-xhdpi/ic_full_reply.png
index dba6fa7b0..dba6fa7b0 100644
--- a/samples/wearable/Notifications/Application/src/main/res/drawable-xhdpi/ic_full_reply.png
+++ b/samples/browseable/Notifications/Application/res/drawable-xhdpi/ic_full_reply.png
Binary files differ
diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable-xhdpi/ic_result_open.png b/samples/browseable/Notifications/Application/res/drawable-xhdpi/ic_result_open.png
index 7d3c785c8..7d3c785c8 100644
--- a/samples/wearable/Notifications/Application/src/main/res/drawable-xhdpi/ic_result_open.png
+++ b/samples/browseable/Notifications/Application/res/drawable-xhdpi/ic_result_open.png
Binary files differ
diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable/selected_background.xml b/samples/browseable/Notifications/Application/res/drawable/selected_background.xml
index 5852dd89a..5852dd89a 100644
--- a/samples/wearable/Notifications/Application/src/main/res/drawable/selected_background.xml
+++ b/samples/browseable/Notifications/Application/res/drawable/selected_background.xml
diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable/unselected_background.xml b/samples/browseable/Notifications/Application/res/drawable/unselected_background.xml
index 161316759..161316759 100644
--- a/samples/wearable/Notifications/Application/src/main/res/drawable/unselected_background.xml
+++ b/samples/browseable/Notifications/Application/res/drawable/unselected_background.xml
diff --git a/samples/browseable/Notifications/Application/res/layout/activity_main.xml b/samples/browseable/Notifications/Application/res/layout/activity_main.xml
new file mode 100755
index 000000000..be1aa49d9
--- /dev/null
+++ b/samples/browseable/Notifications/Application/res/layout/activity_main.xml
@@ -0,0 +1,36 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <LinearLayout style="@style/Widget.SampleMessageTile"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView style="@style/Widget.SampleMessage"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="@dimen/horizontal_page_margin"
+ android:layout_marginRight="@dimen/horizontal_page_margin"
+ android:layout_marginTop="@dimen/vertical_page_margin"
+ android:layout_marginBottom="@dimen/vertical_page_margin"
+ android:text="@string/intro_message" />
+ </LinearLayout>
+</LinearLayout>
diff --git a/samples/wearable/Notifications/Application/src/main/res/layout/background_picker.xml b/samples/browseable/Notifications/Application/res/layout/background_picker.xml
index 03f77f1c1..03f77f1c1 100644
--- a/samples/wearable/Notifications/Application/src/main/res/layout/background_picker.xml
+++ b/samples/browseable/Notifications/Application/res/layout/background_picker.xml
diff --git a/samples/wearable/Notifications/Application/src/main/res/layout/layout_divider.xml b/samples/browseable/Notifications/Application/res/layout/layout_divider.xml
index 82142b7f3..82142b7f3 100644
--- a/samples/wearable/Notifications/Application/src/main/res/layout/layout_divider.xml
+++ b/samples/browseable/Notifications/Application/res/layout/layout_divider.xml
diff --git a/samples/wearable/Notifications/Application/src/main/res/layout/activity_main.xml b/samples/browseable/Notifications/Application/res/layout/main.xml
index 3068ddcd6..3068ddcd6 100644
--- a/samples/wearable/Notifications/Application/src/main/res/layout/activity_main.xml
+++ b/samples/browseable/Notifications/Application/res/layout/main.xml
diff --git a/samples/wearable/Notifications/Application/src/main/res/layout/simple_spinner_item.xml b/samples/browseable/Notifications/Application/res/layout/simple_spinner_item.xml
index 342a13027..342a13027 100644
--- a/samples/wearable/Notifications/Application/src/main/res/layout/simple_spinner_item.xml
+++ b/samples/browseable/Notifications/Application/res/layout/simple_spinner_item.xml
diff --git a/samples/wearable/Notifications/Application/src/main/res/mipmap-hdpi/ic_launcher.png b/samples/browseable/Notifications/Application/res/mipmap-hdpi/ic_launcher.png
index 41479debe..41479debe 100644
--- a/samples/wearable/Notifications/Application/src/main/res/mipmap-hdpi/ic_launcher.png
+++ b/samples/browseable/Notifications/Application/res/mipmap-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/Notifications/Application/src/main/res/mipmap-mdpi/ic_launcher.png b/samples/browseable/Notifications/Application/res/mipmap-mdpi/ic_launcher.png
index 380b02f45..380b02f45 100644
--- a/samples/wearable/Notifications/Application/src/main/res/mipmap-mdpi/ic_launcher.png
+++ b/samples/browseable/Notifications/Application/res/mipmap-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/Notifications/Application/src/main/res/mipmap-xhdpi/ic_launcher.png b/samples/browseable/Notifications/Application/res/mipmap-xhdpi/ic_launcher.png
index b3e251e0b..b3e251e0b 100644
--- a/samples/wearable/Notifications/Application/src/main/res/mipmap-xhdpi/ic_launcher.png
+++ b/samples/browseable/Notifications/Application/res/mipmap-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/Notifications/Application/src/main/res/mipmap-xxhdpi/ic_launcher.png b/samples/browseable/Notifications/Application/res/mipmap-xxhdpi/ic_launcher.png
index 1962289e7..1962289e7 100644
--- a/samples/wearable/Notifications/Application/src/main/res/mipmap-xxhdpi/ic_launcher.png
+++ b/samples/browseable/Notifications/Application/res/mipmap-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/Notifications/Application/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/samples/browseable/Notifications/Application/res/mipmap-xxxhdpi/ic_launcher.png
index 163f1f000..163f1f000 100644
--- a/samples/wearable/Notifications/Application/src/main/res/mipmap-xxxhdpi/ic_launcher.png
+++ b/samples/browseable/Notifications/Application/res/mipmap-xxxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/Notifications/Application/res/values-sw600dp/template-dimens.xml b/samples/browseable/Notifications/Application/res/values-sw600dp/template-dimens.xml
new file mode 100644
index 000000000..22074a2bd
--- /dev/null
+++ b/samples/browseable/Notifications/Application/res/values-sw600dp/template-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>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_huge</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/Notifications/Application/res/values-sw600dp/template-styles.xml b/samples/browseable/Notifications/Application/res/values-sw600dp/template-styles.xml
new file mode 100644
index 000000000..03d197418
--- /dev/null
+++ b/samples/browseable/Notifications/Application/res/values-sw600dp/template-styles.xml
@@ -0,0 +1,25 @@
+<!--
+ 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.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceLarge</item>
+ <item name="android:lineSpacingMultiplier">1.2</item>
+ <item name="android:shadowDy">-6.5</item>
+ </style>
+
+</resources>
diff --git a/samples/browseable/Notifications/Application/res/values-v11/template-styles.xml b/samples/browseable/Notifications/Application/res/values-v11/template-styles.xml
new file mode 100644
index 000000000..8c1ea66f2
--- /dev/null
+++ b/samples/browseable/Notifications/Application/res/values-v11/template-styles.xml
@@ -0,0 +1,22 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Holo.Light" />
+
+</resources>
diff --git a/samples/browseable/Notifications/Application/res/values-v21/base-colors.xml b/samples/browseable/Notifications/Application/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/Notifications/Application/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/Notifications/Application/res/values-v21/base-template-styles.xml b/samples/browseable/Notifications/Application/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/Notifications/Application/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/Notifications/Application/res/values/base-strings.xml b/samples/browseable/Notifications/Application/res/values/base-strings.xml
new file mode 100644
index 000000000..55d83b021
--- /dev/null
+++ b/samples/browseable/Notifications/Application/res/values/base-strings.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<resources>
+ <string name="app_name">Wearable Notifications</string>
+ <string name="intro_message">
+ <![CDATA[
+
+
+This sample application provides a showcase of available notification styles and
+demonstrates various features of the Android Wear notifications API. Running the sample on your
+companion allows you to select between various notification styles and to see how these
+notifications are displayed, both in a phone\'s notification shade and on the wearable.
+
+
+ ]]>
+ </string>
+</resources>
diff --git a/samples/browseable/Notifications/Application/res/values/colors.xml b/samples/browseable/Notifications/Application/res/values/colors.xml
new file mode 100644
index 000000000..fbcf9562c
--- /dev/null
+++ b/samples/browseable/Notifications/Application/res/values/colors.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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>
+ <color name="divider_text">@android:color/holo_blue_dark</color>
+</resources>
diff --git a/samples/wearable/Notifications/Application/src/main/res/values/dimens.xml b/samples/browseable/Notifications/Application/res/values/dimens.xml
index fd97910ac..fd97910ac 100644
--- a/samples/wearable/Notifications/Application/src/main/res/values/dimens.xml
+++ b/samples/browseable/Notifications/Application/res/values/dimens.xml
diff --git a/samples/browseable/Notifications/Application/res/values/strings.xml b/samples/browseable/Notifications/Application/res/values/strings.xml
new file mode 100644
index 000000000..ffcb9f3ab
--- /dev/null
+++ b/samples/browseable/Notifications/Application/res/values/strings.xml
@@ -0,0 +1,196 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+
+ <string name="properties">Properties</string>
+ <string name="preset">Preset</string>
+ <string name="text">Text</string>
+ <string name="title">Title</string>
+ <string name="priority">Priority</string>
+ <string name="actions">Actions</string>
+ <string name="include_large_icon">Include large icon</string>
+ <string name="local_only">Local only</string>
+ <string name="include_content_intent">Include content intent</string>
+ <string name="vibrate">Vibrate</string>
+
+ <string name="basic_example">Basic example</string>
+ <string name="stylized_text_example">Stylized text example</string>
+ <string name="inbox_example">Inbox example</string>
+ <string name="big_picture_example">Big picture example</string>
+ <string name="big_text_example">Big text example</string>
+ <string name="bottom_aligned_example">Bottom-aligned example</string>
+ <string name="gravity_example">Gravity example</string>
+ <string name="content_action_example">Content action example</string>
+ <string name="content_icon_example">Content icon example</string>
+ <string name="multiple_page_example">Multiple page example</string>
+ <string name="bundle_example">Bundle example</string>
+ <string name="barcode_example">Barcode example</string>
+
+ <string name="min_priority">Min priority</string>
+ <string name="low_priority">Low priority</string>
+ <string name="default_priority">Default priority</string>
+ <string name="high_priority">High priority</string>
+ <string name="max_priority">Max priority</string>
+
+ <string name="no_actions">No actions</string>
+ <string name="single_action">Single action</string>
+ <string name="long_title_action">Single action with a long title</string>
+ <string name="reply_action">Reply action</string>
+ <string name="reply_action_with_choices">Reply action with choices</string>
+ <string name="different_actions_on_phone_and_wearable">Different on phone and wearable</string>
+
+ <string name="example_action">Example action</string>
+ <string name="example_action_long_title">Example action with a long title which wraps</string>
+ <string name="example_reply_action">Example reply action</string>
+ <string name="phone_action">Phone action</string>
+ <string name="wearable_action">Wearable action</string>
+
+ <string name="example_action_clicked">Example action clicked</string>
+ <string name="example_reply_action_clicked">Example reply action clicked</string>
+ <string name="phone_action_clicked">Phone action clicked</string>
+ <string name="wearable_action_clicked">Wearable action clicked</string>
+ <string name="second_child_action_clicked">Second child action clicked</string>
+ <string name="content_intent_clicked">Content intent clicked</string>
+ <string name="example_content_action_clicked">Example content action clicked</string>
+ <string name="example_content_action2_clicked">Example content action 2 clicked</string>
+ <string name="example_notification_deleted">Example notification deleted</string>
+
+ <string name="example_content_title">Basic example title</string>
+ <string name="example_content_text">Basic example text</string>
+
+ <string name="big_text_example_title">Big text example title</string>
+ <string name="big_text_example_summary_text">Big text example summary</string>
+ <string name="big_text_example_big_text">
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
+ incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
+ exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
+ dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
+ Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
+ anim id est laborum.
+
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
+ incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
+ exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
+ dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
+ Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
+ anim id est laborum.
+
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
+ incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
+ exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
+ dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
+ Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
+ anim id est laborum.
+
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
+ incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
+ exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
+ dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
+ Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
+ anim id est laborum.
+
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
+ incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
+ exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
+ dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
+ Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
+ anim id est laborum.
+
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
+ incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
+ exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
+ dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
+ Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
+ anim id est laborum.
+
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
+ incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
+ exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
+ dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
+ Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
+ anim id est laborum.
+
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
+ incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
+ exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
+ dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
+ Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
+ anim id est laborum.
+
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
+ incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
+ exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
+ dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
+ Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
+ anim id est laborum.
+
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
+ incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
+ exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
+ dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
+ Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
+ anim id est laborum.
+
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
+ incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
+ exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
+ dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
+ Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
+ anim id est laborum.
+ </string>
+
+ <string name="inbox_style_example_title">Inbox style example title</string>
+ <string name="inbox_style_example_summary_text">Inbox style example summary</string>
+ <string name="inbox_style_example_line1">Inbox style example line 1</string>
+ <string name="inbox_style_example_line2">Inbox style example line 2</string>
+ <string name="inbox_style_example_line3">Inbox style example line 3</string>
+
+ <string name="big_picture_style_example_title">Big picture style example title</string>
+ <string name="big_picture_style_example_summary_text">Big picture style example summary</string>
+
+ <string name="barcode_content_title">Barcode example</string>
+ <string name="barcode_content_text">Swipe to view</string>
+
+ <string name="second_page_content_title">Second page title</string>
+ <string name="second_page_content_text">Second page text</string>
+
+ <string name="third_page_content_title">Third page title</string>
+ <string name="third_page_content_text">Third page text</string>
+
+ <string name="fourth_page_content_title">Fourth page title</string>
+ <string name="fourth_page_content_text">Fourth page text</string>
+
+ <string name="first_child_content_title">First child title</string>
+ <string name="first_child_content_text">
+ First child text. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
+ tempor incididunt ut labore et dolore magna aliqua.</string>
+ <string name="second_child_content_title">Second child title</string>
+ <string name="second_child_content_text">
+ Second child text. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
+ tempor incididunt ut labore et dolore magna aliqua.</string>
+ <string name="second_child_action">Second child action</string>
+
+ <string name="example_reply_label">Message?</string>
+
+ <string name="example_reply_answer_label">Answer?</string>
+ <string name="yes">Yes</string>
+ <string name="no">No</string>
+ <string name="maybe">Maybe</string>
+
+ <string name="bg_picker_label">Page %s background: </string>
+
+</resources>
diff --git a/samples/browseable/Notifications/Application/res/values/styles.xml b/samples/browseable/Notifications/Application/res/values/styles.xml
new file mode 100644
index 000000000..69f8dfaa7
--- /dev/null
+++ b/samples/browseable/Notifications/Application/res/values/styles.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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="bg_picker">
+ <item name="android:layout_marginLeft">16dp</item>
+ <item name="android:background">@drawable/unselected_background</item>
+ </style>
+
+</resources>
diff --git a/samples/browseable/Notifications/Application/res/values/template-dimens.xml b/samples/browseable/Notifications/Application/res/values/template-dimens.xml
new file mode 100644
index 000000000..39e710b5c
--- /dev/null
+++ b/samples/browseable/Notifications/Application/res/values/template-dimens.xml
@@ -0,0 +1,32 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Define standard dimensions to comply with Holo-style grids and rhythm. -->
+
+ <dimen name="margin_tiny">4dp</dimen>
+ <dimen name="margin_small">8dp</dimen>
+ <dimen name="margin_medium">16dp</dimen>
+ <dimen name="margin_large">32dp</dimen>
+ <dimen name="margin_huge">64dp</dimen>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_medium</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/Notifications/Application/res/values/template-styles.xml b/samples/browseable/Notifications/Application/res/values/template-styles.xml
new file mode 100644
index 000000000..6e7d593dd
--- /dev/null
+++ b/samples/browseable/Notifications/Application/res/values/template-styles.xml
@@ -0,0 +1,42 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+
+ <style name="Theme.Base" parent="android:Theme.Light" />
+
+ <style name="Theme.Sample" parent="Theme.Base" />
+
+ <style name="AppTheme" parent="Theme.Sample" />
+ <!-- Widget styling -->
+
+ <style name="Widget" />
+
+ <style name="Widget.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceMedium</item>
+ <item name="android:lineSpacingMultiplier">1.1</item>
+ </style>
+
+ <style name="Widget.SampleMessageTile">
+ <item name="android:background">@drawable/tile</item>
+ <item name="android:shadowColor">#7F000000</item>
+ <item name="android:shadowDy">-3.5</item>
+ <item name="android:shadowRadius">2</item>
+ </style>
+
+</resources>
diff --git a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/ActionsPreset.java b/samples/browseable/Notifications/Application/src/com.example.android.support.wearable.notifications/ActionsPreset.java
index a550912df..a550912df 100644
--- a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/ActionsPreset.java
+++ b/samples/browseable/Notifications/Application/src/com.example.android.support.wearable.notifications/ActionsPreset.java
diff --git a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/ActionsPresets.java b/samples/browseable/Notifications/Application/src/com.example.android.support.wearable.notifications/ActionsPresets.java
index ff639dcb9..ff639dcb9 100644
--- a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/ActionsPresets.java
+++ b/samples/browseable/Notifications/Application/src/com.example.android.support.wearable.notifications/ActionsPresets.java
diff --git a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/BackgroundPickers.java b/samples/browseable/Notifications/Application/src/com.example.android.support.wearable.notifications/BackgroundPickers.java
index aedd548df..aedd548df 100644
--- a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/BackgroundPickers.java
+++ b/samples/browseable/Notifications/Application/src/com.example.android.support.wearable.notifications/BackgroundPickers.java
diff --git a/samples/browseable/Notifications/Application/src/com.example.android.support.wearable.notifications/MainActivity.java b/samples/browseable/Notifications/Application/src/com.example.android.support.wearable.notifications/MainActivity.java
new file mode 100644
index 000000000..4ade3ed1f
--- /dev/null
+++ b/samples/browseable/Notifications/Application/src/com.example.android.support.wearable.notifications/MainActivity.java
@@ -0,0 +1,352 @@
+/*
+ * Copyright (C) 2014 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.support.wearable.notifications;
+
+import android.app.Activity;
+import android.app.Notification;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.support.v4.app.NotificationManagerCompat;
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+import android.widget.EditText;
+import android.widget.Spinner;
+import android.widget.TextView;
+
+import java.util.Arrays;
+
+/**
+ * Main activity which posts a notification when resumed, and allows customization
+ * of that notification via controls.
+ */
+public class MainActivity extends Activity implements Handler.Callback {
+ private static final int MSG_POST_NOTIFICATIONS = 0;
+ private static final long POST_NOTIFICATIONS_DELAY_MS = 200;
+
+ private Handler mHandler;
+ private Spinner mPresetSpinner;
+ private EditText mTitleEditText;
+ private EditText mTextEditText;
+ private TextWatcher mTextChangedListener;
+ private Spinner mPrioritySpinner;
+ private Spinner mActionsSpinner;
+ private CheckBox mIncludeLargeIconCheckbox;
+ private CheckBox mLocalOnlyCheckbox;
+ private CheckBox mIncludeContentIntentCheckbox;
+ private CheckBox mVibrateCheckbox;
+ private BackgroundPickers mBackgroundPickers;
+ private int postedNotificationCount = 0;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.main);
+
+ mHandler = new Handler(this);
+ mTextChangedListener = new UpdateNotificationsOnTextChangeListener();
+
+ initPresetSpinner();
+ initTitleEditText();
+ initTextEditText();
+ initPrioritySpinner();
+ initActionsSpinner();
+ initIncludeLargeIconCheckbox();
+ initLocalOnlyCheckbox();
+ initIncludeContentIntentCheckbox();
+ initVibrateCheckbox();
+ initBackgroundPickers();
+
+ NotificationPreset preset = NotificationPresets.PRESETS[
+ mPresetSpinner.getSelectedItemPosition()];
+ updateTextEditors(preset);
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ updateNotifications(false /* cancelExisting */);
+ }
+
+ private void initPresetSpinner() {
+ mPresetSpinner = (Spinner) findViewById(R.id.preset_spinner);
+ mPresetSpinner.setAdapter(new NamedPresetSpinnerArrayAdapter(this,
+ NotificationPresets.PRESETS));
+ mPresetSpinner.post(new Runnable() {
+ @Override
+ public void run() {
+ mPresetSpinner.setOnItemSelectedListener(new PresetSpinnerListener());
+ }
+ });
+ }
+
+ private void initTitleEditText() {
+ mTitleEditText = (EditText) findViewById(R.id.title_editor);
+ }
+
+ private void initTextEditText() {
+ mTextEditText = (EditText) findViewById(R.id.text_editor);
+ }
+
+ private void initPrioritySpinner() {
+ mPrioritySpinner = (Spinner) findViewById(R.id.priority_spinner);
+ mPrioritySpinner.setAdapter(new NamedPresetSpinnerArrayAdapter(this,
+ PriorityPresets.PRESETS));
+ mPrioritySpinner.setSelection(Arrays.asList(PriorityPresets.PRESETS)
+ .indexOf(PriorityPresets.DEFAULT));
+ mPrioritySpinner.post(new Runnable() {
+ @Override
+ public void run() {
+ mPrioritySpinner.setOnItemSelectedListener(
+ new UpdateNotificationsOnItemSelectedListener(true /* cancelExisting */));
+ }
+ });
+ }
+
+ private void initActionsSpinner() {
+ mActionsSpinner = (Spinner) findViewById(R.id.actions_spinner);
+ mActionsSpinner.setAdapter(new NamedPresetSpinnerArrayAdapter(this,
+ ActionsPresets.PRESETS));
+ mActionsSpinner.post(new Runnable() {
+ @Override
+ public void run() {
+ mActionsSpinner.setOnItemSelectedListener(
+ new UpdateNotificationsOnItemSelectedListener(false /* cancelExisting */));
+ }
+ });
+ }
+
+ private void initIncludeLargeIconCheckbox() {
+ mIncludeLargeIconCheckbox = (CheckBox) findViewById(R.id.include_large_icon_checkbox);
+ mIncludeLargeIconCheckbox.setOnCheckedChangeListener(
+ new UpdateNotificationsOnCheckedChangeListener(false /* cancelExisting */));
+ }
+
+ private void initLocalOnlyCheckbox() {
+ mLocalOnlyCheckbox = (CheckBox) findViewById(R.id.local_only_checkbox);
+ mLocalOnlyCheckbox.setOnCheckedChangeListener(
+ new UpdateNotificationsOnCheckedChangeListener(false /* cancelExisting */));
+ }
+
+ private void initIncludeContentIntentCheckbox() {
+ mIncludeContentIntentCheckbox = (CheckBox) findViewById(
+ R.id.include_content_intent_checkbox);
+ mIncludeContentIntentCheckbox.setOnCheckedChangeListener(
+ new UpdateNotificationsOnCheckedChangeListener(false /* cancelExisting */));
+ }
+
+ private void initVibrateCheckbox() {
+ mVibrateCheckbox = (CheckBox) findViewById(R.id.vibrate_checkbox);
+ mVibrateCheckbox.setOnCheckedChangeListener(
+ new UpdateNotificationsOnCheckedChangeListener(false /* cancelExisting */));
+ }
+
+ private void initBackgroundPickers() {
+ mBackgroundPickers = new BackgroundPickers(
+ (ViewGroup) findViewById(R.id.background_pickers),
+ new BackgroundPickerListener());
+ }
+
+ private void updateTextEditors(NotificationPreset preset) {
+ mTitleEditText.setText(getString(preset.titleResId));
+ mTextEditText.setText(getString(preset.textResId));
+ if (preset == NotificationPresets.BASIC) {
+ findViewById(R.id.title_edit_field).setVisibility(View.VISIBLE);
+ mTitleEditText.addTextChangedListener(mTextChangedListener);
+ findViewById(R.id.text_edit_field).setVisibility(View.VISIBLE);
+ mTextEditText.addTextChangedListener(mTextChangedListener);
+ } else {
+ findViewById(R.id.title_edit_field).setVisibility(View.GONE);
+ mTitleEditText.removeTextChangedListener(mTextChangedListener);
+ findViewById(R.id.text_edit_field).setVisibility(View.GONE);
+ mTextEditText.removeTextChangedListener(mTextChangedListener);
+ }
+ }
+
+ /**
+ * Begin to re-post the sample notification(s).
+ */
+ private void updateNotifications(boolean cancelExisting) {
+ // Disable messages to skip notification deleted messages during cancel.
+ sendBroadcast(new Intent(NotificationIntentReceiver.ACTION_DISABLE_MESSAGES)
+ .setClass(this, NotificationIntentReceiver.class));
+
+ if (cancelExisting) {
+ // Cancel all existing notifications to trigger fresh-posting behavior: For example,
+ // switching from HIGH to LOW priority does not cause a reordering in Notification Shade.
+ NotificationManagerCompat.from(this).cancelAll();
+ postedNotificationCount = 0;
+
+ // Post the updated notifications on a delay to avoid a cancel+post race condition
+ // with notification manager.
+ mHandler.removeMessages(MSG_POST_NOTIFICATIONS);
+ mHandler.sendEmptyMessageDelayed(MSG_POST_NOTIFICATIONS, POST_NOTIFICATIONS_DELAY_MS);
+ } else {
+ postNotifications();
+ }
+ }
+
+ /**
+ * Post the sample notification(s) using current options.
+ */
+ private void postNotifications() {
+ sendBroadcast(new Intent(NotificationIntentReceiver.ACTION_ENABLE_MESSAGES)
+ .setClass(this, NotificationIntentReceiver.class));
+
+ NotificationPreset preset = NotificationPresets.PRESETS[
+ mPresetSpinner.getSelectedItemPosition()];
+ CharSequence titlePreset = mTitleEditText.getText();
+ CharSequence textPreset = mTextEditText.getText();
+ PriorityPreset priorityPreset = PriorityPresets.PRESETS[
+ mPrioritySpinner.getSelectedItemPosition()];
+ ActionsPreset actionsPreset = ActionsPresets.PRESETS[
+ mActionsSpinner.getSelectedItemPosition()];
+ if (preset.actionsRequired() && actionsPreset == ActionsPresets.NO_ACTIONS_PRESET) {
+ // If actions are required, but the no-actions preset was selected, change presets.
+ actionsPreset = ActionsPresets.SINGLE_ACTION_PRESET;
+ mActionsSpinner.setSelection(Arrays.asList(ActionsPresets.PRESETS).indexOf(
+ actionsPreset), true);
+ }
+ NotificationPreset.BuildOptions options = new NotificationPreset.BuildOptions(
+ titlePreset,
+ textPreset,
+ priorityPreset,
+ actionsPreset,
+ mIncludeLargeIconCheckbox.isChecked(),
+ mLocalOnlyCheckbox.isChecked(),
+ mIncludeContentIntentCheckbox.isChecked(),
+ mVibrateCheckbox.isChecked(),
+ mBackgroundPickers.getRes());
+ Notification[] notifications = preset.buildNotifications(this, options);
+
+ // Post new notifications
+ for (int i = 0; i < notifications.length; i++) {
+ NotificationManagerCompat.from(this).notify(i, notifications[i]);
+ }
+ // Cancel any that are beyond the current count.
+ for (int i = notifications.length; i < postedNotificationCount; i++) {
+ NotificationManagerCompat.from(this).cancel(i);
+ }
+ postedNotificationCount = notifications.length;
+ }
+
+ @Override
+ public boolean handleMessage(Message message) {
+ switch (message.what) {
+ case MSG_POST_NOTIFICATIONS:
+ postNotifications();
+ return true;
+ }
+ return false;
+ }
+
+ private class PresetSpinnerListener implements AdapterView.OnItemSelectedListener {
+ @Override
+ public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
+ NotificationPreset preset = NotificationPresets.PRESETS[position];
+ mBackgroundPickers.generatePickers(preset.countBackgroundPickersRequired());
+ updateTextEditors(preset);
+ updateNotifications(false /* cancelExisting */);
+ }
+
+ @Override
+ public void onNothingSelected(AdapterView<?> adapterView) {
+ }
+ }
+
+ private class UpdateNotificationsOnTextChangeListener implements TextWatcher {
+ @Override
+ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+ }
+
+ public void onTextChanged(CharSequence s, int start, int before, int count) {
+ }
+
+ @Override
+ public void afterTextChanged(Editable s) {
+ updateNotifications(false /* cancelExisting */);
+ }
+ }
+
+ private class UpdateNotificationsOnItemSelectedListener
+ implements AdapterView.OnItemSelectedListener {
+ private final boolean mCancelExisting;
+
+ public UpdateNotificationsOnItemSelectedListener(boolean cancelExisting) {
+ mCancelExisting = cancelExisting;
+ }
+ @Override
+ public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
+ updateNotifications(mCancelExisting);
+ }
+
+ @Override
+ public void onNothingSelected(AdapterView<?> adapterView) {
+ }
+ }
+
+ private class UpdateNotificationsOnCheckedChangeListener
+ implements CompoundButton.OnCheckedChangeListener {
+ private final boolean mCancelExisting;
+
+ public UpdateNotificationsOnCheckedChangeListener(boolean cancelExisting) {
+ mCancelExisting = cancelExisting;
+ }
+
+ @Override
+ public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
+ updateNotifications(mCancelExisting);
+ }
+ }
+
+ private class BackgroundPickerListener
+ implements BackgroundPickers.OnBackgroundPickersChangedListener {
+ @Override
+ public void onBackgroundPickersChanged(BackgroundPickers pickers) {
+ updateNotifications(false /* cancelExisting */);
+ }
+ }
+
+ private class NamedPresetSpinnerArrayAdapter extends ArrayAdapter<NamedPreset> {
+ public NamedPresetSpinnerArrayAdapter(Context context, NamedPreset[] presets) {
+ super(context, R.layout.simple_spinner_item, presets);
+ }
+
+ @Override
+ public View getDropDownView(int position, View convertView, ViewGroup parent) {
+ TextView view = (TextView) super.getDropDownView(position, convertView, parent);
+ view.setText(getString(getItem(position).nameResId));
+ return view;
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ TextView view = (TextView) getLayoutInflater().inflate(
+ android.R.layout.simple_spinner_item, parent, false);
+ view.setText(getString(getItem(position).nameResId));
+ return view;
+ }
+ }
+}
diff --git a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/NamedPreset.java b/samples/browseable/Notifications/Application/src/com.example.android.support.wearable.notifications/NamedPreset.java
index afc5f169d..afc5f169d 100644
--- a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/NamedPreset.java
+++ b/samples/browseable/Notifications/Application/src/com.example.android.support.wearable.notifications/NamedPreset.java
diff --git a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/NotificationIntentReceiver.java b/samples/browseable/Notifications/Application/src/com.example.android.support.wearable.notifications/NotificationIntentReceiver.java
index 39a1c7850..39a1c7850 100644
--- a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/NotificationIntentReceiver.java
+++ b/samples/browseable/Notifications/Application/src/com.example.android.support.wearable.notifications/NotificationIntentReceiver.java
diff --git a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/NotificationPreset.java b/samples/browseable/Notifications/Application/src/com.example.android.support.wearable.notifications/NotificationPreset.java
index a0dff1874..a0dff1874 100644
--- a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/NotificationPreset.java
+++ b/samples/browseable/Notifications/Application/src/com.example.android.support.wearable.notifications/NotificationPreset.java
diff --git a/samples/browseable/Notifications/Application/src/com.example.android.support.wearable.notifications/NotificationPresets.java b/samples/browseable/Notifications/Application/src/com.example.android.support.wearable.notifications/NotificationPresets.java
new file mode 100644
index 000000000..641b861fe
--- /dev/null
+++ b/samples/browseable/Notifications/Application/src/com.example.android.support.wearable.notifications/NotificationPresets.java
@@ -0,0 +1,510 @@
+/*
+ * Copyright (C) 2014 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.support.wearable.notifications;
+
+import android.app.Notification;
+import android.content.Context;
+import android.graphics.BitmapFactory;
+import android.graphics.Color;
+import android.graphics.Typeface;
+import android.support.v4.app.NotificationCompat;
+import android.text.SpannableStringBuilder;
+import android.text.style.ForegroundColorSpan;
+import android.text.style.RelativeSizeSpan;
+import android.text.style.StrikethroughSpan;
+import android.text.style.StyleSpan;
+import android.text.style.SubscriptSpan;
+import android.text.style.SuperscriptSpan;
+import android.text.style.TypefaceSpan;
+import android.text.style.UnderlineSpan;
+import android.view.Gravity;
+
+/**
+ * Collection of notification builder presets.
+ */
+public class NotificationPresets {
+ private static final String EXAMPLE_GROUP_KEY = "example";
+
+ public static final NotificationPreset BASIC = new BasicNotificationPreset();
+ public static final NotificationPreset STYLIZED_TEXT = new StylizedTextNotificationPreset();
+ public static final NotificationPreset INBOX = new InboxNotificationPreset();
+ public static final NotificationPreset BIG_PICTURE = new BigPictureNotificationPreset();
+ public static final NotificationPreset BIG_TEXT = new BigTextNotificationPreset();
+ public static final NotificationPreset BOTTOM_ALIGNED = new BottomAlignedNotificationPreset();
+ public static final NotificationPreset GRAVITY = new GravityNotificationPreset();
+ public static final NotificationPreset CONTENT_ACTION = new ContentActionNotificationPreset();
+ public static final NotificationPreset CONTENT_ICON = new ContentIconNotificationPreset();
+ public static final NotificationPreset MULTIPLE_PAGE = new MultiplePageNotificationPreset();
+ public static final NotificationPreset BUNDLE = new NotificationBundlePreset();
+ public static final NotificationPreset BARCODE = new NotificationBarcodePreset();
+
+ public static final NotificationPreset[] PRESETS = new NotificationPreset[] {
+ BASIC,
+ STYLIZED_TEXT,
+ INBOX,
+ BIG_PICTURE,
+ BIG_TEXT,
+ BOTTOM_ALIGNED,
+ GRAVITY,
+ CONTENT_ACTION,
+ CONTENT_ICON,
+ MULTIPLE_PAGE,
+ BUNDLE,
+ BARCODE
+ };
+
+ private static NotificationCompat.Builder applyBasicOptions(Context context,
+ NotificationCompat.Builder builder, NotificationCompat.WearableExtender wearableOptions,
+ NotificationPreset.BuildOptions options) {
+ builder.setContentTitle(options.titlePreset)
+ .setContentText(options.textPreset)
+ .setSmallIcon(R.mipmap.ic_launcher)
+ .setDeleteIntent(NotificationUtil.getExamplePendingIntent(
+ context, R.string.example_notification_deleted));
+ options.actionsPreset.apply(context, builder, wearableOptions);
+ options.priorityPreset.apply(builder, wearableOptions);
+ if (options.includeLargeIcon) {
+ builder.setLargeIcon(BitmapFactory.decodeResource(
+ context.getResources(), R.drawable.example_large_icon));
+ }
+ if (options.isLocalOnly) {
+ builder.setLocalOnly(true);
+ }
+ if (options.hasContentIntent) {
+ builder.setContentIntent(NotificationUtil.getExamplePendingIntent(context,
+ R.string.content_intent_clicked));
+ }
+ if (options.vibrate) {
+ builder.setVibrate(new long[] {0, 100, 50, 100} );
+ }
+ return builder;
+ }
+
+ private static class BasicNotificationPreset extends NotificationPreset {
+ public BasicNotificationPreset() {
+ super(R.string.basic_example, R.string.example_content_title,
+ R.string.example_content_text);
+ }
+
+ @Override
+ public Notification[] buildNotifications(Context context, BuildOptions options) {
+ NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
+ NotificationCompat.WearableExtender wearableOptions =
+ new NotificationCompat.WearableExtender();
+ applyBasicOptions(context, builder, wearableOptions, options);
+ builder.extend(wearableOptions);
+ return new Notification[] { builder.build() };
+ }
+ }
+
+ private static class StylizedTextNotificationPreset extends NotificationPreset {
+ public StylizedTextNotificationPreset() {
+ super(R.string.stylized_text_example, R.string.example_content_title,
+ R.string.example_content_text);
+ }
+
+ @Override
+ public Notification[] buildNotifications(Context context, BuildOptions options) {
+ NotificationCompat.BigTextStyle style = new NotificationCompat.BigTextStyle();
+
+ SpannableStringBuilder title = new SpannableStringBuilder();
+ appendStyled(title, "Stylized", new StyleSpan(Typeface.BOLD_ITALIC));
+ title.append(" title");
+ SpannableStringBuilder text = new SpannableStringBuilder("Stylized text: ");
+ appendStyled(text, "C", new ForegroundColorSpan(Color.RED));
+ appendStyled(text, "O", new ForegroundColorSpan(Color.GREEN));
+ appendStyled(text, "L", new ForegroundColorSpan(Color.BLUE));
+ appendStyled(text, "O", new ForegroundColorSpan(Color.YELLOW));
+ appendStyled(text, "R", new ForegroundColorSpan(Color.MAGENTA));
+ appendStyled(text, "S", new ForegroundColorSpan(Color.CYAN));
+ text.append("; ");
+ appendStyled(text, "1.25x size", new RelativeSizeSpan(1.25f));
+ text.append("; ");
+ appendStyled(text, "0.75x size", new RelativeSizeSpan(0.75f));
+ text.append("; ");
+ appendStyled(text, "underline", new UnderlineSpan());
+ text.append("; ");
+ appendStyled(text, "strikethrough", new StrikethroughSpan());
+ text.append("; ");
+ appendStyled(text, "bold", new StyleSpan(Typeface.BOLD));
+ text.append("; ");
+ appendStyled(text, "italic", new StyleSpan(Typeface.ITALIC));
+ text.append("; ");
+ appendStyled(text, "sans-serif-thin", new TypefaceSpan("sans-serif-thin"));
+ text.append("; ");
+ appendStyled(text, "monospace", new TypefaceSpan("monospace"));
+ text.append("; ");
+ appendStyled(text, "sub", new SubscriptSpan());
+ text.append("script");
+ appendStyled(text, "super", new SuperscriptSpan());
+
+ style.setBigContentTitle(title);
+ style.bigText(text);
+
+ NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
+ .setStyle(style);
+ NotificationCompat.WearableExtender wearableOptions =
+ new NotificationCompat.WearableExtender();
+ applyBasicOptions(context, builder, wearableOptions, options);
+ builder.extend(wearableOptions);
+ return new Notification[] { builder.build() };
+ }
+
+ private void appendStyled(SpannableStringBuilder builder, String str, Object... spans) {
+ builder.append(str);
+ for (Object span : spans) {
+ builder.setSpan(span, builder.length() - str.length(), builder.length(), 0);
+ }
+ }
+ }
+
+ private static class InboxNotificationPreset extends NotificationPreset {
+ public InboxNotificationPreset() {
+ super(R.string.inbox_example, R.string.example_content_title,
+ R.string.example_content_text);
+ }
+
+ @Override
+ public Notification[] buildNotifications(Context context, BuildOptions options) {
+ NotificationCompat.InboxStyle style = new NotificationCompat.InboxStyle();
+ style.addLine(context.getString(R.string.inbox_style_example_line1));
+ style.addLine(context.getString(R.string.inbox_style_example_line2));
+ style.addLine(context.getString(R.string.inbox_style_example_line3));
+ style.setBigContentTitle(context.getString(R.string.inbox_style_example_title));
+ style.setSummaryText(context.getString(R.string.inbox_style_example_summary_text));
+
+ NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
+ .setStyle(style);
+ NotificationCompat.WearableExtender wearableOptions =
+ new NotificationCompat.WearableExtender();
+ applyBasicOptions(context, builder, wearableOptions, options);
+ builder.extend(wearableOptions);
+ return new Notification[] { builder.build() };
+ }
+ }
+
+ private static class BigPictureNotificationPreset extends NotificationPreset {
+ public BigPictureNotificationPreset() {
+ super(R.string.big_picture_example, R.string.example_content_title,
+ R.string.example_content_text);
+ }
+
+ @Override
+ public Notification[] buildNotifications(Context context, BuildOptions options) {
+ NotificationCompat.BigPictureStyle style = new NotificationCompat.BigPictureStyle();
+ style.bigPicture(BitmapFactory.decodeResource(context.getResources(),
+ R.drawable.example_big_picture));
+ style.setBigContentTitle(context.getString(R.string.big_picture_style_example_title));
+ style.setSummaryText(context.getString(
+ R.string.big_picture_style_example_summary_text));
+
+ NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
+ .setStyle(style);
+ NotificationCompat.WearableExtender wearableOptions =
+ new NotificationCompat.WearableExtender();
+ applyBasicOptions(context, builder, wearableOptions, options);
+ builder.extend(wearableOptions);
+ return new Notification[] { builder.build() };
+ }
+ }
+
+ private static class BigTextNotificationPreset extends NotificationPreset {
+ public BigTextNotificationPreset() {
+ super(R.string.big_text_example, R.string.example_content_title,
+ R.string.example_content_text);
+ }
+
+ @Override
+ public Notification[] buildNotifications(Context context, BuildOptions options) {
+ NotificationCompat.BigTextStyle style = new NotificationCompat.BigTextStyle();
+ style.bigText(context.getString(R.string.big_text_example_big_text));
+ style.setBigContentTitle(context.getString(R.string.big_text_example_title));
+ style.setSummaryText(context.getString(R.string.big_text_example_summary_text));
+
+ NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
+ .setStyle(style);
+ NotificationCompat.WearableExtender wearableOptions =
+ new NotificationCompat.WearableExtender();
+ applyBasicOptions(context, builder, wearableOptions, options);
+ builder.extend(wearableOptions);
+ return new Notification[] { builder.build() };
+ }
+ }
+
+ private static class BottomAlignedNotificationPreset extends NotificationPreset {
+ public BottomAlignedNotificationPreset() {
+ super(R.string.bottom_aligned_example, R.string.example_content_title,
+ R.string.example_content_text);
+ }
+
+ @Override
+ public Notification[] buildNotifications(Context context, BuildOptions options) {
+ NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
+ NotificationCompat.WearableExtender wearableOptions =
+ new NotificationCompat.WearableExtender();
+ applyBasicOptions(context, builder, wearableOptions, options);
+
+ NotificationCompat.Builder secondPageBuilder = new NotificationCompat.Builder(context);
+ secondPageBuilder.setContentTitle(
+ context.getString(R.string.second_page_content_title));
+ secondPageBuilder.setContentText(context.getString(R.string.big_text_example_big_text));
+ secondPageBuilder.extend(new NotificationCompat.WearableExtender()
+ .setStartScrollBottom(true));
+
+ wearableOptions.addPage(secondPageBuilder.build());
+ builder.extend(wearableOptions);
+ return new Notification[] { builder.build() };
+ }
+ }
+
+ private static class GravityNotificationPreset extends NotificationPreset {
+ public GravityNotificationPreset() {
+ super(R.string.gravity_example, R.string.example_content_title,
+ R.string.example_content_text);
+ }
+
+ @Override
+ public Notification[] buildNotifications(Context context, BuildOptions options) {
+ NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
+ NotificationCompat.WearableExtender wearableOptions =
+ new NotificationCompat.WearableExtender();
+ applyBasicOptions(context, builder, wearableOptions, options);
+
+ NotificationCompat.Builder secondPageBuilder = new NotificationCompat.Builder(context)
+ .setContentTitle(options.titlePreset)
+ .setContentText(options.textPreset)
+ .extend(new NotificationCompat.WearableExtender()
+ .setGravity(Gravity.CENTER_VERTICAL));
+ wearableOptions.addPage(secondPageBuilder.build());
+
+ NotificationCompat.Builder thirdPageBuilder = new NotificationCompat.Builder(context)
+ .setContentTitle(options.titlePreset)
+ .setContentText(options.textPreset)
+ .extend(new NotificationCompat.WearableExtender()
+ .setGravity(Gravity.TOP));
+ wearableOptions.addPage(thirdPageBuilder.build());
+
+ wearableOptions.setGravity(Gravity.BOTTOM);
+ builder.extend(wearableOptions);
+ return new Notification[] { builder.build() };
+ }
+ }
+
+ private static class ContentActionNotificationPreset extends NotificationPreset {
+ public ContentActionNotificationPreset() {
+ super(R.string.content_action_example, R.string.example_content_title,
+ R.string.example_content_text);
+ }
+
+ @Override
+ public Notification[] buildNotifications(Context context, BuildOptions options) {
+ Notification secondPage = new NotificationCompat.Builder(context)
+ .setContentTitle(context.getString(R.string.second_page_content_title))
+ .setContentText(context.getString(R.string.second_page_content_text))
+ .extend(new NotificationCompat.WearableExtender()
+ .setContentAction(1))
+ .build();
+
+ NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
+ NotificationCompat.Action action = new NotificationCompat.Action.Builder(
+ R.drawable.ic_result_open, null, NotificationUtil.getExamplePendingIntent(
+ context, R.string.example_content_action_clicked)).build();
+ NotificationCompat.Action action2 = new NotificationCompat.Action.Builder(
+ R.drawable.ic_result_open, null, NotificationUtil.getExamplePendingIntent(
+ context, R.string.example_content_action2_clicked)).build();
+ NotificationCompat.WearableExtender wearableOptions =
+ new NotificationCompat.WearableExtender()
+ .addAction(action)
+ .addAction(action2)
+ .addPage(secondPage)
+ .setContentAction(0)
+ .setHintHideIcon(true);
+ applyBasicOptions(context, builder, wearableOptions, options);
+ builder.extend(wearableOptions);
+ return new Notification[] { builder.build() };
+ }
+
+ @Override
+ public boolean actionsRequired() {
+ return true;
+ }
+ }
+
+ private static class ContentIconNotificationPreset extends NotificationPreset {
+ public ContentIconNotificationPreset() {
+ super(R.string.content_icon_example, R.string.example_content_title,
+ R.string.example_content_text);
+ }
+
+ @Override
+ public Notification[] buildNotifications(Context context, BuildOptions options) {
+ Notification secondPage = new NotificationCompat.Builder(context)
+ .setContentTitle(context.getString(R.string.second_page_content_title))
+ .setContentText(context.getString(R.string.second_page_content_text))
+ .extend(new NotificationCompat.WearableExtender()
+ .setContentIcon(R.drawable.content_icon_small)
+ .setContentIconGravity(Gravity.START))
+ .build();
+
+ Notification thirdPage = new NotificationCompat.Builder(context)
+ .setContentTitle(context.getString(R.string.third_page_content_title))
+ .setContentText(context.getString(R.string.third_page_content_text))
+ .extend(new NotificationCompat.WearableExtender()
+ .setContentIcon(R.drawable.content_icon_large))
+ .build();
+
+ Notification fourthPage = new NotificationCompat.Builder(context)
+ .setContentTitle(context.getString(R.string.fourth_page_content_title))
+ .setContentText(context.getString(R.string.fourth_page_content_text))
+ .extend(new NotificationCompat.WearableExtender()
+ .setContentIcon(R.drawable.content_icon_large)
+ .setContentIconGravity(Gravity.START))
+ .build();
+
+ NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
+ NotificationCompat.WearableExtender wearableOptions =
+ new NotificationCompat.WearableExtender()
+ .setHintHideIcon(true)
+ .setContentIcon(R.drawable.content_icon_small)
+ .addPage(secondPage)
+ .addPage(thirdPage)
+ .addPage(fourthPage);
+ applyBasicOptions(context, builder, wearableOptions, options);
+ builder.extend(wearableOptions);
+ return new Notification[] { builder.build() };
+ }
+ }
+
+ private static class MultiplePageNotificationPreset extends NotificationPreset {
+ public MultiplePageNotificationPreset() {
+ super(R.string.multiple_page_example, R.string.example_content_title,
+ R.string.example_content_text);
+ }
+
+ @Override
+ public Notification[] buildNotifications(Context context, BuildOptions options) {
+ NotificationCompat.Builder secondPageBuilder = new NotificationCompat.Builder(context)
+ .setContentTitle(context.getString(R.string.second_page_content_title))
+ .setContentText(context.getString(R.string.second_page_content_text));
+
+ NotificationCompat.Builder firstPageBuilder = new NotificationCompat.Builder(context);
+ NotificationCompat.WearableExtender firstPageWearableOptions =
+ new NotificationCompat.WearableExtender();
+ applyBasicOptions(context, firstPageBuilder, firstPageWearableOptions, options);
+
+ Integer firstBackground = options.backgroundIds == null
+ ? null : options.backgroundIds[0];
+ if (firstBackground != null) {
+ NotificationCompat.BigPictureStyle style =
+ new NotificationCompat.BigPictureStyle();
+ style.bigPicture(BitmapFactory.decodeResource(context.getResources(),
+ firstBackground));
+ firstPageBuilder.setStyle(style);
+ }
+
+ Integer secondBackground = options.backgroundIds == null
+ ? null : options.backgroundIds[1];
+ if (secondBackground != null) {
+ NotificationCompat.BigPictureStyle style = new NotificationCompat.BigPictureStyle();
+ style.bigPicture(BitmapFactory.decodeResource(context.getResources(),
+ secondBackground));
+ secondPageBuilder.setStyle(style);
+ }
+
+ firstPageBuilder.extend(
+ firstPageWearableOptions.addPage(secondPageBuilder.build()));
+
+ return new Notification[]{ firstPageBuilder.build() };
+ }
+
+ @Override
+ public int countBackgroundPickersRequired() {
+ return 2; // This sample does 2 pages notifications.
+ }
+ }
+
+ private static class NotificationBundlePreset extends NotificationPreset {
+ public NotificationBundlePreset() {
+ super(R.string.bundle_example, R.string.example_content_title,
+ R.string.example_content_text);
+ }
+
+ @Override
+ public Notification[] buildNotifications(Context context, BuildOptions options) {
+ NotificationCompat.Builder childBuilder1 = new NotificationCompat.Builder(context)
+ .setContentTitle(context.getString(R.string.first_child_content_title))
+ .setContentText(context.getString(R.string.first_child_content_text))
+ .setSmallIcon(R.mipmap.ic_launcher)
+ .setLocalOnly(options.isLocalOnly)
+ .setGroup(EXAMPLE_GROUP_KEY)
+ .setSortKey("0");
+
+ NotificationCompat.Builder childBuilder2 = new NotificationCompat.Builder(context)
+ .setContentTitle(context.getString(R.string.second_child_content_title))
+ .setContentText(context.getString(R.string.second_child_content_text))
+ .setSmallIcon(R.mipmap.ic_launcher)
+ .addAction(R.mipmap.ic_launcher,
+ context.getString(R.string.second_child_action),
+ NotificationUtil.getExamplePendingIntent(
+ context, R.string.second_child_action_clicked))
+ .setLocalOnly(options.isLocalOnly)
+ .setGroup(EXAMPLE_GROUP_KEY)
+ .setSortKey("1");
+
+ NotificationCompat.Builder summaryBuilder = new NotificationCompat.Builder(context)
+ .setGroup(EXAMPLE_GROUP_KEY)
+ .setGroupSummary(true);
+
+ NotificationCompat.WearableExtender summaryWearableOptions =
+ new NotificationCompat.WearableExtender();
+ applyBasicOptions(context, summaryBuilder, summaryWearableOptions, options);
+ summaryBuilder.extend(summaryWearableOptions);
+
+ return new Notification[] { summaryBuilder.build(), childBuilder1.build(),
+ childBuilder2.build() };
+ }
+ }
+
+ private static class NotificationBarcodePreset extends NotificationPreset {
+ public NotificationBarcodePreset() {
+ super(R.string.barcode_example, R.string.barcode_content_title,
+ R.string.barcode_content_text);
+ }
+
+ @Override
+ public Notification[] buildNotifications(Context context, BuildOptions options) {
+ NotificationCompat.Builder secondPageBuilder = new NotificationCompat.Builder(context)
+ .extend(new NotificationCompat.WearableExtender()
+ .setHintShowBackgroundOnly(true)
+ .setBackground(BitmapFactory.decodeResource(context.getResources(),
+ R.drawable.qr_code))
+ .setHintAvoidBackgroundClipping(true)
+ .setHintScreenTimeout(
+ NotificationCompat.WearableExtender.SCREEN_TIMEOUT_LONG));
+
+ NotificationCompat.Builder firstPageBuilder = new NotificationCompat.Builder(context);
+ NotificationCompat.WearableExtender firstPageWearableOptions =
+ new NotificationCompat.WearableExtender();
+ applyBasicOptions(context, firstPageBuilder, firstPageWearableOptions, options);
+
+ firstPageBuilder.extend(
+ firstPageWearableOptions.addPage(secondPageBuilder.build()));
+
+ return new Notification[]{ firstPageBuilder.build() };
+ }
+ }
+}
diff --git a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/NotificationUtil.java b/samples/browseable/Notifications/Application/src/com.example.android.support.wearable.notifications/NotificationUtil.java
index 389b90a5a..389b90a5a 100644
--- a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/NotificationUtil.java
+++ b/samples/browseable/Notifications/Application/src/com.example.android.support.wearable.notifications/NotificationUtil.java
diff --git a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/PriorityPreset.java b/samples/browseable/Notifications/Application/src/com.example.android.support.wearable.notifications/PriorityPreset.java
index b4298fd30..b4298fd30 100644
--- a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/PriorityPreset.java
+++ b/samples/browseable/Notifications/Application/src/com.example.android.support.wearable.notifications/PriorityPreset.java
diff --git a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/PriorityPresets.java b/samples/browseable/Notifications/Application/src/com.example.android.support.wearable.notifications/PriorityPresets.java
index c33b59d7a..c33b59d7a 100644
--- a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/PriorityPresets.java
+++ b/samples/browseable/Notifications/Application/src/com.example.android.support.wearable.notifications/PriorityPresets.java
diff --git a/samples/browseable/Notifications/Wearable/AndroidManifest.xml b/samples/browseable/Notifications/Wearable/AndroidManifest.xml
new file mode 100644
index 000000000..34a29ff66
--- /dev/null
+++ b/samples/browseable/Notifications/Wearable/AndroidManifest.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.support.wearable.notifications" >
+
+ <uses-sdk android:minSdkVersion="20"
+ android:targetSdkVersion="21" />
+
+ <uses-feature android:name="android.hardware.type.watch" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@mipmap/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@android:style/Theme.DeviceDefault.Light" >
+
+ <activity
+ android:name=".MainActivity"
+ android:label="@string/app_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <activity
+ android:name=".BasicNotificationDisplayActivity"
+ android:exported="true"
+ android:allowEmbedded="true"
+ android:label="@string/app_name"
+ android:taskAffinity="" />
+ <activity
+ android:name=".AnimatedNotificationDisplayActivity"
+ android:exported="true"
+ android:allowEmbedded="true"
+ android:label="@string/app_name"
+ android:taskAffinity="" />
+ </application>
+
+</manifest>
diff --git a/samples/wearable/Notifications/Wearable/src/main/res/drawable-nodpi/content_icon_large.png b/samples/browseable/Notifications/Wearable/res/drawable-nodpi/content_icon_large.png
index 0eab3b10a..0eab3b10a 100644
--- a/samples/wearable/Notifications/Wearable/src/main/res/drawable-nodpi/content_icon_large.png
+++ b/samples/browseable/Notifications/Wearable/res/drawable-nodpi/content_icon_large.png
Binary files differ
diff --git a/samples/wearable/Notifications/Wearable/src/main/res/drawable-nodpi/content_icon_small.png b/samples/browseable/Notifications/Wearable/res/drawable-nodpi/content_icon_small.png
index 9a9f4b4b5..9a9f4b4b5 100644
--- a/samples/wearable/Notifications/Wearable/src/main/res/drawable-nodpi/content_icon_small.png
+++ b/samples/browseable/Notifications/Wearable/res/drawable-nodpi/content_icon_small.png
Binary files differ
diff --git a/samples/wearable/Notifications/Wearable/src/main/res/drawable-nodpi/example_big_picture.jpg b/samples/browseable/Notifications/Wearable/res/drawable-nodpi/example_big_picture.jpg
index 68473ba6c..68473ba6c 100644
--- a/samples/wearable/Notifications/Wearable/src/main/res/drawable-nodpi/example_big_picture.jpg
+++ b/samples/browseable/Notifications/Wearable/res/drawable-nodpi/example_big_picture.jpg
Binary files differ
diff --git a/samples/wearable/Notifications/Wearable/src/main/res/drawable/wl_circle.xml b/samples/browseable/Notifications/Wearable/res/drawable/wl_circle.xml
index 7c9708ed0..7c9708ed0 100644
--- a/samples/wearable/Notifications/Wearable/src/main/res/drawable/wl_circle.xml
+++ b/samples/browseable/Notifications/Wearable/res/drawable/wl_circle.xml
diff --git a/samples/wearable/Notifications/Wearable/src/main/res/layout/activity_animated_notification_display.xml b/samples/browseable/Notifications/Wearable/res/layout/activity_animated_notification_display.xml
index be70b2b0b..be70b2b0b 100644
--- a/samples/wearable/Notifications/Wearable/src/main/res/layout/activity_animated_notification_display.xml
+++ b/samples/browseable/Notifications/Wearable/res/layout/activity_animated_notification_display.xml
diff --git a/samples/wearable/Notifications/Wearable/src/main/res/layout/activity_main.xml b/samples/browseable/Notifications/Wearable/res/layout/activity_main.xml
index 9ae6026b7..9ae6026b7 100644
--- a/samples/wearable/Notifications/Wearable/src/main/res/layout/activity_main.xml
+++ b/samples/browseable/Notifications/Wearable/res/layout/activity_main.xml
diff --git a/samples/wearable/Notifications/Wearable/src/main/res/layout/activity_notification_display.xml b/samples/browseable/Notifications/Wearable/res/layout/activity_notification_display.xml
index 7a329d2b7..7a329d2b7 100644
--- a/samples/wearable/Notifications/Wearable/src/main/res/layout/activity_notification_display.xml
+++ b/samples/browseable/Notifications/Wearable/res/layout/activity_notification_display.xml
diff --git a/samples/wearable/Notifications/Wearable/src/main/res/layout/notif_preset_list_item.xml b/samples/browseable/Notifications/Wearable/res/layout/notif_preset_list_item.xml
index 9e3cd459d..9e3cd459d 100644
--- a/samples/wearable/Notifications/Wearable/src/main/res/layout/notif_preset_list_item.xml
+++ b/samples/browseable/Notifications/Wearable/res/layout/notif_preset_list_item.xml
diff --git a/samples/wearable/Notifications/Wearable/src/main/res/mipmap-hdpi/ic_launcher.png b/samples/browseable/Notifications/Wearable/res/mipmap-hdpi/ic_launcher.png
index 41479debe..41479debe 100644
--- a/samples/wearable/Notifications/Wearable/src/main/res/mipmap-hdpi/ic_launcher.png
+++ b/samples/browseable/Notifications/Wearable/res/mipmap-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/Notifications/Wearable/src/main/res/mipmap-mdpi/ic_launcher.png b/samples/browseable/Notifications/Wearable/res/mipmap-mdpi/ic_launcher.png
index 380b02f45..380b02f45 100644
--- a/samples/wearable/Notifications/Wearable/src/main/res/mipmap-mdpi/ic_launcher.png
+++ b/samples/browseable/Notifications/Wearable/res/mipmap-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/Notifications/Wearable/src/main/res/mipmap-xhdpi/ic_launcher.png b/samples/browseable/Notifications/Wearable/res/mipmap-xhdpi/ic_launcher.png
index b3e251e0b..b3e251e0b 100644
--- a/samples/wearable/Notifications/Wearable/src/main/res/mipmap-xhdpi/ic_launcher.png
+++ b/samples/browseable/Notifications/Wearable/res/mipmap-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/Notifications/Wearable/src/main/res/mipmap-xxhdpi/ic_launcher.png b/samples/browseable/Notifications/Wearable/res/mipmap-xxhdpi/ic_launcher.png
index 1962289e7..1962289e7 100644
--- a/samples/wearable/Notifications/Wearable/src/main/res/mipmap-xxhdpi/ic_launcher.png
+++ b/samples/browseable/Notifications/Wearable/res/mipmap-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/Notifications/Wearable/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/samples/browseable/Notifications/Wearable/res/mipmap-xxxhdpi/ic_launcher.png
index 163f1f000..163f1f000 100644
--- a/samples/wearable/Notifications/Wearable/src/main/res/mipmap-xxxhdpi/ic_launcher.png
+++ b/samples/browseable/Notifications/Wearable/res/mipmap-xxxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/Notifications/Wearable/src/main/res/values/colors.xml b/samples/browseable/Notifications/Wearable/res/values/colors.xml
index 10fad66cf..10fad66cf 100644
--- a/samples/wearable/Notifications/Wearable/src/main/res/values/colors.xml
+++ b/samples/browseable/Notifications/Wearable/res/values/colors.xml
diff --git a/samples/wearable/Notifications/Wearable/src/main/res/values/dimens.xml b/samples/browseable/Notifications/Wearable/res/values/dimens.xml
index 50214e65d..50214e65d 100644
--- a/samples/wearable/Notifications/Wearable/src/main/res/values/dimens.xml
+++ b/samples/browseable/Notifications/Wearable/res/values/dimens.xml
diff --git a/samples/wearable/Notifications/Wearable/src/main/res/values/integers.xml b/samples/browseable/Notifications/Wearable/res/values/integers.xml
index 1dfb01162..1dfb01162 100644
--- a/samples/wearable/Notifications/Wearable/src/main/res/values/integers.xml
+++ b/samples/browseable/Notifications/Wearable/res/values/integers.xml
diff --git a/samples/wearable/Notifications/Wearable/src/main/res/values/strings.xml b/samples/browseable/Notifications/Wearable/res/values/strings.xml
index ff7023b50..ff7023b50 100644
--- a/samples/wearable/Notifications/Wearable/src/main/res/values/strings.xml
+++ b/samples/browseable/Notifications/Wearable/res/values/strings.xml
diff --git a/samples/wearable/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/AnimatedNotificationDisplayActivity.java b/samples/browseable/Notifications/Wearable/src/com.example.android.support.wearable.notifications/AnimatedNotificationDisplayActivity.java
index 2e0b2eed4..2e0b2eed4 100644
--- a/samples/wearable/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/AnimatedNotificationDisplayActivity.java
+++ b/samples/browseable/Notifications/Wearable/src/com.example.android.support.wearable.notifications/AnimatedNotificationDisplayActivity.java
diff --git a/samples/wearable/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/BasicNotificationDisplayActivity.java b/samples/browseable/Notifications/Wearable/src/com.example.android.support.wearable.notifications/BasicNotificationDisplayActivity.java
index d029f436b..d029f436b 100644
--- a/samples/wearable/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/BasicNotificationDisplayActivity.java
+++ b/samples/browseable/Notifications/Wearable/src/com.example.android.support.wearable.notifications/BasicNotificationDisplayActivity.java
diff --git a/samples/wearable/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/MainActivity.java b/samples/browseable/Notifications/Wearable/src/com.example.android.support.wearable.notifications/MainActivity.java
index d564e13a3..d564e13a3 100644
--- a/samples/wearable/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/MainActivity.java
+++ b/samples/browseable/Notifications/Wearable/src/com.example.android.support.wearable.notifications/MainActivity.java
diff --git a/samples/wearable/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/NotificationPreset.java b/samples/browseable/Notifications/Wearable/src/com.example.android.support.wearable.notifications/NotificationPreset.java
index d6570d5ba..d6570d5ba 100644
--- a/samples/wearable/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/NotificationPreset.java
+++ b/samples/browseable/Notifications/Wearable/src/com.example.android.support.wearable.notifications/NotificationPreset.java
diff --git a/samples/wearable/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/NotificationPresets.java b/samples/browseable/Notifications/Wearable/src/com.example.android.support.wearable.notifications/NotificationPresets.java
index 5578659e1..5578659e1 100644
--- a/samples/wearable/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/NotificationPresets.java
+++ b/samples/browseable/Notifications/Wearable/src/com.example.android.support.wearable.notifications/NotificationPresets.java
diff --git a/samples/browseable/Notifications/Wearable/src/com.example.android.support.wearable.notifications/WearableListItemLayout.java b/samples/browseable/Notifications/Wearable/src/com.example.android.support.wearable.notifications/WearableListItemLayout.java
new file mode 100644
index 000000000..4ec554ce4
--- /dev/null
+++ b/samples/browseable/Notifications/Wearable/src/com.example.android.support.wearable.notifications/WearableListItemLayout.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2014 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.support.wearable.notifications;
+
+import android.content.Context;
+import android.graphics.drawable.GradientDrawable;
+import android.support.wearable.view.WearableListView;
+import android.util.AttributeSet;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+public class WearableListItemLayout extends LinearLayout
+ implements WearableListView.OnCenterProximityListener {
+
+ private final float mFadedTextAlpha;
+ private final int mFadedCircleColor;
+ private final int mChosenCircleColor;
+ private ImageView mCircle;
+ private float mScale;
+ private TextView mName;
+
+ public WearableListItemLayout(Context context) {
+ this(context, null);
+ }
+
+ public WearableListItemLayout(Context context, AttributeSet attrs) {
+ this(context, attrs, 0);
+ }
+
+ public WearableListItemLayout(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ mFadedTextAlpha = getResources().getInteger(R.integer.action_text_faded_alpha) / 100f;
+ mFadedCircleColor = getResources().getColor(R.color.wl_gray);
+ mChosenCircleColor = getResources().getColor(R.color.wl_blue);
+ }
+
+ @Override
+ protected void onFinishInflate() {
+ super.onFinishInflate();
+ mCircle = (ImageView) findViewById(R.id.circle);
+ mName = (TextView) findViewById(R.id.name);
+ }
+
+ @Override
+ public void onCenterPosition(boolean animate) {
+ mName.setAlpha(1f);
+ ((GradientDrawable) mCircle.getDrawable()).setColor(mChosenCircleColor);
+ }
+
+ @Override
+ public void onNonCenterPosition(boolean animate) {
+ ((GradientDrawable) mCircle.getDrawable()).setColor(mFadedCircleColor);
+ mName.setAlpha(mFadedTextAlpha);
+ }
+}
diff --git a/samples/browseable/Notifications/_index.jd b/samples/browseable/Notifications/_index.jd
new file mode 100644
index 000000000..ba2823317
--- /dev/null
+++ b/samples/browseable/Notifications/_index.jd
@@ -0,0 +1,12 @@
+page.tags="Wearable Notifications"
+sample.group=Wearable
+@jd:body
+
+<p>
+
+This sample application provides a showcase of available notification styles and
+demonstrates various features of the Android Wear notifications API. Running the sample on your
+companion allows you to select between various notification styles and to see how these
+notifications are displayed, both in a phone\'s notification shade and on the wearable.
+
+ </p>
diff --git a/samples/browseable/PdfRendererBasic/AndroidManifest.xml b/samples/browseable/PdfRendererBasic/AndroidManifest.xml
new file mode 100644
index 000000000..22870679a
--- /dev/null
+++ b/samples/browseable/PdfRendererBasic/AndroidManifest.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.pdfrendererbasic"
+ android:versionCode="1"
+ android:versionName="1.0">
+
+ <application android:allowBackup="true"
+ android:label="@string/app_name"
+ android:icon="@drawable/ic_launcher"
+ android:theme="@style/AppTheme">
+
+ <activity android:name=".MainActivity"
+ android:label="@string/app_name">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+
+
+</manifest>
diff --git a/samples/browseable/PdfRendererBasic/_index.jd b/samples/browseable/PdfRendererBasic/_index.jd
new file mode 100644
index 000000000..59c5a5309
--- /dev/null
+++ b/samples/browseable/PdfRendererBasic/_index.jd
@@ -0,0 +1,9 @@
+page.tags="PdfRendererBasic"
+sample.group=UI
+@jd:body
+
+<p>
+
+ This sample demonstrates how to use PdfRenderer to display PDF documents on the screen.
+
+ </p>
diff --git a/samples/browseable/PdfRendererBasic/res/drawable-hdpi/ic_action_info.png b/samples/browseable/PdfRendererBasic/res/drawable-hdpi/ic_action_info.png
new file mode 100644
index 000000000..32bd1aabc
--- /dev/null
+++ b/samples/browseable/PdfRendererBasic/res/drawable-hdpi/ic_action_info.png
Binary files differ
diff --git a/samples/browseable/PdfRendererBasic/res/drawable-hdpi/ic_launcher.png b/samples/browseable/PdfRendererBasic/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 000000000..0c9b69468
--- /dev/null
+++ b/samples/browseable/PdfRendererBasic/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/PdfRendererBasic/res/drawable-hdpi/tile.9.png b/samples/browseable/PdfRendererBasic/res/drawable-hdpi/tile.9.png
new file mode 100644
index 000000000..135862883
--- /dev/null
+++ b/samples/browseable/PdfRendererBasic/res/drawable-hdpi/tile.9.png
Binary files differ
diff --git a/samples/browseable/PdfRendererBasic/res/drawable-mdpi/ic_action_info.png b/samples/browseable/PdfRendererBasic/res/drawable-mdpi/ic_action_info.png
new file mode 100644
index 000000000..8efbbf8b3
--- /dev/null
+++ b/samples/browseable/PdfRendererBasic/res/drawable-mdpi/ic_action_info.png
Binary files differ
diff --git a/samples/browseable/PdfRendererBasic/res/drawable-mdpi/ic_launcher.png b/samples/browseable/PdfRendererBasic/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 000000000..1a6c3d0d8
--- /dev/null
+++ b/samples/browseable/PdfRendererBasic/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/PdfRendererBasic/res/drawable-xhdpi/ic_action_info.png b/samples/browseable/PdfRendererBasic/res/drawable-xhdpi/ic_action_info.png
new file mode 100644
index 000000000..ba143ea7a
--- /dev/null
+++ b/samples/browseable/PdfRendererBasic/res/drawable-xhdpi/ic_action_info.png
Binary files differ
diff --git a/samples/browseable/PdfRendererBasic/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/PdfRendererBasic/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 000000000..2081f403b
--- /dev/null
+++ b/samples/browseable/PdfRendererBasic/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/PdfRendererBasic/res/drawable-xxhdpi/ic_action_info.png b/samples/browseable/PdfRendererBasic/res/drawable-xxhdpi/ic_action_info.png
new file mode 100644
index 000000000..394eb7e53
--- /dev/null
+++ b/samples/browseable/PdfRendererBasic/res/drawable-xxhdpi/ic_action_info.png
Binary files differ
diff --git a/samples/browseable/PdfRendererBasic/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/PdfRendererBasic/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 000000000..b506de4d5
--- /dev/null
+++ b/samples/browseable/PdfRendererBasic/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/PdfRendererBasic/res/layout/activity_main.xml b/samples/browseable/PdfRendererBasic/res/layout/activity_main.xml
new file mode 100755
index 000000000..be1aa49d9
--- /dev/null
+++ b/samples/browseable/PdfRendererBasic/res/layout/activity_main.xml
@@ -0,0 +1,36 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <LinearLayout style="@style/Widget.SampleMessageTile"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView style="@style/Widget.SampleMessage"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="@dimen/horizontal_page_margin"
+ android:layout_marginRight="@dimen/horizontal_page_margin"
+ android:layout_marginTop="@dimen/vertical_page_margin"
+ android:layout_marginBottom="@dimen/vertical_page_margin"
+ android:text="@string/intro_message" />
+ </LinearLayout>
+</LinearLayout>
diff --git a/samples/browseable/PdfRendererBasic/res/layout/activity_main_real.xml b/samples/browseable/PdfRendererBasic/res/layout/activity_main_real.xml
new file mode 100644
index 000000000..dcd52beaf
--- /dev/null
+++ b/samples/browseable/PdfRendererBasic/res/layout/activity_main_real.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014 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.
+-->
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/container"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context=".MainActivity"
+ tools:ignore="MergeRootFrame" />
diff --git a/samples/browseable/PdfRendererBasic/res/layout/fragment_pdf_renderer_basic.xml b/samples/browseable/PdfRendererBasic/res/layout/fragment_pdf_renderer_basic.xml
new file mode 100644
index 000000000..4a7799b7b
--- /dev/null
+++ b/samples/browseable/PdfRendererBasic/res/layout/fragment_pdf_renderer_basic.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ tools:context=".MainActivity$PlaceholderFragment">
+
+ <ImageView
+ android:id="@+id/image"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:background="@android:color/white"
+ android:scaleType="fitCenter" />
+
+ <LinearLayout
+ style="?android:attr/buttonBarStyle"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:measureWithLargestChild="true"
+ android:orientation="horizontal">
+
+ <Button
+ android:id="@+id/previous"
+ style="?android:attr/buttonBarButtonStyle"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="@string/previous" />
+
+ <Button
+ android:id="@+id/next"
+ style="?android:attr/buttonBarButtonStyle"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="@string/next" />
+ </LinearLayout>
+
+</LinearLayout>
diff --git a/samples/browseable/PdfRendererBasic/res/menu/main.xml b/samples/browseable/PdfRendererBasic/res/menu/main.xml
new file mode 100644
index 000000000..fa452e108
--- /dev/null
+++ b/samples/browseable/PdfRendererBasic/res/menu/main.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <item
+ android:id="@+id/action_info"
+ android:icon="@drawable/ic_action_info"
+ android:showAsAction="always"
+ android:title="@string/info" />
+
+</menu> \ No newline at end of file
diff --git a/samples/browseable/PdfRendererBasic/res/values-sw600dp/template-dimens.xml b/samples/browseable/PdfRendererBasic/res/values-sw600dp/template-dimens.xml
new file mode 100644
index 000000000..22074a2bd
--- /dev/null
+++ b/samples/browseable/PdfRendererBasic/res/values-sw600dp/template-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>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_huge</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/PdfRendererBasic/res/values-sw600dp/template-styles.xml b/samples/browseable/PdfRendererBasic/res/values-sw600dp/template-styles.xml
new file mode 100644
index 000000000..03d197418
--- /dev/null
+++ b/samples/browseable/PdfRendererBasic/res/values-sw600dp/template-styles.xml
@@ -0,0 +1,25 @@
+<!--
+ 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.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceLarge</item>
+ <item name="android:lineSpacingMultiplier">1.2</item>
+ <item name="android:shadowDy">-6.5</item>
+ </style>
+
+</resources>
diff --git a/samples/browseable/PdfRendererBasic/res/values-v11/template-styles.xml b/samples/browseable/PdfRendererBasic/res/values-v11/template-styles.xml
new file mode 100644
index 000000000..8c1ea66f2
--- /dev/null
+++ b/samples/browseable/PdfRendererBasic/res/values-v11/template-styles.xml
@@ -0,0 +1,22 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Holo.Light" />
+
+</resources>
diff --git a/samples/browseable/PdfRendererBasic/res/values-v21/base-colors.xml b/samples/browseable/PdfRendererBasic/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/PdfRendererBasic/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/PdfRendererBasic/res/values-v21/base-template-styles.xml b/samples/browseable/PdfRendererBasic/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/PdfRendererBasic/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/PdfRendererBasic/res/values/base-strings.xml b/samples/browseable/PdfRendererBasic/res/values/base-strings.xml
new file mode 100644
index 000000000..d97b3c6a8
--- /dev/null
+++ b/samples/browseable/PdfRendererBasic/res/values/base-strings.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>
+ <string name="app_name">PdfRendererBasic</string>
+ <string name="intro_message">
+ <![CDATA[
+
+
+ This sample demonstrates how to use PdfRenderer to display PDF documents on the screen.
+
+
+ ]]>
+ </string>
+</resources>
diff --git a/samples/browseable/PdfRendererBasic/res/values/strings.xml b/samples/browseable/PdfRendererBasic/res/values/strings.xml
new file mode 100644
index 000000000..e0182fd39
--- /dev/null
+++ b/samples/browseable/PdfRendererBasic/res/values/strings.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<resources>
+
+ <string name="app_name_with_index">PdfRendererBasic (%1$d/%2$d)</string>
+ <string name="info">Info</string>
+ <string name="previous">Previous</string>
+ <string name="next">Next</string>
+
+</resources>
diff --git a/samples/browseable/PdfRendererBasic/res/values/template-dimens.xml b/samples/browseable/PdfRendererBasic/res/values/template-dimens.xml
new file mode 100644
index 000000000..39e710b5c
--- /dev/null
+++ b/samples/browseable/PdfRendererBasic/res/values/template-dimens.xml
@@ -0,0 +1,32 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Define standard dimensions to comply with Holo-style grids and rhythm. -->
+
+ <dimen name="margin_tiny">4dp</dimen>
+ <dimen name="margin_small">8dp</dimen>
+ <dimen name="margin_medium">16dp</dimen>
+ <dimen name="margin_large">32dp</dimen>
+ <dimen name="margin_huge">64dp</dimen>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_medium</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/PdfRendererBasic/res/values/template-styles.xml b/samples/browseable/PdfRendererBasic/res/values/template-styles.xml
new file mode 100644
index 000000000..6e7d593dd
--- /dev/null
+++ b/samples/browseable/PdfRendererBasic/res/values/template-styles.xml
@@ -0,0 +1,42 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+
+ <style name="Theme.Base" parent="android:Theme.Light" />
+
+ <style name="Theme.Sample" parent="Theme.Base" />
+
+ <style name="AppTheme" parent="Theme.Sample" />
+ <!-- Widget styling -->
+
+ <style name="Widget" />
+
+ <style name="Widget.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceMedium</item>
+ <item name="android:lineSpacingMultiplier">1.1</item>
+ </style>
+
+ <style name="Widget.SampleMessageTile">
+ <item name="android:background">@drawable/tile</item>
+ <item name="android:shadowColor">#7F000000</item>
+ <item name="android:shadowDy">-3.5</item>
+ <item name="android:shadowRadius">2</item>
+ </style>
+
+</resources>
diff --git a/samples/browseable/PdfRendererBasic/src/com.example.android.pdfrendererbasic/MainActivity.java b/samples/browseable/PdfRendererBasic/src/com.example.android.pdfrendererbasic/MainActivity.java
new file mode 100644
index 000000000..6b7e8b454
--- /dev/null
+++ b/samples/browseable/PdfRendererBasic/src/com.example.android.pdfrendererbasic/MainActivity.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2014 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.pdfrendererbasic;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuItem;
+
+public class MainActivity extends Activity {
+
+ public static final String FRAGMENT_PDF_RENDERER_BASIC = "pdf_renderer_basic";
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main_real);
+ if (savedInstanceState == null) {
+ getFragmentManager().beginTransaction()
+ .add(R.id.container, new PdfRendererBasicFragment(),
+ FRAGMENT_PDF_RENDERER_BASIC)
+ .commit();
+ }
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.main, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.action_info:
+ new AlertDialog.Builder(this)
+ .setMessage(R.string.intro_message)
+ .setPositiveButton(android.R.string.ok, null)
+ .show();
+ return true;
+ }
+ return super.onOptionsItemSelected(item);
+ }
+}
diff --git a/samples/browseable/PdfRendererBasic/src/com.example.android.pdfrendererbasic/PdfRendererBasicFragment.java b/samples/browseable/PdfRendererBasic/src/com.example.android.pdfrendererbasic/PdfRendererBasicFragment.java
new file mode 100644
index 000000000..e413c6599
--- /dev/null
+++ b/samples/browseable/PdfRendererBasic/src/com.example.android.pdfrendererbasic/PdfRendererBasicFragment.java
@@ -0,0 +1,221 @@
+/*
+ * Copyright (C) 2014 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.pdfrendererbasic;
+
+import android.app.Activity;
+import android.app.Fragment;
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.pdf.PdfRenderer;
+import android.os.Bundle;
+import android.os.ParcelFileDescriptor;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.Toast;
+
+import java.io.IOException;
+
+/**
+ * This fragment has a big {@ImageView} that shows PDF pages, and 2 {@link android.widget.Button}s to move between
+ * pages. We use a {@link android.graphics.pdf.PdfRenderer} to render PDF pages as {@link android.graphics.Bitmap}s.
+ */
+public class PdfRendererBasicFragment extends Fragment implements View.OnClickListener {
+
+ /**
+ * Key string for saving the state of current page index.
+ */
+ private static final String STATE_CURRENT_PAGE_INDEX = "current_page_index";
+
+ /**
+ * File descriptor of the PDF.
+ */
+ private ParcelFileDescriptor mFileDescriptor;
+
+ /**
+ * {@link android.graphics.pdf.PdfRenderer} to render the PDF.
+ */
+ private PdfRenderer mPdfRenderer;
+
+ /**
+ * Page that is currently shown on the screen.
+ */
+ private PdfRenderer.Page mCurrentPage;
+
+ /**
+ * {@link android.widget.ImageView} that shows a PDF page as a {@link android.graphics.Bitmap}
+ */
+ private ImageView mImageView;
+
+ /**
+ * {@link android.widget.Button} to move to the previous page.
+ */
+ private Button mButtonPrevious;
+
+ /**
+ * {@link android.widget.Button} to move to the next page.
+ */
+ private Button mButtonNext;
+
+ public PdfRendererBasicFragment() {
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.fragment_pdf_renderer_basic, container, false);
+ }
+
+ @Override
+ public void onViewCreated(View view, Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ // Retain view references.
+ mImageView = (ImageView) view.findViewById(R.id.image);
+ mButtonPrevious = (Button) view.findViewById(R.id.previous);
+ mButtonNext = (Button) view.findViewById(R.id.next);
+ // Bind events.
+ mButtonPrevious.setOnClickListener(this);
+ mButtonNext.setOnClickListener(this);
+ // Show the first page by default.
+ int index = 0;
+ // If there is a savedInstanceState (screen orientations, etc.), we restore the page index.
+ if (null != savedInstanceState) {
+ index = savedInstanceState.getInt(STATE_CURRENT_PAGE_INDEX, 0);
+ }
+ showPage(index);
+ }
+
+ @Override
+ public void onAttach(Activity activity) {
+ super.onAttach(activity);
+ try {
+ openRenderer(activity);
+ } catch (IOException e) {
+ e.printStackTrace();
+ Toast.makeText(activity, "Error! " + e.getMessage(), Toast.LENGTH_SHORT).show();
+ activity.finish();
+ }
+ }
+
+ @Override
+ public void onDetach() {
+ try {
+ closeRenderer();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ super.onDetach();
+ }
+
+ @Override
+ public void onSaveInstanceState(Bundle outState) {
+ super.onSaveInstanceState(outState);
+ if (null != mCurrentPage) {
+ outState.putInt(STATE_CURRENT_PAGE_INDEX, mCurrentPage.getIndex());
+ }
+ }
+
+ /**
+ * Sets up a {@link android.graphics.pdf.PdfRenderer} and related resources.
+ */
+ private void openRenderer(Context context) throws IOException {
+ // In this sample, we read a PDF from the assets directory.
+ mFileDescriptor = context.getAssets().openFd("sample.pdf").getParcelFileDescriptor();
+ // This is the PdfRenderer we use to render the PDF.
+ mPdfRenderer = new PdfRenderer(mFileDescriptor);
+ }
+
+ /**
+ * Closes the {@link android.graphics.pdf.PdfRenderer} and related resources.
+ *
+ * @throws java.io.IOException When the PDF file cannot be closed.
+ */
+ private void closeRenderer() throws IOException {
+ if (null != mCurrentPage) {
+ mCurrentPage.close();
+ }
+ mPdfRenderer.close();
+ mFileDescriptor.close();
+ }
+
+ /**
+ * Shows the specified page of PDF to the screen.
+ *
+ * @param index The page index.
+ */
+ private void showPage(int index) {
+ if (mPdfRenderer.getPageCount() <= index) {
+ return;
+ }
+ // Make sure to close the current page before opening another one.
+ if (null != mCurrentPage) {
+ mCurrentPage.close();
+ }
+ // Use `openPage` to open a specific page in PDF.
+ mCurrentPage = mPdfRenderer.openPage(index);
+ // Important: the destination bitmap must be ARGB (not RGB).
+ Bitmap bitmap = Bitmap.createBitmap(mCurrentPage.getWidth(), mCurrentPage.getHeight(),
+ Bitmap.Config.ARGB_8888);
+ // Here, we render the page onto the Bitmap.
+ // To render a portion of the page, use the second and third parameter. Pass nulls to get
+ // the default result.
+ // Pass either RENDER_MODE_FOR_DISPLAY or RENDER_MODE_FOR_PRINT for the last parameter.
+ mCurrentPage.render(bitmap, null, null, PdfRenderer.Page.RENDER_MODE_FOR_DISPLAY);
+ // We are ready to show the Bitmap to user.
+ mImageView.setImageBitmap(bitmap);
+ updateUi();
+ }
+
+ /**
+ * Updates the state of 2 control buttons in response to the current page index.
+ */
+ private void updateUi() {
+ int index = mCurrentPage.getIndex();
+ int pageCount = mPdfRenderer.getPageCount();
+ mButtonPrevious.setEnabled(0 != index);
+ mButtonNext.setEnabled(index + 1 < pageCount);
+ getActivity().setTitle(getString(R.string.app_name_with_index, index + 1, pageCount));
+ }
+
+ /**
+ * Gets the number of pages in the PDF. This method is marked as public for testing.
+ *
+ * @return The number of pages.
+ */
+ public int getPageCount() {
+ return mPdfRenderer.getPageCount();
+ }
+
+ @Override
+ public void onClick(View view) {
+ switch (view.getId()) {
+ case R.id.previous: {
+ // Move to the previous page
+ showPage(mCurrentPage.getIndex() - 1);
+ break;
+ }
+ case R.id.next: {
+ // Move to the next page
+ showPage(mCurrentPage.getIndex() + 1);
+ break;
+ }
+ }
+ }
+
+}
diff --git a/samples/browseable/Quiz/Application/AndroidManifest.xml b/samples/browseable/Quiz/Application/AndroidManifest.xml
new file mode 100644
index 000000000..55b666f14
--- /dev/null
+++ b/samples/browseable/Quiz/Application/AndroidManifest.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.wearable.quiz" >
+
+ <uses-sdk android:minSdkVersion="18"
+ android:targetSdkVersion="21" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@style/AppTheme">
+ <meta-data android:name="com.google.android.gms.version"
+ android:value="@integer/google_play_services_version" />
+
+ <activity
+ android:name="com.example.android.wearable.quiz.MainActivity"
+ android:label="@string/app_name"
+ android:windowSoftInputMode="stateHidden"
+ android:configChanges="keyboardHidden|orientation|screenSize" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+
+ </application>
+
+</manifest>
diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable-hdpi/ic_choice_a.png b/samples/browseable/Quiz/Application/res/drawable-hdpi/ic_choice_a.png
index de18ce11a..de18ce11a 100644
--- a/samples/wearable/Quiz/Application/src/main/res/drawable-hdpi/ic_choice_a.png
+++ b/samples/browseable/Quiz/Application/res/drawable-hdpi/ic_choice_a.png
Binary files differ
diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable-hdpi/ic_choice_b.png b/samples/browseable/Quiz/Application/res/drawable-hdpi/ic_choice_b.png
index 3cdfe9750..3cdfe9750 100644
--- a/samples/wearable/Quiz/Application/src/main/res/drawable-hdpi/ic_choice_b.png
+++ b/samples/browseable/Quiz/Application/res/drawable-hdpi/ic_choice_b.png
Binary files differ
diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable-hdpi/ic_choice_c.png b/samples/browseable/Quiz/Application/res/drawable-hdpi/ic_choice_c.png
index f0ed2ef99..f0ed2ef99 100644
--- a/samples/wearable/Quiz/Application/src/main/res/drawable-hdpi/ic_choice_c.png
+++ b/samples/browseable/Quiz/Application/res/drawable-hdpi/ic_choice_c.png
Binary files differ
diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable-hdpi/ic_choice_d.png b/samples/browseable/Quiz/Application/res/drawable-hdpi/ic_choice_d.png
index c158d2953..c158d2953 100644
--- a/samples/wearable/Quiz/Application/src/main/res/drawable-hdpi/ic_choice_d.png
+++ b/samples/browseable/Quiz/Application/res/drawable-hdpi/ic_choice_d.png
Binary files differ
diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable-hdpi/ic_launcher.png b/samples/browseable/Quiz/Application/res/drawable-hdpi/ic_launcher.png
index 91a8cff95..91a8cff95 100755
--- a/samples/wearable/Quiz/Application/src/main/res/drawable-hdpi/ic_launcher.png
+++ b/samples/browseable/Quiz/Application/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable-hdpi/ic_unknown_choice.png b/samples/browseable/Quiz/Application/res/drawable-hdpi/ic_unknown_choice.png
index 9aed51728..9aed51728 100644
--- a/samples/wearable/Quiz/Application/src/main/res/drawable-hdpi/ic_unknown_choice.png
+++ b/samples/browseable/Quiz/Application/res/drawable-hdpi/ic_unknown_choice.png
Binary files differ
diff --git a/samples/browseable/Quiz/Application/res/drawable-hdpi/tile.9.png b/samples/browseable/Quiz/Application/res/drawable-hdpi/tile.9.png
new file mode 100644
index 000000000..135862883
--- /dev/null
+++ b/samples/browseable/Quiz/Application/res/drawable-hdpi/tile.9.png
Binary files differ
diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable-mdpi/ic_choice_a.png b/samples/browseable/Quiz/Application/res/drawable-mdpi/ic_choice_a.png
index 57459365c..57459365c 100644
--- a/samples/wearable/Quiz/Application/src/main/res/drawable-mdpi/ic_choice_a.png
+++ b/samples/browseable/Quiz/Application/res/drawable-mdpi/ic_choice_a.png
Binary files differ
diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable-mdpi/ic_choice_b.png b/samples/browseable/Quiz/Application/res/drawable-mdpi/ic_choice_b.png
index 958b92e31..958b92e31 100644
--- a/samples/wearable/Quiz/Application/src/main/res/drawable-mdpi/ic_choice_b.png
+++ b/samples/browseable/Quiz/Application/res/drawable-mdpi/ic_choice_b.png
Binary files differ
diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable-mdpi/ic_choice_c.png b/samples/browseable/Quiz/Application/res/drawable-mdpi/ic_choice_c.png
index 9fcfab754..9fcfab754 100644
--- a/samples/wearable/Quiz/Application/src/main/res/drawable-mdpi/ic_choice_c.png
+++ b/samples/browseable/Quiz/Application/res/drawable-mdpi/ic_choice_c.png
Binary files differ
diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable-mdpi/ic_choice_d.png b/samples/browseable/Quiz/Application/res/drawable-mdpi/ic_choice_d.png
index 821cadb78..821cadb78 100644
--- a/samples/wearable/Quiz/Application/src/main/res/drawable-mdpi/ic_choice_d.png
+++ b/samples/browseable/Quiz/Application/res/drawable-mdpi/ic_choice_d.png
Binary files differ
diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable-mdpi/ic_launcher.png b/samples/browseable/Quiz/Application/res/drawable-mdpi/ic_launcher.png
index 728ee6d73..728ee6d73 100755
--- a/samples/wearable/Quiz/Application/src/main/res/drawable-mdpi/ic_launcher.png
+++ b/samples/browseable/Quiz/Application/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable-mdpi/ic_unknown_choice.png b/samples/browseable/Quiz/Application/res/drawable-mdpi/ic_unknown_choice.png
index b8030ef08..b8030ef08 100644
--- a/samples/wearable/Quiz/Application/src/main/res/drawable-mdpi/ic_unknown_choice.png
+++ b/samples/browseable/Quiz/Application/res/drawable-mdpi/ic_unknown_choice.png
Binary files differ
diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable-xhdpi/ic_choice_a.png b/samples/browseable/Quiz/Application/res/drawable-xhdpi/ic_choice_a.png
index 3dba96f32..3dba96f32 100644
--- a/samples/wearable/Quiz/Application/src/main/res/drawable-xhdpi/ic_choice_a.png
+++ b/samples/browseable/Quiz/Application/res/drawable-xhdpi/ic_choice_a.png
Binary files differ
diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable-xhdpi/ic_choice_b.png b/samples/browseable/Quiz/Application/res/drawable-xhdpi/ic_choice_b.png
index 9ca3c85f2..9ca3c85f2 100644
--- a/samples/wearable/Quiz/Application/src/main/res/drawable-xhdpi/ic_choice_b.png
+++ b/samples/browseable/Quiz/Application/res/drawable-xhdpi/ic_choice_b.png
Binary files differ
diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable-xhdpi/ic_choice_c.png b/samples/browseable/Quiz/Application/res/drawable-xhdpi/ic_choice_c.png
index b84b3b76d..b84b3b76d 100644
--- a/samples/wearable/Quiz/Application/src/main/res/drawable-xhdpi/ic_choice_c.png
+++ b/samples/browseable/Quiz/Application/res/drawable-xhdpi/ic_choice_c.png
Binary files differ
diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable-xhdpi/ic_choice_d.png b/samples/browseable/Quiz/Application/res/drawable-xhdpi/ic_choice_d.png
index 185e91ec8..185e91ec8 100644
--- a/samples/wearable/Quiz/Application/src/main/res/drawable-xhdpi/ic_choice_d.png
+++ b/samples/browseable/Quiz/Application/res/drawable-xhdpi/ic_choice_d.png
Binary files differ
diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/Quiz/Application/res/drawable-xhdpi/ic_launcher.png
index 64a585453..64a585453 100755
--- a/samples/wearable/Quiz/Application/src/main/res/drawable-xhdpi/ic_launcher.png
+++ b/samples/browseable/Quiz/Application/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/Quiz/Application/res/drawable-xxhdpi/ic_launcher.png
index 86a395bb6..86a395bb6 100755
--- a/samples/wearable/Quiz/Application/src/main/res/drawable-xxhdpi/ic_launcher.png
+++ b/samples/browseable/Quiz/Application/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable/selected_background.xml b/samples/browseable/Quiz/Application/res/drawable/selected_background.xml
index 5852dd89a..5852dd89a 100644
--- a/samples/wearable/Quiz/Application/src/main/res/drawable/selected_background.xml
+++ b/samples/browseable/Quiz/Application/res/drawable/selected_background.xml
diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable/unselected_background.xml b/samples/browseable/Quiz/Application/res/drawable/unselected_background.xml
index 161316759..161316759 100644
--- a/samples/wearable/Quiz/Application/src/main/res/drawable/unselected_background.xml
+++ b/samples/browseable/Quiz/Application/res/drawable/unselected_background.xml
diff --git a/samples/browseable/Quiz/Application/res/layout/activity_main.xml b/samples/browseable/Quiz/Application/res/layout/activity_main.xml
new file mode 100755
index 000000000..be1aa49d9
--- /dev/null
+++ b/samples/browseable/Quiz/Application/res/layout/activity_main.xml
@@ -0,0 +1,36 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <LinearLayout style="@style/Widget.SampleMessageTile"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView style="@style/Widget.SampleMessage"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="@dimen/horizontal_page_margin"
+ android:layout_marginRight="@dimen/horizontal_page_margin"
+ android:layout_marginTop="@dimen/vertical_page_margin"
+ android:layout_marginBottom="@dimen/vertical_page_margin"
+ android:text="@string/intro_message" />
+ </LinearLayout>
+</LinearLayout>
diff --git a/samples/wearable/Quiz/Application/src/main/res/layout/activity_main.xml b/samples/browseable/Quiz/Application/res/layout/main.xml
index 3eb19f9bb..3eb19f9bb 100644
--- a/samples/wearable/Quiz/Application/src/main/res/layout/activity_main.xml
+++ b/samples/browseable/Quiz/Application/res/layout/main.xml
diff --git a/samples/wearable/Quiz/Application/src/main/res/layout/question_status_element.xml b/samples/browseable/Quiz/Application/res/layout/question_status_element.xml
index 280f44ad7..280f44ad7 100644
--- a/samples/wearable/Quiz/Application/src/main/res/layout/question_status_element.xml
+++ b/samples/browseable/Quiz/Application/res/layout/question_status_element.xml
diff --git a/samples/browseable/Quiz/Application/res/values-sw600dp/template-dimens.xml b/samples/browseable/Quiz/Application/res/values-sw600dp/template-dimens.xml
new file mode 100644
index 000000000..22074a2bd
--- /dev/null
+++ b/samples/browseable/Quiz/Application/res/values-sw600dp/template-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>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_huge</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/Quiz/Application/res/values-sw600dp/template-styles.xml b/samples/browseable/Quiz/Application/res/values-sw600dp/template-styles.xml
new file mode 100644
index 000000000..03d197418
--- /dev/null
+++ b/samples/browseable/Quiz/Application/res/values-sw600dp/template-styles.xml
@@ -0,0 +1,25 @@
+<!--
+ 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.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceLarge</item>
+ <item name="android:lineSpacingMultiplier">1.2</item>
+ <item name="android:shadowDy">-6.5</item>
+ </style>
+
+</resources>
diff --git a/samples/browseable/Quiz/Application/res/values-v11/template-styles.xml b/samples/browseable/Quiz/Application/res/values-v11/template-styles.xml
new file mode 100644
index 000000000..8c1ea66f2
--- /dev/null
+++ b/samples/browseable/Quiz/Application/res/values-v11/template-styles.xml
@@ -0,0 +1,22 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Holo.Light" />
+
+</resources>
diff --git a/samples/browseable/Quiz/Application/res/values-v21/base-colors.xml b/samples/browseable/Quiz/Application/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/Quiz/Application/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/Quiz/Application/res/values-v21/base-template-styles.xml b/samples/browseable/Quiz/Application/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/Quiz/Application/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/Quiz/Application/res/values/base-strings.xml b/samples/browseable/Quiz/Application/res/values/base-strings.xml
new file mode 100644
index 000000000..527d03896
--- /dev/null
+++ b/samples/browseable/Quiz/Application/res/values/base-strings.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<resources>
+ <string name="app_name">Quiz</string>
+ <string name="intro_message">
+ <![CDATA[
+
+
+ This sample uses Google Play Services Wearable Data APIs to communicate between
+ applications on a phone and a paired wearable device. Users can create quiz questions on the phone,
+ each of which has an associated DataItem. These DataItems are then received on the wearable, which
+ displays them as notifications. Each notification contains the question as the first page, followed
+ by answers as actions. When an answer is selected, the corresponding question\'s DataItem is updated,
+ which allows the phone application to update the status of the question (i.e. did the user answer it
+ correctly or not) and prompt the next question.
+
+
+ ]]>
+ </string>
+</resources>
diff --git a/samples/wearable/Quiz/Application/src/main/res/values/dimens.xml b/samples/browseable/Quiz/Application/res/values/dimens.xml
index fd97910ac..fd97910ac 100644
--- a/samples/wearable/Quiz/Application/src/main/res/values/dimens.xml
+++ b/samples/browseable/Quiz/Application/res/values/dimens.xml
diff --git a/samples/browseable/Quiz/Application/res/values/strings.xml b/samples/browseable/Quiz/Application/res/values/strings.xml
new file mode 100644
index 000000000..e2fa3b13c
--- /dev/null
+++ b/samples/browseable/Quiz/Application/res/values/strings.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+
+ <string name="read_from_file_button">Read quiz from file</string>
+
+ <string name="edit_question">Question</string>
+ <string name="edit_choice_a">Choice A</string>
+ <string name="edit_choice_b">Choice B</string>
+ <string name="edit_choice_c">Choice C</string>
+ <string name="edit_choice_d">Choice D</string>
+ <string name="add_question">Add Question</string>
+
+ <string name="quiz_status">Quiz Status</string>
+ <string name="question_placeholder">Question</string>
+ <string name="question_unanswered">This question has not yet been answered.</string>
+ <string name="question_incorrect">This question has been answered incorrectly.</string>
+ <string name="question_correct">This question has been answered correctly!</string>
+ <string name="question_left_blank">This question was left blank.</string>
+
+ <string name="reset_quiz">Reset Quiz</string>
+ <string name="new_quiz">New Quiz</string>
+
+</resources>
diff --git a/samples/browseable/Quiz/Application/res/values/styles.xml b/samples/browseable/Quiz/Application/res/values/styles.xml
new file mode 100644
index 000000000..69f8dfaa7
--- /dev/null
+++ b/samples/browseable/Quiz/Application/res/values/styles.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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="bg_picker">
+ <item name="android:layout_marginLeft">16dp</item>
+ <item name="android:background">@drawable/unselected_background</item>
+ </style>
+
+</resources>
diff --git a/samples/browseable/Quiz/Application/res/values/template-dimens.xml b/samples/browseable/Quiz/Application/res/values/template-dimens.xml
new file mode 100644
index 000000000..39e710b5c
--- /dev/null
+++ b/samples/browseable/Quiz/Application/res/values/template-dimens.xml
@@ -0,0 +1,32 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Define standard dimensions to comply with Holo-style grids and rhythm. -->
+
+ <dimen name="margin_tiny">4dp</dimen>
+ <dimen name="margin_small">8dp</dimen>
+ <dimen name="margin_medium">16dp</dimen>
+ <dimen name="margin_large">32dp</dimen>
+ <dimen name="margin_huge">64dp</dimen>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_medium</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/Quiz/Application/res/values/template-styles.xml b/samples/browseable/Quiz/Application/res/values/template-styles.xml
new file mode 100644
index 000000000..6e7d593dd
--- /dev/null
+++ b/samples/browseable/Quiz/Application/res/values/template-styles.xml
@@ -0,0 +1,42 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+
+ <style name="Theme.Base" parent="android:Theme.Light" />
+
+ <style name="Theme.Sample" parent="Theme.Base" />
+
+ <style name="AppTheme" parent="Theme.Sample" />
+ <!-- Widget styling -->
+
+ <style name="Widget" />
+
+ <style name="Widget.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceMedium</item>
+ <item name="android:lineSpacingMultiplier">1.1</item>
+ </style>
+
+ <style name="Widget.SampleMessageTile">
+ <item name="android:background">@drawable/tile</item>
+ <item name="android:shadowColor">#7F000000</item>
+ <item name="android:shadowDy">-3.5</item>
+ <item name="android:shadowRadius">2</item>
+ </style>
+
+</resources>
diff --git a/samples/wearable/Quiz/Application/src/main/java/com/example/android/wearable/quiz/Constants.java b/samples/browseable/Quiz/Application/src/com.example.android.wearable.quiz/Constants.java
index 2bcfe5f18..2bcfe5f18 100644
--- a/samples/wearable/Quiz/Application/src/main/java/com/example/android/wearable/quiz/Constants.java
+++ b/samples/browseable/Quiz/Application/src/com.example.android.wearable.quiz/Constants.java
diff --git a/samples/wearable/Quiz/Application/src/main/java/com/example/android/wearable/quiz/JsonUtils.java b/samples/browseable/Quiz/Application/src/com.example.android.wearable.quiz/JsonUtils.java
index df8c8998e..df8c8998e 100644
--- a/samples/wearable/Quiz/Application/src/main/java/com/example/android/wearable/quiz/JsonUtils.java
+++ b/samples/browseable/Quiz/Application/src/com.example.android.wearable.quiz/JsonUtils.java
diff --git a/samples/browseable/Quiz/Application/src/com.example.android.wearable.quiz/MainActivity.java b/samples/browseable/Quiz/Application/src/com.example.android.wearable.quiz/MainActivity.java
new file mode 100644
index 000000000..0ff41f42d
--- /dev/null
+++ b/samples/browseable/Quiz/Application/src/com.example.android.wearable.quiz/MainActivity.java
@@ -0,0 +1,585 @@
+/*
+ * Copyright (C) 2014 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.wearable.quiz;
+
+import static com.example.android.wearable.quiz.Constants.ANSWERS;
+import static com.example.android.wearable.quiz.Constants.CHOSEN_ANSWER_CORRECT;
+import static com.example.android.wearable.quiz.Constants.CORRECT_ANSWER_INDEX;
+import static com.example.android.wearable.quiz.Constants.NUM_CORRECT;
+import static com.example.android.wearable.quiz.Constants.NUM_INCORRECT;
+import static com.example.android.wearable.quiz.Constants.NUM_SKIPPED;
+import static com.example.android.wearable.quiz.Constants.QUESTION;
+import static com.example.android.wearable.quiz.Constants.QUESTION_INDEX;
+import static com.example.android.wearable.quiz.Constants.QUESTION_WAS_ANSWERED;
+import static com.example.android.wearable.quiz.Constants.QUESTION_WAS_DELETED;
+import static com.example.android.wearable.quiz.Constants.QUIZ_ENDED_PATH;
+import static com.example.android.wearable.quiz.Constants.QUIZ_EXITED_PATH;
+import static com.example.android.wearable.quiz.Constants.RESET_QUIZ_PATH;
+
+import android.app.Activity;
+import android.graphics.Color;
+import android.net.Uri;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.LinearLayout;
+import android.widget.RadioGroup;
+import android.widget.TextView;
+
+import com.google.android.gms.common.ConnectionResult;
+import com.google.android.gms.common.api.GoogleApiClient;
+import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks;
+import com.google.android.gms.common.api.ResultCallback;
+import com.google.android.gms.common.data.FreezableUtils;
+import com.google.android.gms.wearable.DataApi;
+import com.google.android.gms.wearable.DataEvent;
+import com.google.android.gms.wearable.DataEventBuffer;
+import com.google.android.gms.wearable.DataItem;
+import com.google.android.gms.wearable.DataItemBuffer;
+import com.google.android.gms.wearable.DataMap;
+import com.google.android.gms.wearable.DataMapItem;
+import com.google.android.gms.wearable.MessageApi;
+import com.google.android.gms.wearable.MessageEvent;
+import com.google.android.gms.wearable.Node;
+import com.google.android.gms.wearable.NodeApi;
+import com.google.android.gms.wearable.PutDataMapRequest;
+import com.google.android.gms.wearable.PutDataRequest;
+import com.google.android.gms.wearable.Wearable;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.PriorityQueue;
+
+/**
+ * Allows the user to create questions, which will be put as notifications on the watch's stream.
+ * The status of questions will be updated on the phone when the user answers them.
+ */
+public class MainActivity extends Activity implements DataApi.DataListener,
+ MessageApi.MessageListener, ConnectionCallbacks,
+ GoogleApiClient.OnConnectionFailedListener {
+
+ private static final String TAG = "ExampleQuizApp";
+ private static final String QUIZ_JSON_FILE = "Quiz.json";
+
+ // Various UI components.
+ private EditText questionEditText;
+ private EditText choiceAEditText;
+ private EditText choiceBEditText;
+ private EditText choiceCEditText;
+ private EditText choiceDEditText;
+ private RadioGroup choicesRadioGroup;
+ private TextView quizStatus;
+ private LinearLayout quizButtons;
+ private LinearLayout questionsContainer;
+ private Button readQuizFromFileButton;
+ private Button resetQuizButton;
+
+ private GoogleApiClient mGoogleApiClient;
+ private PriorityQueue<Question> mFutureQuestions;
+ private int mQuestionIndex = 0;
+ private boolean mHasQuestionBeenAsked = false;
+
+ // Data to display in end report.
+ private int mNumCorrect = 0;
+ private int mNumIncorrect = 0;
+ private int mNumSkipped = 0;
+
+ private static final Map<Integer, Integer> radioIdToIndex;
+
+ static {
+ Map<Integer, Integer> temp = new HashMap<Integer, Integer>(4);
+ temp.put(R.id.choice_a_radio, 0);
+ temp.put(R.id.choice_b_radio, 1);
+ temp.put(R.id.choice_c_radio, 2);
+ temp.put(R.id.choice_d_radio, 3);
+ radioIdToIndex = Collections.unmodifiableMap(temp);
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.main);
+
+ mGoogleApiClient = new GoogleApiClient.Builder(this)
+ .addApi(Wearable.API)
+ .addConnectionCallbacks(this)
+ .addOnConnectionFailedListener(this)
+ .build();
+ mFutureQuestions = new PriorityQueue<Question>(10);
+
+ // Find UI components to be used later.
+ questionEditText = (EditText) findViewById(R.id.question_text);
+ choiceAEditText = (EditText) findViewById(R.id.choice_a_text);
+ choiceBEditText = (EditText) findViewById(R.id.choice_b_text);
+ choiceCEditText = (EditText) findViewById(R.id.choice_c_text);
+ choiceDEditText = (EditText) findViewById(R.id.choice_d_text);
+ choicesRadioGroup = (RadioGroup) findViewById(R.id.choices_radio_group);
+ quizStatus = (TextView) findViewById(R.id.quiz_status);
+ quizButtons = (LinearLayout) findViewById(R.id.quiz_buttons);
+ questionsContainer = (LinearLayout) findViewById(R.id.questions_container);
+ readQuizFromFileButton = (Button) findViewById(R.id.read_quiz_from_file_button);
+ resetQuizButton = (Button) findViewById(R.id.reset_quiz_button);
+ }
+
+ @Override
+ protected void onStart() {
+ super.onStart();
+ if (!mGoogleApiClient.isConnected()) {
+ mGoogleApiClient.connect();
+ }
+ }
+
+ @Override
+ protected void onStop() {
+ Wearable.DataApi.removeListener(mGoogleApiClient, this);
+ Wearable.MessageApi.removeListener(mGoogleApiClient, this);
+
+ // Tell the wearable to end the quiz (counting unanswered questions as skipped), and then
+ // disconnect mGoogleApiClient.
+ DataMap dataMap = new DataMap();
+ dataMap.putInt(NUM_CORRECT, mNumCorrect);
+ dataMap.putInt(NUM_INCORRECT, mNumIncorrect);
+ if (mHasQuestionBeenAsked) {
+ mNumSkipped += 1;
+ }
+ mNumSkipped += mFutureQuestions.size();
+ dataMap.putInt(NUM_SKIPPED, mNumSkipped);
+ if (mNumCorrect + mNumIncorrect + mNumSkipped > 0) {
+ sendMessageToWearable(QUIZ_EXITED_PATH, dataMap.toByteArray());
+ }
+
+ clearQuizStatus();
+ super.onStop();
+ }
+
+ @Override
+ public void onConnected(Bundle connectionHint) {
+ Wearable.DataApi.addListener(mGoogleApiClient, this);
+ Wearable.MessageApi.addListener(mGoogleApiClient, this);
+ }
+
+ @Override
+ public void onConnectionSuspended(int cause) {
+ // Ignore
+ }
+
+ @Override
+ public void onConnectionFailed(ConnectionResult result) {
+ Log.e(TAG, "Failed to connect to Google Play Services");
+ }
+
+ @Override
+ public void onMessageReceived(MessageEvent messageEvent) {
+ if (messageEvent.getPath().equals(RESET_QUIZ_PATH)) {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ resetQuiz(null);
+ }
+ });
+ }
+ }
+
+ /**
+ * Used to ensure questions with smaller indexes come before questions with larger
+ * indexes. For example, question0 should come before question1.
+ */
+ private static class Question implements Comparable<Question> {
+ private String question;
+ private int questionIndex;
+ private String[] answers;
+ private int correctAnswerIndex;
+
+ public Question(String question, int questionIndex, String[] answers,
+ int correctAnswerIndex) {
+ this.question = question;
+ this.questionIndex = questionIndex;
+ this.answers = answers;
+ this.correctAnswerIndex = correctAnswerIndex;
+ }
+
+ public static Question fromJson(JSONObject questionObject, int questionIndex)
+ throws JSONException {
+ String question = questionObject.getString(JsonUtils.JSON_FIELD_QUESTION);
+ JSONArray answersJsonArray = questionObject.getJSONArray(JsonUtils.JSON_FIELD_ANSWERS);
+ String[] answers = new String[JsonUtils.NUM_ANSWER_CHOICES];
+ for (int j = 0; j < answersJsonArray.length(); j++) {
+ answers[j] = answersJsonArray.getString(j);
+ }
+ int correctIndex = questionObject.getInt(JsonUtils.JSON_FIELD_CORRECT_INDEX);
+ return new Question(question, questionIndex, answers, correctIndex);
+ }
+
+ @Override
+ public int compareTo(Question that) {
+ return this.questionIndex - that.questionIndex;
+ }
+
+ public PutDataRequest toPutDataRequest() {
+ PutDataMapRequest request = PutDataMapRequest.create("/question/" + questionIndex);
+ DataMap dataMap = request.getDataMap();
+ dataMap.putString(QUESTION, question);
+ dataMap.putInt(QUESTION_INDEX, questionIndex);
+ dataMap.putStringArray(ANSWERS, answers);
+ dataMap.putInt(CORRECT_ANSWER_INDEX, correctAnswerIndex);
+ return request.asPutDataRequest();
+ }
+ }
+
+ /**
+ * Create a quiz, as defined in Quiz.json, when the user clicks on "Read quiz from file."
+ * @throws IOException
+ */
+ public void readQuizFromFile(View view) throws IOException, JSONException {
+ clearQuizStatus();
+ JSONObject jsonObject = JsonUtils.loadJsonFile(this, QUIZ_JSON_FILE);
+ JSONArray jsonArray = jsonObject.getJSONArray(JsonUtils.JSON_FIELD_QUESTIONS);
+ for (int i = 0; i < jsonArray.length(); i++) {
+ JSONObject questionObject = jsonArray.getJSONObject(i);
+ Question question = Question.fromJson(questionObject, mQuestionIndex++);
+ addQuestionDataItem(question);
+ setNewQuestionStatus(question.question);
+ }
+ }
+
+ /**
+ * Adds a question (with answer choices) when user clicks on "Add Question."
+ */
+ public void addQuestion(View view) {
+ // Retrieve the question and answers supplied by the user.
+ String question = questionEditText.getText().toString();
+ String[] answers = new String[4];
+ answers[0] = choiceAEditText.getText().toString();
+ answers[1] = choiceBEditText.getText().toString();
+ answers[2] = choiceCEditText.getText().toString();
+ answers[3] = choiceDEditText.getText().toString();
+ int correctAnswerIndex = radioIdToIndex.get(choicesRadioGroup.getCheckedRadioButtonId());
+
+ addQuestionDataItem(new Question(question, mQuestionIndex++, answers, correctAnswerIndex));
+ setNewQuestionStatus(question);
+
+ // Clear the edit boxes to let the user input a new question.
+ questionEditText.setText("");
+ choiceAEditText.setText("");
+ choiceBEditText.setText("");
+ choiceCEditText.setText("");
+ choiceDEditText.setText("");
+ }
+
+ /**
+ * Adds the questions (and answers) to the wearable's stream by creating a Data Item
+ * that will be received on the wearable, which will create corresponding notifications.
+ */
+ private void addQuestionDataItem(Question question) {
+ if (!mHasQuestionBeenAsked) {
+ // Ask the question now.
+ Wearable.DataApi.putDataItem(mGoogleApiClient, question.toPutDataRequest());
+ setHasQuestionBeenAsked(true);
+ } else {
+ // Enqueue the question to be asked in the future.
+ mFutureQuestions.add(question);
+ }
+ }
+
+ /**
+ * Sets the question's status to be the default "unanswered." This will be updated when the
+ * user chooses an answer for the question on the wearable.
+ */
+ private void setNewQuestionStatus(String question) {
+ quizStatus.setVisibility(View.VISIBLE);
+ quizButtons.setVisibility(View.VISIBLE);
+ LayoutInflater inflater = LayoutInflater.from(this);
+ View questionStatusElem = inflater.inflate(R.layout.question_status_element, null, false);
+ ((TextView) questionStatusElem.findViewById(R.id.question)).setText(question);
+ ((TextView) questionStatusElem.findViewById(R.id.status))
+ .setText(R.string.question_unanswered);
+ questionsContainer.addView(questionStatusElem);
+ }
+
+ @Override
+ public void onDataChanged(DataEventBuffer dataEvents) {
+ final List<DataEvent> events = FreezableUtils.freezeIterable(dataEvents);
+ dataEvents.close();
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ for (DataEvent event : events) {
+ if (event.getType() == DataEvent.TYPE_CHANGED) {
+ DataMap dataMap = DataMapItem.fromDataItem(event.getDataItem())
+ .getDataMap();
+ boolean questionWasAnswered = dataMap.getBoolean(QUESTION_WAS_ANSWERED);
+ boolean questionWasDeleted = dataMap.getBoolean(QUESTION_WAS_DELETED);
+ if (questionWasAnswered) {
+ // Update the answered question's status.
+ int questionIndex = dataMap.getInt(QUESTION_INDEX);
+ boolean questionCorrect = dataMap.getBoolean(CHOSEN_ANSWER_CORRECT);
+ updateQuestionStatus(questionIndex, questionCorrect);
+ askNextQuestionIfExists();
+ } else if (questionWasDeleted) {
+ // Update the deleted question's status by marking it as left blank.
+ int questionIndex = dataMap.getInt(QUESTION_INDEX);
+ markQuestionLeftBlank(questionIndex);
+ askNextQuestionIfExists();
+ }
+ }
+ }
+ }
+ });
+ }
+
+ /**
+ * Updates the given question based on whether it was answered correctly or not.
+ * This involves changing the question's text color and changing the status text for it.
+ */
+ public void updateQuestionStatus(int questionIndex, boolean questionCorrect) {
+ LinearLayout questionStatusElement = (LinearLayout)
+ questionsContainer.getChildAt(questionIndex);
+ TextView questionText = (TextView) questionStatusElement.findViewById(R.id.question);
+ TextView questionStatus = (TextView) questionStatusElement.findViewById(R.id.status);
+ if (questionCorrect) {
+ questionText.setTextColor(Color.GREEN);
+ questionStatus.setText(R.string.question_correct);
+ mNumCorrect++;
+ } else {
+ questionText.setTextColor(Color.RED);
+ questionStatus.setText(R.string.question_incorrect);
+ mNumIncorrect++;
+ }
+ }
+
+ /**
+ * Marks a question as "left blank" when its corresponding question notification is deleted.
+ */
+ private void markQuestionLeftBlank(int index) {
+ LinearLayout questionStatusElement = (LinearLayout) questionsContainer.getChildAt(index);
+ if (questionStatusElement != null) {
+ TextView questionText = (TextView) questionStatusElement.findViewById(R.id.question);
+ TextView questionStatus = (TextView) questionStatusElement.findViewById(R.id.status);
+ if (questionStatus.getText().equals(getString(R.string.question_unanswered))) {
+ questionText.setTextColor(Color.YELLOW);
+ questionStatus.setText(R.string.question_left_blank);
+ mNumSkipped++;
+ }
+ }
+ }
+
+ /**
+ * Asks the next enqueued question if it exists, otherwise ends the quiz.
+ */
+ private void askNextQuestionIfExists() {
+ if (mFutureQuestions.isEmpty()) {
+ // Quiz has been completed - send message to wearable to display end report.
+ DataMap dataMap = new DataMap();
+ dataMap.putInt(NUM_CORRECT, mNumCorrect);
+ dataMap.putInt(NUM_INCORRECT, mNumIncorrect);
+ dataMap.putInt(NUM_SKIPPED, mNumSkipped);
+ sendMessageToWearable(QUIZ_ENDED_PATH, dataMap.toByteArray());
+ setHasQuestionBeenAsked(false);
+ } else {
+ // Ask next question by putting a DataItem that will be received on the wearable.
+ Wearable.DataApi.putDataItem(mGoogleApiClient,
+ mFutureQuestions.remove().toPutDataRequest());
+ setHasQuestionBeenAsked(true);
+ }
+ }
+
+ private void sendMessageToWearable(final String path, final byte[] data) {
+ Wearable.NodeApi.getConnectedNodes(mGoogleApiClient).setResultCallback(
+ new ResultCallback<NodeApi.GetConnectedNodesResult>() {
+ @Override
+ public void onResult(NodeApi.GetConnectedNodesResult nodes) {
+ for (Node node : nodes.getNodes()) {
+ Wearable.MessageApi.sendMessage(mGoogleApiClient, node.getId(), path, data);
+ }
+
+ if (path.equals(QUIZ_EXITED_PATH) && mGoogleApiClient.isConnected()) {
+ mGoogleApiClient.disconnect();
+ }
+ }
+ });
+ }
+
+ /**
+ * Resets the current quiz when Reset Quiz is pressed.
+ */
+ public void resetQuiz(View view) {
+ // Reset quiz status in phone layout.
+ for(int i = 0; i < questionsContainer.getChildCount(); i++) {
+ LinearLayout questionStatusElement = (LinearLayout) questionsContainer.getChildAt(i);
+ TextView questionText = (TextView) questionStatusElement.findViewById(R.id.question);
+ TextView questionStatus = (TextView) questionStatusElement.findViewById(R.id.status);
+ questionText.setTextColor(Color.WHITE);
+ questionStatus.setText(R.string.question_unanswered);
+ }
+ // Reset data items and notifications on wearable.
+ if (mGoogleApiClient.isConnected()) {
+ Wearable.DataApi.getDataItems(mGoogleApiClient)
+ .setResultCallback(new ResultCallback<DataItemBuffer>() {
+ @Override
+ public void onResult(DataItemBuffer result) {
+ if (result.getStatus().isSuccess()) {
+ List<DataItem> dataItemList = FreezableUtils.freezeIterable(result);
+ result.close();
+ resetDataItems(dataItemList);
+ } else {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "Reset quiz: failed to get Data Items to reset");
+ }
+ }
+ result.close();
+ }
+ });
+ } else {
+ Log.e(TAG, "Failed to reset data items because client is disconnected from "
+ + "Google Play Services");
+ }
+ setHasQuestionBeenAsked(false);
+ mNumCorrect = 0;
+ mNumIncorrect = 0;
+ mNumSkipped = 0;
+ }
+
+ private void resetDataItems(List<DataItem> dataItemList) {
+ if (mGoogleApiClient.isConnected()) {
+ for (final DataItem dataItem : dataItemList) {
+ final Uri dataItemUri = dataItem.getUri();
+ Wearable.DataApi.getDataItem(mGoogleApiClient, dataItemUri)
+ .setResultCallback(new ResetDataItemCallback());
+ }
+ } else {
+ Log.e(TAG, "Failed to reset data items because client is disconnected from "
+ + "Google Play Services");
+ }
+ }
+
+ /**
+ * Callback that marks a DataItem, which represents a question, as unanswered and not deleted.
+ */
+ private class ResetDataItemCallback implements ResultCallback<DataApi.DataItemResult> {
+ @Override
+ public void onResult(DataApi.DataItemResult dataItemResult) {
+ if (dataItemResult.getStatus().isSuccess()) {
+ PutDataMapRequest request = PutDataMapRequest.createFromDataMapItem(
+ DataMapItem.fromDataItem(dataItemResult.getDataItem()));
+ DataMap dataMap = request.getDataMap();
+ dataMap.putBoolean(QUESTION_WAS_ANSWERED, false);
+ dataMap.putBoolean(QUESTION_WAS_DELETED, false);
+ if (!mHasQuestionBeenAsked && dataMap.getInt(QUESTION_INDEX) == 0) {
+ // Ask the first question now.
+ Wearable.DataApi.putDataItem(mGoogleApiClient, request.asPutDataRequest());
+ setHasQuestionBeenAsked(true);
+ } else {
+ // Enqueue future questions.
+ mFutureQuestions.add(new Question(dataMap.getString(QUESTION),
+ dataMap.getInt(QUESTION_INDEX), dataMap.getStringArray(ANSWERS),
+ dataMap.getInt(CORRECT_ANSWER_INDEX)));
+ }
+ } else {
+ Log.e(TAG, "Failed to reset data item " + dataItemResult.getDataItem().getUri());
+ }
+ }
+ }
+
+ /**
+ * Clears the current quiz when user clicks on "New Quiz."
+ * On this end, this involves clearing the quiz status layout and deleting all DataItems. The
+ * wearable will then remove any outstanding question notifications upon receiving this change.
+ */
+ public void newQuiz(View view) {
+ clearQuizStatus();
+ if (mGoogleApiClient.isConnected()) {
+ Wearable.DataApi.getDataItems(mGoogleApiClient)
+ .setResultCallback(new ResultCallback<DataItemBuffer>() {
+ @Override
+ public void onResult(DataItemBuffer result) {
+ if (result.getStatus().isSuccess()) {
+ List<Uri> dataItemUriList = new ArrayList<Uri>();
+ for (final DataItem dataItem : result) {
+ dataItemUriList.add(dataItem.getUri());
+ }
+ result.close();
+ deleteDataItems(dataItemUriList);
+ } else {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "Clear quiz: failed to get Data Items for deletion");
+ }
+ }
+ result.close();
+ }
+ });
+ } else {
+ Log.e(TAG, "Failed to delete data items because client is disconnected from "
+ + "Google Play Services");
+ }
+ }
+
+ /**
+ * Removes quiz status views (i.e. the views describing the status of each question).
+ */
+ private void clearQuizStatus() {
+ questionsContainer.removeAllViews();
+ quizStatus.setVisibility(View.INVISIBLE);
+ quizButtons.setVisibility(View.INVISIBLE);
+ setHasQuestionBeenAsked(false);
+ mFutureQuestions.clear();
+ mQuestionIndex = 0;
+ mNumCorrect = 0;
+ mNumIncorrect = 0;
+ mNumSkipped = 0;
+ }
+
+ private void deleteDataItems(List<Uri> dataItemUriList) {
+ if (mGoogleApiClient.isConnected()) {
+ for (final Uri dataItemUri : dataItemUriList) {
+ Wearable.DataApi.deleteDataItems(mGoogleApiClient, dataItemUri)
+ .setResultCallback(new ResultCallback<DataApi.DeleteDataItemsResult>() {
+ @Override
+ public void onResult(DataApi.DeleteDataItemsResult deleteResult) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ if (deleteResult.getStatus().isSuccess()) {
+ Log.d(TAG, "Successfully deleted data item " + dataItemUri);
+ } else {
+ Log.d(TAG, "Failed to delete data item " + dataItemUri);
+ }
+ }
+ }
+ });
+ }
+ } else {
+ Log.e(TAG, "Failed to delete data items because client is disconnected from "
+ + "Google Play Services");
+ }
+ }
+
+ private void setHasQuestionBeenAsked(boolean b) {
+ mHasQuestionBeenAsked = b;
+ // Only let user click on Reset or Read from file if they have answered all the questions.
+ readQuizFromFileButton.setEnabled(!mHasQuestionBeenAsked);
+ resetQuizButton.setEnabled(!mHasQuestionBeenAsked);
+ }
+}
diff --git a/samples/browseable/Quiz/Wearable/AndroidManifest.xml b/samples/browseable/Quiz/Wearable/AndroidManifest.xml
new file mode 100644
index 000000000..fbc74922f
--- /dev/null
+++ b/samples/browseable/Quiz/Wearable/AndroidManifest.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.wearable.quiz" >
+
+
+ <uses-sdk android:minSdkVersion="20"
+ android:targetSdkVersion="21" />
+
+ <uses-feature android:name="android.hardware.type.watch" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@android:style/Theme.DeviceDefault" >
+ <meta-data
+ android:name="com.google.android.gms.version"
+ android:value="@integer/google_play_services_version" />
+
+ <service android:name=".QuizListenerService" >
+ <intent-filter>
+ <action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
+ </intent-filter>
+ </service>
+ <service android:name=".UpdateQuestionService" />
+ <service android:name=".DeleteQuestionService" />
+ <service android:name=".QuizReportActionService" />
+
+ </application>
+
+</manifest>
diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-hdpi/ic_choice_a.png b/samples/browseable/Quiz/Wearable/res/drawable-hdpi/ic_choice_a.png
index de18ce11a..de18ce11a 100644
--- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-hdpi/ic_choice_a.png
+++ b/samples/browseable/Quiz/Wearable/res/drawable-hdpi/ic_choice_a.png
Binary files differ
diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-hdpi/ic_choice_b.png b/samples/browseable/Quiz/Wearable/res/drawable-hdpi/ic_choice_b.png
index 3cdfe9750..3cdfe9750 100644
--- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-hdpi/ic_choice_b.png
+++ b/samples/browseable/Quiz/Wearable/res/drawable-hdpi/ic_choice_b.png
Binary files differ
diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-hdpi/ic_choice_c.png b/samples/browseable/Quiz/Wearable/res/drawable-hdpi/ic_choice_c.png
index f0ed2ef99..f0ed2ef99 100644
--- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-hdpi/ic_choice_c.png
+++ b/samples/browseable/Quiz/Wearable/res/drawable-hdpi/ic_choice_c.png
Binary files differ
diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-hdpi/ic_choice_d.png b/samples/browseable/Quiz/Wearable/res/drawable-hdpi/ic_choice_d.png
index c158d2953..c158d2953 100644
--- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-hdpi/ic_choice_d.png
+++ b/samples/browseable/Quiz/Wearable/res/drawable-hdpi/ic_choice_d.png
Binary files differ
diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-hdpi/ic_launcher.png b/samples/browseable/Quiz/Wearable/res/drawable-hdpi/ic_launcher.png
index 91a8cff95..91a8cff95 100755
--- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-hdpi/ic_launcher.png
+++ b/samples/browseable/Quiz/Wearable/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-hdpi/ic_unknown_choice.png b/samples/browseable/Quiz/Wearable/res/drawable-hdpi/ic_unknown_choice.png
index 9aed51728..9aed51728 100644
--- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-hdpi/ic_unknown_choice.png
+++ b/samples/browseable/Quiz/Wearable/res/drawable-hdpi/ic_unknown_choice.png
Binary files differ
diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-mdpi/ic_choice_a.png b/samples/browseable/Quiz/Wearable/res/drawable-mdpi/ic_choice_a.png
index 57459365c..57459365c 100644
--- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-mdpi/ic_choice_a.png
+++ b/samples/browseable/Quiz/Wearable/res/drawable-mdpi/ic_choice_a.png
Binary files differ
diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-mdpi/ic_choice_b.png b/samples/browseable/Quiz/Wearable/res/drawable-mdpi/ic_choice_b.png
index 958b92e31..958b92e31 100644
--- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-mdpi/ic_choice_b.png
+++ b/samples/browseable/Quiz/Wearable/res/drawable-mdpi/ic_choice_b.png
Binary files differ
diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-mdpi/ic_choice_c.png b/samples/browseable/Quiz/Wearable/res/drawable-mdpi/ic_choice_c.png
index 9fcfab754..9fcfab754 100644
--- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-mdpi/ic_choice_c.png
+++ b/samples/browseable/Quiz/Wearable/res/drawable-mdpi/ic_choice_c.png
Binary files differ
diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-mdpi/ic_choice_d.png b/samples/browseable/Quiz/Wearable/res/drawable-mdpi/ic_choice_d.png
index 821cadb78..821cadb78 100644
--- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-mdpi/ic_choice_d.png
+++ b/samples/browseable/Quiz/Wearable/res/drawable-mdpi/ic_choice_d.png
Binary files differ
diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-mdpi/ic_launcher.png b/samples/browseable/Quiz/Wearable/res/drawable-mdpi/ic_launcher.png
index 728ee6d73..728ee6d73 100755
--- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-mdpi/ic_launcher.png
+++ b/samples/browseable/Quiz/Wearable/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-mdpi/ic_unknown_choice.png b/samples/browseable/Quiz/Wearable/res/drawable-mdpi/ic_unknown_choice.png
index b8030ef08..b8030ef08 100644
--- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-mdpi/ic_unknown_choice.png
+++ b/samples/browseable/Quiz/Wearable/res/drawable-mdpi/ic_unknown_choice.png
Binary files differ
diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-xhdpi/ic_choice_a.png b/samples/browseable/Quiz/Wearable/res/drawable-xhdpi/ic_choice_a.png
index 3dba96f32..3dba96f32 100644
--- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-xhdpi/ic_choice_a.png
+++ b/samples/browseable/Quiz/Wearable/res/drawable-xhdpi/ic_choice_a.png
Binary files differ
diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-xhdpi/ic_choice_b.png b/samples/browseable/Quiz/Wearable/res/drawable-xhdpi/ic_choice_b.png
index 9ca3c85f2..9ca3c85f2 100644
--- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-xhdpi/ic_choice_b.png
+++ b/samples/browseable/Quiz/Wearable/res/drawable-xhdpi/ic_choice_b.png
Binary files differ
diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-xhdpi/ic_choice_c.png b/samples/browseable/Quiz/Wearable/res/drawable-xhdpi/ic_choice_c.png
index b84b3b76d..b84b3b76d 100644
--- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-xhdpi/ic_choice_c.png
+++ b/samples/browseable/Quiz/Wearable/res/drawable-xhdpi/ic_choice_c.png
Binary files differ
diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-xhdpi/ic_choice_d.png b/samples/browseable/Quiz/Wearable/res/drawable-xhdpi/ic_choice_d.png
index 185e91ec8..185e91ec8 100644
--- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-xhdpi/ic_choice_d.png
+++ b/samples/browseable/Quiz/Wearable/res/drawable-xhdpi/ic_choice_d.png
Binary files differ
diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/Quiz/Wearable/res/drawable-xhdpi/ic_launcher.png
index 64a585453..64a585453 100755
--- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png
+++ b/samples/browseable/Quiz/Wearable/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-xhdpi/ic_unknown_choice.png b/samples/browseable/Quiz/Wearable/res/drawable-xhdpi/ic_unknown_choice.png
index 57838d152..57838d152 100644
--- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-xhdpi/ic_unknown_choice.png
+++ b/samples/browseable/Quiz/Wearable/res/drawable-xhdpi/ic_unknown_choice.png
Binary files differ
diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/Quiz/Wearable/res/drawable-xxhdpi/ic_launcher.png
index 86a395bb6..86a395bb6 100755
--- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png
+++ b/samples/browseable/Quiz/Wearable/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/Quiz/Wearable/src/main/res/values/colors.xml b/samples/browseable/Quiz/Wearable/res/values/colors.xml
index b10adafa3..b10adafa3 100644
--- a/samples/wearable/Quiz/Wearable/src/main/res/values/colors.xml
+++ b/samples/browseable/Quiz/Wearable/res/values/colors.xml
diff --git a/samples/wearable/Quiz/Wearable/src/main/res/values/strings.xml b/samples/browseable/Quiz/Wearable/res/values/strings.xml
index 313ee4c29..313ee4c29 100644
--- a/samples/wearable/Quiz/Wearable/src/main/res/values/strings.xml
+++ b/samples/browseable/Quiz/Wearable/res/values/strings.xml
diff --git a/samples/wearable/Quiz/Wearable/src/main/java/com/example/android/wearable/quiz/Constants.java b/samples/browseable/Quiz/Wearable/src/com.example.android.wearable.quiz/Constants.java
index 8b81f59be..8b81f59be 100644
--- a/samples/wearable/Quiz/Wearable/src/main/java/com/example/android/wearable/quiz/Constants.java
+++ b/samples/browseable/Quiz/Wearable/src/com.example.android.wearable.quiz/Constants.java
diff --git a/samples/wearable/Quiz/Wearable/src/main/java/com/example/android/wearable/quiz/DeleteQuestionService.java b/samples/browseable/Quiz/Wearable/src/com.example.android.wearable.quiz/DeleteQuestionService.java
index 78e81ca0c..78e81ca0c 100644
--- a/samples/wearable/Quiz/Wearable/src/main/java/com/example/android/wearable/quiz/DeleteQuestionService.java
+++ b/samples/browseable/Quiz/Wearable/src/com.example.android.wearable.quiz/DeleteQuestionService.java
diff --git a/samples/wearable/Quiz/Wearable/src/main/java/com/example/android/wearable/quiz/QuizListenerService.java b/samples/browseable/Quiz/Wearable/src/com.example.android.wearable.quiz/QuizListenerService.java
index 020a37b8d..020a37b8d 100644
--- a/samples/wearable/Quiz/Wearable/src/main/java/com/example/android/wearable/quiz/QuizListenerService.java
+++ b/samples/browseable/Quiz/Wearable/src/com.example.android.wearable.quiz/QuizListenerService.java
diff --git a/samples/wearable/Quiz/Wearable/src/main/java/com/example/android/wearable/quiz/QuizReportActionService.java b/samples/browseable/Quiz/Wearable/src/com.example.android.wearable.quiz/QuizReportActionService.java
index 956bdaf38..956bdaf38 100644
--- a/samples/wearable/Quiz/Wearable/src/main/java/com/example/android/wearable/quiz/QuizReportActionService.java
+++ b/samples/browseable/Quiz/Wearable/src/com.example.android.wearable.quiz/QuizReportActionService.java
diff --git a/samples/wearable/Quiz/Wearable/src/main/java/com/example/android/wearable/quiz/UpdateQuestionService.java b/samples/browseable/Quiz/Wearable/src/com.example.android.wearable.quiz/UpdateQuestionService.java
index e06c30346..e06c30346 100644
--- a/samples/wearable/Quiz/Wearable/src/main/java/com/example/android/wearable/quiz/UpdateQuestionService.java
+++ b/samples/browseable/Quiz/Wearable/src/com.example.android.wearable.quiz/UpdateQuestionService.java
diff --git a/samples/browseable/Quiz/_index.jd b/samples/browseable/Quiz/_index.jd
new file mode 100644
index 000000000..3c1a1daa1
--- /dev/null
+++ b/samples/browseable/Quiz/_index.jd
@@ -0,0 +1,15 @@
+page.tags="Quiz"
+sample.group=Wearable
+@jd:body
+
+<p>
+
+ This sample uses Google Play Services Wearable Data APIs to communicate between
+ applications on a phone and a paired wearable device. Users can create quiz questions on the phone,
+ each of which has an associated DataItem. These DataItems are then received on the wearable, which
+ displays them as notifications. Each notification contains the question as the first page, followed
+ by answers as actions. When an answer is selected, the corresponding question\'s DataItem is updated,
+ which allows the phone application to update the status of the question (i.e. did the user answer it
+ correctly or not) and prompt the next question.
+
+ </p>
diff --git a/samples/browseable/RecipeAssistant/Application/AndroidManifest.xml b/samples/browseable/RecipeAssistant/Application/AndroidManifest.xml
new file mode 100644
index 000000000..1786d278b
--- /dev/null
+++ b/samples/browseable/RecipeAssistant/Application/AndroidManifest.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.wearable.recipeassistant" >
+
+ <uses-sdk android:minSdkVersion="18"
+ android:targetSdkVersion="21" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@mipmap/ic_app_recipe"
+ android:label="@string/app_name"
+ android:theme="@android:style/Theme.Holo.Light" >
+ <activity
+ android:name=".MainActivity"
+ android:label="@string/app_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <activity
+ android:name=".RecipeActivity"
+ android:label="@string/app_name" >
+ </activity>
+ <service
+ android:name=".RecipeService" />
+ </application>
+
+</manifest>
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/drawable-hdpi/ic_noimage.png b/samples/browseable/RecipeAssistant/Application/res/drawable-hdpi/ic_noimage.png
index 7bba7ab76..7bba7ab76 100644
--- a/samples/wearable/RecipeAssistant/Application/src/main/res/drawable-hdpi/ic_noimage.png
+++ b/samples/browseable/RecipeAssistant/Application/res/drawable-hdpi/ic_noimage.png
Binary files differ
diff --git a/samples/browseable/RecipeAssistant/Application/res/drawable-hdpi/tile.9.png b/samples/browseable/RecipeAssistant/Application/res/drawable-hdpi/tile.9.png
new file mode 100644
index 000000000..135862883
--- /dev/null
+++ b/samples/browseable/RecipeAssistant/Application/res/drawable-hdpi/tile.9.png
Binary files differ
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/drawable-mdpi/ic_noimage.png b/samples/browseable/RecipeAssistant/Application/res/drawable-mdpi/ic_noimage.png
index a5ad26f64..a5ad26f64 100644
--- a/samples/wearable/RecipeAssistant/Application/src/main/res/drawable-mdpi/ic_noimage.png
+++ b/samples/browseable/RecipeAssistant/Application/res/drawable-mdpi/ic_noimage.png
Binary files differ
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/drawable-xhdpi/ic_noimage.png b/samples/browseable/RecipeAssistant/Application/res/drawable-xhdpi/ic_noimage.png
index 8b631d121..8b631d121 100644
--- a/samples/wearable/RecipeAssistant/Application/src/main/res/drawable-xhdpi/ic_noimage.png
+++ b/samples/browseable/RecipeAssistant/Application/res/drawable-xhdpi/ic_noimage.png
Binary files differ
diff --git a/samples/browseable/RecipeAssistant/Application/res/layout/activity_main.xml b/samples/browseable/RecipeAssistant/Application/res/layout/activity_main.xml
new file mode 100755
index 000000000..be1aa49d9
--- /dev/null
+++ b/samples/browseable/RecipeAssistant/Application/res/layout/activity_main.xml
@@ -0,0 +1,36 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <LinearLayout style="@style/Widget.SampleMessageTile"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView style="@style/Widget.SampleMessage"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="@dimen/horizontal_page_margin"
+ android:layout_marginRight="@dimen/horizontal_page_margin"
+ android:layout_marginTop="@dimen/vertical_page_margin"
+ android:layout_marginBottom="@dimen/vertical_page_margin"
+ android:text="@string/intro_message" />
+ </LinearLayout>
+</LinearLayout>
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/layout/list_item.xml b/samples/browseable/RecipeAssistant/Application/res/layout/list_item.xml
index 756880c8f..756880c8f 100644
--- a/samples/wearable/RecipeAssistant/Application/src/main/res/layout/list_item.xml
+++ b/samples/browseable/RecipeAssistant/Application/res/layout/list_item.xml
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/layout/recipe.xml b/samples/browseable/RecipeAssistant/Application/res/layout/recipe.xml
index 3bb20b86b..3bb20b86b 100644
--- a/samples/wearable/RecipeAssistant/Application/src/main/res/layout/recipe.xml
+++ b/samples/browseable/RecipeAssistant/Application/res/layout/recipe.xml
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/layout/step_item.xml b/samples/browseable/RecipeAssistant/Application/res/layout/step_item.xml
index faa5ac5c8..faa5ac5c8 100644
--- a/samples/wearable/RecipeAssistant/Application/src/main/res/layout/step_item.xml
+++ b/samples/browseable/RecipeAssistant/Application/res/layout/step_item.xml
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/menu/main.xml b/samples/browseable/RecipeAssistant/Application/res/menu/main.xml
index b392472f8..b392472f8 100644
--- a/samples/wearable/RecipeAssistant/Application/src/main/res/menu/main.xml
+++ b/samples/browseable/RecipeAssistant/Application/res/menu/main.xml
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-hdpi/ic_app_recipe.png b/samples/browseable/RecipeAssistant/Application/res/mipmap-hdpi/ic_app_recipe.png
index 8ceb8696d..8ceb8696d 100644
--- a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-hdpi/ic_app_recipe.png
+++ b/samples/browseable/RecipeAssistant/Application/res/mipmap-hdpi/ic_app_recipe.png
Binary files differ
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-hdpi/ic_notification_recipe.png b/samples/browseable/RecipeAssistant/Application/res/mipmap-hdpi/ic_notification_recipe.png
index 844d8ede8..844d8ede8 100644
--- a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-hdpi/ic_notification_recipe.png
+++ b/samples/browseable/RecipeAssistant/Application/res/mipmap-hdpi/ic_notification_recipe.png
Binary files differ
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-mdpi/ic_app_recipe.png b/samples/browseable/RecipeAssistant/Application/res/mipmap-mdpi/ic_app_recipe.png
index b884789c5..b884789c5 100644
--- a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-mdpi/ic_app_recipe.png
+++ b/samples/browseable/RecipeAssistant/Application/res/mipmap-mdpi/ic_app_recipe.png
Binary files differ
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-mdpi/ic_notification_recipe.png b/samples/browseable/RecipeAssistant/Application/res/mipmap-mdpi/ic_notification_recipe.png
index 3f3f58cde..3f3f58cde 100644
--- a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-mdpi/ic_notification_recipe.png
+++ b/samples/browseable/RecipeAssistant/Application/res/mipmap-mdpi/ic_notification_recipe.png
Binary files differ
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-xhdpi/ic_app_recipe.png b/samples/browseable/RecipeAssistant/Application/res/mipmap-xhdpi/ic_app_recipe.png
index 2a27c3283..2a27c3283 100644
--- a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-xhdpi/ic_app_recipe.png
+++ b/samples/browseable/RecipeAssistant/Application/res/mipmap-xhdpi/ic_app_recipe.png
Binary files differ
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-xhdpi/ic_notification_recipe.png b/samples/browseable/RecipeAssistant/Application/res/mipmap-xhdpi/ic_notification_recipe.png
index 5a99b7c71..5a99b7c71 100644
--- a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-xhdpi/ic_notification_recipe.png
+++ b/samples/browseable/RecipeAssistant/Application/res/mipmap-xhdpi/ic_notification_recipe.png
Binary files differ
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-xxhdpi/ic_app_recipe.png b/samples/browseable/RecipeAssistant/Application/res/mipmap-xxhdpi/ic_app_recipe.png
index b10c77068..b10c77068 100644
--- a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-xxhdpi/ic_app_recipe.png
+++ b/samples/browseable/RecipeAssistant/Application/res/mipmap-xxhdpi/ic_app_recipe.png
Binary files differ
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-xxhdpi/ic_notification_recipe.png b/samples/browseable/RecipeAssistant/Application/res/mipmap-xxhdpi/ic_notification_recipe.png
index 799726d05..799726d05 100644
--- a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-xxhdpi/ic_notification_recipe.png
+++ b/samples/browseable/RecipeAssistant/Application/res/mipmap-xxhdpi/ic_notification_recipe.png
Binary files differ
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-xxxhdpi/ic_app_recipe.png b/samples/browseable/RecipeAssistant/Application/res/mipmap-xxxhdpi/ic_app_recipe.png
index 606f07f77..606f07f77 100644
--- a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-xxxhdpi/ic_app_recipe.png
+++ b/samples/browseable/RecipeAssistant/Application/res/mipmap-xxxhdpi/ic_app_recipe.png
Binary files differ
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-xxxhdpi/ic_notification_recipe.png b/samples/browseable/RecipeAssistant/Application/res/mipmap-xxxhdpi/ic_notification_recipe.png
index 30e28a884..30e28a884 100644
--- a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-xxxhdpi/ic_notification_recipe.png
+++ b/samples/browseable/RecipeAssistant/Application/res/mipmap-xxxhdpi/ic_notification_recipe.png
Binary files differ
diff --git a/samples/browseable/RecipeAssistant/Application/res/values-sw600dp/template-dimens.xml b/samples/browseable/RecipeAssistant/Application/res/values-sw600dp/template-dimens.xml
new file mode 100644
index 000000000..22074a2bd
--- /dev/null
+++ b/samples/browseable/RecipeAssistant/Application/res/values-sw600dp/template-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>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_huge</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/RecipeAssistant/Application/res/values-sw600dp/template-styles.xml b/samples/browseable/RecipeAssistant/Application/res/values-sw600dp/template-styles.xml
new file mode 100644
index 000000000..03d197418
--- /dev/null
+++ b/samples/browseable/RecipeAssistant/Application/res/values-sw600dp/template-styles.xml
@@ -0,0 +1,25 @@
+<!--
+ 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.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceLarge</item>
+ <item name="android:lineSpacingMultiplier">1.2</item>
+ <item name="android:shadowDy">-6.5</item>
+ </style>
+
+</resources>
diff --git a/samples/browseable/RecipeAssistant/Application/res/values-v11/template-styles.xml b/samples/browseable/RecipeAssistant/Application/res/values-v11/template-styles.xml
new file mode 100644
index 000000000..8c1ea66f2
--- /dev/null
+++ b/samples/browseable/RecipeAssistant/Application/res/values-v11/template-styles.xml
@@ -0,0 +1,22 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Holo.Light" />
+
+</resources>
diff --git a/samples/browseable/RecipeAssistant/Application/res/values-v21/base-colors.xml b/samples/browseable/RecipeAssistant/Application/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/RecipeAssistant/Application/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/RecipeAssistant/Application/res/values-v21/base-template-styles.xml b/samples/browseable/RecipeAssistant/Application/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/RecipeAssistant/Application/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/RecipeAssistant/Application/res/values/base-strings.xml b/samples/browseable/RecipeAssistant/Application/res/values/base-strings.xml
new file mode 100644
index 000000000..e536fbd5e
--- /dev/null
+++ b/samples/browseable/RecipeAssistant/Application/res/values/base-strings.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.
+-->
+<resources>
+ <string name="app_name">RecipeAssistant</string>
+ <string name="intro_message">
+ <![CDATA[
+
+
+ This phone application uses the enhanced notifications API to display recipe
+ instructions using paged notifications. After starting the application on your phone, you can browse
+ from a short list of recipes and select one to view. Each recipe is broken down into a number of
+ steps; when ready, you can click on the START action in the action bar to send the steps to the
+ wearable. On the wearable device, the steps are displayed as a multi-page notification, with one
+ page for each step in the recipe.
+
+
+ ]]>
+ </string>
+</resources>
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/values/colors.xml b/samples/browseable/RecipeAssistant/Application/res/values/colors.xml
index 0f1430c3f..0f1430c3f 100644
--- a/samples/wearable/RecipeAssistant/Application/src/main/res/values/colors.xml
+++ b/samples/browseable/RecipeAssistant/Application/res/values/colors.xml
diff --git a/samples/browseable/RecipeAssistant/Application/res/values/strings.xml b/samples/browseable/RecipeAssistant/Application/res/values/strings.xml
new file mode 100644
index 000000000..f8ae1092c
--- /dev/null
+++ b/samples/browseable/RecipeAssistant/Application/res/values/strings.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+ <string name="action_settings">Settings</string>
+ <string name="action_cook">Start</string>
+ <string name="steps">Steps</string>
+ <string name="ingredients">Ingredients</string>
+ <string name="step_count">Step %1$d of %2$d</string>
+</resources>
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/values/styles.xml b/samples/browseable/RecipeAssistant/Application/res/values/styles.xml
index 8876dd5f5..8876dd5f5 100644
--- a/samples/wearable/RecipeAssistant/Application/src/main/res/values/styles.xml
+++ b/samples/browseable/RecipeAssistant/Application/res/values/styles.xml
diff --git a/samples/browseable/RecipeAssistant/Application/res/values/template-dimens.xml b/samples/browseable/RecipeAssistant/Application/res/values/template-dimens.xml
new file mode 100644
index 000000000..39e710b5c
--- /dev/null
+++ b/samples/browseable/RecipeAssistant/Application/res/values/template-dimens.xml
@@ -0,0 +1,32 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Define standard dimensions to comply with Holo-style grids and rhythm. -->
+
+ <dimen name="margin_tiny">4dp</dimen>
+ <dimen name="margin_small">8dp</dimen>
+ <dimen name="margin_medium">16dp</dimen>
+ <dimen name="margin_large">32dp</dimen>
+ <dimen name="margin_huge">64dp</dimen>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_medium</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/RecipeAssistant/Application/res/values/template-styles.xml b/samples/browseable/RecipeAssistant/Application/res/values/template-styles.xml
new file mode 100644
index 000000000..6e7d593dd
--- /dev/null
+++ b/samples/browseable/RecipeAssistant/Application/res/values/template-styles.xml
@@ -0,0 +1,42 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+
+ <style name="Theme.Base" parent="android:Theme.Light" />
+
+ <style name="Theme.Sample" parent="Theme.Base" />
+
+ <style name="AppTheme" parent="Theme.Sample" />
+ <!-- Widget styling -->
+
+ <style name="Widget" />
+
+ <style name="Widget.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceMedium</item>
+ <item name="android:lineSpacingMultiplier">1.1</item>
+ </style>
+
+ <style name="Widget.SampleMessageTile">
+ <item name="android:background">@drawable/tile</item>
+ <item name="android:shadowColor">#7F000000</item>
+ <item name="android:shadowDy">-3.5</item>
+ <item name="android:shadowRadius">2</item>
+ </style>
+
+</resources>
diff --git a/samples/browseable/RecipeAssistant/Application/src/com.example.android.common/activities/SampleActivityBase.java b/samples/browseable/RecipeAssistant/Application/src/com.example.android.common/activities/SampleActivityBase.java
new file mode 100644
index 000000000..3228927b7
--- /dev/null
+++ b/samples/browseable/RecipeAssistant/Application/src/com.example.android.common/activities/SampleActivityBase.java
@@ -0,0 +1,52 @@
+/*
+* Copyright 2013 The Android Open Source Project
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package com.example.android.common.activities;
+
+import android.os.Bundle;
+import android.support.v4.app.FragmentActivity;
+
+import com.example.android.common.logger.Log;
+import com.example.android.common.logger.LogWrapper;
+
+/**
+ * Base launcher activity, to handle most of the common plumbing for samples.
+ */
+public class SampleActivityBase extends FragmentActivity {
+
+ public static final String TAG = "SampleActivityBase";
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ }
+
+ @Override
+ protected void onStart() {
+ super.onStart();
+ initializeLogging();
+ }
+
+ /** Set up targets to receive log data */
+ public void initializeLogging() {
+ // Using Log, front-end to the logging chain, emulates android.util.log method signatures.
+ // Wraps Android's native log framework
+ LogWrapper logWrapper = new LogWrapper();
+ Log.setLogNode(logWrapper);
+
+ Log.i(TAG, "Ready");
+ }
+}
diff --git a/samples/browseable/RecipeAssistant/Application/src/com.example.android.common/logger/Log.java b/samples/browseable/RecipeAssistant/Application/src/com.example.android.common/logger/Log.java
new file mode 100644
index 000000000..17503c568
--- /dev/null
+++ b/samples/browseable/RecipeAssistant/Application/src/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);
+ }
+}
diff --git a/samples/browseable/RecipeAssistant/Application/src/com.example.android.common/logger/LogFragment.java b/samples/browseable/RecipeAssistant/Application/src/com.example.android.common/logger/LogFragment.java
new file mode 100644
index 000000000..b302acd4b
--- /dev/null
+++ b/samples/browseable/RecipeAssistant/Application/src/com.example.android.common/logger/LogFragment.java
@@ -0,0 +1,109 @@
+/*
+* 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 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.graphics.Typeface;
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ScrollView;
+
+/**
+ * Simple fraggment which contains a LogView and uses is to output log data it receives
+ * through the LogNode interface.
+ */
+public class LogFragment extends Fragment {
+
+ private LogView mLogView;
+ private ScrollView mScrollView;
+
+ public LogFragment() {}
+
+ public View inflateViews() {
+ mScrollView = new ScrollView(getActivity());
+ ViewGroup.LayoutParams scrollParams = new ViewGroup.LayoutParams(
+ ViewGroup.LayoutParams.MATCH_PARENT,
+ ViewGroup.LayoutParams.MATCH_PARENT);
+ mScrollView.setLayoutParams(scrollParams);
+
+ mLogView = new LogView(getActivity());
+ ViewGroup.LayoutParams logParams = new ViewGroup.LayoutParams(scrollParams);
+ logParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
+ mLogView.setLayoutParams(logParams);
+ mLogView.setClickable(true);
+ mLogView.setFocusable(true);
+ mLogView.setTypeface(Typeface.MONOSPACE);
+
+ // Want to set padding as 16 dips, setPadding takes pixels. Hooray math!
+ int paddingDips = 16;
+ double scale = getResources().getDisplayMetrics().density;
+ int paddingPixels = (int) ((paddingDips * (scale)) + .5);
+ mLogView.setPadding(paddingPixels, paddingPixels, paddingPixels, paddingPixels);
+ mLogView.setCompoundDrawablePadding(paddingPixels);
+
+ mLogView.setGravity(Gravity.BOTTOM);
+ mLogView.setTextAppearance(getActivity(), android.R.style.TextAppearance_Holo_Medium);
+
+ mScrollView.addView(mLogView);
+ return mScrollView;
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+
+ View result = inflateViews();
+
+ 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) {
+ mScrollView.fullScroll(ScrollView.FOCUS_DOWN);
+ }
+ });
+ return result;
+ }
+
+ public LogView getLogView() {
+ return mLogView;
+ }
+} \ No newline at end of file
diff --git a/samples/browseable/RecipeAssistant/Application/src/com.example.android.common/logger/LogNode.java b/samples/browseable/RecipeAssistant/Application/src/com.example.android.common/logger/LogNode.java
new file mode 100644
index 000000000..bc37cabc0
--- /dev/null
+++ b/samples/browseable/RecipeAssistant/Application/src/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/samples/browseable/RecipeAssistant/Application/src/com.example.android.common/logger/LogView.java b/samples/browseable/RecipeAssistant/Application/src/com.example.android.common/logger/LogView.java
new file mode 100644
index 000000000..c01542b91
--- /dev/null
+++ b/samples/browseable/RecipeAssistant/Application/src/com.example.android.common/logger/LogView.java
@@ -0,0 +1,145 @@
+/*
+ * 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.app.Activity;
+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.
+ final StringBuilder outputBuilder = new StringBuilder();
+
+ String delimiter = "\t";
+ appendIfNotNull(outputBuilder, priorityStr, delimiter);
+ appendIfNotNull(outputBuilder, tag, delimiter);
+ appendIfNotNull(outputBuilder, msg, delimiter);
+ appendIfNotNull(outputBuilder, exceptionStr, delimiter);
+
+ // In case this was originally called from an AsyncTask or some other off-UI thread,
+ // make sure the update occurs within the UI thread.
+ ((Activity) getContext()).runOnUiThread( (new Thread(new Runnable() {
+ @Override
+ public void run() {
+ // 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/samples/browseable/RecipeAssistant/Application/src/com.example.android.common/logger/LogWrapper.java b/samples/browseable/RecipeAssistant/Application/src/com.example.android.common/logger/LogWrapper.java
new file mode 100644
index 000000000..16a9e7ba2
--- /dev/null
+++ b/samples/browseable/RecipeAssistant/Application/src/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);
+ }
+ }
+}
diff --git a/samples/browseable/RecipeAssistant/Application/src/com.example.android.common/logger/MessageOnlyLogFilter.java b/samples/browseable/RecipeAssistant/Application/src/com.example.android.common/logger/MessageOnlyLogFilter.java
new file mode 100644
index 000000000..19967dcd4
--- /dev/null
+++ b/samples/browseable/RecipeAssistant/Application/src/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 chain.
+ */
+ public LogNode getNext() {
+ return mNext;
+ }
+
+ /**
+ * Sets the LogNode data will be sent to..
+ */
+ public void setNext(LogNode node) {
+ mNext = node;
+ }
+
+}
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/AssetUtils.java b/samples/browseable/RecipeAssistant/Application/src/com.example.android.wearable.recipeassistant/AssetUtils.java
index 8753582af..8753582af 100644
--- a/samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/AssetUtils.java
+++ b/samples/browseable/RecipeAssistant/Application/src/com.example.android.wearable.recipeassistant/AssetUtils.java
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/Constants.java b/samples/browseable/RecipeAssistant/Application/src/com.example.android.wearable.recipeassistant/Constants.java
index fae49ee7a..fae49ee7a 100644
--- a/samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/Constants.java
+++ b/samples/browseable/RecipeAssistant/Application/src/com.example.android.wearable.recipeassistant/Constants.java
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/MainActivity.java b/samples/browseable/RecipeAssistant/Application/src/com.example.android.wearable.recipeassistant/MainActivity.java
index 4cc860f49..4cc860f49 100644
--- a/samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/MainActivity.java
+++ b/samples/browseable/RecipeAssistant/Application/src/com.example.android.wearable.recipeassistant/MainActivity.java
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/Recipe.java b/samples/browseable/RecipeAssistant/Application/src/com.example.android.wearable.recipeassistant/Recipe.java
index e470c0f4e..e470c0f4e 100644
--- a/samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/Recipe.java
+++ b/samples/browseable/RecipeAssistant/Application/src/com.example.android.wearable.recipeassistant/Recipe.java
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/RecipeActivity.java b/samples/browseable/RecipeAssistant/Application/src/com.example.android.wearable.recipeassistant/RecipeActivity.java
index cc7f034a7..cc7f034a7 100644
--- a/samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/RecipeActivity.java
+++ b/samples/browseable/RecipeAssistant/Application/src/com.example.android.wearable.recipeassistant/RecipeActivity.java
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/RecipeListAdapter.java b/samples/browseable/RecipeAssistant/Application/src/com.example.android.wearable.recipeassistant/RecipeListAdapter.java
index 746603a31..746603a31 100644
--- a/samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/RecipeListAdapter.java
+++ b/samples/browseable/RecipeAssistant/Application/src/com.example.android.wearable.recipeassistant/RecipeListAdapter.java
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/RecipeService.java b/samples/browseable/RecipeAssistant/Application/src/com.example.android.wearable.recipeassistant/RecipeService.java
index 4abdf97f0..4abdf97f0 100644
--- a/samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/RecipeService.java
+++ b/samples/browseable/RecipeAssistant/Application/src/com.example.android.wearable.recipeassistant/RecipeService.java
diff --git a/samples/browseable/RecipeAssistant/_index.jd b/samples/browseable/RecipeAssistant/_index.jd
new file mode 100644
index 000000000..0860bce87
--- /dev/null
+++ b/samples/browseable/RecipeAssistant/_index.jd
@@ -0,0 +1,14 @@
+page.tags="RecipeAssistant"
+sample.group=Wearable
+@jd:body
+
+<p>
+
+ This phone application uses the enhanced notifications API to display recipe
+ instructions using paged notifications. After starting the application on your phone, you can browse
+ from a short list of recipes and select one to view. Each recipe is broken down into a number of
+ steps; when ready, you can click on the START action in the action bar to send the steps to the
+ wearable. On the wearable device, the steps are displayed as a multi-page notification, with one
+ page for each step in the recipe.
+
+ </p>
diff --git a/samples/browseable/RecyclerView/_index.jd b/samples/browseable/RecyclerView/_index.jd
index e4e2534ac..31b0facbf 100644
--- a/samples/browseable/RecyclerView/_index.jd
+++ b/samples/browseable/RecyclerView/_index.jd
@@ -4,6 +4,8 @@ sample.group=UI
<p>
- Demonstration of using RecyclerView with a LayoutManager to create a vertical ListView.
+ Demonstration of using RecyclerView with a LinearLayoutManager and GridLayoutManager
+ to create a vertical list. Tap \"SHOW LOG\" to view elements as they are bound to
+ their ViewHolder. The log also displays elements that you tap.
</p>
diff --git a/samples/browseable/RecyclerView/res/layout/recycler_view_frag.xml b/samples/browseable/RecyclerView/res/layout/recycler_view_frag.xml
index 6682468ee..dda99ce3a 100644
--- a/samples/browseable/RecyclerView/res/layout/recycler_view_frag.xml
+++ b/samples/browseable/RecyclerView/res/layout/recycler_view_frag.xml
@@ -15,14 +15,28 @@
limitations under the License.
-->
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
+ <RadioGroup
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:orientation="horizontal"
+ android:checkedButton="@+id/linear_layout_rb">
+ <RadioButton android:id="@+id/linear_layout_rb"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/linear_layout_manager"/>
+ <RadioButton android:id="@+id/grid_layout_rb"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/grid_layout_manager"/>
+ </RadioGroup>
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
- android:layout_height="match_parent" />
-
-</FrameLayout>
+ android:layout_height="match_parent"/>
+</LinearLayout>
diff --git a/samples/browseable/RecyclerView/res/layout/text_row_item.xml b/samples/browseable/RecyclerView/res/layout/text_row_item.xml
index d552e0e52..9b94684b8 100644
--- a/samples/browseable/RecyclerView/res/layout/text_row_item.xml
+++ b/samples/browseable/RecyclerView/res/layout/text_row_item.xml
@@ -15,17 +15,16 @@
limitations under the License.
-->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_margin="@dimen/margin_small"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content">
-
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/list_item_height"
+ android:layout_marginLeft="@dimen/margin_medium"
+ android:layout_marginRight="@dimen/margin_medium"
+ android:gravity="center_vertical">
<TextView
+ android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="@string/element_text"
- android:id="@+id/textView"
- android:layout_gravity="center_horizontal"/>
-</LinearLayout> \ No newline at end of file
+ android:text="@string/element_text"/>
+</FrameLayout> \ No newline at end of file
diff --git a/samples/browseable/RecyclerView/res/values-v21/base-colors.xml b/samples/browseable/RecyclerView/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..16853b126
--- /dev/null
+++ b/samples/browseable/RecyclerView/res/values-v21/base-colors.xml
@@ -0,0 +1,22 @@
+<?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>
+
+ <color name="colorPrimary">#00BCD4</color>
+ <color name="colorPrimaryDark">#00838F</color>
+
+</resources>
diff --git a/samples/browseable/RecyclerView/res/values-v21/base-template-styles.xml b/samples/browseable/RecyclerView/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..c2b4c8ea7
--- /dev/null
+++ b/samples/browseable/RecyclerView/res/values-v21/base-template-styles.xml
@@ -0,0 +1,25 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ <item name="android:colorPrimary">@color/colorPrimary</item>
+ <item name="android:colorPrimaryDark">@color/colorPrimaryDark</item>
+ </style>
+
+</resources>
diff --git a/samples/browseable/RecyclerView/res/values-v21/template-styles.xml b/samples/browseable/RecyclerView/res/values-v21/template-styles.xml
deleted file mode 100644
index 134fcd9d3..000000000
--- a/samples/browseable/RecyclerView/res/values-v21/template-styles.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<!--
- Copyright 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<resources>
-
- <!-- Activity themes -->
- <style name="Theme.Base" parent="android:Theme.Material.Light" />
-
-</resources>
diff --git a/samples/browseable/RecyclerView/res/values/base-strings.xml b/samples/browseable/RecyclerView/res/values/base-strings.xml
index b6efd8eb3..7580f122a 100644
--- a/samples/browseable/RecyclerView/res/values/base-strings.xml
+++ b/samples/browseable/RecyclerView/res/values/base-strings.xml
@@ -20,7 +20,9 @@
<![CDATA[
- Demonstration of using RecyclerView with a LayoutManager to create a vertical ListView.
+ Demonstration of using RecyclerView with a LinearLayoutManager and GridLayoutManager
+ to create a vertical list. Tap \"SHOW LOG\" to view elements as they are bound to
+ their ViewHolder. The log also displays elements that you tap.
]]>
diff --git a/samples/browseable/RecyclerView/res/values/dimens.xml b/samples/browseable/RecyclerView/res/values/dimens.xml
new file mode 100644
index 000000000..5af7e9ede
--- /dev/null
+++ b/samples/browseable/RecyclerView/res/values/dimens.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 2014 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>
+ <dimen name="list_item_height">72dp</dimen>
+</resources> \ No newline at end of file
diff --git a/samples/browseable/RecyclerView/res/values/strings.xml b/samples/browseable/RecyclerView/res/values/strings.xml
index 179529c01..642e022ff 100644
--- a/samples/browseable/RecyclerView/res/values/strings.xml
+++ b/samples/browseable/RecyclerView/res/values/strings.xml
@@ -17,4 +17,6 @@
<resources>
<string name="element_text">Element</string>
+ <string name="grid_layout_manager">Grid Layout Manager</string>
+ <string name="linear_layout_manager">Linear Layout Manager</string>
</resources> \ No newline at end of file
diff --git a/samples/browseable/RecyclerView/src/com.example.android.recyclerview/CustomAdapter.java b/samples/browseable/RecyclerView/src/com.example.android.recyclerview/CustomAdapter.java
index f8e3baecf..40f937541 100644
--- a/samples/browseable/RecyclerView/src/com.example.android.recyclerview/CustomAdapter.java
+++ b/samples/browseable/RecyclerView/src/com.example.android.recyclerview/CustomAdapter.java
@@ -34,21 +34,29 @@ public class CustomAdapter extends RecyclerView.Adapter<CustomAdapter.ViewHolder
// BEGIN_INCLUDE(recyclerViewSampleViewHolder)
/**
- * Provide a reference to the type of views that you are using (custom viewholder)
+ * Provide a reference to the type of views that you are using (custom ViewHolder)
*/
public static class ViewHolder extends RecyclerView.ViewHolder {
- private final TextView mTextView;
+ private final TextView textView;
public ViewHolder(View v) {
super(v);
- mTextView = (TextView) v.findViewById(R.id.textView);
+ // Define click listener for the ViewHolder's View.
+ v.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Log.d(TAG, "Element " + getPosition() + " clicked.");
+ }
+ });
+ textView = (TextView) v.findViewById(R.id.textView);
}
- public TextView getmTextView() {
- return mTextView;
+ public TextView getTextView() {
+ return textView;
}
}
// END_INCLUDE(recyclerViewSampleViewHolder)
+
/**
* Initialize the dataset of the Adapter.
*
@@ -61,25 +69,24 @@ public class CustomAdapter extends RecyclerView.Adapter<CustomAdapter.ViewHolder
// BEGIN_INCLUDE(recyclerViewOnCreateViewHolder)
// Create new views (invoked by the layout manager)
@Override
- public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int position) {
+ public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
// Create a new view.
View v = LayoutInflater.from(viewGroup.getContext())
.inflate(R.layout.text_row_item, viewGroup, false);
- ViewHolder vh = new ViewHolder(v);
- return vh;
+ return new ViewHolder(v);
}
// END_INCLUDE(recyclerViewOnCreateViewHolder)
// BEGIN_INCLUDE(recyclerViewOnBindViewHolder)
// Replace the contents of a view (invoked by the layout manager)
@Override
- public void onBindViewHolder(ViewHolder viewHolder, int position) {
+ public void onBindViewHolder(ViewHolder viewHolder, final int position) {
Log.d(TAG, "Element " + position + " set.");
// Get element from your dataset at this position and replace the contents of the view
// with that element
- viewHolder.getmTextView().setText(mDataSet[position]);
+ viewHolder.getTextView().setText(mDataSet[position]);
}
// END_INCLUDE(recyclerViewOnBindViewHolder)
diff --git a/samples/browseable/RecyclerView/src/com.example.android.recyclerview/RecyclerViewFragment.java b/samples/browseable/RecyclerView/src/com.example.android.recyclerview/RecyclerViewFragment.java
index 4f4a5966a..019657ffb 100644
--- a/samples/browseable/RecyclerView/src/com.example.android.recyclerview/RecyclerViewFragment.java
+++ b/samples/browseable/RecyclerView/src/com.example.android.recyclerview/RecyclerViewFragment.java
@@ -18,21 +18,37 @@ package com.example.android.recyclerview;
import android.os.Bundle;
import android.support.v4.app.Fragment;
+import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.RadioButton;
/**
- * Demonstrates the use of RecyclerView with a LinearLayoutManager.
+ * Demonstrates the use of {@link RecyclerView} with a {@link LinearLayoutManager} and a
+ * {@link GridLayoutManager}.
*/
public class RecyclerViewFragment extends Fragment {
private static final String TAG = "RecyclerViewFragment";
+ private static final String KEY_LAYOUT_MANAGER = "layoutManager";
+ private static final int SPAN_COUNT = 2;
+ private static final int DATASET_COUNT = 60;
+
+ private enum LayoutManagerType {
+ GRID_LAYOUT_MANAGER,
+ LINEAR_LAYOUT_MANAGER
+ }
+
+ protected LayoutManagerType mCurrentLayoutManagerType;
+
+ protected RadioButton mLinearLayoutRadioButton;
+ protected RadioButton mGridLayoutRadioButton;
protected RecyclerView mRecyclerView;
- protected RecyclerView.Adapter mAdapter;
+ protected CustomAdapter mAdapter;
protected RecyclerView.LayoutManager mLayoutManager;
protected String[] mDataset;
@@ -58,23 +74,86 @@ public class RecyclerViewFragment extends Fragment {
// to the way ListView would layout elements. The RecyclerView.LayoutManager defines how
// elements are laid out.
mLayoutManager = new LinearLayoutManager(getActivity());
- mRecyclerView.setLayoutManager(mLayoutManager);
+
+ mCurrentLayoutManagerType = LayoutManagerType.LINEAR_LAYOUT_MANAGER;
+
+ if (savedInstanceState != null) {
+ // Restore saved layout manager type.
+ mCurrentLayoutManagerType = (LayoutManagerType) savedInstanceState
+ .getSerializable(LAYOUT_MANAGER_KEY);
+ }
+ setRecyclerViewLayoutManager(mCurrentLayoutManagerType);
mAdapter = new CustomAdapter(mDataset);
// Set CustomAdapter as the adapter for RecyclerView.
mRecyclerView.setAdapter(mAdapter);
// END_INCLUDE(initializeRecyclerView)
+ mLinearLayoutRadioButton = (RadioButton) rootView.findViewById(R.id.linear_layout_rb);
+ mLinearLayoutRadioButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ setRecyclerViewLayoutManager(LayoutManagerType.LINEAR_LAYOUT_MANAGER);
+ }
+ });
+
+ mGridLayoutRadioButton = (RadioButton) rootView.findViewById(R.id.grid_layout_rb);
+ mGridLayoutRadioButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ setRecyclerViewLayoutManager(LayoutManagerType.GRID_LAYOUT_MANAGER);
+ }
+ });
+
return rootView;
}
/**
+ * Set RecyclerView's LayoutManager to the one given.
+ *
+ * @param layoutManagerType Type of layout manager to switch to.
+ */
+ public void setRecyclerViewLayoutManager(LayoutManagerType layoutManagerType) {
+ int scrollPosition = 0;
+
+ // If a layout manager has already been set, get current scroll position.
+ if (mRecyclerView.getLayoutManager() != null) {
+ scrollPosition = ((LinearLayoutManager) mRecyclerView.getLayoutManager())
+ .findFirstCompletelyVisibleItemPosition();
+ }
+
+ switch (layoutManagerType) {
+ case GRID_LAYOUT_MANAGER:
+ mLayoutManager = new GridLayoutManager(getActivity(), SPAN_COUNT);
+ mCurrentLayoutManagerType = LayoutManagerType.GRID_LAYOUT_MANAGER;
+ break;
+ case LINEAR_LAYOUT_MANAGER:
+ mLayoutManager = new LinearLayoutManager(getActivity());
+ mCurrentLayoutManagerType = LayoutManagerType.LINEAR_LAYOUT_MANAGER;
+ break;
+ default:
+ mLayoutManager = new LinearLayoutManager(getActivity());
+ mCurrentLayoutManagerType = LayoutManagerType.LINEAR_LAYOUT_MANAGER;
+ }
+
+ mRecyclerView.setLayoutManager(mLayoutManager);
+ mRecyclerView.scrollToPosition(scrollPosition);
+ }
+
+ @Override
+ public void onSaveInstanceState(Bundle savedInstanceState) {
+ // Save currently selected layout manager.
+ savedInstanceState.putSerializable(LAYOUT_MANAGER_KEY, mCurrentLayoutManagerType);
+ super.onSaveInstanceState(savedInstanceState);
+ }
+
+ /**
* Generates Strings for RecyclerView's adapter. This data would usually come
* from a local content provider or remote server.
*/
private void initDataset() {
- mDataset = new String[60];
- for (int i=0; i < 60; i++) {
+ mDataset = new String[DATASET_COUNT];
+ for (int i = 0; i < DATASET_COUNT; i++) {
mDataset[i] = "This is element #" + i;
}
}
diff --git a/samples/browseable/RenderScriptIntrinsic/AndroidManifest.xml b/samples/browseable/RenderScriptIntrinsic/AndroidManifest.xml
index 566ef8ae7..e108aff20 100644
--- a/samples/browseable/RenderScriptIntrinsic/AndroidManifest.xml
+++ b/samples/browseable/RenderScriptIntrinsic/AndroidManifest.xml
@@ -20,9 +20,7 @@
android:versionCode="1"
android:versionName="1.0">
- <uses-sdk
- android:minSdkVersion="8"
- android:targetSdkVersion="19" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<application
android:allowBackup="true"
diff --git a/samples/browseable/RenderScriptIntrinsic/_index.jd b/samples/browseable/RenderScriptIntrinsic/_index.jd
index 2724c1a3a..f5d5e4e06 100644
--- a/samples/browseable/RenderScriptIntrinsic/_index.jd
+++ b/samples/browseable/RenderScriptIntrinsic/_index.jd
@@ -1,15 +1,11 @@
-
-
-
page.tags="RenderScriptIntrinsic"
sample.group=RenderScript
@jd:body
<p>
- This sample demonstrates how to use <a href=
- "http://android-developers.blogspot.com/2013/08/renderscript-intrinsics.html">
- RenderScript intrinsics</a>. The app creates several RenderScript intrinsics
- and shows a filtering result with various parameters. The sample also shows
- how to extend {@link android.widget.RadioButton} with {@link
- android.graphics.drawable.StateListDrawable}.
-</p>
+
+ RenderScriptIntrinsic sample that demonstrates how to use RenderScript intrinsics.
+ Creates several RenderScript intrinsics and shows a filtering result with various parameters.
+ Also shows how to extends RedioButton with StateListDrawable.
+
+ </p>
diff --git a/samples/browseable/RenderScriptIntrinsic/res/values-v21/base-colors.xml b/samples/browseable/RenderScriptIntrinsic/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/RenderScriptIntrinsic/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/RenderScriptIntrinsic/res/values-v21/base-template-styles.xml b/samples/browseable/RenderScriptIntrinsic/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/RenderScriptIntrinsic/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/RenderScriptIntrinsic/res/values/base-strings.xml b/samples/browseable/RenderScriptIntrinsic/res/values/base-strings.xml
index c8488beed..e32a25973 100644
--- a/samples/browseable/RenderScriptIntrinsic/res/values/base-strings.xml
+++ b/samples/browseable/RenderScriptIntrinsic/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">RenderScriptIntrinsic</string>
<string name="intro_message">
diff --git a/samples/browseable/RepeatingAlarm/AndroidManifest.xml b/samples/browseable/RepeatingAlarm/AndroidManifest.xml
index b7d02e570..0fbdc7a7e 100644
--- a/samples/browseable/RepeatingAlarm/AndroidManifest.xml
+++ b/samples/browseable/RepeatingAlarm/AndroidManifest.xml
@@ -19,7 +19,7 @@
android:versionCode="1"
android:versionName="1.0">
- <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="17" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<application android:allowBackup="true"
android:label="@string/app_name"
diff --git a/samples/browseable/RepeatingAlarm/_index.jd b/samples/browseable/RepeatingAlarm/_index.jd
index 69f7ee1c3..1735034c8 100644
--- a/samples/browseable/RepeatingAlarm/_index.jd
+++ b/samples/browseable/RepeatingAlarm/_index.jd
@@ -1,9 +1,10 @@
-
-
-
page.tags="RepeatingAlarm"
sample.group=Background
@jd:body
-
-
-<p>This sample demonstrates how to implement a repeating alarm using an {@link android.app.AlarmManager}.</p>
+
+<p>
+
+ Introductory text that explains what the sample is intended to demonstrate. Edit
+ in template-params.xml.
+
+ </p>
diff --git a/samples/browseable/RepeatingAlarm/res/values-v21/base-colors.xml b/samples/browseable/RepeatingAlarm/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/RepeatingAlarm/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/RepeatingAlarm/res/values-v21/base-template-styles.xml b/samples/browseable/RepeatingAlarm/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/RepeatingAlarm/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/RepeatingAlarm/res/values/base-strings.xml b/samples/browseable/RepeatingAlarm/res/values/base-strings.xml
index 6b89192f6..e6170d2bc 100644
--- a/samples/browseable/RepeatingAlarm/res/values/base-strings.xml
+++ b/samples/browseable/RepeatingAlarm/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">RepeatingAlarm</string>
<string name="intro_message">
diff --git a/samples/browseable/RepeatingAlarm/res/values/strings.xml b/samples/browseable/RepeatingAlarm/res/values/strings.xml
index 2013d95c1..59a8ff229 100644
--- a/samples/browseable/RepeatingAlarm/res/values/strings.xml
+++ b/samples/browseable/RepeatingAlarm/res/values/strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="sample_action">Set Alarm</string>
</resources>
diff --git a/samples/browseable/RepeatingAlarm/src/com.example.android.repeatingalarm/MainActivity.java b/samples/browseable/RepeatingAlarm/src/com.example.android.repeatingalarm/MainActivity.java
index 147f5761a..b7527d526 100644
--- a/samples/browseable/RepeatingAlarm/src/com.example.android.repeatingalarm/MainActivity.java
+++ b/samples/browseable/RepeatingAlarm/src/com.example.android.repeatingalarm/MainActivity.java
@@ -14,9 +14,6 @@
* limitations under the License.
*/
-
-
-
package com.example.android.repeatingalarm;
import android.graphics.Color;
diff --git a/samples/browseable/RevealEffectBasic/res/values-v21/base-colors.xml b/samples/browseable/RevealEffectBasic/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/RevealEffectBasic/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/RevealEffectBasic/res/values-v21/base-template-styles.xml b/samples/browseable/RevealEffectBasic/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/RevealEffectBasic/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/RevealEffectBasic/res/values-v21/template-styles.xml b/samples/browseable/RevealEffectBasic/res/values-v21/template-styles.xml
deleted file mode 100644
index 134fcd9d3..000000000
--- a/samples/browseable/RevealEffectBasic/res/values-v21/template-styles.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<!--
- Copyright 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<resources>
-
- <!-- Activity themes -->
- <style name="Theme.Base" parent="android:Theme.Material.Light" />
-
-</resources>
diff --git a/samples/browseable/SkeletonWearableApp/Application/AndroidManifest.xml b/samples/browseable/SkeletonWearableApp/Application/AndroidManifest.xml
new file mode 100644
index 000000000..23497ca05
--- /dev/null
+++ b/samples/browseable/SkeletonWearableApp/Application/AndroidManifest.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.google.wearable.app">
+
+ <uses-sdk android:minSdkVersion="18"
+ android:targetSdkVersion="21" />
+
+ <application android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name">
+ </application>
+
+</manifest>
+
diff --git a/samples/browseable/SkeletonWearableApp/Application/res/drawable-hdpi/ic_launcher.png b/samples/browseable/SkeletonWearableApp/Application/res/drawable-hdpi/ic_launcher.png
new file mode 100755
index 000000000..589f229d1
--- /dev/null
+++ b/samples/browseable/SkeletonWearableApp/Application/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/SkeletonWearableApp/Application/res/drawable-hdpi/tile.9.png b/samples/browseable/SkeletonWearableApp/Application/res/drawable-hdpi/tile.9.png
new file mode 100644
index 000000000..135862883
--- /dev/null
+++ b/samples/browseable/SkeletonWearableApp/Application/res/drawable-hdpi/tile.9.png
Binary files differ
diff --git a/samples/browseable/SkeletonWearableApp/Application/res/drawable-mdpi/ic_launcher.png b/samples/browseable/SkeletonWearableApp/Application/res/drawable-mdpi/ic_launcher.png
new file mode 100755
index 000000000..77dd57139
--- /dev/null
+++ b/samples/browseable/SkeletonWearableApp/Application/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/SkeletonWearableApp/Application/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/SkeletonWearableApp/Application/res/drawable-xhdpi/ic_launcher.png
new file mode 100755
index 000000000..fe34ebe13
--- /dev/null
+++ b/samples/browseable/SkeletonWearableApp/Application/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/SkeletonWearableApp/Application/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/SkeletonWearableApp/Application/res/drawable-xxhdpi/ic_launcher.png
new file mode 100755
index 000000000..ab80bcd13
--- /dev/null
+++ b/samples/browseable/SkeletonWearableApp/Application/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/SkeletonWearableApp/Application/res/layout/activity_main.xml b/samples/browseable/SkeletonWearableApp/Application/res/layout/activity_main.xml
new file mode 100755
index 000000000..be1aa49d9
--- /dev/null
+++ b/samples/browseable/SkeletonWearableApp/Application/res/layout/activity_main.xml
@@ -0,0 +1,36 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <LinearLayout style="@style/Widget.SampleMessageTile"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView style="@style/Widget.SampleMessage"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="@dimen/horizontal_page_margin"
+ android:layout_marginRight="@dimen/horizontal_page_margin"
+ android:layout_marginTop="@dimen/vertical_page_margin"
+ android:layout_marginBottom="@dimen/vertical_page_margin"
+ android:text="@string/intro_message" />
+ </LinearLayout>
+</LinearLayout>
diff --git a/samples/browseable/SkeletonWearableApp/Application/res/values-sw600dp/template-dimens.xml b/samples/browseable/SkeletonWearableApp/Application/res/values-sw600dp/template-dimens.xml
new file mode 100644
index 000000000..22074a2bd
--- /dev/null
+++ b/samples/browseable/SkeletonWearableApp/Application/res/values-sw600dp/template-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>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_huge</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/SkeletonWearableApp/Application/res/values-sw600dp/template-styles.xml b/samples/browseable/SkeletonWearableApp/Application/res/values-sw600dp/template-styles.xml
new file mode 100644
index 000000000..03d197418
--- /dev/null
+++ b/samples/browseable/SkeletonWearableApp/Application/res/values-sw600dp/template-styles.xml
@@ -0,0 +1,25 @@
+<!--
+ 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.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceLarge</item>
+ <item name="android:lineSpacingMultiplier">1.2</item>
+ <item name="android:shadowDy">-6.5</item>
+ </style>
+
+</resources>
diff --git a/samples/browseable/SkeletonWearableApp/Application/res/values-v11/template-styles.xml b/samples/browseable/SkeletonWearableApp/Application/res/values-v11/template-styles.xml
new file mode 100644
index 000000000..8c1ea66f2
--- /dev/null
+++ b/samples/browseable/SkeletonWearableApp/Application/res/values-v11/template-styles.xml
@@ -0,0 +1,22 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Holo.Light" />
+
+</resources>
diff --git a/samples/browseable/SkeletonWearableApp/Application/res/values-v21/base-colors.xml b/samples/browseable/SkeletonWearableApp/Application/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/SkeletonWearableApp/Application/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/SkeletonWearableApp/Application/res/values-v21/base-template-styles.xml b/samples/browseable/SkeletonWearableApp/Application/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/SkeletonWearableApp/Application/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/SkeletonWearableApp/Application/res/values/base-strings.xml b/samples/browseable/SkeletonWearableApp/Application/res/values/base-strings.xml
new file mode 100644
index 000000000..6bdffc614
--- /dev/null
+++ b/samples/browseable/SkeletonWearableApp/Application/res/values/base-strings.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<resources>
+ <string name="app_name">SkeletonWearableApp</string>
+ <string name="intro_message">
+ <![CDATA[
+
+
+ This sample is a mostly empty wearable app that implements a fullscreen activity
+ conforming to Android Wear best practices. Included in the sample are examples of GridViewPager,
+ DelayedConfirmationView, and DismissOverlayView. Developers who require a fullscreen activity for
+ their wearable app can use this sample as a starting point.
+
+
+ ]]>
+ </string>
+</resources>
diff --git a/samples/browseable/SkeletonWearableApp/Application/res/values/template-dimens.xml b/samples/browseable/SkeletonWearableApp/Application/res/values/template-dimens.xml
new file mode 100644
index 000000000..39e710b5c
--- /dev/null
+++ b/samples/browseable/SkeletonWearableApp/Application/res/values/template-dimens.xml
@@ -0,0 +1,32 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Define standard dimensions to comply with Holo-style grids and rhythm. -->
+
+ <dimen name="margin_tiny">4dp</dimen>
+ <dimen name="margin_small">8dp</dimen>
+ <dimen name="margin_medium">16dp</dimen>
+ <dimen name="margin_large">32dp</dimen>
+ <dimen name="margin_huge">64dp</dimen>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_medium</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/SkeletonWearableApp/Application/res/values/template-styles.xml b/samples/browseable/SkeletonWearableApp/Application/res/values/template-styles.xml
new file mode 100644
index 000000000..6e7d593dd
--- /dev/null
+++ b/samples/browseable/SkeletonWearableApp/Application/res/values/template-styles.xml
@@ -0,0 +1,42 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+
+ <style name="Theme.Base" parent="android:Theme.Light" />
+
+ <style name="Theme.Sample" parent="Theme.Base" />
+
+ <style name="AppTheme" parent="Theme.Sample" />
+ <!-- Widget styling -->
+
+ <style name="Widget" />
+
+ <style name="Widget.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceMedium</item>
+ <item name="android:lineSpacingMultiplier">1.1</item>
+ </style>
+
+ <style name="Widget.SampleMessageTile">
+ <item name="android:background">@drawable/tile</item>
+ <item name="android:shadowColor">#7F000000</item>
+ <item name="android:shadowDy">-3.5</item>
+ <item name="android:shadowRadius">2</item>
+ </style>
+
+</resources>
diff --git a/samples/browseable/SkeletonWearableApp/Wearable/AndroidManifest.xml b/samples/browseable/SkeletonWearableApp/Wearable/AndroidManifest.xml
new file mode 100644
index 000000000..f99d785cc
--- /dev/null
+++ b/samples/browseable/SkeletonWearableApp/Wearable/AndroidManifest.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.google.wearable.app" >
+
+ <uses-sdk android:minSdkVersion="20"
+ android:targetSdkVersion="21" />
+
+ <uses-feature android:name="android.hardware.type.watch" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@android:style/Theme.DeviceDefault">
+ <activity
+ android:name=".MainActivity"
+ android:label="@string/app_name">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="android.intent.category.LAUNCHER"/>
+ </intent-filter>
+ <intent-filter>
+ <action android:name="com.google.android.clockwork.example.SKELETON"/>
+ <category android:name="android.intent.category.DEFAULT"/>
+ </intent-filter>
+ </activity>
+ <activity
+ android:name=".GridExampleActivity">
+ <intent-filter>
+ <action android:name="com.example.android.google.wearable.app.GRID_ACTIVITY"/>
+ <category android:name="android.intent.category.DEFAULT"/>
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest>
diff --git a/samples/browseable/SkeletonWearableApp/Wearable/res/drawable-hdpi/ic_launcher.png b/samples/browseable/SkeletonWearableApp/Wearable/res/drawable-hdpi/ic_launcher.png
new file mode 100755
index 000000000..589f229d1
--- /dev/null
+++ b/samples/browseable/SkeletonWearableApp/Wearable/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/SkeletonWearableApp/Wearable/res/drawable-mdpi/ic_launcher.png b/samples/browseable/SkeletonWearableApp/Wearable/res/drawable-mdpi/ic_launcher.png
new file mode 100755
index 000000000..77dd57139
--- /dev/null
+++ b/samples/browseable/SkeletonWearableApp/Wearable/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/SkeletonWearableApp/Wearable/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/SkeletonWearableApp/Wearable/res/drawable-xhdpi/ic_launcher.png
new file mode 100755
index 000000000..fe34ebe13
--- /dev/null
+++ b/samples/browseable/SkeletonWearableApp/Wearable/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/SkeletonWearableApp/Wearable/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/SkeletonWearableApp/Wearable/res/drawable-xxhdpi/ic_launcher.png
new file mode 100755
index 000000000..ab80bcd13
--- /dev/null
+++ b/samples/browseable/SkeletonWearableApp/Wearable/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/layout/grid_activity.xml b/samples/browseable/SkeletonWearableApp/Wearable/res/layout/grid_activity.xml
index c86705131..c86705131 100644
--- a/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/layout/grid_activity.xml
+++ b/samples/browseable/SkeletonWearableApp/Wearable/res/layout/grid_activity.xml
diff --git a/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/layout/main_activity.xml b/samples/browseable/SkeletonWearableApp/Wearable/res/layout/main_activity.xml
index c949e5faf..c949e5faf 100644
--- a/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/layout/main_activity.xml
+++ b/samples/browseable/SkeletonWearableApp/Wearable/res/layout/main_activity.xml
diff --git a/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/values/dimens.xml b/samples/browseable/SkeletonWearableApp/Wearable/res/values/dimens.xml
index 67c967796..67c967796 100644
--- a/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/values/dimens.xml
+++ b/samples/browseable/SkeletonWearableApp/Wearable/res/values/dimens.xml
diff --git a/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/values/strings.xml b/samples/browseable/SkeletonWearableApp/Wearable/res/values/strings.xml
index 3917d07da..3917d07da 100644
--- a/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/values/strings.xml
+++ b/samples/browseable/SkeletonWearableApp/Wearable/res/values/strings.xml
diff --git a/samples/browseable/SkeletonWearableApp/Wearable/src/com.example.android.google.wearable.app/GridExampleActivity.java b/samples/browseable/SkeletonWearableApp/Wearable/src/com.example.android.google.wearable.app/GridExampleActivity.java
new file mode 100644
index 000000000..80af2a69d
--- /dev/null
+++ b/samples/browseable/SkeletonWearableApp/Wearable/src/com.example.android.google.wearable.app/GridExampleActivity.java
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2014 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.google.wearable.app;
+
+import android.app.Activity;
+import android.app.Fragment;
+import android.app.FragmentManager;
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.graphics.Point;
+import android.graphics.Typeface;
+import android.graphics.Paint.Align;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.support.wearable.view.CardFragment;
+import android.support.wearable.view.FragmentGridPagerAdapter;
+import android.support.wearable.view.GridViewPager;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class GridExampleActivity extends Activity {
+ private static final int NUM_ROWS = 10;
+ private static final int NUM_COLS = 3;
+
+ MainAdapter mAdapter;
+ GridViewPager mPager;
+
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.grid_activity);
+ mPager = (GridViewPager) findViewById(R.id.fragment_container);
+ mAdapter = new MainAdapter(this, getFragmentManager());
+ mPager.setAdapter(mAdapter);
+
+ }
+
+ private static class MainAdapter extends FragmentGridPagerAdapter{
+ Map<Point, Drawable> mBackgrounds = new HashMap<Point, Drawable>();
+ private Context mContext;
+
+ public MainAdapter(Context ctx, FragmentManager fm) {
+ super(fm);
+ mContext = ctx;
+ }
+
+ @Override
+ public int getRowCount() {
+ return NUM_ROWS;
+ }
+
+ @Override
+ public int getColumnCount(int rowNum) {
+ return NUM_COLS;
+ }
+
+ @Override
+ public Fragment getFragment(int rowNum, int colNum) {
+ return MainFragment.newInstance(rowNum, colNum);
+ }
+
+ @Override
+ public Drawable getBackgroundForPage(int row, int column) {
+ Point pt = new Point(column, row);
+ Drawable drawable = mBackgrounds.get(pt);
+ if (drawable == null) {
+ Bitmap bm = Bitmap.createBitmap(200, 200, Bitmap.Config.ARGB_8888);
+ Canvas c = new Canvas(bm);
+ Paint p = new Paint();
+ // Clear previous image.
+ c.drawRect(0, 0, 200, 200, p);
+ p.setAntiAlias(true);
+ p.setTypeface(Typeface.DEFAULT);
+ p.setTextSize(64);
+ p.setColor(Color.LTGRAY);
+ p.setTextAlign(Align.CENTER);
+ c.drawText(column+ "-" + row, 100, 100, p);
+ drawable = new BitmapDrawable(mContext.getResources(), bm);
+ mBackgrounds.put(pt, drawable);
+ }
+ return drawable;
+ }
+ }
+
+ public static class MainFragment extends CardFragment {
+ private static MainFragment newInstance(int rowNum, int colNum) {
+ Bundle args = new Bundle();
+ args.putString(CardFragment.KEY_TITLE, "Row:" + rowNum);
+ args.putString(CardFragment.KEY_TEXT, "Col:" + colNum);
+ MainFragment f = new MainFragment();
+ f.setArguments(args);
+ return f;
+ }
+ }
+}
diff --git a/samples/wearable/SkeletonWearableApp/Wearable/src/main/java/com/example/android/google/wearable/app/MainActivity.java b/samples/browseable/SkeletonWearableApp/Wearable/src/com.example.android.google.wearable.app/MainActivity.java
index 817e195a8..817e195a8 100644
--- a/samples/wearable/SkeletonWearableApp/Wearable/src/main/java/com/example/android/google/wearable/app/MainActivity.java
+++ b/samples/browseable/SkeletonWearableApp/Wearable/src/com.example.android.google.wearable.app/MainActivity.java
diff --git a/samples/browseable/SkeletonWearableApp/_index.jd b/samples/browseable/SkeletonWearableApp/_index.jd
new file mode 100644
index 000000000..f3ab4256f
--- /dev/null
+++ b/samples/browseable/SkeletonWearableApp/_index.jd
@@ -0,0 +1,12 @@
+page.tags="SkeletonWearableApp"
+sample.group=Wearable
+@jd:body
+
+<p>
+
+ This sample is a mostly empty wearable app that implements a fullscreen activity
+ conforming to Android Wear best practices. Included in the sample are examples of GridViewPager,
+ DelayedConfirmationView, and DismissOverlayView. Developers who require a fullscreen activity for
+ their wearable app can use this sample as a starting point.
+
+ </p>
diff --git a/samples/browseable/SlidingTabsBasic/AndroidManifest.xml b/samples/browseable/SlidingTabsBasic/AndroidManifest.xml
index 31cbfb893..441c3de8e 100644
--- a/samples/browseable/SlidingTabsBasic/AndroidManifest.xml
+++ b/samples/browseable/SlidingTabsBasic/AndroidManifest.xml
@@ -22,7 +22,7 @@
android:versionCode="1"
android:versionName="1.0">
- <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="19" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<application android:allowBackup="true"
android:label="@string/app_name"
diff --git a/samples/browseable/SlidingTabsBasic/_index.jd b/samples/browseable/SlidingTabsBasic/_index.jd
index 261885c75..ec30b9f9f 100644
--- a/samples/browseable/SlidingTabsBasic/_index.jd
+++ b/samples/browseable/SlidingTabsBasic/_index.jd
@@ -1,14 +1,10 @@
-
-
-
page.tags="SlidingTabsBasic"
sample.group=UI
@jd:body
<p>
- This sample shows how to use <code><a href=
- "{@docRoot}samples/SlidingTabsBasic/src/com.example.android.common/view/SlidingTabLayout.html">
- SlidingTabLayout</a></code> to display a custom {@link
- android.support.v4.view.ViewPager ViewPager} title strip that gives
- continuous feedback to the user when scrolling.
-</p> \ No newline at end of file
+
+ A basic sample which shows how to use SlidingTabLayout to display a custom
+ ViewPager title strip which gives continuous feedback to the user when scrolling.
+
+ </p>
diff --git a/samples/browseable/SlidingTabsBasic/res/values-v21/base-colors.xml b/samples/browseable/SlidingTabsBasic/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/SlidingTabsBasic/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/SlidingTabsBasic/res/values-v21/base-template-styles.xml b/samples/browseable/SlidingTabsBasic/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/SlidingTabsBasic/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/SlidingTabsBasic/res/values/base-strings.xml b/samples/browseable/SlidingTabsBasic/res/values/base-strings.xml
index c7f26bf55..ea90429e6 100644
--- a/samples/browseable/SlidingTabsBasic/res/values/base-strings.xml
+++ b/samples/browseable/SlidingTabsBasic/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">SlidingTabsBasic</string>
<string name="intro_message">
diff --git a/samples/browseable/SlidingTabsBasic/res/values/strings.xml b/samples/browseable/SlidingTabsBasic/res/values/strings.xml
deleted file mode 100755
index 7b9d9ec4f..000000000
--- a/samples/browseable/SlidingTabsBasic/res/values/strings.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<!--
- Copyright 2013 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<resources>
- <string name="sample_show_log">Show Log</string>
- <string name="sample_hide_log">Hide Log</string>
-</resources>
diff --git a/samples/browseable/SlidingTabsBasic/src/com.example.android.slidingtabsbasic/MainActivity.java b/samples/browseable/SlidingTabsBasic/src/com.example.android.slidingtabsbasic/MainActivity.java
index ac405d19b..d7d2ff50f 100644
--- a/samples/browseable/SlidingTabsBasic/src/com.example.android.slidingtabsbasic/MainActivity.java
+++ b/samples/browseable/SlidingTabsBasic/src/com.example.android.slidingtabsbasic/MainActivity.java
@@ -14,9 +14,6 @@
* limitations under the License.
*/
-
-
-
package com.example.android.slidingtabsbasic;
import android.os.Bundle;
@@ -50,10 +47,12 @@ public class MainActivity extends SampleActivityBase {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
- FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
- SlidingTabsBasicFragment fragment = new SlidingTabsBasicFragment();
- transaction.replace(R.id.sample_content_fragment, fragment);
- transaction.commit();
+ if (savedInstanceState == null) {
+ FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
+ SlidingTabsBasicFragment fragment = new SlidingTabsBasicFragment();
+ transaction.replace(R.id.sample_content_fragment, fragment);
+ transaction.commit();
+ }
}
@Override
diff --git a/samples/browseable/SlidingTabsColors/AndroidManifest.xml b/samples/browseable/SlidingTabsColors/AndroidManifest.xml
index be4a43ad2..5ff4240d6 100644
--- a/samples/browseable/SlidingTabsColors/AndroidManifest.xml
+++ b/samples/browseable/SlidingTabsColors/AndroidManifest.xml
@@ -22,7 +22,7 @@
android:versionCode="1"
android:versionName="1.0">
- <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="19" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<application android:allowBackup="true"
android:label="@string/app_name"
diff --git a/samples/browseable/SlidingTabsColors/_index.jd b/samples/browseable/SlidingTabsColors/_index.jd
index 342ee1545..5fc023eb3 100644
--- a/samples/browseable/SlidingTabsColors/_index.jd
+++ b/samples/browseable/SlidingTabsColors/_index.jd
@@ -1,14 +1,10 @@
-
-
-
page.tags="SlidingTabsColors"
sample.group=UI
@jd:body
<p>
- This sample shows a more advanced example of how to use a <code><a href=
- "{@docRoot}samples/SlidingTabsColors/src/com.example.android.common/view/SlidingTabLayout.html">
- SlidingTabLayout</a></code> to display a custom {@link
- android.support.v4.view.ViewPager ViewPager} title strip, with custom
- coloring for each tab.
-</p> \ No newline at end of file
+
+ A more advanced sample which shows how to use SlidingTabLayout to display a custom
+ ViewPager title strip, with custom coloring for each tab.
+
+ </p>
diff --git a/samples/browseable/SlidingTabsColors/res/values-v21/base-colors.xml b/samples/browseable/SlidingTabsColors/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/SlidingTabsColors/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/SlidingTabsColors/res/values-v21/base-template-styles.xml b/samples/browseable/SlidingTabsColors/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/SlidingTabsColors/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/SlidingTabsColors/res/values/base-strings.xml b/samples/browseable/SlidingTabsColors/res/values/base-strings.xml
index 89cac2d6e..66070a411 100644
--- a/samples/browseable/SlidingTabsColors/res/values/base-strings.xml
+++ b/samples/browseable/SlidingTabsColors/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">SlidingTabsColors</string>
<string name="intro_message">
diff --git a/samples/browseable/SlidingTabsColors/res/values/strings.xml b/samples/browseable/SlidingTabsColors/res/values/strings.xml
index e1b0846b9..e1b0846b9 100755..100644
--- a/samples/browseable/SlidingTabsColors/res/values/strings.xml
+++ b/samples/browseable/SlidingTabsColors/res/values/strings.xml
diff --git a/samples/browseable/SlidingTabsColors/src/com.example.android.slidingtabscolors/MainActivity.java b/samples/browseable/SlidingTabsColors/src/com.example.android.slidingtabscolors/MainActivity.java
index d3d7567cd..dc1205ba1 100644
--- a/samples/browseable/SlidingTabsColors/src/com.example.android.slidingtabscolors/MainActivity.java
+++ b/samples/browseable/SlidingTabsColors/src/com.example.android.slidingtabscolors/MainActivity.java
@@ -14,9 +14,6 @@
* limitations under the License.
*/
-
-
-
package com.example.android.slidingtabscolors;
import android.os.Bundle;
@@ -50,10 +47,12 @@ public class MainActivity extends SampleActivityBase {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
- FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
- SlidingTabsColorsFragment fragment = new SlidingTabsColorsFragment();
- transaction.replace(R.id.sample_content_fragment, fragment);
- transaction.commit();
+ if (savedInstanceState == null) {
+ FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
+ SlidingTabsColorsFragment fragment = new SlidingTabsColorsFragment();
+ transaction.replace(R.id.sample_content_fragment, fragment);
+ transaction.commit();
+ }
}
@Override
diff --git a/samples/browseable/SpeedTracker/Application/AndroidManifest.xml b/samples/browseable/SpeedTracker/Application/AndroidManifest.xml
new file mode 100644
index 000000000..44284d4fd
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Application/AndroidManifest.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.wearable.speedtracker" >
+
+ <uses-permission android:name="android.permission.INTERNET"/>
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
+ <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
+ <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
+
+ <uses-feature android:name="android.hardware.location.gps" android:required="true" />
+ <uses-feature
+ android:glEsVersion="0x00020000" android:required="true"/>
+ <uses-sdk
+ android:minSdkVersion="18"
+ android:targetSdkVersion="21" />
+
+ <application
+ android:name=".PhoneApplication"
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@style/AppTheme" >
+ <meta-data
+ android:name="com.google.android.maps.v2.API_KEY"
+ android:value="@string/map_v2_api_key"/>
+ <meta-data android:name="com.google.android.gms.version"
+ android:value="@integer/google_play_services_version"/>
+ <activity
+ android:name=".PhoneMainActivity"
+ android:label="@string/app_name"
+ android:screenOrientation="portrait">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <service android:name=".db.UpdateService">
+ <intent-filter>
+ <action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
+ </intent-filter>
+ </service>
+ </application>
+
+</manifest>
diff --git a/samples/browseable/SpeedTracker/Application/res/drawable-hdpi/ic_launcher.png b/samples/browseable/SpeedTracker/Application/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 000000000..2476b11e6
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Application/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/SpeedTracker/Application/res/drawable-hdpi/tile.9.png b/samples/browseable/SpeedTracker/Application/res/drawable-hdpi/tile.9.png
new file mode 100644
index 000000000..135862883
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Application/res/drawable-hdpi/tile.9.png
Binary files differ
diff --git a/samples/browseable/SpeedTracker/Application/res/drawable-mdpi/ic_launcher.png b/samples/browseable/SpeedTracker/Application/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 000000000..a102b7949
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Application/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/SpeedTracker/Application/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/SpeedTracker/Application/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 000000000..8ad19e8fa
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Application/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/SpeedTracker/Application/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/SpeedTracker/Application/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 000000000..9c5429f6a
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Application/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/SpeedTracker/Application/res/drawable-xxxhdpi/ic_launcher.png b/samples/browseable/SpeedTracker/Application/res/drawable-xxxhdpi/ic_launcher.png
new file mode 100644
index 000000000..b2a49f891
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Application/res/drawable-xxxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/SpeedTracker/Application/res/layout/activity_main.xml b/samples/browseable/SpeedTracker/Application/res/layout/activity_main.xml
new file mode 100755
index 000000000..be1aa49d9
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Application/res/layout/activity_main.xml
@@ -0,0 +1,36 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <LinearLayout style="@style/Widget.SampleMessageTile"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView style="@style/Widget.SampleMessage"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="@dimen/horizontal_page_margin"
+ android:layout_marginRight="@dimen/horizontal_page_margin"
+ android:layout_marginTop="@dimen/vertical_page_margin"
+ android:layout_marginBottom="@dimen/vertical_page_margin"
+ android:text="@string/intro_message" />
+ </LinearLayout>
+</LinearLayout>
diff --git a/samples/browseable/SpeedTracker/Application/res/layout/main_activity.xml b/samples/browseable/SpeedTracker/Application/res/layout/main_activity.xml
new file mode 100644
index 000000000..a18c64484
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Application/res/layout/main_activity.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent">
+
+ <RelativeLayout
+ android:id="@+id/top_container"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content">
+ <Button
+ android:id="@+id/date_picker"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:onClick="onClick"
+ android:layout_centerHorizontal="true"
+ android:text="@string/show_my_track"
+ />
+ <TextView
+ android:id="@+id/selected_date"
+ android:layout_below="@+id/date_picker"
+ android:layout_centerHorizontal="true"
+ android:layout_marginBottom="5dp"
+ android:layout_marginTop="5dp"
+ android:textStyle="italic"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
+ </RelativeLayout>
+
+ <fragment
+ android:id="@+id/map"
+ android:layout_below="@+id/top_container"
+ android:layout_width="fill_parent"
+ android:layout_height="match_parent"
+ android:name="com.google.android.gms.maps.MapFragment"/>
+
+</RelativeLayout> \ No newline at end of file
diff --git a/samples/browseable/SpeedTracker/Application/res/values-sw600dp/template-dimens.xml b/samples/browseable/SpeedTracker/Application/res/values-sw600dp/template-dimens.xml
new file mode 100644
index 000000000..22074a2bd
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Application/res/values-sw600dp/template-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>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_huge</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/SpeedTracker/Application/res/values-sw600dp/template-styles.xml b/samples/browseable/SpeedTracker/Application/res/values-sw600dp/template-styles.xml
new file mode 100644
index 000000000..03d197418
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Application/res/values-sw600dp/template-styles.xml
@@ -0,0 +1,25 @@
+<!--
+ 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.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceLarge</item>
+ <item name="android:lineSpacingMultiplier">1.2</item>
+ <item name="android:shadowDy">-6.5</item>
+ </style>
+
+</resources>
diff --git a/samples/browseable/SpeedTracker/Application/res/values-v11/template-styles.xml b/samples/browseable/SpeedTracker/Application/res/values-v11/template-styles.xml
new file mode 100644
index 000000000..8c1ea66f2
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Application/res/values-v11/template-styles.xml
@@ -0,0 +1,22 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Holo.Light" />
+
+</resources>
diff --git a/samples/browseable/SpeedTracker/Application/res/values-v21/base-colors.xml b/samples/browseable/SpeedTracker/Application/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Application/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/SpeedTracker/Application/res/values-v21/base-template-styles.xml b/samples/browseable/SpeedTracker/Application/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Application/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/SpeedTracker/Application/res/values/base-strings.xml b/samples/browseable/SpeedTracker/Application/res/values/base-strings.xml
new file mode 100644
index 000000000..0d22a8789
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Application/res/values/base-strings.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>
+ <string name="app_name">Speed Tracker</string>
+ <string name="intro_message">
+ <![CDATA[
+
+
+This sample uses the FusedLocation APIs of Google Play Services
+on those devices that have a hardware GPS built in. In those
+cases, this sample provides a simple screen that shows the
+current speed of the device on the watch. User can set a speed
+limit and if the speed approaches that limit, it changes the
+color to yellow and if it exceeds the limit, it turns red. User
+can also enable recording of coordinates and when it pairs back
+with the phone, this data will be synced with the phone
+component of the app and user can see a track made of those
+coordinates on a map on the phone.
+
+
+ ]]>
+ </string>
+</resources>
diff --git a/samples/browseable/SpeedTracker/Application/res/values/strings.xml b/samples/browseable/SpeedTracker/Application/res/values/strings.xml
new file mode 100644
index 000000000..cdb6f7cd6
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Application/res/values/strings.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+
+ <string name="map_v2_api_key">YOUR_MAP_V2_API_KEY</string>
+ <string name="action_settings">Settings</string>
+
+ <string name="showing_for_date">Track for %1$s</string>
+ <string name="no_date">No data for the selected date</string>
+ <string name="show_my_track">Show My Track</string>
+
+</resources>
diff --git a/samples/browseable/SpeedTracker/Application/res/values/template-dimens.xml b/samples/browseable/SpeedTracker/Application/res/values/template-dimens.xml
new file mode 100644
index 000000000..39e710b5c
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Application/res/values/template-dimens.xml
@@ -0,0 +1,32 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Define standard dimensions to comply with Holo-style grids and rhythm. -->
+
+ <dimen name="margin_tiny">4dp</dimen>
+ <dimen name="margin_small">8dp</dimen>
+ <dimen name="margin_medium">16dp</dimen>
+ <dimen name="margin_large">32dp</dimen>
+ <dimen name="margin_huge">64dp</dimen>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_medium</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/SpeedTracker/Application/res/values/template-styles.xml b/samples/browseable/SpeedTracker/Application/res/values/template-styles.xml
new file mode 100644
index 000000000..6e7d593dd
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Application/res/values/template-styles.xml
@@ -0,0 +1,42 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+
+ <style name="Theme.Base" parent="android:Theme.Light" />
+
+ <style name="Theme.Sample" parent="Theme.Base" />
+
+ <style name="AppTheme" parent="Theme.Sample" />
+ <!-- Widget styling -->
+
+ <style name="Widget" />
+
+ <style name="Widget.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceMedium</item>
+ <item name="android:lineSpacingMultiplier">1.1</item>
+ </style>
+
+ <style name="Widget.SampleMessageTile">
+ <item name="android:background">@drawable/tile</item>
+ <item name="android:shadowColor">#7F000000</item>
+ <item name="android:shadowDy">-3.5</item>
+ <item name="android:shadowRadius">2</item>
+ </style>
+
+</resources>
diff --git a/samples/browseable/SpeedTracker/Application/src/com.example.android.wearable.speedtracker/LocationDataManager.java b/samples/browseable/SpeedTracker/Application/src/com.example.android.wearable.speedtracker/LocationDataManager.java
new file mode 100644
index 000000000..9a3bf23ea
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Application/src/com.example.android.wearable.speedtracker/LocationDataManager.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2014 Google Inc. All Rights Reserved.
+ *
+ * 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.wearable.speedtracker;
+
+import com.example.android.wearable.speedtracker.common.LocationEntry;
+import com.example.android.wearable.speedtracker.common.Utils;
+import com.example.android.wearable.speedtracker.db.LocationDbHelper;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * A class that wraps database access and provides a cache for various GPS data.
+ */
+public class LocationDataManager {
+
+ private final Map<String, List<LocationEntry>> mPointsMap =
+ new HashMap<String, List<LocationEntry>>();
+
+ private LocationDbHelper mDbHelper;
+
+ public LocationDataManager(LocationDbHelper dbHelper) {
+ mDbHelper = dbHelper;
+ }
+
+ /**
+ * Returns a list of {@link com.example.android.wearable.speedtracker.common.LocationEntry}
+ * objects for the day that the {@link java.util.Calendar} object points at. Internally it uses
+ * a cache to speed up subsequent calls. If there is no cached value, it gets the result from
+ * the database.
+ */
+ public final List<LocationEntry> getPoints(Calendar calendar) {
+ String day = Utils.getHashedDay(calendar);
+ synchronized (mPointsMap) {
+ if (mPointsMap.get(day) == null) {
+ // there is no cache for this day, so lets get it from DB
+ List<LocationEntry> points = mDbHelper.read(calendar);
+ mPointsMap.put(day, points);
+ }
+ }
+ return mPointsMap.get(day);
+ }
+
+ /**
+ * Clears the data for the day that the {@link java.util.Calendar} object falls on. This method
+ * removes the entries from the database and updates the cache accordingly.
+ */
+ public final int clearPoints(Calendar calendar) {
+ synchronized (mPointsMap) {
+ String day = Utils.getHashedDay(calendar);
+ mPointsMap.remove(day);
+ return mDbHelper.delete(day);
+ }
+ }
+
+ /**
+ * Adds a {@link com.example.android.wearable.speedtracker.common.LocationEntry} point to the
+ * database and cache if it is a new point.
+ */
+ public final void addPoint(LocationEntry entry) {
+ synchronized (mPointsMap) {
+ List<LocationEntry> points = getPoints(entry.calendar);
+ if (points == null || points.isEmpty()) {
+ mDbHelper.insert(entry);
+ if (points == null) {
+ points = new ArrayList<LocationEntry>();
+ }
+ points.add(entry);
+ mPointsMap.put(entry.day, points);
+ } else {
+ if (!points.contains(entry)) {
+ mDbHelper.insert(entry);
+ points.add(entry);
+ }
+ }
+ }
+ }
+}
diff --git a/samples/browseable/SpeedTracker/Application/src/com.example.android.wearable.speedtracker/PhoneApplication.java b/samples/browseable/SpeedTracker/Application/src/com.example.android.wearable.speedtracker/PhoneApplication.java
new file mode 100644
index 000000000..d74d81f86
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Application/src/com.example.android.wearable.speedtracker/PhoneApplication.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2014 Google Inc. All Rights Reserved.
+ *
+ * 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.wearable.speedtracker;
+
+import android.app.Application;
+
+import com.example.android.wearable.speedtracker.db.LocationDbHelper;
+
+/**
+ * The {@link android.app.Application} class for the handset app.
+ */
+public class PhoneApplication extends Application {
+
+ private LocationDataManager mDataManager;
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ LocationDbHelper dbHelper = new LocationDbHelper(getApplicationContext());
+ mDataManager = new LocationDataManager(dbHelper);
+ }
+
+ /**
+ * Returns an instance of {@link com.example.android.wearable.speedtracker.LocationDataManager}.
+ */
+ public final LocationDataManager getDataManager() {
+ return mDataManager;
+ }
+}
diff --git a/samples/browseable/SpeedTracker/Application/src/com.example.android.wearable.speedtracker/PhoneMainActivity.java b/samples/browseable/SpeedTracker/Application/src/com.example.android.wearable.speedtracker/PhoneMainActivity.java
new file mode 100644
index 000000000..76f609b15
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Application/src/com.example.android.wearable.speedtracker/PhoneMainActivity.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2014 Google Inc. All Rights Reserved.
+ *
+ * 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.wearable.speedtracker;
+
+import com.google.android.gms.maps.CameraUpdateFactory;
+import com.google.android.gms.maps.GoogleMap;
+import com.google.android.gms.maps.MapFragment;
+import com.google.android.gms.maps.model.LatLng;
+import com.google.android.gms.maps.model.LatLngBounds;
+import com.google.android.gms.maps.model.PolylineOptions;
+
+import android.app.Activity;
+import android.app.DatePickerDialog;
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.text.format.DateUtils;
+import android.util.Log;
+import android.view.View;
+import android.widget.DatePicker;
+import android.widget.TextView;
+
+import com.example.android.wearable.speedtracker.common.LocationEntry;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+
+/**
+ * The main activity for the handset application. When a watch device reconnects to the handset
+ * app, the collected GPS data on the watch, if any, is synced up and user can see his/her track on
+ * a map. This data is then saved into an internal database and the corresponding data items are
+ * deleted.
+ */
+public class PhoneMainActivity extends Activity implements DatePickerDialog.OnDateSetListener {
+
+ private static final String TAG = "PhoneMainActivity";
+ private static final int BOUNDING_BOX_PADDING_PX = 50;
+ private TextView mSelectedDateText;
+ private GoogleMap mMap;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.main_activity);
+ mSelectedDateText = (TextView) findViewById(R.id.selected_date);
+ mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
+ }
+
+ public void onClick(View view) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTimeInMillis(System.currentTimeMillis());
+ new DatePickerDialog(PhoneMainActivity.this, PhoneMainActivity.this,
+ calendar.get(Calendar.YEAR),
+ calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH)).show();
+ }
+
+ @Override
+ public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
+ // the following if-clause is to get around a bug that causes this callback to be called
+ // twice
+ if (view.isShown()) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTimeInMillis(System.currentTimeMillis());
+ calendar.set(Calendar.YEAR, year);
+ calendar.set(Calendar.MONTH, monthOfYear);
+ calendar.set(Calendar.DAY_OF_MONTH, dayOfMonth);
+ String date = DateUtils.formatDateTime(this, calendar.getTimeInMillis(),
+ DateUtils.FORMAT_SHOW_DATE);
+ mSelectedDateText.setText(getString(R.string.showing_for_date, date));
+ showTrack(calendar);
+ }
+ }
+
+ /**
+ * An {@link android.os.AsyncTask} that is responsible for getting a list of {@link
+ * com.example.android.wearable.speedtracker.common.LocationEntry} objects for a given day and
+ * building a track from those points. In addition, it sets the smallest bounding box for the
+ * map that covers all the points on the track.
+ */
+ private void showTrack(Calendar calendar) {
+ new AsyncTask<Calendar, Void, Void>() {
+
+ private List<LatLng> coordinates;
+ private LatLngBounds bounds;
+
+ @Override
+ protected Void doInBackground(Calendar... params) {
+ LocationDataManager dataManager = ((PhoneApplication) getApplicationContext())
+ .getDataManager();
+ List<LocationEntry> entries = dataManager.getPoints(params[0]);
+ if (entries != null && !entries.isEmpty()) {
+ coordinates = new ArrayList<LatLng>();
+ LatLngBounds.Builder builder = new LatLngBounds.Builder();
+ for (LocationEntry entry : entries) {
+ LatLng latLng = new LatLng(entry.latitude, entry.longitude);
+ builder.include(latLng);
+ coordinates.add(latLng);
+ }
+ bounds = builder.build();
+ }
+ return null;
+ }
+
+ @Override
+ protected void onPostExecute(Void aVoid) {
+ mMap.clear();
+ if (coordinates == null || coordinates.isEmpty()) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "No Entries found for that date");
+ }
+ } else {
+ mMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds,
+ BOUNDING_BOX_PADDING_PX));
+ mMap.addPolyline(new PolylineOptions().geodesic(true).addAll(coordinates));
+ }
+ }
+
+ }.execute(calendar);
+ }
+}
diff --git a/samples/browseable/SpeedTracker/Application/src/com.example.android.wearable.speedtracker/db/LocationDbHelper.java b/samples/browseable/SpeedTracker/Application/src/com.example.android.wearable.speedtracker/db/LocationDbHelper.java
new file mode 100644
index 000000000..3397eaac6
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Application/src/com.example.android.wearable.speedtracker/db/LocationDbHelper.java
@@ -0,0 +1,165 @@
+/*
+ * Copyright (C) 2014 Google Inc. All Rights Reserved.
+ *
+ * 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.wearable.speedtracker.db;
+
+import android.content.ContentValues;
+import android.content.Context;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteDatabase;
+import android.database.sqlite.SQLiteOpenHelper;
+import android.provider.BaseColumns;
+import android.util.Log;
+
+import com.example.android.wearable.speedtracker.common.LocationEntry;
+import com.example.android.wearable.speedtracker.common.Utils;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+
+/**
+ * A helper class to set up the database that holds the GPS location information
+ */
+public class LocationDbHelper extends SQLiteOpenHelper {
+
+ private static final String TAG = "LocationDbHelper";
+
+ public static final String TABLE_NAME = "location";
+ public static final String COLUMN_NAME_DAY = "day";
+ public static final String COLUMN_NAME_LATITUDE = "lat";
+ public static final String COLUMN_NAME_LONGITUDE = "lon";
+ public static final String COLUMN_NAME_TIME = "time";
+
+ private static final String TEXT_TYPE = " TEXT";
+ private static final String INTEGER_TYPE = " INTEGER";
+ private static final String REAL_TYPE = " REAL";
+ private static final String COMMA_SEP = ",";
+ private static final String SQL_CREATE_ENTRIES =
+ "CREATE TABLE " + TABLE_NAME + " ("
+ + BaseColumns._ID + " INTEGER PRIMARY KEY,"
+ + COLUMN_NAME_DAY + TEXT_TYPE + COMMA_SEP
+ + COLUMN_NAME_LATITUDE + REAL_TYPE + COMMA_SEP
+ + COLUMN_NAME_LONGITUDE + REAL_TYPE + COMMA_SEP
+ + COLUMN_NAME_TIME + INTEGER_TYPE
+ + " )";
+ private static final String SQL_DELETE_ENTRIES = "DROP TABLE IF EXISTS " + TABLE_NAME;
+
+ public static final int DATABASE_VERSION = 1;
+ public static final String DATABASE_NAME = "Location.db";
+
+ public LocationDbHelper(Context context) {
+ super(context, DATABASE_NAME, null, DATABASE_VERSION);
+ }
+
+ @Override
+ public void onCreate(SQLiteDatabase db) {
+ db.execSQL(SQL_CREATE_ENTRIES);
+ }
+
+ @Override
+ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
+ db.execSQL(SQL_DELETE_ENTRIES);
+ onCreate(db);
+ }
+
+ /**
+ * Inserts a {@link com.example.android.wearable.speedtracker.common.LocationEntry} item to the
+ * database.
+ */
+ public final long insert(LocationEntry entry) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "Inserting a LocationEntry");
+ }
+ // Gets the data repository in write mode
+ SQLiteDatabase db = getWritableDatabase();
+
+ // Create a new map of values, where column names are the keys
+ ContentValues values = new ContentValues();
+ values.put(COLUMN_NAME_DAY, entry.day);
+ values.put(COLUMN_NAME_LONGITUDE, entry.longitude);
+ values.put(COLUMN_NAME_LATITUDE, entry.latitude);
+ values.put(COLUMN_NAME_TIME, entry.calendar.getTimeInMillis());
+
+ // Insert the new row, returning the primary key value of the new row
+ return db.insert(TABLE_NAME, "null", values);
+ }
+
+ /**
+ * Returns a list of {@link com.example.android.wearable.speedtracker.common.LocationEntry}
+ * objects from the database for a given day. The list can be empty (but not {@code null}) if
+ * there are no such items. This method looks at the day that the calendar argument points at.
+ */
+ public final List<LocationEntry> read(Calendar calendar) {
+ SQLiteDatabase db = getReadableDatabase();
+ String[] projection = {
+ COLUMN_NAME_LONGITUDE,
+ COLUMN_NAME_LATITUDE,
+ COLUMN_NAME_TIME
+ };
+ String day = Utils.getHashedDay(calendar);
+
+ // sort ASC based on the time of the entry
+ String sortOrder = COLUMN_NAME_TIME + " ASC";
+ String selection = COLUMN_NAME_DAY + " LIKE ?";
+
+ Cursor cursor = db.query(
+ TABLE_NAME, // The table to query
+ projection, // The columns to return
+ selection, // The columns for the WHERE clause
+ new String[]{day}, // The values for the WHERE clause
+ null, // don't group the rows
+ null, // don't filter by row groups
+ sortOrder // The sort order
+ );
+
+ List<LocationEntry> result = new ArrayList<LocationEntry>();
+ int count = cursor.getCount();
+ if (count > 0) {
+ cursor.moveToFirst();
+ while (!cursor.isAfterLast()) {
+ Calendar cal = Calendar.getInstance();
+ cal.setTimeInMillis(cursor.getLong(2));
+ LocationEntry entry = new LocationEntry(cal, cursor.getDouble(1),
+ cursor.getDouble(0));
+ result.add(entry);
+ cursor.moveToNext();
+ }
+ }
+ cursor.close();
+ return result;
+ }
+
+ /**
+ * Deletes all the entries in the database for the given day. The argument {@code day} should
+ * match the format provided by {@link getHashedDay()}
+ */
+ public final int delete(String day) {
+ SQLiteDatabase db = getWritableDatabase();
+ // Define 'where' part of the query.
+ String selection = COLUMN_NAME_DAY + " LIKE ?";
+ String[] selectionArgs = {day};
+ return db.delete(TABLE_NAME, selection, selectionArgs);
+ }
+
+ /**
+ * Deletes all the entries in the database for the day that the {@link java.util.Calendar}
+ * argument points at.
+ */
+ public final int delete(Calendar calendar) {
+ return delete(Utils.getHashedDay(calendar));
+ }
+}
diff --git a/samples/browseable/SpeedTracker/Application/src/com.example.android.wearable.speedtracker/db/UpdateService.java b/samples/browseable/SpeedTracker/Application/src/com.example.android.wearable.speedtracker/db/UpdateService.java
new file mode 100644
index 000000000..8fe5951d4
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Application/src/com.example.android.wearable.speedtracker/db/UpdateService.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright (C) 2014 Google Inc. All Rights Reserved.
+ *
+ * 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.wearable.speedtracker.db;
+
+import com.google.android.gms.common.ConnectionResult;
+import com.google.android.gms.common.api.GoogleApiClient;
+import com.google.android.gms.common.api.ResultCallback;
+import com.google.android.gms.wearable.DataApi;
+import com.google.android.gms.wearable.DataEvent;
+import com.google.android.gms.wearable.DataEventBuffer;
+import com.google.android.gms.wearable.DataMap;
+import com.google.android.gms.wearable.DataMapItem;
+import com.google.android.gms.wearable.Wearable;
+import com.google.android.gms.wearable.WearableListenerService;
+
+import android.net.Uri;
+import android.os.Bundle;
+import android.util.Log;
+
+import com.example.android.wearable.speedtracker.LocationDataManager;
+import com.example.android.wearable.speedtracker.PhoneApplication;
+import com.example.android.wearable.speedtracker.common.Constants;
+import com.example.android.wearable.speedtracker.common.LocationEntry;
+
+import java.util.Calendar;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * A {@link com.google.android.gms.wearable.WearableListenerService} that is responsible for
+ * reading location data that gets added to the Data Layer storage.
+ */
+public class UpdateService extends WearableListenerService
+ implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener,
+ ResultCallback<DataApi.DeleteDataItemsResult> {
+
+ private static final String TAG = "UpdateService";
+ private LocationDataManager mDataManager;
+ private GoogleApiClient mGoogleApiClient;
+ private final Set<Uri> mToBeDeletedUris = new HashSet<Uri>();
+ public static final String ACTION_NOTIFY = "com.example.android.wearable.speedtracker.Message";
+ public static final String EXTRA_ENTRY = "entry";
+ public static final String EXTRA_LOG = "log";
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ mGoogleApiClient = new GoogleApiClient.Builder(this)
+ .addApi(Wearable.API)
+ .addConnectionCallbacks(this)
+ .addOnConnectionFailedListener(this)
+ .build();
+ mGoogleApiClient.connect();
+ mDataManager = ((PhoneApplication) getApplicationContext()).getDataManager();
+ }
+
+ @Override
+ public void onDataChanged(DataEventBuffer dataEvents) {
+ for (DataEvent dataEvent : dataEvents) {
+ if (dataEvent.getType() == DataEvent.TYPE_CHANGED) {
+ Uri dataItemUri = dataEvent.getDataItem().getUri();
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "Received a data item with uri: " + dataItemUri.getPath());
+ }
+ if (dataItemUri.getPath().startsWith(Constants.PATH)) {
+ DataMap dataMap = DataMapItem.fromDataItem(dataEvent.getDataItem())
+ .getDataMap();
+ double longitude = dataMap.getDouble(Constants.KEY_LONGITUDE);
+ double latitude = dataMap.getDouble(Constants.KEY_LATITUDE);
+ long time = dataMap.getLong(Constants.KEY_TIME);
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTimeInMillis(time);
+ mDataManager.addPoint(
+ new LocationEntry(calendar, latitude, longitude));
+ if (mGoogleApiClient.isConnected()) {
+ Wearable.DataApi.deleteDataItems(
+ mGoogleApiClient, dataItemUri).setResultCallback(this);
+ } else {
+ synchronized (mToBeDeletedUris) {
+ mToBeDeletedUris.add(dataItemUri);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @Override // ConnectionCallbacks
+ public void onConnected(Bundle bundle) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onConnected(): api client is connected now");
+ }
+ synchronized (mToBeDeletedUris) {
+ if (!mToBeDeletedUris.isEmpty()) {
+ for (Uri dataItemUri : mToBeDeletedUris) {
+ Wearable.DataApi.deleteDataItems(
+ mGoogleApiClient, dataItemUri).setResultCallback(this);
+ }
+ }
+ }
+ }
+
+ @Override // ConnectionCallbacks
+ public void onConnectionSuspended(int i) {
+ }
+
+ @Override // OnConnectionFailedListener
+ public void onConnectionFailed(ConnectionResult connectionResult) {
+ Log.e(TAG, "Failed to connect to the Google API client");
+ }
+
+ @Override // ResultCallback
+ public void onResult(DataApi.DeleteDataItemsResult deleteDataItemsResult) {
+ if (!deleteDataItemsResult.getStatus().isSuccess()) {
+ Log.e(TAG,
+ "Failed to delete a dataItem, status code: " + deleteDataItemsResult.getStatus()
+ .getStatusCode() + deleteDataItemsResult.getStatus()
+ .getStatusMessage());
+ }
+ }
+}
diff --git a/samples/browseable/SpeedTracker/Shared/AndroidManifest.xml b/samples/browseable/SpeedTracker/Shared/AndroidManifest.xml
new file mode 100644
index 000000000..50d0339d6
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Shared/AndroidManifest.xml
@@ -0,0 +1,6 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.wearable.speedtracker.common">
+
+ <application android:allowBackup="true"/>
+
+</manifest>
diff --git a/samples/browseable/SpeedTracker/Shared/src/com.example.android.wearable.speedtracker.common/Constants.java b/samples/browseable/SpeedTracker/Shared/src/com.example.android.wearable.speedtracker.common/Constants.java
new file mode 100644
index 000000000..ac761eb1d
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Shared/src/com.example.android.wearable.speedtracker.common/Constants.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2014 Google Inc. All Rights Reserved.
+ *
+ * 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.wearable.speedtracker.common;
+
+/**
+ * A collection of constants that is shared between teh wearable and handset apps.
+ */
+public class Constants {
+
+ public static final String PATH = "/location";
+ public static final String KEY_LONGITUDE = "lng";
+ public static final String KEY_LATITUDE = "lat";
+ public static final String KEY_TIME = "time";
+
+ private Constants() {}
+}
diff --git a/samples/browseable/SpeedTracker/Shared/src/com.example.android.wearable.speedtracker.common/LocationEntry.java b/samples/browseable/SpeedTracker/Shared/src/com.example.android.wearable.speedtracker.common/LocationEntry.java
new file mode 100644
index 000000000..2a8676ab7
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Shared/src/com.example.android.wearable.speedtracker.common/LocationEntry.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2014 Google Inc. All Rights Reserved.
+ *
+ * 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.wearable.speedtracker.common;
+
+import java.util.Calendar;
+
+/**
+ * A class that models a GPS location point with additional information about the time that the data
+ * was obtained.
+ */
+public class LocationEntry {
+
+ public double latitude;
+ public double longitude;
+ public Calendar calendar;
+ public String day;
+
+ public LocationEntry(Calendar calendar, double latitude, double longitude) {
+ this.calendar = calendar;
+ this.latitude = latitude;
+ this.longitude = longitude;
+ this.day = Utils.getHashedDay(calendar);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ LocationEntry that = (LocationEntry) o;
+
+ if (calendar.getTimeInMillis() != that.calendar.getTimeInMillis()) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return calendar.hashCode();
+ }
+} \ No newline at end of file
diff --git a/samples/browseable/SpeedTracker/Shared/src/com.example.android.wearable.speedtracker.common/Utils.java b/samples/browseable/SpeedTracker/Shared/src/com.example.android.wearable.speedtracker.common/Utils.java
new file mode 100644
index 000000000..a2f300ff6
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Shared/src/com.example.android.wearable.speedtracker.common/Utils.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 Google Inc. All Rights Reserved.
+ *
+ * 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.wearable.speedtracker.common;
+
+import java.util.Calendar;
+
+/**
+ * A utility class that is used in both the handset and wearable apps.
+ */
+public class Utils {
+
+ /**
+ * Builds a simple hash for a day by concatenating year and day of year together. Note that two
+ * {@link java.util.Calendar} inputs that fall on the same day will be hashed to the same
+ * string.
+ */
+ public static String getHashedDay(Calendar day) {
+ return day.get(Calendar.YEAR) + "-" + day.get(Calendar.DAY_OF_YEAR);
+ }
+
+ private Utils() {
+ }
+}
diff --git a/samples/browseable/SpeedTracker/Wearable/AndroidManifest.xml b/samples/browseable/SpeedTracker/Wearable/AndroidManifest.xml
new file mode 100644
index 000000000..ab19d5e6b
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Wearable/AndroidManifest.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.wearable.speedtracker">
+
+ <uses-feature android:name="android.hardware.type.watch"/>
+ <uses-feature android:name="android.hardware.location.gps" android:required="true" />
+ <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>\
+ <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
+
+ <uses-sdk
+ android:minSdkVersion="20"
+ android:targetSdkVersion="21" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@android:style/Theme.DeviceDefault">
+ <meta-data android:name="com.google.android.gms.version"
+ android:value="@integer/google_play_services_version"/>
+ <activity
+ android:name=".WearableMainActivity"
+ android:label="@string/app_name">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+
+ <category android:name="android.intent.category.LAUNCHER"/>
+ </intent-filter>
+ </activity>
+ <activity
+ android:name="com.example.android.wearable.speedtracker.SpeedPickerActivity">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ </intent-filter>
+ </activity>
+ <activity
+ android:name=".ui.LocationSettingActivity">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest>
diff --git a/samples/browseable/SpeedTracker/Wearable/res/drawable-hdpi/ic_launcher.png b/samples/browseable/SpeedTracker/Wearable/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 000000000..2476b11e6
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Wearable/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/SpeedTracker/Wearable/res/drawable-mdpi/ic_boot_cancel.png b/samples/browseable/SpeedTracker/Wearable/res/drawable-mdpi/ic_boot_cancel.png
new file mode 100644
index 000000000..9b4497911
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Wearable/res/drawable-mdpi/ic_boot_cancel.png
Binary files differ
diff --git a/samples/browseable/SpeedTracker/Wearable/res/drawable-mdpi/ic_launcher.png b/samples/browseable/SpeedTracker/Wearable/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 000000000..a102b7949
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Wearable/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/SpeedTracker/Wearable/res/drawable-nodpi/dot.png b/samples/browseable/SpeedTracker/Wearable/res/drawable-nodpi/dot.png
new file mode 100644
index 000000000..37cfba60b
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Wearable/res/drawable-nodpi/dot.png
Binary files differ
diff --git a/samples/browseable/SpeedTracker/Wearable/res/drawable-xhdpi/ic_cancel_80.png b/samples/browseable/SpeedTracker/Wearable/res/drawable-xhdpi/ic_cancel_80.png
new file mode 100644
index 000000000..46de04304
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Wearable/res/drawable-xhdpi/ic_cancel_80.png
Binary files differ
diff --git a/samples/browseable/SpeedTracker/Wearable/res/drawable-xhdpi/ic_confirmation.png b/samples/browseable/SpeedTracker/Wearable/res/drawable-xhdpi/ic_confirmation.png
new file mode 100755
index 000000000..aba4b3e37
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Wearable/res/drawable-xhdpi/ic_confirmation.png
Binary files differ
diff --git a/samples/browseable/SpeedTracker/Wearable/res/drawable-xhdpi/ic_confirmation_80.png b/samples/browseable/SpeedTracker/Wearable/res/drawable-xhdpi/ic_confirmation_80.png
new file mode 100644
index 000000000..faeb9e49c
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Wearable/res/drawable-xhdpi/ic_confirmation_80.png
Binary files differ
diff --git a/samples/browseable/SpeedTracker/Wearable/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/SpeedTracker/Wearable/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 000000000..8ad19e8fa
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Wearable/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/SpeedTracker/Wearable/res/drawable-xxhdpi/ic_gps_not_saving_grey600_96dp.png b/samples/browseable/SpeedTracker/Wearable/res/drawable-xxhdpi/ic_gps_not_saving_grey600_96dp.png
new file mode 100644
index 000000000..0eff434b2
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Wearable/res/drawable-xxhdpi/ic_gps_not_saving_grey600_96dp.png
Binary files differ
diff --git a/samples/browseable/SpeedTracker/Wearable/res/drawable-xxhdpi/ic_gps_saving_grey600_96dp.png b/samples/browseable/SpeedTracker/Wearable/res/drawable-xxhdpi/ic_gps_saving_grey600_96dp.png
new file mode 100644
index 000000000..7b3506b83
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Wearable/res/drawable-xxhdpi/ic_gps_saving_grey600_96dp.png
Binary files differ
diff --git a/samples/browseable/SpeedTracker/Wearable/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/SpeedTracker/Wearable/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 000000000..9c5429f6a
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Wearable/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/SpeedTracker/Wearable/res/drawable-xxhdpi/ic_settings_black_24dp.png b/samples/browseable/SpeedTracker/Wearable/res/drawable-xxhdpi/ic_settings_black_24dp.png
new file mode 100644
index 000000000..bce161d00
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Wearable/res/drawable-xxhdpi/ic_settings_black_24dp.png
Binary files differ
diff --git a/samples/browseable/SpeedTracker/Wearable/res/drawable-xxhdpi/ic_settings_googblue_24dp.png b/samples/browseable/SpeedTracker/Wearable/res/drawable-xxhdpi/ic_settings_googblue_24dp.png
new file mode 100644
index 000000000..c1b17250e
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Wearable/res/drawable-xxhdpi/ic_settings_googblue_24dp.png
Binary files differ
diff --git a/samples/browseable/SpeedTracker/Wearable/res/drawable-xxhdpi/ic_settings_grey600_24dp.png b/samples/browseable/SpeedTracker/Wearable/res/drawable-xxhdpi/ic_settings_grey600_24dp.png
new file mode 100644
index 000000000..5eba9e8ec
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Wearable/res/drawable-xxhdpi/ic_settings_grey600_24dp.png
Binary files differ
diff --git a/samples/browseable/SpeedTracker/Wearable/res/drawable-xxhdpi/ic_settings_white_24dp.png b/samples/browseable/SpeedTracker/Wearable/res/drawable-xxhdpi/ic_settings_white_24dp.png
new file mode 100644
index 000000000..97e9ca945
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Wearable/res/drawable-xxhdpi/ic_settings_white_24dp.png
Binary files differ
diff --git a/samples/browseable/SpeedTracker/Wearable/res/drawable-xxxhdpi/ic_launcher.png b/samples/browseable/SpeedTracker/Wearable/res/drawable-xxxhdpi/ic_launcher.png
new file mode 100644
index 000000000..b2a49f891
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Wearable/res/drawable-xxxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/SpeedTracker/Wearable/res/drawable/settings.xml b/samples/browseable/SpeedTracker/Wearable/res/drawable/settings.xml
new file mode 100644
index 000000000..7af58c6e3
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Wearable/res/drawable/settings.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:drawable="@drawable/ic_settings_googblue_24dp" android:state_pressed="true" />
+ <item android:drawable="@drawable/ic_settings_grey600_24dp" android:state_focused="true" />
+ <item android:drawable="@drawable/ic_settings_grey600_24dp" />
+</selector> \ No newline at end of file
diff --git a/samples/wearable/Timer/Wearable/src/main/res/drawable/wl_circle.xml b/samples/browseable/SpeedTracker/Wearable/res/drawable/wl_circle.xml
index a06c53a8d..a06c53a8d 100644
--- a/samples/wearable/Timer/Wearable/src/main/res/drawable/wl_circle.xml
+++ b/samples/browseable/SpeedTracker/Wearable/res/drawable/wl_circle.xml
diff --git a/samples/browseable/SpeedTracker/Wearable/res/layout/main_activity.xml b/samples/browseable/SpeedTracker/Wearable/res/layout/main_activity.xml
new file mode 100644
index 000000000..a1b9081a0
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Wearable/res/layout/main_activity.xml
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="#111">
+
+ <View
+ android:id="@+id/center"
+ android:layout_width="1px"
+ android:layout_height="1px"
+ android:layout_centerInParent="true"/>
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerInParent="true"
+ android:fontFamily="sans-serif-light"
+ android:textSize="17sp"
+ android:textStyle="italic"
+ android:id="@+id/acquiring_gps"
+ android:text="@string/acquiring_gps"/>
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:textSize="50sp"
+ android:fontFamily="sans-serif-light"
+ android:id="@+id/current_speed_text"
+ android:layout_centerVertical="true"
+ android:layout_toLeftOf="@+id/center"
+ android:textColor="@color/green"
+ android:layout_marginRight="-10dp"/>
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:textSize="18sp"
+ android:text="@string/mph"
+ android:layout_marginLeft="15dp"
+ android:layout_alignBaseline="@+id/current_speed_text"
+ android:id="@+id/current_speed_mph"
+ android:fontFamily="sans-serif-thin"
+ android:layout_toRightOf="@+id/current_speed_text"/>
+
+ <ImageView
+ android:id="@+id/dot"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_toRightOf="@+id/current_speed_mph"
+ android:layout_centerVertical="true"
+ android:layout_marginLeft="5dp"
+ android:visibility="invisible"
+ android:src="@drawable/dot"/>
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:id="@+id/max_speed_text"
+ android:layout_alignParentTop="true"
+ android:layout_centerHorizontal="true"
+ android:fontFamily="sans-serif-thin"
+ android:textSize="17sp"
+ android:layout_marginTop="33dp" />
+
+ <ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/ic_gps_not_saving_grey600_96dp"
+ android:id="@+id/saving"
+ android:layout_alignParentBottom="true"
+ android:layout_alignParentLeft="true"
+ android:layout_marginBottom="20dp"
+ android:layout_marginLeft="60dp" />
+
+ <ImageButton
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:id="@+id/settings"
+ android:background="@drawable/settings"
+ android:layout_alignParentRight="true"
+ android:layout_alignBottom="@+id/saving"
+ android:layout_marginRight="60dp"/>
+</RelativeLayout>
diff --git a/samples/browseable/SpeedTracker/Wearable/res/layout/saving_activity.xml b/samples/browseable/SpeedTracker/Wearable/res/layout/saving_activity.xml
new file mode 100644
index 000000000..c37d95930
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Wearable/res/layout/saving_activity.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:layout_width="match_parent" android:layout_height="match_parent">
+ <View
+ android:id="@+id/center"
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:layout_centerInParent="true"/>
+ <TextView
+ android:id="@+id/textView"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerHorizontal="true"
+ android:layout_above="@id/center"
+ android:layout_marginBottom="18dp"
+ android:fontFamily="sans-serif-light"
+ android:textSize="18sp"
+ android:text="@string/start_saving_gps"/>
+ <android.support.wearable.view.CircledImageView
+ android:id="@+id/cancelBtn"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:layout_below="@id/center"
+ android:layout_toLeftOf="@id/center"
+ android:layout_marginEnd="10dp"
+ android:src="@drawable/ic_cancel_80"
+ app:circle_color="@color/grey"
+ android:onClick="onClick"
+ app:circle_padding="@dimen/circle_padding"
+ app:circle_radius="@dimen/circle_radius"
+ app:circle_radius_pressed="@dimen/circle_radius_pressed" />
+ <android.support.wearable.view.CircledImageView
+ android:id="@+id/submitBtn"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:layout_below="@id/center"
+ android:layout_toRightOf="@id/center"
+ android:layout_marginStart="10dp"
+ android:src="@drawable/ic_confirmation_80"
+ app:circle_color="@color/blue"
+ android:onClick="onClick"
+ app:circle_padding="@dimen/circle_padding"
+ app:circle_radius="@dimen/circle_radius"
+ app:circle_radius_pressed="@dimen/circle_radius_pressed" />
+</RelativeLayout> \ No newline at end of file
diff --git a/samples/browseable/SpeedTracker/Wearable/res/layout/speed_picker_activity.xml b/samples/browseable/SpeedTracker/Wearable/res/layout/speed_picker_activity.xml
new file mode 100644
index 000000000..663988fac
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Wearable/res/layout/speed_picker_activity.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+
+<android.support.wearable.view.BoxInsetLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:background="@android:color/black"
+ android:layout_height="match_parent"
+ android:layout_width="match_parent"
+ >
+
+ <RelativeLayout
+ android:id="@+id/frame_layout"
+ android:layout_height="match_parent"
+ android:layout_width="match_parent"
+ app:layout_box="left|bottom|right">
+
+
+ <android.support.wearable.view.WearableListView
+ android:id="@+id/wearable_list"
+ android:layout_height="match_parent"
+ android:layout_width="match_parent">
+ </android.support.wearable.view.WearableListView>
+ <TextView
+ android:id="@+id/header"
+ android:layout_width="wrap_content"
+ android:layout_height="60dp"
+ android:gravity="bottom"
+ android:textSize="20sp"
+ android:fontFamily="sans-serif-light"
+ android:layout_centerHorizontal="true"
+ android:layout_alignParentTop="true"
+ android:text="@string/speed_limit_header"/>
+ </RelativeLayout>
+</android.support.wearable.view.BoxInsetLayout> \ No newline at end of file
diff --git a/samples/browseable/SpeedTracker/Wearable/res/layout/speed_picker_item_layout.xml b/samples/browseable/SpeedTracker/Wearable/res/layout/speed_picker_item_layout.xml
new file mode 100644
index 000000000..7b6890854
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Wearable/res/layout/speed_picker_item_layout.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+
+<com.example.android.wearable.speedtracker.ui.SpeedPickerLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:gravity="center_vertical"
+ android:layout_width="match_parent"
+ android:layout_height="80dp">
+ <ImageView
+ android:id="@+id/circle"
+ android:layout_height="20dp"
+ android:layout_margin="16dp"
+ android:layout_width="20dp"
+ android:src="@drawable/wl_circle"/>
+ <TextView
+ android:id="@+id/name"
+ android:gravity="center_vertical|left"
+ android:layout_width="wrap_content"
+ android:layout_marginRight="16dp"
+ android:layout_height="match_parent"
+ android:fontFamily="sans-serif-condensed-light"
+ android:lineSpacingExtra="-4sp"
+ android:textColor="@color/text_color"
+ android:textSize="20sp"/>
+</com.example.android.wearable.speedtracker.ui.SpeedPickerLayout> \ No newline at end of file
diff --git a/samples/browseable/SpeedTracker/Wearable/res/values/colors.xml b/samples/browseable/SpeedTracker/Wearable/res/values/colors.xml
new file mode 100644
index 000000000..a83306418
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Wearable/res/values/colors.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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>
+ <color name="wl_blue">#2878ff</color>
+ <color name="wl_gray">#c1c1c1</color>
+ <color name="text_color">#BBB</color>
+ <color name="yellow">#ced020</color>
+ <color name="speed_below">@color/green</color>
+ <color name="speed_close">@color/yellow</color>
+ <color name="speed_above">@color/red</color>
+
+ <color name="cancel">#c1c1c1</color>
+ <color name="cancel_pressed">#838383</color>
+ <color name="lightblue">#2878ff</color>
+</resources> \ No newline at end of file
diff --git a/samples/browseable/SpeedTracker/Wearable/res/values/dimens.xml b/samples/browseable/SpeedTracker/Wearable/res/values/dimens.xml
new file mode 100644
index 000000000..2f2eb2a13
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Wearable/res/values/dimens.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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>
+ <dimen name="pair_button_diameter">40dp</dimen>
+ <dimen name="circle_border_normal_width">10dp</dimen>
+ <dimen name="circle_padding">5dp</dimen>
+ <dimen name="circle_radius">35dp</dimen>
+ <dimen name="circle_radius_pressed">40dp</dimen>
+</resources> \ No newline at end of file
diff --git a/samples/browseable/SpeedTracker/Wearable/res/values/integers.xml b/samples/browseable/SpeedTracker/Wearable/res/values/integers.xml
new file mode 100644
index 000000000..b58f08383
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Wearable/res/values/integers.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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>
+ <integer name="action_text_faded_alpha">50</integer>
+</resources> \ No newline at end of file
diff --git a/samples/browseable/SpeedTracker/Wearable/res/values/strings.xml b/samples/browseable/SpeedTracker/Wearable/res/values/strings.xml
new file mode 100644
index 000000000..dda3ecd6b
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Wearable/res/values/strings.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+ <string name="app_name">Speed Tracker</string>
+ <string name="lat_label">Latitude:</string>
+ <string name="not_available">Not Available</string>
+ <string name="lon_label">Longitude:</string>
+ <string name="speed_label">Speed:</string>
+ <string name="activity_label">Activity:</string>
+ <string name="timestamp_label">Time:</string>
+ <string name="speed_limit">Limit: %1$d mph</string>
+ <string name="acquiring_gps">Acquiring GPS Fix ...</string>
+ <string name="speed_for_list">%1$d mph</string>
+ <string name="start_saving_gps">Start Recording GPS?</string>
+ <string name="stop_saving_gps">Stop Recording GPS?</string>
+ <string name="mph">mph</string>
+ <string name="speed_limit_header">Speed Limit</string>
+ <string name="gps_not_available">GPS not available.</string>
+ <string name="ok">OK</string>
+ <string name="speed_format">%.0f</string>
+</resources>
diff --git a/samples/browseable/SpeedTracker/Wearable/src/com.example.android.wearable.speedtracker/SpeedPickerActivity.java b/samples/browseable/SpeedTracker/Wearable/src/com.example.android.wearable.speedtracker/SpeedPickerActivity.java
new file mode 100644
index 000000000..d55d7dfb6
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Wearable/src/com.example.android.wearable.speedtracker/SpeedPickerActivity.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2014 Google Inc. All Rights Reserved.
+ *
+ * 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.wearable.speedtracker;
+
+import android.app.Activity;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.preference.PreferenceManager;
+import android.support.wearable.view.WearableListView;
+import android.widget.TextView;
+
+import com.example.android.wearable.speedtracker.ui.SpeedPickerListAdapter;
+
+/**
+ * An activity that presents a list of speeds to user and allows user to pick one, to be used as
+ * the current speed limit.
+ */
+public class SpeedPickerActivity extends Activity implements WearableListView.ClickListener {
+
+ /* Speeds, in mph, that will be shown on the list */
+ private int[] speeds = {25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75};
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.speed_picker_activity);
+
+ final TextView header = (TextView) findViewById(R.id.header);
+
+ // Get the list component from the layout of the activity
+ WearableListView listView = (WearableListView) findViewById(R.id.wearable_list);
+
+ // Assign an adapter to the list
+ listView.setAdapter(new SpeedPickerListAdapter(this, speeds));
+
+ // Set a click listener
+ listView.setClickListener(this);
+
+ listView.addOnScrollListener(new WearableListView.OnScrollListener() {
+ @Override
+ public void onScroll(int i) {
+ }
+
+ @Override
+ public void onAbsoluteScrollChange(int i) {
+ // only scroll the header up from the base position, not down...
+ if (i > 0) {
+ header.setY(-i);
+ }
+ }
+
+ @Override
+ public void onScrollStateChanged(int i) {
+ }
+
+ @Override
+ public void onCentralPositionChanged(int i) {
+ }
+ });
+ }
+
+ @Override
+ public void onClick(WearableListView.ViewHolder viewHolder) {
+ SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this);
+ pref.edit().putInt(WearableMainActivity.PREFS_SPEED_LIMIT_KEY,
+ speeds[viewHolder.getPosition()]).apply();
+ finish();
+ }
+
+ @Override
+ public void onTopEmptyRegionClick() {
+ }
+}
diff --git a/samples/browseable/SpeedTracker/Wearable/src/com.example.android.wearable.speedtracker/WearableMainActivity.java b/samples/browseable/SpeedTracker/Wearable/src/com.example.android.wearable.speedtracker/WearableMainActivity.java
new file mode 100644
index 000000000..f3015bf87
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Wearable/src/com.example.android.wearable.speedtracker/WearableMainActivity.java
@@ -0,0 +1,349 @@
+/*
+ * Copyright (C) 2014 Google Inc. All Rights Reserved.
+ *
+ * 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.wearable.speedtracker;
+
+import com.google.android.gms.common.ConnectionResult;
+import com.google.android.gms.common.api.GoogleApiClient;
+import com.google.android.gms.common.api.ResultCallback;
+import com.google.android.gms.common.api.Status;
+import com.google.android.gms.location.LocationListener;
+import com.google.android.gms.location.LocationRequest;
+import com.google.android.gms.location.LocationServices;
+import com.google.android.gms.wearable.DataApi;
+import com.google.android.gms.wearable.PutDataMapRequest;
+import com.google.android.gms.wearable.PutDataRequest;
+import com.google.android.gms.wearable.Wearable;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.content.pm.PackageManager;
+import android.location.Location;
+import android.os.Bundle;
+import android.os.Handler;
+import android.preference.PreferenceManager;
+import android.util.Log;
+import android.view.View;
+import android.view.WindowManager;
+import android.widget.ImageButton;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.example.android.wearable.speedtracker.common.Constants;
+import com.example.android.wearable.speedtracker.common.LocationEntry;
+import com.example.android.wearable.speedtracker.ui.LocationSettingActivity;
+
+import java.util.Calendar;
+
+/**
+ * The main activity for the wearable app. User can pick a speed limit, and after this activity
+ * obtains a fix on the GPS, it starts reporting the speed. In addition to showing the current
+ * speed, if user's speed gets close to the selected speed limit, the color of speed turns yellow
+ * and if the user exceeds the speed limit, it will turn red. In order to show the user that GPS
+ * location data is coming in, a small green dot keeps on blinking while GPS data is available.
+ */
+public class WearableMainActivity extends Activity implements GoogleApiClient.ConnectionCallbacks,
+ GoogleApiClient.OnConnectionFailedListener, LocationListener {
+
+ private static final String TAG = "WearableActivity";
+
+ private static final long UPDATE_INTERVAL_MS = 5 * 1000;
+ private static final long FASTEST_INTERVAL_MS = 5 * 1000;
+
+ public static final float MPH_IN_METERS_PER_SECOND = 2.23694f;
+
+ public static final String PREFS_SPEED_LIMIT_KEY = "speed_limit";
+ public static final int SPEED_LIMIT_DEFAULT_MPH = 45;
+ private static final long INDICATOR_DOT_FADE_AWAY_MS = 500L;
+
+ private GoogleApiClient mGoogleApiClient;
+ private TextView mSpeedLimitText;
+ private TextView mCurrentSpeedText;
+ private ImageView mSaveImageView;
+ private TextView mAcquiringGps;
+ private TextView mCurrentSpeedMphText;
+
+ private int mCurrentSpeedLimit;
+ private float mCurrentSpeed;
+ private View mDot;
+ private Handler mHandler = new Handler();
+ private Calendar mCalendar;
+ private boolean mSaveGpsLocation;
+
+ private enum SpeedState {
+ BELOW(R.color.speed_below), CLOSE(R.color.speed_close), ABOVE(R.color.speed_above);
+
+ private int mColor;
+
+ SpeedState(int color) {
+ mColor = color;
+ }
+
+ int getColor() {
+ return mColor;
+ }
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.main_activity);
+ if (!hasGps()) {
+ // If this hardware doesn't support GPS, we prefer to exit.
+ // Note that when such device is connected to a phone with GPS capabilities, the
+ // framework automatically routes the location requests to the phone. For this
+ // application, this would not be desirable so we exit the app but for some other
+ // applications, that might be a valid scenario.
+ Log.w(TAG, "This hardware doesn't have GPS, so we exit");
+ new AlertDialog.Builder(this)
+ .setMessage(getString(R.string.gps_not_available))
+ .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int id) {
+ finish();
+ dialog.cancel();
+ }
+ })
+ .setOnDismissListener(new DialogInterface.OnDismissListener() {
+ @Override
+ public void onDismiss(DialogInterface dialog) {
+ dialog.cancel();
+ finish();
+ }
+ })
+ .setCancelable(false)
+ .create()
+ .show();
+ }
+
+ setupViews();
+ updateSpeedVisibility(false);
+ setSpeedLimit();
+ mGoogleApiClient = new GoogleApiClient.Builder(this)
+ .addApi(LocationServices.API)
+ .addApi(Wearable.API)
+ .addConnectionCallbacks(this)
+ .addOnConnectionFailedListener(this)
+ .build();
+ mGoogleApiClient.connect();
+ }
+
+ private void setupViews() {
+ mSpeedLimitText = (TextView) findViewById(R.id.max_speed_text);
+ mCurrentSpeedText = (TextView) findViewById(R.id.current_speed_text);
+ mSaveImageView = (ImageView) findViewById(R.id.saving);
+ ImageButton settingButton = (ImageButton) findViewById(R.id.settings);
+ mAcquiringGps = (TextView) findViewById(R.id.acquiring_gps);
+ mCurrentSpeedMphText = (TextView) findViewById(R.id.current_speed_mph);
+ mDot = findViewById(R.id.dot);
+
+ settingButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Intent speedIntent = new Intent(WearableMainActivity.this,
+ SpeedPickerActivity.class);
+ startActivity(speedIntent);
+ }
+ });
+
+ mSaveImageView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Intent savingIntent = new Intent(WearableMainActivity.this,
+ LocationSettingActivity.class);
+ startActivity(savingIntent);
+ }
+ });
+ }
+
+ private void setSpeedLimit(int speedLimit) {
+ mSpeedLimitText.setText(getString(R.string.speed_limit, speedLimit));
+ }
+
+ private void setSpeedLimit() {
+ SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this);
+ mCurrentSpeedLimit = pref.getInt(PREFS_SPEED_LIMIT_KEY, SPEED_LIMIT_DEFAULT_MPH);
+ setSpeedLimit(mCurrentSpeedLimit);
+ }
+
+ private void setCurrentSpeed(float speed) {
+ mCurrentSpeed = speed;
+ mCurrentSpeedText.setText(String.format(getString(R.string.speed_format), speed));
+ adjustColor();
+ }
+
+ /**
+ * Adjusts the color of the speed based on its value relative to the speed limit.
+ */
+ private void adjustColor() {
+ SpeedState state = SpeedState.ABOVE;
+ if (mCurrentSpeed <= mCurrentSpeedLimit - 5) {
+ state = SpeedState.BELOW;
+ } else if (mCurrentSpeed <= mCurrentSpeedLimit) {
+ state = SpeedState.CLOSE;
+ }
+
+ mCurrentSpeedText.setTextColor(getResources().getColor(state.getColor()));
+ }
+
+ @Override
+ public void onConnected(Bundle bundle) {
+ LocationRequest locationRequest = LocationRequest.create()
+ .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY)
+ .setInterval(UPDATE_INTERVAL_MS)
+ .setFastestInterval(FASTEST_INTERVAL_MS);
+
+ LocationServices.FusedLocationApi
+ .requestLocationUpdates(mGoogleApiClient, locationRequest, this)
+ .setResultCallback(new ResultCallback<Status>() {
+
+ @Override
+ public void onResult(Status status) {
+ if (status.getStatus().isSuccess()) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "Successfully requested location updates");
+ }
+ } else {
+ Log.e(TAG,
+ "Failed in requesting location updates, "
+ + "status code: "
+ + status.getStatusCode() + ", message: " + status
+ .getStatusMessage());
+ }
+ }
+ });
+ }
+
+ @Override
+ public void onConnectionSuspended(int i) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onConnectionSuspended(): connection to location client suspended");
+ }
+ LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, this);
+ }
+
+ @Override
+ public void onConnectionFailed(ConnectionResult connectionResult) {
+ Log.e(TAG, "onConnectionFailed(): connection to location client failed");
+ }
+
+ @Override
+ public void onLocationChanged(Location location) {
+ updateSpeedVisibility(true);
+ setCurrentSpeed(location.getSpeed() * MPH_IN_METERS_PER_SECOND);
+ flashDot();
+ addLocationEntry(location.getLatitude(), location.getLongitude());
+ }
+
+ /**
+ * Causes the (green) dot blinks when new GPS location data is acquired.
+ */
+ private void flashDot() {
+ mHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ mDot.setVisibility(View.VISIBLE);
+ }
+ });
+ mDot.setVisibility(View.VISIBLE);
+ mHandler.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ mDot.setVisibility(View.INVISIBLE);
+ }
+ }, INDICATOR_DOT_FADE_AWAY_MS);
+ }
+
+ /**
+ * Adjusts the visibility of speed indicator based on the arrival of GPS data.
+ */
+ private void updateSpeedVisibility(boolean speedVisible) {
+ if (speedVisible) {
+ mAcquiringGps.setVisibility(View.GONE);
+ mCurrentSpeedText.setVisibility(View.VISIBLE);
+ mCurrentSpeedMphText.setVisibility(View.VISIBLE);
+ } else {
+ mAcquiringGps.setVisibility(View.VISIBLE);
+ mCurrentSpeedText.setVisibility(View.GONE);
+ mCurrentSpeedMphText.setVisibility(View.GONE);
+ }
+ }
+
+ /**
+ * Adds a data item to the data Layer storage
+ */
+ private void addLocationEntry(double latitude, double longitude) {
+ if (!mSaveGpsLocation || !mGoogleApiClient.isConnected()) {
+ return;
+ }
+ mCalendar.setTimeInMillis(System.currentTimeMillis());
+ LocationEntry entry = new LocationEntry(mCalendar, latitude, longitude);
+ String path = Constants.PATH + "/" + mCalendar.getTimeInMillis();
+ PutDataMapRequest putDataMapRequest = PutDataMapRequest.create(path);
+ putDataMapRequest.getDataMap().putDouble(Constants.KEY_LATITUDE, entry.latitude);
+ putDataMapRequest.getDataMap().putDouble(Constants.KEY_LONGITUDE, entry.longitude);
+ putDataMapRequest.getDataMap()
+ .putLong(Constants.KEY_TIME, entry.calendar.getTimeInMillis());
+ PutDataRequest request = putDataMapRequest.asPutDataRequest();
+ Wearable.DataApi.putDataItem(mGoogleApiClient, request)
+ .setResultCallback(new ResultCallback<DataApi.DataItemResult>() {
+ @Override
+ public void onResult(DataApi.DataItemResult dataItemResult) {
+ if (!dataItemResult.getStatus().isSuccess()) {
+ Log.e(TAG, "AddPoint:onClick(): Failed to set the data, "
+ + "status: " + dataItemResult.getStatus()
+ .getStatusCode());
+ }
+ }
+ });
+ }
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+ if (mGoogleApiClient.isConnected()) {
+ LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, this);
+ }
+ mGoogleApiClient.disconnect();
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
+ mCalendar = Calendar.getInstance();
+ setSpeedLimit();
+ adjustColor();
+ updateRecordingIcon();
+ }
+
+ private void updateRecordingIcon() {
+ mSaveGpsLocation = LocationSettingActivity.getGpsRecordingStatusFromPreferences(this);
+ mSaveImageView.setImageResource(mSaveGpsLocation ? R.drawable.ic_gps_saving_grey600_96dp
+ : R.drawable.ic_gps_not_saving_grey600_96dp);
+ }
+
+ /**
+ * Returns {@code true} if this device has the GPS capabilities.
+ */
+ private boolean hasGps() {
+ return getPackageManager().hasSystemFeature(PackageManager.FEATURE_LOCATION_GPS);
+ }
+}
diff --git a/samples/browseable/SpeedTracker/Wearable/src/com.example.android.wearable.speedtracker/ui/LocationSettingActivity.java b/samples/browseable/SpeedTracker/Wearable/src/com.example.android.wearable.speedtracker/ui/LocationSettingActivity.java
new file mode 100644
index 000000000..1f8be71c2
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Wearable/src/com.example.android.wearable.speedtracker/ui/LocationSettingActivity.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2014 Google Inc. All Rights Reserved.
+ *
+ * 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.wearable.speedtracker.ui;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.preference.PreferenceManager;
+import android.view.View;
+import android.widget.TextView;
+
+import com.example.android.wearable.speedtracker.R;
+
+/**
+ * A simple activity that allows the user to start or stop recording of GPS location data.
+ */
+public class LocationSettingActivity extends Activity {
+
+ private static final String PREFS_KEY_SAVE_GPS = "save-gps";
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.saving_activity);
+ TextView textView = (TextView) findViewById(R.id.textView);
+ textView.setText(getGpsRecordingStatusFromPreferences(this) ? R.string.stop_saving_gps
+ : R.string.start_saving_gps);
+
+ }
+
+ public void onClick(View view) {
+ switch (view.getId()) {
+ case R.id.submitBtn:
+ saveGpsRecordingStatusToPreferences(LocationSettingActivity.this,
+ !getGpsRecordingStatusFromPreferences(this));
+ break;
+ case R.id.cancelBtn:
+ break;
+ }
+ finish();
+ }
+
+ /**
+ * Get the persisted value for whether the app should record the GPS location data or not. If
+ * there is no prior value persisted, it returns {@code false}.
+ */
+ public static boolean getGpsRecordingStatusFromPreferences(Context context) {
+ SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context);
+ return pref.getBoolean(PREFS_KEY_SAVE_GPS, false);
+ }
+
+ /**
+ * Persists the user selection to whether save the GPS location data or not.
+ */
+ public static void saveGpsRecordingStatusToPreferences(Context context, boolean value) {
+ SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context);
+ pref.edit().putBoolean(PREFS_KEY_SAVE_GPS, value).apply();
+
+ }
+}
diff --git a/samples/browseable/SpeedTracker/Wearable/src/com.example.android.wearable.speedtracker/ui/SpeedPickerLayout.java b/samples/browseable/SpeedTracker/Wearable/src/com.example.android.wearable.speedtracker/ui/SpeedPickerLayout.java
new file mode 100644
index 000000000..5796c1367
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Wearable/src/com.example.android.wearable.speedtracker/ui/SpeedPickerLayout.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2014 Google Inc. All Rights Reserved.
+ *
+ * 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.wearable.speedtracker.ui;
+
+import android.content.Context;
+import android.graphics.drawable.GradientDrawable;
+import android.support.wearable.view.WearableListView;
+import android.util.AttributeSet;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import com.example.android.wearable.speedtracker.R;
+
+/**
+ * A simple extension of the {@link android.widget.LinearLayout} to represent a single item in a
+ * {@link android.support.wearable.view.WearableListView}.
+ */
+public class SpeedPickerLayout extends LinearLayout
+ implements WearableListView.OnCenterProximityListener {
+
+ private final float mFadedTextAlpha;
+ private final int mFadedCircleColor;
+ private final int mChosenCircleColor;
+ private ImageView mCircle;
+ private TextView mName;
+
+ public SpeedPickerLayout(Context context) {
+ this(context, null);
+ }
+
+ public SpeedPickerLayout(Context context, AttributeSet attrs) {
+ this(context, attrs, 0);
+ }
+
+ public SpeedPickerLayout(Context context, AttributeSet attrs,
+ int defStyle) {
+ super(context, attrs, defStyle);
+ mFadedTextAlpha = getResources()
+ .getInteger(R.integer.action_text_faded_alpha) / 100f;
+ mFadedCircleColor = getResources().getColor(R.color.grey);
+ mChosenCircleColor = getResources().getColor(R.color.blue);
+ }
+
+ // Get references to the icon and text in the item layout definiton
+ @Override
+ protected void onFinishInflate() {
+ super.onFinishInflate();
+ mCircle = (ImageView) findViewById(R.id.circle);
+ mName = (TextView) findViewById(R.id.name);
+ }
+
+ @Override
+ public void onCenterPosition(boolean animate) {
+ mName.setAlpha(1f);
+ ((GradientDrawable) mCircle.getDrawable()).setColor(mChosenCircleColor);
+ }
+
+ @Override
+ public void onNonCenterPosition(boolean animate) {
+ ((GradientDrawable) mCircle.getDrawable()).setColor(mFadedCircleColor);
+ mName.setAlpha(mFadedTextAlpha);
+
+ }
+}
diff --git a/samples/browseable/SpeedTracker/Wearable/src/com.example.android.wearable.speedtracker/ui/SpeedPickerListAdapter.java b/samples/browseable/SpeedTracker/Wearable/src/com.example.android.wearable.speedtracker/ui/SpeedPickerListAdapter.java
new file mode 100644
index 000000000..e3b284bfa
--- /dev/null
+++ b/samples/browseable/SpeedTracker/Wearable/src/com.example.android.wearable.speedtracker/ui/SpeedPickerListAdapter.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2014 Google Inc. All Rights Reserved.
+ *
+ * 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.wearable.speedtracker.ui;
+
+import android.content.Context;
+import android.support.wearable.view.WearableListView;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import com.example.android.wearable.speedtracker.R;
+
+/**
+ * A {@link android.support.wearable.view.WearableListView.Adapter} that is used to populate the
+ * list of speeds.
+ */
+public class SpeedPickerListAdapter extends WearableListView.Adapter {
+
+ private int[] mDataSet;
+ private final Context mContext;
+ private final LayoutInflater mInflater;
+
+ public SpeedPickerListAdapter(Context context, int[] dataset) {
+ mContext = context;
+ mInflater = LayoutInflater.from(context);
+ mDataSet = dataset;
+ }
+
+ public static class ItemViewHolder extends WearableListView.ViewHolder {
+
+ private TextView mTextView;
+
+ public ItemViewHolder(View itemView) {
+ super(itemView);
+ // find the text view within the custom item's layout
+ mTextView = (TextView) itemView.findViewById(R.id.name);
+ }
+ }
+
+ /**
+ * Create new views for list items (invoked by the WearableListView's layout manager)
+ */
+ @Override
+ public WearableListView.ViewHolder onCreateViewHolder(ViewGroup parent,
+ int viewType) {
+ // Inflate our custom layout for list items
+ return new ItemViewHolder(mInflater.inflate(R.layout.speed_picker_item_layout, null));
+ }
+
+ /**
+ * Replaces the contents of a list item. Instead of creating new views, the list tries to
+ * recycle existing ones. This is invoked by the WearableListView's layout manager.
+ */
+ @Override
+ public void onBindViewHolder(WearableListView.ViewHolder holder,
+ int position) {
+ // retrieve the text view
+ ItemViewHolder itemHolder = (ItemViewHolder) holder;
+ TextView view = itemHolder.mTextView;
+ // replace text contents
+ view.setText(mContext.getString(R.string.speed_for_list, mDataSet[position]));
+ // replace list item's metadata
+ holder.itemView.setTag(position);
+ }
+
+ /**
+ * Return the size of the data set (invoked by the WearableListView's layout manager).
+ */
+ @Override
+ public int getItemCount() {
+ return mDataSet.length;
+ }
+
+}
diff --git a/samples/browseable/SpeedTracker/_index.jd b/samples/browseable/SpeedTracker/_index.jd
new file mode 100644
index 000000000..298926f1f
--- /dev/null
+++ b/samples/browseable/SpeedTracker/_index.jd
@@ -0,0 +1,18 @@
+page.tags="Speed Tracker"
+sample.group=Wearable
+@jd:body
+
+<p>
+
+This sample uses the FusedLocation APIs of Google Play Services
+on those devices that have a hardware GPS built in. In those
+cases, this sample provides a simple screen that shows the
+current speed of the device on the watch. User can set a speed
+limit and if the speed approaches that limit, it changes the
+color to yellow and if it exceeds the limit, it turns red. User
+can also enable recording of coordinates and when it pairs back
+with the phone, this data will be synced with the phone
+component of the app and user can see a track made of those
+coordinates on a map on the phone.
+
+ </p>
diff --git a/samples/browseable/StorageClient/AndroidManifest.xml b/samples/browseable/StorageClient/AndroidManifest.xml
index d35a4ec22..0bcfde911 100644
--- a/samples/browseable/StorageClient/AndroidManifest.xml
+++ b/samples/browseable/StorageClient/AndroidManifest.xml
@@ -19,7 +19,7 @@
android:versionCode="1"
android:versionName="1.0">
- <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="19" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<application android:allowBackup="true"
android:label="@string/app_name"
diff --git a/samples/browseable/StorageClient/_index.jd b/samples/browseable/StorageClient/_index.jd
index e81e6b254..d1444f5a5 100644
--- a/samples/browseable/StorageClient/_index.jd
+++ b/samples/browseable/StorageClient/_index.jd
@@ -1,12 +1,12 @@
-
-
-
page.tags="StorageClient"
sample.group=Content
@jd:body
-<p>This sample demonstrates how to use the
-{@link android.content.Intent#ACTION_OPEN_DOCUMENT} intent to let users
-choose a file via the system's file browser. This intent allows a client
-application to access a list of document providers on the device, and choose
-a file from any of them.</p>
+<p>
+
+ Using the OPEN_DOCUMENT intent, a client app can access a list of Document Providers
+ on the device, and choose a file from any of them.
+ \n\nTo demonstrate this, click the button below to open up the Storage Access Framework
+ interface, and choose an image on your device. It will be displayed in this app.
+
+ </p>
diff --git a/samples/browseable/StorageClient/res/values-v21/base-colors.xml b/samples/browseable/StorageClient/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/StorageClient/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/StorageClient/res/values-v21/base-template-styles.xml b/samples/browseable/StorageClient/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/StorageClient/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/StorageClient/res/values/base-strings.xml b/samples/browseable/StorageClient/res/values/base-strings.xml
index 9498a2dab..0e3659dd1 100644
--- a/samples/browseable/StorageClient/res/values/base-strings.xml
+++ b/samples/browseable/StorageClient/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">StorageClient</string>
<string name="intro_message">
diff --git a/samples/browseable/StorageClient/res/values/strings.xml b/samples/browseable/StorageClient/res/values/strings.xml
index 303776fbf..c571bb586 100644
--- a/samples/browseable/StorageClient/res/values/strings.xml
+++ b/samples/browseable/StorageClient/res/values/strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="sample_action">Show Me The Image</string>
</resources>
diff --git a/samples/browseable/StorageClient/src/com.example.android.storageclient/MainActivity.java b/samples/browseable/StorageClient/src/com.example.android.storageclient/MainActivity.java
index 106f26b6f..2925d011c 100644
--- a/samples/browseable/StorageClient/src/com.example.android.storageclient/MainActivity.java
+++ b/samples/browseable/StorageClient/src/com.example.android.storageclient/MainActivity.java
@@ -14,9 +14,6 @@
* limitations under the License.
*/
-
-
-
package com.example.android.storageclient;
import android.graphics.Color;
diff --git a/samples/browseable/StorageProvider/AndroidManifest.xml b/samples/browseable/StorageProvider/AndroidManifest.xml
index e4704dc8f..53e78196e 100644
--- a/samples/browseable/StorageProvider/AndroidManifest.xml
+++ b/samples/browseable/StorageProvider/AndroidManifest.xml
@@ -21,9 +21,7 @@
android:versionCode="1"
android:versionName="1.0">
- <uses-sdk
- android:minSdkVersion="19"
- android:targetSdkVersion="19"/>
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
diff --git a/samples/browseable/StorageProvider/_index.jd b/samples/browseable/StorageProvider/_index.jd
index 562a83217..02e8c660d 100644
--- a/samples/browseable/StorageProvider/_index.jd
+++ b/samples/browseable/StorageProvider/_index.jd
@@ -1,7 +1,10 @@
-page.tags="Storage access framework", storage, documents
+page.tags="MyCloud"
sample.group=Content
@jd:body
-<p>This sample demonstrates how to use the
-{@link android.provider.DocumentsProvider} API to manage documents and
-expose them to the Android system for sharing.</p>
+<p>
+
+ \nA simple implementation of a documents provider using the storage access framework in
+ Android 4.4.
+
+ </p>
diff --git a/samples/browseable/StorageProvider/res/drawable-hdpi/ic_launcher.png b/samples/browseable/StorageProvider/res/drawable-hdpi/ic_launcher.png
index c5d697220..8ab9c3c7c 100755..100644
--- a/samples/browseable/StorageProvider/res/drawable-hdpi/ic_launcher.png
+++ b/samples/browseable/StorageProvider/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/StorageProvider/res/drawable-mdpi/ic_launcher.png b/samples/browseable/StorageProvider/res/drawable-mdpi/ic_launcher.png
index 59e6bd9ea..8a2df9469 100755..100644
--- a/samples/browseable/StorageProvider/res/drawable-mdpi/ic_launcher.png
+++ b/samples/browseable/StorageProvider/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/StorageProvider/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/StorageProvider/res/drawable-xhdpi/ic_launcher.png
index 5b8b7be20..9c196e17b 100755..100644
--- a/samples/browseable/StorageProvider/res/drawable-xhdpi/ic_launcher.png
+++ b/samples/browseable/StorageProvider/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/StorageProvider/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/StorageProvider/res/drawable-xxhdpi/ic_launcher.png
index 474bbd248..558f9012b 100755..100644
--- a/samples/browseable/StorageProvider/res/drawable-xxhdpi/ic_launcher.png
+++ b/samples/browseable/StorageProvider/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/StorageProvider/res/ic_launcher.png b/samples/browseable/StorageProvider/res/ic_launcher.png
deleted file mode 100755
index c5d697220..000000000
--- a/samples/browseable/StorageProvider/res/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/samples/browseable/StorageProvider/res/values-v21/base-colors.xml b/samples/browseable/StorageProvider/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/StorageProvider/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/StorageProvider/res/values-v21/base-template-styles.xml b/samples/browseable/StorageProvider/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/StorageProvider/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/StorageProvider/res/values/base-strings.xml b/samples/browseable/StorageProvider/res/values/base-strings.xml
index d3674af60..3453e88e3 100644
--- a/samples/browseable/StorageProvider/res/values/base-strings.xml
+++ b/samples/browseable/StorageProvider/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">MyCloud</string>
<string name="intro_message">
diff --git a/samples/browseable/StorageProvider/res/values/strings.xml b/samples/browseable/StorageProvider/res/values/strings.xml
index df0327374..cde5fb53c 100644
--- a/samples/browseable/StorageProvider/res/values/strings.xml
+++ b/samples/browseable/StorageProvider/res/values/strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="sample_action">Log in</string>
</resources>
diff --git a/samples/browseable/StorageProvider/src/com.example.android.storageprovider/MainActivity.java b/samples/browseable/StorageProvider/src/com.example.android.storageprovider/MainActivity.java
index 3108c1f50..e46a55a1e 100644
--- a/samples/browseable/StorageProvider/src/com.example.android.storageprovider/MainActivity.java
+++ b/samples/browseable/StorageProvider/src/com.example.android.storageprovider/MainActivity.java
@@ -14,9 +14,6 @@
* limitations under the License.
*/
-
-
-
package com.example.android.storageprovider;
import android.graphics.Color;
diff --git a/samples/browseable/SwipeRefreshLayoutBasic/AndroidManifest.xml b/samples/browseable/SwipeRefreshLayoutBasic/AndroidManifest.xml
index fa754537a..245097d3a 100644
--- a/samples/browseable/SwipeRefreshLayoutBasic/AndroidManifest.xml
+++ b/samples/browseable/SwipeRefreshLayoutBasic/AndroidManifest.xml
@@ -22,7 +22,7 @@
android:versionCode="1"
android:versionName="1.0">
- <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="17" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<application android:allowBackup="true"
android:label="@string/app_name"
diff --git a/samples/browseable/SwipeRefreshLayoutBasic/_index.jd b/samples/browseable/SwipeRefreshLayoutBasic/_index.jd
index bfbaddbbb..ca15805fa 100644
--- a/samples/browseable/SwipeRefreshLayoutBasic/_index.jd
+++ b/samples/browseable/SwipeRefreshLayoutBasic/_index.jd
@@ -1,11 +1,11 @@
-
-
-
page.tags="SwipeRefreshLayoutBasic"
sample.group=UI
@jd:body
-<p>This sample demonstrates how to use {@link android.support.v4.widget.SwipeRefreshLayout} to add
-the <em>swipe-to-refresh</em> gesture to a {@link android.view.View}, which enables you to trigger
-a refresh by swiping down on the {@link android.view.View}. In this sample, the view that can
-be freshed is a {@link android.widget.ListView}.</p>
+<p>
+
+ A basic sample which shows how to use SwipeRefreshLayout to add the \'swipe-to-refresh\'
+ gesture to a View, enabling the ability to trigger a refresh from swiping down on the view.
+ In this sample the View which can be refreshed is a ListView.
+
+ </p>
diff --git a/samples/browseable/SwipeRefreshLayoutBasic/res/values-v21/base-colors.xml b/samples/browseable/SwipeRefreshLayoutBasic/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/SwipeRefreshLayoutBasic/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/SwipeRefreshLayoutBasic/res/values-v21/base-template-styles.xml b/samples/browseable/SwipeRefreshLayoutBasic/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/SwipeRefreshLayoutBasic/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/SwipeRefreshLayoutBasic/res/values/base-strings.xml b/samples/browseable/SwipeRefreshLayoutBasic/res/values/base-strings.xml
index 665d16fed..a9f797f56 100644
--- a/samples/browseable/SwipeRefreshLayoutBasic/res/values/base-strings.xml
+++ b/samples/browseable/SwipeRefreshLayoutBasic/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">SwipeRefreshLayoutBasic</string>
<string name="intro_message">
diff --git a/samples/browseable/SwipeRefreshLayoutBasic/res/values/strings.xml b/samples/browseable/SwipeRefreshLayoutBasic/res/values/strings.xml
index 6bdb32e3c..6bdb32e3c 100755..100644
--- a/samples/browseable/SwipeRefreshLayoutBasic/res/values/strings.xml
+++ b/samples/browseable/SwipeRefreshLayoutBasic/res/values/strings.xml
diff --git a/samples/browseable/SwipeRefreshLayoutBasic/src/com.example.android.swiperefreshlayoutbasic/MainActivity.java b/samples/browseable/SwipeRefreshLayoutBasic/src/com.example.android.swiperefreshlayoutbasic/MainActivity.java
index f90aed1fc..61e70fc5f 100644
--- a/samples/browseable/SwipeRefreshLayoutBasic/src/com.example.android.swiperefreshlayoutbasic/MainActivity.java
+++ b/samples/browseable/SwipeRefreshLayoutBasic/src/com.example.android.swiperefreshlayoutbasic/MainActivity.java
@@ -14,9 +14,6 @@
* limitations under the License.
*/
-
-
-
package com.example.android.swiperefreshlayoutbasic;
import android.os.Bundle;
@@ -50,10 +47,12 @@ public class MainActivity extends SampleActivityBase {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
- FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
- SwipeRefreshLayoutBasicFragment fragment = new SwipeRefreshLayoutBasicFragment();
- transaction.replace(R.id.sample_content_fragment, fragment);
- transaction.commit();
+ if (savedInstanceState == null) {
+ FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
+ SwipeRefreshLayoutBasicFragment fragment = new SwipeRefreshLayoutBasicFragment();
+ transaction.replace(R.id.sample_content_fragment, fragment);
+ transaction.commit();
+ }
}
@Override
diff --git a/samples/browseable/SwipeRefreshListFragment/AndroidManifest.xml b/samples/browseable/SwipeRefreshListFragment/AndroidManifest.xml
index be449304e..48f1a8d72 100644
--- a/samples/browseable/SwipeRefreshListFragment/AndroidManifest.xml
+++ b/samples/browseable/SwipeRefreshListFragment/AndroidManifest.xml
@@ -22,7 +22,7 @@
android:versionCode="1"
android:versionName="1.0">
- <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<application android:allowBackup="true"
android:label="@string/app_name"
diff --git a/samples/browseable/SwipeRefreshListFragment/_index.jd b/samples/browseable/SwipeRefreshListFragment/_index.jd
index 3a34bb032..bbbedf738 100644
--- a/samples/browseable/SwipeRefreshListFragment/_index.jd
+++ b/samples/browseable/SwipeRefreshListFragment/_index.jd
@@ -1,12 +1,12 @@
-
-
-
page.tags="SwipeRefreshListFragment"
sample.group=UI
@jd:body
-<p>This sample demonstrates how to use {@link android.support.v4.widget.SwipeRefreshLayout} within
-{@link android.app.ListFragment} to add the <em>swipe-to-refresh</em> gesture to a
-{@link android.widget.ListView}, which enables you to trigger a refresh by swiping down on that
-view. This functionality is provided by the <code>SwipeRefreshListFragment</code> class, which you
-can reuse.</p>
+<p>
+
+ A sample which shows how to use SwipeRefreshLayout within a ListFragment to add the
+ \'swipe-to-refresh\' gesture to a ListView, enabling the ability to trigger a refresh
+ from swiping down on that view. This is provided through the re-usable
+ SwipeRefreshListFragment class.
+
+ </p>
diff --git a/samples/browseable/SwipeRefreshListFragment/res/values-v21/base-colors.xml b/samples/browseable/SwipeRefreshListFragment/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/SwipeRefreshListFragment/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/SwipeRefreshListFragment/res/values-v21/base-template-styles.xml b/samples/browseable/SwipeRefreshListFragment/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/SwipeRefreshListFragment/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/SwipeRefreshListFragment/res/values/base-strings.xml b/samples/browseable/SwipeRefreshListFragment/res/values/base-strings.xml
index f84c807b3..4a327dd0f 100644
--- a/samples/browseable/SwipeRefreshListFragment/res/values/base-strings.xml
+++ b/samples/browseable/SwipeRefreshListFragment/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">SwipeRefreshListFragment</string>
<string name="intro_message">
diff --git a/samples/browseable/SwipeRefreshListFragment/res/values/strings.xml b/samples/browseable/SwipeRefreshListFragment/res/values/strings.xml
index 21bbcaffe..21bbcaffe 100755..100644
--- a/samples/browseable/SwipeRefreshListFragment/res/values/strings.xml
+++ b/samples/browseable/SwipeRefreshListFragment/res/values/strings.xml
diff --git a/samples/browseable/SwipeRefreshListFragment/src/com.example.android.swiperefreshlistfragment/MainActivity.java b/samples/browseable/SwipeRefreshListFragment/src/com.example.android.swiperefreshlistfragment/MainActivity.java
index 7f7a7c8f4..ca3a5bf01 100644
--- a/samples/browseable/SwipeRefreshListFragment/src/com.example.android.swiperefreshlistfragment/MainActivity.java
+++ b/samples/browseable/SwipeRefreshListFragment/src/com.example.android.swiperefreshlistfragment/MainActivity.java
@@ -14,9 +14,6 @@
* limitations under the License.
*/
-
-
-
package com.example.android.swiperefreshlistfragment;
import android.os.Bundle;
@@ -50,10 +47,12 @@ public class MainActivity extends SampleActivityBase {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
- FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
- SwipeRefreshListFragmentFragment fragment = new SwipeRefreshListFragmentFragment();
- transaction.replace(R.id.sample_content_fragment, fragment);
- transaction.commit();
+ if (savedInstanceState == null) {
+ FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
+ SwipeRefreshListFragmentFragment fragment = new SwipeRefreshListFragmentFragment();
+ transaction.replace(R.id.sample_content_fragment, fragment);
+ transaction.commit();
+ }
}
@Override
diff --git a/samples/browseable/SwipeRefreshMultipleViews/AndroidManifest.xml b/samples/browseable/SwipeRefreshMultipleViews/AndroidManifest.xml
index aba15e066..b987db446 100644
--- a/samples/browseable/SwipeRefreshMultipleViews/AndroidManifest.xml
+++ b/samples/browseable/SwipeRefreshMultipleViews/AndroidManifest.xml
@@ -22,7 +22,7 @@
android:versionCode="1"
android:versionName="1.0">
- <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="17" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<application android:allowBackup="true"
android:label="@string/app_name"
diff --git a/samples/browseable/SwipeRefreshMultipleViews/_index.jd b/samples/browseable/SwipeRefreshMultipleViews/_index.jd
index 70ff8ea89..0cc246bb2 100644
--- a/samples/browseable/SwipeRefreshMultipleViews/_index.jd
+++ b/samples/browseable/SwipeRefreshMultipleViews/_index.jd
@@ -1,12 +1,12 @@
-
-
-
page.tags="SwipeRefreshMultipleViews"
sample.group=UI
@jd:body
-<p>This sample demonstrates how to use {@link android.support.v4.widget.SwipeRefreshLayout} to add
-the <em>swipe-to-refresh</em> gesture to a layout with multiple children, which enables you to
-trigger a refresh by swiping down on the view. In this sample
-{@link android.support.v4.widget.SwipeRefreshLayout} contains a scrollable
-{@link android.widget.GridView} with an empty {@link android.widget.TextView}.</p>
+<p>
+
+ A sample which shows how to use SwipeRefreshLayout to add the \'swipe-to-refresh\'
+ gesture to a layout with multiple children, enabling the ability to trigger a
+ refresh from swiping down on the visible view. In this sample, SwipeRefreshLayout
+ contains a scrollable GridView, along with a TextView empty view.
+
+ </p>
diff --git a/samples/browseable/SwipeRefreshMultipleViews/res/values-v21/base-colors.xml b/samples/browseable/SwipeRefreshMultipleViews/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/SwipeRefreshMultipleViews/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/SwipeRefreshMultipleViews/res/values-v21/base-template-styles.xml b/samples/browseable/SwipeRefreshMultipleViews/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/SwipeRefreshMultipleViews/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/SwipeRefreshMultipleViews/res/values/base-strings.xml b/samples/browseable/SwipeRefreshMultipleViews/res/values/base-strings.xml
index d7c1c9eb3..f7d434123 100644
--- a/samples/browseable/SwipeRefreshMultipleViews/res/values/base-strings.xml
+++ b/samples/browseable/SwipeRefreshMultipleViews/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">SwipeRefreshMultipleViews</string>
<string name="intro_message">
diff --git a/samples/browseable/SwipeRefreshMultipleViews/res/values/strings.xml b/samples/browseable/SwipeRefreshMultipleViews/res/values/strings.xml
index 991f0e8bd..991f0e8bd 100755..100644
--- a/samples/browseable/SwipeRefreshMultipleViews/res/values/strings.xml
+++ b/samples/browseable/SwipeRefreshMultipleViews/res/values/strings.xml
diff --git a/samples/browseable/SwipeRefreshMultipleViews/src/com.example.android.swiperefreshmultipleviews/MainActivity.java b/samples/browseable/SwipeRefreshMultipleViews/src/com.example.android.swiperefreshmultipleviews/MainActivity.java
index 0191d87de..a8bbf4dda 100644
--- a/samples/browseable/SwipeRefreshMultipleViews/src/com.example.android.swiperefreshmultipleviews/MainActivity.java
+++ b/samples/browseable/SwipeRefreshMultipleViews/src/com.example.android.swiperefreshmultipleviews/MainActivity.java
@@ -14,9 +14,6 @@
* limitations under the License.
*/
-
-
-
package com.example.android.swiperefreshmultipleviews;
import android.os.Bundle;
@@ -50,10 +47,12 @@ public class MainActivity extends SampleActivityBase {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
- FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
- SwipeRefreshMultipleViewsFragment fragment = new SwipeRefreshMultipleViewsFragment();
- transaction.replace(R.id.sample_content_fragment, fragment);
- transaction.commit();
+ if (savedInstanceState == null) {
+ FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
+ SwipeRefreshMultipleViewsFragment fragment = new SwipeRefreshMultipleViewsFragment();
+ transaction.replace(R.id.sample_content_fragment, fragment);
+ transaction.commit();
+ }
}
@Override
diff --git a/samples/browseable/SynchronizedNotifications/Application/AndroidManifest.xml b/samples/browseable/SynchronizedNotifications/Application/AndroidManifest.xml
new file mode 100644
index 000000000..1737c7da0
--- /dev/null
+++ b/samples/browseable/SynchronizedNotifications/Application/AndroidManifest.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.wearable.synchronizednotifications"
+ android:versionCode="1"
+ android:versionName="1.0">
+
+ <uses-sdk android:minSdkVersion="18"
+ android:targetSdkVersion="21" />
+
+ <application android:allowBackup="true"
+ android:label="@string/app_name"
+ android:icon="@drawable/ic_launcher"
+ android:theme="@style/AppTheme">
+
+ <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
+
+ <activity android:name=".MainActivity"
+ android:label="@string/app_name"
+ android:uiOptions="splitActionBarWhenNarrow">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <service android:name=".DismissListener">
+ <intent-filter>
+ <action
+ android:name="com.google.android.gms.wearable.BIND_LISTENER" />
+ </intent-filter>
+ <intent-filter>
+ <action
+ android:name="com.example.android.wearable.wearable.synchronizednotifications.DISMISS" />
+ </intent-filter>
+ </service>
+ </application>
+
+
+</manifest>
diff --git a/samples/browseable/SynchronizedNotifications/Application/res/drawable-hdpi/ic_launcher.png b/samples/browseable/SynchronizedNotifications/Application/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 000000000..b1efaf4b2
--- /dev/null
+++ b/samples/browseable/SynchronizedNotifications/Application/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/SynchronizedNotifications/Application/res/drawable-hdpi/tile.9.png b/samples/browseable/SynchronizedNotifications/Application/res/drawable-hdpi/tile.9.png
new file mode 100644
index 000000000..135862883
--- /dev/null
+++ b/samples/browseable/SynchronizedNotifications/Application/res/drawable-hdpi/tile.9.png
Binary files differ
diff --git a/samples/browseable/SynchronizedNotifications/Application/res/drawable-mdpi/ic_launcher.png b/samples/browseable/SynchronizedNotifications/Application/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 000000000..f5f9244f2
--- /dev/null
+++ b/samples/browseable/SynchronizedNotifications/Application/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/SynchronizedNotifications/Application/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/SynchronizedNotifications/Application/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 000000000..5d07b3f06
--- /dev/null
+++ b/samples/browseable/SynchronizedNotifications/Application/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/SynchronizedNotifications/Application/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/SynchronizedNotifications/Application/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 000000000..6ef21e1f4
--- /dev/null
+++ b/samples/browseable/SynchronizedNotifications/Application/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/SynchronizedNotifications/Application/res/layout-sw600dp-land/activity_main.xml b/samples/browseable/SynchronizedNotifications/Application/res/layout-sw600dp-land/activity_main.xml
new file mode 100644
index 000000000..8fed5f746
--- /dev/null
+++ b/samples/browseable/SynchronizedNotifications/Application/res/layout-sw600dp-land/activity_main.xml
@@ -0,0 +1,42 @@
+<!--
+ 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:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:fillViewport="true"
+ android:id="@+id/sample_main_layout">
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+ <TextView android:id="@+id/sample_output"
+ style="@style/Widget.SampleMessage"
+ android:background="@android:color/white"
+ android:layout_weight="1"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:text="@string/intro_message"
+ android:layout_margin="16dp" />
+ <fragment
+ android:name="com.example.android.common.logger.LogFragment"
+ android:id="@+id/log_fragment"
+ android:layout_weight="1"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_margin="16dp" />
+ </LinearLayout>
+</ScrollView>
diff --git a/samples/browseable/SynchronizedNotifications/Application/res/layout-sw600dp/activity_main.xml b/samples/browseable/SynchronizedNotifications/Application/res/layout-sw600dp/activity_main.xml
new file mode 100644
index 000000000..f811ef7dc
--- /dev/null
+++ b/samples/browseable/SynchronizedNotifications/Application/res/layout-sw600dp/activity_main.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 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:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:fillViewport="true"
+ android:id="@+id/sample_main_layout">
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+ <TextView android:id="@+id/sample_output"
+ style="@style/Widget.SampleMessage"
+ android:background="@android:color/white"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:padding="16dp"
+ android:layout_margin="16dp"/>
+ <fragment
+ android:name="com.example.android.common.logger.LogFragment"
+ android:id="@+id/log_fragment"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_margin="16dp" />
+ </LinearLayout>
+</ScrollView>
diff --git a/samples/browseable/SynchronizedNotifications/Application/res/layout/activity_main.xml b/samples/browseable/SynchronizedNotifications/Application/res/layout/activity_main.xml
new file mode 100644
index 000000000..d17095875
--- /dev/null
+++ b/samples/browseable/SynchronizedNotifications/Application/res/layout/activity_main.xml
@@ -0,0 +1,43 @@
+<!--
+ 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:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:fillViewport="true"
+ android:id="@+id/sample_main_layout">
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+ <TextView android:id="@+id/sample_output"
+ style="@style/Widget.SampleMessage"
+ android:layout_weight="1"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:padding="16dp" />
+ <View
+ android:layout_width="fill_parent"
+ android:layout_height="1dp"
+ android:background="@android:color/darker_gray"/>
+ <fragment
+ android:name="com.example.android.common.logger.LogFragment"
+ android:id="@+id/log_fragment"
+ android:layout_weight="1"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" />
+ </LinearLayout>
+</ScrollView>
diff --git a/samples/browseable/SynchronizedNotifications/Application/res/menu/main.xml b/samples/browseable/SynchronizedNotifications/Application/res/menu/main.xml
new file mode 100644
index 000000000..165c0a8da
--- /dev/null
+++ b/samples/browseable/SynchronizedNotifications/Application/res/menu/main.xml
@@ -0,0 +1,30 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:id="@+id/btn_phone_only"
+ android:showAsAction="always"
+ android:title="@string/phone_only" />
+
+ <item android:id="@+id/btn_wear_only"
+ android:showAsAction="always"
+ android:title="@string/wear_only" />
+
+ <item android:id="@+id/btn_different"
+ android:showAsAction="always"
+ android:title="@string/different_notifications" />
+
+</menu>
diff --git a/samples/browseable/SynchronizedNotifications/Application/res/values-sw600dp/template-dimens.xml b/samples/browseable/SynchronizedNotifications/Application/res/values-sw600dp/template-dimens.xml
new file mode 100644
index 000000000..22074a2bd
--- /dev/null
+++ b/samples/browseable/SynchronizedNotifications/Application/res/values-sw600dp/template-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>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_huge</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/SynchronizedNotifications/Application/res/values-sw600dp/template-styles.xml b/samples/browseable/SynchronizedNotifications/Application/res/values-sw600dp/template-styles.xml
new file mode 100644
index 000000000..03d197418
--- /dev/null
+++ b/samples/browseable/SynchronizedNotifications/Application/res/values-sw600dp/template-styles.xml
@@ -0,0 +1,25 @@
+<!--
+ 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.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceLarge</item>
+ <item name="android:lineSpacingMultiplier">1.2</item>
+ <item name="android:shadowDy">-6.5</item>
+ </style>
+
+</resources>
diff --git a/samples/browseable/SynchronizedNotifications/Application/res/values-v11/template-styles.xml b/samples/browseable/SynchronizedNotifications/Application/res/values-v11/template-styles.xml
new file mode 100644
index 000000000..8c1ea66f2
--- /dev/null
+++ b/samples/browseable/SynchronizedNotifications/Application/res/values-v11/template-styles.xml
@@ -0,0 +1,22 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Holo.Light" />
+
+</resources>
diff --git a/samples/browseable/SynchronizedNotifications/Application/res/values-v21/base-colors.xml b/samples/browseable/SynchronizedNotifications/Application/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/SynchronizedNotifications/Application/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/SynchronizedNotifications/Application/res/values-v21/base-template-styles.xml b/samples/browseable/SynchronizedNotifications/Application/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/SynchronizedNotifications/Application/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/SynchronizedNotifications/Application/res/values/base-strings.xml b/samples/browseable/SynchronizedNotifications/Application/res/values/base-strings.xml
new file mode 100644
index 000000000..8b6d8fff5
--- /dev/null
+++ b/samples/browseable/SynchronizedNotifications/Application/res/values/base-strings.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>
+ <string name="app_name">SynchronizedNotifications</string>
+ <string name="intro_message">
+ <![CDATA[
+
+
+ This sample creates simple or synchronized notifications on a
+ device and an Android Wear watch.
+
+
+ ]]>
+ </string>
+</resources>
diff --git a/samples/wearable/SynchronizedNotifications/Application/src/main/res/values/dimens.xml b/samples/browseable/SynchronizedNotifications/Application/res/values/dimens.xml
index a1e9cfe8a..a1e9cfe8a 100644
--- a/samples/wearable/SynchronizedNotifications/Application/src/main/res/values/dimens.xml
+++ b/samples/browseable/SynchronizedNotifications/Application/res/values/dimens.xml
diff --git a/samples/browseable/SynchronizedNotifications/Application/res/values/sample-strings.xml b/samples/browseable/SynchronizedNotifications/Application/res/values/sample-strings.xml
new file mode 100644
index 000000000..8ac6bf272
--- /dev/null
+++ b/samples/browseable/SynchronizedNotifications/Application/res/values/sample-strings.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+
+ <string name="wear_only">Watch Only</string>
+ <string name="phone_only">Phone Only</string>
+ <string name="different_notifications">Both</string>
+ <string name="phone_both">Phone Notification</string>
+ <string name="watch_both">Watch Notification</string>
+
+</resources>
diff --git a/samples/browseable/SynchronizedNotifications/Application/res/values/template-dimens.xml b/samples/browseable/SynchronizedNotifications/Application/res/values/template-dimens.xml
new file mode 100644
index 000000000..39e710b5c
--- /dev/null
+++ b/samples/browseable/SynchronizedNotifications/Application/res/values/template-dimens.xml
@@ -0,0 +1,32 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Define standard dimensions to comply with Holo-style grids and rhythm. -->
+
+ <dimen name="margin_tiny">4dp</dimen>
+ <dimen name="margin_small">8dp</dimen>
+ <dimen name="margin_medium">16dp</dimen>
+ <dimen name="margin_large">32dp</dimen>
+ <dimen name="margin_huge">64dp</dimen>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_medium</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/SynchronizedNotifications/Application/res/values/template-styles.xml b/samples/browseable/SynchronizedNotifications/Application/res/values/template-styles.xml
new file mode 100644
index 000000000..cfffcbd1b
--- /dev/null
+++ b/samples/browseable/SynchronizedNotifications/Application/res/values/template-styles.xml
@@ -0,0 +1,54 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+
+ <style name="Theme.Base" parent="android:Theme.Holo.Light" />
+
+ <style name="AppTheme" parent="Theme.Base" />
+ <!-- Widget styling -->
+
+ <style name="Widget" />
+
+ <style name="Widget.SampleMessage">
+ <item name="android:padding">@dimen/margin_medium</item>
+ <item name="android:textAppearance">?android:textAppearanceMedium</item>
+ <item name="android:lineSpacingMultiplier">1.1</item>
+ <item name="android:layout_margin">16dp</item>
+ <item name="android:shadowDy">-6.5</item>
+ </style>
+
+ <style name="Widget.SampleMessageTile">
+ <item name="android:background">@drawable/tile</item>
+ <item name="android:shadowColor">#7F000000</item>
+ <item name="android:shadowDy">-3.5</item>
+ <item name="android:shadowRadius">2</item>
+ </style>
+
+
+ <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/samples/browseable/SynchronizedNotifications/Application/src/com.example.android.common/activities/SampleActivityBase.java b/samples/browseable/SynchronizedNotifications/Application/src/com.example.android.common/activities/SampleActivityBase.java
new file mode 100644
index 000000000..3228927b7
--- /dev/null
+++ b/samples/browseable/SynchronizedNotifications/Application/src/com.example.android.common/activities/SampleActivityBase.java
@@ -0,0 +1,52 @@
+/*
+* Copyright 2013 The Android Open Source Project
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package com.example.android.common.activities;
+
+import android.os.Bundle;
+import android.support.v4.app.FragmentActivity;
+
+import com.example.android.common.logger.Log;
+import com.example.android.common.logger.LogWrapper;
+
+/**
+ * Base launcher activity, to handle most of the common plumbing for samples.
+ */
+public class SampleActivityBase extends FragmentActivity {
+
+ public static final String TAG = "SampleActivityBase";
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ }
+
+ @Override
+ protected void onStart() {
+ super.onStart();
+ initializeLogging();
+ }
+
+ /** Set up targets to receive log data */
+ public void initializeLogging() {
+ // Using Log, front-end to the logging chain, emulates android.util.log method signatures.
+ // Wraps Android's native log framework
+ LogWrapper logWrapper = new LogWrapper();
+ Log.setLogNode(logWrapper);
+
+ Log.i(TAG, "Ready");
+ }
+}
diff --git a/samples/browseable/SynchronizedNotifications/Application/src/com.example.android.common/logger/Log.java b/samples/browseable/SynchronizedNotifications/Application/src/com.example.android.common/logger/Log.java
new file mode 100644
index 000000000..17503c568
--- /dev/null
+++ b/samples/browseable/SynchronizedNotifications/Application/src/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);
+ }
+}
diff --git a/samples/browseable/SynchronizedNotifications/Application/src/com.example.android.common/logger/LogFragment.java b/samples/browseable/SynchronizedNotifications/Application/src/com.example.android.common/logger/LogFragment.java
new file mode 100644
index 000000000..b302acd4b
--- /dev/null
+++ b/samples/browseable/SynchronizedNotifications/Application/src/com.example.android.common/logger/LogFragment.java
@@ -0,0 +1,109 @@
+/*
+* 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 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.graphics.Typeface;
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ScrollView;
+
+/**
+ * Simple fraggment which contains a LogView and uses is to output log data it receives
+ * through the LogNode interface.
+ */
+public class LogFragment extends Fragment {
+
+ private LogView mLogView;
+ private ScrollView mScrollView;
+
+ public LogFragment() {}
+
+ public View inflateViews() {
+ mScrollView = new ScrollView(getActivity());
+ ViewGroup.LayoutParams scrollParams = new ViewGroup.LayoutParams(
+ ViewGroup.LayoutParams.MATCH_PARENT,
+ ViewGroup.LayoutParams.MATCH_PARENT);
+ mScrollView.setLayoutParams(scrollParams);
+
+ mLogView = new LogView(getActivity());
+ ViewGroup.LayoutParams logParams = new ViewGroup.LayoutParams(scrollParams);
+ logParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
+ mLogView.setLayoutParams(logParams);
+ mLogView.setClickable(true);
+ mLogView.setFocusable(true);
+ mLogView.setTypeface(Typeface.MONOSPACE);
+
+ // Want to set padding as 16 dips, setPadding takes pixels. Hooray math!
+ int paddingDips = 16;
+ double scale = getResources().getDisplayMetrics().density;
+ int paddingPixels = (int) ((paddingDips * (scale)) + .5);
+ mLogView.setPadding(paddingPixels, paddingPixels, paddingPixels, paddingPixels);
+ mLogView.setCompoundDrawablePadding(paddingPixels);
+
+ mLogView.setGravity(Gravity.BOTTOM);
+ mLogView.setTextAppearance(getActivity(), android.R.style.TextAppearance_Holo_Medium);
+
+ mScrollView.addView(mLogView);
+ return mScrollView;
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+
+ View result = inflateViews();
+
+ 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) {
+ mScrollView.fullScroll(ScrollView.FOCUS_DOWN);
+ }
+ });
+ return result;
+ }
+
+ public LogView getLogView() {
+ return mLogView;
+ }
+} \ No newline at end of file
diff --git a/samples/browseable/SynchronizedNotifications/Application/src/com.example.android.common/logger/LogNode.java b/samples/browseable/SynchronizedNotifications/Application/src/com.example.android.common/logger/LogNode.java
new file mode 100644
index 000000000..bc37cabc0
--- /dev/null
+++ b/samples/browseable/SynchronizedNotifications/Application/src/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/samples/browseable/SynchronizedNotifications/Application/src/com.example.android.common/logger/LogView.java b/samples/browseable/SynchronizedNotifications/Application/src/com.example.android.common/logger/LogView.java
new file mode 100644
index 000000000..c01542b91
--- /dev/null
+++ b/samples/browseable/SynchronizedNotifications/Application/src/com.example.android.common/logger/LogView.java
@@ -0,0 +1,145 @@
+/*
+ * 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.app.Activity;
+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.
+ final StringBuilder outputBuilder = new StringBuilder();
+
+ String delimiter = "\t";
+ appendIfNotNull(outputBuilder, priorityStr, delimiter);
+ appendIfNotNull(outputBuilder, tag, delimiter);
+ appendIfNotNull(outputBuilder, msg, delimiter);
+ appendIfNotNull(outputBuilder, exceptionStr, delimiter);
+
+ // In case this was originally called from an AsyncTask or some other off-UI thread,
+ // make sure the update occurs within the UI thread.
+ ((Activity) getContext()).runOnUiThread( (new Thread(new Runnable() {
+ @Override
+ public void run() {
+ // 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/samples/browseable/SynchronizedNotifications/Application/src/com.example.android.common/logger/LogWrapper.java b/samples/browseable/SynchronizedNotifications/Application/src/com.example.android.common/logger/LogWrapper.java
new file mode 100644
index 000000000..16a9e7ba2
--- /dev/null
+++ b/samples/browseable/SynchronizedNotifications/Application/src/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);
+ }
+ }
+}
diff --git a/samples/browseable/SynchronizedNotifications/Application/src/com.example.android.common/logger/MessageOnlyLogFilter.java b/samples/browseable/SynchronizedNotifications/Application/src/com.example.android.common/logger/MessageOnlyLogFilter.java
new file mode 100644
index 000000000..19967dcd4
--- /dev/null
+++ b/samples/browseable/SynchronizedNotifications/Application/src/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 chain.
+ */
+ public LogNode getNext() {
+ return mNext;
+ }
+
+ /**
+ * Sets the LogNode data will be sent to..
+ */
+ public void setNext(LogNode node) {
+ mNext = node;
+ }
+
+}
diff --git a/samples/browseable/SynchronizedNotifications/Application/src/com.example.android.wearable.synchronizednotifications/DismissListener.java b/samples/browseable/SynchronizedNotifications/Application/src/com.example.android.wearable.synchronizednotifications/DismissListener.java
new file mode 100644
index 000000000..8d5cca440
--- /dev/null
+++ b/samples/browseable/SynchronizedNotifications/Application/src/com.example.android.wearable.synchronizednotifications/DismissListener.java
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2014 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.wearable.synchronizednotifications;
+
+import static com.google.android.gms.wearable.PutDataRequest.WEAR_URI_SCHEME;
+
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.support.v4.app.NotificationManagerCompat;
+import android.util.Log;
+
+import com.example.android.wearable.synchronizednotifications.common.Constants;
+import com.google.android.gms.common.ConnectionResult;
+import com.google.android.gms.common.api.GoogleApiClient;
+import com.google.android.gms.common.api.ResultCallback;
+import com.google.android.gms.wearable.DataApi;
+import com.google.android.gms.wearable.DataEvent;
+import com.google.android.gms.wearable.DataEventBuffer;
+import com.google.android.gms.wearable.PutDataMapRequest;
+import com.google.android.gms.wearable.Wearable;
+import com.google.android.gms.wearable.WearableListenerService;
+
+/**
+ * A {@link com.google.android.gms.wearable.WearableListenerService} that is invoked when certain
+ * notifications are dismissed from either the phone or watch.
+ */
+public class DismissListener extends WearableListenerService
+ implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener,
+ ResultCallback<DataApi.DeleteDataItemsResult> {
+
+ private static final String TAG = "DismissListener";
+ private GoogleApiClient mGoogleApiClient;
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ mGoogleApiClient = new GoogleApiClient.Builder(this)
+ .addApi(Wearable.API)
+ .addConnectionCallbacks(this)
+ .addOnConnectionFailedListener(this)
+ .build();
+ }
+
+ @Override
+ public void onDataChanged(DataEventBuffer dataEvents) {
+ for (DataEvent dataEvent : dataEvents) {
+ if (dataEvent.getType() == DataEvent.TYPE_DELETED) {
+ if (Constants.BOTH_PATH.equals(dataEvent.getDataItem().getUri().getPath())) {
+ // notification on the phone should be dismissed
+ NotificationManagerCompat.from(this).cancel(Constants.BOTH_ID);
+ }
+ }
+ }
+ }
+
+ @Override
+ public int onStartCommand(Intent intent, int flags, int startId) {
+ if (null != intent) {
+ String action = intent.getAction();
+ if (Constants.ACTION_DISMISS.equals(action)) {
+ // We need to dismiss the wearable notification. We delete the DataItem that
+ // created the notification to inform the wearable.
+ int notificationId = intent.getIntExtra(Constants.KEY_NOTIFICATION_ID, -1);
+ if (notificationId == Constants.BOTH_ID) {
+ dismissWearableNotification(notificationId);
+ }
+ }
+ }
+ return super.onStartCommand(intent, flags, startId);
+ }
+
+ /**
+ * Removes the DataItem that was used to create a notification on the watch. By deleting the
+ * data item, a {@link com.google.android.gms.wearable.WearableListenerService} on the watch
+ * will be notified and the notification on the watch will be removed. To
+ * access the Wearable DataApi, we first need to ensure the GoogleApiClient is ready,
+ * which will then run the onConnected callback were the data removal is
+ * defined.
+ *
+ * @param id The ID of the notification that should be removed
+ */
+ private void dismissWearableNotification(final int id) {
+ mGoogleApiClient.connect();
+ }
+
+ @Override // ConnectionCallbacks
+ public void onConnected(Bundle bundle) {
+ final Uri dataItemUri =
+ new Uri.Builder().scheme(WEAR_URI_SCHEME).path(Constants.BOTH_PATH).build();
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "Deleting Uri: " + dataItemUri.toString());
+ }
+ Wearable.DataApi.deleteDataItems(
+ mGoogleApiClient, dataItemUri).setResultCallback(this);
+ }
+
+ @Override // ConnectionCallbacks
+ public void onConnectionSuspended(int i) {
+ }
+
+ @Override // OnConnectionFailedListener
+ public void onConnectionFailed(ConnectionResult connectionResult) {
+ Log.e(TAG, "Failed to connect to the Google API client");
+ }
+
+ @Override // ResultCallback<DataApi.DeleteDataItemsResult>
+ public void onResult(DataApi.DeleteDataItemsResult deleteDataItemsResult) {
+ if (!deleteDataItemsResult.getStatus().isSuccess()) {
+ Log.e(TAG, "dismissWearableNotification(): failed to delete DataItem");
+ }
+ mGoogleApiClient.disconnect();
+ }
+}
diff --git a/samples/browseable/SynchronizedNotifications/Application/src/com.example.android.wearable.synchronizednotifications/MainActivity.java b/samples/browseable/SynchronizedNotifications/Application/src/com.example.android.wearable.synchronizednotifications/MainActivity.java
new file mode 100644
index 000000000..ad1b372ea
--- /dev/null
+++ b/samples/browseable/SynchronizedNotifications/Application/src/com.example.android.wearable.synchronizednotifications/MainActivity.java
@@ -0,0 +1,82 @@
+/*
+* Copyright 2013 The Android Open Source Project
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package com.example.android.wearable.synchronizednotifications;
+
+import android.graphics.Color;
+import android.os.Bundle;
+import android.support.v4.app.FragmentTransaction;
+import android.text.Html;
+import android.widget.TextView;
+import android.view.Menu;
+
+import com.example.android.common.activities.SampleActivityBase;
+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;
+
+/**
+ * A simple launcher activity containing a summary sample description
+ * and a few action bar buttons.
+ */
+public class MainActivity extends SampleActivityBase {
+
+ public static final String TAG = "MainActivity";
+
+ public static final String FRAGTAG = "SynchronizedNotificationsFragment";
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+ TextView sampleOutput = (TextView) findViewById(R.id.sample_output);
+ sampleOutput.setText(Html.fromHtml(getString(R.string.intro_message)));
+
+ FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
+ SynchronizedNotificationsFragment fragment = new SynchronizedNotificationsFragment();
+ transaction.add(fragment, FRAGTAG);
+ transaction.commit();
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.main, menu);
+ return true;
+ }
+
+ /** Create a chain of targets that will receive log data */
+ @Override
+ public void initializeLogging() {
+ // Wraps Android's native log framework.
+ LogWrapper logWrapper = new LogWrapper();
+ // Using Log, front-end to the logging chain, emulates android.util.log method signatures.
+ Log.setLogNode(logWrapper);
+
+ // Filter strips out everything except the message text.
+ MessageOnlyLogFilter msgFilter = new MessageOnlyLogFilter();
+ logWrapper.setNext(msgFilter);
+
+ // On screen logging via a fragment with a TextView.
+ LogFragment logFragment = (LogFragment) getSupportFragmentManager()
+ .findFragmentById(R.id.log_fragment);
+ msgFilter.setNext(logFragment.getLogView());
+ logFragment.getLogView().setTextAppearance(this, R.style.Log);
+ logFragment.getLogView().setBackgroundColor(Color.WHITE);
+
+ Log.i(TAG, "Ready");
+ }
+}
diff --git a/samples/browseable/SynchronizedNotifications/Application/src/com.example.android.wearable.synchronizednotifications/SynchronizedNotificationsFragment.java b/samples/browseable/SynchronizedNotifications/Application/src/com.example.android.wearable.synchronizednotifications/SynchronizedNotificationsFragment.java
new file mode 100644
index 000000000..240af9b27
--- /dev/null
+++ b/samples/browseable/SynchronizedNotifications/Application/src/com.example.android.wearable.synchronizednotifications/SynchronizedNotificationsFragment.java
@@ -0,0 +1,198 @@
+/*
+ * Copyright (C) 2014 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.wearable.synchronizednotifications;
+
+import android.app.PendingIntent;
+import android.content.Intent;
+import android.support.v4.app.Fragment;
+import android.app.Activity;
+import android.net.Uri;
+import android.os.Bundle;
+import android.support.v4.app.NotificationCompat;
+import android.support.v4.app.NotificationManagerCompat;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Toast;
+
+import com.example.android.wearable.synchronizednotifications.common.Constants;
+import com.google.android.gms.common.ConnectionResult;
+import com.google.android.gms.common.api.GoogleApiClient;
+import com.google.android.gms.common.api.ResultCallback;
+import com.google.android.gms.wearable.DataApi;
+import com.google.android.gms.wearable.PutDataMapRequest;
+import com.google.android.gms.wearable.PutDataRequest;
+import com.google.android.gms.wearable.Wearable;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+
+
+/**
+ * A simple fragment that presents three buttons that would trigger three different combinations of
+ * notifications on the handset and the watch:
+ * <ul>
+ * <li>The first button builds a simple local-only notification on the handset.</li>
+ * <li>The second one creates a wearable-only notification by putting a data item in the shared data
+ * store and having a {@link com.google.android.gms.wearable.WearableListenerService} listen for
+ * that on the wearable</li>
+ * <li>The third one creates a local notification and a wearable notification by combining the above
+ * two. It, however, demonstrates how one can set things up so that the dismissal of one
+ * notification results in the dismissal of the other one.</li>
+ * </ul>
+ */
+public class SynchronizedNotificationsFragment extends Fragment
+ implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
+
+ private static final String TAG = "SynchronizedNotificationsFragment";
+ private GoogleApiClient mGoogleApiClient;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ mGoogleApiClient = new GoogleApiClient.Builder(this.getActivity())
+ .addApi(Wearable.API)
+ .addConnectionCallbacks(this)
+ .addOnConnectionFailedListener(this)
+ .build();
+ setHasOptionsMenu(true);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.btn_phone_only:
+ buildLocalOnlyNotification(getString(R.string.phone_only), now(),
+ Constants.PHONE_ONLY_ID, false);
+ return true;
+ case R.id.btn_wear_only:
+ buildWearableOnlyNotification(getString(R.string.wear_only), now(),
+ Constants.WATCH_ONLY_PATH);
+ return true;
+ case R.id.btn_different:
+ buildMirroredNotifications(getString(R.string.phone_both), getString(R.string.watch_both), now());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Builds a local-only notification for the handset. This is achieved by using
+ * <code>setLocalOnly(true)</code>. If <code>withDismissal</code> is set to <code>true</code>, a
+ * {@link android.app.PendingIntent} will be added to handle the dismissal of notification to
+ * be able to remove the mirrored notification on the wearable.
+ */
+ private void buildLocalOnlyNotification(String title, String content, int notificationId,
+ boolean withDismissal) {
+ NotificationCompat.Builder builder = new NotificationCompat.Builder(this.getActivity());
+ builder.setContentTitle(title)
+ .setContentText(content)
+ .setLocalOnly(true)
+ .setSmallIcon(R.drawable.ic_launcher);
+
+ if (withDismissal) {
+ Intent dismissIntent = new Intent(Constants.ACTION_DISMISS);
+ dismissIntent.putExtra(Constants.KEY_NOTIFICATION_ID, Constants.BOTH_ID);
+ PendingIntent pendingIntent = PendingIntent
+ .getService(this.getActivity(), 0, dismissIntent, PendingIntent.FLAG_UPDATE_CURRENT);
+ builder.setDeleteIntent(pendingIntent);
+ }
+ NotificationManagerCompat.from(this.getActivity()).notify(notificationId, builder.build());
+ }
+
+ /**
+ * Builds a DataItem that on the wearable will be interpreted as a request to show a
+ * notification. The result will be a notification that only shows up on the wearable.
+ */
+ private void buildWearableOnlyNotification(String title, String content, String path) {
+ if (mGoogleApiClient.isConnected()) {
+ PutDataMapRequest putDataMapRequest = PutDataMapRequest.create(path);
+ putDataMapRequest.getDataMap().putString(Constants.KEY_CONTENT, content);
+ putDataMapRequest.getDataMap().putString(Constants.KEY_TITLE, title);
+ PutDataRequest request = putDataMapRequest.asPutDataRequest();
+ Wearable.DataApi.putDataItem(mGoogleApiClient, request)
+ .setResultCallback(new ResultCallback<DataApi.DataItemResult>() {
+ @Override
+ public void onResult(DataApi.DataItemResult dataItemResult) {
+ if (!dataItemResult.getStatus().isSuccess()) {
+ Log.e(TAG, "buildWatchOnlyNotification(): Failed to set the data, "
+ + "status: " + dataItemResult.getStatus().getStatusCode());
+ }
+ }
+ });
+ } else {
+ Log.e(TAG, "buildWearableOnlyNotification(): no Google API Client connection");
+ }
+ }
+
+ /**
+ * Builds a local notification and sets a DataItem that will be interpreted by the wearable as
+ * a request to build a notification on the wearable as as well. The two notifications show
+ * different messages.
+ * Dismissing either of the notifications will result in dismissal of the other; this is
+ * achieved by creating a {@link android.app.PendingIntent} that results in removal of
+ * the DataItem that created the watch notification. The deletion of the DataItem is observed on
+ * both sides, using WearableListenerService callbacks, and is interpreted on each side as a
+ * request to dismiss the corresponding notification.
+ */
+ private void buildMirroredNotifications(String phoneTitle, String watchTitle, String content) {
+ if (mGoogleApiClient.isConnected()) {
+ // Wearable notification
+ buildWearableOnlyNotification(watchTitle, content, Constants.BOTH_PATH);
+
+ // Local notification, with a pending intent for dismissal
+ buildLocalOnlyNotification(phoneTitle, content, Constants.BOTH_ID, true);
+ }
+ }
+
+ @Override
+ public void onStart() {
+ super.onStart();
+ mGoogleApiClient.connect();
+ }
+
+ @Override
+ public void onStop() {
+ mGoogleApiClient.disconnect();
+ super.onStop();
+ }
+
+ @Override
+ public void onConnected(Bundle bundle) {
+ }
+
+ @Override
+ public void onConnectionSuspended(int i) {
+ }
+
+ @Override
+ public void onConnectionFailed(ConnectionResult connectionResult) {
+ Log.e(TAG, "Failed to connect to Google API Client");
+ }
+
+ /**
+ * Returns a string built from the current time
+ */
+ private String now() {
+ SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss", Locale.getDefault());
+ return sdf.format(new Date());
+ }
+
+}
diff --git a/samples/browseable/SynchronizedNotifications/Shared/AndroidManifest.xml b/samples/browseable/SynchronizedNotifications/Shared/AndroidManifest.xml
new file mode 100644
index 000000000..5362fc736
--- /dev/null
+++ b/samples/browseable/SynchronizedNotifications/Shared/AndroidManifest.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.wearable.synchronizednotifications.common">
+
+ <application android:allowBackup="true"
+ android:label="@string/app_name">
+ </application>
+
+</manifest>
diff --git a/samples/browseable/SynchronizedNotifications/Shared/res/values/strings.xml b/samples/browseable/SynchronizedNotifications/Shared/res/values/strings.xml
new file mode 100644
index 000000000..0f2bb9075
--- /dev/null
+++ b/samples/browseable/SynchronizedNotifications/Shared/res/values/strings.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<resources>
+ <string name="app_name">Shared</string>
+</resources>
diff --git a/samples/browseable/SynchronizedNotifications/Shared/src/com.example.android.wearable.synchronizednotifications.common/Constants.java b/samples/browseable/SynchronizedNotifications/Shared/src/com.example.android.wearable.synchronizednotifications.common/Constants.java
new file mode 100644
index 000000000..2e1d46c83
--- /dev/null
+++ b/samples/browseable/SynchronizedNotifications/Shared/src/com.example.android.wearable.synchronizednotifications.common/Constants.java
@@ -0,0 +1,37 @@
+/*
+ * 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.wearable.synchronizednotifications.common;
+
+/**
+ * Constants that are used in both the Application and the Wearable modules.
+ */
+public final class Constants {
+
+ private Constants() {};
+
+ public static final int WATCH_ONLY_ID = 2;
+ public static final int PHONE_ONLY_ID = 3;
+ public static final int BOTH_ID = 4;
+
+ public static final String BOTH_PATH = "/both";
+ public static final String WATCH_ONLY_PATH = "/watch-only";
+ public static final String KEY_NOTIFICATION_ID = "notification-id";
+ public static final String KEY_TITLE = "title";
+ public static final String KEY_CONTENT = "content";
+
+ public static final String ACTION_DISMISS
+ = "com.example.android.wearable.synchronizednotifications.DISMISS";
+}
diff --git a/samples/browseable/SynchronizedNotifications/Wearable/AndroidManifest.xml b/samples/browseable/SynchronizedNotifications/Wearable/AndroidManifest.xml
new file mode 100644
index 000000000..f9b0d9c85
--- /dev/null
+++ b/samples/browseable/SynchronizedNotifications/Wearable/AndroidManifest.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.wearable.synchronizednotifications">
+
+ <uses-sdk android:minSdkVersion="20"
+ android:targetSdkVersion="21" />
+
+ <uses-feature android:name="android.hardware.type.watch" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@android:style/Theme.DeviceDefault.Light" >
+ <meta-data android:name="com.google.android.gms.version"
+ android:value="@integer/google_play_services_version" />
+ <activity
+ android:name=".WearableActivity"
+ android:label="@string/app_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <service android:name=".NotificationUpdateService">
+ <intent-filter>
+ <action
+ android:name="com.google.android.gms.wearable.BIND_LISTENER" />
+ </intent-filter>
+ <intent-filter>
+ <action
+ android:name="com.example.android.wearable.synchronizednotifications.DISMISS" />
+ </intent-filter>
+ </service>
+
+ </application>
+
+</manifest>
diff --git a/samples/wearable/SynchronizedNotifications/Application/src/main/res/drawable-hdpi/ic_launcher.png b/samples/browseable/SynchronizedNotifications/Wearable/res/drawable-hdpi/ic_launcher.png
index f7dd9a0bd..f7dd9a0bd 100644
--- a/samples/wearable/SynchronizedNotifications/Application/src/main/res/drawable-hdpi/ic_launcher.png
+++ b/samples/browseable/SynchronizedNotifications/Wearable/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/SynchronizedNotifications/Application/src/main/res/drawable-mdpi/ic_launcher.png b/samples/browseable/SynchronizedNotifications/Wearable/res/drawable-mdpi/ic_launcher.png
index fef2da78f..fef2da78f 100644
--- a/samples/wearable/SynchronizedNotifications/Application/src/main/res/drawable-mdpi/ic_launcher.png
+++ b/samples/browseable/SynchronizedNotifications/Wearable/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/SynchronizedNotifications/Application/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/SynchronizedNotifications/Wearable/res/drawable-xhdpi/ic_launcher.png
index f2fb03cdd..f2fb03cdd 100644
--- a/samples/wearable/SynchronizedNotifications/Application/src/main/res/drawable-xhdpi/ic_launcher.png
+++ b/samples/browseable/SynchronizedNotifications/Wearable/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/SynchronizedNotifications/Wearable/src/main/res/layout/activity_wearable.xml b/samples/browseable/SynchronizedNotifications/Wearable/res/layout/activity_wearable.xml
index 71451ff50..71451ff50 100644
--- a/samples/wearable/SynchronizedNotifications/Wearable/src/main/res/layout/activity_wearable.xml
+++ b/samples/browseable/SynchronizedNotifications/Wearable/res/layout/activity_wearable.xml
diff --git a/samples/browseable/SynchronizedNotifications/Wearable/res/values/strings.xml b/samples/browseable/SynchronizedNotifications/Wearable/res/values/strings.xml
new file mode 100644
index 000000000..aa51a71fd
--- /dev/null
+++ b/samples/browseable/SynchronizedNotifications/Wearable/res/values/strings.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+ <string name="app_name">Synchronized Notifications</string>
+</resources>
+
diff --git a/samples/browseable/SynchronizedNotifications/Wearable/src/com.example.android.wearable.synchronizednotifications/NotificationUpdateService.java b/samples/browseable/SynchronizedNotifications/Wearable/src/com.example.android.wearable.synchronizednotifications/NotificationUpdateService.java
new file mode 100644
index 000000000..8b46bf3ae
--- /dev/null
+++ b/samples/browseable/SynchronizedNotifications/Wearable/src/com.example.android.wearable.synchronizednotifications/NotificationUpdateService.java
@@ -0,0 +1,164 @@
+/*
+ * Copyright (C) 2014 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.wearable.synchronizednotifications;
+
+import static com.google.android.gms.wearable.PutDataRequest.WEAR_URI_SCHEME;
+
+import android.app.Notification;
+import android.app.NotificationManager;
+import android.app.PendingIntent;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.util.Log;
+
+import com.example.android.wearable.synchronizednotifications.common.Constants;
+import com.google.android.gms.common.ConnectionResult;
+import com.google.android.gms.common.api.GoogleApiClient;
+import com.google.android.gms.common.api.ResultCallback;
+import com.google.android.gms.wearable.DataApi;
+import com.google.android.gms.wearable.DataEvent;
+import com.google.android.gms.wearable.DataEventBuffer;
+import com.google.android.gms.wearable.DataMap;
+import com.google.android.gms.wearable.DataMapItem;
+import com.google.android.gms.wearable.PutDataMapRequest;
+import com.google.android.gms.wearable.Wearable;
+import com.google.android.gms.wearable.WearableListenerService;
+
+/**
+ * A {@link com.google.android.gms.wearable.WearableListenerService} that will be invoked when a
+ * DataItem is added or deleted. The creation of a new DataItem will be interpreted as a request to
+ * create a new notification and the removal of that DataItem is interpreted as a request to
+ * dismiss that notification.
+ */
+public class NotificationUpdateService extends WearableListenerService
+ implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener,
+ ResultCallback<DataApi.DeleteDataItemsResult> {
+
+ private static final String TAG = "NotificationUpdate";
+ private GoogleApiClient mGoogleApiClient;
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ mGoogleApiClient = new GoogleApiClient.Builder(this)
+ .addApi(Wearable.API)
+ .addConnectionCallbacks(this)
+ .addOnConnectionFailedListener(this)
+ .build();
+ }
+
+ @Override
+ public int onStartCommand(Intent intent, int flags, int startId) {
+ if (null != intent) {
+ String action = intent.getAction();
+ if (Constants.ACTION_DISMISS.equals(action)) {
+ // We need to dismiss the wearable notification. We delete the data item that
+ // created the notification and that is how we inform the phone
+ int notificationId = intent.getIntExtra(Constants.KEY_NOTIFICATION_ID, -1);
+ if (notificationId == Constants.BOTH_ID) {
+ dismissPhoneNotification(notificationId);
+ }
+ }
+ }
+ return super.onStartCommand(intent, flags, startId);
+ }
+
+ /**
+ * Dismisses the phone notification, via a {@link android.app.PendingIntent} that is triggered
+ * when the user dismisses the local notification. Deleting the corresponding data item notifies
+ * the {@link com.google.android.gms.wearable.WearableListenerService} on the phone that the
+ * matching notification on the phone side should be removed.
+ */
+ private void dismissPhoneNotification(int id) {
+ mGoogleApiClient.connect();
+ }
+
+ @Override
+ public void onDataChanged(DataEventBuffer dataEvents) {
+ for (DataEvent dataEvent : dataEvents) {
+ if (dataEvent.getType() == DataEvent.TYPE_CHANGED) {
+ DataMap dataMap = DataMapItem.fromDataItem(dataEvent.getDataItem()).getDataMap();
+ String content = dataMap.getString(Constants.KEY_CONTENT);
+ String title = dataMap.getString(Constants.KEY_TITLE);
+ if (Constants.WATCH_ONLY_PATH.equals(dataEvent.getDataItem().getUri().getPath())) {
+ buildWearableOnlyNotification(title, content, false);
+ } else if (Constants.BOTH_PATH.equals(dataEvent.getDataItem().getUri().getPath())) {
+ buildWearableOnlyNotification(title, content, true);
+ }
+ } else if (dataEvent.getType() == DataEvent.TYPE_DELETED) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "DataItem deleted: " + dataEvent.getDataItem().getUri().getPath());
+ }
+ if (Constants.BOTH_PATH.equals(dataEvent.getDataItem().getUri().getPath())) {
+ // Dismiss the corresponding notification
+ ((NotificationManager) getSystemService(NOTIFICATION_SERVICE))
+ .cancel(Constants.WATCH_ONLY_ID);
+ }
+ }
+ }
+ }
+
+ /**
+ * Builds a simple notification on the wearable.
+ */
+ private void buildWearableOnlyNotification(String title, String content,
+ boolean withDismissal) {
+ Notification.Builder builder = new Notification.Builder(this)
+ .setSmallIcon(R.drawable.ic_launcher)
+ .setContentTitle(title)
+ .setContentText(content);
+
+ if (withDismissal) {
+ Intent dismissIntent = new Intent(Constants.ACTION_DISMISS);
+ dismissIntent.putExtra(Constants.KEY_NOTIFICATION_ID, Constants.BOTH_ID);
+ PendingIntent pendingIntent = PendingIntent
+ .getService(this, 0, dismissIntent, PendingIntent.FLAG_UPDATE_CURRENT);
+ builder.setDeleteIntent(pendingIntent);
+ }
+
+ ((NotificationManager) getSystemService(NOTIFICATION_SERVICE))
+ .notify(Constants.WATCH_ONLY_ID, builder.build());
+ }
+
+ @Override
+ public void onConnected(Bundle bundle) {
+ final Uri dataItemUri =
+ new Uri.Builder().scheme(WEAR_URI_SCHEME).path(Constants.BOTH_PATH).build();
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "Deleting Uri: " + dataItemUri.toString());
+ }
+ Wearable.DataApi.deleteDataItems(
+ mGoogleApiClient, dataItemUri).setResultCallback(this);
+ }
+
+ @Override
+ public void onConnectionSuspended(int i) {
+ }
+
+ @Override
+ public void onConnectionFailed(ConnectionResult connectionResult) {
+ }
+
+ @Override
+ public void onResult(DataApi.DeleteDataItemsResult deleteDataItemsResult) {
+ if (!deleteDataItemsResult.getStatus().isSuccess()) {
+ Log.e(TAG, "dismissWearableNotification(): failed to delete DataItem");
+ }
+ mGoogleApiClient.disconnect();
+ }
+}
diff --git a/samples/browseable/SynchronizedNotifications/Wearable/src/com.example.android.wearable.synchronizednotifications/WearableActivity.java b/samples/browseable/SynchronizedNotifications/Wearable/src/com.example.android.wearable.synchronizednotifications/WearableActivity.java
new file mode 100644
index 000000000..6ef2f1bd2
--- /dev/null
+++ b/samples/browseable/SynchronizedNotifications/Wearable/src/com.example.android.wearable.synchronizednotifications/WearableActivity.java
@@ -0,0 +1,28 @@
+/*
+ * 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.wearable.synchronizednotifications;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+public class WearableActivity extends Activity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_wearable);
+ }
+}
diff --git a/samples/browseable/SynchronizedNotifications/_index.jd b/samples/browseable/SynchronizedNotifications/_index.jd
new file mode 100644
index 000000000..fe882adce
--- /dev/null
+++ b/samples/browseable/SynchronizedNotifications/_index.jd
@@ -0,0 +1,10 @@
+page.tags="SynchronizedNotifications"
+sample.group=Wearable
+@jd:body
+
+<p>
+
+ This sample creates simple or synchronized notifications on a
+ device and an Android Wear watch.
+
+ </p>
diff --git a/samples/browseable/TextLinkify/AndroidManifest.xml b/samples/browseable/TextLinkify/AndroidManifest.xml
index 49b4eae0b..eb55f205b 100644
--- a/samples/browseable/TextLinkify/AndroidManifest.xml
+++ b/samples/browseable/TextLinkify/AndroidManifest.xml
@@ -22,9 +22,7 @@
android:versionCode="1"
android:versionName="1.0">
- <uses-sdk
- android:minSdkVersion="4"
- android:targetSdkVersion="17" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<application
android:allowBackup="true"
diff --git a/samples/browseable/TextLinkify/_index.jd b/samples/browseable/TextLinkify/_index.jd
index 36aa07515..5b4c000b8 100644
--- a/samples/browseable/TextLinkify/_index.jd
+++ b/samples/browseable/TextLinkify/_index.jd
@@ -1,16 +1,10 @@
-
-
-
page.tags="TextLinkify"
sample.group=Views
@jd:body
-<p>This sample demonstrates how to add clickable links to a
-{@link android.widget.TextView}, by using these techniques:
-<ul>
-<li>Setting the {@link android.R.styleable#TextView_autoLink} property
-to automatically convert the text to a link.</li>
-<li>Parsing a String as HTML</li>
-<li>Manually by constructing a {@link android.text.SpannableString}.</li>
-</ul>
-</p>
+<p>
+
+ This sample illustrates how links can be added to a TextView. This can be done either
+ automatically by setting the "autoLink" property or explicitly.
+
+ </p>
diff --git a/samples/browseable/TextLinkify/res/values-v21/base-colors.xml b/samples/browseable/TextLinkify/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/TextLinkify/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/TextLinkify/res/values-v21/base-template-styles.xml b/samples/browseable/TextLinkify/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/TextLinkify/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/TextLinkify/res/values/base-strings.xml b/samples/browseable/TextLinkify/res/values/base-strings.xml
index f2eb104c4..831f4b2a2 100644
--- a/samples/browseable/TextLinkify/res/values/base-strings.xml
+++ b/samples/browseable/TextLinkify/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">TextLinkify</string>
<string name="intro_message">
diff --git a/samples/browseable/TextSwitcher/AndroidManifest.xml b/samples/browseable/TextSwitcher/AndroidManifest.xml
index 7f512a335..70884cde2 100644
--- a/samples/browseable/TextSwitcher/AndroidManifest.xml
+++ b/samples/browseable/TextSwitcher/AndroidManifest.xml
@@ -20,9 +20,7 @@
android:versionCode="1"
android:versionName="1.0" >
- <uses-sdk
- android:minSdkVersion="4"
- android:targetSdkVersion="17" />
+ <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<application
android:allowBackup="true"
diff --git a/samples/browseable/TextSwitcher/_index.jd b/samples/browseable/TextSwitcher/_index.jd
index 0fc5c3254..ddcc042ed 100644
--- a/samples/browseable/TextSwitcher/_index.jd
+++ b/samples/browseable/TextSwitcher/_index.jd
@@ -1,11 +1,11 @@
-
-
-
page.tags="TextSwitcher"
sample.group=UI
@jd:body
-<p>This sample demonstrates how to use the {@link android.widget.TextSwitcher}
-view with animations. A {@link android.widget.TextSwitcher} is a type of
-{@link android.widget.ViewSwitcher} that animates text transitions on screen
-when {@link android.widget.TextSwitcher#setText(CharSequence)} is called.</p>
+<p>
+
+ This sample illustrates the use of a TextSwitcher to display text.
+ \n\nClick the button below to set new text in the TextSwitcher and observe the
+ in and out fade animations.
+
+ </p>
diff --git a/samples/browseable/TextSwitcher/res/values-v21/base-colors.xml b/samples/browseable/TextSwitcher/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/TextSwitcher/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/TextSwitcher/res/values-v21/base-template-styles.xml b/samples/browseable/TextSwitcher/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/TextSwitcher/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/TextSwitcher/res/values/base-strings.xml b/samples/browseable/TextSwitcher/res/values/base-strings.xml
index 2497e8610..223f06847 100644
--- a/samples/browseable/TextSwitcher/res/values/base-strings.xml
+++ b/samples/browseable/TextSwitcher/res/values/base-strings.xml
@@ -14,9 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-
-
<resources>
<string name="app_name">TextSwitcher</string>
<string name="intro_message">
diff --git a/samples/browseable/Timer/Application/AndroidManifest.xml b/samples/browseable/Timer/Application/AndroidManifest.xml
new file mode 100644
index 000000000..2c60ab9f7
--- /dev/null
+++ b/samples/browseable/Timer/Application/AndroidManifest.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.wearable.timer">
+
+ <uses-sdk android:minSdkVersion="18"
+ android:targetSdkVersion="21" />
+
+ <application android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name">
+ </application>
+
+</manifest>
+
diff --git a/samples/browseable/Timer/Application/res/drawable-hdpi/ic_launcher.png b/samples/browseable/Timer/Application/res/drawable-hdpi/ic_launcher.png
new file mode 100755
index 000000000..589f229d1
--- /dev/null
+++ b/samples/browseable/Timer/Application/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/Timer/Application/res/drawable-hdpi/tile.9.png b/samples/browseable/Timer/Application/res/drawable-hdpi/tile.9.png
new file mode 100644
index 000000000..135862883
--- /dev/null
+++ b/samples/browseable/Timer/Application/res/drawable-hdpi/tile.9.png
Binary files differ
diff --git a/samples/browseable/Timer/Application/res/drawable-mdpi/ic_launcher.png b/samples/browseable/Timer/Application/res/drawable-mdpi/ic_launcher.png
new file mode 100755
index 000000000..77dd57139
--- /dev/null
+++ b/samples/browseable/Timer/Application/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/Timer/Application/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/Timer/Application/res/drawable-xhdpi/ic_launcher.png
new file mode 100755
index 000000000..fe34ebe13
--- /dev/null
+++ b/samples/browseable/Timer/Application/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/Timer/Application/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/Timer/Application/res/drawable-xxhdpi/ic_launcher.png
new file mode 100755
index 000000000..ab80bcd13
--- /dev/null
+++ b/samples/browseable/Timer/Application/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/Timer/Application/res/layout/activity_main.xml b/samples/browseable/Timer/Application/res/layout/activity_main.xml
new file mode 100755
index 000000000..be1aa49d9
--- /dev/null
+++ b/samples/browseable/Timer/Application/res/layout/activity_main.xml
@@ -0,0 +1,36 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <LinearLayout style="@style/Widget.SampleMessageTile"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView style="@style/Widget.SampleMessage"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="@dimen/horizontal_page_margin"
+ android:layout_marginRight="@dimen/horizontal_page_margin"
+ android:layout_marginTop="@dimen/vertical_page_margin"
+ android:layout_marginBottom="@dimen/vertical_page_margin"
+ android:text="@string/intro_message" />
+ </LinearLayout>
+</LinearLayout>
diff --git a/samples/browseable/Timer/Application/res/values-sw600dp/template-dimens.xml b/samples/browseable/Timer/Application/res/values-sw600dp/template-dimens.xml
new file mode 100644
index 000000000..22074a2bd
--- /dev/null
+++ b/samples/browseable/Timer/Application/res/values-sw600dp/template-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>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_huge</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/Timer/Application/res/values-sw600dp/template-styles.xml b/samples/browseable/Timer/Application/res/values-sw600dp/template-styles.xml
new file mode 100644
index 000000000..03d197418
--- /dev/null
+++ b/samples/browseable/Timer/Application/res/values-sw600dp/template-styles.xml
@@ -0,0 +1,25 @@
+<!--
+ 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.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceLarge</item>
+ <item name="android:lineSpacingMultiplier">1.2</item>
+ <item name="android:shadowDy">-6.5</item>
+ </style>
+
+</resources>
diff --git a/samples/browseable/Timer/Application/res/values-v11/template-styles.xml b/samples/browseable/Timer/Application/res/values-v11/template-styles.xml
new file mode 100644
index 000000000..8c1ea66f2
--- /dev/null
+++ b/samples/browseable/Timer/Application/res/values-v11/template-styles.xml
@@ -0,0 +1,22 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Holo.Light" />
+
+</resources>
diff --git a/samples/browseable/Timer/Application/res/values-v21/base-colors.xml b/samples/browseable/Timer/Application/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/Timer/Application/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/Timer/Application/res/values-v21/base-template-styles.xml b/samples/browseable/Timer/Application/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/Timer/Application/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/Timer/Application/res/values/base-strings.xml b/samples/browseable/Timer/Application/res/values/base-strings.xml
new file mode 100644
index 000000000..0ccfd5093
--- /dev/null
+++ b/samples/browseable/Timer/Application/res/values/base-strings.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>
+ <string name="app_name">Timer</string>
+ <string name="intro_message">
+ <![CDATA[
+
+
+ This simple wearable app allows the user to set a countdown timer. It runs
+ independently on the wearable with no phone connection.
+
+
+ ]]>
+ </string>
+</resources>
diff --git a/samples/browseable/Timer/Application/res/values/template-dimens.xml b/samples/browseable/Timer/Application/res/values/template-dimens.xml
new file mode 100644
index 000000000..39e710b5c
--- /dev/null
+++ b/samples/browseable/Timer/Application/res/values/template-dimens.xml
@@ -0,0 +1,32 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Define standard dimensions to comply with Holo-style grids and rhythm. -->
+
+ <dimen name="margin_tiny">4dp</dimen>
+ <dimen name="margin_small">8dp</dimen>
+ <dimen name="margin_medium">16dp</dimen>
+ <dimen name="margin_large">32dp</dimen>
+ <dimen name="margin_huge">64dp</dimen>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_medium</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/Timer/Application/res/values/template-styles.xml b/samples/browseable/Timer/Application/res/values/template-styles.xml
new file mode 100644
index 000000000..6e7d593dd
--- /dev/null
+++ b/samples/browseable/Timer/Application/res/values/template-styles.xml
@@ -0,0 +1,42 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+
+ <style name="Theme.Base" parent="android:Theme.Light" />
+
+ <style name="Theme.Sample" parent="Theme.Base" />
+
+ <style name="AppTheme" parent="Theme.Sample" />
+ <!-- Widget styling -->
+
+ <style name="Widget" />
+
+ <style name="Widget.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceMedium</item>
+ <item name="android:lineSpacingMultiplier">1.1</item>
+ </style>
+
+ <style name="Widget.SampleMessageTile">
+ <item name="android:background">@drawable/tile</item>
+ <item name="android:shadowColor">#7F000000</item>
+ <item name="android:shadowDy">-3.5</item>
+ <item name="android:shadowRadius">2</item>
+ </style>
+
+</resources>
diff --git a/samples/browseable/Timer/Wearable/AndroidManifest.xml b/samples/browseable/Timer/Wearable/AndroidManifest.xml
new file mode 100644
index 000000000..364fb5a68
--- /dev/null
+++ b/samples/browseable/Timer/Wearable/AndroidManifest.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.wearable.timer" >
+
+ <uses-sdk android:minSdkVersion="20"
+ android:targetSdkVersion="21" />
+
+ <uses-feature android:name="android.hardware.type.watch" />
+
+ <application
+ android:icon="@mipmap/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@android:style/Theme.DeviceDefault.Light"
+ android:allowBackup="true">
+
+ <!-- Timer components -->
+ <activity android:name=".SetTimerActivity">
+ <intent-filter>
+ <action android:name="com.android.example.clockwork.timer.TIMER"/>
+ <category android:name="android.intent.category.DEFAULT"/>
+ </intent-filter>
+ <!-- Set a timer voice command -->
+ <intent-filter>
+ <action android:name="android.intent.action.SET_TIMER"/>
+ <category android:name="android.intent.category.DEFAULT"/>
+ </intent-filter>
+ </activity>
+
+ <service android:name=".TimerNotificationService" />
+
+ </application>
+</manifest>
diff --git a/samples/wearable/Timer/Wearable/src/main/res/drawable/ic_cc_alarm.png b/samples/browseable/Timer/Wearable/res/drawable/ic_cc_alarm.png
index ad51ddf4d..ad51ddf4d 100644
--- a/samples/wearable/Timer/Wearable/src/main/res/drawable/ic_cc_alarm.png
+++ b/samples/browseable/Timer/Wearable/res/drawable/ic_cc_alarm.png
Binary files differ
diff --git a/samples/browseable/Timer/Wearable/res/drawable/wl_circle.xml b/samples/browseable/Timer/Wearable/res/drawable/wl_circle.xml
new file mode 100644
index 000000000..a06c53a8d
--- /dev/null
+++ b/samples/browseable/Timer/Wearable/res/drawable/wl_circle.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="oval">
+ <solid android:color="@color/wl_gray"/>
+</shape>
diff --git a/samples/wearable/Timer/Wearable/src/main/res/layout/timer_list_item.xml b/samples/browseable/Timer/Wearable/res/layout/timer_list_item.xml
index 6cef07a2b..6cef07a2b 100644
--- a/samples/wearable/Timer/Wearable/src/main/res/layout/timer_list_item.xml
+++ b/samples/browseable/Timer/Wearable/res/layout/timer_list_item.xml
diff --git a/samples/wearable/Timer/Wearable/src/main/res/layout/timer_set_timer.xml b/samples/browseable/Timer/Wearable/res/layout/timer_set_timer.xml
index cdf9e77e2..cdf9e77e2 100644
--- a/samples/wearable/Timer/Wearable/src/main/res/layout/timer_set_timer.xml
+++ b/samples/browseable/Timer/Wearable/res/layout/timer_set_timer.xml
diff --git a/samples/wearable/Timer/Wearable/src/main/res/mipmap-hdpi/ic_launcher.png b/samples/browseable/Timer/Wearable/res/mipmap-hdpi/ic_launcher.png
index 56f7fc168..56f7fc168 100644
--- a/samples/wearable/Timer/Wearable/src/main/res/mipmap-hdpi/ic_launcher.png
+++ b/samples/browseable/Timer/Wearable/res/mipmap-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/Timer/Wearable/src/main/res/mipmap-mdpi/ic_launcher.png b/samples/browseable/Timer/Wearable/res/mipmap-mdpi/ic_launcher.png
index dec99cdfe..dec99cdfe 100644
--- a/samples/wearable/Timer/Wearable/src/main/res/mipmap-mdpi/ic_launcher.png
+++ b/samples/browseable/Timer/Wearable/res/mipmap-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/Timer/Wearable/src/main/res/mipmap-xhdpi/ic_launcher.png b/samples/browseable/Timer/Wearable/res/mipmap-xhdpi/ic_launcher.png
index 48fa0abf7..48fa0abf7 100644
--- a/samples/wearable/Timer/Wearable/src/main/res/mipmap-xhdpi/ic_launcher.png
+++ b/samples/browseable/Timer/Wearable/res/mipmap-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/Timer/Wearable/src/main/res/mipmap-xxhdpi/ic_launcher.png b/samples/browseable/Timer/Wearable/res/mipmap-xxhdpi/ic_launcher.png
index 817392194..817392194 100644
--- a/samples/wearable/Timer/Wearable/src/main/res/mipmap-xxhdpi/ic_launcher.png
+++ b/samples/browseable/Timer/Wearable/res/mipmap-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/Timer/Wearable/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/samples/browseable/Timer/Wearable/res/mipmap-xxxhdpi/ic_launcher.png
index 0dce80932..0dce80932 100644
--- a/samples/wearable/Timer/Wearable/src/main/res/mipmap-xxxhdpi/ic_launcher.png
+++ b/samples/browseable/Timer/Wearable/res/mipmap-xxxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/Timer/Wearable/src/main/res/values/colors.xml b/samples/browseable/Timer/Wearable/res/values/colors.xml
index a8bb87b7e..a8bb87b7e 100644
--- a/samples/wearable/Timer/Wearable/src/main/res/values/colors.xml
+++ b/samples/browseable/Timer/Wearable/res/values/colors.xml
diff --git a/samples/wearable/Timer/Wearable/src/main/res/values/integers.xml b/samples/browseable/Timer/Wearable/res/values/integers.xml
index c3bc25215..c3bc25215 100644
--- a/samples/wearable/Timer/Wearable/src/main/res/values/integers.xml
+++ b/samples/browseable/Timer/Wearable/res/values/integers.xml
diff --git a/samples/wearable/Timer/Wearable/src/main/res/values/strings.xml b/samples/browseable/Timer/Wearable/res/values/strings.xml
index f7e05bb44..f7e05bb44 100644
--- a/samples/wearable/Timer/Wearable/src/main/res/values/strings.xml
+++ b/samples/browseable/Timer/Wearable/res/values/strings.xml
diff --git a/samples/wearable/Timer/Wearable/src/main/java/com/example/android/wearable/timer/SetTimerActivity.java b/samples/browseable/Timer/Wearable/src/com.example.android.wearable.timer/SetTimerActivity.java
index f660f9ff1..f660f9ff1 100644
--- a/samples/wearable/Timer/Wearable/src/main/java/com/example/android/wearable/timer/SetTimerActivity.java
+++ b/samples/browseable/Timer/Wearable/src/com.example.android.wearable.timer/SetTimerActivity.java
diff --git a/samples/wearable/Timer/Wearable/src/main/java/com/example/android/wearable/timer/TimerNotificationService.java b/samples/browseable/Timer/Wearable/src/com.example.android.wearable.timer/TimerNotificationService.java
index 5822fe410..5822fe410 100644
--- a/samples/wearable/Timer/Wearable/src/main/java/com/example/android/wearable/timer/TimerNotificationService.java
+++ b/samples/browseable/Timer/Wearable/src/com.example.android.wearable.timer/TimerNotificationService.java
diff --git a/samples/browseable/Timer/Wearable/src/com.example.android.wearable.timer/WearableListItemLayout.java b/samples/browseable/Timer/Wearable/src/com.example.android.wearable.timer/WearableListItemLayout.java
new file mode 100644
index 000000000..09591bf42
--- /dev/null
+++ b/samples/browseable/Timer/Wearable/src/com.example.android.wearable.timer/WearableListItemLayout.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2014 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.wearable.timer;
+
+import android.content.Context;
+import android.graphics.drawable.GradientDrawable;
+import android.support.wearable.view.WearableListView;
+import android.util.AttributeSet;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+public class WearableListItemLayout extends LinearLayout
+ implements WearableListView.OnCenterProximityListener {
+ private final float mFadedTextAlpha;
+ private final int mFadedCircleColor;
+ private final int mChosenCircleColor;
+ private ImageView mCircle;
+ private TextView mName;
+
+ public WearableListItemLayout(Context context) {
+ this(context, null);
+ }
+
+ public WearableListItemLayout(Context context, AttributeSet attrs) {
+ this(context, attrs, 0);
+ }
+
+ public WearableListItemLayout(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ mFadedTextAlpha = getResources().getInteger(R.integer.action_text_faded_alpha) / 100f;
+ mFadedCircleColor = getResources().getColor(R.color.wl_gray);
+ mChosenCircleColor = getResources().getColor(R.color.wl_blue);
+ }
+
+ @Override
+ protected void onFinishInflate() {
+ super.onFinishInflate();
+ mCircle = (ImageView) findViewById(R.id.circle);
+ mName = (TextView) findViewById(R.id.time_text);
+ }
+
+ @Override
+ public void onCenterPosition(boolean animate) {
+ mName.setAlpha(1f);
+ ((GradientDrawable) mCircle.getDrawable()).setColor(mChosenCircleColor);
+ }
+
+ @Override
+ public void onNonCenterPosition(boolean animate) {
+ ((GradientDrawable) mCircle.getDrawable()).setColor(mFadedCircleColor);
+ mName.setAlpha(mFadedTextAlpha);
+ }
+}
diff --git a/samples/wearable/Timer/Wearable/src/main/java/com/example/android/wearable/timer/util/Constants.java b/samples/browseable/Timer/Wearable/src/com.example.android.wearable.timer/util/Constants.java
index 85885e415..85885e415 100644
--- a/samples/wearable/Timer/Wearable/src/main/java/com/example/android/wearable/timer/util/Constants.java
+++ b/samples/browseable/Timer/Wearable/src/com.example.android.wearable.timer/util/Constants.java
diff --git a/samples/wearable/Timer/Wearable/src/main/java/com/example/android/wearable/timer/util/TimerFormat.java b/samples/browseable/Timer/Wearable/src/com.example.android.wearable.timer/util/TimerFormat.java
index b40351ba4..b40351ba4 100644
--- a/samples/wearable/Timer/Wearable/src/main/java/com/example/android/wearable/timer/util/TimerFormat.java
+++ b/samples/browseable/Timer/Wearable/src/com.example.android.wearable.timer/util/TimerFormat.java
diff --git a/samples/wearable/Timer/Wearable/src/main/java/com/example/android/wearable/timer/util/TimerObj.java b/samples/browseable/Timer/Wearable/src/com.example.android.wearable.timer/util/TimerObj.java
index 52f7244c8..52f7244c8 100644
--- a/samples/wearable/Timer/Wearable/src/main/java/com/example/android/wearable/timer/util/TimerObj.java
+++ b/samples/browseable/Timer/Wearable/src/com.example.android.wearable.timer/util/TimerObj.java
diff --git a/samples/browseable/Timer/_index.jd b/samples/browseable/Timer/_index.jd
new file mode 100644
index 000000000..68941eff7
--- /dev/null
+++ b/samples/browseable/Timer/_index.jd
@@ -0,0 +1,10 @@
+page.tags="Timer"
+sample.group=Wearable
+@jd:body
+
+<p>
+
+ This simple wearable app allows the user to set a countdown timer. It runs
+ independently on the wearable with no phone connection.
+
+ </p>
diff --git a/samples/browseable/WatchFace/Application/AndroidManifest.xml b/samples/browseable/WatchFace/Application/AndroidManifest.xml
new file mode 100644
index 000000000..732e3061b
--- /dev/null
+++ b/samples/browseable/WatchFace/Application/AndroidManifest.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.wearable.watchface" >
+
+ <uses-sdk android:minSdkVersion="18"
+ android:targetSdkVersion="21" />
+
+ <!-- Permissions required by the wearable app -->
+ <uses-permission android:name="com.google.android.permission.PROVIDE_BACKGROUND" />
+ <uses-permission android:name="android.permission.WAKE_LOCK" />
+ <uses-permission android:name="android.permission.READ_CALENDAR" />
+
+ <!-- All intent-filters for config actions must include the categories
+ com.google.android.wearable.watchface.category.COMPANION_CONFIGURATION and
+ android.intent.category.DEFAULT. -->
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@style/AppTheme" >
+
+ <activity
+ android:name=".AnalogAndCardBoundsWatchFaceConfigActivity"
+ android:label="@string/app_name">
+ <intent-filter>
+ <action android:name="com.example.android.wearable.watchface.CONFIG_ANALOG" />
+ <action android:name="com.example.android.wearable.watchface.CONFIG_CARD_BOUNDS" />
+ <category android:name="com.google.android.wearable.watchface.category.COMPANION_CONFIGURATION" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ </activity>
+
+ <activity
+ android:name=".DigitalWatchFaceCompanionConfigActivity"
+ android:label="@string/app_name">
+ <intent-filter>
+ <action android:name="com.example.android.wearable.watchface.CONFIG_DIGITAL" />
+ <category android:name="com.google.android.wearable.watchface.category.COMPANION_CONFIGURATION" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ </activity>
+
+ <activity
+ android:name=".TiltWatchFaceConfigActivity"
+ android:label="@string/app_name">
+ <intent-filter>
+ <action android:name="com.example.android.wearable.watchface.CONFIG_TILT" />
+ <category android:name="com.google.android.wearable.watchface.category.COMPANION_CONFIGURATION" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ </activity>
+
+ <meta-data
+ android:name="com.google.android.gms.version"
+ android:value="@integer/google_play_services_version" />
+
+ </application>
+
+</manifest>
diff --git a/samples/browseable/WatchFace/Application/res/drawable-hdpi/ic_launcher.png b/samples/browseable/WatchFace/Application/res/drawable-hdpi/ic_launcher.png
new file mode 100755
index 000000000..589f229d1
--- /dev/null
+++ b/samples/browseable/WatchFace/Application/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/WatchFace/Application/res/drawable-hdpi/tile.9.png b/samples/browseable/WatchFace/Application/res/drawable-hdpi/tile.9.png
new file mode 100644
index 000000000..135862883
--- /dev/null
+++ b/samples/browseable/WatchFace/Application/res/drawable-hdpi/tile.9.png
Binary files differ
diff --git a/samples/browseable/WatchFace/Application/res/drawable-mdpi/ic_launcher.png b/samples/browseable/WatchFace/Application/res/drawable-mdpi/ic_launcher.png
new file mode 100755
index 000000000..77dd57139
--- /dev/null
+++ b/samples/browseable/WatchFace/Application/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/WatchFace/Application/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/WatchFace/Application/res/drawable-xhdpi/ic_launcher.png
new file mode 100755
index 000000000..fe34ebe13
--- /dev/null
+++ b/samples/browseable/WatchFace/Application/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/WatchFace/Application/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/WatchFace/Application/res/drawable-xxhdpi/ic_launcher.png
new file mode 100755
index 000000000..ab80bcd13
--- /dev/null
+++ b/samples/browseable/WatchFace/Application/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/WatchFace/Application/res/layout/activity_analog_watch_face_config.xml b/samples/browseable/WatchFace/Application/res/layout/activity_analog_watch_face_config.xml
new file mode 100644
index 000000000..ec816c22e
--- /dev/null
+++ b/samples/browseable/WatchFace/Application/res/layout/activity_analog_watch_face_config.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <TextView
+ android:id="@+id/label"
+ android:text="@string/analog_config_text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
+
+</FrameLayout>
diff --git a/samples/browseable/WatchFace/Application/res/layout/activity_digital_watch_face_config.xml b/samples/browseable/WatchFace/Application/res/layout/activity_digital_watch_face_config.xml
new file mode 100644
index 000000000..204d523d3
--- /dev/null
+++ b/samples/browseable/WatchFace/Application/res/layout/activity_digital_watch_face_config.xml
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <TextView
+ android:id="@+id/label"
+ android:text="@string/digital_config_text"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+ <TextView
+ android:text="@string/digital_config_background"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1" />
+ <Spinner
+ android:id="@+id/background"
+ android:entries="@array/color_array"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="3" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+ <TextView
+ android:text="@string/digital_config_hours"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1" />
+ <Spinner
+ android:id="@+id/hours"
+ android:entries="@array/color_array"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="3" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+ <TextView
+ android:text="@string/digital_config_minutes"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1" />
+ <Spinner
+ android:id="@+id/minutes"
+ android:entries="@array/color_array"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="3" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+ <TextView
+ android:text="@string/digital_config_seconds"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1" />
+ <Spinner
+ android:id="@+id/seconds"
+ android:entries="@array/color_array"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="3" />
+ </LinearLayout>
+
+</LinearLayout>
diff --git a/samples/browseable/WatchFace/Application/res/layout/activity_main.xml b/samples/browseable/WatchFace/Application/res/layout/activity_main.xml
new file mode 100755
index 000000000..be1aa49d9
--- /dev/null
+++ b/samples/browseable/WatchFace/Application/res/layout/activity_main.xml
@@ -0,0 +1,36 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <LinearLayout style="@style/Widget.SampleMessageTile"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView style="@style/Widget.SampleMessage"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="@dimen/horizontal_page_margin"
+ android:layout_marginRight="@dimen/horizontal_page_margin"
+ android:layout_marginTop="@dimen/vertical_page_margin"
+ android:layout_marginBottom="@dimen/vertical_page_margin"
+ android:text="@string/intro_message" />
+ </LinearLayout>
+</LinearLayout>
diff --git a/samples/browseable/WatchFace/Application/res/layout/activity_tilt_watch_face_config.xml b/samples/browseable/WatchFace/Application/res/layout/activity_tilt_watch_face_config.xml
new file mode 100644
index 000000000..bda2d686e
--- /dev/null
+++ b/samples/browseable/WatchFace/Application/res/layout/activity_tilt_watch_face_config.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <TextView
+ android:id="@+id/label"
+ android:text="@string/tilt_config_text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
+
+</FrameLayout>
diff --git a/samples/browseable/WatchFace/Application/res/values-sw600dp/template-dimens.xml b/samples/browseable/WatchFace/Application/res/values-sw600dp/template-dimens.xml
new file mode 100644
index 000000000..22074a2bd
--- /dev/null
+++ b/samples/browseable/WatchFace/Application/res/values-sw600dp/template-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>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_huge</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/WatchFace/Application/res/values-sw600dp/template-styles.xml b/samples/browseable/WatchFace/Application/res/values-sw600dp/template-styles.xml
new file mode 100644
index 000000000..03d197418
--- /dev/null
+++ b/samples/browseable/WatchFace/Application/res/values-sw600dp/template-styles.xml
@@ -0,0 +1,25 @@
+<!--
+ 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.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceLarge</item>
+ <item name="android:lineSpacingMultiplier">1.2</item>
+ <item name="android:shadowDy">-6.5</item>
+ </style>
+
+</resources>
diff --git a/samples/browseable/WatchFace/Application/res/values-v11/template-styles.xml b/samples/browseable/WatchFace/Application/res/values-v11/template-styles.xml
new file mode 100644
index 000000000..8c1ea66f2
--- /dev/null
+++ b/samples/browseable/WatchFace/Application/res/values-v11/template-styles.xml
@@ -0,0 +1,22 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Holo.Light" />
+
+</resources>
diff --git a/samples/browseable/WatchFace/Application/res/values-v21/base-colors.xml b/samples/browseable/WatchFace/Application/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/WatchFace/Application/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/WatchFace/Application/res/values-v21/base-template-styles.xml b/samples/browseable/WatchFace/Application/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/WatchFace/Application/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/WatchFace/Application/res/values/base-strings.xml b/samples/browseable/WatchFace/Application/res/values/base-strings.xml
new file mode 100644
index 000000000..5108f618e
--- /dev/null
+++ b/samples/browseable/WatchFace/Application/res/values/base-strings.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<resources>
+ <string name="app_name">WatchFace</string>
+ <string name="intro_message">
+ <![CDATA[
+
+
+This sample demonstrates how to create watch faces for android wear and includes a phone app
+and a wearable app. The wearable app has a variety of watch faces including analog, digital,
+opengl, calendar, etc. It also includes a watch-side configuration example. The phone app
+includes a phone-side configuration example.
+
+
+ ]]>
+ </string>
+</resources>
diff --git a/samples/browseable/WatchFace/Application/res/values/strings.xml b/samples/browseable/WatchFace/Application/res/values/strings.xml
new file mode 100644
index 000000000..aacb108e5
--- /dev/null
+++ b/samples/browseable/WatchFace/Application/res/values/strings.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<resources>
+ <string name="analog_config_text">This is the config activity for the Analog and Card Bounds watch faces</string>
+ <string name="digital_config_text">Digital watch face configuration</string>
+ <string name="tilt_config_text">Tilt watch face configuration</string>
+ <string name="digital_config_background">Background</string>
+ <string name="digital_config_hours">Hours</string>
+ <string name="digital_config_minutes">Minutes</string>
+ <string name="digital_config_seconds">Seconds</string>
+
+ <string name="title_no_device_connected">No wearable device is currently connected.</string>
+ <string name="ok_no_device_connected">OK</string>
+
+ <string name="color_black">Black</string>
+ <string name="color_blue">Blue</string>
+ <string name="color_gray">Gray</string>
+ <string name="color_green">Green</string>
+ <string name="color_navy">Navy</string>
+ <string name="color_red">Red</string>
+ <string name="color_white">White</string>
+
+ <string-array name="color_array">
+ <item>@string/color_black</item>
+ <item>@string/color_blue</item>
+ <item>@string/color_gray</item>
+ <item>@string/color_green</item>
+ <item>@string/color_navy</item>
+ <item>@string/color_red</item>
+ <item>@string/color_white</item>
+ </string-array>
+</resources>
diff --git a/samples/browseable/WatchFace/Application/res/values/template-dimens.xml b/samples/browseable/WatchFace/Application/res/values/template-dimens.xml
new file mode 100644
index 000000000..39e710b5c
--- /dev/null
+++ b/samples/browseable/WatchFace/Application/res/values/template-dimens.xml
@@ -0,0 +1,32 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Define standard dimensions to comply with Holo-style grids and rhythm. -->
+
+ <dimen name="margin_tiny">4dp</dimen>
+ <dimen name="margin_small">8dp</dimen>
+ <dimen name="margin_medium">16dp</dimen>
+ <dimen name="margin_large">32dp</dimen>
+ <dimen name="margin_huge">64dp</dimen>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_medium</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/WatchFace/Application/res/values/template-styles.xml b/samples/browseable/WatchFace/Application/res/values/template-styles.xml
new file mode 100644
index 000000000..6e7d593dd
--- /dev/null
+++ b/samples/browseable/WatchFace/Application/res/values/template-styles.xml
@@ -0,0 +1,42 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+
+ <style name="Theme.Base" parent="android:Theme.Light" />
+
+ <style name="Theme.Sample" parent="Theme.Base" />
+
+ <style name="AppTheme" parent="Theme.Sample" />
+ <!-- Widget styling -->
+
+ <style name="Widget" />
+
+ <style name="Widget.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceMedium</item>
+ <item name="android:lineSpacingMultiplier">1.1</item>
+ </style>
+
+ <style name="Widget.SampleMessageTile">
+ <item name="android:background">@drawable/tile</item>
+ <item name="android:shadowColor">#7F000000</item>
+ <item name="android:shadowDy">-3.5</item>
+ <item name="android:shadowRadius">2</item>
+ </style>
+
+</resources>
diff --git a/samples/browseable/WatchFace/Application/src/com.example.android.wearable.watchface/AnalogAndCardBoundsWatchFaceConfigActivity.java b/samples/browseable/WatchFace/Application/src/com.example.android.wearable.watchface/AnalogAndCardBoundsWatchFaceConfigActivity.java
new file mode 100644
index 000000000..5943e6b13
--- /dev/null
+++ b/samples/browseable/WatchFace/Application/src/com.example.android.wearable.watchface/AnalogAndCardBoundsWatchFaceConfigActivity.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 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.wearable.watchface;
+
+import android.app.Activity;
+import android.content.ComponentName;
+import android.os.Bundle;
+import android.support.wearable.companion.WatchFaceCompanion;
+import android.widget.TextView;
+
+public class AnalogAndCardBoundsWatchFaceConfigActivity extends Activity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_analog_watch_face_config);
+
+ ComponentName name =
+ getIntent().getParcelableExtra(WatchFaceCompanion.EXTRA_WATCH_FACE_COMPONENT);
+ TextView label = (TextView) findViewById(R.id.label);
+ label.setText(label.getText() + " (" + name.getClassName() + ")");
+ }
+}
diff --git a/samples/browseable/WatchFace/Application/src/com.example.android.wearable.watchface/DigitalWatchFaceCompanionConfigActivity.java b/samples/browseable/WatchFace/Application/src/com.example.android.wearable.watchface/DigitalWatchFaceCompanionConfigActivity.java
new file mode 100644
index 000000000..b04f11ee4
--- /dev/null
+++ b/samples/browseable/WatchFace/Application/src/com.example.android.wearable.watchface/DigitalWatchFaceCompanionConfigActivity.java
@@ -0,0 +1,217 @@
+/*
+ * Copyright (C) 2014 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.wearable.watchface;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.ComponentName;
+import android.content.DialogInterface;
+import android.graphics.Color;
+import android.net.Uri;
+import android.os.Bundle;
+import android.support.wearable.companion.WatchFaceCompanion;
+import android.util.Log;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.Spinner;
+import android.widget.TextView;
+
+import com.google.android.gms.common.ConnectionResult;
+import com.google.android.gms.common.api.GoogleApiClient;
+import com.google.android.gms.common.api.ResultCallback;
+import com.google.android.gms.wearable.DataApi;
+import com.google.android.gms.wearable.DataItem;
+import com.google.android.gms.wearable.DataMap;
+import com.google.android.gms.wearable.DataMapItem;
+import com.google.android.gms.wearable.Wearable;
+
+/**
+ * The phone-side config activity for {@code DigitalWatchFaceService}. Like the watch-side config
+ * activity ({@code DigitalWatchFaceWearableConfigActivity}), allows for setting the background
+ * color. Additionally, enables setting the color for hour, minute and second digits.
+ */
+public class DigitalWatchFaceCompanionConfigActivity extends Activity
+ implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener,
+ ResultCallback<DataApi.DataItemResult> {
+ private static final String TAG = "DigitalWatchFaceConfig";
+
+ // TODO: use the shared constants (needs covering all the samples with Gradle build model)
+ private static final String KEY_BACKGROUND_COLOR = "BACKGROUND_COLOR";
+ private static final String KEY_HOURS_COLOR = "HOURS_COLOR";
+ private static final String KEY_MINUTES_COLOR = "MINUTES_COLOR";
+ private static final String KEY_SECONDS_COLOR = "SECONDS_COLOR";
+ private static final String PATH_WITH_FEATURE = "/watch_face_config/Digital";
+
+ private GoogleApiClient mGoogleApiClient;
+ private String mPeerId;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_digital_watch_face_config);
+
+ mPeerId = getIntent().getStringExtra(WatchFaceCompanion.EXTRA_PEER_ID);
+ mGoogleApiClient = new GoogleApiClient.Builder(this)
+ .addConnectionCallbacks(this)
+ .addOnConnectionFailedListener(this)
+ .addApi(Wearable.API)
+ .build();
+
+ ComponentName name = getIntent().getParcelableExtra(
+ WatchFaceCompanion.EXTRA_WATCH_FACE_COMPONENT);
+ TextView label = (TextView)findViewById(R.id.label);
+ label.setText(label.getText() + " (" + name.getClassName() + ")");
+ }
+
+ @Override
+ protected void onStart() {
+ super.onStart();
+ mGoogleApiClient.connect();
+ }
+
+ @Override
+ protected void onStop() {
+ if (mGoogleApiClient != null && mGoogleApiClient.isConnected()) {
+ mGoogleApiClient.disconnect();
+ }
+ super.onStop();
+ }
+
+ @Override // GoogleApiClient.ConnectionCallbacks
+ public void onConnected(Bundle connectionHint) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onConnected: " + connectionHint);
+ }
+
+ if (mPeerId != null) {
+ Uri.Builder builder = new Uri.Builder();
+ Uri uri = builder.scheme("wear").path(PATH_WITH_FEATURE).authority(mPeerId).build();
+ Wearable.DataApi.getDataItem(mGoogleApiClient, uri).setResultCallback(this);
+ } else {
+ displayNoConnectedDeviceDialog();
+ }
+ }
+
+ @Override // ResultCallback<DataApi.DataItemResult>
+ public void onResult(DataApi.DataItemResult dataItemResult) {
+ if (dataItemResult.getStatus().isSuccess() && dataItemResult.getDataItem() != null) {
+ DataItem configDataItem = dataItemResult.getDataItem();
+ DataMapItem dataMapItem = DataMapItem.fromDataItem(configDataItem);
+ DataMap config = dataMapItem.getDataMap();
+ setUpAllPickers(config);
+ } else {
+ // If DataItem with the current config can't be retrieved, select the default items on
+ // each picker.
+ setUpAllPickers(null);
+ }
+ }
+
+ @Override // GoogleApiClient.ConnectionCallbacks
+ public void onConnectionSuspended(int cause) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onConnectionSuspended: " + cause);
+ }
+ }
+
+ @Override // GoogleApiClient.OnConnectionFailedListener
+ public void onConnectionFailed(ConnectionResult result) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onConnectionFailed: " + result);
+ }
+ }
+
+ private void displayNoConnectedDeviceDialog() {
+ AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ String messageText = getResources().getString(R.string.title_no_device_connected);
+ String okText = getResources().getString(R.string.ok_no_device_connected);
+ builder.setMessage(messageText)
+ .setCancelable(false)
+ .setPositiveButton(okText, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int id) { }
+ });
+ AlertDialog alert = builder.create();
+ alert.show();
+ }
+
+ /**
+ * Sets up selected items for all pickers according to given {@code config} and sets up their
+ * item selection listeners.
+ *
+ * @param config the {@code DigitalWatchFaceService} config {@link DataMap}. If null, the
+ * default items are selected.
+ */
+ private void setUpAllPickers(DataMap config) {
+ setUpColorPickerSelection(R.id.background, KEY_BACKGROUND_COLOR, config,
+ R.string.color_black);
+ setUpColorPickerSelection(R.id.hours, KEY_HOURS_COLOR, config, R.string.color_white);
+ setUpColorPickerSelection(R.id.minutes, KEY_MINUTES_COLOR, config, R.string.color_white);
+ setUpColorPickerSelection(R.id.seconds, KEY_SECONDS_COLOR, config, R.string.color_gray);
+
+ setUpColorPickerListener(R.id.background, KEY_BACKGROUND_COLOR);
+ setUpColorPickerListener(R.id.hours, KEY_HOURS_COLOR);
+ setUpColorPickerListener(R.id.minutes, KEY_MINUTES_COLOR);
+ setUpColorPickerListener(R.id.seconds, KEY_SECONDS_COLOR);
+ }
+
+ private void setUpColorPickerSelection(int spinnerId, final String configKey, DataMap config,
+ int defaultColorNameResId) {
+ String defaultColorName = getString(defaultColorNameResId);
+ int defaultColor = Color.parseColor(defaultColorName);
+ int color;
+ if (config != null) {
+ color = config.getInt(configKey, defaultColor);
+ } else {
+ color = defaultColor;
+ }
+ Spinner spinner = (Spinner) findViewById(spinnerId);
+ String[] colorNames = getResources().getStringArray(R.array.color_array);
+ for (int i = 0; i < colorNames.length; i++) {
+ if (Color.parseColor(colorNames[i]) == color) {
+ spinner.setSelection(i);
+ break;
+ }
+ }
+ }
+
+ private void setUpColorPickerListener(int spinnerId, final String configKey) {
+ Spinner spinner = (Spinner) findViewById(spinnerId);
+ spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+ @Override
+ public void onItemSelected(AdapterView<?> adapterView, View view, int pos, long id) {
+ final String colorName = (String) adapterView.getItemAtPosition(pos);
+ sendConfigUpdateMessage(configKey, Color.parseColor(colorName));
+ }
+
+ @Override
+ public void onNothingSelected(AdapterView<?> adapterView) { }
+ });
+ }
+
+ private void sendConfigUpdateMessage(String configKey, int color) {
+ if (mPeerId != null) {
+ DataMap config = new DataMap();
+ config.putInt(configKey, color);
+ byte[] rawData = config.toByteArray();
+ Wearable.MessageApi.sendMessage(mGoogleApiClient, mPeerId, PATH_WITH_FEATURE, rawData);
+
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "Sent watch face config message: " + configKey + " -> "
+ + Integer.toHexString(color));
+ }
+ }
+ }
+}
diff --git a/samples/browseable/WatchFace/Application/src/com.example.android.wearable.watchface/TiltWatchFaceConfigActivity.java b/samples/browseable/WatchFace/Application/src/com.example.android.wearable.watchface/TiltWatchFaceConfigActivity.java
new file mode 100644
index 000000000..303e72ea5
--- /dev/null
+++ b/samples/browseable/WatchFace/Application/src/com.example.android.wearable.watchface/TiltWatchFaceConfigActivity.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 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.wearable.watchface;
+
+import android.app.Activity;
+import android.content.ComponentName;
+import android.os.Bundle;
+import android.support.wearable.companion.WatchFaceCompanion;
+import android.widget.TextView;
+
+public class TiltWatchFaceConfigActivity extends Activity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_tilt_watch_face_config);
+
+ ComponentName name =
+ getIntent().getParcelableExtra(WatchFaceCompanion.EXTRA_WATCH_FACE_COMPONENT);
+ TextView label = (TextView)findViewById(R.id.label);
+ label.setText(label.getText() + " (" + name.getClassName() + ")");
+ }
+}
diff --git a/samples/browseable/WatchFace/Wearable/AndroidManifest.xml b/samples/browseable/WatchFace/Wearable/AndroidManifest.xml
new file mode 100644
index 000000000..ee906b763
--- /dev/null
+++ b/samples/browseable/WatchFace/Wearable/AndroidManifest.xml
@@ -0,0 +1,205 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.wearable.watchface" >
+
+ <uses-sdk android:minSdkVersion="21"
+ android:targetSdkVersion="21" />
+
+ <uses-feature android:name="android.hardware.type.watch" />
+
+ <!-- Required to act as a custom watch face. -->
+ <uses-permission android:name="com.google.android.permission.PROVIDE_BACKGROUND" />
+ <uses-permission android:name="android.permission.WAKE_LOCK" />
+
+ <!-- Calendar permission used by CalendarWatchFaceService -->
+ <uses-permission android:name="android.permission.READ_CALENDAR" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name" >
+
+ <service
+ android:name=".AnalogWatchFaceService"
+ android:label="@string/analog_name"
+ android:allowEmbedded="true"
+ android:taskAffinity=""
+ android:permission="android.permission.BIND_WALLPAPER" >
+ <meta-data
+ android:name="android.service.wallpaper"
+ android:resource="@xml/watch_face" />
+ <meta-data
+ android:name="com.google.android.wearable.watchface.preview"
+ android:resource="@drawable/preview_analog" />
+ <meta-data
+ android:name="com.google.android.clockwork.home.preview_circular"
+ android:resource="@drawable/preview_analog_circular" />
+ <meta-data
+ android:name="com.google.android.wearable.watchface.companionConfigurationAction"
+ android:value="com.example.android.wearable.watchface.CONFIG_ANALOG" />
+ <intent-filter>
+ <action android:name="android.service.wallpaper.WallpaperService" />
+ <category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
+ </intent-filter>
+ </service>
+
+ <service
+ android:name=".SweepWatchFaceService"
+ android:label="@string/sweep_name"
+ android:allowEmbedded="true"
+ android:taskAffinity=""
+ android:permission="android.permission.BIND_WALLPAPER" >
+ <meta-data
+ android:name="android.service.wallpaper"
+ android:resource="@xml/watch_face" />
+ <meta-data
+ android:name="com.google.android.wearable.watchface.preview"
+ android:resource="@drawable/preview_analog" />
+ <meta-data
+ android:name="com.google.android.clockwork.home.preview_circular"
+ android:resource="@drawable/preview_analog_circular" />
+ <intent-filter>
+ <action android:name="android.service.wallpaper.WallpaperService" />
+ <category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
+ </intent-filter>
+ </service>
+
+ <service
+ android:name=".TiltWatchFaceService"
+ android:label="@string/tilt_name"
+ android:allowEmbedded="true"
+ android:taskAffinity=""
+ android:permission="android.permission.BIND_WALLPAPER" >
+ <meta-data
+ android:name="android.service.wallpaper"
+ android:resource="@xml/watch_face" />
+ <meta-data
+ android:name="com.google.android.wearable.watchface.preview"
+ android:resource="@drawable/preview_tilt" />
+ <meta-data
+ android:name="com.google.android.clockwork.home.preview_circular"
+ android:resource="@drawable/preview_tilt_circular" />
+ <meta-data
+ android:name="com.google.android.wearable.watchface.companionConfigurationAction"
+ android:value="com.example.android.wearable.watchface.CONFIG_TILT" />
+
+ <intent-filter>
+ <action android:name="android.service.wallpaper.WallpaperService" />
+ <category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
+ </intent-filter>
+ </service>
+
+ <service
+ android:name=".CardBoundsWatchFaceService"
+ android:label="@string/card_bounds_name"
+ android:allowEmbedded="true"
+ android:taskAffinity=""
+ android:permission="android.permission.BIND_WALLPAPER" >
+ <meta-data
+ android:name="android.service.wallpaper"
+ android:resource="@xml/watch_face" />
+ <meta-data
+ android:name="com.google.android.wearable.watchface.preview"
+ android:resource="@drawable/preview_card_bounds" />
+ <meta-data
+ android:name="com.google.android.clockwork.home.preview_circular"
+ android:resource="@drawable/preview_card_bounds_circular" />
+ <meta-data
+ android:name="com.google.android.wearable.watchface.companionConfigurationAction"
+ android:value="com.example.android.wearable.watchface.CONFIG_CARD_BOUNDS" />
+ <intent-filter>
+ <action android:name="android.service.wallpaper.WallpaperService" />
+ <category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
+ </intent-filter>
+ </service>
+
+ <service
+ android:name=".DigitalWatchFaceService"
+ android:label="@string/digital_name"
+ android:allowEmbedded="true"
+ android:taskAffinity=""
+ android:permission="android.permission.BIND_WALLPAPER" >
+ <meta-data
+ android:name="android.service.wallpaper"
+ android:resource="@xml/watch_face" />
+ <meta-data
+ android:name="com.google.android.wearable.watchface.preview"
+ android:resource="@drawable/preview_digital" />
+ <meta-data
+ android:name="com.google.android.clockwork.home.preview_circular"
+ android:resource="@drawable/preview_digital_circular" />
+ <meta-data
+ android:name="com.google.android.wearable.watchface.companionConfigurationAction"
+ android:value="com.example.android.wearable.watchface.CONFIG_DIGITAL" />
+ <meta-data
+ android:name="com.google.android.wearable.watchface.wearableConfigurationAction"
+ android:value="com.example.android.wearable.watchface.CONFIG_DIGITAL" />
+ <intent-filter>
+ <action android:name="android.service.wallpaper.WallpaperService" />
+ <category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
+ </intent-filter>
+ </service>
+
+ <!-- All intent-filters for config actions must include the categories
+ com.google.android.wearable.watchface.category.WEARABLE_CONFIGURATION
+ and android.intent.category.DEFAULT. -->
+
+ <activity
+ android:name=".DigitalWatchFaceWearableConfigActivity"
+ android:label="@string/digital_config_name">
+ <intent-filter>
+ <action android:name="com.example.android.wearable.watchface.CONFIG_DIGITAL" />
+ <category android:name="com.google.android.wearable.watchface.category.WEARABLE_CONFIGURATION" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ </activity>
+
+ <service
+ android:name=".CalendarWatchFaceService"
+ android:label="@string/calendar_name"
+ android:allowEmbedded="true"
+ android:taskAffinity=""
+ android:permission="android.permission.BIND_WALLPAPER" >
+ <meta-data
+ android:name="android.service.wallpaper"
+ android:resource="@xml/watch_face" />
+ <meta-data
+ android:name="com.google.android.wearable.watchface.preview"
+ android:resource="@drawable/preview_calendar" />
+ <meta-data
+ android:name="com.google.android.clockwork.home.preview_circular"
+ android:resource="@drawable/preview_calendar_circular" />
+ <intent-filter>
+ <action android:name="android.service.wallpaper.WallpaperService" />
+ <category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
+ </intent-filter>
+ </service>
+
+ <service android:name=".DigitalWatchFaceConfigListenerService">
+ <intent-filter>
+ <action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
+ </intent-filter>
+ </service>
+
+ <meta-data
+ android:name="com.google.android.gms.version"
+ android:value="@integer/google_play_services_version" />
+
+ </application>
+
+</manifest>
diff --git a/samples/browseable/WatchFace/Wearable/res/drawable-hdpi/bg.png b/samples/browseable/WatchFace/Wearable/res/drawable-hdpi/bg.png
new file mode 100644
index 000000000..5199af2d8
--- /dev/null
+++ b/samples/browseable/WatchFace/Wearable/res/drawable-hdpi/bg.png
Binary files differ
diff --git a/samples/browseable/WatchFace/Wearable/res/drawable-hdpi/ic_launcher.png b/samples/browseable/WatchFace/Wearable/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 000000000..589f229d1
--- /dev/null
+++ b/samples/browseable/WatchFace/Wearable/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_analog.png b/samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_analog.png
new file mode 100644
index 000000000..ed6960dbf
--- /dev/null
+++ b/samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_analog.png
Binary files differ
diff --git a/samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_analog_circular.png b/samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_analog_circular.png
new file mode 100644
index 000000000..a3affe213
--- /dev/null
+++ b/samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_analog_circular.png
Binary files differ
diff --git a/samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_calendar.png b/samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_calendar.png
new file mode 100644
index 000000000..928aa1f4f
--- /dev/null
+++ b/samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_calendar.png
Binary files differ
diff --git a/samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_calendar_circular.png b/samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_calendar_circular.png
new file mode 100644
index 000000000..cb1d27bac
--- /dev/null
+++ b/samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_calendar_circular.png
Binary files differ
diff --git a/samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_card_bounds.png b/samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_card_bounds.png
new file mode 100644
index 000000000..f87b6c5d3
--- /dev/null
+++ b/samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_card_bounds.png
Binary files differ
diff --git a/samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_card_bounds_circular.png b/samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_card_bounds_circular.png
new file mode 100644
index 000000000..387f59e7d
--- /dev/null
+++ b/samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_card_bounds_circular.png
Binary files differ
diff --git a/samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_digital.png b/samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_digital.png
new file mode 100644
index 000000000..4853a6454
--- /dev/null
+++ b/samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_digital.png
Binary files differ
diff --git a/samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_digital_circular.png b/samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_digital_circular.png
new file mode 100644
index 000000000..efeac3405
--- /dev/null
+++ b/samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_digital_circular.png
Binary files differ
diff --git a/samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_tilt.png b/samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_tilt.png
new file mode 100644
index 000000000..aab5f18d6
--- /dev/null
+++ b/samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_tilt.png
Binary files differ
diff --git a/samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_tilt_circular.png b/samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_tilt_circular.png
new file mode 100644
index 000000000..31d3a1f94
--- /dev/null
+++ b/samples/browseable/WatchFace/Wearable/res/drawable-hdpi/preview_tilt_circular.png
Binary files differ
diff --git a/samples/browseable/WatchFace/Wearable/res/drawable-mdpi/ic_launcher.png b/samples/browseable/WatchFace/Wearable/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 000000000..77dd57139
--- /dev/null
+++ b/samples/browseable/WatchFace/Wearable/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/WatchFace/Wearable/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/WatchFace/Wearable/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 000000000..fe34ebe13
--- /dev/null
+++ b/samples/browseable/WatchFace/Wearable/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/WatchFace/Wearable/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/WatchFace/Wearable/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 000000000..ab80bcd13
--- /dev/null
+++ b/samples/browseable/WatchFace/Wearable/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/WatchFace/Wearable/res/layout/activity_digital_config.xml b/samples/browseable/WatchFace/Wearable/res/layout/activity_digital_config.xml
new file mode 100644
index 000000000..a368390d0
--- /dev/null
+++ b/samples/browseable/WatchFace/Wearable/res/layout/activity_digital_config.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+<android.support.wearable.view.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:id="@+id/content"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@color/config_activity_background">
+ <TextView
+ android:id="@+id/header"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="16dp"
+ android:layout_marginTop="14dp"
+ android:textSize="24sp"
+ android:textColor="@color/config_activity_header_text_color"
+ android:text="@string/digital_background_color"
+ android:fontFamily="sans-serif-condensed-light"
+ app:layout_box="left|top"/>
+ <android.support.wearable.view.WearableListView
+ android:id="@+id/color_picker"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@android:color/transparent"
+ app:layout_box="left|right"/>
+</android.support.wearable.view.BoxInsetLayout>
diff --git a/samples/browseable/WatchFace/Wearable/res/layout/color_picker_item.xml b/samples/browseable/WatchFace/Wearable/res/layout/color_picker_item.xml
new file mode 100644
index 000000000..9b07e2aa6
--- /dev/null
+++ b/samples/browseable/WatchFace/Wearable/res/layout/color_picker_item.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+<merge
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto">
+
+ <android.support.wearable.view.CircledImageView
+ android:id="@+id/color"
+ android:layout_width="52dp"
+ android:layout_height="52dp"
+ android:layout_gravity="center_vertical"
+ app:circle_border_color="@color/color_item_circle_border_color"
+ app:circle_radius="26dp"
+ app:circle_border_width="1dp"/>
+
+ <TextView
+ android:id="@+id/label"
+ android:fontFamily="sans-serif-condensed-light"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:layout_marginLeft="10dp"
+ android:textColor="@color/color_item_label_color"
+ android:textSize="18sp"/>
+</merge> \ No newline at end of file
diff --git a/samples/browseable/WatchFace/Wearable/res/values/color.xml b/samples/browseable/WatchFace/Wearable/res/values/color.xml
new file mode 100644
index 000000000..0da08ed8b
--- /dev/null
+++ b/samples/browseable/WatchFace/Wearable/res/values/color.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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>
+ <color name="digital_am_pm">#aaaaa0</color>
+ <color name="digital_colons">#aaaaa0</color>
+ <color name="config_activity_background">#ffffff</color>
+ <color name="config_activity_header_text_color">#959595</color>
+ <color name="color_item_label_color">#000000</color>
+ <color name="color_item_circle_border_color">#424242</color>
+</resources>
diff --git a/samples/browseable/WatchFace/Wearable/res/values/dimens.xml b/samples/browseable/WatchFace/Wearable/res/values/dimens.xml
new file mode 100644
index 000000000..8f04e56de
--- /dev/null
+++ b/samples/browseable/WatchFace/Wearable/res/values/dimens.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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>
+ <dimen name="digital_text_size">40dp</dimen>
+ <dimen name="digital_text_size_round">45dp</dimen>
+ <dimen name="digital_am_pm_size">25dp</dimen>
+ <dimen name="digital_am_pm_size_round">30dp</dimen>
+ <dimen name="digital_x_offset">15dp</dimen>
+ <dimen name="digital_x_offset_round">25dp</dimen>
+ <dimen name="digital_y_offset">90dp</dimen>
+ <dimen name="digital_config_color_picker_item_margin">32dp</dimen>
+ <dimen name="content_padding_start">12dp</dimen>
+</resources>
diff --git a/samples/browseable/WatchFace/Wearable/res/values/strings.xml b/samples/browseable/WatchFace/Wearable/res/values/strings.xml
new file mode 100644
index 000000000..e54591fd3
--- /dev/null
+++ b/samples/browseable/WatchFace/Wearable/res/values/strings.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<resources>
+ <string name="app_name">WatchFace</string>
+ <string name="tilt_name">Sample Tilt</string>
+ <string name="analog_name">Sample Analog</string>
+ <string name="sweep_name">Sample Sweep</string>
+ <string name="card_bounds_name">Sample Card Bounds</string>
+ <string name="digital_name">Sample Digital</string>
+ <string name="digital_background_color">Background color</string>
+ <string name="digital_config_name">Digital watch face configuration</string>
+ <string name="digital_am">AM</string>
+ <string name="digital_pm">PM</string>
+ <string name="calendar_name">Sample Calendar</string>
+ <plurals name="calendar_meetings">
+ <item quantity="one">&lt;br&gt;&lt;br&gt;&lt;br&gt;You have &lt;b&gt;%1$d&lt;/b&gt; meeting in the next 24 hours.</item>
+ <item quantity="other">&lt;br&gt;&lt;br&gt;&lt;br&gt;You have &lt;b&gt;%1$d&lt;/b&gt; meetings in the next 24 hours.</item>
+ </plurals>
+
+ <!-- TODO: this should be shared (needs covering all the samples with Gradle build model) -->
+ <string name="color_black">Black</string>
+ <string name="color_blue">Blue</string>
+ <string name="color_gray">Gray</string>
+ <string name="color_green">Green</string>
+ <string name="color_navy">Navy</string>
+ <string name="color_red">Red</string>
+ <string name="color_white">White</string>
+
+ <string-array name="color_array">
+ <item>@string/color_black</item>
+ <item>@string/color_blue</item>
+ <item>@string/color_gray</item>
+ <item>@string/color_green</item>
+ <item>@string/color_navy</item>
+ <item>@string/color_red</item>
+ <item>@string/color_white</item>
+ </string-array>
+</resources>
diff --git a/samples/browseable/WatchFace/Wearable/res/xml/watch_face.xml b/samples/browseable/WatchFace/Wearable/res/xml/watch_face.xml
new file mode 100644
index 000000000..aa2e34382
--- /dev/null
+++ b/samples/browseable/WatchFace/Wearable/res/xml/watch_face.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+<wallpaper xmlns:android="http://schemas.android.com/apk/res/android" />
diff --git a/samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/AnalogWatchFaceService.java b/samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/AnalogWatchFaceService.java
new file mode 100644
index 000000000..f0fb4f582
--- /dev/null
+++ b/samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/AnalogWatchFaceService.java
@@ -0,0 +1,334 @@
+/*
+ * Copyright (C) 2014 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.wearable.watchface;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.Rect;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.support.wearable.watchface.CanvasWatchFaceService;
+import android.support.wearable.watchface.WatchFaceService;
+import android.support.wearable.watchface.WatchFaceStyle;
+import android.text.format.Time;
+import android.util.Log;
+import android.view.SurfaceHolder;
+
+import java.util.TimeZone;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Sample analog watch face with a ticking second hand. In ambient mode, the second hand isn't
+ * shown. On devices with low-bit ambient mode, the hands are drawn without anti-aliasing in ambient
+ * mode. The watch face is drawn with less contrast in mute mode.
+ *
+ * {@link SweepWatchFaceService} is similar but has a sweep second hand.
+ */
+public class AnalogWatchFaceService extends CanvasWatchFaceService {
+ private static final String TAG = "AnalogWatchFaceService";
+
+ /**
+ * Update rate in milliseconds for interactive mode. We update once a second to advance the
+ * second hand.
+ */
+ private static final long INTERACTIVE_UPDATE_RATE_MS = TimeUnit.SECONDS.toMillis(1);
+
+ @Override
+ public Engine onCreateEngine() {
+ return new Engine();
+ }
+
+ private class Engine extends CanvasWatchFaceService.Engine {
+ static final int MSG_UPDATE_TIME = 0;
+
+ Paint mHourPaint;
+ Paint mMinutePaint;
+ Paint mSecondPaint;
+ Paint mTickPaint;
+ boolean mMute;
+ Time mTime;
+
+ /** Handler to update the time once a second in interactive mode. */
+ final Handler mUpdateTimeHandler = new Handler() {
+ @Override
+ public void handleMessage(Message message) {
+ switch (message.what) {
+ case MSG_UPDATE_TIME:
+ if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ Log.v(TAG, "updating time");
+ }
+ invalidate();
+ if (shouldTimerBeRunning()) {
+ long timeMs = System.currentTimeMillis();
+ long delayMs = INTERACTIVE_UPDATE_RATE_MS
+ - (timeMs % INTERACTIVE_UPDATE_RATE_MS);
+ mUpdateTimeHandler.sendEmptyMessageDelayed(MSG_UPDATE_TIME, delayMs);
+ }
+ break;
+ }
+ }
+ };
+
+ final BroadcastReceiver mTimeZoneReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ mTime.clear(intent.getStringExtra("time-zone"));
+ mTime.setToNow();
+ }
+ };
+ boolean mRegisteredTimeZoneReceiver = false;
+
+ /**
+ * Whether the display supports fewer bits for each color in ambient mode. When true, we
+ * disable anti-aliasing in ambient mode.
+ */
+ boolean mLowBitAmbient;
+
+ Bitmap mBackgroundBitmap;
+ Bitmap mBackgroundScaledBitmap;
+
+ @Override
+ public void onCreate(SurfaceHolder holder) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onCreate");
+ }
+ super.onCreate(holder);
+
+ setWatchFaceStyle(new WatchFaceStyle.Builder(AnalogWatchFaceService.this)
+ .setCardPeekMode(WatchFaceStyle.PEEK_MODE_SHORT)
+ .setBackgroundVisibility(WatchFaceStyle.BACKGROUND_VISIBILITY_INTERRUPTIVE)
+ .setShowSystemUiTime(false)
+ .build());
+
+ Resources resources = AnalogWatchFaceService.this.getResources();
+ Drawable backgroundDrawable = resources.getDrawable(R.drawable.bg);
+ mBackgroundBitmap = ((BitmapDrawable) backgroundDrawable).getBitmap();
+
+ mHourPaint = new Paint();
+ mHourPaint.setARGB(255, 200, 200, 200);
+ mHourPaint.setStrokeWidth(5.f);
+ mHourPaint.setAntiAlias(true);
+ mHourPaint.setStrokeCap(Paint.Cap.ROUND);
+
+ mMinutePaint = new Paint();
+ mMinutePaint.setARGB(255, 200, 200, 200);
+ mMinutePaint.setStrokeWidth(3.f);
+ mMinutePaint.setAntiAlias(true);
+ mMinutePaint.setStrokeCap(Paint.Cap.ROUND);
+
+ mSecondPaint = new Paint();
+ mSecondPaint.setARGB(255, 255, 0, 0);
+ mSecondPaint.setStrokeWidth(2.f);
+ mSecondPaint.setAntiAlias(true);
+ mSecondPaint.setStrokeCap(Paint.Cap.ROUND);
+
+ mTickPaint = new Paint();
+ mTickPaint.setARGB(100, 255, 255, 255);
+ mTickPaint.setStrokeWidth(2.f);
+ mTickPaint.setAntiAlias(true);
+
+ mTime = new Time();
+ }
+
+ @Override
+ public void onDestroy() {
+ mUpdateTimeHandler.removeMessages(MSG_UPDATE_TIME);
+ super.onDestroy();
+ }
+
+ @Override
+ public void onPropertiesChanged(Bundle properties) {
+ super.onPropertiesChanged(properties);
+ mLowBitAmbient = properties.getBoolean(PROPERTY_LOW_BIT_AMBIENT, false);
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onPropertiesChanged: low-bit ambient = " + mLowBitAmbient);
+ }
+ }
+
+ @Override
+ public void onTimeTick() {
+ super.onTimeTick();
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onTimeTick: ambient = " + isInAmbientMode());
+ }
+ invalidate();
+ }
+
+ @Override
+ public void onAmbientModeChanged(boolean inAmbientMode) {
+ super.onAmbientModeChanged(inAmbientMode);
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onAmbientModeChanged: " + inAmbientMode);
+ }
+ if (mLowBitAmbient) {
+ boolean antiAlias = !inAmbientMode;
+ mHourPaint.setAntiAlias(antiAlias);
+ mMinutePaint.setAntiAlias(antiAlias);
+ mSecondPaint.setAntiAlias(antiAlias);
+ mTickPaint.setAntiAlias(antiAlias);
+ }
+ invalidate();
+
+ // Whether the timer should be running depends on whether we're in ambient mode (as well
+ // as whether we're visible), so we may need to start or stop the timer.
+ updateTimer();
+ }
+
+ @Override
+ public void onInterruptionFilterChanged(int interruptionFilter) {
+ super.onInterruptionFilterChanged(interruptionFilter);
+ boolean inMuteMode = (interruptionFilter == WatchFaceService.INTERRUPTION_FILTER_NONE);
+ if (mMute != inMuteMode) {
+ mMute = inMuteMode;
+ mHourPaint.setAlpha(inMuteMode ? 100 : 255);
+ mMinutePaint.setAlpha(inMuteMode ? 100 : 255);
+ mSecondPaint.setAlpha(inMuteMode ? 80 : 255);
+ invalidate();
+ }
+ }
+
+ @Override
+ public void onDraw(Canvas canvas, Rect bounds) {
+ mTime.setToNow();
+
+ int width = bounds.width();
+ int height = bounds.height();
+
+ // Draw the background, scaled to fit.
+ if (mBackgroundScaledBitmap == null
+ || mBackgroundScaledBitmap.getWidth() != width
+ || mBackgroundScaledBitmap.getHeight() != height) {
+ mBackgroundScaledBitmap = Bitmap.createScaledBitmap(mBackgroundBitmap,
+ width, height, true /* filter */);
+ }
+ canvas.drawBitmap(mBackgroundScaledBitmap, 0, 0, null);
+
+ // Find the center. Ignore the window insets so that, on round watches with a
+ // "chin", the watch face is centered on the entire screen, not just the usable
+ // portion.
+ float centerX = width / 2f;
+ float centerY = height / 2f;
+
+ // Draw the ticks.
+ float innerTickRadius = centerX - 10;
+ float outerTickRadius = centerX;
+ for (int tickIndex = 0; tickIndex < 12; tickIndex++) {
+ float tickRot = (float) (tickIndex * Math.PI * 2 / 12);
+ float innerX = (float) Math.sin(tickRot) * innerTickRadius;
+ float innerY = (float) -Math.cos(tickRot) * innerTickRadius;
+ float outerX = (float) Math.sin(tickRot) * outerTickRadius;
+ float outerY = (float) -Math.cos(tickRot) * outerTickRadius;
+ canvas.drawLine(centerX + innerX, centerY + innerY,
+ centerX + outerX, centerY + outerY, mTickPaint);
+ }
+
+ float secRot = mTime.second / 30f * (float) Math.PI;
+ int minutes = mTime.minute;
+ float minRot = minutes / 30f * (float) Math.PI;
+ float hrRot = ((mTime.hour + (minutes / 60f)) / 6f ) * (float) Math.PI;
+
+ float secLength = centerX - 20;
+ float minLength = centerX - 40;
+ float hrLength = centerX - 80;
+
+ if (!isInAmbientMode()) {
+ float secX = (float) Math.sin(secRot) * secLength;
+ float secY = (float) -Math.cos(secRot) * secLength;
+ canvas.drawLine(centerX, centerY, centerX + secX, centerY + secY, mSecondPaint);
+ }
+
+ float minX = (float) Math.sin(minRot) * minLength;
+ float minY = (float) -Math.cos(minRot) * minLength;
+ canvas.drawLine(centerX, centerY, centerX + minX, centerY + minY, mMinutePaint);
+
+ float hrX = (float) Math.sin(hrRot) * hrLength;
+ float hrY = (float) -Math.cos(hrRot) * hrLength;
+ canvas.drawLine(centerX, centerY, centerX + hrX, centerY + hrY, mHourPaint);
+ }
+
+ @Override
+ public void onVisibilityChanged(boolean visible) {
+ super.onVisibilityChanged(visible);
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onVisibilityChanged: " + visible);
+ }
+
+ if (visible) {
+ registerReceiver();
+
+ // Update time zone in case it changed while we weren't visible.
+ mTime.clear(TimeZone.getDefault().getID());
+ mTime.setToNow();
+ } else {
+ unregisterReceiver();
+ }
+
+ // Whether the timer should be running depends on whether we're visible (as well as
+ // whether we're in ambient mode), so we may need to start or stop the timer.
+ updateTimer();
+ }
+
+ private void registerReceiver() {
+ if (mRegisteredTimeZoneReceiver) {
+ return;
+ }
+ mRegisteredTimeZoneReceiver = true;
+ IntentFilter filter = new IntentFilter(Intent.ACTION_TIMEZONE_CHANGED);
+ AnalogWatchFaceService.this.registerReceiver(mTimeZoneReceiver, filter);
+ }
+
+ private void unregisterReceiver() {
+ if (!mRegisteredTimeZoneReceiver) {
+ return;
+ }
+ mRegisteredTimeZoneReceiver = false;
+ AnalogWatchFaceService.this.unregisterReceiver(mTimeZoneReceiver);
+ }
+
+ /**
+ * Starts the {@link #mUpdateTimeHandler} timer if it should be running and isn't currently
+ * or stops it if it shouldn't be running but currently is.
+ */
+ private void updateTimer() {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "updateTimer");
+ }
+ mUpdateTimeHandler.removeMessages(MSG_UPDATE_TIME);
+ if (shouldTimerBeRunning()) {
+ mUpdateTimeHandler.sendEmptyMessage(MSG_UPDATE_TIME);
+ }
+ }
+
+ /**
+ * Returns whether the {@link #mUpdateTimeHandler} timer should be running. The timer should
+ * only run when we're visible and in interactive mode.
+ */
+ private boolean shouldTimerBeRunning() {
+ return isVisible() && !isInAmbientMode();
+ }
+
+ }
+}
diff --git a/samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/CalendarWatchFaceService.java b/samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/CalendarWatchFaceService.java
new file mode 100644
index 000000000..a8ab95568
--- /dev/null
+++ b/samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/CalendarWatchFaceService.java
@@ -0,0 +1,232 @@
+/*
+ * Copyright (C) 2014 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.wearable.watchface;
+
+import android.content.BroadcastReceiver;
+import android.content.ContentUris;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.database.Cursor;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Rect;
+import android.net.Uri;
+import android.os.AsyncTask;
+import android.os.Handler;
+import android.os.Message;
+import android.os.PowerManager;
+import android.support.wearable.provider.WearableCalendarContract;
+import android.support.wearable.watchface.CanvasWatchFaceService;
+import android.support.wearable.watchface.WatchFaceStyle;
+import android.text.DynamicLayout;
+import android.text.Editable;
+import android.text.Html;
+import android.text.Layout;
+import android.text.SpannableStringBuilder;
+import android.text.TextPaint;
+import android.text.format.DateUtils;
+import android.util.Log;
+import android.view.SurfaceHolder;
+
+/**
+ * Proof of concept sample watch face that demonstrates how a watch face can load calendar data.
+ */
+public class CalendarWatchFaceService extends CanvasWatchFaceService {
+ private static final String TAG = "CalendarWatchFace";
+
+ @Override
+ public Engine onCreateEngine() {
+ return new Engine();
+ }
+
+ private class Engine extends CanvasWatchFaceService.Engine {
+
+ static final int BACKGROUND_COLOR = Color.BLACK;
+ static final int FOREGROUND_COLOR = Color.WHITE;
+ static final int TEXT_SIZE = 25;
+ static final int MSG_LOAD_MEETINGS = 0;
+
+ /** Editable string containing the text to draw with the number of meetings in bold. */
+ final Editable mEditable = new SpannableStringBuilder();
+
+ /** Width specified when {@link #mLayout} was created. */
+ int mLayoutWidth;
+
+ /** Layout to wrap {@link #mEditable} onto multiple lines. */
+ DynamicLayout mLayout;
+
+ /** Paint used to draw text. */
+ final TextPaint mTextPaint = new TextPaint();
+
+ int mNumMeetings;
+
+ private AsyncTask<Void, Void, Integer> mLoadMeetingsTask;
+
+ /** Handler to load the meetings once a minute in interactive mode. */
+ final Handler mLoadMeetingsHandler = new Handler() {
+ @Override
+ public void handleMessage(Message message) {
+ switch (message.what) {
+ case MSG_LOAD_MEETINGS:
+ cancelLoadMeetingTask();
+ mLoadMeetingsTask = new LoadMeetingsTask();
+ mLoadMeetingsTask.execute();
+ break;
+ }
+ }
+ };
+
+ private boolean mIsReceiverRegistered;
+
+ private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (Intent.ACTION_PROVIDER_CHANGED.equals(intent.getAction())
+ && WearableCalendarContract.CONTENT_URI.equals(intent.getData())) {
+ cancelLoadMeetingTask();
+ mLoadMeetingsHandler.sendEmptyMessage(MSG_LOAD_MEETINGS);
+ }
+ }
+ };
+
+ @Override
+ public void onCreate(SurfaceHolder holder) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onCreate");
+ }
+ super.onCreate(holder);
+ setWatchFaceStyle(new WatchFaceStyle.Builder(CalendarWatchFaceService.this)
+ .setCardPeekMode(WatchFaceStyle.PEEK_MODE_VARIABLE)
+ .setBackgroundVisibility(WatchFaceStyle.BACKGROUND_VISIBILITY_INTERRUPTIVE)
+ .setShowSystemUiTime(false)
+ .build());
+
+ mTextPaint.setColor(FOREGROUND_COLOR);
+ mTextPaint.setTextSize(TEXT_SIZE);
+
+ mLoadMeetingsHandler.sendEmptyMessage(MSG_LOAD_MEETINGS);
+ }
+
+ @Override
+ public void onDestroy() {
+ mLoadMeetingsHandler.removeMessages(MSG_LOAD_MEETINGS);
+ cancelLoadMeetingTask();
+ super.onDestroy();
+ }
+
+ @Override
+ public void onDraw(Canvas canvas, Rect bounds) {
+ // Create or update mLayout if necessary.
+ if (mLayout == null || mLayoutWidth != bounds.width()) {
+ mLayoutWidth = bounds.width();
+ mLayout = new DynamicLayout(mEditable, mTextPaint, mLayoutWidth,
+ Layout.Alignment.ALIGN_NORMAL, 1 /* spacingMult */, 0 /* spacingAdd */,
+ false /* includePad */);
+ }
+
+ // Update the contents of mEditable.
+ mEditable.clear();
+ mEditable.append(Html.fromHtml(getResources().getQuantityString(
+ R.plurals.calendar_meetings, mNumMeetings, mNumMeetings)));
+
+ // Draw the text on a solid background.
+ canvas.drawColor(BACKGROUND_COLOR);
+ mLayout.draw(canvas);
+ }
+
+ @Override
+ public void onVisibilityChanged(boolean visible) {
+ super.onVisibilityChanged(visible);
+ if (visible) {
+ IntentFilter filter = new IntentFilter(Intent.ACTION_PROVIDER_CHANGED);
+ filter.addDataScheme("content");
+ filter.addDataAuthority(WearableCalendarContract.AUTHORITY, null);
+ registerReceiver(mBroadcastReceiver, filter);
+ mIsReceiverRegistered = true;
+
+ mLoadMeetingsHandler.sendEmptyMessage(MSG_LOAD_MEETINGS);
+ } else {
+ if (mIsReceiverRegistered) {
+ unregisterReceiver(mBroadcastReceiver);
+ mIsReceiverRegistered = false;
+ }
+ mLoadMeetingsHandler.removeMessages(MSG_LOAD_MEETINGS);
+ }
+ }
+
+ private void onMeetingsLoaded(Integer result) {
+ if (result != null) {
+ mNumMeetings = result;
+ invalidate();
+ }
+ }
+
+ private void cancelLoadMeetingTask() {
+ if (mLoadMeetingsTask != null) {
+ mLoadMeetingsTask.cancel(true);
+ }
+ }
+
+ /**
+ * Asynchronous task to load the meetings from the content provider and report the number of
+ * meetings back via {@link #onMeetingsLoaded}.
+ */
+ private class LoadMeetingsTask extends AsyncTask<Void, Void, Integer> {
+ private PowerManager.WakeLock mWakeLock;
+
+ @Override
+ protected Integer doInBackground(Void... voids) {
+ PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE);
+ mWakeLock = powerManager.newWakeLock(
+ PowerManager.PARTIAL_WAKE_LOCK, "CalendarWatchFaceWakeLock");
+ mWakeLock.acquire();
+
+ long begin = System.currentTimeMillis();
+ Uri.Builder builder =
+ WearableCalendarContract.Instances.CONTENT_URI.buildUpon();
+ ContentUris.appendId(builder, begin);
+ ContentUris.appendId(builder, begin + DateUtils.DAY_IN_MILLIS);
+ final Cursor cursor = getContentResolver().query(builder.build(),
+ null, null, null, null);
+ int numMeetings = cursor.getCount();
+ if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ Log.v(TAG, "Num meetings: " + numMeetings);
+ }
+ return numMeetings;
+ }
+
+ @Override
+ protected void onPostExecute(Integer result) {
+ releaseWakeLock();
+ onMeetingsLoaded(result);
+ }
+
+ @Override
+ protected void onCancelled() {
+ releaseWakeLock();
+ }
+
+ private void releaseWakeLock() {
+ if (mWakeLock != null) {
+ mWakeLock.release();
+ mWakeLock = null;
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/CardBoundsWatchFaceService.java b/samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/CardBoundsWatchFaceService.java
new file mode 100644
index 000000000..359d7af07
--- /dev/null
+++ b/samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/CardBoundsWatchFaceService.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2014 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.wearable.watchface;
+
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.graphics.Rect;
+import android.support.wearable.watchface.CanvasWatchFaceService;
+import android.support.wearable.watchface.WatchFaceStyle;
+import android.util.Log;
+import android.view.SurfaceHolder;
+
+/**
+ * Proof of concept sample watch face that demonstrates how a watch face can detect where the peek
+ * card is. This watch face draws a border around the area where the peeking card is.
+ */
+public class CardBoundsWatchFaceService extends CanvasWatchFaceService {
+
+ private static final String TAG = "CardBoundsWatchFace";
+
+ @Override
+ public Engine onCreateEngine() {
+ return new Engine();
+ }
+
+ private class Engine extends CanvasWatchFaceService.Engine {
+
+ static final int BORDER_WIDTH_PX = 5;
+
+ final Rect mCardBounds = new Rect();
+ final Paint mPaint = new Paint();
+
+ @Override
+ public void onCreate(SurfaceHolder holder) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onCreate");
+ }
+ super.onCreate(holder);
+ setWatchFaceStyle(new WatchFaceStyle.Builder(CardBoundsWatchFaceService.this)
+ .setCardPeekMode(WatchFaceStyle.PEEK_MODE_VARIABLE)
+ .setBackgroundVisibility(WatchFaceStyle.BACKGROUND_VISIBILITY_INTERRUPTIVE)
+ .setShowSystemUiTime(true)
+ .setPeekOpacityMode(WatchFaceStyle.PEEK_OPACITY_MODE_TRANSLUCENT)
+ .build());
+ }
+
+ @Override
+ public void onAmbientModeChanged(boolean inAmbientMode) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onAmbientModeChanged: " + inAmbientMode);
+ }
+ super.onAmbientModeChanged(inAmbientMode);
+ invalidate();
+ }
+
+ @Override
+ public void onPeekCardPositionUpdate(Rect bounds) {
+ super.onPeekCardPositionUpdate(bounds);
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onPeekCardPositionUpdate: " + bounds);
+ }
+ super.onPeekCardPositionUpdate(bounds);
+ if (!bounds.equals(mCardBounds)) {
+ mCardBounds.set(bounds);
+ invalidate();
+ }
+ }
+
+ @Override
+ public void onDraw(Canvas canvas, Rect bounds) {
+ // Clear screen.
+ canvas.drawColor(isInAmbientMode() ? Color.BLACK : Color.BLUE);
+
+ // Draw border around card in interactive mode.
+ if (!isInAmbientMode()) {
+ mPaint.setColor(Color.MAGENTA);
+ canvas.drawRect(mCardBounds.left - BORDER_WIDTH_PX,
+ mCardBounds.top - BORDER_WIDTH_PX,
+ mCardBounds.right + BORDER_WIDTH_PX,
+ mCardBounds.bottom + BORDER_WIDTH_PX, mPaint);
+ }
+
+ // Fill area under card.
+ mPaint.setColor(isInAmbientMode() ? Color.RED : Color.GREEN);
+ canvas.drawRect(mCardBounds, mPaint);
+ }
+ }
+}
diff --git a/samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/DigitalWatchFaceConfigListenerService.java b/samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/DigitalWatchFaceConfigListenerService.java
new file mode 100644
index 000000000..725c51aa8
--- /dev/null
+++ b/samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/DigitalWatchFaceConfigListenerService.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2014 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.wearable.watchface;
+
+import android.os.Bundle;
+import android.util.Log;
+
+import com.google.android.gms.common.ConnectionResult;
+import com.google.android.gms.common.api.GoogleApiClient;
+import com.google.android.gms.wearable.DataMap;
+import com.google.android.gms.wearable.MessageEvent;
+import com.google.android.gms.wearable.Wearable;
+import com.google.android.gms.wearable.WearableListenerService;
+
+import java.util.concurrent.TimeUnit;
+
+/**
+ * A {@link WearableListenerService} listening for {@link DigitalWatchFaceService} config messages
+ * and updating the config {@link com.google.android.gms.wearable.DataItem} accordingly.
+ */
+public class DigitalWatchFaceConfigListenerService extends WearableListenerService
+ implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
+ private static final String TAG = "DigitalListenerService";
+
+ private GoogleApiClient mGoogleApiClient;
+
+ @Override // WearableListenerService
+ public void onMessageReceived(MessageEvent messageEvent) {
+ if (!messageEvent.getPath().equals(DigitalWatchFaceUtil.PATH_WITH_FEATURE)) {
+ return;
+ }
+ byte[] rawData = messageEvent.getData();
+ // It's allowed that the message carries only some of the keys used in the config DataItem
+ // and skips the ones that we don't want to change.
+ DataMap configKeysToOverwrite = DataMap.fromByteArray(rawData);
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "Received watch face config message: " + configKeysToOverwrite);
+ }
+
+ if (mGoogleApiClient == null) {
+ mGoogleApiClient = new GoogleApiClient.Builder(this).addConnectionCallbacks(this)
+ .addOnConnectionFailedListener(this).addApi(Wearable.API).build();
+ }
+ if (!mGoogleApiClient.isConnected()) {
+ ConnectionResult connectionResult =
+ mGoogleApiClient.blockingConnect(30, TimeUnit.SECONDS);
+
+ if (!connectionResult.isSuccess()) {
+ Log.e(TAG, "Failed to connect to GoogleApiClient.");
+ return;
+ }
+ }
+
+ DigitalWatchFaceUtil.overwriteKeysInConfigDataMap(mGoogleApiClient, configKeysToOverwrite);
+ }
+
+ @Override // GoogleApiClient.ConnectionCallbacks
+ public void onConnected(Bundle connectionHint) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onConnected: " + connectionHint);
+ }
+ }
+
+ @Override // GoogleApiClient.ConnectionCallbacks
+ public void onConnectionSuspended(int cause) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onConnectionSuspended: " + cause);
+ }
+ }
+
+ @Override // GoogleApiClient.OnConnectionFailedListener
+ public void onConnectionFailed(ConnectionResult result) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onConnectionFailed: " + result);
+ }
+ }
+}
diff --git a/samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/DigitalWatchFaceService.java b/samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/DigitalWatchFaceService.java
new file mode 100644
index 000000000..b8b1314b8
--- /dev/null
+++ b/samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/DigitalWatchFaceService.java
@@ -0,0 +1,605 @@
+/*
+ * Copyright (C) 2014 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.wearable.watchface;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.res.Resources;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.Rect;
+import android.graphics.Typeface;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.support.wearable.watchface.CanvasWatchFaceService;
+import android.support.wearable.watchface.WatchFaceService;
+import android.support.wearable.watchface.WatchFaceStyle;
+import android.text.format.Time;
+import android.util.Log;
+import android.view.SurfaceHolder;
+import android.view.WindowInsets;
+
+import com.google.android.gms.common.ConnectionResult;
+import com.google.android.gms.common.api.GoogleApiClient;
+import com.google.android.gms.wearable.DataApi;
+import com.google.android.gms.wearable.DataEvent;
+import com.google.android.gms.wearable.DataEventBuffer;
+import com.google.android.gms.wearable.DataItem;
+import com.google.android.gms.wearable.DataMap;
+import com.google.android.gms.wearable.DataMapItem;
+import com.google.android.gms.wearable.Wearable;
+
+import java.util.TimeZone;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Sample digital watch face with blinking colons and seconds. In ambient mode, the seconds are
+ * replaced with an AM/PM indicator and the colons don't blink. On devices with low-bit ambient
+ * mode, the text is drawn without anti-aliasing in ambient mode. On devices which require burn-in
+ * protection, the hours are drawn in normal rather than bold. The time is drawn with less contrast
+ * and without seconds in mute mode.
+ */
+public class DigitalWatchFaceService extends CanvasWatchFaceService {
+ private static final String TAG = "DigitalWatchFaceService";
+
+ private static final Typeface BOLD_TYPEFACE =
+ Typeface.create(Typeface.SANS_SERIF, Typeface.BOLD);
+ private static final Typeface NORMAL_TYPEFACE =
+ Typeface.create(Typeface.SANS_SERIF, Typeface.NORMAL);
+
+ /**
+ * Update rate in milliseconds for normal (not ambient and not mute) mode. We update twice
+ * a second to blink the colons.
+ */
+ private static final long NORMAL_UPDATE_RATE_MS = 500;
+
+ /**
+ * Update rate in milliseconds for mute mode. We update every minute, like in ambient mode.
+ */
+ private static final long MUTE_UPDATE_RATE_MS = TimeUnit.MINUTES.toMillis(1);
+
+ @Override
+ public Engine onCreateEngine() {
+ return new Engine();
+ }
+
+ private class Engine extends CanvasWatchFaceService.Engine implements DataApi.DataListener,
+ GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
+ static final String COLON_STRING = ":";
+
+ /** Alpha value for drawing time when in mute mode. */
+ static final int MUTE_ALPHA = 100;
+
+ /** Alpha value for drawing time when not in mute mode. */
+ static final int NORMAL_ALPHA = 255;
+
+ static final int MSG_UPDATE_TIME = 0;
+
+ /** How often {@link #mUpdateTimeHandler} ticks in milliseconds. */
+ long mInteractiveUpdateRateMs = NORMAL_UPDATE_RATE_MS;
+
+ /** Handler to update the time periodically in interactive mode. */
+ final Handler mUpdateTimeHandler = new Handler() {
+ @Override
+ public void handleMessage(Message message) {
+ switch (message.what) {
+ case MSG_UPDATE_TIME:
+ if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ Log.v(TAG, "updating time");
+ }
+ invalidate();
+ if (shouldTimerBeRunning()) {
+ long timeMs = System.currentTimeMillis();
+ long delayMs =
+ mInteractiveUpdateRateMs - (timeMs % mInteractiveUpdateRateMs);
+ mUpdateTimeHandler.sendEmptyMessageDelayed(MSG_UPDATE_TIME, delayMs);
+ }
+ break;
+ }
+ }
+ };
+
+ GoogleApiClient mGoogleApiClient = new GoogleApiClient.Builder(DigitalWatchFaceService.this)
+ .addConnectionCallbacks(this)
+ .addOnConnectionFailedListener(this)
+ .addApi(Wearable.API)
+ .build();
+
+ final BroadcastReceiver mTimeZoneReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ mTime.clear(intent.getStringExtra("time-zone"));
+ mTime.setToNow();
+ }
+ };
+ boolean mRegisteredTimeZoneReceiver = false;
+
+ Paint mBackgroundPaint;
+ Paint mHourPaint;
+ Paint mMinutePaint;
+ Paint mSecondPaint;
+ Paint mAmPmPaint;
+ Paint mColonPaint;
+ float mColonWidth;
+ boolean mMute;
+ Time mTime;
+ boolean mShouldDrawColons;
+ float mXOffset;
+ float mYOffset;
+ String mAmString;
+ String mPmString;
+ int mInteractiveBackgroundColor =
+ DigitalWatchFaceUtil.COLOR_VALUE_DEFAULT_AND_AMBIENT_BACKGROUND;
+ int mInteractiveHourDigitsColor =
+ DigitalWatchFaceUtil.COLOR_VALUE_DEFAULT_AND_AMBIENT_HOUR_DIGITS;
+ int mInteractiveMinuteDigitsColor =
+ DigitalWatchFaceUtil.COLOR_VALUE_DEFAULT_AND_AMBIENT_MINUTE_DIGITS;
+ int mInteractiveSecondDigitsColor =
+ DigitalWatchFaceUtil.COLOR_VALUE_DEFAULT_AND_AMBIENT_SECOND_DIGITS;
+
+ /**
+ * Whether the display supports fewer bits for each color in ambient mode. When true, we
+ * disable anti-aliasing in ambient mode.
+ */
+ boolean mLowBitAmbient;
+
+ @Override
+ public void onCreate(SurfaceHolder holder) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onCreate");
+ }
+ super.onCreate(holder);
+
+ setWatchFaceStyle(new WatchFaceStyle.Builder(DigitalWatchFaceService.this)
+ .setCardPeekMode(WatchFaceStyle.PEEK_MODE_VARIABLE)
+ .setBackgroundVisibility(WatchFaceStyle.BACKGROUND_VISIBILITY_INTERRUPTIVE)
+ .setShowSystemUiTime(false)
+ .build());
+ Resources resources = DigitalWatchFaceService.this.getResources();
+ mYOffset = resources.getDimension(R.dimen.digital_y_offset);
+ mAmString = resources.getString(R.string.digital_am);
+ mPmString = resources.getString(R.string.digital_pm);
+
+ mBackgroundPaint = new Paint();
+ mBackgroundPaint.setColor(mInteractiveBackgroundColor);
+ mHourPaint = createTextPaint(mInteractiveHourDigitsColor, BOLD_TYPEFACE);
+ mMinutePaint = createTextPaint(mInteractiveMinuteDigitsColor);
+ mSecondPaint = createTextPaint(mInteractiveSecondDigitsColor);
+ mAmPmPaint = createTextPaint(resources.getColor(R.color.digital_am_pm));
+ mColonPaint = createTextPaint(resources.getColor(R.color.digital_colons));
+
+ mTime = new Time();
+ }
+
+ @Override
+ public void onDestroy() {
+ mUpdateTimeHandler.removeMessages(MSG_UPDATE_TIME);
+ super.onDestroy();
+ }
+
+ private Paint createTextPaint(int defaultInteractiveColor) {
+ return createTextPaint(defaultInteractiveColor, NORMAL_TYPEFACE);
+ }
+
+ private Paint createTextPaint(int defaultInteractiveColor, Typeface typeface) {
+ Paint paint = new Paint();
+ paint.setColor(defaultInteractiveColor);
+ paint.setTypeface(typeface);
+ paint.setAntiAlias(true);
+ return paint;
+ }
+
+ @Override
+ public void onVisibilityChanged(boolean visible) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onVisibilityChanged: " + visible);
+ }
+ super.onVisibilityChanged(visible);
+
+ if (visible) {
+ mGoogleApiClient.connect();
+
+ registerReceiver();
+
+ // Update time zone in case it changed while we weren't visible.
+ mTime.clear(TimeZone.getDefault().getID());
+ mTime.setToNow();
+ } else {
+ unregisterReceiver();
+
+ if (mGoogleApiClient != null && mGoogleApiClient.isConnected()) {
+ Wearable.DataApi.removeListener(mGoogleApiClient, this);
+ mGoogleApiClient.disconnect();
+ }
+ }
+
+ // Whether the timer should be running depends on whether we're visible (as well as
+ // whether we're in ambient mode), so we may need to start or stop the timer.
+ updateTimer();
+ }
+
+ private void registerReceiver() {
+ if (mRegisteredTimeZoneReceiver) {
+ return;
+ }
+ mRegisteredTimeZoneReceiver = true;
+ IntentFilter filter = new IntentFilter(Intent.ACTION_TIMEZONE_CHANGED);
+ DigitalWatchFaceService.this.registerReceiver(mTimeZoneReceiver, filter);
+ }
+
+ private void unregisterReceiver() {
+ if (!mRegisteredTimeZoneReceiver) {
+ return;
+ }
+ mRegisteredTimeZoneReceiver = false;
+ DigitalWatchFaceService.this.unregisterReceiver(mTimeZoneReceiver);
+ }
+
+ @Override
+ public void onApplyWindowInsets(WindowInsets insets) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onApplyWindowInsets: " + (insets.isRound() ? "round" : "square"));
+ }
+ super.onApplyWindowInsets(insets);
+
+ // Load resources that have alternate values for round watches.
+ Resources resources = DigitalWatchFaceService.this.getResources();
+ boolean isRound = insets.isRound();
+ mXOffset = resources.getDimension(isRound
+ ? R.dimen.digital_x_offset_round : R.dimen.digital_x_offset);
+ float textSize = resources.getDimension(isRound
+ ? R.dimen.digital_text_size_round : R.dimen.digital_text_size);
+ float amPmSize = resources.getDimension(isRound
+ ? R.dimen.digital_am_pm_size_round : R.dimen.digital_am_pm_size);
+
+ mHourPaint.setTextSize(textSize);
+ mMinutePaint.setTextSize(textSize);
+ mSecondPaint.setTextSize(textSize);
+ mAmPmPaint.setTextSize(amPmSize);
+ mColonPaint.setTextSize(textSize);
+
+ mColonWidth = mColonPaint.measureText(COLON_STRING);
+ }
+
+ @Override
+ public void onPropertiesChanged(Bundle properties) {
+ super.onPropertiesChanged(properties);
+
+ boolean burnInProtection = properties.getBoolean(PROPERTY_BURN_IN_PROTECTION, false);
+ mHourPaint.setTypeface(burnInProtection ? NORMAL_TYPEFACE : BOLD_TYPEFACE);
+
+ mLowBitAmbient = properties.getBoolean(PROPERTY_LOW_BIT_AMBIENT, false);
+
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onPropertiesChanged: burn-in protection = " + burnInProtection
+ + ", low-bit ambient = " + mLowBitAmbient);
+ }
+ }
+
+ @Override
+ public void onTimeTick() {
+ super.onTimeTick();
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onTimeTick: ambient = " + isInAmbientMode());
+ }
+ invalidate();
+ }
+
+ @Override
+ public void onAmbientModeChanged(boolean inAmbientMode) {
+ super.onAmbientModeChanged(inAmbientMode);
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onAmbientModeChanged: " + inAmbientMode);
+ }
+ adjustPaintColorToCurrentMode(mBackgroundPaint, mInteractiveBackgroundColor,
+ DigitalWatchFaceUtil.COLOR_VALUE_DEFAULT_AND_AMBIENT_BACKGROUND);
+ adjustPaintColorToCurrentMode(mHourPaint, mInteractiveHourDigitsColor,
+ DigitalWatchFaceUtil.COLOR_VALUE_DEFAULT_AND_AMBIENT_HOUR_DIGITS);
+ adjustPaintColorToCurrentMode(mMinutePaint, mInteractiveMinuteDigitsColor,
+ DigitalWatchFaceUtil.COLOR_VALUE_DEFAULT_AND_AMBIENT_MINUTE_DIGITS);
+ // Actually, the seconds are not rendered in the ambient mode, so we could pass just any
+ // value as ambientColor here.
+ adjustPaintColorToCurrentMode(mSecondPaint, mInteractiveSecondDigitsColor,
+ DigitalWatchFaceUtil.COLOR_VALUE_DEFAULT_AND_AMBIENT_SECOND_DIGITS);
+
+ if (mLowBitAmbient) {
+ boolean antiAlias = !inAmbientMode;
+ mHourPaint.setAntiAlias(antiAlias);
+ mMinutePaint.setAntiAlias(antiAlias);
+ mSecondPaint.setAntiAlias(antiAlias);
+ mAmPmPaint.setAntiAlias(antiAlias);
+ mColonPaint.setAntiAlias(antiAlias);
+ }
+ invalidate();
+
+ // Whether the timer should be running depends on whether we're in ambient mode (as well
+ // as whether we're visible), so we may need to start or stop the timer.
+ updateTimer();
+ }
+
+ private void adjustPaintColorToCurrentMode(Paint paint, int interactiveColor,
+ int ambientColor) {
+ paint.setColor(isInAmbientMode() ? ambientColor : interactiveColor);
+ }
+
+ @Override
+ public void onInterruptionFilterChanged(int interruptionFilter) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onInterruptionFilterChanged: " + interruptionFilter);
+ }
+ super.onInterruptionFilterChanged(interruptionFilter);
+
+ boolean inMuteMode = interruptionFilter == WatchFaceService.INTERRUPTION_FILTER_NONE;
+ // We only need to update once a minute in mute mode.
+ setInteractiveUpdateRateMs(inMuteMode ? MUTE_UPDATE_RATE_MS : NORMAL_UPDATE_RATE_MS);
+
+ if (mMute != inMuteMode) {
+ mMute = inMuteMode;
+ int alpha = inMuteMode ? MUTE_ALPHA : NORMAL_ALPHA;
+ mHourPaint.setAlpha(alpha);
+ mMinutePaint.setAlpha(alpha);
+ mColonPaint.setAlpha(alpha);
+ mAmPmPaint.setAlpha(alpha);
+ invalidate();
+ }
+ }
+
+ public void setInteractiveUpdateRateMs(long updateRateMs) {
+ if (updateRateMs == mInteractiveUpdateRateMs) {
+ return;
+ }
+ mInteractiveUpdateRateMs = updateRateMs;
+
+ // Stop and restart the timer so the new update rate takes effect immediately.
+ if (shouldTimerBeRunning()) {
+ updateTimer();
+ }
+ }
+
+ private void updatePaintIfInteractive(Paint paint, int interactiveColor) {
+ if (!isInAmbientMode() && paint != null) {
+ paint.setColor(interactiveColor);
+ }
+ }
+
+ private void setInteractiveBackgroundColor(int color) {
+ mInteractiveBackgroundColor = color;
+ updatePaintIfInteractive(mBackgroundPaint, color);
+ }
+
+ private void setInteractiveHourDigitsColor(int color) {
+ mInteractiveHourDigitsColor = color;
+ updatePaintIfInteractive(mHourPaint, color);
+ }
+
+ private void setInteractiveMinuteDigitsColor(int color) {
+ mInteractiveMinuteDigitsColor = color;
+ updatePaintIfInteractive(mMinutePaint, color);
+ }
+
+ private void setInteractiveSecondDigitsColor(int color) {
+ mInteractiveSecondDigitsColor = color;
+ updatePaintIfInteractive(mSecondPaint, color);
+ }
+
+ private String formatTwoDigitNumber(int hour) {
+ return String.format("%02d", hour);
+ }
+
+ private int convertTo12Hour(int hour) {
+ int result = hour % 12;
+ return (result == 0) ? 12 : result;
+ }
+
+ private String getAmPmString(int hour) {
+ return (hour < 12) ? mAmString : mPmString;
+ }
+
+ @Override
+ public void onDraw(Canvas canvas, Rect bounds) {
+ mTime.setToNow();
+
+ // Show colons for the first half of each second so the colons blink on when the time
+ // updates.
+ mShouldDrawColons = (System.currentTimeMillis() % 1000) < 500;
+
+ // Draw the background.
+ canvas.drawRect(0, 0, bounds.width(), bounds.height(), mBackgroundPaint);
+
+ // Draw the hours.
+ float x = mXOffset;
+ String hourString = String.valueOf(convertTo12Hour(mTime.hour));
+ canvas.drawText(hourString, x, mYOffset, mHourPaint);
+ x += mHourPaint.measureText(hourString);
+
+ // In ambient and mute modes, always draw the first colon. Otherwise, draw the
+ // first colon for the first half of each second.
+ if (isInAmbientMode() || mMute || mShouldDrawColons) {
+ canvas.drawText(COLON_STRING, x, mYOffset, mColonPaint);
+ }
+ x += mColonWidth;
+
+ // Draw the minutes.
+ String minuteString = formatTwoDigitNumber(mTime.minute);
+ canvas.drawText(minuteString, x, mYOffset, mMinutePaint);
+ x += mMinutePaint.measureText(minuteString);
+
+ // In ambient and mute modes, draw AM/PM. Otherwise, draw a second blinking
+ // colon followed by the seconds.
+ if (isInAmbientMode() || mMute) {
+ x += mColonWidth;
+ canvas.drawText(getAmPmString(mTime.hour), x, mYOffset, mAmPmPaint);
+ } else {
+ if (mShouldDrawColons) {
+ canvas.drawText(COLON_STRING, x, mYOffset, mColonPaint);
+ }
+ x += mColonWidth;
+ canvas.drawText(formatTwoDigitNumber(mTime.second), x, mYOffset,
+ mSecondPaint);
+ }
+ }
+
+ /**
+ * Starts the {@link #mUpdateTimeHandler} timer if it should be running and isn't currently
+ * or stops it if it shouldn't be running but currently is.
+ */
+ private void updateTimer() {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "updateTimer");
+ }
+ mUpdateTimeHandler.removeMessages(MSG_UPDATE_TIME);
+ if (shouldTimerBeRunning()) {
+ mUpdateTimeHandler.sendEmptyMessage(MSG_UPDATE_TIME);
+ }
+ }
+
+ /**
+ * Returns whether the {@link #mUpdateTimeHandler} timer should be running. The timer should
+ * only run when we're visible and in interactive mode.
+ */
+ private boolean shouldTimerBeRunning() {
+ return isVisible() && !isInAmbientMode();
+ }
+
+ private void updateConfigDataItemAndUiOnStartup() {
+ DigitalWatchFaceUtil.fetchConfigDataMap(mGoogleApiClient,
+ new DigitalWatchFaceUtil.FetchConfigDataMapCallback() {
+ @Override
+ public void onConfigDataMapFetched(DataMap startupConfig) {
+ // If the DataItem hasn't been created yet or some keys are missing,
+ // use the default values.
+ setDefaultValuesForMissingConfigKeys(startupConfig);
+ DigitalWatchFaceUtil.putConfigDataItem(mGoogleApiClient, startupConfig);
+
+ updateUiForConfigDataMap(startupConfig);
+ }
+ }
+ );
+ }
+
+ private void setDefaultValuesForMissingConfigKeys(DataMap config) {
+ addIntKeyIfMissing(config, DigitalWatchFaceUtil.KEY_BACKGROUND_COLOR,
+ DigitalWatchFaceUtil.COLOR_VALUE_DEFAULT_AND_AMBIENT_BACKGROUND);
+ addIntKeyIfMissing(config, DigitalWatchFaceUtil.KEY_HOURS_COLOR,
+ DigitalWatchFaceUtil.COLOR_VALUE_DEFAULT_AND_AMBIENT_HOUR_DIGITS);
+ addIntKeyIfMissing(config, DigitalWatchFaceUtil.KEY_MINUTES_COLOR,
+ DigitalWatchFaceUtil.COLOR_VALUE_DEFAULT_AND_AMBIENT_MINUTE_DIGITS);
+ addIntKeyIfMissing(config, DigitalWatchFaceUtil.KEY_SECONDS_COLOR,
+ DigitalWatchFaceUtil.COLOR_VALUE_DEFAULT_AND_AMBIENT_SECOND_DIGITS);
+ }
+
+ private void addIntKeyIfMissing(DataMap config, String key, int color) {
+ if (!config.containsKey(key)) {
+ config.putInt(key, color);
+ }
+ }
+
+ @Override // DataApi.DataListener
+ public void onDataChanged(DataEventBuffer dataEvents) {
+ try {
+ for (DataEvent dataEvent : dataEvents) {
+ if (dataEvent.getType() != DataEvent.TYPE_CHANGED) {
+ continue;
+ }
+
+ DataItem dataItem = dataEvent.getDataItem();
+ if (!dataItem.getUri().getPath().equals(
+ DigitalWatchFaceUtil.PATH_WITH_FEATURE)) {
+ continue;
+ }
+
+ DataMapItem dataMapItem = DataMapItem.fromDataItem(dataItem);
+ DataMap config = dataMapItem.getDataMap();
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "Config DataItem updated:" + config);
+ }
+ updateUiForConfigDataMap(config);
+ }
+ } finally {
+ dataEvents.close();
+ }
+ }
+
+ private void updateUiForConfigDataMap(final DataMap config) {
+ boolean uiUpdated = false;
+ for (String configKey : config.keySet()) {
+ if (!config.containsKey(configKey)) {
+ continue;
+ }
+ int color = config.getInt(configKey);
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "Found watch face config key: " + configKey + " -> "
+ + Integer.toHexString(color));
+ }
+ if (updateUiForKey(configKey, color)) {
+ uiUpdated = true;
+ }
+ }
+ if (uiUpdated) {
+ invalidate();
+ }
+ }
+
+ /**
+ * Updates the color of a UI item according to the given {@code configKey}. Does nothing if
+ * {@code configKey} isn't recognized.
+ *
+ * @return whether UI has been updated
+ */
+ private boolean updateUiForKey(String configKey, int color) {
+ if (configKey.equals(DigitalWatchFaceUtil.KEY_BACKGROUND_COLOR)) {
+ setInteractiveBackgroundColor(color);
+ } else if (configKey.equals(DigitalWatchFaceUtil.KEY_HOURS_COLOR)) {
+ setInteractiveHourDigitsColor(color);
+ } else if (configKey.equals(DigitalWatchFaceUtil.KEY_MINUTES_COLOR)) {
+ setInteractiveMinuteDigitsColor(color);
+ } else if (configKey.equals(DigitalWatchFaceUtil.KEY_SECONDS_COLOR)) {
+ setInteractiveSecondDigitsColor(color);
+ } else {
+ Log.w(TAG, "Ignoring unknown config key: " + configKey);
+ return false;
+ }
+ return true;
+ }
+
+ @Override // GoogleApiClient.ConnectionCallbacks
+ public void onConnected(Bundle connectionHint) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onConnected: " + connectionHint);
+ }
+ Wearable.DataApi.addListener(mGoogleApiClient, Engine.this);
+ updateConfigDataItemAndUiOnStartup();
+ }
+
+ @Override // GoogleApiClient.ConnectionCallbacks
+ public void onConnectionSuspended(int cause) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onConnectionSuspended: " + cause);
+ }
+ }
+
+ @Override // GoogleApiClient.OnConnectionFailedListener
+ public void onConnectionFailed(ConnectionResult result) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onConnectionFailed: " + result);
+ }
+ }
+ }
+}
diff --git a/samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/DigitalWatchFaceUtil.java b/samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/DigitalWatchFaceUtil.java
new file mode 100644
index 000000000..1c4af700b
--- /dev/null
+++ b/samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/DigitalWatchFaceUtil.java
@@ -0,0 +1,205 @@
+/*
+ * Copyright (C) 2014 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.wearable.watchface;
+
+import android.graphics.Color;
+import android.net.Uri;
+import android.util.Log;
+
+import com.google.android.gms.common.api.GoogleApiClient;
+import com.google.android.gms.common.api.ResultCallback;
+import com.google.android.gms.wearable.DataApi;
+import com.google.android.gms.wearable.DataItem;
+import com.google.android.gms.wearable.DataMap;
+import com.google.android.gms.wearable.DataMapItem;
+import com.google.android.gms.wearable.NodeApi;
+import com.google.android.gms.wearable.PutDataMapRequest;
+import com.google.android.gms.wearable.Wearable;
+
+public final class DigitalWatchFaceUtil {
+ private static final String TAG = "DigitalWatchFaceUtil";
+
+ /**
+ * The {@link DataMap} key for {@link DigitalWatchFaceService} background color name.
+ * The color name must be a {@link String} recognized by {@link Color#parseColor}.
+ */
+ public static final String KEY_BACKGROUND_COLOR = "BACKGROUND_COLOR";
+
+ /**
+ * The {@link DataMap} key for {@link DigitalWatchFaceService} hour digits color name.
+ * The color name must be a {@link String} recognized by {@link Color#parseColor}.
+ */
+ public static final String KEY_HOURS_COLOR = "HOURS_COLOR";
+
+ /**
+ * The {@link DataMap} key for {@link DigitalWatchFaceService} minute digits color name.
+ * The color name must be a {@link String} recognized by {@link Color#parseColor}.
+ */
+ public static final String KEY_MINUTES_COLOR = "MINUTES_COLOR";
+
+ /**
+ * The {@link DataMap} key for {@link DigitalWatchFaceService} second digits color name.
+ * The color name must be a {@link String} recognized by {@link Color#parseColor}.
+ */
+ public static final String KEY_SECONDS_COLOR = "SECONDS_COLOR";
+
+ /**
+ * The path for the {@link DataItem} containing {@link DigitalWatchFaceService} configuration.
+ */
+ public static final String PATH_WITH_FEATURE = "/watch_face_config/Digital";
+
+ /**
+ * Name of the default interactive mode background color and the ambient mode background color.
+ */
+ public static final String COLOR_NAME_DEFAULT_AND_AMBIENT_BACKGROUND = "Black";
+ public static final int COLOR_VALUE_DEFAULT_AND_AMBIENT_BACKGROUND =
+ parseColor(COLOR_NAME_DEFAULT_AND_AMBIENT_BACKGROUND);
+
+ /**
+ * Name of the default interactive mode hour digits color and the ambient mode hour digits
+ * color.
+ */
+ public static final String COLOR_NAME_DEFAULT_AND_AMBIENT_HOUR_DIGITS = "White";
+ public static final int COLOR_VALUE_DEFAULT_AND_AMBIENT_HOUR_DIGITS =
+ parseColor(COLOR_NAME_DEFAULT_AND_AMBIENT_HOUR_DIGITS);
+
+ /**
+ * Name of the default interactive mode minute digits color and the ambient mode minute digits
+ * color.
+ */
+ public static final String COLOR_NAME_DEFAULT_AND_AMBIENT_MINUTE_DIGITS = "White";
+ public static final int COLOR_VALUE_DEFAULT_AND_AMBIENT_MINUTE_DIGITS =
+ parseColor(COLOR_NAME_DEFAULT_AND_AMBIENT_MINUTE_DIGITS);
+
+ /**
+ * Name of the default interactive mode second digits color and the ambient mode second digits
+ * color.
+ */
+ public static final String COLOR_NAME_DEFAULT_AND_AMBIENT_SECOND_DIGITS = "Gray";
+ public static final int COLOR_VALUE_DEFAULT_AND_AMBIENT_SECOND_DIGITS =
+ parseColor(COLOR_NAME_DEFAULT_AND_AMBIENT_SECOND_DIGITS);
+
+ /**
+ * Callback interface to perform an action with the current config {@link DataMap} for
+ * {@link DigitalWatchFaceService}.
+ */
+ public interface FetchConfigDataMapCallback {
+ /**
+ * Callback invoked with the current config {@link DataMap} for
+ * {@link DigitalWatchFaceService}.
+ */
+ void onConfigDataMapFetched(DataMap config);
+ }
+
+ private static int parseColor(String colorName) {
+ return Color.parseColor(colorName.toLowerCase());
+ }
+
+ /**
+ * Asynchronously fetches the current config {@link DataMap} for {@link DigitalWatchFaceService}
+ * and passes it to the given callback.
+ * <p>
+ * If the current config {@link DataItem} doesn't exist, it isn't created and the callback
+ * receives an empty DataMap.
+ */
+ public static void fetchConfigDataMap(final GoogleApiClient client,
+ final FetchConfigDataMapCallback callback) {
+ Wearable.NodeApi.getLocalNode(client).setResultCallback(
+ new ResultCallback<NodeApi.GetLocalNodeResult>() {
+ @Override
+ public void onResult(NodeApi.GetLocalNodeResult getLocalNodeResult) {
+ String localNode = getLocalNodeResult.getNode().getId();
+ Uri uri = new Uri.Builder()
+ .scheme("wear")
+ .path(DigitalWatchFaceUtil.PATH_WITH_FEATURE)
+ .authority(localNode)
+ .build();
+ Wearable.DataApi.getDataItem(client, uri)
+ .setResultCallback(new DataItemResultCallback(callback));
+ }
+ }
+ );
+ }
+
+ /**
+ * Overwrites (or sets, if not present) the keys in the current config {@link DataItem} with
+ * the ones appearing in the given {@link DataMap}. If the config DataItem doesn't exist,
+ * it's created.
+ * <p>
+ * It is allowed that only some of the keys used in the config DataItem appear in
+ * {@code configKeysToOverwrite}. The rest of the keys remains unmodified in this case.
+ */
+ public static void overwriteKeysInConfigDataMap(final GoogleApiClient googleApiClient,
+ final DataMap configKeysToOverwrite) {
+
+ DigitalWatchFaceUtil.fetchConfigDataMap(googleApiClient,
+ new FetchConfigDataMapCallback() {
+ @Override
+ public void onConfigDataMapFetched(DataMap currentConfig) {
+ DataMap overwrittenConfig = new DataMap();
+ overwrittenConfig.putAll(currentConfig);
+ overwrittenConfig.putAll(configKeysToOverwrite);
+ DigitalWatchFaceUtil.putConfigDataItem(googleApiClient, overwrittenConfig);
+ }
+ }
+ );
+ }
+
+ /**
+ * Overwrites the current config {@link DataItem}'s {@link DataMap} with {@code newConfig}.
+ * If the config DataItem doesn't exist, it's created.
+ */
+ public static void putConfigDataItem(GoogleApiClient googleApiClient, DataMap newConfig) {
+ PutDataMapRequest putDataMapRequest = PutDataMapRequest.create(PATH_WITH_FEATURE);
+ DataMap configToPut = putDataMapRequest.getDataMap();
+ configToPut.putAll(newConfig);
+ Wearable.DataApi.putDataItem(googleApiClient, putDataMapRequest.asPutDataRequest())
+ .setResultCallback(new ResultCallback<DataApi.DataItemResult>() {
+ @Override
+ public void onResult(DataApi.DataItemResult dataItemResult) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "putDataItem result status: " + dataItemResult.getStatus());
+ }
+ }
+ });
+ }
+
+ private static class DataItemResultCallback implements ResultCallback<DataApi.DataItemResult> {
+
+ private final FetchConfigDataMapCallback mCallback;
+
+ public DataItemResultCallback(FetchConfigDataMapCallback callback) {
+ mCallback = callback;
+ }
+
+ @Override
+ public void onResult(DataApi.DataItemResult dataItemResult) {
+ if (dataItemResult.getStatus().isSuccess()) {
+ if (dataItemResult.getDataItem() != null) {
+ DataItem configDataItem = dataItemResult.getDataItem();
+ DataMapItem dataMapItem = DataMapItem.fromDataItem(configDataItem);
+ DataMap config = dataMapItem.getDataMap();
+ mCallback.onConfigDataMapFetched(config);
+ } else {
+ mCallback.onConfigDataMapFetched(new DataMap());
+ }
+ }
+ }
+ }
+
+ private DigitalWatchFaceUtil() { }
+}
diff --git a/samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/DigitalWatchFaceWearableConfigActivity.java b/samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/DigitalWatchFaceWearableConfigActivity.java
new file mode 100644
index 000000000..4b309e6e2
--- /dev/null
+++ b/samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/DigitalWatchFaceWearableConfigActivity.java
@@ -0,0 +1,298 @@
+/*
+ * Copyright (C) 2014 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.wearable.watchface;
+
+import android.animation.AnimatorSet;
+import android.animation.ObjectAnimator;
+import android.app.Activity;
+import android.content.Context;
+import android.graphics.Color;
+import android.os.Bundle;
+import android.support.v7.widget.LinearLayoutManager;
+import android.support.v7.widget.RecyclerView;
+import android.support.wearable.view.BoxInsetLayout;
+import android.support.wearable.view.CircledImageView;
+import android.support.wearable.view.WearableListView;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.WindowInsets;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import com.google.android.gms.common.ConnectionResult;
+import com.google.android.gms.common.api.GoogleApiClient;
+import com.google.android.gms.wearable.DataMap;
+import com.google.android.gms.wearable.Wearable;
+
+/**
+ * The watch-side config activity for {@link DigitalWatchFaceService}, which allows for setting the
+ * background color.
+ */
+public class DigitalWatchFaceWearableConfigActivity extends Activity implements
+ WearableListView.ClickListener, WearableListView.OnScrollListener {
+ private static final String TAG = "DigitalWatchFaceConfig";
+
+ private GoogleApiClient mGoogleApiClient;
+ private TextView mHeader;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_digital_config);
+
+ mHeader = (TextView) findViewById(R.id.header);
+ WearableListView listView = (WearableListView) findViewById(R.id.color_picker);
+ BoxInsetLayout content = (BoxInsetLayout) findViewById(R.id.content);
+ // BoxInsetLayout adds padding by default on round devices. Add some on square devices.
+ content.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
+ @Override
+ public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
+ if (!insets.isRound()) {
+ v.setPaddingRelative(
+ (int) getResources().getDimensionPixelSize(R.dimen.content_padding_start),
+ v.getPaddingTop(),
+ v.getPaddingEnd(),
+ v.getPaddingBottom());
+ }
+ return v.onApplyWindowInsets(insets);
+ }
+ });
+
+ listView.setHasFixedSize(true);
+ listView.setClickListener(this);
+ listView.addOnScrollListener(this);
+
+ String[] colors = getResources().getStringArray(R.array.color_array);
+ listView.setAdapter(new ColorListAdapter(colors));
+
+ mGoogleApiClient = new GoogleApiClient.Builder(this)
+ .addConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() {
+ @Override
+ public void onConnected(Bundle connectionHint) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onConnected: " + connectionHint);
+ }
+ }
+
+ @Override
+ public void onConnectionSuspended(int cause) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onConnectionSuspended: " + cause);
+ }
+ }
+ })
+ .addOnConnectionFailedListener(new GoogleApiClient.OnConnectionFailedListener() {
+ @Override
+ public void onConnectionFailed(ConnectionResult result) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onConnectionFailed: " + result);
+ }
+ }
+ })
+ .addApi(Wearable.API)
+ .build();
+ }
+
+ @Override
+ protected void onStart() {
+ super.onStart();
+ mGoogleApiClient.connect();
+ }
+
+ @Override
+ protected void onStop() {
+ if (mGoogleApiClient != null && mGoogleApiClient.isConnected()) {
+ mGoogleApiClient.disconnect();
+ }
+ super.onStop();
+ }
+
+ @Override // WearableListView.ClickListener
+ public void onClick(WearableListView.ViewHolder viewHolder) {
+ ColorItemViewHolder colorItemViewHolder = (ColorItemViewHolder) viewHolder;
+ updateConfigDataItem(colorItemViewHolder.mColorItem.getColor());
+ finish();
+ }
+
+ @Override // WearableListView.ClickListener
+ public void onTopEmptyRegionClick() {}
+
+ @Override // WearableListView.OnScrollListener
+ public void onScroll(int scroll) {}
+
+ @Override // WearableListView.OnScrollListener
+ public void onAbsoluteScrollChange(int scroll) {
+ float newTranslation = Math.min(-scroll, 0);
+ mHeader.setTranslationY(newTranslation);
+ }
+
+ @Override // WearableListView.OnScrollListener
+ public void onScrollStateChanged(int scrollState) {}
+
+ @Override // WearableListView.OnScrollListener
+ public void onCentralPositionChanged(int centralPosition) {}
+
+ private void updateConfigDataItem(final int backgroundColor) {
+ DataMap configKeysToOverwrite = new DataMap();
+ configKeysToOverwrite.putInt(DigitalWatchFaceUtil.KEY_BACKGROUND_COLOR,
+ backgroundColor);
+ DigitalWatchFaceUtil.overwriteKeysInConfigDataMap(mGoogleApiClient, configKeysToOverwrite);
+ }
+
+ private class ColorListAdapter extends WearableListView.Adapter {
+ private final String[] mColors;
+
+ public ColorListAdapter(String[] colors) {
+ mColors = colors;
+ }
+
+ @Override
+ public ColorItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
+ return new ColorItemViewHolder(new ColorItem(parent.getContext()));
+ }
+
+ @Override
+ public void onBindViewHolder(WearableListView.ViewHolder holder, int position) {
+ ColorItemViewHolder colorItemViewHolder = (ColorItemViewHolder) holder;
+ String colorName = mColors[position];
+ colorItemViewHolder.mColorItem.setColor(colorName);
+
+ RecyclerView.LayoutParams layoutParams =
+ new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
+ ViewGroup.LayoutParams.WRAP_CONTENT);
+ int colorPickerItemMargin = (int) getResources()
+ .getDimension(R.dimen.digital_config_color_picker_item_margin);
+ // Add margins to first and last item to make it possible for user to tap on them.
+ if (position == 0) {
+ layoutParams.setMargins(0, colorPickerItemMargin, 0, 0);
+ } else if (position == mColors.length - 1) {
+ layoutParams.setMargins(0, 0, 0, colorPickerItemMargin);
+ } else {
+ layoutParams.setMargins(0, 0, 0, 0);
+ }
+ colorItemViewHolder.itemView.setLayoutParams(layoutParams);
+ }
+
+ @Override
+ public int getItemCount() {
+ return mColors.length;
+ }
+ }
+
+ /** The layout of a color item including image and label. */
+ private static class ColorItem extends LinearLayout implements
+ WearableListView.OnCenterProximityListener {
+ /** The duration of the expand/shrink animation. */
+ private static final int ANIMATION_DURATION_MS = 150;
+ /** The ratio for the size of a circle in shrink state. */
+ private static final float SHRINK_CIRCLE_RATIO = .75f;
+
+ private static final float SHRINK_LABEL_ALPHA = .5f;
+ private static final float EXPAND_LABEL_ALPHA = 1f;
+
+ private final TextView mLabel;
+ private final CircledImageView mColor;
+
+ private final float mExpandCircleRadius;
+ private final float mShrinkCircleRadius;
+
+ private final ObjectAnimator mExpandCircleAnimator;
+ private final ObjectAnimator mExpandLabelAnimator;
+ private final AnimatorSet mExpandAnimator;
+
+ private final ObjectAnimator mShrinkCircleAnimator;
+ private final ObjectAnimator mShrinkLabelAnimator;
+ private final AnimatorSet mShrinkAnimator;
+
+ public ColorItem(Context context) {
+ super(context);
+ View.inflate(context, R.layout.color_picker_item, this);
+
+ mLabel = (TextView) findViewById(R.id.label);
+ mColor = (CircledImageView) findViewById(R.id.color);
+
+ mExpandCircleRadius = mColor.getCircleRadius();
+ mShrinkCircleRadius = mExpandCircleRadius * SHRINK_CIRCLE_RATIO;
+
+ mShrinkCircleAnimator = ObjectAnimator.ofFloat(mColor, "circleRadius",
+ mExpandCircleRadius, mShrinkCircleRadius);
+ mShrinkLabelAnimator = ObjectAnimator.ofFloat(mLabel, "alpha",
+ EXPAND_LABEL_ALPHA, SHRINK_LABEL_ALPHA);
+ mShrinkAnimator = new AnimatorSet().setDuration(ANIMATION_DURATION_MS);
+ mShrinkAnimator.playTogether(mShrinkCircleAnimator, mShrinkLabelAnimator);
+
+ mExpandCircleAnimator = ObjectAnimator.ofFloat(mColor, "circleRadius",
+ mShrinkCircleRadius, mExpandCircleRadius);
+ mExpandLabelAnimator = ObjectAnimator.ofFloat(mLabel, "alpha",
+ SHRINK_LABEL_ALPHA, EXPAND_LABEL_ALPHA);
+ mExpandAnimator = new AnimatorSet().setDuration(ANIMATION_DURATION_MS);
+ mExpandAnimator.playTogether(mExpandCircleAnimator, mExpandLabelAnimator);
+ }
+
+ @Override
+ public void onCenterPosition(boolean animate) {
+ if (animate) {
+ mShrinkAnimator.cancel();
+ if (!mExpandAnimator.isRunning()) {
+ mExpandCircleAnimator.setFloatValues(mColor.getCircleRadius(), mExpandCircleRadius);
+ mExpandLabelAnimator.setFloatValues(mLabel.getAlpha(), EXPAND_LABEL_ALPHA);
+ mExpandAnimator.start();
+ }
+ } else {
+ mExpandAnimator.cancel();
+ mColor.setCircleRadius(mExpandCircleRadius);
+ mLabel.setAlpha(EXPAND_LABEL_ALPHA);
+ }
+ }
+
+ @Override
+ public void onNonCenterPosition(boolean animate) {
+ if (animate) {
+ mExpandAnimator.cancel();
+ if (!mShrinkAnimator.isRunning()) {
+ mShrinkCircleAnimator.setFloatValues(mColor.getCircleRadius(), mShrinkCircleRadius);
+ mShrinkLabelAnimator.setFloatValues(mLabel.getAlpha(), SHRINK_LABEL_ALPHA);
+ mShrinkAnimator.start();
+ }
+ } else {
+ mShrinkAnimator.cancel();
+ mColor.setCircleRadius(mShrinkCircleRadius);
+ mLabel.setAlpha(SHRINK_LABEL_ALPHA);
+ }
+ }
+
+ private void setColor(String colorName) {
+ mLabel.setText(colorName);
+ mColor.setCircleColor(Color.parseColor(colorName));
+ }
+
+ private int getColor() {
+ return mColor.getDefaultCircleColor();
+ }
+ }
+
+ private static class ColorItemViewHolder extends WearableListView.ViewHolder {
+ private final ColorItem mColorItem;
+
+ public ColorItemViewHolder(ColorItem colorItem) {
+ super(colorItem);
+ mColorItem = colorItem;
+ }
+ }
+}
diff --git a/samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/Gles2ColoredTriangleList.java b/samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/Gles2ColoredTriangleList.java
new file mode 100644
index 000000000..2441c6591
--- /dev/null
+++ b/samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/Gles2ColoredTriangleList.java
@@ -0,0 +1,278 @@
+/*
+ * Copyright (C) 2014 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.wearable.watchface;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.FloatBuffer;
+
+import android.opengl.GLES20;
+import android.opengl.GLU;
+import android.opengl.GLUtils;
+import android.util.Log;
+
+/**
+ * A list of triangles drawn in a single solid color using OpenGL ES 2.0.
+ */
+public class Gles2ColoredTriangleList {
+ private static final String TAG = "GlColoredTriangleList";
+
+ /** Whether to check for GL errors. This is slow, so not appropriate for production builds. */
+ private static final boolean CHECK_GL_ERRORS = false;
+
+ /** Number of coordinates per vertex in this array: one for each of x, y, and z. */
+ private static final int COORDS_PER_VERTEX = 3;
+
+ /** Number of bytes to store a float in GL. */
+ public static final int BYTES_PER_FLOAT = 4;
+
+ /** Number of bytes per vertex. */
+ private static final int VERTEX_STRIDE = COORDS_PER_VERTEX * BYTES_PER_FLOAT;
+
+ /** Triangles have three vertices. */
+ private static final int VERTICE_PER_TRIANGLE = 3;
+
+ /**
+ * Number of components in an OpenGL color. The components are:<ol>
+ * <li>red
+ * <li>green
+ * <li>blue
+ * <li>alpha
+ * </ol>
+ */
+ private static final int NUM_COLOR_COMPONENTS = 4;
+
+ /** Shaders to render this triangle list. */
+ private final Program mProgram;
+
+ /** The VBO containing the vertex coordinates. */
+ private final FloatBuffer mVertexBuffer;
+
+ /**
+ * Color of this triangle list represented as an array of floats in the range [0, 1] in RGBA
+ * order.
+ */
+ private final float mColor[];
+
+ /** Number of coordinates in this triangle list. */
+ private final int mNumCoords;
+
+ /**
+ * Creates a Gles2ColoredTriangleList to draw a triangle list with the given vertices and color.
+ *
+ * @param program program for drawing triangles
+ * @param triangleCoords flat array of 3D coordinates of triangle vertices in counterclockwise
+ * order
+ * @param color color in RGBA order, each in the range [0, 1]
+ */
+ public Gles2ColoredTriangleList(Program program, float[] triangleCoords, float[] color) {
+ if (triangleCoords.length % (VERTICE_PER_TRIANGLE * COORDS_PER_VERTEX) != 0) {
+ throw new IllegalArgumentException("must be multiple"
+ + " of VERTICE_PER_TRIANGLE * COORDS_PER_VERTEX coordinates");
+ }
+ if (color.length != NUM_COLOR_COMPONENTS) {
+ throw new IllegalArgumentException("wrong number of color components");
+ }
+ mProgram = program;
+ mColor = color;
+
+ ByteBuffer bb = ByteBuffer.allocateDirect(triangleCoords.length * BYTES_PER_FLOAT);
+
+ // Use the device hardware's native byte order.
+ bb.order(ByteOrder.nativeOrder());
+
+ // Create a FloatBuffer that wraps the ByteBuffer.
+ mVertexBuffer = bb.asFloatBuffer();
+
+ // Add the coordinates to the FloatBuffer.
+ mVertexBuffer.put(triangleCoords);
+
+ // Go back to the start for reading.
+ mVertexBuffer.position(0);
+
+ mNumCoords = triangleCoords.length / COORDS_PER_VERTEX;
+ }
+
+ /**
+ * Draws this triangle list using OpenGL commands.
+ *
+ * @param mvpMatrix the Model View Project matrix to draw this triangle list
+ */
+ public void draw(float[] mvpMatrix) {
+ // Pass the MVP matrix, vertex data, and color to OpenGL.
+ mProgram.bind(mvpMatrix, mVertexBuffer, mColor);
+
+ // Draw the triangle list.
+ GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, mNumCoords);
+ if (CHECK_GL_ERRORS) checkGlError("glDrawArrays");
+ }
+
+ /**
+ * Checks if any of the GL calls since the last time this method was called set an error
+ * condition. Call this method immediately after calling a GL method. Pass the name of the GL
+ * operation. For example:
+ *
+ * <pre>
+ * mColorHandle = GLES20.glGetUniformLocation(mProgram, "uColor");
+ * MyGLRenderer.checkGlError("glGetUniformLocation");</pre>
+ *
+ * If the operation is not successful, the check throws an exception.
+ *
+ * <p><em>Note</em> This is quite slow so it's best to use it sparingly in production builds.
+ *
+ * @param glOperation name of the OpenGL call to check
+ */
+ private static void checkGlError(String glOperation) {
+ int error = GLES20.glGetError();
+ if (error != GLES20.GL_NO_ERROR) {
+ String errorString = GLU.gluErrorString(error);
+ if (errorString == null) {
+ errorString = GLUtils.getEGLErrorString(error);
+ }
+ String message = glOperation + " caused GL error 0x" + Integer.toHexString(error) +
+ ": " + errorString;
+ Log.e(TAG, message);
+ throw new RuntimeException(message);
+ }
+ }
+
+ /**
+ * Compiles an OpenGL shader.
+ *
+ * @param type {@link GLES20#GL_VERTEX_SHADER} or {@link GLES20#GL_FRAGMENT_SHADER}
+ * @param shaderCode string containing the shader source code
+ * @return ID for the shader
+ */
+ private static int loadShader(int type, String shaderCode){
+ // Create a vertex or fragment shader.
+ int shader = GLES20.glCreateShader(type);
+ if (CHECK_GL_ERRORS) checkGlError("glCreateShader");
+ if (shader == 0) {
+ throw new IllegalStateException("glCreateShader failed");
+ }
+
+ // Add the source code to the shader and compile it.
+ GLES20.glShaderSource(shader, shaderCode);
+ if (CHECK_GL_ERRORS) checkGlError("glShaderSource");
+ GLES20.glCompileShader(shader);
+ if (CHECK_GL_ERRORS) checkGlError("glCompileShader");
+
+ return shader;
+ }
+
+ /** OpenGL shaders for drawing solid colored triangle lists. */
+ public static class Program {
+ /** Trivial vertex shader that transforms the input vertex by the MVP matrix. */
+ private static final String VERTEX_SHADER_CODE = "" +
+ "uniform mat4 uMvpMatrix;\n" +
+ "attribute vec4 aPosition;\n" +
+ "void main() {\n" +
+ " gl_Position = uMvpMatrix * aPosition;\n" +
+ "}\n";
+
+ /** Trivial fragment shader that draws with a fixed color. */
+ private static final String FRAGMENT_SHADER_CODE = "" +
+ "precision mediump float;\n" +
+ "uniform vec4 uColor;\n" +
+ "void main() {\n" +
+ " gl_FragColor = uColor;\n" +
+ "}\n";
+
+ /** ID OpenGL uses to identify this program. */
+ private final int mProgramId;
+
+ /** Handle for uMvpMatrix uniform in vertex shader. */
+ private final int mMvpMatrixHandle;
+
+ /** Handle for aPosition attribute in vertex shader. */
+ private final int mPositionHandle;
+
+ /** Handle for uColor uniform in fragment shader. */
+ private final int mColorHandle;
+
+ /**
+ * Creates a program to draw triangle lists. For optimal drawing efficiency, one program
+ * should be used for all triangle lists being drawn.
+ */
+ public Program() {
+ // Prepare shaders.
+ int vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, VERTEX_SHADER_CODE);
+ int fragmentShader = loadShader(GLES20.GL_FRAGMENT_SHADER, FRAGMENT_SHADER_CODE);
+
+ // Create empty OpenGL Program.
+ mProgramId = GLES20.glCreateProgram();
+ if (CHECK_GL_ERRORS) checkGlError("glCreateProgram");
+ if (mProgramId == 0) {
+ throw new IllegalStateException("glCreateProgram failed");
+ }
+
+ // Add the shaders to the program.
+ GLES20.glAttachShader(mProgramId, vertexShader);
+ if (CHECK_GL_ERRORS) checkGlError("glAttachShader");
+ GLES20.glAttachShader(mProgramId, fragmentShader);
+ if (CHECK_GL_ERRORS) checkGlError("glAttachShader");
+
+ // Link the program so it can be executed.
+ GLES20.glLinkProgram(mProgramId);
+ if (CHECK_GL_ERRORS) checkGlError("glLinkProgram");
+
+ // Get a handle to the uMvpMatrix uniform in the vertex shader.
+ mMvpMatrixHandle = GLES20.glGetUniformLocation(mProgramId, "uMvpMatrix");
+ if (CHECK_GL_ERRORS) checkGlError("glGetUniformLocation");
+
+ // Get a handle to the vertex shader's aPosition attribute.
+ mPositionHandle = GLES20.glGetAttribLocation(mProgramId, "aPosition");
+ if (CHECK_GL_ERRORS) checkGlError("glGetAttribLocation");
+
+ // Enable vertex array (VBO).
+ GLES20.glEnableVertexAttribArray(mPositionHandle);
+ if (CHECK_GL_ERRORS) checkGlError("glEnableVertexAttribArray");
+
+ // Get a handle to fragment shader's uColor uniform.
+ mColorHandle = GLES20.glGetUniformLocation(mProgramId, "uColor");
+ if (CHECK_GL_ERRORS) checkGlError("glGetUniformLocation");
+ }
+
+ /**
+ * Tells OpenGL to use this program. Call this method before drawing a sequence of
+ * triangle lists.
+ */
+ public void use() {
+ GLES20.glUseProgram(mProgramId);
+ if (CHECK_GL_ERRORS) checkGlError("glUseProgram");
+ }
+
+ /** Sends the given MVP matrix, vertex data, and color to OpenGL. */
+ public void bind(float[] mvpMatrix, FloatBuffer vertexBuffer, float[] color) {
+ // Pass the MVP matrix to OpenGL.
+ GLES20.glUniformMatrix4fv(mMvpMatrixHandle, 1 /* count */, false /* transpose */,
+ mvpMatrix, 0 /* offset */);
+ if (CHECK_GL_ERRORS) checkGlError("glUniformMatrix4fv");
+
+ // Pass the VBO with the triangle list's vertices to OpenGL.
+ GLES20.glEnableVertexAttribArray(mPositionHandle);
+ if (CHECK_GL_ERRORS) checkGlError("glEnableVertexAttribArray");
+ GLES20.glVertexAttribPointer(mPositionHandle, COORDS_PER_VERTEX, GLES20.GL_FLOAT,
+ false /* normalized */, VERTEX_STRIDE, vertexBuffer);
+ if (CHECK_GL_ERRORS) checkGlError("glVertexAttribPointer");
+
+ // Pass the triangle list's color to OpenGL.
+ GLES20.glUniform4fv(mColorHandle, 1 /* count */, color, 0 /* offset */);
+ if (CHECK_GL_ERRORS) checkGlError("glUniform4fv");
+ }
+ }
+}
diff --git a/samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/SweepWatchFaceService.java b/samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/SweepWatchFaceService.java
new file mode 100644
index 000000000..44e9569f5
--- /dev/null
+++ b/samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/SweepWatchFaceService.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 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.wearable.watchface;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.Rect;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.support.wearable.watchface.CanvasWatchFaceService;
+import android.support.wearable.watchface.WatchFaceService;
+import android.support.wearable.watchface.WatchFaceStyle;
+import android.text.format.Time;
+import android.util.Log;
+import android.view.SurfaceHolder;
+
+import java.util.TimeZone;
+
+/**
+ * Sample analog watch face with a sweep second hand. In ambient mode, the second hand isn't shown.
+ * On devices with low-bit ambient mode, the hands are drawn without anti-aliasing in ambient mode.
+ * The watch face is drawn with less contrast in mute mode.
+ *
+ * {@link AnalogWatchFaceService} is similar but has a ticking second hand.
+ */
+public class SweepWatchFaceService extends CanvasWatchFaceService {
+ private static final String TAG = "SweepWatchFaceService";
+
+ @Override
+ public Engine onCreateEngine() {
+ return new Engine();
+ }
+
+ private class Engine extends CanvasWatchFaceService.Engine {
+ Paint mHourPaint;
+ Paint mMinutePaint;
+ Paint mSecondPaint;
+ Paint mTickPaint;
+ boolean mMute;
+ Time mTime;
+
+ final BroadcastReceiver mTimeZoneReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ mTime.clear(intent.getStringExtra("time-zone"));
+ mTime.setToNow();
+ }
+ };
+ boolean mRegisteredTimeZoneReceiver = false;
+
+ /**
+ * Whether the display supports fewer bits for each color in ambient mode. When true, we
+ * disable anti-aliasing in ambient mode.
+ */
+ boolean mLowBitAmbient;
+
+ Bitmap mBackgroundBitmap;
+ Bitmap mBackgroundScaledBitmap;
+
+ @Override
+ public void onCreate(SurfaceHolder holder) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onCreate");
+ }
+ super.onCreate(holder);
+
+ setWatchFaceStyle(new WatchFaceStyle.Builder(SweepWatchFaceService.this)
+ .setCardPeekMode(WatchFaceStyle.PEEK_MODE_SHORT)
+ .setBackgroundVisibility(WatchFaceStyle.BACKGROUND_VISIBILITY_INTERRUPTIVE)
+ .setShowSystemUiTime(false)
+ .build());
+
+ Resources resources = SweepWatchFaceService.this.getResources();
+ Drawable backgroundDrawable = resources.getDrawable(R.drawable.bg);
+ mBackgroundBitmap = ((BitmapDrawable) backgroundDrawable).getBitmap();
+
+ mHourPaint = new Paint();
+ mHourPaint.setARGB(255, 200, 200, 200);
+ mHourPaint.setStrokeWidth(5.f);
+ mHourPaint.setAntiAlias(true);
+ mHourPaint.setStrokeCap(Paint.Cap.ROUND);
+
+ mMinutePaint = new Paint();
+ mMinutePaint.setARGB(255, 200, 200, 200);
+ mMinutePaint.setStrokeWidth(3.f);
+ mMinutePaint.setAntiAlias(true);
+ mMinutePaint.setStrokeCap(Paint.Cap.ROUND);
+
+ mSecondPaint = new Paint();
+ mSecondPaint.setARGB(255, 255, 0, 0);
+ mSecondPaint.setStrokeWidth(2.f);
+ mSecondPaint.setAntiAlias(true);
+ mSecondPaint.setStrokeCap(Paint.Cap.ROUND);
+
+ mTickPaint = new Paint();
+ mTickPaint.setARGB(100, 255, 255, 255);
+ mTickPaint.setStrokeWidth(2.f);
+ mTickPaint.setAntiAlias(true);
+
+ mTime = new Time();
+ }
+
+ @Override
+ public void onPropertiesChanged(Bundle properties) {
+ super.onPropertiesChanged(properties);
+ mLowBitAmbient = properties.getBoolean(PROPERTY_LOW_BIT_AMBIENT, false);
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onPropertiesChanged: low-bit ambient = " + mLowBitAmbient);
+ }
+ }
+
+ @Override
+ public void onTimeTick() {
+ super.onTimeTick();
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onTimeTick: ambient = " + isInAmbientMode());
+ }
+ invalidate();
+ }
+
+ @Override
+ public void onAmbientModeChanged(boolean inAmbientMode) {
+ super.onAmbientModeChanged(inAmbientMode);
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onAmbientModeChanged: " + inAmbientMode);
+ }
+ if (mLowBitAmbient) {
+ boolean antiAlias = !inAmbientMode;
+ mHourPaint.setAntiAlias(antiAlias);
+ mMinutePaint.setAntiAlias(antiAlias);
+ mSecondPaint.setAntiAlias(antiAlias);
+ mTickPaint.setAntiAlias(antiAlias);
+ }
+ invalidate();
+ }
+
+ @Override
+ public void onInterruptionFilterChanged(int interruptionFilter) {
+ super.onInterruptionFilterChanged(interruptionFilter);
+ boolean inMuteMode = (interruptionFilter == WatchFaceService.INTERRUPTION_FILTER_NONE);
+ if (mMute != inMuteMode) {
+ mMute = inMuteMode;
+ mHourPaint.setAlpha(inMuteMode ? 100 : 255);
+ mMinutePaint.setAlpha(inMuteMode ? 100 : 255);
+ mSecondPaint.setAlpha(inMuteMode ? 80 : 255);
+ invalidate();
+ }
+ }
+
+ @Override
+ public void onDraw(Canvas canvas, Rect bounds) {
+ if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ Log.v(TAG, "onDraw");
+ }
+ long now = System.currentTimeMillis();
+ mTime.set(now);
+ int milliseconds = (int) (now % 1000);
+
+ int width = bounds.width();
+ int height = bounds.height();
+
+ // Draw the background, scaled to fit.
+ if (mBackgroundScaledBitmap == null
+ || mBackgroundScaledBitmap.getWidth() != width
+ || mBackgroundScaledBitmap.getHeight() != height) {
+ mBackgroundScaledBitmap = Bitmap.createScaledBitmap(mBackgroundBitmap,
+ width, height, true /* filter */);
+ }
+ canvas.drawBitmap(mBackgroundScaledBitmap, 0, 0, null);
+
+ // Find the center. Ignore the window insets so that, on round watches with a
+ // "chin", the watch face is centered on the entire screen, not just the usable
+ // portion.
+ float centerX = width / 2f;
+ float centerY = height / 2f;
+
+ // Draw the ticks.
+ float innerTickRadius = centerX - 10;
+ float outerTickRadius = centerX;
+ for (int tickIndex = 0; tickIndex < 12; tickIndex++) {
+ float tickRot = (float) (tickIndex * Math.PI * 2 / 12);
+ float innerX = (float) Math.sin(tickRot) * innerTickRadius;
+ float innerY = (float) -Math.cos(tickRot) * innerTickRadius;
+ float outerX = (float) Math.sin(tickRot) * outerTickRadius;
+ float outerY = (float) -Math.cos(tickRot) * outerTickRadius;
+ canvas.drawLine(centerX + innerX, centerY + innerY,
+ centerX + outerX, centerY + outerY, mTickPaint);
+ }
+
+ float seconds = mTime.second + milliseconds / 1000f;
+ float secRot = seconds / 30f * (float) Math.PI;
+ int minutes = mTime.minute;
+ float minRot = minutes / 30f * (float) Math.PI;
+ float hrRot = ((mTime.hour + (minutes / 60f)) / 6f ) * (float) Math.PI;
+
+ float secLength = centerX - 20;
+ float minLength = centerX - 40;
+ float hrLength = centerX - 80;
+
+ if (!isInAmbientMode()) {
+ float secX = (float) Math.sin(secRot) * secLength;
+ float secY = (float) -Math.cos(secRot) * secLength;
+ canvas.drawLine(centerX, centerY, centerX + secX, centerY + secY, mSecondPaint);
+ }
+
+ float minX = (float) Math.sin(minRot) * minLength;
+ float minY = (float) -Math.cos(minRot) * minLength;
+ canvas.drawLine(centerX, centerY, centerX + minX, centerY + minY, mMinutePaint);
+
+ float hrX = (float) Math.sin(hrRot) * hrLength;
+ float hrY = (float) -Math.cos(hrRot) * hrLength;
+ canvas.drawLine(centerX, centerY, centerX + hrX, centerY + hrY, mHourPaint);
+
+ // Draw every frame as long as we're visible and in interactive mode.
+ if (isVisible() && !isInAmbientMode()) {
+ invalidate();
+ }
+ }
+
+ @Override
+ public void onVisibilityChanged(boolean visible) {
+ super.onVisibilityChanged(visible);
+
+ if (visible) {
+ registerReceiver();
+
+ // Update time zone in case it changed while we weren't visible.
+ mTime.clear(TimeZone.getDefault().getID());
+ mTime.setToNow();
+
+ invalidate();
+ } else {
+ unregisterReceiver();
+ }
+ }
+
+ private void registerReceiver() {
+ if (mRegisteredTimeZoneReceiver) {
+ return;
+ }
+ mRegisteredTimeZoneReceiver = true;
+ IntentFilter filter = new IntentFilter(Intent.ACTION_TIMEZONE_CHANGED);
+ SweepWatchFaceService.this.registerReceiver(mTimeZoneReceiver, filter);
+ }
+
+ private void unregisterReceiver() {
+ if (!mRegisteredTimeZoneReceiver) {
+ return;
+ }
+ mRegisteredTimeZoneReceiver = false;
+ SweepWatchFaceService.this.unregisterReceiver(mTimeZoneReceiver);
+ }
+ }
+}
diff --git a/samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/TiltWatchFaceService.java b/samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/TiltWatchFaceService.java
new file mode 100644
index 000000000..6dd01b000
--- /dev/null
+++ b/samples/browseable/WatchFace/Wearable/src/com.example.android.wearable.watchface/TiltWatchFaceService.java
@@ -0,0 +1,478 @@
+/*
+ * Copyright (C) 2014 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.wearable.watchface;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.opengl.GLES20;
+import android.opengl.Matrix;
+import android.support.wearable.watchface.Gles2WatchFaceService;
+import android.support.wearable.watchface.WatchFaceStyle;
+import android.text.format.Time;
+import android.util.Log;
+import android.view.Gravity;
+import android.view.SurfaceHolder;
+
+import java.util.TimeZone;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Sample watch face using OpenGL. The watch face is rendered using
+ * {@link Gles2ColoredTriangleList}s. The camera moves around in interactive mode and stops moving
+ * when the watch enters ambient mode.
+ */
+public class TiltWatchFaceService extends Gles2WatchFaceService {
+
+ private static final String TAG = "TiltWatchFaceService";
+
+ /** Expected frame rate in interactive mode. */
+ private static final long FPS = 60;
+
+ /** How long each frame is displayed at expected frame rate. */
+ private static final long FRAME_PERIOD_MS = TimeUnit.SECONDS.toMillis(1) / FPS;
+
+ @Override
+ public Engine onCreateEngine() {
+ return new Engine();
+ }
+
+ private class Engine extends Gles2WatchFaceService.Engine {
+ /** Cycle time before the camera motion repeats. */
+ private static final long CYCLE_PERIOD_SECONDS = 5;
+
+ /** Number of camera angles to precompute. */
+ private final int mNumCameraAngles = (int) (CYCLE_PERIOD_SECONDS * FPS);
+
+ /** Projection transformation matrix. Converts from 3D to 2D. */
+ private final float[] mProjectionMatrix = new float[16];
+
+ /**
+ * View transformation matrices to use in interactive mode. Converts from world to camera-
+ * relative coordinates. One matrix per camera position.
+ */
+ private final float[][] mViewMatrices = new float[mNumCameraAngles][16];
+
+ /** The view transformation matrix to use in ambient mode */
+ private final float[] mAmbientViewMatrix = new float[16];
+
+ /**
+ * Model transformation matrices. Converts from model-relative coordinates to world
+ * coordinates. One matrix per degree of rotation.
+ */
+ private final float[][] mModelMatrices = new float[360][16];
+
+ /**
+ * Products of {@link #mViewMatrices} and {@link #mProjectionMatrix}. One matrix per camera
+ * position.
+ */
+ private final float[][] mVpMatrices = new float[mNumCameraAngles][16];
+
+ /** The product of {@link #mAmbientViewMatrix} and {@link #mProjectionMatrix} */
+ private final float[] mAmbientVpMatrix = new float[16];
+
+ /**
+ * Product of {@link #mModelMatrices}, {@link #mViewMatrices}, and
+ * {@link #mProjectionMatrix}.
+ */
+ private final float[] mMvpMatrix = new float[16];
+
+ /** Triangles for the 4 major ticks. These are grouped together to speed up rendering. */
+ private Gles2ColoredTriangleList mMajorTickTriangles;
+
+ /** Triangles for the 8 minor ticks. These are grouped together to speed up rendering. */
+ private Gles2ColoredTriangleList mMinorTickTriangles;
+
+ /** Triangle for the second hand. */
+ private Gles2ColoredTriangleList mSecondHandTriangle;
+
+ /** Triangle for the minute hand. */
+ private Gles2ColoredTriangleList mMinuteHandTriangle;
+
+ /** Triangle for the hour hand. */
+ private Gles2ColoredTriangleList mHourHandTriangle;
+
+ private Time mTime = new Time();
+
+ /** Whether we've registered {@link #mTimeZoneReceiver}. */
+ private boolean mRegisteredTimeZoneReceiver;
+
+ private final BroadcastReceiver mTimeZoneReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ mTime.clear(intent.getStringExtra("time-zone"));
+ mTime.setToNow();
+ }
+ };
+
+ @Override
+ public void onCreate(SurfaceHolder surfaceHolder) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onCreate");
+ }
+ super.onCreate(surfaceHolder);
+ setWatchFaceStyle(new WatchFaceStyle.Builder(TiltWatchFaceService.this)
+ .setCardPeekMode(WatchFaceStyle.PEEK_MODE_SHORT)
+ .setBackgroundVisibility(WatchFaceStyle.BACKGROUND_VISIBILITY_INTERRUPTIVE)
+ .setStatusBarGravity(Gravity.RIGHT | Gravity.TOP)
+ .setHotwordIndicatorGravity(Gravity.LEFT | Gravity.TOP)
+ .setShowSystemUiTime(false)
+ .build());
+ }
+
+ @Override
+ public void onGlContextCreated() {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onGlContextCreated");
+ }
+ super.onGlContextCreated();
+
+ // Create program for drawing triangles.
+ Gles2ColoredTriangleList.Program triangleProgram =
+ new Gles2ColoredTriangleList.Program();
+
+ // We only draw triangles which all use the same program so we don't need to switch
+ // programs mid-frame. This means we can tell OpenGL to use this program only once
+ // rather than having to do so for each frame. This makes OpenGL draw faster.
+ triangleProgram.use();
+
+ // Create triangles for the ticks.
+ mMajorTickTriangles = createMajorTicks(triangleProgram);
+ mMinorTickTriangles = createMinorTicks(triangleProgram);
+
+ // Create triangles for the hands.
+ mSecondHandTriangle = createHand(
+ triangleProgram,
+ 0.02f /* width */,
+ 1.0f /* height */,
+ new float[]{
+ 1.0f /* red */,
+ 0.0f /* green */,
+ 0.0f /* blue */,
+ 1.0f /* alpha */
+ }
+ );
+ mMinuteHandTriangle = createHand(
+ triangleProgram,
+ 0.06f /* width */,
+ 0.8f /* height */,
+ new float[]{
+ 0.7f /* red */,
+ 0.7f /* green */,
+ 0.7f /* blue */,
+ 1.0f /* alpha */
+ }
+ );
+ mHourHandTriangle = createHand(
+ triangleProgram,
+ 0.1f /* width */,
+ 0.5f /* height */,
+ new float[]{
+ 0.9f /* red */,
+ 0.9f /* green */,
+ 0.9f /* blue */,
+ 1.0f /* alpha */
+ }
+ );
+
+ // Precompute the clock angles.
+ for (int i = 0; i < mModelMatrices.length; ++i) {
+ Matrix.setRotateM(mModelMatrices[i], 0, i, 0, 0, 1);
+ }
+
+ // Precompute the camera angles.
+ for (int i = 0; i < mNumCameraAngles; ++i) {
+ // Set the camera position (View matrix). When active, move the eye around to show
+ // off that this is 3D.
+ final float cameraAngle = (float) (((float) i) / mNumCameraAngles * 2 * Math.PI);
+ final float eyeX = (float) Math.cos(cameraAngle);
+ final float eyeY = (float) Math.sin(cameraAngle);
+ Matrix.setLookAtM(mViewMatrices[i],
+ 0, // dest index
+ eyeX, eyeY, -3, // eye
+ 0, 0, 0, // center
+ 0, 1, 0); // up vector
+ }
+
+ Matrix.setLookAtM(mAmbientViewMatrix,
+ 0, // dest index
+ 0, 0, -3, // eye
+ 0, 0, 0, // center
+ 0, 1, 0); // up vector
+ }
+
+ @Override
+ public void onGlSurfaceCreated(int width, int height) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onGlSurfaceCreated: " + width + " x " + height);
+ }
+ super.onGlSurfaceCreated(width, height);
+
+ // Update the projection matrix based on the new aspect ratio.
+ final float aspectRatio = (float) width / height;
+ Matrix.frustumM(mProjectionMatrix,
+ 0 /* offset */,
+ -aspectRatio /* left */,
+ aspectRatio /* right */,
+ -1 /* bottom */,
+ 1 /* top */,
+ 2 /* near */,
+ 7 /* far */);
+
+ // Precompute the products of Projection and View matrices for each camera angle.
+ for (int i = 0; i < mNumCameraAngles; ++i) {
+ Matrix.multiplyMM(mVpMatrices[i], 0, mProjectionMatrix, 0, mViewMatrices[i], 0);
+ }
+
+ Matrix.multiplyMM(mAmbientVpMatrix, 0, mProjectionMatrix, 0, mAmbientViewMatrix, 0);
+ }
+
+ /**
+ * Creates a triangle for a hand on the watch face.
+ *
+ * @param program program for drawing triangles
+ * @param width width of base of triangle
+ * @param length length of triangle
+ * @param color color in RGBA order, each in the range [0, 1]
+ */
+ private Gles2ColoredTriangleList createHand(Gles2ColoredTriangleList.Program program,
+ float width, float length, float[] color) {
+ // Create the data for the VBO.
+ float[] triangleCoords = new float[]{
+ // in counterclockwise order:
+ 0, length, 0, // top
+ -width / 2, 0, 0, // bottom left
+ width / 2, 0, 0 // bottom right
+ };
+ return new Gles2ColoredTriangleList(program, triangleCoords, color);
+ }
+
+ /**
+ * Creates a triangle list for the major ticks on the watch face.
+ *
+ * @param program program for drawing triangles
+ */
+ private Gles2ColoredTriangleList createMajorTicks(
+ Gles2ColoredTriangleList.Program program) {
+ // Create the data for the VBO.
+ float[] trianglesCoords = new float[9 * 4];
+ for (int i = 0; i < 4; i++) {
+ float[] triangleCoords = getMajorTickTriangleCoords(i);
+ System.arraycopy(triangleCoords, 0, trianglesCoords, i * 9, triangleCoords.length);
+ }
+
+ return new Gles2ColoredTriangleList(program, trianglesCoords,
+ new float[]{
+ 1.0f /* red */,
+ 1.0f /* green */,
+ 1.0f /* blue */,
+ 1.0f /* alpha */
+ }
+ );
+ }
+
+ /**
+ * Creates a triangle list for the minor ticks on the watch face.
+ *
+ * @param program program for drawing triangles
+ */
+ private Gles2ColoredTriangleList createMinorTicks(
+ Gles2ColoredTriangleList.Program program) {
+ // Create the data for the VBO.
+ float[] trianglesCoords = new float[9 * (12 - 4)];
+ int index = 0;
+ for (int i = 0; i < 12; i++) {
+ if (i % 3 == 0) {
+ // This is where a major tick goes, so skip it.
+ continue;
+ }
+ float[] triangleCoords = getMinorTickTriangleCoords(i);
+ System.arraycopy(triangleCoords, 0, trianglesCoords, index, triangleCoords.length);
+ index += 9;
+ }
+
+ return new Gles2ColoredTriangleList(program, trianglesCoords,
+ new float[]{
+ 0.5f /* red */,
+ 0.5f /* green */,
+ 0.5f /* blue */,
+ 1.0f /* alpha */
+ }
+ );
+ }
+
+ private float[] getMajorTickTriangleCoords(int index) {
+ return getTickTriangleCoords(0.03f /* width */, 0.09f /* length */,
+ index * 360 / 4 /* angleDegrees */);
+ }
+
+ private float[] getMinorTickTriangleCoords(int index) {
+ return getTickTriangleCoords(0.02f /* width */, 0.06f /* length */,
+ index * 360 / 12 /* angleDegrees */);
+ }
+
+ private float[] getTickTriangleCoords(float width, float length, int angleDegrees) {
+ // Create the data for the VBO.
+ float[] coords = new float[]{
+ // in counterclockwise order:
+ 0, 1, 0, // top
+ width / 2, length + 1, 0, // bottom left
+ -width / 2, length + 1, 0 // bottom right
+ };
+
+ rotateCoords(coords, angleDegrees);
+ return coords;
+ }
+
+ /**
+ * Destructively rotates the given coordinates in the XY plane about the origin by the given
+ * angle.
+ *
+ * @param coords flattened 3D coordinates
+ * @param angleDegrees angle in degrees clockwise when viewed from negative infinity on the
+ * Z axis
+ */
+ private void rotateCoords(float[] coords, int angleDegrees) {
+ double angleRadians = Math.toRadians(angleDegrees);
+ double cos = Math.cos(angleRadians);
+ double sin = Math.sin(angleRadians);
+ for (int i = 0; i < coords.length; i += 3) {
+ float x = coords[i];
+ float y = coords[i + 1];
+ coords[i] = (float) (cos * x - sin * y);
+ coords[i + 1] = (float) (sin * x + cos * y);
+ }
+ }
+
+ @Override
+ public void onAmbientModeChanged(boolean inAmbientMode) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onAmbientModeChanged: " + inAmbientMode);
+ }
+ super.onAmbientModeChanged(inAmbientMode);
+ invalidate();
+ }
+
+ @Override
+ public void onVisibilityChanged(boolean visible) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onVisibilityChanged: " + visible);
+ }
+ super.onVisibilityChanged(visible);
+ if (visible) {
+ registerReceiver();
+
+ // Update time zone in case it changed while we were detached.
+ mTime.clear(TimeZone.getDefault().getID());
+ mTime.setToNow();
+
+ invalidate();
+ } else {
+ unregisterReceiver();
+ }
+ }
+
+ private void registerReceiver() {
+ if (mRegisteredTimeZoneReceiver) {
+ return;
+ }
+ mRegisteredTimeZoneReceiver = true;
+ IntentFilter filter = new IntentFilter(Intent.ACTION_TIMEZONE_CHANGED);
+ TiltWatchFaceService.this.registerReceiver(mTimeZoneReceiver, filter);
+ }
+
+ private void unregisterReceiver() {
+ if (!mRegisteredTimeZoneReceiver) {
+ return;
+ }
+ mRegisteredTimeZoneReceiver = false;
+ TiltWatchFaceService.this.unregisterReceiver(mTimeZoneReceiver);
+ }
+
+ @Override
+ public void onTimeTick() {
+ super.onTimeTick();
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onTimeTick: ambient = " + isInAmbientMode());
+ }
+ invalidate();
+ }
+
+ @Override
+ public void onDraw() {
+ if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ Log.v(TAG, "onDraw");
+ }
+ super.onDraw();
+ final float[] vpMatrix;
+
+ // Draw background color and select the appropriate view projection matrix. The
+ // background should always be black in ambient mode. The view projection matrix used is
+ // overhead in ambient. In interactive mode, it's tilted depending on the current time.
+ if (isInAmbientMode()) {
+ GLES20.glClearColor(0, 0, 0, 1);
+ vpMatrix = mAmbientVpMatrix;
+ } else {
+ GLES20.glClearColor(0.5f, 0.2f, 0.2f, 1);
+ final int cameraIndex =
+ (int) ((System.currentTimeMillis() / FRAME_PERIOD_MS) % mNumCameraAngles);
+ vpMatrix = mVpMatrices[cameraIndex];
+ }
+ GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
+
+ // Compute angle indices for the three hands.
+ mTime.setToNow();
+ final int secIndex = mTime.second * 360 / 60;
+ final int minIndex = mTime.minute * 360 / 60;
+ final int hoursIndex = (mTime.hour % 12) * 360 / 12 + mTime.minute * 360 / 60 / 12;
+
+ // Draw triangles from back to front. Don't draw the second hand in ambient mode.
+ {
+ // Combine the model matrix with the projection and camera view.
+ Matrix.multiplyMM(mMvpMatrix, 0, vpMatrix, 0, mModelMatrices[hoursIndex], 0);
+
+ // Draw the triangle.
+ mHourHandTriangle.draw(mMvpMatrix);
+ }
+ {
+ // Combine the model matrix with the projection and camera view.
+ Matrix.multiplyMM(mMvpMatrix, 0, vpMatrix, 0, mModelMatrices[minIndex], 0);
+
+ // Draw the triangle.
+ mMinuteHandTriangle.draw(mMvpMatrix);
+ }
+ if (!isInAmbientMode()) {
+ // Combine the model matrix with the projection and camera view.
+ Matrix.multiplyMM(mMvpMatrix, 0, vpMatrix, 0, mModelMatrices[secIndex], 0);
+
+ // Draw the triangle.
+ mSecondHandTriangle.draw(mMvpMatrix);
+ }
+ {
+ // Draw the major and minor ticks.
+ mMajorTickTriangles.draw(vpMatrix);
+ mMinorTickTriangles.draw(vpMatrix);
+ }
+
+ // Draw every frame as long as we're visible and in interactive mode.
+ if (isVisible() && !isInAmbientMode()) {
+ invalidate();
+ }
+ }
+ }
+}
diff --git a/samples/browseable/WatchFace/_index.jd b/samples/browseable/WatchFace/_index.jd
new file mode 100644
index 000000000..fcba857b8
--- /dev/null
+++ b/samples/browseable/WatchFace/_index.jd
@@ -0,0 +1,12 @@
+page.tags="WatchFace"
+sample.group=Wearable
+@jd:body
+
+<p>
+
+This sample demonstrates how to create watch faces for android wear and includes a phone app
+and a wearable app. The wearable app has a variety of watch faces including analog, digital,
+opengl, calendar, etc. It also includes a watch-side configuration example. The phone app
+includes a phone-side configuration example.
+
+ </p>
diff --git a/samples/browseable/WatchViewStub/Application/AndroidManifest.xml b/samples/browseable/WatchViewStub/Application/AndroidManifest.xml
new file mode 100644
index 000000000..b1b7103dc
--- /dev/null
+++ b/samples/browseable/WatchViewStub/Application/AndroidManifest.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.google.wearable.watchviewstub">
+
+ <uses-sdk android:minSdkVersion="18"
+ android:targetSdkVersion="21" />
+
+ <application android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name">
+ </application>
+
+</manifest>
+
diff --git a/samples/browseable/WatchViewStub/Application/res/drawable-hdpi/ic_launcher.png b/samples/browseable/WatchViewStub/Application/res/drawable-hdpi/ic_launcher.png
new file mode 100755
index 000000000..589f229d1
--- /dev/null
+++ b/samples/browseable/WatchViewStub/Application/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/WatchViewStub/Application/res/drawable-hdpi/tile.9.png b/samples/browseable/WatchViewStub/Application/res/drawable-hdpi/tile.9.png
new file mode 100644
index 000000000..135862883
--- /dev/null
+++ b/samples/browseable/WatchViewStub/Application/res/drawable-hdpi/tile.9.png
Binary files differ
diff --git a/samples/browseable/WatchViewStub/Application/res/drawable-mdpi/ic_launcher.png b/samples/browseable/WatchViewStub/Application/res/drawable-mdpi/ic_launcher.png
new file mode 100755
index 000000000..77dd57139
--- /dev/null
+++ b/samples/browseable/WatchViewStub/Application/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/WatchViewStub/Application/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/WatchViewStub/Application/res/drawable-xhdpi/ic_launcher.png
new file mode 100755
index 000000000..fe34ebe13
--- /dev/null
+++ b/samples/browseable/WatchViewStub/Application/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/WatchViewStub/Application/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/WatchViewStub/Application/res/drawable-xxhdpi/ic_launcher.png
new file mode 100755
index 000000000..ab80bcd13
--- /dev/null
+++ b/samples/browseable/WatchViewStub/Application/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/WatchViewStub/Application/res/layout/activity_main.xml b/samples/browseable/WatchViewStub/Application/res/layout/activity_main.xml
new file mode 100755
index 000000000..be1aa49d9
--- /dev/null
+++ b/samples/browseable/WatchViewStub/Application/res/layout/activity_main.xml
@@ -0,0 +1,36 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <LinearLayout style="@style/Widget.SampleMessageTile"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView style="@style/Widget.SampleMessage"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="@dimen/horizontal_page_margin"
+ android:layout_marginRight="@dimen/horizontal_page_margin"
+ android:layout_marginTop="@dimen/vertical_page_margin"
+ android:layout_marginBottom="@dimen/vertical_page_margin"
+ android:text="@string/intro_message" />
+ </LinearLayout>
+</LinearLayout>
diff --git a/samples/browseable/WatchViewStub/Application/res/values-sw600dp/template-dimens.xml b/samples/browseable/WatchViewStub/Application/res/values-sw600dp/template-dimens.xml
new file mode 100644
index 000000000..22074a2bd
--- /dev/null
+++ b/samples/browseable/WatchViewStub/Application/res/values-sw600dp/template-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>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_huge</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/WatchViewStub/Application/res/values-sw600dp/template-styles.xml b/samples/browseable/WatchViewStub/Application/res/values-sw600dp/template-styles.xml
new file mode 100644
index 000000000..03d197418
--- /dev/null
+++ b/samples/browseable/WatchViewStub/Application/res/values-sw600dp/template-styles.xml
@@ -0,0 +1,25 @@
+<!--
+ 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.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceLarge</item>
+ <item name="android:lineSpacingMultiplier">1.2</item>
+ <item name="android:shadowDy">-6.5</item>
+ </style>
+
+</resources>
diff --git a/samples/browseable/WatchViewStub/Application/res/values-v11/template-styles.xml b/samples/browseable/WatchViewStub/Application/res/values-v11/template-styles.xml
new file mode 100644
index 000000000..8c1ea66f2
--- /dev/null
+++ b/samples/browseable/WatchViewStub/Application/res/values-v11/template-styles.xml
@@ -0,0 +1,22 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Holo.Light" />
+
+</resources>
diff --git a/samples/browseable/WatchViewStub/Application/res/values-v21/base-colors.xml b/samples/browseable/WatchViewStub/Application/res/values-v21/base-colors.xml
new file mode 100644
index 000000000..34c9cd138
--- /dev/null
+++ b/samples/browseable/WatchViewStub/Application/res/values-v21/base-colors.xml
@@ -0,0 +1,20 @@
+<?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>
+
+
+</resources>
diff --git a/samples/browseable/WatchViewStub/Application/res/values-v21/base-template-styles.xml b/samples/browseable/WatchViewStub/Application/res/values-v21/base-template-styles.xml
new file mode 100644
index 000000000..0b2948f7e
--- /dev/null
+++ b/samples/browseable/WatchViewStub/Application/res/values-v21/base-template-styles.xml
@@ -0,0 +1,23 @@
+<?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>
+
+ <!-- Activity themes -->
+ <style name="Theme.Base" parent="android:Theme.Material.Light">
+ </style>
+
+</resources>
diff --git a/samples/browseable/WatchViewStub/Application/res/values/base-strings.xml b/samples/browseable/WatchViewStub/Application/res/values/base-strings.xml
new file mode 100644
index 000000000..d65338289
--- /dev/null
+++ b/samples/browseable/WatchViewStub/Application/res/values/base-strings.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>
+ <string name="app_name">WatchViewStub</string>
+ <string name="intro_message">
+ <![CDATA[
+
+
+ This sample demonstrates how to specify different layouts for round and rectangular screens.
+
+
+ ]]>
+ </string>
+</resources>
diff --git a/samples/browseable/WatchViewStub/Application/res/values/template-dimens.xml b/samples/browseable/WatchViewStub/Application/res/values/template-dimens.xml
new file mode 100644
index 000000000..39e710b5c
--- /dev/null
+++ b/samples/browseable/WatchViewStub/Application/res/values/template-dimens.xml
@@ -0,0 +1,32 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Define standard dimensions to comply with Holo-style grids and rhythm. -->
+
+ <dimen name="margin_tiny">4dp</dimen>
+ <dimen name="margin_small">8dp</dimen>
+ <dimen name="margin_medium">16dp</dimen>
+ <dimen name="margin_large">32dp</dimen>
+ <dimen name="margin_huge">64dp</dimen>
+
+ <!-- Semantic definitions -->
+
+ <dimen name="horizontal_page_margin">@dimen/margin_medium</dimen>
+ <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/samples/browseable/WatchViewStub/Application/res/values/template-styles.xml b/samples/browseable/WatchViewStub/Application/res/values/template-styles.xml
new file mode 100644
index 000000000..6e7d593dd
--- /dev/null
+++ b/samples/browseable/WatchViewStub/Application/res/values/template-styles.xml
@@ -0,0 +1,42 @@
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <!-- Activity themes -->
+
+ <style name="Theme.Base" parent="android:Theme.Light" />
+
+ <style name="Theme.Sample" parent="Theme.Base" />
+
+ <style name="AppTheme" parent="Theme.Sample" />
+ <!-- Widget styling -->
+
+ <style name="Widget" />
+
+ <style name="Widget.SampleMessage">
+ <item name="android:textAppearance">?android:textAppearanceMedium</item>
+ <item name="android:lineSpacingMultiplier">1.1</item>
+ </style>
+
+ <style name="Widget.SampleMessageTile">
+ <item name="android:background">@drawable/tile</item>
+ <item name="android:shadowColor">#7F000000</item>
+ <item name="android:shadowDy">-3.5</item>
+ <item name="android:shadowRadius">2</item>
+ </style>
+
+</resources>
diff --git a/samples/browseable/WatchViewStub/Wearable/AndroidManifest.xml b/samples/browseable/WatchViewStub/Wearable/AndroidManifest.xml
new file mode 100644
index 000000000..33a266d63
--- /dev/null
+++ b/samples/browseable/WatchViewStub/Wearable/AndroidManifest.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.google.wearable.watchviewstub" >
+
+ <uses-sdk android:minSdkVersion="20"
+ android:targetSdkVersion="21" />
+
+ <uses-feature android:name="android.hardware.type.watch" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@android:style/Theme.DeviceDefault">
+ <activity
+ android:name="com.example.android.google.wearable.watchviewstub.MainActivity"
+ android:label="@string/app_name">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="android.intent.category.LAUNCHER"/>
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest>
diff --git a/samples/browseable/WatchViewStub/Wearable/res/drawable-hdpi/ic_launcher.png b/samples/browseable/WatchViewStub/Wearable/res/drawable-hdpi/ic_launcher.png
new file mode 100755
index 000000000..589f229d1
--- /dev/null
+++ b/samples/browseable/WatchViewStub/Wearable/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/WatchViewStub/Wearable/res/drawable-mdpi/ic_launcher.png b/samples/browseable/WatchViewStub/Wearable/res/drawable-mdpi/ic_launcher.png
new file mode 100755
index 000000000..77dd57139
--- /dev/null
+++ b/samples/browseable/WatchViewStub/Wearable/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/WatchViewStub/Wearable/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/WatchViewStub/Wearable/res/drawable-xhdpi/ic_launcher.png
new file mode 100755
index 000000000..fe34ebe13
--- /dev/null
+++ b/samples/browseable/WatchViewStub/Wearable/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/browseable/WatchViewStub/Wearable/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/WatchViewStub/Wearable/res/drawable-xxhdpi/ic_launcher.png
new file mode 100755
index 000000000..ab80bcd13
--- /dev/null
+++ b/samples/browseable/WatchViewStub/Wearable/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/wearable/WatchViewStub/Wearable/src/main/res/drawable/rect_background.xml b/samples/browseable/WatchViewStub/Wearable/res/drawable/rect_background.xml
index eeda78fa0..eeda78fa0 100644
--- a/samples/wearable/WatchViewStub/Wearable/src/main/res/drawable/rect_background.xml
+++ b/samples/browseable/WatchViewStub/Wearable/res/drawable/rect_background.xml
diff --git a/samples/wearable/WatchViewStub/Wearable/src/main/res/drawable/round_background.xml b/samples/browseable/WatchViewStub/Wearable/res/drawable/round_background.xml
index 432b0d24a..432b0d24a 100644
--- a/samples/wearable/WatchViewStub/Wearable/src/main/res/drawable/round_background.xml
+++ b/samples/browseable/WatchViewStub/Wearable/res/drawable/round_background.xml
diff --git a/samples/wearable/WatchViewStub/Wearable/src/main/res/layout/main_activity.xml b/samples/browseable/WatchViewStub/Wearable/res/layout/main_activity.xml
index e9745bc6e..e9745bc6e 100644
--- a/samples/wearable/WatchViewStub/Wearable/src/main/res/layout/main_activity.xml
+++ b/samples/browseable/WatchViewStub/Wearable/res/layout/main_activity.xml
diff --git a/samples/wearable/WatchViewStub/Wearable/src/main/res/layout/rect_layout.xml b/samples/browseable/WatchViewStub/Wearable/res/layout/rect_layout.xml
index 7b0006cbe..7b0006cbe 100644
--- a/samples/wearable/WatchViewStub/Wearable/src/main/res/layout/rect_layout.xml
+++ b/samples/browseable/WatchViewStub/Wearable/res/layout/rect_layout.xml
diff --git a/samples/wearable/WatchViewStub/Wearable/src/main/res/layout/round_layout.xml b/samples/browseable/WatchViewStub/Wearable/res/layout/round_layout.xml
index d7a55f6d2..d7a55f6d2 100644
--- a/samples/wearable/WatchViewStub/Wearable/src/main/res/layout/round_layout.xml
+++ b/samples/browseable/WatchViewStub/Wearable/res/layout/round_layout.xml
diff --git a/samples/wearable/WatchViewStub/Wearable/src/main/res/values/dimens.xml b/samples/browseable/WatchViewStub/Wearable/res/values/dimens.xml
index 37148a2d4..37148a2d4 100644
--- a/samples/wearable/WatchViewStub/Wearable/src/main/res/values/dimens.xml
+++ b/samples/browseable/WatchViewStub/Wearable/res/values/dimens.xml
diff --git a/samples/wearable/WatchViewStub/Wearable/src/main/res/values/strings.xml b/samples/browseable/WatchViewStub/Wearable/res/values/strings.xml
index 00cc6c641..00cc6c641 100644
--- a/samples/wearable/WatchViewStub/Wearable/src/main/res/values/strings.xml
+++ b/samples/browseable/WatchViewStub/Wearable/res/values/strings.xml
diff --git a/samples/wearable/WatchViewStub/Wearable/src/main/java/com/example/android/google/wearable/watchviewstub/MainActivity.java b/samples/browseable/WatchViewStub/Wearable/src/com.example.android.google.wearable.watchviewstub/MainActivity.java
index e4271d24b..e4271d24b 100644
--- a/samples/wearable/WatchViewStub/Wearable/src/main/java/com/example/android/google/wearable/watchviewstub/MainActivity.java
+++ b/samples/browseable/WatchViewStub/Wearable/src/com.example.android.google.wearable.watchviewstub/MainActivity.java
diff --git a/samples/browseable/WatchViewStub/_index.jd b/samples/browseable/WatchViewStub/_index.jd
new file mode 100644
index 000000000..7341f9286
--- /dev/null
+++ b/samples/browseable/WatchViewStub/_index.jd
@@ -0,0 +1,9 @@
+page.tags="WatchViewStub"
+sample.group=Wearable
+@jd:body
+
+<p>
+
+ This sample demonstrates how to specify different layouts for round and rectangular screens.
+
+ </p>
diff --git a/samples/samples_source.prop_template b/samples/samples_source.prop_template
index d3cdfd5ee..1524e33b6 100644
--- a/samples/samples_source.prop_template
+++ b/samples/samples_source.prop_template
@@ -1,4 +1,4 @@
Pkg.UserSrc=false
-Pkg.Revision=1
+Pkg.Revision=5
AndroidVersion.ApiLevel=${PLATFORM_SDK_VERSION}
AndroidVersion.CodeName=${PLATFORM_VERSION_CODENAME}
diff --git a/samples/wearable/.gitignore b/samples/wearable/.gitignore
deleted file mode 100644
index a76265553..000000000
--- a/samples/wearable/.gitignore
+++ /dev/null
@@ -1,42 +0,0 @@
-# built application files
-*.apk
-*.ap_
-
-# files for the dex VM
-*.dex
-
-# Java class files
-*.class
-
-# generated files
-bin/
-out/
-src/common
-src/template
-_index.jd
-README.txt
-
-# Libraries used by the app
-# Can explicitly add if we want, but shouldn't do so blindly. Licenses, bloat, etc.
-/libs
-
-
-# Build stuff (auto-generated by android update project ...)
-ant.properties
-local.properties
-
-# Eclipse project files
-.classpath
-.project
-
-# idea project files
-.idea/
-.idea/.name
-*.iml
-*.ipr
-*.iws
-
-##Gradle-based build
-.gradle
-build/
-
diff --git a/samples/wearable/AgendaData/Application/build.gradle b/samples/wearable/AgendaData/Application/build.gradle
deleted file mode 100644
index 8d1d61958..000000000
--- a/samples/wearable/AgendaData/Application/build.gradle
+++ /dev/null
@@ -1,26 +0,0 @@
-apply plugin: 'android'
-
-android {
- compileSdkVersion 18
- buildToolsVersion '20'
-
- defaultConfig {
- minSdkVersion 18
- targetSdkVersion 19
- versionCode 1
- versionName "1.0"
- }
-
- buildTypes {
- release {
- runProguard false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
- }
- }
-}
-
-dependencies {
- compile 'com.google.android.gms:play-services:5.0.+'
- compile "com.android.support:support-v4:20.0.+"
- wearApp project(':Wearable')
-}
diff --git a/samples/wearable/AgendaData/Application/proguard-rules.txt b/samples/wearable/AgendaData/Application/proguard-rules.txt
deleted file mode 100644
index 53f713a6b..000000000
--- a/samples/wearable/AgendaData/Application/proguard-rules.txt
+++ /dev/null
@@ -1,28 +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 *;
-#}
--dontwarn android.support.wearable.view.DelayedConfirmationView
--dontwarn android.support.wearable.view.CircledImageView
-
--keep class android.support.wearable.view.WearableListView {
- private void setScrollAnimator(int);
- protected void setScrollVertically(int);
-}
-
diff --git a/samples/wearable/AgendaData/Application/project.properties b/samples/wearable/AgendaData/Application/project.properties
deleted file mode 100644
index 4ab125693..000000000
--- a/samples/wearable/AgendaData/Application/project.properties
+++ /dev/null
@@ -1,14 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system edit
-# "ant.properties", and override values to adapt the script to your
-# project structure.
-#
-# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
-#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
-
-# Project target.
-target=android-19
diff --git a/samples/wearable/AgendaData/Application/src/main/AndroidManifest.xml b/samples/wearable/AgendaData/Application/src/main/AndroidManifest.xml
deleted file mode 100644
index 0f1e7dbef..000000000
--- a/samples/wearable/AgendaData/Application/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.wearable.agendadata">
-
- <uses-permission android:name="android.permission.READ_CALENDAR" />
- <uses-permission android:name="android.permission.READ_CONTACTS" />
-
- <application
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@android:style/Theme.Holo.Light"
- android:allowBackup="false">
-
- <meta-data
- android:name="com.google.android.gms.version"
- android:value="@integer/google_play_services_version" />
-
- <activity
- android:name="com.example.android.wearable.agendadata.MainActivity"
- android:label="@string/app_name"
- android:configChanges="keyboardHidden|orientation|screenSize">
- <intent-filter>
- <action android:name="android.intent.action.MAIN"/>
- <category android:name="android.intent.category.LAUNCHER"/>
- </intent-filter>
- </activity>
-
- <service android:name="com.example.android.wearable.agendadata.CalendarQueryService"/>
- </application>
-</manifest>
diff --git a/samples/wearable/AgendaData/Application/src/main/res/values/strings.xml b/samples/wearable/AgendaData/Application/src/main/res/values/strings.xml
deleted file mode 100644
index b18a6587d..000000000
--- a/samples/wearable/AgendaData/Application/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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 xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="app_name">Android Wear AgendaData Example Application</string>
- <string name="get_events">Sync calendar events to wearable</string>
- <string name="delete_events">Delete calendar events from wearable</string>
- <string name="log">Log</string>
-</resources>
diff --git a/samples/wearable/AgendaData/Application/src/main/res/values/styles.xml b/samples/wearable/AgendaData/Application/src/main/res/values/styles.xml
deleted file mode 100644
index 209e00f81..000000000
--- a/samples/wearable/AgendaData/Application/src/main/res/values/styles.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
- <item name="android:windowAnimationStyle">@null</item>
- </style>
-
- <!-- Application theme. -->
- <style name="AppTheme" parent="AppBaseTheme">
- <!-- All customizations that are NOT specific to a particular API-level can go here. -->
- </style>
-</resources>
diff --git a/samples/wearable/AgendaData/Wearable/build.gradle b/samples/wearable/AgendaData/Wearable/build.gradle
deleted file mode 100644
index 0e23b4d56..000000000
--- a/samples/wearable/AgendaData/Wearable/build.gradle
+++ /dev/null
@@ -1,25 +0,0 @@
-apply plugin: 'android'
-
-android {
- compileSdkVersion 20
- buildToolsVersion '20'
-
- defaultConfig {
- minSdkVersion 20
- targetSdkVersion 20
- versionCode 1
- versionName "1.0"
- }
-
- buildTypes {
- release {
- runProguard false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
- }
- }
-}
-
-dependencies {
- compile 'com.google.android.gms:play-services-wearable:+'
- compile "com.google.android.support:wearable:1.0.+"
-} \ No newline at end of file
diff --git a/samples/wearable/AgendaData/Wearable/proguard-rules.txt b/samples/wearable/AgendaData/Wearable/proguard-rules.txt
deleted file mode 100644
index 08e5bdc8d..000000000
--- a/samples/wearable/AgendaData/Wearable/proguard-rules.txt
+++ /dev/null
@@ -1,22 +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 *;
-#}
--dontwarn android.support.wearable.view.DelayedConfirmationView
--dontwarn android.support.wearable.view.CircledImageView
diff --git a/samples/wearable/AgendaData/Wearable/project.properties b/samples/wearable/AgendaData/Wearable/project.properties
deleted file mode 100644
index 4ab125693..000000000
--- a/samples/wearable/AgendaData/Wearable/project.properties
+++ /dev/null
@@ -1,14 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system edit
-# "ant.properties", and override values to adapt the script to your
-# project structure.
-#
-# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
-#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
-
-# Project target.
-target=android-19
diff --git a/samples/wearable/AgendaData/Wearable/src/main/AndroidManifest.xml b/samples/wearable/AgendaData/Wearable/src/main/AndroidManifest.xml
deleted file mode 100644
index 686badc3d..000000000
--- a/samples/wearable/AgendaData/Wearable/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.wearable.agendadata" >
-
- <uses-feature android:name="android.hardware.type.watch" />
-
- <application
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:allowBackup="false">
-
- <meta-data
- android:name="com.google.android.gms.version"
- android:value="@integer/google_play_services_version" />
-
- <service
- android:name="com.example.android.wearable.agendadata.HomeListenerService" >
- <intent-filter>
- <action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
- </intent-filter>
- </service>
-
- <service android:name="com.example.android.wearable.agendadata.DeleteService"/>
-
- <activity android:name="android.support.wearable.activity.ConfirmationActivity"/>
-
- </application>
-</manifest>
diff --git a/samples/wearable/AgendaData/_index.html b/samples/wearable/AgendaData/_index.html
deleted file mode 100644
index 735e7861e..000000000
--- a/samples/wearable/AgendaData/_index.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<p><b>About:</b> Syncs calendar events to your wearable at the press of a button, using the Wearable
-DataApi to transmit data such as event time, description, and background image. The DataItems can be
-deleted individually via an action on the event notifications, or all at once via a button on the
-companion. When deleted using the notification action, a ConfirmationActivity is used to indicate
-success or failure.</p>
-<p><b>How to run:</b> Install the Application APK on the companion, and the Wearable APK on the
-wearable. Start the sample by running the AgendaData application on the companion.</p>
-<p><b>Wearable APIs used:</b> DataApi, NodeApi, WearableListenerService, ConfirmationActivity</p>
-<p><b>Screenshots:</b>
- <figure>
- <img src="screenshots/companion_agenda_data.png" alt="Companion AgendaData" width="216"
- height="384">
- <img src="screenshots/dummy_calendar_event.png" alt="Dummy Calendar Event" width="160"
- height="160">
- <figcaption>Companion app and wearable app communicate with each other.</figcaption>
- </figure>
-</p>
diff --git a/samples/wearable/AgendaData/build.gradle b/samples/wearable/AgendaData/build.gradle
deleted file mode 100644
index d3c8c5971..000000000
--- a/samples/wearable/AgendaData/build.gradle
+++ /dev/null
@@ -1,14 +0,0 @@
-buildscript {
- repositories {
- mavenCentral()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:0.12.+'
- }
-}
-
-allprojects {
- repositories {
- mavenCentral()
- }
-} \ No newline at end of file
diff --git a/samples/wearable/AgendaData/gradle.properties b/samples/wearable/AgendaData/gradle.properties
deleted file mode 100644
index 5d08ba75b..000000000
--- a/samples/wearable/AgendaData/gradle.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-# Project-wide Gradle settings.
-
-# IDE (e.g. Android Studio) users:
-# Settings specified in this file will override any Gradle settings
-# configured through the IDE.
-
-# For more details on how to configure your build environment visit
-# http://www.gradle.org/docs/current/userguide/build_environment.html
-
-# Specifies the JVM arguments used for the daemon process.
-# The setting is particularly useful for tweaking memory settings.
-# Default value: -Xmx10248m -XX:MaxPermSize=256m
-# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
-
-# When configured, Gradle will run in incubating parallel mode.
-# This option should only be used with decoupled projects. More details, visit
-# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
-# org.gradle.parallel=true \ No newline at end of file
diff --git a/samples/wearable/AgendaData/gradle/wrapper/gradle-wrapper.jar b/samples/wearable/AgendaData/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index 8c0fb64a8..000000000
--- a/samples/wearable/AgendaData/gradle/wrapper/gradle-wrapper.jar
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/AgendaData/gradle/wrapper/gradle-wrapper.properties b/samples/wearable/AgendaData/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index 1e61d1fd3..000000000
--- a/samples/wearable/AgendaData/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-#Wed Apr 10 15:27:10 PDT 2013
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip
diff --git a/samples/wearable/AgendaData/gradlew b/samples/wearable/AgendaData/gradlew
deleted file mode 100755
index 91a7e269e..000000000
--- a/samples/wearable/AgendaData/gradlew
+++ /dev/null
@@ -1,164 +0,0 @@
-#!/usr/bin/env bash
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn ( ) {
- echo "$*"
-}
-
-die ( ) {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
-esac
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched.
-if $cygwin ; then
- [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-fi
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >&-
-APP_HOME="`pwd -P`"
-cd "$SAVED" >&-
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
-}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
-
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/samples/wearable/AgendaData/gradlew.bat b/samples/wearable/AgendaData/gradlew.bat
deleted file mode 100755
index aec99730b..000000000
--- a/samples/wearable/AgendaData/gradlew.bat
+++ /dev/null
@@ -1,90 +0,0 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/samples/wearable/AgendaData/screenshots/companion_agenda_data.png b/samples/wearable/AgendaData/screenshots/companion_agenda_data.png
deleted file mode 100644
index c39503bf2..000000000
--- a/samples/wearable/AgendaData/screenshots/companion_agenda_data.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/AgendaData/screenshots/dummy_calendar_event.png b/samples/wearable/AgendaData/screenshots/dummy_calendar_event.png
deleted file mode 100644
index 074c56b4a..000000000
--- a/samples/wearable/AgendaData/screenshots/dummy_calendar_event.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/AgendaData/settings.gradle b/samples/wearable/AgendaData/settings.gradle
deleted file mode 100644
index f3f25a547..000000000
--- a/samples/wearable/AgendaData/settings.gradle
+++ /dev/null
@@ -1 +0,0 @@
-include 'Wearable', 'Application'
diff --git a/samples/wearable/DataLayer/Application/build.gradle b/samples/wearable/DataLayer/Application/build.gradle
deleted file mode 100644
index 8d1d61958..000000000
--- a/samples/wearable/DataLayer/Application/build.gradle
+++ /dev/null
@@ -1,26 +0,0 @@
-apply plugin: 'android'
-
-android {
- compileSdkVersion 18
- buildToolsVersion '20'
-
- defaultConfig {
- minSdkVersion 18
- targetSdkVersion 19
- versionCode 1
- versionName "1.0"
- }
-
- buildTypes {
- release {
- runProguard false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
- }
- }
-}
-
-dependencies {
- compile 'com.google.android.gms:play-services:5.0.+'
- compile "com.android.support:support-v4:20.0.+"
- wearApp project(':Wearable')
-}
diff --git a/samples/wearable/DataLayer/Application/proguard-rules.txt b/samples/wearable/DataLayer/Application/proguard-rules.txt
deleted file mode 100644
index f2fe1559a..000000000
--- a/samples/wearable/DataLayer/Application/proguard-rules.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/samples/wearable/DataLayer/Application/src/main/AndroidManifest.xml b/samples/wearable/DataLayer/Application/src/main/AndroidManifest.xml
deleted file mode 100644
index 33e7bdb90..000000000
--- a/samples/wearable/DataLayer/Application/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.wearable.datalayer" >
-
- <uses-feature android:name="android.hardware.camera" android:required="false" />
-
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name">
-
- <meta-data
- android:name="com.google.android.gms.version"
- android:value="@integer/google_play_services_version" />
-
- <activity
- android:name=".MainActivity"
- android:label="@string/app_name"
- android:launchMode="singleTask" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
-</manifest>
diff --git a/samples/wearable/DataLayer/Application/src/main/res/values/strings.xml b/samples/wearable/DataLayer/Application/src/main/res/values/strings.xml
deleted file mode 100644
index 06dc3bca3..000000000
--- a/samples/wearable/DataLayer/Application/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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 xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="app_name">Data Layer Sample App</string>
- <string name="start_wearable_activity">Start Wearable Activity</string>
- <string name="start">Start</string>
- <string name="take_photo">Take a Photo</string>
- <string name="send_photo">Send Photo</string>
-</resources>
diff --git a/samples/wearable/DataLayer/Wearable/build.gradle b/samples/wearable/DataLayer/Wearable/build.gradle
deleted file mode 100644
index f26a79136..000000000
--- a/samples/wearable/DataLayer/Wearable/build.gradle
+++ /dev/null
@@ -1,24 +0,0 @@
-apply plugin: 'android'
-
-android {
- compileSdkVersion 20
- buildToolsVersion '20'
-
- defaultConfig {
- minSdkVersion 20
- targetSdkVersion 20
- versionCode 1
- versionName "1.0"
- }
-
- buildTypes {
- release {
- runProguard false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
- }
- }
-}
-
-dependencies {
- compile 'com.google.android.gms:play-services-wearable:+'
-} \ No newline at end of file
diff --git a/samples/wearable/DataLayer/Wearable/proguard-rules.txt b/samples/wearable/DataLayer/Wearable/proguard-rules.txt
deleted file mode 100644
index f2fe1559a..000000000
--- a/samples/wearable/DataLayer/Wearable/proguard-rules.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/samples/wearable/DataLayer/Wearable/src/main/AndroidManifest.xml b/samples/wearable/DataLayer/Wearable/src/main/AndroidManifest.xml
deleted file mode 100644
index 0b3491779..000000000
--- a/samples/wearable/DataLayer/Wearable/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.wearable.datalayer" >
-
- <uses-feature android:name="android.hardware.type.watch" />
-
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@android:style/Theme.DeviceDefault">
-
- <meta-data
- android:name="com.google.android.gms.version"
- android:value="@integer/google_play_services_version" />
-
- <service
- android:name=".DataLayerListenerService" >
- <intent-filter>
- <action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
- </intent-filter>
- </service>
-
- <activity
- android:name=".MainActivity"
- android:label="@string/app_name">
- <intent-filter>
- <action android:name="android.intent.action.MAIN"/>
- <category android:name="android.intent.category.LAUNCHER"/>
- </intent-filter>
- <intent-filter>
- <action android:name="com.example.android.wearable.datalayer.EXAMPLE"/>
- <category android:name="android.intent.category.DEFAULT"/>
- </intent-filter>
- </activity>
- </application>
-</manifest>
diff --git a/samples/wearable/DataLayer/_index.html b/samples/wearable/DataLayer/_index.html
deleted file mode 100644
index 2b9a3fa37..000000000
--- a/samples/wearable/DataLayer/_index.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<p><b>About:</b> You can cause the wearable to start an activity by pressing a button in the
-companion app UI. You can also take a picture on the companion device, which will be transmitted as
-an Asset for display on the wearable.</p>
-<p><b>How to run:</b> Install the Application APK on the companion, and the Wearable APK on the
-wearable. Start the sample by running the DataLayer application on the companion.</p>
-<p><b>Wearable APIs used:</b> DataApi, MessageApi, NodeApi, WearableListenerService</p>
-<p><b>Screenshots:</b>
- <figure>
- <img src="screenshots/phone_image.png" alt="Phone Image" width="216" height="384">
- <img src="screenshots/wearable_background_image.png" alt="Wearable Background Image"
- width="140" height="140">
- <figcaption>Image captured on the phone, followed by the same image on the wearable.
- </figcaption>
- </figure>
-</p>
diff --git a/samples/wearable/DataLayer/build.gradle b/samples/wearable/DataLayer/build.gradle
deleted file mode 100644
index d3c8c5971..000000000
--- a/samples/wearable/DataLayer/build.gradle
+++ /dev/null
@@ -1,14 +0,0 @@
-buildscript {
- repositories {
- mavenCentral()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:0.12.+'
- }
-}
-
-allprojects {
- repositories {
- mavenCentral()
- }
-} \ No newline at end of file
diff --git a/samples/wearable/DataLayer/gradle/wrapper/gradle-wrapper.jar b/samples/wearable/DataLayer/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index 8c0fb64a8..000000000
--- a/samples/wearable/DataLayer/gradle/wrapper/gradle-wrapper.jar
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/DataLayer/gradle/wrapper/gradle-wrapper.properties b/samples/wearable/DataLayer/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index 1e61d1fd3..000000000
--- a/samples/wearable/DataLayer/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-#Wed Apr 10 15:27:10 PDT 2013
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip
diff --git a/samples/wearable/DataLayer/gradlew b/samples/wearable/DataLayer/gradlew
deleted file mode 100755
index 91a7e269e..000000000
--- a/samples/wearable/DataLayer/gradlew
+++ /dev/null
@@ -1,164 +0,0 @@
-#!/usr/bin/env bash
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn ( ) {
- echo "$*"
-}
-
-die ( ) {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
-esac
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched.
-if $cygwin ; then
- [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-fi
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >&-
-APP_HOME="`pwd -P`"
-cd "$SAVED" >&-
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
-}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
-
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/samples/wearable/DataLayer/gradlew.bat b/samples/wearable/DataLayer/gradlew.bat
deleted file mode 100755
index aec99730b..000000000
--- a/samples/wearable/DataLayer/gradlew.bat
+++ /dev/null
@@ -1,90 +0,0 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/samples/wearable/DataLayer/screenshots/phone_image.png b/samples/wearable/DataLayer/screenshots/phone_image.png
deleted file mode 100644
index e045b6543..000000000
--- a/samples/wearable/DataLayer/screenshots/phone_image.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/DataLayer/screenshots/wearable_background_image.png b/samples/wearable/DataLayer/screenshots/wearable_background_image.png
deleted file mode 100644
index 78261808d..000000000
--- a/samples/wearable/DataLayer/screenshots/wearable_background_image.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/DataLayer/settings.gradle b/samples/wearable/DataLayer/settings.gradle
deleted file mode 100644
index 68726d456..000000000
--- a/samples/wearable/DataLayer/settings.gradle
+++ /dev/null
@@ -1 +0,0 @@
-include 'Application', 'Wearable' \ No newline at end of file
diff --git a/samples/wearable/DelayedConfirmation/Application/build.gradle b/samples/wearable/DelayedConfirmation/Application/build.gradle
deleted file mode 100644
index f04fad5a0..000000000
--- a/samples/wearable/DelayedConfirmation/Application/build.gradle
+++ /dev/null
@@ -1,25 +0,0 @@
-apply plugin: 'android'
-
-android {
- compileSdkVersion 18
- buildToolsVersion '20'
-
- defaultConfig {
- minSdkVersion 18
- targetSdkVersion 19
- versionCode 1
- versionName "1.0"
- }
-
- buildTypes {
- release {
- runProguard false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
- }
- }
-}
-
-dependencies {
- compile 'com.google.android.gms:play-services:5.0.+'
- wearApp project(':Wearable')
-}
diff --git a/samples/wearable/DelayedConfirmation/Application/proguard-rules.txt b/samples/wearable/DelayedConfirmation/Application/proguard-rules.txt
deleted file mode 100644
index f2fe1559a..000000000
--- a/samples/wearable/DelayedConfirmation/Application/proguard-rules.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/samples/wearable/DelayedConfirmation/Application/src/main/AndroidManifest.xml b/samples/wearable/DelayedConfirmation/Application/src/main/AndroidManifest.xml
deleted file mode 100644
index b682ef200..000000000
--- a/samples/wearable/DelayedConfirmation/Application/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.wearable.delayedconfirmation" >
-
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name">
-
- <meta-data
- android:name="com.google.android.gms.version"
- android:value="@integer/google_play_services_version" />
-
- <activity
- android:name=".MainActivity"
- android:label="@string/app_name"
- android:launchMode="singleTask" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
-</manifest>
diff --git a/samples/wearable/DelayedConfirmation/Application/src/main/res/values/strings.xml b/samples/wearable/DelayedConfirmation/Application/src/main/res/values/strings.xml
deleted file mode 100644
index 3b2d9d6e5..000000000
--- a/samples/wearable/DelayedConfirmation/Application/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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 xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="app_name">Delayed Confirmation Sample App</string>
- <string name="start_wearable_activity">Start Wearable Activity</string>
- <string name="start">Start</string>
-
- <string name="toast_timer_selected">Timer Selected</string>
- <string name="toast_timer_finished">Timer Finished</string>
-</resources>
diff --git a/samples/wearable/DelayedConfirmation/Wearable/build.gradle b/samples/wearable/DelayedConfirmation/Wearable/build.gradle
deleted file mode 100644
index 0e23b4d56..000000000
--- a/samples/wearable/DelayedConfirmation/Wearable/build.gradle
+++ /dev/null
@@ -1,25 +0,0 @@
-apply plugin: 'android'
-
-android {
- compileSdkVersion 20
- buildToolsVersion '20'
-
- defaultConfig {
- minSdkVersion 20
- targetSdkVersion 20
- versionCode 1
- versionName "1.0"
- }
-
- buildTypes {
- release {
- runProguard false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
- }
- }
-}
-
-dependencies {
- compile 'com.google.android.gms:play-services-wearable:+'
- compile "com.google.android.support:wearable:1.0.+"
-} \ No newline at end of file
diff --git a/samples/wearable/DelayedConfirmation/Wearable/proguard-rules.txt b/samples/wearable/DelayedConfirmation/Wearable/proguard-rules.txt
deleted file mode 100644
index 2ddbcfcdd..000000000
--- a/samples/wearable/DelayedConfirmation/Wearable/proguard-rules.txt
+++ /dev/null
@@ -1,21 +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 *;
-#}
--dontwarn android.support.wearable.view.DelayedConfirmationView
diff --git a/samples/wearable/DelayedConfirmation/Wearable/src/main/AndroidManifest.xml b/samples/wearable/DelayedConfirmation/Wearable/src/main/AndroidManifest.xml
deleted file mode 100644
index 239be9fd3..000000000
--- a/samples/wearable/DelayedConfirmation/Wearable/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.wearable.delayedconfirmation" >
-
- <uses-feature android:name="android.hardware.type.watch" />
-
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@android:style/Theme.DeviceDefault">
-
- <meta-data
- android:name="com.google.android.gms.version"
- android:value="@integer/google_play_services_version" />
-
- <service
- android:name=".WearableMessageListenerService" >
- <intent-filter>
- <action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
- </intent-filter>
- </service>
-
- <activity
- android:name=".MainActivity"
- android:label="@string/app_name">
- </activity>
- </application>
-</manifest>
diff --git a/samples/wearable/DelayedConfirmation/_index.html b/samples/wearable/DelayedConfirmation/_index.html
deleted file mode 100644
index 2dd5cdbfb..000000000
--- a/samples/wearable/DelayedConfirmation/_index.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<p><b>About:</b> Demonstrates how to create a DelayedConfirmationView in your wearable app. In this
-sample, pressing a button on the phone app sends a message to the wearable to start a simple
-activity. This activity displays a DelayedConfirmationView that starts when the user presses "Start
-Timer." Then, callbacks are implemented on both the wearable and phone to show when the timer is
-selected or finishes. The activity on the wearable uses BoxInsetLayout to automatically apply
-appropriate margins based on whether the display is square or circular.</p>
-<p><b>How to run:</b> Install the Application APK on the companion, and the Wearable APK on the
-wearable. Start the sample by running the DelayedConfirmation application on the companion and
-pressing "Start".</p>
-<p><b>Wearable APIs used:</b> MessageApi, NodeApi, WearableListenerService, BoxInsetLayout,
-DelayedConfirmationView</p>
-<p><b>Screenshots:</b>
- <figure>
- <img src="screenshots/delayed_confirmation_box_inset_top.png" alt='DelayedConfirmation view
- in BoxInsetLayout with layout_box="top"' width="160" height="160">
- <img src="screenshots/delayed_confirmation_box_inset_all.png" alt='DelayedConfirmation view
- in BoxInsetLayout with layout_box="all"' width="160" height="160">
- <img src="screenshots/delayed_confirmation_notification.png" alt="DelayedConfirmationView
- selected notification" width="140" height="140">
- <img src="screenshots/companion_delayed_confirmation.png" alt="Timer Selected toast on
- companion" width="216" height="384">
- <figcaption>From left to right: DelayedConfirmationView in a BoxInsetLayout with
- layout_box="top", the same view but with layout_box="all", the notification that shows
- up on the wearable when you select the timer before it finishes, and the toast generated
- on the phone at the same time. Note: normally you would make the circle's background the
- same color as the box background so users won't see the box's edges.</figcaption>
- </figure>
-</p>
diff --git a/samples/wearable/DelayedConfirmation/build.gradle b/samples/wearable/DelayedConfirmation/build.gradle
deleted file mode 100644
index d3c8c5971..000000000
--- a/samples/wearable/DelayedConfirmation/build.gradle
+++ /dev/null
@@ -1,14 +0,0 @@
-buildscript {
- repositories {
- mavenCentral()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:0.12.+'
- }
-}
-
-allprojects {
- repositories {
- mavenCentral()
- }
-} \ No newline at end of file
diff --git a/samples/wearable/DelayedConfirmation/gradle.properties b/samples/wearable/DelayedConfirmation/gradle.properties
deleted file mode 100644
index 5d08ba75b..000000000
--- a/samples/wearable/DelayedConfirmation/gradle.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-# Project-wide Gradle settings.
-
-# IDE (e.g. Android Studio) users:
-# Settings specified in this file will override any Gradle settings
-# configured through the IDE.
-
-# For more details on how to configure your build environment visit
-# http://www.gradle.org/docs/current/userguide/build_environment.html
-
-# Specifies the JVM arguments used for the daemon process.
-# The setting is particularly useful for tweaking memory settings.
-# Default value: -Xmx10248m -XX:MaxPermSize=256m
-# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
-
-# When configured, Gradle will run in incubating parallel mode.
-# This option should only be used with decoupled projects. More details, visit
-# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
-# org.gradle.parallel=true \ No newline at end of file
diff --git a/samples/wearable/DelayedConfirmation/gradle/wrapper/gradle-wrapper.jar b/samples/wearable/DelayedConfirmation/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index 8c0fb64a8..000000000
--- a/samples/wearable/DelayedConfirmation/gradle/wrapper/gradle-wrapper.jar
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/DelayedConfirmation/gradle/wrapper/gradle-wrapper.properties b/samples/wearable/DelayedConfirmation/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index 1e61d1fd3..000000000
--- a/samples/wearable/DelayedConfirmation/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-#Wed Apr 10 15:27:10 PDT 2013
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip
diff --git a/samples/wearable/DelayedConfirmation/gradlew b/samples/wearable/DelayedConfirmation/gradlew
deleted file mode 100755
index 91a7e269e..000000000
--- a/samples/wearable/DelayedConfirmation/gradlew
+++ /dev/null
@@ -1,164 +0,0 @@
-#!/usr/bin/env bash
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn ( ) {
- echo "$*"
-}
-
-die ( ) {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
-esac
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched.
-if $cygwin ; then
- [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-fi
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >&-
-APP_HOME="`pwd -P`"
-cd "$SAVED" >&-
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
-}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
-
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/samples/wearable/DelayedConfirmation/gradlew.bat b/samples/wearable/DelayedConfirmation/gradlew.bat
deleted file mode 100755
index aec99730b..000000000
--- a/samples/wearable/DelayedConfirmation/gradlew.bat
+++ /dev/null
@@ -1,90 +0,0 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/samples/wearable/DelayedConfirmation/screenshots/companion_delayed_confirmation.png b/samples/wearable/DelayedConfirmation/screenshots/companion_delayed_confirmation.png
deleted file mode 100644
index b1b61a4af..000000000
--- a/samples/wearable/DelayedConfirmation/screenshots/companion_delayed_confirmation.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/DelayedConfirmation/screenshots/delayed_confirmation_box_inset_all.png b/samples/wearable/DelayedConfirmation/screenshots/delayed_confirmation_box_inset_all.png
deleted file mode 100644
index 9119dd38e..000000000
--- a/samples/wearable/DelayedConfirmation/screenshots/delayed_confirmation_box_inset_all.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/DelayedConfirmation/screenshots/delayed_confirmation_box_inset_top.png b/samples/wearable/DelayedConfirmation/screenshots/delayed_confirmation_box_inset_top.png
deleted file mode 100644
index 6d2da705d..000000000
--- a/samples/wearable/DelayedConfirmation/screenshots/delayed_confirmation_box_inset_top.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/DelayedConfirmation/screenshots/delayed_confirmation_notification.png b/samples/wearable/DelayedConfirmation/screenshots/delayed_confirmation_notification.png
deleted file mode 100644
index 936bcaf0f..000000000
--- a/samples/wearable/DelayedConfirmation/screenshots/delayed_confirmation_notification.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/DelayedConfirmation/settings.gradle b/samples/wearable/DelayedConfirmation/settings.gradle
deleted file mode 100644
index 68726d456..000000000
--- a/samples/wearable/DelayedConfirmation/settings.gradle
+++ /dev/null
@@ -1 +0,0 @@
-include 'Application', 'Wearable' \ No newline at end of file
diff --git a/samples/wearable/ElizaChat/Application/build.gradle b/samples/wearable/ElizaChat/Application/build.gradle
deleted file mode 100644
index 7abc52428..000000000
--- a/samples/wearable/ElizaChat/Application/build.gradle
+++ /dev/null
@@ -1,24 +0,0 @@
-apply plugin: 'android'
-
-android {
- compileSdkVersion 18
- buildToolsVersion '20'
-
- defaultConfig {
- minSdkVersion 18
- targetSdkVersion 19
- versionCode 1
- versionName "1.0"
- }
-
- buildTypes {
- release {
- runProguard false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
- }
- }
-}
-
-dependencies {
- compile "com.android.support:support-v4:20.0.+"
-}
diff --git a/samples/wearable/ElizaChat/Application/proguard-rules.txt b/samples/wearable/ElizaChat/Application/proguard-rules.txt
deleted file mode 100644
index 5b89420db..000000000
--- a/samples/wearable/ElizaChat/Application/proguard-rules.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 *;
-#} \ No newline at end of file
diff --git a/samples/wearable/ElizaChat/Application/project.properties b/samples/wearable/ElizaChat/Application/project.properties
deleted file mode 100644
index 4ab125693..000000000
--- a/samples/wearable/ElizaChat/Application/project.properties
+++ /dev/null
@@ -1,14 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system edit
-# "ant.properties", and override values to adapt the script to your
-# project structure.
-#
-# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
-#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
-
-# Project target.
-target=android-19
diff --git a/samples/wearable/ElizaChat/Application/src/main/AndroidManifest.xml b/samples/wearable/ElizaChat/Application/src/main/AndroidManifest.xml
deleted file mode 100644
index dc06b5160..000000000
--- a/samples/wearable/ElizaChat/Application/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.wearable.elizachat" >
-
- <application
- android:allowBackup="true"
- android:icon="@mipmap/ic_app_eliza"
- android:label="@string/app_name"
- android:theme="@style/AppTheme" >
- <activity
- android:name=".MainActivity"
- android:label="@string/app_name" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <service
- android:name=".ResponderService">
- <intent-filter>
- <action android:name="com.example.android.wearable.elizachat.REPLY" />
- <action android:name="com.example.android.wearable.elizachat.CONVERSATION" />
- </intent-filter>
- </service>
- </application>
-
-</manifest>
diff --git a/samples/wearable/ElizaChat/Application/src/main/java/com/example/android/wearable/elizachat/MainActivity.java b/samples/wearable/ElizaChat/Application/src/main/java/com/example/android/wearable/elizachat/MainActivity.java
deleted file mode 100644
index ef08e987a..000000000
--- a/samples/wearable/ElizaChat/Application/src/main/java/com/example/android/wearable/elizachat/MainActivity.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (C) 2014 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.wearable.elizachat;
-
-import android.app.Activity;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.os.Bundle;
-import android.support.v4.content.LocalBroadcastManager;
-import android.text.TextUtils;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.widget.TextView;
-
-public class MainActivity extends Activity {
-
- @SuppressWarnings("unused")
- private static final String TAG = "MainActivity";
-
- public static final String EXTRA_MESSAGE = "message";
-
- public static final String ACTION_NOTIFY = "com.example.android.wearable.elizachat.NOTIFY";
-
- public static final String ACTION_GET_CONVERSATION
- = "com.example.android.wearable.elizachat.CONVERSATION";
-
- private BroadcastReceiver mReceiver;
-
- private TextView mHistoryView;
-
- @Override
- protected void onCreate(Bundle saved) {
- super.onCreate(saved);
- setContentView(R.layout.activity_main);
- mReceiver = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- processMessage(intent);
- }
- };
- mHistoryView = (TextView) findViewById(R.id.history);
- startResponderService();
- }
-
- private void startResponderService() {
- Intent serviceIntent = new Intent(ResponderService.ACTION_INCOMING);
- startService(serviceIntent);
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- LocalBroadcastManager.getInstance(this).registerReceiver(mReceiver,
- new IntentFilter(ACTION_NOTIFY));
- mHistoryView.setText("");
- Intent serviceIntent = new Intent(ACTION_GET_CONVERSATION);
- startService(serviceIntent);
-
- }
-
- @Override
- protected void onPause() {
- LocalBroadcastManager.getInstance(this).unregisterReceiver(mReceiver);
- super.onPause();
- }
-
- private void processMessage(Intent intent) {
- String text = intent.getStringExtra(EXTRA_MESSAGE);
- if (!TextUtils.isEmpty(text)) {
- mHistoryView.append("\n" + text);
- }
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- super.onCreateOptionsMenu(menu);
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case R.id.action_stop_service:
- stopService(new Intent(this, ResponderService.class));
- finish();
- break;
- }
- return true;
- }
-}
diff --git a/samples/wearable/ElizaChat/Application/src/main/res/values/strings.xml b/samples/wearable/ElizaChat/Application/src/main/res/values/strings.xml
deleted file mode 100644
index 29130e61c..000000000
--- a/samples/wearable/ElizaChat/Application/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<resources>
-
- <string name="app_name">ElizaChat</string>
- <string name="send_notification">Send notification!</string>
- <string name="eliza">Eliza</string>
- <string name="answer_eliza">Answer Eliza</string>
- <string name="reply">Reply</string>
- <string name="stop_service">End Chat Session</string>
-
-</resources>
diff --git a/samples/wearable/ElizaChat/Application/src/main/res/values/styles.xml b/samples/wearable/ElizaChat/Application/src/main/res/values/styles.xml
deleted file mode 100644
index e1edbe8d5..000000000
--- a/samples/wearable/ElizaChat/Application/src/main/res/values/styles.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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. -->
- <style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
- <!-- Customize your theme here. -->
- </style>
-
-</resources>
diff --git a/samples/wearable/ElizaChat/_index.html b/samples/wearable/ElizaChat/_index.html
deleted file mode 100644
index 0bc94336d..000000000
--- a/samples/wearable/ElizaChat/_index.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<p><b>About: </b>
-This sample is a phone application that provides a chat experience in which users can respond to
-messages with a quick voice response. New messages create a notification with a "Reply" action.
-The notification is bridged from phone to wearable, and selecting the "Reply" action on the
-wearable opens the voice transcription UI allowing the user to speak a response.</p>
-
-<p>To keep the example simple and self-contained, instead of a real chat application (which would
-require a server or a peer-to-peer connection), the conversation is conducted with an chat bot on
-the phone. Each time the bot responds, the phone app updates the notification and allows the user
-to write back. This sample is primarily intended to demonstrate the voice-reply capabilities
-provided by the Android Wear notification API.</p>
-
-<p>When using the emulator you can type a response instead of speaking it aloud. To allow typed
-responses, ensure that your emulator image has the "hardware keyboard present" option enabled.
-After typing your message into the emulator window, hit the enter key and wait a few seconds for
-your message to be sent.</p>
-
-
-<p><b>How to run:</b> Install the Application APK on the companion and run it. A notification will
-automatically be bridged onto the wearable, with a "Reply" action.</p>
-<p><b>Screenshots:</b>
- <figure>
- <img src="screenshots/companion_eliza_chat.png" alt="Eliza chat when opened on companion"
- width="216" height="384">
- <img src="screenshots/wearable_eliza_notification.png" alt="Initial notification on
- wearable" width="140" height="140">
- <img src="screenshots/wearable_voice_reply.png" alt="Initial notification on
- wearable" width="140" height="140">
- <img src="screenshots/companion_eliza_chat_response.png" alt="Response received on
- companion" width="216" height="384">
- <figcaption>The progressing stages of a chat with Eliza.</figcaption>
- </figure>
-</p>
diff --git a/samples/wearable/ElizaChat/build.gradle b/samples/wearable/ElizaChat/build.gradle
deleted file mode 100644
index d3c8c5971..000000000
--- a/samples/wearable/ElizaChat/build.gradle
+++ /dev/null
@@ -1,14 +0,0 @@
-buildscript {
- repositories {
- mavenCentral()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:0.12.+'
- }
-}
-
-allprojects {
- repositories {
- mavenCentral()
- }
-} \ No newline at end of file
diff --git a/samples/wearable/ElizaChat/gradle.properties b/samples/wearable/ElizaChat/gradle.properties
deleted file mode 100644
index 5d08ba75b..000000000
--- a/samples/wearable/ElizaChat/gradle.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-# Project-wide Gradle settings.
-
-# IDE (e.g. Android Studio) users:
-# Settings specified in this file will override any Gradle settings
-# configured through the IDE.
-
-# For more details on how to configure your build environment visit
-# http://www.gradle.org/docs/current/userguide/build_environment.html
-
-# Specifies the JVM arguments used for the daemon process.
-# The setting is particularly useful for tweaking memory settings.
-# Default value: -Xmx10248m -XX:MaxPermSize=256m
-# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
-
-# When configured, Gradle will run in incubating parallel mode.
-# This option should only be used with decoupled projects. More details, visit
-# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
-# org.gradle.parallel=true \ No newline at end of file
diff --git a/samples/wearable/ElizaChat/gradle/wrapper/gradle-wrapper.jar b/samples/wearable/ElizaChat/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index 8c0fb64a8..000000000
--- a/samples/wearable/ElizaChat/gradle/wrapper/gradle-wrapper.jar
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/ElizaChat/gradle/wrapper/gradle-wrapper.properties b/samples/wearable/ElizaChat/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index 1e61d1fd3..000000000
--- a/samples/wearable/ElizaChat/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-#Wed Apr 10 15:27:10 PDT 2013
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip
diff --git a/samples/wearable/ElizaChat/gradlew b/samples/wearable/ElizaChat/gradlew
deleted file mode 100755
index 91a7e269e..000000000
--- a/samples/wearable/ElizaChat/gradlew
+++ /dev/null
@@ -1,164 +0,0 @@
-#!/usr/bin/env bash
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn ( ) {
- echo "$*"
-}
-
-die ( ) {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
-esac
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched.
-if $cygwin ; then
- [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-fi
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >&-
-APP_HOME="`pwd -P`"
-cd "$SAVED" >&-
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
-}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
-
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/samples/wearable/ElizaChat/gradlew.bat b/samples/wearable/ElizaChat/gradlew.bat
deleted file mode 100755
index aec99730b..000000000
--- a/samples/wearable/ElizaChat/gradlew.bat
+++ /dev/null
@@ -1,90 +0,0 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/samples/wearable/ElizaChat/screenshots/companion_eliza_chat.png b/samples/wearable/ElizaChat/screenshots/companion_eliza_chat.png
deleted file mode 100644
index b7fd26663..000000000
--- a/samples/wearable/ElizaChat/screenshots/companion_eliza_chat.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/ElizaChat/screenshots/companion_eliza_chat_response.png b/samples/wearable/ElizaChat/screenshots/companion_eliza_chat_response.png
deleted file mode 100644
index cea063c35..000000000
--- a/samples/wearable/ElizaChat/screenshots/companion_eliza_chat_response.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/ElizaChat/screenshots/wearable_eliza_notification.png b/samples/wearable/ElizaChat/screenshots/wearable_eliza_notification.png
deleted file mode 100644
index c5ced4963..000000000
--- a/samples/wearable/ElizaChat/screenshots/wearable_eliza_notification.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/ElizaChat/screenshots/wearable_voice_reply.png b/samples/wearable/ElizaChat/screenshots/wearable_voice_reply.png
deleted file mode 100644
index 032e03752..000000000
--- a/samples/wearable/ElizaChat/screenshots/wearable_voice_reply.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/ElizaChat/settings.gradle b/samples/wearable/ElizaChat/settings.gradle
deleted file mode 100644
index 9464a3593..000000000
--- a/samples/wearable/ElizaChat/settings.gradle
+++ /dev/null
@@ -1 +0,0 @@
-include 'Application'
diff --git a/samples/wearable/EmbeddedApp/Application/build.gradle b/samples/wearable/EmbeddedApp/Application/build.gradle
deleted file mode 100644
index 1ce5b265e..000000000
--- a/samples/wearable/EmbeddedApp/Application/build.gradle
+++ /dev/null
@@ -1,34 +0,0 @@
-apply plugin: 'android'
-
-android {
- compileSdkVersion 18
- buildToolsVersion '20'
-
- defaultConfig {
- minSdkVersion 18
- targetSdkVersion 19
- versionCode 1
- versionName '1.0'
- }
-
- signingConfigs {
- release {
- keyAlias 'androiddebugkey'
- keyPassword 'android'
- storeFile file('$rootDir/../../debug.keystore')
- storePassword 'android'
- }
- }
-
- buildTypes {
- release {
- runProguard false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
- signingConfig signingConfigs.release
- }
- }
-}
-
-dependencies {
- wearApp project(':Wearable')
-}
diff --git a/samples/wearable/EmbeddedApp/Application/proguard-rules.txt b/samples/wearable/EmbeddedApp/Application/proguard-rules.txt
deleted file mode 100644
index 5b86c0858..000000000
--- a/samples/wearable/EmbeddedApp/Application/proguard-rules.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-# 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 proguardFiles
-# directive in build.gradle.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# Add any project specific keep options here:
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
diff --git a/samples/wearable/EmbeddedApp/Application/src/main/AndroidManifest.xml b/samples/wearable/EmbeddedApp/Application/src/main/AndroidManifest.xml
deleted file mode 100644
index aac2df8c5..000000000
--- a/samples/wearable/EmbeddedApp/Application/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.wearable.embeddedapp" >
- <uses-sdk android:minSdkVersion="18" android:targetSdkVersion="19" />
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@android:style/Theme.DeviceDefault.Light" >
- <activity
- android:name=".PhoneActivity"
- android:label="@string/app_name" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
-
-</manifest>
diff --git a/samples/wearable/EmbeddedApp/Application/src/main/res/values/strings.xml b/samples/wearable/EmbeddedApp/Application/src/main/res/values/strings.xml
deleted file mode 100644
index 0babff04d..000000000
--- a/samples/wearable/EmbeddedApp/Application/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<resources>
-
- <string name="app_name">EmbeddedApp Sample</string>
- <string name="welcome_message">
- By installing the release build of this application, the corresponding wearable app should
- automatically be installed on any connected wearable devices.
- </string>
-
-</resources>
diff --git a/samples/wearable/EmbeddedApp/Wearable/build.gradle b/samples/wearable/EmbeddedApp/Wearable/build.gradle
deleted file mode 100644
index 92ac19e85..000000000
--- a/samples/wearable/EmbeddedApp/Wearable/build.gradle
+++ /dev/null
@@ -1,30 +0,0 @@
-apply plugin: 'android'
-
-android {
- compileSdkVersion 20
- buildToolsVersion '20'
-
- defaultConfig {
- minSdkVersion 20
- targetSdkVersion 20
- versionCode 1
- versionName '1.0'
- }
-
- signingConfigs {
- release {
- keyAlias 'androiddebugkey'
- keyPassword 'android'
- storeFile file('$rootDir/../../debug.keystore')
- storePassword 'android'
- }
- }
-
- buildTypes {
- release {
- runProguard false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
- signingConfig signingConfigs.release
- }
- }
-}
diff --git a/samples/wearable/EmbeddedApp/Wearable/proguard-rules.txt b/samples/wearable/EmbeddedApp/Wearable/proguard-rules.txt
deleted file mode 100644
index 5b86c0858..000000000
--- a/samples/wearable/EmbeddedApp/Wearable/proguard-rules.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-# 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 proguardFiles
-# directive in build.gradle.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# Add any project specific keep options here:
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
diff --git a/samples/wearable/EmbeddedApp/Wearable/src/main/AndroidManifest.xml b/samples/wearable/EmbeddedApp/Wearable/src/main/AndroidManifest.xml
deleted file mode 100644
index 8c9ef4ece..000000000
--- a/samples/wearable/EmbeddedApp/Wearable/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.wearable.embeddedapp" >
-
- <uses-feature android:name="android.hardware.type.watch" />
-
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@android:style/Theme.DeviceDefault.Light" >
- <activity
- android:name=".WearableActivity"
- android:label="@string/app_name" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
-
-</manifest>
diff --git a/samples/wearable/EmbeddedApp/_index.html b/samples/wearable/EmbeddedApp/_index.html
deleted file mode 100644
index 5b5cdc5e4..000000000
--- a/samples/wearable/EmbeddedApp/_index.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<p><b>About:</b> This simple app demonstrates how to embed a wearable app into a phone app.</p>
-<p><b>How to run:</b> Install the Application APK on the companion, and the Wearable APK on the
-wearable. Start the sample by running the EmbeddedApp Sample application on the companion.</p>
-<p><b>Screenshots:</b>
- <figure>
- <img src="screenshots/phone_app.png" alt="Phone app" width="216" height="384">
- <img src="screenshots/embedded_wearable_app.png" alt="Embedded wearable app" width="140"
- height="140">
- <figcaption>The sample phone app and embedded wearable app.</figcaption>
- </figure>
-</p> \ No newline at end of file
diff --git a/samples/wearable/EmbeddedApp/build.gradle b/samples/wearable/EmbeddedApp/build.gradle
deleted file mode 100644
index 8bd4ffc49..000000000
--- a/samples/wearable/EmbeddedApp/build.gradle
+++ /dev/null
@@ -1,14 +0,0 @@
-buildscript {
- repositories {
- mavenCentral()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:0.12.+'
- }
-}
-
-allprojects {
- repositories {
- mavenCentral()
- }
-}
diff --git a/samples/wearable/EmbeddedApp/debug.keystore b/samples/wearable/EmbeddedApp/debug.keystore
deleted file mode 100644
index 617a6846c..000000000
--- a/samples/wearable/EmbeddedApp/debug.keystore
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/EmbeddedApp/gradle/wrapper/gradle-wrapper.jar b/samples/wearable/EmbeddedApp/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index 8c0fb64a8..000000000
--- a/samples/wearable/EmbeddedApp/gradle/wrapper/gradle-wrapper.jar
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/EmbeddedApp/gradle/wrapper/gradle-wrapper.properties b/samples/wearable/EmbeddedApp/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index 1e61d1fd3..000000000
--- a/samples/wearable/EmbeddedApp/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-#Wed Apr 10 15:27:10 PDT 2013
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip
diff --git a/samples/wearable/EmbeddedApp/gradlew b/samples/wearable/EmbeddedApp/gradlew
deleted file mode 100755
index 91a7e269e..000000000
--- a/samples/wearable/EmbeddedApp/gradlew
+++ /dev/null
@@ -1,164 +0,0 @@
-#!/usr/bin/env bash
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn ( ) {
- echo "$*"
-}
-
-die ( ) {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
-esac
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched.
-if $cygwin ; then
- [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-fi
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >&-
-APP_HOME="`pwd -P`"
-cd "$SAVED" >&-
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
-}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
-
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/samples/wearable/EmbeddedApp/gradlew.bat b/samples/wearable/EmbeddedApp/gradlew.bat
deleted file mode 100755
index aec99730b..000000000
--- a/samples/wearable/EmbeddedApp/gradlew.bat
+++ /dev/null
@@ -1,90 +0,0 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/samples/wearable/EmbeddedApp/screenshots/embedded_wearable_app.png b/samples/wearable/EmbeddedApp/screenshots/embedded_wearable_app.png
deleted file mode 100644
index 414afe519..000000000
--- a/samples/wearable/EmbeddedApp/screenshots/embedded_wearable_app.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/EmbeddedApp/screenshots/phone_app.png b/samples/wearable/EmbeddedApp/screenshots/phone_app.png
deleted file mode 100644
index 46c3d89c3..000000000
--- a/samples/wearable/EmbeddedApp/screenshots/phone_app.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/EmbeddedApp/settings.gradle b/samples/wearable/EmbeddedApp/settings.gradle
deleted file mode 100644
index 19d00acb1..000000000
--- a/samples/wearable/EmbeddedApp/settings.gradle
+++ /dev/null
@@ -1 +0,0 @@
-include ':Application', ':Wearable'
diff --git a/samples/wearable/FindMyPhone/Application/build.gradle b/samples/wearable/FindMyPhone/Application/build.gradle
deleted file mode 100644
index 8d1d61958..000000000
--- a/samples/wearable/FindMyPhone/Application/build.gradle
+++ /dev/null
@@ -1,26 +0,0 @@
-apply plugin: 'android'
-
-android {
- compileSdkVersion 18
- buildToolsVersion '20'
-
- defaultConfig {
- minSdkVersion 18
- targetSdkVersion 19
- versionCode 1
- versionName "1.0"
- }
-
- buildTypes {
- release {
- runProguard false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
- }
- }
-}
-
-dependencies {
- compile 'com.google.android.gms:play-services:5.0.+'
- compile "com.android.support:support-v4:20.0.+"
- wearApp project(':Wearable')
-}
diff --git a/samples/wearable/FindMyPhone/Application/proguard-rules.txt b/samples/wearable/FindMyPhone/Application/proguard-rules.txt
deleted file mode 100644
index 08e5bdc8d..000000000
--- a/samples/wearable/FindMyPhone/Application/proguard-rules.txt
+++ /dev/null
@@ -1,22 +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 *;
-#}
--dontwarn android.support.wearable.view.DelayedConfirmationView
--dontwarn android.support.wearable.view.CircledImageView
diff --git a/samples/wearable/FindMyPhone/Application/project.properties b/samples/wearable/FindMyPhone/Application/project.properties
deleted file mode 100644
index 4ab125693..000000000
--- a/samples/wearable/FindMyPhone/Application/project.properties
+++ /dev/null
@@ -1,14 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system edit
-# "ant.properties", and override values to adapt the script to your
-# project structure.
-#
-# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
-#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
-
-# Project target.
-target=android-19
diff --git a/samples/wearable/FindMyPhone/Application/src/main/AndroidManifest.xml b/samples/wearable/FindMyPhone/Application/src/main/AndroidManifest.xml
deleted file mode 100644
index 79999bab8..000000000
--- a/samples/wearable/FindMyPhone/Application/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.wearable.findphone">
-
- <uses-permission android:name="android.permission.VIBRATE" />
- <application
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@android:style/Theme.Holo.Light"
- android:allowBackup="true">
-
- <meta-data
- android:name="com.google.android.gms.version"
- android:value="@integer/google_play_services_version" />
-
- <service
- android:name="com.example.android.wearable.findphone.SoundAlarmListenerService" >
- <intent-filter>
- <action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
- </intent-filter>
- </service>
-
- </application>
-</manifest>
diff --git a/samples/wearable/FindMyPhone/Application/src/main/res/values/strings.xml b/samples/wearable/FindMyPhone/Application/src/main/res/values/strings.xml
deleted file mode 100644
index 8db7cedcb..000000000
--- a/samples/wearable/FindMyPhone/Application/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<resources>
-
- <string name="app_name">Find My Phone</string>
-
-</resources>
diff --git a/samples/wearable/FindMyPhone/Wearable/build.gradle b/samples/wearable/FindMyPhone/Wearable/build.gradle
deleted file mode 100644
index 0e23b4d56..000000000
--- a/samples/wearable/FindMyPhone/Wearable/build.gradle
+++ /dev/null
@@ -1,25 +0,0 @@
-apply plugin: 'android'
-
-android {
- compileSdkVersion 20
- buildToolsVersion '20'
-
- defaultConfig {
- minSdkVersion 20
- targetSdkVersion 20
- versionCode 1
- versionName "1.0"
- }
-
- buildTypes {
- release {
- runProguard false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
- }
- }
-}
-
-dependencies {
- compile 'com.google.android.gms:play-services-wearable:+'
- compile "com.google.android.support:wearable:1.0.+"
-} \ No newline at end of file
diff --git a/samples/wearable/FindMyPhone/Wearable/proguard-rules.txt b/samples/wearable/FindMyPhone/Wearable/proguard-rules.txt
deleted file mode 100644
index 08e5bdc8d..000000000
--- a/samples/wearable/FindMyPhone/Wearable/proguard-rules.txt
+++ /dev/null
@@ -1,22 +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 *;
-#}
--dontwarn android.support.wearable.view.DelayedConfirmationView
--dontwarn android.support.wearable.view.CircledImageView
diff --git a/samples/wearable/FindMyPhone/Wearable/project.properties b/samples/wearable/FindMyPhone/Wearable/project.properties
deleted file mode 100644
index 4ab125693..000000000
--- a/samples/wearable/FindMyPhone/Wearable/project.properties
+++ /dev/null
@@ -1,14 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system edit
-# "ant.properties", and override values to adapt the script to your
-# project structure.
-#
-# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
-#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
-
-# Project target.
-target=android-19
diff --git a/samples/wearable/FindMyPhone/Wearable/src/main/AndroidManifest.xml b/samples/wearable/FindMyPhone/Wearable/src/main/AndroidManifest.xml
deleted file mode 100644
index 81ef5897f..000000000
--- a/samples/wearable/FindMyPhone/Wearable/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.wearable.findphone" >
-
- <uses-permission android:name="android.permission.VIBRATE" />
- <uses-feature android:name="android.hardware.type.watch" />
-
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@android:style/Theme.DeviceDefault" >
-
- <meta-data
- android:name="com.google.android.gms.version"
- android:value="@integer/google_play_services_version" />
-
- <service android:name=".DisconnectListenerService" >
- <intent-filter>
- <action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
- </intent-filter>
- </service>
-
- <service android:name="com.example.android.wearable.findphone.FindPhoneService"/>
-
- <activity
- android:name=".FindPhoneActivity"
- android:label="@string/app_name" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN"/>
- <category android:name="android.intent.category.LAUNCHER"/>
- </intent-filter>
- </activity>
- </application>
-
-</manifest>
diff --git a/samples/wearable/FindMyPhone/_index.html b/samples/wearable/FindMyPhone/_index.html
deleted file mode 100644
index 9d19f5bed..000000000
--- a/samples/wearable/FindMyPhone/_index.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<p><b>About:</b> This sample application notifies you when you may have left your phone behind
-(specifically, when your companion and wearable disconnect). If you have misplaced your phone, but
-it is still connected to your wearable, you can also start an activity on the wearable to sound an
-alarm on your phone.</p>
-<p><b>How to run:</b> Install the Application APK on the companion, and the Wearable APK on the
-wearable. A notification will automatically appear on the wearable when the wearable and companion
-disconnect. To start the FindMyPhone activity on the wearable, go to the voice menu (either by
-saying "OK Google" or tapping the home screen) and select the "Start..." option. Then, select
-"Find My Phone" from the submenu.</p>
-<p><b>Wearable APIs used:</b> DataApi, WearableListenerService</p>
-<p><b>Screenshots:</b>
- <figure>
- <img src="screenshots/find_my_phone_notification.png" alt="Forgetting something?"
- width="140" height="140">
- <img src="screenshots/find_my_phone_activity.png" alt="Tap to sound an alarm on phone"
- width="140" height="140">
- <figcaption>The notification that appears when your wearable and companion disconnect,
- followed by the wearable FindMyPhone activity (which just creates a notification).
- </figcaption>
- </figure>
-</p>
diff --git a/samples/wearable/FindMyPhone/build.gradle b/samples/wearable/FindMyPhone/build.gradle
deleted file mode 100644
index d3c8c5971..000000000
--- a/samples/wearable/FindMyPhone/build.gradle
+++ /dev/null
@@ -1,14 +0,0 @@
-buildscript {
- repositories {
- mavenCentral()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:0.12.+'
- }
-}
-
-allprojects {
- repositories {
- mavenCentral()
- }
-} \ No newline at end of file
diff --git a/samples/wearable/FindMyPhone/gradle.properties b/samples/wearable/FindMyPhone/gradle.properties
deleted file mode 100644
index 5d08ba75b..000000000
--- a/samples/wearable/FindMyPhone/gradle.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-# Project-wide Gradle settings.
-
-# IDE (e.g. Android Studio) users:
-# Settings specified in this file will override any Gradle settings
-# configured through the IDE.
-
-# For more details on how to configure your build environment visit
-# http://www.gradle.org/docs/current/userguide/build_environment.html
-
-# Specifies the JVM arguments used for the daemon process.
-# The setting is particularly useful for tweaking memory settings.
-# Default value: -Xmx10248m -XX:MaxPermSize=256m
-# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
-
-# When configured, Gradle will run in incubating parallel mode.
-# This option should only be used with decoupled projects. More details, visit
-# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
-# org.gradle.parallel=true \ No newline at end of file
diff --git a/samples/wearable/FindMyPhone/gradle/wrapper/gradle-wrapper.jar b/samples/wearable/FindMyPhone/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index 8c0fb64a8..000000000
--- a/samples/wearable/FindMyPhone/gradle/wrapper/gradle-wrapper.jar
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/FindMyPhone/gradle/wrapper/gradle-wrapper.properties b/samples/wearable/FindMyPhone/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index 1e61d1fd3..000000000
--- a/samples/wearable/FindMyPhone/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-#Wed Apr 10 15:27:10 PDT 2013
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip
diff --git a/samples/wearable/FindMyPhone/gradlew b/samples/wearable/FindMyPhone/gradlew
deleted file mode 100755
index 91a7e269e..000000000
--- a/samples/wearable/FindMyPhone/gradlew
+++ /dev/null
@@ -1,164 +0,0 @@
-#!/usr/bin/env bash
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn ( ) {
- echo "$*"
-}
-
-die ( ) {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
-esac
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched.
-if $cygwin ; then
- [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-fi
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >&-
-APP_HOME="`pwd -P`"
-cd "$SAVED" >&-
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
-}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
-
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/samples/wearable/FindMyPhone/gradlew.bat b/samples/wearable/FindMyPhone/gradlew.bat
deleted file mode 100755
index aec99730b..000000000
--- a/samples/wearable/FindMyPhone/gradlew.bat
+++ /dev/null
@@ -1,90 +0,0 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/samples/wearable/FindMyPhone/screenshots/find_my_phone_activity.png b/samples/wearable/FindMyPhone/screenshots/find_my_phone_activity.png
deleted file mode 100644
index 8cff992c3..000000000
--- a/samples/wearable/FindMyPhone/screenshots/find_my_phone_activity.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/FindMyPhone/screenshots/find_my_phone_notification.png b/samples/wearable/FindMyPhone/screenshots/find_my_phone_notification.png
deleted file mode 100644
index a8ed8679a..000000000
--- a/samples/wearable/FindMyPhone/screenshots/find_my_phone_notification.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/FindMyPhone/settings.gradle b/samples/wearable/FindMyPhone/settings.gradle
deleted file mode 100644
index f3f25a547..000000000
--- a/samples/wearable/FindMyPhone/settings.gradle
+++ /dev/null
@@ -1 +0,0 @@
-include 'Wearable', 'Application'
diff --git a/samples/wearable/Flashlight/Wearable/build.gradle b/samples/wearable/Flashlight/Wearable/build.gradle
deleted file mode 100644
index b9450ca9a..000000000
--- a/samples/wearable/Flashlight/Wearable/build.gradle
+++ /dev/null
@@ -1,24 +0,0 @@
-apply plugin: 'android'
-
-android {
- compileSdkVersion 20
- buildToolsVersion '20'
-
- defaultConfig {
- minSdkVersion 20
- targetSdkVersion 20
- versionCode 1
- versionName "1.0"
- }
-
- buildTypes {
- release {
- runProguard false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
- }
- }
-}
-
-dependencies {
- compile "com.google.android.support:wearable:1.0.+"
-}
diff --git a/samples/wearable/Flashlight/Wearable/proguard-rules.txt b/samples/wearable/Flashlight/Wearable/proguard-rules.txt
deleted file mode 100644
index 2267fe6a9..000000000
--- a/samples/wearable/Flashlight/Wearable/proguard-rules.txt
+++ /dev/null
@@ -1,44 +0,0 @@
-# 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 classes here when necessary.
-
--keep class android.support.wearable.view.WearableListView {
- private void setScrollAnimator(int);
- protected void setScrollVertically(int);
-}
--keep class android.support.wearable.view.WearableListView.ViewHolder {
- private void setFocusPaddingTop(int);
- private void setFocusPaddingBottom(int);
-}
-
-# GmsCore Proguard rules.
-# See: https://developer.android.com/google/play-services/setup.html
--keep class * extends java.util.ListResourceBundle {
- protected Object[][] getContents();
-}
-
-# Keep SafeParcelable value, needed for reflection. This is required to support backwards
-# compatibility of some classes.
--keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
- public static final *** NULL;
-}
-
-# Keep the names of classes/members we need for client functionality.
--keepnames @com.google.android.gms.common.annotation.KeepName class *
--keepclassmembernames class * {
- @com.google.android.gms.common.annotation.KeepName *;
-}
-
-# Needed for Parcelable/SafeParcelable Creators to not get stripped
--keepnames class * implements android.os.Parcelable {
- public static final ** CREATOR;
-}
-
-# End GmsCore Proguard rules.
diff --git a/samples/wearable/Flashlight/Wearable/src/main/AndroidManifest.xml b/samples/wearable/Flashlight/Wearable/src/main/AndroidManifest.xml
deleted file mode 100644
index bd240dd34..000000000
--- a/samples/wearable/Flashlight/Wearable/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.wearable.flashlight" >
-
- <uses-feature android:name="android.hardware.type.watch" />
-
- <application
- android:label="@string/app_name"
- android:icon="@drawable/ic_launcher"
- android:theme="@android:style/Theme.DeviceDefault" >
- <activity android:name=".MainActivity"
- android:label="@string/app_name"
- android:launchMode="singleTop"
- android:configChanges="orientation|keyboardHidden">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- <category android:name="android.intent.category.DEFAULT" />
- </intent-filter>
- </activity>
- </application>
-</manifest>
diff --git a/samples/wearable/Flashlight/_index.html b/samples/wearable/Flashlight/_index.html
deleted file mode 100644
index 358148a21..000000000
--- a/samples/wearable/Flashlight/_index.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<p><b>About:</b> Wearable activity that uses your wearable screen as a flashlight. There is also
-a party-mode option, if you want to make things interesting.</p>
-<p><b>How to run:</b> Install the Wearable APK on the wearable, go to the voice menu (either by
-saying "OK Google" or tapping the home screen) and select the "Start..." option. Then, select
-"Flashlight" from the submenu.</p>
-<p><b>Screenshots:</b>
- <figure>
- <img src="screenshots/flashlight.png" alt="Flashlight" width="140" height="140">
- <img src="screenshots/party_mode.gif" alt="Party mode!" width="140" height="140">
- <figcaption>Plain flashlight, followed by party-mode.</figcaption>
- </figure>
-</p>
diff --git a/samples/wearable/Flashlight/build.gradle b/samples/wearable/Flashlight/build.gradle
deleted file mode 100644
index 8bd4ffc49..000000000
--- a/samples/wearable/Flashlight/build.gradle
+++ /dev/null
@@ -1,14 +0,0 @@
-buildscript {
- repositories {
- mavenCentral()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:0.12.+'
- }
-}
-
-allprojects {
- repositories {
- mavenCentral()
- }
-}
diff --git a/samples/wearable/Flashlight/gradle/wrapper/gradle-wrapper.jar b/samples/wearable/Flashlight/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index 8c0fb64a8..000000000
--- a/samples/wearable/Flashlight/gradle/wrapper/gradle-wrapper.jar
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/Flashlight/gradle/wrapper/gradle-wrapper.properties b/samples/wearable/Flashlight/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index 1e61d1fd3..000000000
--- a/samples/wearable/Flashlight/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-#Wed Apr 10 15:27:10 PDT 2013
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip
diff --git a/samples/wearable/Flashlight/gradlew b/samples/wearable/Flashlight/gradlew
deleted file mode 100755
index 91a7e269e..000000000
--- a/samples/wearable/Flashlight/gradlew
+++ /dev/null
@@ -1,164 +0,0 @@
-#!/usr/bin/env bash
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn ( ) {
- echo "$*"
-}
-
-die ( ) {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
-esac
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched.
-if $cygwin ; then
- [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-fi
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >&-
-APP_HOME="`pwd -P`"
-cd "$SAVED" >&-
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
-}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
-
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/samples/wearable/Flashlight/gradlew.bat b/samples/wearable/Flashlight/gradlew.bat
deleted file mode 100755
index aec99730b..000000000
--- a/samples/wearable/Flashlight/gradlew.bat
+++ /dev/null
@@ -1,90 +0,0 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/samples/wearable/Flashlight/screenshots/flashlight.png b/samples/wearable/Flashlight/screenshots/flashlight.png
deleted file mode 100644
index 02fca20d6..000000000
--- a/samples/wearable/Flashlight/screenshots/flashlight.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/Flashlight/screenshots/party_mode.gif b/samples/wearable/Flashlight/screenshots/party_mode.gif
deleted file mode 100644
index 8258b7dd6..000000000
--- a/samples/wearable/Flashlight/screenshots/party_mode.gif
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/Flashlight/settings.gradle b/samples/wearable/Flashlight/settings.gradle
deleted file mode 100644
index 1d97d30e1..000000000
--- a/samples/wearable/Flashlight/settings.gradle
+++ /dev/null
@@ -1 +0,0 @@
-include ':Wearable'
diff --git a/samples/wearable/Geofencing/Application/build.gradle b/samples/wearable/Geofencing/Application/build.gradle
deleted file mode 100644
index 8d1d61958..000000000
--- a/samples/wearable/Geofencing/Application/build.gradle
+++ /dev/null
@@ -1,26 +0,0 @@
-apply plugin: 'android'
-
-android {
- compileSdkVersion 18
- buildToolsVersion '20'
-
- defaultConfig {
- minSdkVersion 18
- targetSdkVersion 19
- versionCode 1
- versionName "1.0"
- }
-
- buildTypes {
- release {
- runProguard false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
- }
- }
-}
-
-dependencies {
- compile 'com.google.android.gms:play-services:5.0.+'
- compile "com.android.support:support-v4:20.0.+"
- wearApp project(':Wearable')
-}
diff --git a/samples/wearable/Geofencing/Application/proguard-rules.txt b/samples/wearable/Geofencing/Application/proguard-rules.txt
deleted file mode 100644
index 5b89420db..000000000
--- a/samples/wearable/Geofencing/Application/proguard-rules.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 *;
-#} \ No newline at end of file
diff --git a/samples/wearable/Geofencing/Application/project.properties b/samples/wearable/Geofencing/Application/project.properties
deleted file mode 100644
index 4ab125693..000000000
--- a/samples/wearable/Geofencing/Application/project.properties
+++ /dev/null
@@ -1,14 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system edit
-# "ant.properties", and override values to adapt the script to your
-# project structure.
-#
-# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
-#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
-
-# Project target.
-target=android-19
diff --git a/samples/wearable/Geofencing/Application/src/main/AndroidManifest.xml b/samples/wearable/Geofencing/Application/src/main/AndroidManifest.xml
deleted file mode 100644
index 094134eb9..000000000
--- a/samples/wearable/Geofencing/Application/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.wearable.geofencing">
-
- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
-
- <application
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@android:style/Theme.Holo.Light"
- android:allowBackup="true">
-
- <meta-data
- android:name="com.google.android.gms.version"
- android:value="@integer/google_play_services_version"/>
-
- <activity
- android:name=".MainActivity"
- android:label="@string/app_name"
- android:theme="@android:style/Theme.Translucent.NoTitleBar"
- android:excludeFromRecents="true">
- <intent-filter>
- <action android:name="android.intent.action.MAIN"/>
- <category android:name="android.intent.category.LAUNCHER"/>
- </intent-filter>
- </activity>
-
- <service
- android:name=".GeofenceTransitionsIntentService"
- android:exported="false">
- </service>
- </application>
-</manifest>
diff --git a/samples/wearable/Geofencing/Application/src/main/java/com/example/android/wearable/geofencing/GeofenceTransitionsIntentService.java b/samples/wearable/Geofencing/Application/src/main/java/com/example/android/wearable/geofencing/GeofenceTransitionsIntentService.java
deleted file mode 100644
index 5d1ea48e0..000000000
--- a/samples/wearable/Geofencing/Application/src/main/java/com/example/android/wearable/geofencing/GeofenceTransitionsIntentService.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright (C) 2014 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.wearable.geofencing;
-
-import static com.example.android.wearable.geofencing.Constants.CONNECTION_TIME_OUT_MS;
-import static com.example.android.wearable.geofencing.Constants.GEOFENCE_DATA_ITEM_PATH;
-import static com.example.android.wearable.geofencing.Constants.GEOFENCE_DATA_ITEM_URI;
-import static com.example.android.wearable.geofencing.Constants.KEY_GEOFENCE_ID;
-import static com.example.android.wearable.geofencing.Constants.TAG;
-
-import android.app.IntentService;
-import android.content.Intent;
-import android.os.Bundle;
-import android.util.Log;
-
-import com.google.android.gms.common.ConnectionResult;
-import com.google.android.gms.common.api.GoogleApiClient;
-import com.google.android.gms.location.Geofence;
-import com.google.android.gms.location.LocationClient;
-import com.google.android.gms.wearable.PutDataMapRequest;
-import com.google.android.gms.wearable.Wearable;
-
-import java.util.concurrent.TimeUnit;
-
-/**
- * Listens for geofence transition changes.
- */
-public class GeofenceTransitionsIntentService extends IntentService
- implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
-
- private GoogleApiClient mGoogleApiClient;
-
- public GeofenceTransitionsIntentService() {
- super(GeofenceTransitionsIntentService.class.getSimpleName());
- }
-
- @Override
- public void onCreate() {
- super.onCreate();
- mGoogleApiClient = new GoogleApiClient.Builder(this)
- .addApi(Wearable.API)
- .addConnectionCallbacks(this)
- .addOnConnectionFailedListener(this)
- .build();
- }
-
- /**
- * Handles incoming intents.
- * @param intent The Intent sent by Location Services. This Intent is provided to Location
- * Services (inside a PendingIntent) when addGeofences() is called.
- */
- @Override
- protected void onHandleIntent(Intent intent) {
- // First check for errors.
- if (LocationClient.hasError(intent)) {
- int errorCode = LocationClient.getErrorCode(intent);
- Log.e(TAG, "Location Services error: " + errorCode);
- } else {
- // Get the type of geofence transition (i.e. enter or exit in this sample).
- int transitionType = LocationClient.getGeofenceTransition(intent);
- // Create a DataItem when a user enters one of the geofences. The wearable app will
- // receive this and create a notification to prompt him/her to check in.
- if (Geofence.GEOFENCE_TRANSITION_ENTER == transitionType) {
- // Connect to the Google Api service in preparation for sending a DataItem.
- mGoogleApiClient.blockingConnect(CONNECTION_TIME_OUT_MS, TimeUnit.MILLISECONDS);
- // Get the geofence id triggered. Note that only one geofence can be triggered at a
- // time in this example, but in some cases you might want to consider the full list
- // of geofences triggered.
- String triggeredGeofenceId = LocationClient.getTriggeringGeofences(intent).get(0)
- .getRequestId();
- // Create a DataItem with this geofence's id. The wearable can use this to create
- // a notification.
- final PutDataMapRequest putDataMapRequest =
- PutDataMapRequest.create(GEOFENCE_DATA_ITEM_PATH);
- putDataMapRequest.getDataMap().putString(KEY_GEOFENCE_ID, triggeredGeofenceId);
- if (mGoogleApiClient.isConnected()) {
- Wearable.DataApi.putDataItem(
- mGoogleApiClient, putDataMapRequest.asPutDataRequest()).await();
- } else {
- Log.e(TAG, "Failed to send data item: " + putDataMapRequest
- + " - Client disconnected from Google Play Services");
- }
- mGoogleApiClient.disconnect();
- } else if (Geofence.GEOFENCE_TRANSITION_EXIT == transitionType) {
- // Delete the data item when leaving a geofence region.
- mGoogleApiClient.blockingConnect(CONNECTION_TIME_OUT_MS, TimeUnit.MILLISECONDS);
- Wearable.DataApi.deleteDataItems(mGoogleApiClient, GEOFENCE_DATA_ITEM_URI).await();
- mGoogleApiClient.disconnect();
- }
- }
- }
-
- @Override
- public void onConnected(Bundle connectionHint) {
- }
-
- @Override
- public void onConnectionSuspended(int cause) {
- }
-
- @Override
- public void onConnectionFailed(ConnectionResult result) {
- }
-
-}
diff --git a/samples/wearable/Geofencing/Application/src/main/java/com/example/android/wearable/geofencing/MainActivity.java b/samples/wearable/Geofencing/Application/src/main/java/com/example/android/wearable/geofencing/MainActivity.java
deleted file mode 100644
index baef21755..000000000
--- a/samples/wearable/Geofencing/Application/src/main/java/com/example/android/wearable/geofencing/MainActivity.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * Copyright (C) 2014 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.wearable.geofencing;
-
-import static com.example.android.wearable.geofencing.Constants.ANDROID_BUILDING_ID;
-import static com.example.android.wearable.geofencing.Constants.ANDROID_BUILDING_LATITUDE;
-import static com.example.android.wearable.geofencing.Constants.ANDROID_BUILDING_LONGITUDE;
-import static com.example.android.wearable.geofencing.Constants.ANDROID_BUILDING_RADIUS_METERS;
-import static com.example.android.wearable.geofencing.Constants.CONNECTION_FAILURE_RESOLUTION_REQUEST;
-import static com.example.android.wearable.geofencing.Constants.GEOFENCE_EXPIRATION_TIME;
-import static com.example.android.wearable.geofencing.Constants.TAG;
-import static com.example.android.wearable.geofencing.Constants.YERBA_BUENA_ID;
-import static com.example.android.wearable.geofencing.Constants.YERBA_BUENA_LATITUDE;
-import static com.example.android.wearable.geofencing.Constants.YERBA_BUENA_LONGITUDE;
-import static com.example.android.wearable.geofencing.Constants.YERBA_BUENA_RADIUS_METERS;
-
-import android.app.Activity;
-import android.app.PendingIntent;
-import android.content.Intent;
-import android.content.IntentSender;
-import android.os.Bundle;
-import android.util.Log;
-import android.widget.Toast;
-
-import com.google.android.gms.common.ConnectionResult;
-import com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks;
-import com.google.android.gms.common.GooglePlayServicesUtil;
-import com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener;
-import com.google.android.gms.location.Geofence;
-import com.google.android.gms.location.LocationClient;
-import com.google.android.gms.location.LocationClient.OnAddGeofencesResultListener;
-import com.google.android.gms.location.LocationStatusCodes;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class MainActivity extends Activity implements ConnectionCallbacks,
- OnConnectionFailedListener, OnAddGeofencesResultListener {
-
- // Internal List of Geofence objects. In a real app, these might be provided by an API based on
- // locations within the user's proximity.
- List<Geofence> mGeofenceList;
-
- // These will store hard-coded geofences in this sample app.
- private SimpleGeofence mAndroidBuildingGeofence;
- private SimpleGeofence mYerbaBuenaGeofence;
-
- // Persistent storage for geofences.
- private SimpleGeofenceStore mGeofenceStorage;
-
- private LocationClient mLocationClient;
- // Stores the PendingIntent used to request geofence monitoring.
- private PendingIntent mGeofenceRequestIntent;
-
- // Defines the allowable request types (in this example, we only add geofences).
- private enum REQUEST_TYPE {ADD}
- private REQUEST_TYPE mRequestType;
- // Flag that indicates if a request is underway.
- private boolean mInProgress;
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- // Rather than displayng this activity, simply display a toast indicating that the geofence
- // service is being created. This should happen in less than a second.
- Toast.makeText(this, getString(R.string.start_geofence_service), Toast.LENGTH_SHORT).show();
-
- // Instantiate a new geofence storage area.
- mGeofenceStorage = new SimpleGeofenceStore(this);
- // Instantiate the current List of geofences.
- mGeofenceList = new ArrayList<Geofence>();
- // Start with the request flag set to false.
- mInProgress = false;
-
- createGeofences();
- addGeofences();
-
- finish();
- }
-
- /**
- * In this sample, the geofences are predetermined and are hard-coded here. A real app might
- * dynamically create geofences based on the user's location.
- */
- public void createGeofences() {
- // Create internal "flattened" objects containing the geofence data.
- mAndroidBuildingGeofence = new SimpleGeofence(
- ANDROID_BUILDING_ID, // geofenceId.
- ANDROID_BUILDING_LATITUDE,
- ANDROID_BUILDING_LONGITUDE,
- ANDROID_BUILDING_RADIUS_METERS,
- GEOFENCE_EXPIRATION_TIME,
- Geofence.GEOFENCE_TRANSITION_ENTER | Geofence.GEOFENCE_TRANSITION_EXIT
- );
- mYerbaBuenaGeofence = new SimpleGeofence(
- YERBA_BUENA_ID, // geofenceId.
- YERBA_BUENA_LATITUDE,
- YERBA_BUENA_LONGITUDE,
- YERBA_BUENA_RADIUS_METERS,
- GEOFENCE_EXPIRATION_TIME,
- Geofence.GEOFENCE_TRANSITION_ENTER | Geofence.GEOFENCE_TRANSITION_EXIT
- );
-
- // Store these flat versions in SharedPreferences and add them to the geofence list.
- mGeofenceStorage.setGeofence(ANDROID_BUILDING_ID, mAndroidBuildingGeofence);
- mGeofenceStorage.setGeofence(YERBA_BUENA_ID, mYerbaBuenaGeofence);
- mGeofenceList.add(mAndroidBuildingGeofence.toGeofence());
- mGeofenceList.add(mYerbaBuenaGeofence.toGeofence());
- }
-
- /**
- * Start a request for geofence monitoring by calling LocationClient.connect().
- */
- public void addGeofences() {
- // Start a request to add geofences.
- mRequestType = REQUEST_TYPE.ADD;
- // Test for Google Play services after setting the request type.
- if (!isGooglePlayServicesAvailable()) {
- Log.e(TAG, "Unable to add geofences - Google Play services unavailable.");
- return;
- }
- // Create a new location client object. Since this activity class implements
- // ConnectionCallbacks and OnConnectionFailedListener, it can be used as the listener for
- // both parameters.
- mLocationClient = new LocationClient(this, this, this);
- // If a request is not already underway.
- if (!mInProgress) {
- // Indicate that a request is underway.
- mInProgress = true;
- // Request a connection from the client to Location Services.
- mLocationClient.connect();
- // A request is already underway, so disconnect the client and retry the request.
- } else {
- mLocationClient.disconnect();
- mLocationClient.connect();
- }
- }
-
- @Override
- public void onConnectionFailed(ConnectionResult connectionResult) {
- mInProgress = false;
- // If the error has a resolution, start a Google Play services activity to resolve it.
- if (connectionResult.hasResolution()) {
- try {
- connectionResult.startResolutionForResult(this,
- CONNECTION_FAILURE_RESOLUTION_REQUEST);
- } catch (IntentSender.SendIntentException e) {
- Log.e(TAG, "Exception while resolving connection error.", e);
- }
- } else {
- int errorCode = connectionResult.getErrorCode();
- Log.e(TAG, "Connection to Google Play services failed with error code " + errorCode);
- }
- }
-
- /**
- * Called by Location Services if the location client disconnects.
- */
- @Override
- public void onDisconnected() {
- // Turn off the request flag.
- mInProgress = false;
- // Destroy the current location client.
- mLocationClient = null;
- }
-
- /**
- * Once the connection is available, send a request to add the Geofences.
- */
- @Override
- public void onConnected(Bundle connectionHint) {
- // Use mRequestType to determine what action to take. Only ADD is used in this sample.
- if (REQUEST_TYPE.ADD == mRequestType) {
- // Get the PendingIntent for the geofence monitoring request.
- mGeofenceRequestIntent = getGeofenceTransitionPendingIntent();
- // Send a request to add the current geofences.
- mLocationClient.addGeofences(mGeofenceList, mGeofenceRequestIntent, this);
- }
- }
-
- /**
- * Called when request to add geofences is complete, with a result status code.
- */
- @Override
- public void onAddGeofencesResult(int statusCode, String[] geofenceRequestIds) {
- // Log if adding the geofences was successful.
- if (LocationStatusCodes.SUCCESS == statusCode) {
- if (Log.isLoggable(TAG, Log.DEBUG)) {
- Log.d(TAG, "Added geofences successfully.");
- }
- } else {
- Log.e(TAG, "Failed to add geofences. Status code: " + statusCode);
- }
- // Turn off the in progress flag and disconnect the client.
- mInProgress = false;
- mLocationClient.disconnect();
- }
-
- /**
- * Checks if Google Play services is available.
- * @return true if it is.
- */
- private boolean isGooglePlayServicesAvailable() {
- int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
- if (ConnectionResult.SUCCESS == resultCode) {
- if (Log.isLoggable(TAG, Log.DEBUG)) {
- Log.d(TAG, "Google Play services is available.");
- }
- return true;
- } else {
- Log.e(TAG, "Google Play services is unavailable.");
- return false;
- }
- }
-
- /**
- * Create a PendingIntent that triggers GeofenceTransitionIntentService when a geofence
- * transition occurs.
- */
- private PendingIntent getGeofenceTransitionPendingIntent() {
- Intent intent = new Intent(this, GeofenceTransitionsIntentService.class);
- return PendingIntent.getService(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
- }
-
-}
diff --git a/samples/wearable/Geofencing/Application/src/main/res/values/strings.xml b/samples/wearable/Geofencing/Application/src/main/res/values/strings.xml
deleted file mode 100644
index 92ec84899..000000000
--- a/samples/wearable/Geofencing/Application/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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 xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="app_name">Android Wear Geofencing Example Application</string>
- <string name="start_geofence_service">Starting geofence transition service</string>
-</resources>
diff --git a/samples/wearable/Geofencing/Wearable/build.gradle b/samples/wearable/Geofencing/Wearable/build.gradle
deleted file mode 100644
index 0e23b4d56..000000000
--- a/samples/wearable/Geofencing/Wearable/build.gradle
+++ /dev/null
@@ -1,25 +0,0 @@
-apply plugin: 'android'
-
-android {
- compileSdkVersion 20
- buildToolsVersion '20'
-
- defaultConfig {
- minSdkVersion 20
- targetSdkVersion 20
- versionCode 1
- versionName "1.0"
- }
-
- buildTypes {
- release {
- runProguard false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
- }
- }
-}
-
-dependencies {
- compile 'com.google.android.gms:play-services-wearable:+'
- compile "com.google.android.support:wearable:1.0.+"
-} \ No newline at end of file
diff --git a/samples/wearable/Geofencing/Wearable/proguard-rules.txt b/samples/wearable/Geofencing/Wearable/proguard-rules.txt
deleted file mode 100644
index f2fe1559a..000000000
--- a/samples/wearable/Geofencing/Wearable/proguard-rules.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/samples/wearable/Geofencing/Wearable/project.properties b/samples/wearable/Geofencing/Wearable/project.properties
deleted file mode 100644
index 4ab125693..000000000
--- a/samples/wearable/Geofencing/Wearable/project.properties
+++ /dev/null
@@ -1,14 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system edit
-# "ant.properties", and override values to adapt the script to your
-# project structure.
-#
-# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
-#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
-
-# Project target.
-target=android-19
diff --git a/samples/wearable/Geofencing/Wearable/src/main/AndroidManifest.xml b/samples/wearable/Geofencing/Wearable/src/main/AndroidManifest.xml
deleted file mode 100644
index 2446c386c..000000000
--- a/samples/wearable/Geofencing/Wearable/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.wearable.geofencing" >
-
- <uses-feature android:name="android.hardware.type.watch" />
-
- <application
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:allowBackup="true">
-
- <meta-data
- android:name="com.google.android.gms.version"
- android:value="@integer/google_play_services_version" />
-
- <service
- android:name="com.example.android.wearable.geofencing.HomeListenerService" >
- <intent-filter>
- <action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
- </intent-filter>
- </service>
- <service android:name=".CheckInAndDeleteDataItemsService"/>
-
- <activity android:name="android.support.wearable.activity.ConfirmationActivity"/>
- </application>
-</manifest>
diff --git a/samples/wearable/Geofencing/_index.html b/samples/wearable/Geofencing/_index.html
deleted file mode 100644
index 220fc55b3..000000000
--- a/samples/wearable/Geofencing/_index.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<p><b>About:</b> When a user enters the vicinity of the Android building (B44) or the Yerba Buena
-Gardens near the Moscone center in San Francisco, a notification silently appears on his/her
-wearable with an option to check in. This notification automatically disappears when he/she leaves
-the area, and reappears the next time he/she is at one of these locations.</p>
-<p><b>How to run:</b> Install the Application APK on the companion, and the Wearable APK on the
-wearable. Then, start "Android Wear Geofencing Example Application" on the companion. You will
-automatically be notified on the wearable if you enter one of the two specified areas, assuming
-you have your phone on you.</p>
-<p><b>Wearable APIs used:</b> DataApi, WearableListenerService</p>
-<p><b>Other APIs used:</b> Play Services API used for Geofencing (Geofence and LocationClient)</p>
-<p><b>Screenshots:</b>
- <figure>
- <img src="screenshots/android_building_check_in.png" alt="Check in?" width="160"
- height="160">
- <figcaption>Notification that appears when you arrive at the Android building.</figcaption>
- </figure>
-</p>
diff --git a/samples/wearable/Geofencing/build.gradle b/samples/wearable/Geofencing/build.gradle
deleted file mode 100644
index d3c8c5971..000000000
--- a/samples/wearable/Geofencing/build.gradle
+++ /dev/null
@@ -1,14 +0,0 @@
-buildscript {
- repositories {
- mavenCentral()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:0.12.+'
- }
-}
-
-allprojects {
- repositories {
- mavenCentral()
- }
-} \ No newline at end of file
diff --git a/samples/wearable/Geofencing/gradle/wrapper/gradle-wrapper.jar b/samples/wearable/Geofencing/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index 8c0fb64a8..000000000
--- a/samples/wearable/Geofencing/gradle/wrapper/gradle-wrapper.jar
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/Geofencing/gradle/wrapper/gradle-wrapper.properties b/samples/wearable/Geofencing/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index 1e61d1fd3..000000000
--- a/samples/wearable/Geofencing/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-#Wed Apr 10 15:27:10 PDT 2013
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip
diff --git a/samples/wearable/Geofencing/gradlew b/samples/wearable/Geofencing/gradlew
deleted file mode 100755
index 91a7e269e..000000000
--- a/samples/wearable/Geofencing/gradlew
+++ /dev/null
@@ -1,164 +0,0 @@
-#!/usr/bin/env bash
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn ( ) {
- echo "$*"
-}
-
-die ( ) {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
-esac
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched.
-if $cygwin ; then
- [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-fi
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >&-
-APP_HOME="`pwd -P`"
-cd "$SAVED" >&-
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
-}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
-
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/samples/wearable/Geofencing/gradlew.bat b/samples/wearable/Geofencing/gradlew.bat
deleted file mode 100755
index aec99730b..000000000
--- a/samples/wearable/Geofencing/gradlew.bat
+++ /dev/null
@@ -1,90 +0,0 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/samples/wearable/Geofencing/screenshots/android_building_check_in.png b/samples/wearable/Geofencing/screenshots/android_building_check_in.png
deleted file mode 100644
index 5101e772c..000000000
--- a/samples/wearable/Geofencing/screenshots/android_building_check_in.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/Geofencing/settings.gradle b/samples/wearable/Geofencing/settings.gradle
deleted file mode 100644
index f3f25a547..000000000
--- a/samples/wearable/Geofencing/settings.gradle
+++ /dev/null
@@ -1 +0,0 @@
-include 'Wearable', 'Application'
diff --git a/samples/wearable/GridViewPager/Wearable/build.gradle b/samples/wearable/GridViewPager/Wearable/build.gradle
deleted file mode 100644
index b9450ca9a..000000000
--- a/samples/wearable/GridViewPager/Wearable/build.gradle
+++ /dev/null
@@ -1,24 +0,0 @@
-apply plugin: 'android'
-
-android {
- compileSdkVersion 20
- buildToolsVersion '20'
-
- defaultConfig {
- minSdkVersion 20
- targetSdkVersion 20
- versionCode 1
- versionName "1.0"
- }
-
- buildTypes {
- release {
- runProguard false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
- }
- }
-}
-
-dependencies {
- compile "com.google.android.support:wearable:1.0.+"
-}
diff --git a/samples/wearable/GridViewPager/Wearable/proguard-rules.txt b/samples/wearable/GridViewPager/Wearable/proguard-rules.txt
deleted file mode 100644
index 08e5bdc8d..000000000
--- a/samples/wearable/GridViewPager/Wearable/proguard-rules.txt
+++ /dev/null
@@ -1,22 +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 *;
-#}
--dontwarn android.support.wearable.view.DelayedConfirmationView
--dontwarn android.support.wearable.view.CircledImageView
diff --git a/samples/wearable/GridViewPager/Wearable/src/main/AndroidManifest.xml b/samples/wearable/GridViewPager/Wearable/src/main/AndroidManifest.xml
deleted file mode 100644
index 12b8f3ba2..000000000
--- a/samples/wearable/GridViewPager/Wearable/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.wearable.gridviewpager" >
-
- <uses-feature android:name="android.hardware.type.watch" />
-
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@android:style/Theme.DeviceDefault.Light" >
- <activity
- android:name="com.example.android.wearable.gridviewpager.MainActivity"
- android:label="@string/app_name" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
-
-</manifest>
diff --git a/samples/wearable/GridViewPager/Wearable/src/main/java/com/example/android/wearable/gridviewpager/MainActivity.java b/samples/wearable/GridViewPager/Wearable/src/main/java/com/example/android/wearable/gridviewpager/MainActivity.java
deleted file mode 100644
index 20751a309..000000000
--- a/samples/wearable/GridViewPager/Wearable/src/main/java/com/example/android/wearable/gridviewpager/MainActivity.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2014 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.wearable.gridviewpager;
-
-import android.app.Activity;
-import android.content.res.Resources;
-import android.os.Bundle;
-import android.support.wearable.view.GridViewPager;
-import android.view.View;
-import android.view.View.OnApplyWindowInsetsListener;
-import android.view.WindowInsets;
-
-public class MainActivity extends Activity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- final Resources res = getResources();
- final GridViewPager pager = (GridViewPager) findViewById(R.id.pager);
- pager.setOnApplyWindowInsetsListener(new OnApplyWindowInsetsListener() {
- @Override
- public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
- // Adjust page margins:
- // A little extra horizontal spacing between pages looks a bit
- // less crowded on a round display.
- final boolean round = insets.isRound();
- int rowMargin = res.getDimensionPixelOffset(R.dimen.page_row_margin);
- int colMargin = res.getDimensionPixelOffset(round ?
- R.dimen.page_column_margin_round : R.dimen.page_column_margin);
- pager.setPageMargins(rowMargin, colMargin);
-
- // GridViewPager relies on insets to properly handle
- // layout for round displays. They must be explicitly
- // applied since this listener has taken them over.
- pager.onApplyWindowInsets(insets);
- return insets;
- }
- });
- pager.setAdapter(new SampleGridPagerAdapter(this, getFragmentManager()));
- }
-}
diff --git a/samples/wearable/GridViewPager/Wearable/src/main/java/com/example/android/wearable/gridviewpager/SampleGridPagerAdapter.java b/samples/wearable/GridViewPager/Wearable/src/main/java/com/example/android/wearable/gridviewpager/SampleGridPagerAdapter.java
deleted file mode 100644
index 8f9bcf961..000000000
--- a/samples/wearable/GridViewPager/Wearable/src/main/java/com/example/android/wearable/gridviewpager/SampleGridPagerAdapter.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright (C) 2014 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.wearable.gridviewpager;
-
-import android.app.Fragment;
-import android.app.FragmentManager;
-import android.content.Context;
-import android.support.wearable.view.CardFragment;
-import android.support.wearable.view.FragmentGridPagerAdapter;
-import android.support.wearable.view.ImageReference;
-import android.view.Gravity;
-
-/**
- * Constructs fragments as requested by the GridViewPager. For each row a
- * different background is provided.
- */
-public class SampleGridPagerAdapter extends FragmentGridPagerAdapter {
-
- private final Context mContext;
-
- public SampleGridPagerAdapter(Context ctx, FragmentManager fm) {
- super(fm);
- mContext = ctx;
- }
-
- static final int[] BG_IMAGES = new int[] {
- R.drawable.debug_background_1,
- R.drawable.debug_background_2,
- R.drawable.debug_background_3,
- R.drawable.debug_background_4,
- R.drawable.debug_background_5
- };
-
- /** A simple container for static data in each page */
- private static class Page {
- int titleRes;
- int textRes;
- int iconRes;
- int cardGravity = Gravity.BOTTOM;
- boolean expansionEnabled = true;
- float expansionFactor = 1.0f;
- int expansionDirection = CardFragment.EXPAND_DOWN;
-
- public Page(int titleRes, int textRes, boolean expansion) {
- this(titleRes, textRes, 0);
- this.expansionEnabled = expansion;
- }
-
- public Page(int titleRes, int textRes, boolean expansion, float expansionFactor) {
- this(titleRes, textRes, 0);
- this.expansionEnabled = expansion;
- this.expansionFactor = expansionFactor;
- }
-
- public Page(int titleRes, int textRes, int iconRes) {
- this.titleRes = titleRes;
- this.textRes = textRes;
- this.iconRes = iconRes;
- }
-
- public Page(int titleRes, int textRes, int iconRes, int gravity) {
- this.titleRes = titleRes;
- this.textRes = textRes;
- this.iconRes = iconRes;
- this.cardGravity = gravity;
- }
- }
-
- private final Page[][] PAGES = {
- {
- new Page(R.string.welcome_title, R.string.welcome_text, R.drawable.bugdroid,
- Gravity.CENTER_VERTICAL),
- },
- {
- new Page(R.string.about_title, R.string.about_text, false),
- },
- {
- new Page(R.string.cards_title, R.string.cards_text, true, 2),
- new Page(R.string.expansion_title, R.string.expansion_text, true, 10),
- },
- {
- new Page(R.string.backgrounds_title, R.string.backgrounds_text, true, 2),
- new Page(R.string.columns_title, R.string.columns_text, true, 2)
- },
- {
- new Page(R.string.dismiss_title, R.string.dismiss_text, R.drawable.bugdroid,
- Gravity.CENTER_VERTICAL),
- },
-
- };
-
- @Override
- public Fragment getFragment(int row, int col) {
- Page page = PAGES[row][col];
- String title = page.titleRes != 0 ? mContext.getString(page.titleRes) : null;
- String text = page.textRes != 0 ? mContext.getString(page.textRes) : null;
- CardFragment fragment = CardFragment.create(title, text, page.iconRes);
- // Advanced settings
- fragment.setCardGravity(page.cardGravity);
- fragment.setExpansionEnabled(page.expansionEnabled);
- fragment.setExpansionDirection(page.expansionDirection);
- fragment.setExpansionFactor(page.expansionFactor);
- return fragment;
- }
-
- @Override
- public ImageReference getBackground(int row, int column) {
- return ImageReference.forDrawable(BG_IMAGES[row % BG_IMAGES.length]);
- }
-
- @Override
- public int getRowCount() {
- return PAGES.length;
- }
-
- @Override
- public int getColumnCount(int rowNum) {
- return PAGES[rowNum].length;
- }
-}
diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/layout/activity_main.xml b/samples/wearable/GridViewPager/Wearable/src/main/res/layout/activity_main.xml
deleted file mode 100644
index abc3b30e1..000000000
--- a/samples/wearable/GridViewPager/Wearable/src/main/res/layout/activity_main.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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.
--->
-
-<android.support.wearable.view.GridViewPager
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/pager"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:keepScreenOn="true" />
diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/values/dimens.xml b/samples/wearable/GridViewPager/Wearable/src/main/res/values/dimens.xml
deleted file mode 100644
index 47ab217e1..000000000
--- a/samples/wearable/GridViewPager/Wearable/src/main/res/values/dimens.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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>
- <dimen name="page_row_margin">100dp</dimen>
- <dimen name="page_column_margin">10dp</dimen>
- <dimen name="page_column_margin_round">50dp</dimen>
-</resources>
diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/values/strings.xml b/samples/wearable/GridViewPager/Wearable/src/main/res/values/strings.xml
deleted file mode 100644
index 404119bc3..000000000
--- a/samples/wearable/GridViewPager/Wearable/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<resources>
-
- <string name="app_name">GridViewPager Sample</string>
- <string name="welcome_title">GridViewPager</string>
- <string name="welcome_text">Welcome!</string>
-
- <string name="about_title">About</string>
- <string name="about_text">Content is organized into multiple pages. Swipe
- between cards to view other content.</string>
-
- <string name="cards_title">Cards</string>
- <string name="cards_text">Each page is created using a CardFragment. A
- layout is placed inside the card and the rest is handled
- automatically.</string>
-
- <string name="expansion_title">Expansion</string>
- <string name="expansion_text">By default, each card will grow taller to
- accommodate extra content. Tall cards can be scrolled through
- like any scrollable view. The maximum height is controlled by
- setExpansionFactor() with a default of 10 pages. After that
- you\'ll notice a faded edge to indicate there is more. Expansion
- can be disabled completely using setExpansionEnabled(false).
- With this, the content will be clipped if it\'s taller than one
- page.</string>
-
- <string name="backgrounds_title">Backgrounds</string>
- <string name="backgrounds_text">Backgrounds are supplied by the adapter\'s
- getBackground method. Parallax and crossfade effects are applied
- automatically.</string>
-
- <string name="columns_title">Columns</string>
- <string name="columns_text">When moving between rows, the pager always
- returns to column 0. This is adjustable in the adapter. See
- method getCurrentColumnForRow().</string>
-
- <string name="dismiss_title">Dismiss</string>
- <string name="dismiss_text">To exit the application, swipe from left to
- right.</string>
-
-</resources>
diff --git a/samples/wearable/GridViewPager/_index.html b/samples/wearable/GridViewPager/_index.html
deleted file mode 100644
index 5f7aa63de..000000000
--- a/samples/wearable/GridViewPager/_index.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<p><b>About:</b> Demonstrates how to implement a GridViewPager in your wearable app.</p>
-<p><b>How to run:</b> Install the Wearable APK on the wearable, go to the voice menu (either by
-saying "OK Google" or tapping the home screen) and select the "Start..." option. Then, select
-"GridViewPager Sample" from the submenu.</p>
-<p><b>Wearable APIs used:</b> GridViewPager, CardFragment, FragmentGridPagerAdapter,
-ImageReference</p>
-<p><b>Screenshots:</b>
- <figure>
- <img src="screenshots/grid_view_pager.gif" alt="GridViewPager" width="140" height="140">
- <figcaption>Part of the sample in action.</figcaption>
- </figure>
-</p>
diff --git a/samples/wearable/GridViewPager/build.gradle b/samples/wearable/GridViewPager/build.gradle
deleted file mode 100644
index 8bd4ffc49..000000000
--- a/samples/wearable/GridViewPager/build.gradle
+++ /dev/null
@@ -1,14 +0,0 @@
-buildscript {
- repositories {
- mavenCentral()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:0.12.+'
- }
-}
-
-allprojects {
- repositories {
- mavenCentral()
- }
-}
diff --git a/samples/wearable/GridViewPager/gradle.properties b/samples/wearable/GridViewPager/gradle.properties
deleted file mode 100644
index 5d08ba75b..000000000
--- a/samples/wearable/GridViewPager/gradle.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-# Project-wide Gradle settings.
-
-# IDE (e.g. Android Studio) users:
-# Settings specified in this file will override any Gradle settings
-# configured through the IDE.
-
-# For more details on how to configure your build environment visit
-# http://www.gradle.org/docs/current/userguide/build_environment.html
-
-# Specifies the JVM arguments used for the daemon process.
-# The setting is particularly useful for tweaking memory settings.
-# Default value: -Xmx10248m -XX:MaxPermSize=256m
-# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
-
-# When configured, Gradle will run in incubating parallel mode.
-# This option should only be used with decoupled projects. More details, visit
-# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
-# org.gradle.parallel=true \ No newline at end of file
diff --git a/samples/wearable/GridViewPager/gradle/wrapper/gradle-wrapper.jar b/samples/wearable/GridViewPager/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index 8c0fb64a8..000000000
--- a/samples/wearable/GridViewPager/gradle/wrapper/gradle-wrapper.jar
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/GridViewPager/gradle/wrapper/gradle-wrapper.properties b/samples/wearable/GridViewPager/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index 1e61d1fd3..000000000
--- a/samples/wearable/GridViewPager/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-#Wed Apr 10 15:27:10 PDT 2013
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip
diff --git a/samples/wearable/GridViewPager/gradlew b/samples/wearable/GridViewPager/gradlew
deleted file mode 100755
index 91a7e269e..000000000
--- a/samples/wearable/GridViewPager/gradlew
+++ /dev/null
@@ -1,164 +0,0 @@
-#!/usr/bin/env bash
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn ( ) {
- echo "$*"
-}
-
-die ( ) {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
-esac
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched.
-if $cygwin ; then
- [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-fi
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >&-
-APP_HOME="`pwd -P`"
-cd "$SAVED" >&-
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
-}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
-
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/samples/wearable/GridViewPager/gradlew.bat b/samples/wearable/GridViewPager/gradlew.bat
deleted file mode 100755
index aec99730b..000000000
--- a/samples/wearable/GridViewPager/gradlew.bat
+++ /dev/null
@@ -1,90 +0,0 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/samples/wearable/GridViewPager/screenshots/grid_view_pager.gif b/samples/wearable/GridViewPager/screenshots/grid_view_pager.gif
deleted file mode 100644
index f70dafcec..000000000
--- a/samples/wearable/GridViewPager/screenshots/grid_view_pager.gif
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/GridViewPager/settings.gradle b/samples/wearable/GridViewPager/settings.gradle
deleted file mode 100644
index d804d8be7..000000000
--- a/samples/wearable/GridViewPager/settings.gradle
+++ /dev/null
@@ -1 +0,0 @@
-include 'Wearable'
diff --git a/samples/wearable/JumpingJack/Wearable/build.gradle b/samples/wearable/JumpingJack/Wearable/build.gradle
deleted file mode 100644
index 531f41a01..000000000
--- a/samples/wearable/JumpingJack/Wearable/build.gradle
+++ /dev/null
@@ -1,33 +0,0 @@
-apply plugin: 'android'
-
-repositories {
- mavenCentral()
-}
-
-android {
- compileSdkVersion 20
- buildToolsVersion '20'
-
- defaultConfig {
- minSdkVersion 20
- targetSdkVersion 20
- versionCode 1
- versionName "1.0"
- }
-
- buildTypes {
- release {
- runProguard false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
- }
- }
-
- lintOptions {
- abortOnError false
- }
-}
-
-dependencies {
- compile 'com.google.android.gms:play-services-wearable:+'
- compile "com.google.android.support:wearable:1.0.+"
-}
diff --git a/samples/wearable/JumpingJack/Wearable/proguard-rules.txt b/samples/wearable/JumpingJack/Wearable/proguard-rules.txt
deleted file mode 100644
index 0cc65eeb3..000000000
--- a/samples/wearable/JumpingJack/Wearable/proguard-rules.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-# 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 *;
-#} \ No newline at end of file
diff --git a/samples/wearable/JumpingJack/Wearable/src/main/AndroidManifest.xml b/samples/wearable/JumpingJack/Wearable/src/main/AndroidManifest.xml
deleted file mode 100644
index cf3ee0687..000000000
--- a/samples/wearable/JumpingJack/Wearable/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.wearable.jumpingjack">
-
- <uses-feature android:name="android.hardware.type.watch" />
-
- <uses-permission android:name="android.permission.VIBRATE"/>
-
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@android:style/Theme.DeviceDefault.Light">
- <activity
- android:name=".MainActivity"
- android:label="@string/app_name">
- <intent-filter>
- <action android:name="android.intent.action.MAIN"/>
- <category android:name="android.intent.category.LAUNCHER"/>
- </intent-filter>
- </activity>
- </application>
-
-</manifest>
diff --git a/samples/wearable/JumpingJack/Wearable/src/main/java/com/example/android/wearable/jumpingjack/MainActivity.java b/samples/wearable/JumpingJack/Wearable/src/main/java/com/example/android/wearable/jumpingjack/MainActivity.java
deleted file mode 100644
index cdaaf6ec7..000000000
--- a/samples/wearable/JumpingJack/Wearable/src/main/java/com/example/android/wearable/jumpingjack/MainActivity.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * Copyright (C) 2014 Google Inc. All Rights Reserved.
- *
- * 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.wearable.jumpingjack;
-
-import com.example.android.wearable.jumpingjack.fragments.CounterFragment;
-import com.example.android.wearable.jumpingjack.fragments.SettingsFragment;
-
-import android.app.Activity;
-import android.content.Context;
-import android.hardware.Sensor;
-import android.hardware.SensorEvent;
-import android.hardware.SensorEventListener;
-import android.hardware.SensorManager;
-import android.os.Bundle;
-import android.os.Handler;
-import android.support.v4.view.ViewPager;
-import android.util.Log;
-import android.view.WindowManager;
-import android.widget.ImageView;
-
-import java.util.Timer;
-import java.util.TimerTask;
-
-/**
- * The main activity for the Jumping Jack application. This activity registers itself to receive
- * sensor values. Since on wearable devices a full screen activity is very short-lived, we set the
- * FLAG_KEEP_SCREEN_ON to give user adequate time for taking actions but since we don't want to
- * keep screen on for an extended period of time, there is a SCREEN_ON_TIMEOUT_MS that is enforced
- * if no interaction is discovered.
- *
- * This activity includes a {@link android.support.v4.view.ViewPager} with two pages, one that
- * shows the current count and one that allows user to reset the counter. the current value of the
- * counter is persisted so that upon re-launch, the counter picks up from the last value. At any
- * stage, user can set this counter to 0.
- */
-public class MainActivity extends Activity
- implements SensorEventListener {
-
- private static final String TAG = "JJMainActivity";
-
- /** How long to keep the screen on when no activity is happening **/
- private static final long SCREEN_ON_TIMEOUT_MS = 20000; // in milliseconds
-
- /** an up-down movement that takes more than this will not be registered as such **/
- private static final long TIME_THRESHOLD_NS = 2000000000; // in nanoseconds (= 2sec)
-
- /**
- * Earth gravity is around 9.8 m/s^2 but user may not completely direct his/her hand vertical
- * during the exercise so we leave some room. Basically if the x-component of gravity, as
- * measured by the Gravity sensor, changes with a variation (delta) > GRAVITY_THRESHOLD,
- * we consider that a successful count.
- */
- private static final float GRAVITY_THRESHOLD = 7.0f;
-
- private SensorManager mSensorManager;
- private Sensor mSensor;
- private long mLastTime = 0;
- private boolean mUp = false;
- private int mJumpCounter = 0;
- private ViewPager mPager;
- private CounterFragment mCounterPage;
- private SettingsFragment mSettingPage;
- private ImageView mSecondIndicator;
- private ImageView mFirstIndicator;
- private Timer mTimer;
- private TimerTask mTimerTask;
- private Handler mHandler;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.jj_layout);
- setupViews();
- mHandler = new Handler();
- mJumpCounter = Utils.getCounterFromPreference(this);
- getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
- renewTimer();
- mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
- mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_GRAVITY);
- }
-
- private void setupViews() {
- mPager = (ViewPager) findViewById(R.id.pager);
- mFirstIndicator = (ImageView) findViewById(R.id.indicator_0);
- mSecondIndicator = (ImageView) findViewById(R.id.indicator_1);
- final PagerAdapter adapter = new PagerAdapter(getFragmentManager());
- mCounterPage = new CounterFragment();
- mSettingPage = new SettingsFragment(this);
- adapter.addFragment(mCounterPage);
- adapter.addFragment(mSettingPage);
- setIndicator(0);
- mPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
- @Override
- public void onPageScrolled(int i, float v, int i2) {
- }
-
- @Override
- public void onPageSelected(int i) {
- setIndicator(i);
- renewTimer();
- }
-
- @Override
- public void onPageScrollStateChanged(int i) {
- }
- });
-
- mPager.setAdapter(adapter);
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- if (mSensorManager.registerListener(this, mSensor,
- SensorManager.SENSOR_DELAY_NORMAL)) {
- if (Log.isLoggable(TAG, Log.DEBUG)) {
- Log.d(TAG, "Successfully registered for the sensor updates");
- }
- }
- }
-
- @Override
- protected void onPause() {
- super.onPause();
- mSensorManager.unregisterListener(this);
- if (Log.isLoggable(TAG, Log.DEBUG)) {
- Log.d(TAG, "Unregistered for sensor events");
- }
- }
-
- @Override
- public void onSensorChanged(SensorEvent event) {
- detectJump(event.values[0], event.timestamp);
- }
-
- @Override
- public void onAccuracyChanged(Sensor sensor, int accuracy) {
- }
-
- /**
- * A simple algorithm to detect a successful up-down movement of hand(s). The algorithm is
- * based on the assumption that when a person is wearing the watch, the x-component of gravity
- * as measured by the Gravity Sensor is +9.8 when the hand is downward and -9.8 when the hand
- * is upward (signs are reversed if the watch is worn on the right hand). Since the upward or
- * downward may not be completely accurate, we leave some room and instead of 9.8, we use
- * GRAVITY_THRESHOLD. We also consider the up <-> down movement successful if it takes less than
- * TIME_THRESHOLD_NS.
- */
- private void detectJump(float xValue, long timestamp) {
- if ((Math.abs(xValue) > GRAVITY_THRESHOLD)) {
- if(timestamp - mLastTime < TIME_THRESHOLD_NS && mUp != (xValue > 0)) {
- onJumpDetected(!mUp);
- }
- mUp = xValue > 0;
- mLastTime = timestamp;
- }
- }
-
- /**
- * Called on detection of a successful down -> up or up -> down movement of hand.
- */
- private void onJumpDetected(boolean up) {
- // we only count a pair of up and down as one successful movement
- if (up) {
- return;
- }
- mJumpCounter++;
- setCounter(mJumpCounter);
- renewTimer();
- }
-
- /**
- * Updates the counter on UI, saves it to preferences and vibrates the watch when counter
- * reaches a multiple of 10.
- */
- private void setCounter(int i) {
- mCounterPage.setCounter(i);
- Utils.saveCounterToPreference(this, i);
- if (i > 0 && i % 10 == 0) {
- Utils.vibrate(this, 0);
- }
- }
-
- public void resetCounter() {
- setCounter(0);
- renewTimer();
- }
-
- /**
- * Starts a timer to clear the flag FLAG_KEEP_SCREEN_ON.
- */
- private void renewTimer() {
- if (null != mTimer) {
- mTimer.cancel();
- }
- mTimerTask = new TimerTask() {
- @Override
- public void run() {
- if (Log.isLoggable(TAG, Log.DEBUG)) {
- Log.d(TAG,
- "Removing the FLAG_KEEP_SCREEN_ON flag to allow going to background");
- }
- resetFlag();
- }
- };
- mTimer = new Timer();
- mTimer.schedule(mTimerTask, SCREEN_ON_TIMEOUT_MS);
- }
-
- /**
- * Resets the FLAG_KEEP_SCREEN_ON flag so activity can go into background.
- */
- private void resetFlag() {
- mHandler.post(new Runnable() {
- @Override
- public void run() {
- if (Log.isLoggable(TAG, Log.DEBUG)) {
- Log.d(TAG, "Resetting FLAG_KEEP_SCREEN_ON flag to allow going to background");
- }
- getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
- finish();
- }
- });
- }
-
- /**
- * Sets the page indicator for the ViewPager.
- */
- private void setIndicator(int i) {
- switch (i) {
- case 0:
- mFirstIndicator.setImageResource(R.drawable.full_10);
- mSecondIndicator.setImageResource(R.drawable.empty_10);
- break;
- case 1:
- mFirstIndicator.setImageResource(R.drawable.empty_10);
- mSecondIndicator.setImageResource(R.drawable.full_10);
- break;
- }
- }
-
-
-}
diff --git a/samples/wearable/JumpingJack/Wearable/src/main/java/com/example/android/wearable/jumpingjack/fragments/SettingsFragment.java b/samples/wearable/JumpingJack/Wearable/src/main/java/com/example/android/wearable/jumpingjack/fragments/SettingsFragment.java
deleted file mode 100644
index fffe8fb71..000000000
--- a/samples/wearable/JumpingJack/Wearable/src/main/java/com/example/android/wearable/jumpingjack/fragments/SettingsFragment.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2014 Google Inc. All Rights Reserved.
- *
- * 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.wearable.jumpingjack.fragments;
-
-import com.example.android.wearable.jumpingjack.MainActivity;
-import com.example.android.wearable.jumpingjack.R;
-
-import android.app.Fragment;
-import android.os.Bundle;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.Button;
-
-/**
- * A simple fragment that shows a button to reset the counter
- */
-public class SettingsFragment extends Fragment {
-
- private Button mButton;
- private MainActivity mMainActivity;
-
- public SettingsFragment(MainActivity mainActivity) {
- mMainActivity = mainActivity;
- }
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- View view = inflater.inflate(R.layout.setting_layout, container, false);
- mButton = (Button) view.findViewById(R.id.btn);
- mButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- mMainActivity.resetCounter();
- }
- });
- return view;
- }
-
-}
diff --git a/samples/wearable/JumpingJack/_index.html b/samples/wearable/JumpingJack/_index.html
deleted file mode 100644
index 3f4c26a4e..000000000
--- a/samples/wearable/JumpingJack/_index.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<p><b>About:</b> Uses the Gravity sensor to count how many jumping jacks you've performed.</p>
-<p><b>How to run:</b> Install the Wearable APK on the wearable, go to the voice menu (either by
-saying "OK Google" or tapping the home screen) and select the "Start..." option. Then, select
- "Jumping Jack" from the submenu.</p>
-<p><b>Screenshots:</b>
- <figure>
- <img src="screenshots/jumping_jack.gif" alt="JumpingJack" width="140" height="140">
- <figcaption>JumpingJack has a simple interface.</figcaption>
- </figure>
-</p>
diff --git a/samples/wearable/JumpingJack/build.gradle b/samples/wearable/JumpingJack/build.gradle
deleted file mode 100644
index 43dbcd071..000000000
--- a/samples/wearable/JumpingJack/build.gradle
+++ /dev/null
@@ -1,15 +0,0 @@
-buildscript {
- repositories {
- mavenCentral()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:0.12.+'
- }
-}
-
-allprojects {
- repositories {
- mavenCentral()
- }
-}
-
diff --git a/samples/wearable/JumpingJack/gradle.properties b/samples/wearable/JumpingJack/gradle.properties
deleted file mode 100644
index 5d08ba75b..000000000
--- a/samples/wearable/JumpingJack/gradle.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-# Project-wide Gradle settings.
-
-# IDE (e.g. Android Studio) users:
-# Settings specified in this file will override any Gradle settings
-# configured through the IDE.
-
-# For more details on how to configure your build environment visit
-# http://www.gradle.org/docs/current/userguide/build_environment.html
-
-# Specifies the JVM arguments used for the daemon process.
-# The setting is particularly useful for tweaking memory settings.
-# Default value: -Xmx10248m -XX:MaxPermSize=256m
-# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
-
-# When configured, Gradle will run in incubating parallel mode.
-# This option should only be used with decoupled projects. More details, visit
-# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
-# org.gradle.parallel=true \ No newline at end of file
diff --git a/samples/wearable/JumpingJack/gradle/wrapper/gradle-wrapper.jar b/samples/wearable/JumpingJack/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index 8c0fb64a8..000000000
--- a/samples/wearable/JumpingJack/gradle/wrapper/gradle-wrapper.jar
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/JumpingJack/gradle/wrapper/gradle-wrapper.properties b/samples/wearable/JumpingJack/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index 1e61d1fd3..000000000
--- a/samples/wearable/JumpingJack/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-#Wed Apr 10 15:27:10 PDT 2013
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip
diff --git a/samples/wearable/JumpingJack/gradlew b/samples/wearable/JumpingJack/gradlew
deleted file mode 100755
index 91a7e269e..000000000
--- a/samples/wearable/JumpingJack/gradlew
+++ /dev/null
@@ -1,164 +0,0 @@
-#!/usr/bin/env bash
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn ( ) {
- echo "$*"
-}
-
-die ( ) {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
-esac
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched.
-if $cygwin ; then
- [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-fi
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >&-
-APP_HOME="`pwd -P`"
-cd "$SAVED" >&-
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
-}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
-
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/samples/wearable/JumpingJack/gradlew.bat b/samples/wearable/JumpingJack/gradlew.bat
deleted file mode 100755
index aec99730b..000000000
--- a/samples/wearable/JumpingJack/gradlew.bat
+++ /dev/null
@@ -1,90 +0,0 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/samples/wearable/JumpingJack/license.txt b/samples/wearable/JumpingJack/license.txt
deleted file mode 100644
index 1555b526f..000000000
--- a/samples/wearable/JumpingJack/license.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-The Jumping Jack icons used in this app have been created by Jasper Reyes
-(http://thenounproject.com/term/jumping-jack/26440/) and Co-Effect Creative
-(http://thenounproject.com/term/exercise/15085/) from The Noun Project and are used under the
-Creative Commons (CC By 3.0) license
-
diff --git a/samples/wearable/JumpingJack/proguard-rules.txt b/samples/wearable/JumpingJack/proguard-rules.txt
deleted file mode 100644
index 0cc65eeb3..000000000
--- a/samples/wearable/JumpingJack/proguard-rules.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-# 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 *;
-#} \ No newline at end of file
diff --git a/samples/wearable/JumpingJack/screenshots/jumping_jack.gif b/samples/wearable/JumpingJack/screenshots/jumping_jack.gif
deleted file mode 100644
index 86c4faa71..000000000
--- a/samples/wearable/JumpingJack/screenshots/jumping_jack.gif
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/JumpingJack/settings.gradle b/samples/wearable/JumpingJack/settings.gradle
deleted file mode 100644
index 1d97d30e1..000000000
--- a/samples/wearable/JumpingJack/settings.gradle
+++ /dev/null
@@ -1 +0,0 @@
-include ':Wearable'
diff --git a/samples/wearable/Notifications/Application/build.gradle b/samples/wearable/Notifications/Application/build.gradle
deleted file mode 100644
index b705deabc..000000000
--- a/samples/wearable/Notifications/Application/build.gradle
+++ /dev/null
@@ -1,25 +0,0 @@
-apply plugin: 'android'
-
-android {
- compileSdkVersion 18
- buildToolsVersion '20'
-
- defaultConfig {
- minSdkVersion 18
- targetSdkVersion 19
- versionCode 1
- versionName "1.0"
- }
-
- buildTypes {
- release {
- runProguard false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
- }
- }
-}
-
-dependencies {
- compile "com.android.support:support-v4:20.0.+"
- wearApp project(':Wearable')
-}
diff --git a/samples/wearable/Notifications/Application/proguard-rules.txt b/samples/wearable/Notifications/Application/proguard-rules.txt
deleted file mode 100644
index 08e5bdc8d..000000000
--- a/samples/wearable/Notifications/Application/proguard-rules.txt
+++ /dev/null
@@ -1,22 +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 *;
-#}
--dontwarn android.support.wearable.view.DelayedConfirmationView
--dontwarn android.support.wearable.view.CircledImageView
diff --git a/samples/wearable/Notifications/Application/src/main/AndroidManifest.xml b/samples/wearable/Notifications/Application/src/main/AndroidManifest.xml
deleted file mode 100644
index ecf00362b..000000000
--- a/samples/wearable/Notifications/Application/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.support.wearable.notifications" >
-
- <application
- android:allowBackup="true"
- android:icon="@mipmap/ic_launcher"
- android:label="@string/app_name"
- android:theme="@style/AppTheme" >
-
- <activity
- android:name=".MainActivity"
- android:label="@string/app_name"
- android:windowSoftInputMode="stateHidden" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
-
- <receiver android:name=".NotificationIntentReceiver"
- android:exported="false">
- <intent-filter>
- <action android:name="com.example.android.support.wearable.notifications.ACTION_EXAMPLE" />
- <action android:name="com.example.android.support.wearable.notifications.ACTION_ENABLE_MESSAGES" />
- <action android:name="com.example.android.support.wearable.notifications.ACTION_DISABLE_MESSAGES" />
- </intent-filter>
- </receiver>
-
- </application>
-
-</manifest>
diff --git a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/MainActivity.java b/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/MainActivity.java
deleted file mode 100644
index 8543c7736..000000000
--- a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/MainActivity.java
+++ /dev/null
@@ -1,352 +0,0 @@
-/*
- * Copyright (C) 2014 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.support.wearable.notifications;
-
-import android.app.Activity;
-import android.app.Notification;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.support.v4.app.NotificationManagerCompat;
-import android.text.Editable;
-import android.text.TextWatcher;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.AdapterView;
-import android.widget.ArrayAdapter;
-import android.widget.CheckBox;
-import android.widget.CompoundButton;
-import android.widget.EditText;
-import android.widget.Spinner;
-import android.widget.TextView;
-
-import java.util.Arrays;
-
-/**
- * Main activity which posts a notification when resumed, and allows customization
- * of that notification via controls.
- */
-public class MainActivity extends Activity implements Handler.Callback {
- private static final int MSG_POST_NOTIFICATIONS = 0;
- private static final long POST_NOTIFICATIONS_DELAY_MS = 200;
-
- private Handler mHandler;
- private Spinner mPresetSpinner;
- private EditText mTitleEditText;
- private EditText mTextEditText;
- private TextWatcher mTextChangedListener;
- private Spinner mPrioritySpinner;
- private Spinner mActionsSpinner;
- private CheckBox mIncludeLargeIconCheckbox;
- private CheckBox mLocalOnlyCheckbox;
- private CheckBox mIncludeContentIntentCheckbox;
- private CheckBox mVibrateCheckbox;
- private BackgroundPickers mBackgroundPickers;
- private int postedNotificationCount = 0;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- mHandler = new Handler(this);
- mTextChangedListener = new UpdateNotificationsOnTextChangeListener();
-
- initPresetSpinner();
- initTitleEditText();
- initTextEditText();
- initPrioritySpinner();
- initActionsSpinner();
- initIncludeLargeIconCheckbox();
- initLocalOnlyCheckbox();
- initIncludeContentIntentCheckbox();
- initVibrateCheckbox();
- initBackgroundPickers();
-
- NotificationPreset preset = NotificationPresets.PRESETS[
- mPresetSpinner.getSelectedItemPosition()];
- updateTextEditors(preset);
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- updateNotifications(false /* cancelExisting */);
- }
-
- private void initPresetSpinner() {
- mPresetSpinner = (Spinner) findViewById(R.id.preset_spinner);
- mPresetSpinner.setAdapter(new NamedPresetSpinnerArrayAdapter(this,
- NotificationPresets.PRESETS));
- mPresetSpinner.post(new Runnable() {
- @Override
- public void run() {
- mPresetSpinner.setOnItemSelectedListener(new PresetSpinnerListener());
- }
- });
- }
-
- private void initTitleEditText() {
- mTitleEditText = (EditText) findViewById(R.id.title_editor);
- }
-
- private void initTextEditText() {
- mTextEditText = (EditText) findViewById(R.id.text_editor);
- }
-
- private void initPrioritySpinner() {
- mPrioritySpinner = (Spinner) findViewById(R.id.priority_spinner);
- mPrioritySpinner.setAdapter(new NamedPresetSpinnerArrayAdapter(this,
- PriorityPresets.PRESETS));
- mPrioritySpinner.setSelection(Arrays.asList(PriorityPresets.PRESETS)
- .indexOf(PriorityPresets.DEFAULT));
- mPrioritySpinner.post(new Runnable() {
- @Override
- public void run() {
- mPrioritySpinner.setOnItemSelectedListener(
- new UpdateNotificationsOnItemSelectedListener(true /* cancelExisting */));
- }
- });
- }
-
- private void initActionsSpinner() {
- mActionsSpinner = (Spinner) findViewById(R.id.actions_spinner);
- mActionsSpinner.setAdapter(new NamedPresetSpinnerArrayAdapter(this,
- ActionsPresets.PRESETS));
- mActionsSpinner.post(new Runnable() {
- @Override
- public void run() {
- mActionsSpinner.setOnItemSelectedListener(
- new UpdateNotificationsOnItemSelectedListener(false /* cancelExisting */));
- }
- });
- }
-
- private void initIncludeLargeIconCheckbox() {
- mIncludeLargeIconCheckbox = (CheckBox) findViewById(R.id.include_large_icon_checkbox);
- mIncludeLargeIconCheckbox.setOnCheckedChangeListener(
- new UpdateNotificationsOnCheckedChangeListener(false /* cancelExisting */));
- }
-
- private void initLocalOnlyCheckbox() {
- mLocalOnlyCheckbox = (CheckBox) findViewById(R.id.local_only_checkbox);
- mLocalOnlyCheckbox.setOnCheckedChangeListener(
- new UpdateNotificationsOnCheckedChangeListener(false /* cancelExisting */));
- }
-
- private void initIncludeContentIntentCheckbox() {
- mIncludeContentIntentCheckbox = (CheckBox) findViewById(
- R.id.include_content_intent_checkbox);
- mIncludeContentIntentCheckbox.setOnCheckedChangeListener(
- new UpdateNotificationsOnCheckedChangeListener(false /* cancelExisting */));
- }
-
- private void initVibrateCheckbox() {
- mVibrateCheckbox = (CheckBox) findViewById(R.id.vibrate_checkbox);
- mVibrateCheckbox.setOnCheckedChangeListener(
- new UpdateNotificationsOnCheckedChangeListener(false /* cancelExisting */));
- }
-
- private void initBackgroundPickers() {
- mBackgroundPickers = new BackgroundPickers(
- (ViewGroup) findViewById(R.id.background_pickers),
- new BackgroundPickerListener());
- }
-
- private void updateTextEditors(NotificationPreset preset) {
- if (preset == NotificationPresets.BASIC) {
- findViewById(R.id.title_edit_field).setVisibility(View.VISIBLE);
- mTitleEditText.setText(getString(preset.titleResId));
- mTitleEditText.addTextChangedListener(mTextChangedListener);
- findViewById(R.id.text_edit_field).setVisibility(View.VISIBLE);
- mTextEditText.setText(getString(preset.textResId));
- mTextEditText.addTextChangedListener(mTextChangedListener);
- } else {
- findViewById(R.id.title_edit_field).setVisibility(View.GONE);
- mTitleEditText.removeTextChangedListener(mTextChangedListener);
- findViewById(R.id.text_edit_field).setVisibility(View.GONE);
- mTextEditText.removeTextChangedListener(mTextChangedListener);
- }
- }
-
- /**
- * Begin to re-post the sample notification(s).
- */
- private void updateNotifications(boolean cancelExisting) {
- // Disable messages to skip notification deleted messages during cancel.
- sendBroadcast(new Intent(NotificationIntentReceiver.ACTION_DISABLE_MESSAGES)
- .setClass(this, NotificationIntentReceiver.class));
-
- if (cancelExisting) {
- // Cancel all existing notifications to trigger fresh-posting behavior: For example,
- // switching from HIGH to LOW priority does not cause a reordering in Notification Shade.
- NotificationManagerCompat.from(this).cancelAll();
- postedNotificationCount = 0;
-
- // Post the updated notifications on a delay to avoid a cancel+post race condition
- // with notification manager.
- mHandler.removeMessages(MSG_POST_NOTIFICATIONS);
- mHandler.sendEmptyMessageDelayed(MSG_POST_NOTIFICATIONS, POST_NOTIFICATIONS_DELAY_MS);
- } else {
- postNotifications();
- }
- }
-
- /**
- * Post the sample notification(s) using current options.
- */
- private void postNotifications() {
- sendBroadcast(new Intent(NotificationIntentReceiver.ACTION_ENABLE_MESSAGES)
- .setClass(this, NotificationIntentReceiver.class));
-
- NotificationPreset preset = NotificationPresets.PRESETS[
- mPresetSpinner.getSelectedItemPosition()];
- CharSequence titlePreset = mTitleEditText.getText();
- CharSequence textPreset = mTextEditText.getText();
- PriorityPreset priorityPreset = PriorityPresets.PRESETS[
- mPrioritySpinner.getSelectedItemPosition()];
- ActionsPreset actionsPreset = ActionsPresets.PRESETS[
- mActionsSpinner.getSelectedItemPosition()];
- if (preset.actionsRequired() && actionsPreset == ActionsPresets.NO_ACTIONS_PRESET) {
- // If actions are required, but the no-actions preset was selected, change presets.
- actionsPreset = ActionsPresets.SINGLE_ACTION_PRESET;
- mActionsSpinner.setSelection(Arrays.asList(ActionsPresets.PRESETS).indexOf(
- actionsPreset), true);
- }
- NotificationPreset.BuildOptions options = new NotificationPreset.BuildOptions(
- titlePreset,
- textPreset,
- priorityPreset,
- actionsPreset,
- mIncludeLargeIconCheckbox.isChecked(),
- mLocalOnlyCheckbox.isChecked(),
- mIncludeContentIntentCheckbox.isChecked(),
- mVibrateCheckbox.isChecked(),
- mBackgroundPickers.getRes());
- Notification[] notifications = preset.buildNotifications(this, options);
-
- // Post new notifications
- for (int i = 0; i < notifications.length; i++) {
- NotificationManagerCompat.from(this).notify(i, notifications[i]);
- }
- // Cancel any that are beyond the current count.
- for (int i = notifications.length; i < postedNotificationCount; i++) {
- NotificationManagerCompat.from(this).cancel(i);
- }
- postedNotificationCount = notifications.length;
- }
-
- @Override
- public boolean handleMessage(Message message) {
- switch (message.what) {
- case MSG_POST_NOTIFICATIONS:
- postNotifications();
- return true;
- }
- return false;
- }
-
- private class PresetSpinnerListener implements AdapterView.OnItemSelectedListener {
- @Override
- public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
- NotificationPreset preset = NotificationPresets.PRESETS[position];
- mBackgroundPickers.generatePickers(preset.countBackgroundPickersRequired());
- updateTextEditors(preset);
- updateNotifications(false /* cancelExisting */);
- }
-
- @Override
- public void onNothingSelected(AdapterView<?> adapterView) {
- }
- }
-
- private class UpdateNotificationsOnTextChangeListener implements TextWatcher {
- @Override
- public void beforeTextChanged(CharSequence s, int start, int count, int after) {
- }
-
- public void onTextChanged(CharSequence s, int start, int before, int count) {
- }
-
- @Override
- public void afterTextChanged(Editable s) {
- updateNotifications(false /* cancelExisting */);
- }
- }
-
- private class UpdateNotificationsOnItemSelectedListener
- implements AdapterView.OnItemSelectedListener {
- private final boolean mCancelExisting;
-
- public UpdateNotificationsOnItemSelectedListener(boolean cancelExisting) {
- mCancelExisting = cancelExisting;
- }
- @Override
- public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
- updateNotifications(mCancelExisting);
- }
-
- @Override
- public void onNothingSelected(AdapterView<?> adapterView) {
- }
- }
-
- private class UpdateNotificationsOnCheckedChangeListener
- implements CompoundButton.OnCheckedChangeListener {
- private final boolean mCancelExisting;
-
- public UpdateNotificationsOnCheckedChangeListener(boolean cancelExisting) {
- mCancelExisting = cancelExisting;
- }
-
- @Override
- public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
- updateNotifications(mCancelExisting);
- }
- }
-
- private class BackgroundPickerListener
- implements BackgroundPickers.OnBackgroundPickersChangedListener {
- @Override
- public void onBackgroundPickersChanged(BackgroundPickers pickers) {
- updateNotifications(false /* cancelExisting */);
- }
- }
-
- private class NamedPresetSpinnerArrayAdapter extends ArrayAdapter<NamedPreset> {
- public NamedPresetSpinnerArrayAdapter(Context context, NamedPreset[] presets) {
- super(context, R.layout.simple_spinner_item, presets);
- }
-
- @Override
- public View getDropDownView(int position, View convertView, ViewGroup parent) {
- TextView view = (TextView) super.getDropDownView(position, convertView, parent);
- view.setText(getString(getItem(position).nameResId));
- return view;
- }
-
- @Override
- public View getView(int position, View convertView, ViewGroup parent) {
- TextView view = (TextView) getLayoutInflater().inflate(
- android.R.layout.simple_spinner_item, parent, false);
- view.setText(getString(getItem(position).nameResId));
- return view;
- }
- }
-}
diff --git a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/NotificationPresets.java b/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/NotificationPresets.java
deleted file mode 100644
index e175d1120..000000000
--- a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/NotificationPresets.java
+++ /dev/null
@@ -1,479 +0,0 @@
-/*
- * Copyright (C) 2014 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.support.wearable.notifications;
-
-import android.app.Notification;
-import android.content.Context;
-import android.graphics.BitmapFactory;
-import android.graphics.Color;
-import android.graphics.Typeface;
-import android.support.v4.app.NotificationCompat;
-import android.text.SpannableStringBuilder;
-import android.text.style.ForegroundColorSpan;
-import android.text.style.RelativeSizeSpan;
-import android.text.style.StrikethroughSpan;
-import android.text.style.StyleSpan;
-import android.text.style.SubscriptSpan;
-import android.text.style.SuperscriptSpan;
-import android.text.style.TypefaceSpan;
-import android.text.style.UnderlineSpan;
-import android.view.Gravity;
-
-/**
- * Collection of notification builder presets.
- */
-public class NotificationPresets {
- private static final String EXAMPLE_GROUP_KEY = "example";
-
- public static final NotificationPreset BASIC = new BasicNotificationPreset();
- public static final NotificationPreset STYLIZED_TEXT = new StylizedTextNotificationPreset();
- public static final NotificationPreset INBOX = new InboxNotificationPreset();
- public static final NotificationPreset BIG_PICTURE = new BigPictureNotificationPreset();
- public static final NotificationPreset BIG_TEXT = new BigTextNotificationPreset();
- public static final NotificationPreset BOTTOM_ALIGNED = new BottomAlignedNotificationPreset();
- public static final NotificationPreset GRAVITY = new GravityNotificationPreset();
- public static final NotificationPreset CONTENT_ACTION = new ContentActionNotificationPreset();
- public static final NotificationPreset CONTENT_ICON = new ContentIconNotificationPreset();
- public static final NotificationPreset MULTIPLE_PAGE = new MultiplePageNotificationPreset();
- public static final NotificationPreset BUNDLE = new NotificationBundlePreset();
-
- public static final NotificationPreset[] PRESETS = new NotificationPreset[] {
- BASIC,
- STYLIZED_TEXT,
- INBOX,
- BIG_PICTURE,
- BIG_TEXT,
- BOTTOM_ALIGNED,
- GRAVITY,
- CONTENT_ACTION,
- CONTENT_ICON,
- MULTIPLE_PAGE,
- BUNDLE
- };
-
- private static NotificationCompat.Builder applyBasicOptions(Context context,
- NotificationCompat.Builder builder, NotificationCompat.WearableExtender wearableOptions,
- NotificationPreset.BuildOptions options) {
- builder.setContentTitle(options.titlePreset)
- .setContentText(options.textPreset)
- .setSmallIcon(R.mipmap.ic_launcher)
- .setDeleteIntent(NotificationUtil.getExamplePendingIntent(
- context, R.string.example_notification_deleted));
- options.actionsPreset.apply(context, builder, wearableOptions);
- options.priorityPreset.apply(builder, wearableOptions);
- if (options.includeLargeIcon) {
- builder.setLargeIcon(BitmapFactory.decodeResource(
- context.getResources(), R.drawable.example_large_icon));
- }
- if (options.isLocalOnly) {
- builder.setLocalOnly(true);
- }
- if (options.hasContentIntent) {
- builder.setContentIntent(NotificationUtil.getExamplePendingIntent(context,
- R.string.content_intent_clicked));
- }
- if (options.vibrate) {
- builder.setVibrate(new long[] {0, 100, 50, 100} );
- }
- return builder;
- }
-
- private static class BasicNotificationPreset extends NotificationPreset {
- public BasicNotificationPreset() {
- super(R.string.basic_example, R.string.example_content_title,
- R.string.example_content_text);
- }
-
- @Override
- public Notification[] buildNotifications(Context context, BuildOptions options) {
- NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
- NotificationCompat.WearableExtender wearableOptions =
- new NotificationCompat.WearableExtender();
- applyBasicOptions(context, builder, wearableOptions, options);
- builder.extend(wearableOptions);
- return new Notification[] { builder.build() };
- }
- }
-
- private static class StylizedTextNotificationPreset extends NotificationPreset {
- public StylizedTextNotificationPreset() {
- super(R.string.stylized_text_example, R.string.example_content_title,
- R.string.example_content_text);
- }
-
- @Override
- public Notification[] buildNotifications(Context context, BuildOptions options) {
- NotificationCompat.BigTextStyle style = new NotificationCompat.BigTextStyle();
-
- SpannableStringBuilder title = new SpannableStringBuilder();
- appendStyled(title, "Stylized", new StyleSpan(Typeface.BOLD_ITALIC));
- title.append(" title");
- SpannableStringBuilder text = new SpannableStringBuilder("Stylized text: ");
- appendStyled(text, "C", new ForegroundColorSpan(Color.RED));
- appendStyled(text, "O", new ForegroundColorSpan(Color.GREEN));
- appendStyled(text, "L", new ForegroundColorSpan(Color.BLUE));
- appendStyled(text, "O", new ForegroundColorSpan(Color.YELLOW));
- appendStyled(text, "R", new ForegroundColorSpan(Color.MAGENTA));
- appendStyled(text, "S", new ForegroundColorSpan(Color.CYAN));
- text.append("; ");
- appendStyled(text, "1.25x size", new RelativeSizeSpan(1.25f));
- text.append("; ");
- appendStyled(text, "0.75x size", new RelativeSizeSpan(0.75f));
- text.append("; ");
- appendStyled(text, "underline", new UnderlineSpan());
- text.append("; ");
- appendStyled(text, "strikethrough", new StrikethroughSpan());
- text.append("; ");
- appendStyled(text, "bold", new StyleSpan(Typeface.BOLD));
- text.append("; ");
- appendStyled(text, "italic", new StyleSpan(Typeface.ITALIC));
- text.append("; ");
- appendStyled(text, "sans-serif-thin", new TypefaceSpan("sans-serif-thin"));
- text.append("; ");
- appendStyled(text, "monospace", new TypefaceSpan("monospace"));
- text.append("; ");
- appendStyled(text, "sub", new SubscriptSpan());
- text.append("script");
- appendStyled(text, "super", new SuperscriptSpan());
-
- style.setBigContentTitle(title);
- style.bigText(text);
-
- NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
- .setStyle(style);
- NotificationCompat.WearableExtender wearableOptions =
- new NotificationCompat.WearableExtender();
- applyBasicOptions(context, builder, wearableOptions, options);
- builder.extend(wearableOptions);
- return new Notification[] { builder.build() };
- }
-
- private void appendStyled(SpannableStringBuilder builder, String str, Object... spans) {
- builder.append(str);
- for (Object span : spans) {
- builder.setSpan(span, builder.length() - str.length(), builder.length(), 0);
- }
- }
- }
-
- private static class InboxNotificationPreset extends NotificationPreset {
- public InboxNotificationPreset() {
- super(R.string.inbox_example, R.string.example_content_title,
- R.string.example_content_text);
- }
-
- @Override
- public Notification[] buildNotifications(Context context, BuildOptions options) {
- NotificationCompat.InboxStyle style = new NotificationCompat.InboxStyle();
- style.addLine(context.getString(R.string.inbox_style_example_line1));
- style.addLine(context.getString(R.string.inbox_style_example_line2));
- style.addLine(context.getString(R.string.inbox_style_example_line3));
- style.setBigContentTitle(context.getString(R.string.inbox_style_example_title));
- style.setSummaryText(context.getString(R.string.inbox_style_example_summary_text));
-
- NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
- .setStyle(style);
- NotificationCompat.WearableExtender wearableOptions =
- new NotificationCompat.WearableExtender();
- applyBasicOptions(context, builder, wearableOptions, options);
- builder.extend(wearableOptions);
- return new Notification[] { builder.build() };
- }
- }
-
- private static class BigPictureNotificationPreset extends NotificationPreset {
- public BigPictureNotificationPreset() {
- super(R.string.big_picture_example, R.string.example_content_title,
- R.string.example_content_text);
- }
-
- @Override
- public Notification[] buildNotifications(Context context, BuildOptions options) {
- NotificationCompat.BigPictureStyle style = new NotificationCompat.BigPictureStyle();
- style.bigPicture(BitmapFactory.decodeResource(context.getResources(),
- R.drawable.example_big_picture));
- style.setBigContentTitle(context.getString(R.string.big_picture_style_example_title));
- style.setSummaryText(context.getString(
- R.string.big_picture_style_example_summary_text));
-
- NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
- .setStyle(style);
- NotificationCompat.WearableExtender wearableOptions =
- new NotificationCompat.WearableExtender();
- applyBasicOptions(context, builder, wearableOptions, options);
- builder.extend(wearableOptions);
- return new Notification[] { builder.build() };
- }
- }
-
- private static class BigTextNotificationPreset extends NotificationPreset {
- public BigTextNotificationPreset() {
- super(R.string.big_text_example, R.string.example_content_title,
- R.string.example_content_text);
- }
-
- @Override
- public Notification[] buildNotifications(Context context, BuildOptions options) {
- NotificationCompat.BigTextStyle style = new NotificationCompat.BigTextStyle();
- style.bigText(context.getString(R.string.big_text_example_big_text));
- style.setBigContentTitle(context.getString(R.string.big_text_example_title));
- style.setSummaryText(context.getString(R.string.big_text_example_summary_text));
-
- NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
- .setStyle(style);
- NotificationCompat.WearableExtender wearableOptions =
- new NotificationCompat.WearableExtender();
- applyBasicOptions(context, builder, wearableOptions, options);
- builder.extend(wearableOptions);
- return new Notification[] { builder.build() };
- }
- }
-
- private static class BottomAlignedNotificationPreset extends NotificationPreset {
- public BottomAlignedNotificationPreset() {
- super(R.string.bottom_aligned_example, R.string.example_content_title,
- R.string.example_content_text);
- }
-
- @Override
- public Notification[] buildNotifications(Context context, BuildOptions options) {
- NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
- NotificationCompat.WearableExtender wearableOptions =
- new NotificationCompat.WearableExtender();
- applyBasicOptions(context, builder, wearableOptions, options);
-
- NotificationCompat.Builder secondPageBuilder = new NotificationCompat.Builder(context);
- secondPageBuilder.setContentTitle(
- context.getString(R.string.second_page_content_title));
- secondPageBuilder.setContentText(context.getString(R.string.big_text_example_big_text));
- secondPageBuilder.extend(new NotificationCompat.WearableExtender()
- .setStartScrollBottom(true));
-
- wearableOptions.addPage(secondPageBuilder.build());
- builder.extend(wearableOptions);
- return new Notification[] { builder.build() };
- }
- }
-
- private static class GravityNotificationPreset extends NotificationPreset {
- public GravityNotificationPreset() {
- super(R.string.gravity_example, R.string.example_content_title,
- R.string.example_content_text);
- }
-
- @Override
- public Notification[] buildNotifications(Context context, BuildOptions options) {
- NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
- NotificationCompat.WearableExtender wearableOptions =
- new NotificationCompat.WearableExtender();
- applyBasicOptions(context, builder, wearableOptions, options);
-
- NotificationCompat.Builder secondPageBuilder = new NotificationCompat.Builder(context)
- .setContentTitle(options.titlePreset)
- .setContentText(options.textPreset)
- .extend(new NotificationCompat.WearableExtender()
- .setGravity(Gravity.CENTER_VERTICAL));
- wearableOptions.addPage(secondPageBuilder.build());
-
- NotificationCompat.Builder thirdPageBuilder = new NotificationCompat.Builder(context)
- .setContentTitle(options.titlePreset)
- .setContentText(options.textPreset)
- .extend(new NotificationCompat.WearableExtender()
- .setGravity(Gravity.TOP));
- wearableOptions.addPage(thirdPageBuilder.build());
-
- wearableOptions.setGravity(Gravity.BOTTOM);
- builder.extend(wearableOptions);
- return new Notification[] { builder.build() };
- }
- }
-
- private static class ContentActionNotificationPreset extends NotificationPreset {
- public ContentActionNotificationPreset() {
- super(R.string.content_action_example, R.string.example_content_title,
- R.string.example_content_text);
- }
-
- @Override
- public Notification[] buildNotifications(Context context, BuildOptions options) {
- Notification secondPage = new NotificationCompat.Builder(context)
- .setContentTitle(context.getString(R.string.second_page_content_title))
- .setContentText(context.getString(R.string.second_page_content_text))
- .extend(new NotificationCompat.WearableExtender()
- .setContentAction(1))
- .build();
-
- NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
- NotificationCompat.Action action = new NotificationCompat.Action.Builder(
- R.drawable.ic_result_open, null, NotificationUtil.getExamplePendingIntent(
- context, R.string.example_content_action_clicked)).build();
- NotificationCompat.Action action2 = new NotificationCompat.Action.Builder(
- R.drawable.ic_result_open, null, NotificationUtil.getExamplePendingIntent(
- context, R.string.example_content_action2_clicked)).build();
- NotificationCompat.WearableExtender wearableOptions =
- new NotificationCompat.WearableExtender()
- .addAction(action)
- .addAction(action2)
- .addPage(secondPage)
- .setContentAction(0)
- .setHintHideIcon(true);
- applyBasicOptions(context, builder, wearableOptions, options);
- builder.extend(wearableOptions);
- return new Notification[] { builder.build() };
- }
-
- @Override
- public boolean actionsRequired() {
- return true;
- }
- }
-
- private static class ContentIconNotificationPreset extends NotificationPreset {
- public ContentIconNotificationPreset() {
- super(R.string.content_icon_example, R.string.example_content_title,
- R.string.example_content_text);
- }
-
- @Override
- public Notification[] buildNotifications(Context context, BuildOptions options) {
- Notification secondPage = new NotificationCompat.Builder(context)
- .setContentTitle(context.getString(R.string.second_page_content_title))
- .setContentText(context.getString(R.string.second_page_content_text))
- .extend(new NotificationCompat.WearableExtender()
- .setContentIcon(R.drawable.content_icon_small)
- .setContentIconGravity(Gravity.START))
- .build();
-
- Notification thirdPage = new NotificationCompat.Builder(context)
- .setContentTitle(context.getString(R.string.third_page_content_title))
- .setContentText(context.getString(R.string.third_page_content_text))
- .extend(new NotificationCompat.WearableExtender()
- .setContentIcon(R.drawable.content_icon_large))
- .build();
-
- Notification fourthPage = new NotificationCompat.Builder(context)
- .setContentTitle(context.getString(R.string.fourth_page_content_title))
- .setContentText(context.getString(R.string.fourth_page_content_text))
- .extend(new NotificationCompat.WearableExtender()
- .setContentIcon(R.drawable.content_icon_large)
- .setContentIconGravity(Gravity.START))
- .build();
-
- NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
- NotificationCompat.WearableExtender wearableOptions =
- new NotificationCompat.WearableExtender()
- .setHintHideIcon(true)
- .setContentIcon(R.drawable.content_icon_small)
- .addPage(secondPage)
- .addPage(thirdPage)
- .addPage(fourthPage);
- applyBasicOptions(context, builder, wearableOptions, options);
- builder.extend(wearableOptions);
- return new Notification[] { builder.build() };
- }
- }
-
- private static class MultiplePageNotificationPreset extends NotificationPreset {
- public MultiplePageNotificationPreset() {
- super(R.string.multiple_page_example, R.string.example_content_title,
- R.string.example_content_text);
- }
-
- @Override
- public Notification[] buildNotifications(Context context, BuildOptions options) {
- NotificationCompat.Builder secondPageBuilder = new NotificationCompat.Builder(context)
- .setContentTitle(context.getString(R.string.second_page_content_title))
- .setContentText(context.getString(R.string.second_page_content_text));
-
- NotificationCompat.Builder firstPageBuilder = new NotificationCompat.Builder(context);
- NotificationCompat.WearableExtender firstPageWearableOptions =
- new NotificationCompat.WearableExtender();
- applyBasicOptions(context, firstPageBuilder, firstPageWearableOptions, options);
-
- Integer firstBackground = options.backgroundIds == null
- ? null : options.backgroundIds[0];
- if (firstBackground != null) {
- NotificationCompat.BigPictureStyle style =
- new NotificationCompat.BigPictureStyle();
- style.bigPicture(BitmapFactory.decodeResource(context.getResources(),
- firstBackground));
- firstPageBuilder.setStyle(style);
- }
-
- Integer secondBackground = options.backgroundIds == null
- ? null : options.backgroundIds[1];
- if (secondBackground != null) {
- NotificationCompat.BigPictureStyle style = new NotificationCompat.BigPictureStyle();
- style.bigPicture(BitmapFactory.decodeResource(context.getResources(),
- secondBackground));
- secondPageBuilder.setStyle(style);
- }
-
- firstPageBuilder.extend(
- firstPageWearableOptions.addPage(secondPageBuilder.build()));
-
- return new Notification[]{ firstPageBuilder.build() };
- }
-
- @Override
- public int countBackgroundPickersRequired() {
- return 2; // This sample does 2 pages notifications.
- }
- }
-
- private static class NotificationBundlePreset extends NotificationPreset {
- public NotificationBundlePreset() {
- super(R.string.bundle_example, R.string.example_content_title,
- R.string.example_content_text);
- }
-
- @Override
- public Notification[] buildNotifications(Context context, BuildOptions options) {
- NotificationCompat.Builder childBuilder1 = new NotificationCompat.Builder(context)
- .setContentTitle(context.getString(R.string.first_child_content_title))
- .setContentText(context.getString(R.string.first_child_content_text))
- .setSmallIcon(R.mipmap.ic_launcher)
- .setLocalOnly(options.isLocalOnly)
- .setGroup(EXAMPLE_GROUP_KEY)
- .setSortKey("0");
-
- NotificationCompat.Builder childBuilder2 = new NotificationCompat.Builder(context)
- .setContentTitle(context.getString(R.string.second_child_content_title))
- .setContentText(context.getString(R.string.second_child_content_text))
- .setSmallIcon(R.mipmap.ic_launcher)
- .addAction(R.mipmap.ic_launcher,
- context.getString(R.string.second_child_action),
- NotificationUtil.getExamplePendingIntent(
- context, R.string.second_child_action_clicked))
- .setLocalOnly(options.isLocalOnly)
- .setGroup(EXAMPLE_GROUP_KEY)
- .setSortKey("1");
-
- NotificationCompat.Builder summaryBuilder = new NotificationCompat.Builder(context)
- .setGroup(EXAMPLE_GROUP_KEY)
- .setGroupSummary(true);
-
- NotificationCompat.WearableExtender summaryWearableOptions =
- new NotificationCompat.WearableExtender();
- applyBasicOptions(context, summaryBuilder, summaryWearableOptions, options);
- summaryBuilder.extend(summaryWearableOptions);
-
- return new Notification[] { summaryBuilder.build(), childBuilder1.build(),
- childBuilder2.build() };
- }
- }
-}
diff --git a/samples/wearable/Notifications/Application/src/main/res/values/colors.xml b/samples/wearable/Notifications/Application/src/main/res/values/colors.xml
deleted file mode 100644
index 946408559..000000000
--- a/samples/wearable/Notifications/Application/src/main/res/values/colors.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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>
- <color name="divider_text">@android:color/holo_blue_bright</color>
-</resources>
diff --git a/samples/wearable/Notifications/Application/src/main/res/values/strings.xml b/samples/wearable/Notifications/Application/src/main/res/values/strings.xml
deleted file mode 100644
index d46ced776..000000000
--- a/samples/wearable/Notifications/Application/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,193 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<resources>
-
- <string name="app_name">Wearable Notifications</string>
- <string name="properties">Properties</string>
- <string name="preset">Preset</string>
- <string name="text">Text</string>
- <string name="title">Title</string>
- <string name="priority">Priority</string>
- <string name="actions">Actions</string>
- <string name="include_large_icon">Include large icon</string>
- <string name="local_only">Local only</string>
- <string name="include_content_intent">Include content intent</string>
- <string name="vibrate">Vibrate</string>
-
- <string name="basic_example">Basic example</string>
- <string name="stylized_text_example">Stylized text example</string>
- <string name="inbox_example">Inbox example</string>
- <string name="big_picture_example">Big picture example</string>
- <string name="big_text_example">Big text example</string>
- <string name="bottom_aligned_example">Bottom-aligned example</string>
- <string name="gravity_example">Gravity example</string>
- <string name="content_action_example">Content action example</string>
- <string name="content_icon_example">Content icon example</string>
- <string name="multiple_page_example">Multiple page example</string>
- <string name="bundle_example">Bundle example</string>
-
- <string name="min_priority">Min priority</string>
- <string name="low_priority">Low priority</string>
- <string name="default_priority">Default priority</string>
- <string name="high_priority">High priority</string>
- <string name="max_priority">Max priority</string>
-
- <string name="no_actions">No actions</string>
- <string name="single_action">Single action</string>
- <string name="long_title_action">Single action with a long title</string>
- <string name="reply_action">Reply action</string>
- <string name="reply_action_with_choices">Reply action with choices</string>
- <string name="different_actions_on_phone_and_wearable">Different on phone and wearable</string>
-
- <string name="example_action">Example action</string>
- <string name="example_action_long_title">Example action with a long title which wraps</string>
- <string name="example_reply_action">Example reply action</string>
- <string name="phone_action">Phone action</string>
- <string name="wearable_action">Wearable action</string>
-
- <string name="example_action_clicked">Example action clicked</string>
- <string name="example_reply_action_clicked">Example reply action clicked</string>
- <string name="phone_action_clicked">Phone action clicked</string>
- <string name="wearable_action_clicked">Wearable action clicked</string>
- <string name="second_child_action_clicked">Second child action clicked</string>
- <string name="content_intent_clicked">Content intent clicked</string>
- <string name="example_content_action_clicked">Example content action clicked</string>
- <string name="example_content_action2_clicked">Example content action 2 clicked</string>
- <string name="example_notification_deleted">Example notification deleted</string>
-
- <string name="example_content_title">Basic example title</string>
- <string name="example_content_text">Basic example text</string>
-
- <string name="big_text_example_title">Big text example title</string>
- <string name="big_text_example_summary_text">Big text example summary</string>
- <string name="big_text_example_big_text">
- Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
- incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
- exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
- dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
- Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
- anim id est laborum.
-
- Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
- incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
- exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
- dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
- Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
- anim id est laborum.
-
- Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
- incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
- exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
- dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
- Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
- anim id est laborum.
-
- Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
- incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
- exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
- dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
- Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
- anim id est laborum.
-
- Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
- incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
- exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
- dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
- Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
- anim id est laborum.
-
- Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
- incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
- exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
- dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
- Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
- anim id est laborum.
-
- Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
- incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
- exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
- dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
- Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
- anim id est laborum.
-
- Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
- incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
- exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
- dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
- Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
- anim id est laborum.
-
- Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
- incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
- exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
- dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
- Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
- anim id est laborum.
-
- Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
- incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
- exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
- dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
- Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
- anim id est laborum.
-
- Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
- incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
- exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
- dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
- Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
- anim id est laborum.
- </string>
-
- <string name="inbox_style_example_title">Inbox style example title</string>
- <string name="inbox_style_example_summary_text">Inbox style example summary</string>
- <string name="inbox_style_example_line1">Inbox style example line 1</string>
- <string name="inbox_style_example_line2">Inbox style example line 2</string>
- <string name="inbox_style_example_line3">Inbox style example line 3</string>
-
- <string name="big_picture_style_example_title">Big picture style example title</string>
- <string name="big_picture_style_example_summary_text">Big picture style example summary</string>
-
- <string name="second_page_content_title">Second page title</string>
- <string name="second_page_content_text">Second page text</string>
-
- <string name="third_page_content_title">Third page title</string>
- <string name="third_page_content_text">Third page text</string>
-
- <string name="fourth_page_content_title">Fourth page title</string>
- <string name="fourth_page_content_text">Fourth page text</string>
-
- <string name="first_child_content_title">First child title</string>
- <string name="first_child_content_text">
- First child text. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
- tempor incididunt ut labore et dolore magna aliqua.</string>
- <string name="second_child_content_title">Second child title</string>
- <string name="second_child_content_text">
- Second child text. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
- tempor incididunt ut labore et dolore magna aliqua.</string>
- <string name="second_child_action">Second child action</string>
-
- <string name="example_reply_label">Message?</string>
-
- <string name="example_reply_answer_label">Answer?</string>
- <string name="yes">Yes</string>
- <string name="no">No</string>
- <string name="maybe">Maybe</string>
-
- <string name="bg_picker_label">Page %s background: </string>
-
-</resources>
diff --git a/samples/wearable/Notifications/Application/src/main/res/values/styles.xml b/samples/wearable/Notifications/Application/src/main/res/values/styles.xml
deleted file mode 100644
index cf0494b4b..000000000
--- a/samples/wearable/Notifications/Application/src/main/res/values/styles.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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. -->
- <style name="AppTheme" parent="android:Theme.Holo">
- <!-- Customize your theme here. -->
- </style>
-
- <style name="bg_picker">
- <item name="android:layout_marginLeft">16dp</item>
- <item name="android:background">@drawable/unselected_background</item>
- </style>
-
-</resources>
diff --git a/samples/wearable/Notifications/Wearable/build.gradle b/samples/wearable/Notifications/Wearable/build.gradle
deleted file mode 100644
index b9450ca9a..000000000
--- a/samples/wearable/Notifications/Wearable/build.gradle
+++ /dev/null
@@ -1,24 +0,0 @@
-apply plugin: 'android'
-
-android {
- compileSdkVersion 20
- buildToolsVersion '20'
-
- defaultConfig {
- minSdkVersion 20
- targetSdkVersion 20
- versionCode 1
- versionName "1.0"
- }
-
- buildTypes {
- release {
- runProguard false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
- }
- }
-}
-
-dependencies {
- compile "com.google.android.support:wearable:1.0.+"
-}
diff --git a/samples/wearable/Notifications/Wearable/proguard-rules.txt b/samples/wearable/Notifications/Wearable/proguard-rules.txt
deleted file mode 100644
index 08e5bdc8d..000000000
--- a/samples/wearable/Notifications/Wearable/proguard-rules.txt
+++ /dev/null
@@ -1,22 +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 *;
-#}
--dontwarn android.support.wearable.view.DelayedConfirmationView
--dontwarn android.support.wearable.view.CircledImageView
diff --git a/samples/wearable/Notifications/Wearable/src/main/AndroidManifest.xml b/samples/wearable/Notifications/Wearable/src/main/AndroidManifest.xml
deleted file mode 100644
index ad744570a..000000000
--- a/samples/wearable/Notifications/Wearable/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.support.wearable.notifications" >
-
- <uses-feature android:name="android.hardware.type.watch" />
-
- <application
- android:allowBackup="true"
- android:icon="@mipmap/ic_launcher"
- android:label="@string/app_name"
- android:theme="@android:style/Theme.DeviceDefault.Light" >
-
- <activity
- android:name=".MainActivity"
- android:label="@string/app_name" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <activity
- android:name=".BasicNotificationDisplayActivity"
- android:exported="true"
- android:allowEmbedded="true"
- android:label="@string/app_name"
- android:taskAffinity="" />
- <activity
- android:name=".AnimatedNotificationDisplayActivity"
- android:exported="true"
- android:allowEmbedded="true"
- android:label="@string/app_name"
- android:taskAffinity="" />
- </application>
-
-</manifest>
diff --git a/samples/wearable/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/WearableListItemLayout.java b/samples/wearable/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/WearableListItemLayout.java
deleted file mode 100644
index 773dfe4cc..000000000
--- a/samples/wearable/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/WearableListItemLayout.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (C) 2014 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.support.wearable.notifications;
-
-import android.content.Context;
-import android.graphics.drawable.GradientDrawable;
-import android.support.wearable.view.WearableListView;
-import android.util.AttributeSet;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-
-public class WearableListItemLayout extends LinearLayout implements WearableListView.Item {
-
- private final float mFadedTextAlpha;
- private final int mFadedCircleColor;
- private final int mChosenCircleColor;
- private ImageView mCircle;
- private float mScale;
- private TextView mName;
-
- public WearableListItemLayout(Context context) {
- this(context, null);
- }
-
- public WearableListItemLayout(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public WearableListItemLayout(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- mFadedTextAlpha = getResources().getInteger(R.integer.action_text_faded_alpha) / 100f;
- mFadedCircleColor = getResources().getColor(R.color.wl_gray);
- mChosenCircleColor = getResources().getColor(R.color.wl_blue);
- }
-
- @Override
- protected void onFinishInflate() {
- super.onFinishInflate();
- mCircle = (ImageView) findViewById(R.id.circle);
- mName = (TextView) findViewById(R.id.name);
- }
-
- @Override
- public float getProximityMinValue() {
- return 1f;
- }
-
- @Override
- public float getProximityMaxValue() {
- return 1.6f;
- }
-
- @Override
- public float getCurrentProximityValue() {
- return mScale;
- }
-
- @Override
- public void setScalingAnimatorValue(float scale) {
- mScale = scale;
- mCircle.setScaleX(scale);
- mCircle.setScaleY(scale);
- }
-
- @Override
- public void onScaleUpStart() {
- mName.setAlpha(1f);
- ((GradientDrawable) mCircle.getDrawable()).setColor(mChosenCircleColor);
- }
-
- @Override
- public void onScaleDownStart() {
- ((GradientDrawable) mCircle.getDrawable()).setColor(mFadedCircleColor);
- mName.setAlpha(mFadedTextAlpha);
- }
-}
diff --git a/samples/wearable/Notifications/_index.html b/samples/wearable/Notifications/_index.html
deleted file mode 100644
index af28c9404..000000000
--- a/samples/wearable/Notifications/_index.html
+++ /dev/null
@@ -1,76 +0,0 @@
-<p><b>About:</b> This sample application provides a showcase of available notification styles and
-demonstrates various features of the Android Wear notifications API. Running the sample on your
-companion allows you to select between various notification styles and to see how these
-notifications are displayed, both in a phone's notification shade and on the wearable. The companion
-application allows you to create the following types of notifications:</p>
-<ul>
- <li>Basic notification</li>
- <li>"Inbox style" notification: multiple lines of text</li>
- <li>"Big picture style" notification: a full-screen background image for the card on the
- wearable</li>
- <li>"Big text style" notification: a tall card that is collapsed and can be expanded with a
- tap</li>
- <li>"Big action style" notification: tapping anywhere on the card triggers the notification
- content intent</li>
- <li>Notification with multiple pages: swipe horizontally to view the second page</li>
- <li>Bundled Notifications: a stack of cards that can be individually expanded</li>
-</ul>
-<p>This sample also allows you to toggle other attributes for each of these notification types,
-including whether a content intent or action are included, and whether the notification is marked as
-"local only," indicating that it should not be bridged between devices.</p>
-<p>You can also run a separate APK on your wearable for even more customizable notifications. The
-wearable notification styles include:</p>
-<ul>
- <li>A notification drawn with a custom display Activity, using setDisplayIntent</li>
- <li>A notification styled using SpannableStrings</li>
- <li>A notification page with bottom-aligned text</li>
- <li>A notification with a "content icon"</li>
-</ul>
-<p><b>How to run:</b> Install the Application APK on the companion, and/or the Wearable APK on the
-wearable. Start the sample by running the Wearable Notifications application on the companion, or
-by starting the Wearable Notifications application on the wearable. To do the latter, go to the
-voice menu - either by saying Ok Google or tapping the home screen - and select the "Start..."
-option. Then, select "Wearable Notifications" from the submenu.</p>
-<p><b>Wearable APIs used:</b> Notification.WearableExtender, Notification.BigTextStyle,
-Notification.BigPictureStyle (note that NotificationCompat, rather than Notification, is used on the
-companion side in order to be compatible with older versions of Android).</p>
-<p><b>Screenshots:</b>
- <figure>
- <img src="screenshots/companion-multiple-page.png" alt="Multiple page" width="216"
- height="384">
- <img src="screenshots/multiple-page1.png" alt="Page 1" width="140" height="140">
- <img src="screenshots/multiple-page2.png" alt="Page 2" width="140" height="140">
- <img src="screenshots/companion-bottom-aligned.png" alt="Bottom aligned - companion"
- width="216" height="384">
- <img src="screenshots/bottom-aligned.png" alt="Bottom aligned - wearable" width="140"
- height="140">
- <img src="screenshots/companion-content-action.png" alt="Content action - companion"
- width="216" height="384">
- <img src="screenshots/content-action.png" alt="Content action - wearable" width="140"
- height="140">
- <img src="screenshots/content-action2.png" alt="Content action 2 - wearable" width="140"
- height="140">
- <img src="screenshots/companion-bundle.png" alt="Bundle aligned - companion" width="216"
- height="384">
- <img src="screenshots/bundle.png" alt="Bundle - wearable" width="140" height="140">
- <figcaption>Notifications selected from companion app.</figcaption>
- </figure>
- <figure>
- <img src="screenshots/basic-menu.png" alt="Select 'Basic example'" width="140"
- height="140">
- <img src="screenshots/basic.png" alt="Basic example" width="140" height="140">
- <img src="screenshots/content-icon-menu.png" alt="Select 'Content icon example'" width="140"
- height="140">
- <img src="screenshots/content-icon1.png" alt="Content icon 1" width="140" height="140">
- <img src="screenshots/content-icon2.png" alt="Content icon 2" width="140" height="140">
- <img src="screenshots/content-icon3.png" alt="Content icon 3" width="140" height="140">
- <img src="screenshots/content-icon4.png" alt="Content icon 4" width="140" height="140">
- <img src="screenshots/display-intent-menu.png" alt="Select 'Display intent example'"
- width="140" height="140">
- <img src="screenshots/display-intent.png" alt="Display intent" width="140" height="140">
- <img src="screenshots/stylized-menu.png" alt="Select 'Stylized text example'" width="140"
- height="140">
- <img src="screenshots/stylized.png" alt="Stylized text example" width="140" height="140">
- <figcaption>Notifications selected from wearable app.</figcaption>
- </figure>
-</p>
diff --git a/samples/wearable/Notifications/build.gradle b/samples/wearable/Notifications/build.gradle
deleted file mode 100644
index 8bd4ffc49..000000000
--- a/samples/wearable/Notifications/build.gradle
+++ /dev/null
@@ -1,14 +0,0 @@
-buildscript {
- repositories {
- mavenCentral()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:0.12.+'
- }
-}
-
-allprojects {
- repositories {
- mavenCentral()
- }
-}
diff --git a/samples/wearable/Notifications/gradle.properties b/samples/wearable/Notifications/gradle.properties
deleted file mode 100644
index 5d08ba75b..000000000
--- a/samples/wearable/Notifications/gradle.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-# Project-wide Gradle settings.
-
-# IDE (e.g. Android Studio) users:
-# Settings specified in this file will override any Gradle settings
-# configured through the IDE.
-
-# For more details on how to configure your build environment visit
-# http://www.gradle.org/docs/current/userguide/build_environment.html
-
-# Specifies the JVM arguments used for the daemon process.
-# The setting is particularly useful for tweaking memory settings.
-# Default value: -Xmx10248m -XX:MaxPermSize=256m
-# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
-
-# When configured, Gradle will run in incubating parallel mode.
-# This option should only be used with decoupled projects. More details, visit
-# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
-# org.gradle.parallel=true \ No newline at end of file
diff --git a/samples/wearable/Notifications/gradle/wrapper/gradle-wrapper.jar b/samples/wearable/Notifications/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index 8c0fb64a8..000000000
--- a/samples/wearable/Notifications/gradle/wrapper/gradle-wrapper.jar
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/Notifications/gradle/wrapper/gradle-wrapper.properties b/samples/wearable/Notifications/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index 1e61d1fd3..000000000
--- a/samples/wearable/Notifications/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-#Wed Apr 10 15:27:10 PDT 2013
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip
diff --git a/samples/wearable/Notifications/gradlew b/samples/wearable/Notifications/gradlew
deleted file mode 100755
index 91a7e269e..000000000
--- a/samples/wearable/Notifications/gradlew
+++ /dev/null
@@ -1,164 +0,0 @@
-#!/usr/bin/env bash
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn ( ) {
- echo "$*"
-}
-
-die ( ) {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
-esac
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched.
-if $cygwin ; then
- [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-fi
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >&-
-APP_HOME="`pwd -P`"
-cd "$SAVED" >&-
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
-}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
-
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/samples/wearable/Notifications/gradlew.bat b/samples/wearable/Notifications/gradlew.bat
deleted file mode 100755
index aec99730b..000000000
--- a/samples/wearable/Notifications/gradlew.bat
+++ /dev/null
@@ -1,90 +0,0 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/samples/wearable/Notifications/screenshots/basic-menu.png b/samples/wearable/Notifications/screenshots/basic-menu.png
deleted file mode 100644
index 75c29cc15..000000000
--- a/samples/wearable/Notifications/screenshots/basic-menu.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/Notifications/screenshots/basic.png b/samples/wearable/Notifications/screenshots/basic.png
deleted file mode 100644
index 9e13b0926..000000000
--- a/samples/wearable/Notifications/screenshots/basic.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/Notifications/screenshots/bottom-aligned.png b/samples/wearable/Notifications/screenshots/bottom-aligned.png
deleted file mode 100644
index 88c7ffadb..000000000
--- a/samples/wearable/Notifications/screenshots/bottom-aligned.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/Notifications/screenshots/bundle.png b/samples/wearable/Notifications/screenshots/bundle.png
deleted file mode 100644
index a6e1ad5ee..000000000
--- a/samples/wearable/Notifications/screenshots/bundle.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/Notifications/screenshots/companion-bottom-aligned.png b/samples/wearable/Notifications/screenshots/companion-bottom-aligned.png
deleted file mode 100644
index 2bda56c8b..000000000
--- a/samples/wearable/Notifications/screenshots/companion-bottom-aligned.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/Notifications/screenshots/companion-bundle.png b/samples/wearable/Notifications/screenshots/companion-bundle.png
deleted file mode 100644
index 90e0e0869..000000000
--- a/samples/wearable/Notifications/screenshots/companion-bundle.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/Notifications/screenshots/companion-content-action.png b/samples/wearable/Notifications/screenshots/companion-content-action.png
deleted file mode 100644
index 07e680602..000000000
--- a/samples/wearable/Notifications/screenshots/companion-content-action.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/Notifications/screenshots/companion-multiple-page.png b/samples/wearable/Notifications/screenshots/companion-multiple-page.png
deleted file mode 100644
index 7f115219d..000000000
--- a/samples/wearable/Notifications/screenshots/companion-multiple-page.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/Notifications/screenshots/content-action.png b/samples/wearable/Notifications/screenshots/content-action.png
deleted file mode 100644
index 415dd9f66..000000000
--- a/samples/wearable/Notifications/screenshots/content-action.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/Notifications/screenshots/content-action2.png b/samples/wearable/Notifications/screenshots/content-action2.png
deleted file mode 100644
index 7f01994ac..000000000
--- a/samples/wearable/Notifications/screenshots/content-action2.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/Notifications/screenshots/content-icon-menu.png b/samples/wearable/Notifications/screenshots/content-icon-menu.png
deleted file mode 100644
index 6c810cea8..000000000
--- a/samples/wearable/Notifications/screenshots/content-icon-menu.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/Notifications/screenshots/content-icon1.png b/samples/wearable/Notifications/screenshots/content-icon1.png
deleted file mode 100644
index f9d12da48..000000000
--- a/samples/wearable/Notifications/screenshots/content-icon1.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/Notifications/screenshots/content-icon2.png b/samples/wearable/Notifications/screenshots/content-icon2.png
deleted file mode 100644
index a36b734c4..000000000
--- a/samples/wearable/Notifications/screenshots/content-icon2.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/Notifications/screenshots/content-icon3.png b/samples/wearable/Notifications/screenshots/content-icon3.png
deleted file mode 100644
index e2c757e5d..000000000
--- a/samples/wearable/Notifications/screenshots/content-icon3.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/Notifications/screenshots/content-icon4.png b/samples/wearable/Notifications/screenshots/content-icon4.png
deleted file mode 100644
index f5d05231f..000000000
--- a/samples/wearable/Notifications/screenshots/content-icon4.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/Notifications/screenshots/display-intent-menu.png b/samples/wearable/Notifications/screenshots/display-intent-menu.png
deleted file mode 100644
index 567673f73..000000000
--- a/samples/wearable/Notifications/screenshots/display-intent-menu.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/Notifications/screenshots/display-intent.png b/samples/wearable/Notifications/screenshots/display-intent.png
deleted file mode 100644
index f3b333d5e..000000000
--- a/samples/wearable/Notifications/screenshots/display-intent.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/Notifications/screenshots/multiple-page1.png b/samples/wearable/Notifications/screenshots/multiple-page1.png
deleted file mode 100644
index d6591d97e..000000000
--- a/samples/wearable/Notifications/screenshots/multiple-page1.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/Notifications/screenshots/multiple-page2.png b/samples/wearable/Notifications/screenshots/multiple-page2.png
deleted file mode 100644
index 730cb3047..000000000
--- a/samples/wearable/Notifications/screenshots/multiple-page2.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/Notifications/screenshots/stylized-menu.png b/samples/wearable/Notifications/screenshots/stylized-menu.png
deleted file mode 100644
index 2e94c93bd..000000000
--- a/samples/wearable/Notifications/screenshots/stylized-menu.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/Notifications/screenshots/stylized.png b/samples/wearable/Notifications/screenshots/stylized.png
deleted file mode 100644
index 338c9cc5d..000000000
--- a/samples/wearable/Notifications/screenshots/stylized.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/Notifications/settings.gradle b/samples/wearable/Notifications/settings.gradle
deleted file mode 100644
index f3f25a547..000000000
--- a/samples/wearable/Notifications/settings.gradle
+++ /dev/null
@@ -1 +0,0 @@
-include 'Wearable', 'Application'
diff --git a/samples/wearable/Quiz/Application/build.gradle b/samples/wearable/Quiz/Application/build.gradle
deleted file mode 100644
index a138acb2f..000000000
--- a/samples/wearable/Quiz/Application/build.gradle
+++ /dev/null
@@ -1,26 +0,0 @@
-apply plugin: 'android'
-
-android {
- compileSdkVersion 18
- buildToolsVersion '20'
-
- defaultConfig {
- minSdkVersion 18
- targetSdkVersion 19
- versionCode 1
- versionName "1.0"
- }
-
- buildTypes {
- release {
- runProguard false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
- }
- }
-}
-
-dependencies {
- compile 'com.google.android.gms:play-services:5.0.+'
- compile "com.android.support:support-v13:20.0.+"
- wearApp project(':Wearable')
-}
diff --git a/samples/wearable/Quiz/Application/proguard-rules.txt b/samples/wearable/Quiz/Application/proguard-rules.txt
deleted file mode 100644
index 08e5bdc8d..000000000
--- a/samples/wearable/Quiz/Application/proguard-rules.txt
+++ /dev/null
@@ -1,22 +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 *;
-#}
--dontwarn android.support.wearable.view.DelayedConfirmationView
--dontwarn android.support.wearable.view.CircledImageView
diff --git a/samples/wearable/Quiz/Application/src/main/AndroidManifest.xml b/samples/wearable/Quiz/Application/src/main/AndroidManifest.xml
deleted file mode 100644
index faf65f62b..000000000
--- a/samples/wearable/Quiz/Application/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.wearable.quiz" >
-
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@style/AppTheme">
- <meta-data android:name="com.google.android.gms.version"
- android:value="@integer/google_play_services_version" />
-
- <activity
- android:name="com.example.android.wearable.quiz.MainActivity"
- android:label="@string/app_name"
- android:windowSoftInputMode="stateHidden"
- android:configChanges="keyboardHidden|orientation|screenSize" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
-
- </application>
-
-</manifest>
diff --git a/samples/wearable/Quiz/Application/src/main/assets/Quiz.json b/samples/wearable/Quiz/Application/src/main/assets/Quiz.json
deleted file mode 100644
index db2448d9d..000000000
--- a/samples/wearable/Quiz/Application/src/main/assets/Quiz.json
+++ /dev/null
@@ -1,124 +0,0 @@
-{
-"questions": [
-{
-"question": "What is the scientific name of a butterfly?",
-"answers": [
-"Apis",
-"Coleoptera",
-"Formicidae",
-"Rhopalocera"
-],
-"correctIndex": 3
-},
-{
-"question": "How hot is the surface of the sun?",
-"answers": [
-"1,233 K",
-"5,778 K",
-"12,130 K",
-"101,300 K"
-],
-"correctIndex": 1
-},
-{
-"question": "Who are the actors in The Internship?",
-"answers": [
-"Ben Stiller, Jonah Hill",
-"Courteney Cox, Matt LeBlanc",
-"Kaley Cuoco, Jim Parsons",
-"Vince Vaughn, Owen Wilson"
-],
-"correctIndex": 3
-},
-{
-"question": "What is the capital of Spain?",
-"answers": [
-"Berlin",
-"Buenos Aires",
-"Madrid",
-"San Juan"
-],
-"correctIndex": 2
-},
-{
-"question": "What are the school colors of the University of Texas at Austin?",
-"answers": [
-"Black, Red",
-"Blue, Orange",
-"White, Burnt Orange",
-"White, Old gold, Gold"
-],
-"correctIndex": 2
-},
-{
-"question": "What is 70 degrees Fahrenheit in Celsius?",
-"answers": [
-"18.8889",
-"20",
-"21.1111",
-"158"
-],
-"correctIndex": 2
-},
-{
-"question": "When was Mahatma Gandhi born?",
-"answers": [
-"October 2, 1869",
-"December 15, 1872",
-"July 18, 1918",
-"January 15, 1929"
-],
-"correctIndex": 0
-},
-{
-"question": "How far is the moon from Earth?",
-"answers": [
-"7,918 miles (12,742 km)",
-"86,881 miles (139,822 km)",
-"238,400 miles (384,400 km)",
-"35,980,000 miles (57,910,000 km)"
-],
-"correctIndex": 2
-},
-{
-"question": "What is 65 times 52?",
-"answers": [
-"117",
-"3120",
-"3380",
-"3520"
-],
-"correctIndex": 2
-},
-{
-"question": "How tall is Mount Everest?",
-"answers": [
-"6,683 ft (2,037 m)",
-"7,918 ft (2,413 m)",
-"19,341 ft (5,895 m)",
-"29,029 ft (8,847 m)"
-],
-"correctIndex": 3
-},
-{
-"question": "When did The Avengers come out?",
-"answers": [
-"May 2, 2008",
-"May 4, 2012",
-"May 3, 2013",
-"April 4, 2014"
-],
-"correctIndex": 1
-},
-{
-"question": "What is 48,879 in hexidecimal?",
-"answers": [
-"0x18C1",
-"0xBEEF",
-"0xDEAD",
-"0x12D591"
-],
-"correctIndex": 1
-}
-]
-} \ No newline at end of file
diff --git a/samples/wearable/Quiz/Application/src/main/java/com/example/android/wearable/quiz/MainActivity.java b/samples/wearable/Quiz/Application/src/main/java/com/example/android/wearable/quiz/MainActivity.java
deleted file mode 100644
index c860d59f7..000000000
--- a/samples/wearable/Quiz/Application/src/main/java/com/example/android/wearable/quiz/MainActivity.java
+++ /dev/null
@@ -1,585 +0,0 @@
-/*
- * Copyright (C) 2014 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.wearable.quiz;
-
-import static com.example.android.wearable.quiz.Constants.ANSWERS;
-import static com.example.android.wearable.quiz.Constants.CHOSEN_ANSWER_CORRECT;
-import static com.example.android.wearable.quiz.Constants.CORRECT_ANSWER_INDEX;
-import static com.example.android.wearable.quiz.Constants.NUM_CORRECT;
-import static com.example.android.wearable.quiz.Constants.NUM_INCORRECT;
-import static com.example.android.wearable.quiz.Constants.NUM_SKIPPED;
-import static com.example.android.wearable.quiz.Constants.QUESTION;
-import static com.example.android.wearable.quiz.Constants.QUESTION_INDEX;
-import static com.example.android.wearable.quiz.Constants.QUESTION_WAS_ANSWERED;
-import static com.example.android.wearable.quiz.Constants.QUESTION_WAS_DELETED;
-import static com.example.android.wearable.quiz.Constants.QUIZ_ENDED_PATH;
-import static com.example.android.wearable.quiz.Constants.QUIZ_EXITED_PATH;
-import static com.example.android.wearable.quiz.Constants.RESET_QUIZ_PATH;
-
-import android.app.Activity;
-import android.graphics.Color;
-import android.net.Uri;
-import android.os.Bundle;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.LinearLayout;
-import android.widget.RadioGroup;
-import android.widget.TextView;
-
-import com.google.android.gms.common.ConnectionResult;
-import com.google.android.gms.common.api.GoogleApiClient;
-import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks;
-import com.google.android.gms.common.api.ResultCallback;
-import com.google.android.gms.common.data.FreezableUtils;
-import com.google.android.gms.wearable.DataApi;
-import com.google.android.gms.wearable.DataEvent;
-import com.google.android.gms.wearable.DataEventBuffer;
-import com.google.android.gms.wearable.DataItem;
-import com.google.android.gms.wearable.DataItemBuffer;
-import com.google.android.gms.wearable.DataMap;
-import com.google.android.gms.wearable.DataMapItem;
-import com.google.android.gms.wearable.MessageApi;
-import com.google.android.gms.wearable.MessageEvent;
-import com.google.android.gms.wearable.Node;
-import com.google.android.gms.wearable.NodeApi;
-import com.google.android.gms.wearable.PutDataMapRequest;
-import com.google.android.gms.wearable.PutDataRequest;
-import com.google.android.gms.wearable.Wearable;
-
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.PriorityQueue;
-
-/**
- * Allows the user to create questions, which will be put as notifications on the watch's stream.
- * The status of questions will be updated on the phone when the user answers them.
- */
-public class MainActivity extends Activity implements DataApi.DataListener,
- MessageApi.MessageListener, ConnectionCallbacks,
- GoogleApiClient.OnConnectionFailedListener {
-
- private static final String TAG = "ExampleQuizApp";
- private static final String QUIZ_JSON_FILE = "Quiz.json";
-
- // Various UI components.
- private EditText questionEditText;
- private EditText choiceAEditText;
- private EditText choiceBEditText;
- private EditText choiceCEditText;
- private EditText choiceDEditText;
- private RadioGroup choicesRadioGroup;
- private TextView quizStatus;
- private LinearLayout quizButtons;
- private LinearLayout questionsContainer;
- private Button readQuizFromFileButton;
- private Button resetQuizButton;
-
- private GoogleApiClient mGoogleApiClient;
- private PriorityQueue<Question> mFutureQuestions;
- private int mQuestionIndex = 0;
- private boolean mHasQuestionBeenAsked = false;
-
- // Data to display in end report.
- private int mNumCorrect = 0;
- private int mNumIncorrect = 0;
- private int mNumSkipped = 0;
-
- private static final Map<Integer, Integer> radioIdToIndex;
-
- static {
- Map<Integer, Integer> temp = new HashMap<Integer, Integer>(4);
- temp.put(R.id.choice_a_radio, 0);
- temp.put(R.id.choice_b_radio, 1);
- temp.put(R.id.choice_c_radio, 2);
- temp.put(R.id.choice_d_radio, 3);
- radioIdToIndex = Collections.unmodifiableMap(temp);
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- mGoogleApiClient = new GoogleApiClient.Builder(this)
- .addApi(Wearable.API)
- .addConnectionCallbacks(this)
- .addOnConnectionFailedListener(this)
- .build();
- mFutureQuestions = new PriorityQueue<Question>(10);
-
- // Find UI components to be used later.
- questionEditText = (EditText) findViewById(R.id.question_text);
- choiceAEditText = (EditText) findViewById(R.id.choice_a_text);
- choiceBEditText = (EditText) findViewById(R.id.choice_b_text);
- choiceCEditText = (EditText) findViewById(R.id.choice_c_text);
- choiceDEditText = (EditText) findViewById(R.id.choice_d_text);
- choicesRadioGroup = (RadioGroup) findViewById(R.id.choices_radio_group);
- quizStatus = (TextView) findViewById(R.id.quiz_status);
- quizButtons = (LinearLayout) findViewById(R.id.quiz_buttons);
- questionsContainer = (LinearLayout) findViewById(R.id.questions_container);
- readQuizFromFileButton = (Button) findViewById(R.id.read_quiz_from_file_button);
- resetQuizButton = (Button) findViewById(R.id.reset_quiz_button);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- if (!mGoogleApiClient.isConnected()) {
- mGoogleApiClient.connect();
- }
- }
-
- @Override
- protected void onStop() {
- Wearable.DataApi.removeListener(mGoogleApiClient, this);
- Wearable.MessageApi.removeListener(mGoogleApiClient, this);
-
- // Tell the wearable to end the quiz (counting unanswered questions as skipped), and then
- // disconnect mGoogleApiClient.
- DataMap dataMap = new DataMap();
- dataMap.putInt(NUM_CORRECT, mNumCorrect);
- dataMap.putInt(NUM_INCORRECT, mNumIncorrect);
- if (mHasQuestionBeenAsked) {
- mNumSkipped += 1;
- }
- mNumSkipped += mFutureQuestions.size();
- dataMap.putInt(NUM_SKIPPED, mNumSkipped);
- if (mNumCorrect + mNumIncorrect + mNumSkipped > 0) {
- sendMessageToWearable(QUIZ_EXITED_PATH, dataMap.toByteArray());
- }
-
- clearQuizStatus();
- super.onStop();
- }
-
- @Override
- public void onConnected(Bundle connectionHint) {
- Wearable.DataApi.addListener(mGoogleApiClient, this);
- Wearable.MessageApi.addListener(mGoogleApiClient, this);
- }
-
- @Override
- public void onConnectionSuspended(int cause) {
- // Ignore
- }
-
- @Override
- public void onConnectionFailed(ConnectionResult result) {
- Log.e(TAG, "Failed to connect to Google Play Services");
- }
-
- @Override
- public void onMessageReceived(MessageEvent messageEvent) {
- if (messageEvent.getPath().equals(RESET_QUIZ_PATH)) {
- runOnUiThread(new Runnable() {
- @Override
- public void run() {
- resetQuiz(null);
- }
- });
- }
- }
-
- /**
- * Used to ensure questions with smaller indexes come before questions with larger
- * indexes. For example, question0 should come before question1.
- */
- private static class Question implements Comparable<Question> {
- private String question;
- private int questionIndex;
- private String[] answers;
- private int correctAnswerIndex;
-
- public Question(String question, int questionIndex, String[] answers,
- int correctAnswerIndex) {
- this.question = question;
- this.questionIndex = questionIndex;
- this.answers = answers;
- this.correctAnswerIndex = correctAnswerIndex;
- }
-
- public static Question fromJson(JSONObject questionObject, int questionIndex)
- throws JSONException {
- String question = questionObject.getString(JsonUtils.JSON_FIELD_QUESTION);
- JSONArray answersJsonArray = questionObject.getJSONArray(JsonUtils.JSON_FIELD_ANSWERS);
- String[] answers = new String[JsonUtils.NUM_ANSWER_CHOICES];
- for (int j = 0; j < answersJsonArray.length(); j++) {
- answers[j] = answersJsonArray.getString(j);
- }
- int correctIndex = questionObject.getInt(JsonUtils.JSON_FIELD_CORRECT_INDEX);
- return new Question(question, questionIndex, answers, correctIndex);
- }
-
- @Override
- public int compareTo(Question that) {
- return this.questionIndex - that.questionIndex;
- }
-
- public PutDataRequest toPutDataRequest() {
- PutDataMapRequest request = PutDataMapRequest.create("/question/" + questionIndex);
- DataMap dataMap = request.getDataMap();
- dataMap.putString(QUESTION, question);
- dataMap.putInt(QUESTION_INDEX, questionIndex);
- dataMap.putStringArray(ANSWERS, answers);
- dataMap.putInt(CORRECT_ANSWER_INDEX, correctAnswerIndex);
- return request.asPutDataRequest();
- }
- }
-
- /**
- * Create a quiz, as defined in Quiz.json, when the user clicks on "Read quiz from file."
- * @throws IOException
- */
- public void readQuizFromFile(View view) throws IOException, JSONException {
- clearQuizStatus();
- JSONObject jsonObject = JsonUtils.loadJsonFile(this, QUIZ_JSON_FILE);
- JSONArray jsonArray = jsonObject.getJSONArray(JsonUtils.JSON_FIELD_QUESTIONS);
- for (int i = 0; i < jsonArray.length(); i++) {
- JSONObject questionObject = jsonArray.getJSONObject(i);
- Question question = Question.fromJson(questionObject, mQuestionIndex++);
- addQuestionDataItem(question);
- setNewQuestionStatus(question.question);
- }
- }
-
- /**
- * Adds a question (with answer choices) when user clicks on "Add Question."
- */
- public void addQuestion(View view) {
- // Retrieve the question and answers supplied by the user.
- String question = questionEditText.getText().toString();
- String[] answers = new String[4];
- answers[0] = choiceAEditText.getText().toString();
- answers[1] = choiceBEditText.getText().toString();
- answers[2] = choiceCEditText.getText().toString();
- answers[3] = choiceDEditText.getText().toString();
- int correctAnswerIndex = radioIdToIndex.get(choicesRadioGroup.getCheckedRadioButtonId());
-
- addQuestionDataItem(new Question(question, mQuestionIndex++, answers, correctAnswerIndex));
- setNewQuestionStatus(question);
-
- // Clear the edit boxes to let the user input a new question.
- questionEditText.setText("");
- choiceAEditText.setText("");
- choiceBEditText.setText("");
- choiceCEditText.setText("");
- choiceDEditText.setText("");
- }
-
- /**
- * Adds the questions (and answers) to the wearable's stream by creating a Data Item
- * that will be received on the wearable, which will create corresponding notifications.
- */
- private void addQuestionDataItem(Question question) {
- if (!mHasQuestionBeenAsked) {
- // Ask the question now.
- Wearable.DataApi.putDataItem(mGoogleApiClient, question.toPutDataRequest());
- setHasQuestionBeenAsked(true);
- } else {
- // Enqueue the question to be asked in the future.
- mFutureQuestions.add(question);
- }
- }
-
- /**
- * Sets the question's status to be the default "unanswered." This will be updated when the
- * user chooses an answer for the question on the wearable.
- */
- private void setNewQuestionStatus(String question) {
- quizStatus.setVisibility(View.VISIBLE);
- quizButtons.setVisibility(View.VISIBLE);
- LayoutInflater inflater = LayoutInflater.from(this);
- View questionStatusElem = inflater.inflate(R.layout.question_status_element, null, false);
- ((TextView) questionStatusElem.findViewById(R.id.question)).setText(question);
- ((TextView) questionStatusElem.findViewById(R.id.status))
- .setText(R.string.question_unanswered);
- questionsContainer.addView(questionStatusElem);
- }
-
- @Override
- public void onDataChanged(DataEventBuffer dataEvents) {
- final List<DataEvent> events = FreezableUtils.freezeIterable(dataEvents);
- dataEvents.close();
- runOnUiThread(new Runnable() {
- @Override
- public void run() {
- for (DataEvent event : events) {
- if (event.getType() == DataEvent.TYPE_CHANGED) {
- DataMap dataMap = DataMapItem.fromDataItem(event.getDataItem())
- .getDataMap();
- boolean questionWasAnswered = dataMap.getBoolean(QUESTION_WAS_ANSWERED);
- boolean questionWasDeleted = dataMap.getBoolean(QUESTION_WAS_DELETED);
- if (questionWasAnswered) {
- // Update the answered question's status.
- int questionIndex = dataMap.getInt(QUESTION_INDEX);
- boolean questionCorrect = dataMap.getBoolean(CHOSEN_ANSWER_CORRECT);
- updateQuestionStatus(questionIndex, questionCorrect);
- askNextQuestionIfExists();
- } else if (questionWasDeleted) {
- // Update the deleted question's status by marking it as left blank.
- int questionIndex = dataMap.getInt(QUESTION_INDEX);
- markQuestionLeftBlank(questionIndex);
- askNextQuestionIfExists();
- }
- }
- }
- }
- });
- }
-
- /**
- * Updates the given question based on whether it was answered correctly or not.
- * This involves changing the question's text color and changing the status text for it.
- */
- public void updateQuestionStatus(int questionIndex, boolean questionCorrect) {
- LinearLayout questionStatusElement = (LinearLayout)
- questionsContainer.getChildAt(questionIndex);
- TextView questionText = (TextView) questionStatusElement.findViewById(R.id.question);
- TextView questionStatus = (TextView) questionStatusElement.findViewById(R.id.status);
- if (questionCorrect) {
- questionText.setTextColor(Color.GREEN);
- questionStatus.setText(R.string.question_correct);
- mNumCorrect++;
- } else {
- questionText.setTextColor(Color.RED);
- questionStatus.setText(R.string.question_incorrect);
- mNumIncorrect++;
- }
- }
-
- /**
- * Marks a question as "left blank" when its corresponding question notification is deleted.
- */
- private void markQuestionLeftBlank(int index) {
- LinearLayout questionStatusElement = (LinearLayout) questionsContainer.getChildAt(index);
- if (questionStatusElement != null) {
- TextView questionText = (TextView) questionStatusElement.findViewById(R.id.question);
- TextView questionStatus = (TextView) questionStatusElement.findViewById(R.id.status);
- if (questionStatus.getText().equals(getString(R.string.question_unanswered))) {
- questionText.setTextColor(Color.YELLOW);
- questionStatus.setText(R.string.question_left_blank);
- mNumSkipped++;
- }
- }
- }
-
- /**
- * Asks the next enqueued question if it exists, otherwise ends the quiz.
- */
- private void askNextQuestionIfExists() {
- if (mFutureQuestions.isEmpty()) {
- // Quiz has been completed - send message to wearable to display end report.
- DataMap dataMap = new DataMap();
- dataMap.putInt(NUM_CORRECT, mNumCorrect);
- dataMap.putInt(NUM_INCORRECT, mNumIncorrect);
- dataMap.putInt(NUM_SKIPPED, mNumSkipped);
- sendMessageToWearable(QUIZ_ENDED_PATH, dataMap.toByteArray());
- setHasQuestionBeenAsked(false);
- } else {
- // Ask next question by putting a DataItem that will be received on the wearable.
- Wearable.DataApi.putDataItem(mGoogleApiClient,
- mFutureQuestions.remove().toPutDataRequest());
- setHasQuestionBeenAsked(true);
- }
- }
-
- private void sendMessageToWearable(final String path, final byte[] data) {
- Wearable.NodeApi.getConnectedNodes(mGoogleApiClient).setResultCallback(
- new ResultCallback<NodeApi.GetConnectedNodesResult>() {
- @Override
- public void onResult(NodeApi.GetConnectedNodesResult nodes) {
- for (Node node : nodes.getNodes()) {
- Wearable.MessageApi.sendMessage(mGoogleApiClient, node.getId(), path, data);
- }
-
- if (path.equals(QUIZ_EXITED_PATH) && mGoogleApiClient.isConnected()) {
- mGoogleApiClient.disconnect();
- }
- }
- });
- }
-
- /**
- * Resets the current quiz when Reset Quiz is pressed.
- */
- public void resetQuiz(View view) {
- // Reset quiz status in phone layout.
- for(int i = 0; i < questionsContainer.getChildCount(); i++) {
- LinearLayout questionStatusElement = (LinearLayout) questionsContainer.getChildAt(i);
- TextView questionText = (TextView) questionStatusElement.findViewById(R.id.question);
- TextView questionStatus = (TextView) questionStatusElement.findViewById(R.id.status);
- questionText.setTextColor(Color.WHITE);
- questionStatus.setText(R.string.question_unanswered);
- }
- // Reset data items and notifications on wearable.
- if (mGoogleApiClient.isConnected()) {
- Wearable.DataApi.getDataItems(mGoogleApiClient)
- .setResultCallback(new ResultCallback<DataItemBuffer>() {
- @Override
- public void onResult(DataItemBuffer result) {
- if (result.getStatus().isSuccess()) {
- List<DataItem> dataItemList = FreezableUtils.freezeIterable(result);
- result.close();
- resetDataItems(dataItemList);
- } else {
- if (Log.isLoggable(TAG, Log.DEBUG)) {
- Log.d(TAG, "Reset quiz: failed to get Data Items to reset");
- }
- }
- result.close();
- }
- });
- } else {
- Log.e(TAG, "Failed to reset data items because client is disconnected from "
- + "Google Play Services");
- }
- setHasQuestionBeenAsked(false);
- mNumCorrect = 0;
- mNumIncorrect = 0;
- mNumSkipped = 0;
- }
-
- private void resetDataItems(List<DataItem> dataItemList) {
- if (mGoogleApiClient.isConnected()) {
- for (final DataItem dataItem : dataItemList) {
- final Uri dataItemUri = dataItem.getUri();
- Wearable.DataApi.getDataItem(mGoogleApiClient, dataItemUri)
- .setResultCallback(new ResetDataItemCallback());
- }
- } else {
- Log.e(TAG, "Failed to reset data items because client is disconnected from "
- + "Google Play Services");
- }
- }
-
- /**
- * Callback that marks a DataItem, which represents a question, as unanswered and not deleted.
- */
- private class ResetDataItemCallback implements ResultCallback<DataApi.DataItemResult> {
- @Override
- public void onResult(DataApi.DataItemResult dataItemResult) {
- if (dataItemResult.getStatus().isSuccess()) {
- PutDataMapRequest request = PutDataMapRequest.createFromDataMapItem(
- DataMapItem.fromDataItem(dataItemResult.getDataItem()));
- DataMap dataMap = request.getDataMap();
- dataMap.putBoolean(QUESTION_WAS_ANSWERED, false);
- dataMap.putBoolean(QUESTION_WAS_DELETED, false);
- if (!mHasQuestionBeenAsked && dataMap.getInt(QUESTION_INDEX) == 0) {
- // Ask the first question now.
- Wearable.DataApi.putDataItem(mGoogleApiClient, request.asPutDataRequest());
- setHasQuestionBeenAsked(true);
- } else {
- // Enqueue future questions.
- mFutureQuestions.add(new Question(dataMap.getString(QUESTION),
- dataMap.getInt(QUESTION_INDEX), dataMap.getStringArray(ANSWERS),
- dataMap.getInt(CORRECT_ANSWER_INDEX)));
- }
- } else {
- Log.e(TAG, "Failed to reset data item " + dataItemResult.getDataItem().getUri());
- }
- }
- }
-
- /**
- * Clears the current quiz when user clicks on "New Quiz."
- * On this end, this involves clearing the quiz status layout and deleting all DataItems. The
- * wearable will then remove any outstanding question notifications upon receiving this change.
- */
- public void newQuiz(View view) {
- clearQuizStatus();
- if (mGoogleApiClient.isConnected()) {
- Wearable.DataApi.getDataItems(mGoogleApiClient)
- .setResultCallback(new ResultCallback<DataItemBuffer>() {
- @Override
- public void onResult(DataItemBuffer result) {
- if (result.getStatus().isSuccess()) {
- List<Uri> dataItemUriList = new ArrayList<Uri>();
- for (final DataItem dataItem : result) {
- dataItemUriList.add(dataItem.getUri());
- }
- result.close();
- deleteDataItems(dataItemUriList);
- } else {
- if (Log.isLoggable(TAG, Log.DEBUG)) {
- Log.d(TAG, "Clear quiz: failed to get Data Items for deletion");
- }
- }
- result.close();
- }
- });
- } else {
- Log.e(TAG, "Failed to delete data items because client is disconnected from "
- + "Google Play Services");
- }
- }
-
- /**
- * Removes quiz status views (i.e. the views describing the status of each question).
- */
- private void clearQuizStatus() {
- questionsContainer.removeAllViews();
- quizStatus.setVisibility(View.INVISIBLE);
- quizButtons.setVisibility(View.INVISIBLE);
- setHasQuestionBeenAsked(false);
- mFutureQuestions.clear();
- mQuestionIndex = 0;
- mNumCorrect = 0;
- mNumIncorrect = 0;
- mNumSkipped = 0;
- }
-
- private void deleteDataItems(List<Uri> dataItemUriList) {
- if (mGoogleApiClient.isConnected()) {
- for (final Uri dataItemUri : dataItemUriList) {
- Wearable.DataApi.deleteDataItems(mGoogleApiClient, dataItemUri)
- .setResultCallback(new ResultCallback<DataApi.DeleteDataItemsResult>() {
- @Override
- public void onResult(DataApi.DeleteDataItemsResult deleteResult) {
- if (Log.isLoggable(TAG, Log.DEBUG)) {
- if (deleteResult.getStatus().isSuccess()) {
- Log.d(TAG, "Successfully deleted data item " + dataItemUri);
- } else {
- Log.d(TAG, "Failed to delete data item " + dataItemUri);
- }
- }
- }
- });
- }
- } else {
- Log.e(TAG, "Failed to delete data items because client is disconnected from "
- + "Google Play Services");
- }
- }
-
- private void setHasQuestionBeenAsked(boolean b) {
- mHasQuestionBeenAsked = b;
- // Only let user click on Reset or Read from file if they have answered all the questions.
- readQuizFromFileButton.setEnabled(!mHasQuestionBeenAsked);
- resetQuizButton.setEnabled(!mHasQuestionBeenAsked);
- }
-}
diff --git a/samples/wearable/Quiz/Application/src/main/res/values/strings.xml b/samples/wearable/Quiz/Application/src/main/res/values/strings.xml
deleted file mode 100644
index 7c0c2452b..000000000
--- a/samples/wearable/Quiz/Application/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<resources>
-
- <string name="app_name">Quiz</string>
-
- <string name="read_from_file_button">Read quiz from file</string>
-
- <string name="edit_question">Question</string>
- <string name="edit_choice_a">Choice A</string>
- <string name="edit_choice_b">Choice B</string>
- <string name="edit_choice_c">Choice C</string>
- <string name="edit_choice_d">Choice D</string>
- <string name="add_question">Add Question</string>
-
- <string name="quiz_status">Quiz Status</string>
- <string name="question_placeholder">Question</string>
- <string name="question_unanswered">This question has not yet been answered.</string>
- <string name="question_incorrect">This question has been answered incorrectly.</string>
- <string name="question_correct">This question has been answered correctly!</string>
- <string name="question_left_blank">This question was left blank.</string>
-
- <string name="reset_quiz">Reset Quiz</string>
- <string name="new_quiz">New Quiz</string>
-
-</resources>
diff --git a/samples/wearable/Quiz/Application/src/main/res/values/styles.xml b/samples/wearable/Quiz/Application/src/main/res/values/styles.xml
deleted file mode 100644
index cf0494b4b..000000000
--- a/samples/wearable/Quiz/Application/src/main/res/values/styles.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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. -->
- <style name="AppTheme" parent="android:Theme.Holo">
- <!-- Customize your theme here. -->
- </style>
-
- <style name="bg_picker">
- <item name="android:layout_marginLeft">16dp</item>
- <item name="android:background">@drawable/unselected_background</item>
- </style>
-
-</resources>
diff --git a/samples/wearable/Quiz/Wearable/build.gradle b/samples/wearable/Quiz/Wearable/build.gradle
deleted file mode 100644
index de43728e0..000000000
--- a/samples/wearable/Quiz/Wearable/build.gradle
+++ /dev/null
@@ -1,25 +0,0 @@
-apply plugin: 'android'
-
-android {
- compileSdkVersion 20
- buildToolsVersion '20'
-
- defaultConfig {
- minSdkVersion 20
- targetSdkVersion 20
- versionCode 1
- versionName "1.0"
- }
-
- buildTypes {
- release {
- runProguard false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
- }
- }
-}
-
-dependencies {
- compile 'com.google.android.gms:play-services-wearable:+'
- compile "com.google.android.support:wearable:1.0.+"
-}
diff --git a/samples/wearable/Quiz/Wearable/proguard-rules.txt b/samples/wearable/Quiz/Wearable/proguard-rules.txt
deleted file mode 100644
index f2fe1559a..000000000
--- a/samples/wearable/Quiz/Wearable/proguard-rules.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/samples/wearable/Quiz/Wearable/src/main/AndroidManifest.xml b/samples/wearable/Quiz/Wearable/src/main/AndroidManifest.xml
deleted file mode 100644
index 3b8a3184f..000000000
--- a/samples/wearable/Quiz/Wearable/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.wearable.quiz" >
-
- <uses-feature android:name="android.hardware.type.watch" />
-
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@android:style/Theme.DeviceDefault" >
- <meta-data
- android:name="com.google.android.gms.version"
- android:value="@integer/google_play_services_version" />
-
- <service android:name=".QuizListenerService" >
- <intent-filter>
- <action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
- </intent-filter>
- </service>
- <service android:name=".UpdateQuestionService" />
- <service android:name=".DeleteQuestionService" />
- <service android:name=".QuizReportActionService" />
-
- </application>
-
-</manifest>
diff --git a/samples/wearable/Quiz/_index.html b/samples/wearable/Quiz/_index.html
deleted file mode 100644
index 98746112a..000000000
--- a/samples/wearable/Quiz/_index.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<p><b>About:</b> This sample uses Google Play Services Wearable Data APIs to communicate between
-applications on a phone and a paired wearable device. Users can create quiz questions on the phone,
-each of which has an associated DataItem. These DataItems are then received on the wearable, which
-displays them as notifications. Each notification contains the question as the first page, followed
-by answers as actions. When an answer is selected, the corresponding question's DataItem is updated,
-which allows the phone application to update the status of the question (i.e. did the user answer it
-correctly or not) and prompt the next question.
-</p>
-<p>At the end of the quiz, the sample uses the Google Play Services Wearable Message APIs to create
-an end-of-quiz report notification on the wearable, with an option to reset the quiz (by sending a
-message back to the phone).</p>
-<p><b>How to run:</b> Install the Application APK on the companion, and the Wearable APK on the
-wearable. Start the sample by running the Quiz application on the companion.</p>
-<p><b>Wearable APIs used:</b> DataApi, MessageApi, NodeApi, WearableListenerService</p>
-<p><b>Screenshots:</b>
- <figure>
- <img src="screenshots/companion_quiz.png" alt="Quiz on companion" width="216" height="384">
- <img src="screenshots/wearable_quiz.png" alt="Wearable Quiz" width="160" height="160">
- <img src="screenshots/wearable_quiz_answer.png" alt="Answering..." width="160" height="160">
- <img src="screenshots/companion_quiz_correct_status.png" alt="Quiz on companion" width="216"
- height="384">
- <img src="screenshots/wearable_quiz_report.png" alt="End report" width="160" height="160">
- <figcaption>Sample quiz progression involving a clearly unbiased question.</figcaption>
- </figure>
-</p>
diff --git a/samples/wearable/Quiz/build.gradle b/samples/wearable/Quiz/build.gradle
deleted file mode 100644
index 8bd4ffc49..000000000
--- a/samples/wearable/Quiz/build.gradle
+++ /dev/null
@@ -1,14 +0,0 @@
-buildscript {
- repositories {
- mavenCentral()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:0.12.+'
- }
-}
-
-allprojects {
- repositories {
- mavenCentral()
- }
-}
diff --git a/samples/wearable/Quiz/gradle.properties b/samples/wearable/Quiz/gradle.properties
deleted file mode 100644
index 5d08ba75b..000000000
--- a/samples/wearable/Quiz/gradle.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-# Project-wide Gradle settings.
-
-# IDE (e.g. Android Studio) users:
-# Settings specified in this file will override any Gradle settings
-# configured through the IDE.
-
-# For more details on how to configure your build environment visit
-# http://www.gradle.org/docs/current/userguide/build_environment.html
-
-# Specifies the JVM arguments used for the daemon process.
-# The setting is particularly useful for tweaking memory settings.
-# Default value: -Xmx10248m -XX:MaxPermSize=256m
-# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
-
-# When configured, Gradle will run in incubating parallel mode.
-# This option should only be used with decoupled projects. More details, visit
-# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
-# org.gradle.parallel=true \ No newline at end of file
diff --git a/samples/wearable/Quiz/gradle/wrapper/gradle-wrapper.jar b/samples/wearable/Quiz/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index 8c0fb64a8..000000000
--- a/samples/wearable/Quiz/gradle/wrapper/gradle-wrapper.jar
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/Quiz/gradle/wrapper/gradle-wrapper.properties b/samples/wearable/Quiz/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index 1e61d1fd3..000000000
--- a/samples/wearable/Quiz/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-#Wed Apr 10 15:27:10 PDT 2013
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip
diff --git a/samples/wearable/Quiz/gradlew b/samples/wearable/Quiz/gradlew
deleted file mode 100755
index 91a7e269e..000000000
--- a/samples/wearable/Quiz/gradlew
+++ /dev/null
@@ -1,164 +0,0 @@
-#!/usr/bin/env bash
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn ( ) {
- echo "$*"
-}
-
-die ( ) {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
-esac
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched.
-if $cygwin ; then
- [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-fi
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >&-
-APP_HOME="`pwd -P`"
-cd "$SAVED" >&-
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
-}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
-
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/samples/wearable/Quiz/gradlew.bat b/samples/wearable/Quiz/gradlew.bat
deleted file mode 100755
index aec99730b..000000000
--- a/samples/wearable/Quiz/gradlew.bat
+++ /dev/null
@@ -1,90 +0,0 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/samples/wearable/Quiz/screenshots/companion_quiz.png b/samples/wearable/Quiz/screenshots/companion_quiz.png
deleted file mode 100644
index 15f7e8030..000000000
--- a/samples/wearable/Quiz/screenshots/companion_quiz.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/Quiz/screenshots/companion_quiz_correct_status.png b/samples/wearable/Quiz/screenshots/companion_quiz_correct_status.png
deleted file mode 100644
index c0e25ca58..000000000
--- a/samples/wearable/Quiz/screenshots/companion_quiz_correct_status.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/Quiz/screenshots/wearable_quiz.png b/samples/wearable/Quiz/screenshots/wearable_quiz.png
deleted file mode 100644
index 0c631390e..000000000
--- a/samples/wearable/Quiz/screenshots/wearable_quiz.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/Quiz/screenshots/wearable_quiz_answer.png b/samples/wearable/Quiz/screenshots/wearable_quiz_answer.png
deleted file mode 100644
index eb4751615..000000000
--- a/samples/wearable/Quiz/screenshots/wearable_quiz_answer.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/Quiz/screenshots/wearable_quiz_report.png b/samples/wearable/Quiz/screenshots/wearable_quiz_report.png
deleted file mode 100644
index 196d04595..000000000
--- a/samples/wearable/Quiz/screenshots/wearable_quiz_report.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/Quiz/settings.gradle b/samples/wearable/Quiz/settings.gradle
deleted file mode 100644
index d6b72d158..000000000
--- a/samples/wearable/Quiz/settings.gradle
+++ /dev/null
@@ -1 +0,0 @@
-include 'Application', 'Wearable'
diff --git a/samples/wearable/RecipeAssistant/Application/build.gradle b/samples/wearable/RecipeAssistant/Application/build.gradle
deleted file mode 100644
index 7abc52428..000000000
--- a/samples/wearable/RecipeAssistant/Application/build.gradle
+++ /dev/null
@@ -1,24 +0,0 @@
-apply plugin: 'android'
-
-android {
- compileSdkVersion 18
- buildToolsVersion '20'
-
- defaultConfig {
- minSdkVersion 18
- targetSdkVersion 19
- versionCode 1
- versionName "1.0"
- }
-
- buildTypes {
- release {
- runProguard false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
- }
- }
-}
-
-dependencies {
- compile "com.android.support:support-v4:20.0.+"
-}
diff --git a/samples/wearable/RecipeAssistant/Application/proguard-rules.txt b/samples/wearable/RecipeAssistant/Application/proguard-rules.txt
deleted file mode 100644
index 08e5bdc8d..000000000
--- a/samples/wearable/RecipeAssistant/Application/proguard-rules.txt
+++ /dev/null
@@ -1,22 +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 *;
-#}
--dontwarn android.support.wearable.view.DelayedConfirmationView
--dontwarn android.support.wearable.view.CircledImageView
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/AndroidManifest.xml b/samples/wearable/RecipeAssistant/Application/src/main/AndroidManifest.xml
deleted file mode 100644
index fd5a1638c..000000000
--- a/samples/wearable/RecipeAssistant/Application/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.wearable.recipeassistant" >
-
- <application
- android:allowBackup="true"
- android:icon="@mipmap/ic_app_recipe"
- android:label="@string/app_name"
- android:theme="@android:style/Theme.Holo.Light" >
- <activity
- android:name=".MainActivity"
- android:label="@string/app_name" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <activity
- android:name=".RecipeActivity"
- android:label="@string/app_name" >
- </activity>
- <service
- android:name=".RecipeService" />
- </application>
-
-</manifest>
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/assets/beef-brisket-chili.json b/samples/wearable/RecipeAssistant/Application/src/main/assets/beef-brisket-chili.json
deleted file mode 100644
index 19598f9e5..000000000
--- a/samples/wearable/RecipeAssistant/Application/src/main/assets/beef-brisket-chili.json
+++ /dev/null
@@ -1,91 +0,0 @@
-{
-name: "beef-brisket-chili.json",
-steps: [
-{
-text: "Place the cinnamon stick, cumin, paprika and oregano in a pestle and mortar. Bash and grind until the cinnamon is in very small flakes. ",
-img: "step-1-grind-spices.jpg"
-},
-{
-text: "Score the beef and rub the spice mix into the cuts. ",
-img: "step-2-score-beef.jpg"
-},
-{
-text: "Season the beef and drizzle with olive oil. Brown in a hot pan. ",
-img: "step-3-brown-beef.jpg"
-},
-{
-text: "Finely slice the onion and fry in a little olive oil together with the chillies, finely sliced. You can control the heat of your chili by deseeding some of the chillies. ",
-img: "step-4-fry-onion.jpg"
-},
-{
-text: "Add the browned brisket to the pan with the onions and chillies and fry on a low heat."
-},
-{
-text: "Place the bell peppers, roughly sliced, the bay leaves and chopped tomatoes in a large covered pot. Bring to the boil and then add the beef, onions and chillies. ",
-img: "step-6-combine.jpg"
-},
-{
-text: "Bring back to the boil, cover and allow to simmer on a low heat for 4 hours."
-},
-{
-text: "Remove the brisket from the pot, place on a large plate and use two forks to pull the beef apart into individual pieces. ",
-img: "step-8-pull.jpg"
-},
-{
-text: "Remove the bay leaves and add the pulled beef and coriander back to the pot, together with the kidney beans."
-},
-{
-text: "Bring back to the boil and simmer gently for a further 15 - 20 mins."
-}
-],
-summary: "",
-title: "Beef brisket chili",
-img: "chili.jpg",
-serving: [
-"Serve with rice, yoghurt and fresh guacamole. Garnish with the remaining coriander."
-],
-ingredients: [
-{
-text: "3 lbs beef brisket"
-},
-{
-text: "2 red onions"
-},
-{
-text: "4 jalapeno chillies"
-},
-{
-text: "1 large cinnamon stick"
-},
-{
-text: "1 tbsp ground cumin"
-},
-{
-text: "1 tbsp paprika"
-},
-{
-text: "1 heaped tbsp dried oregano"
-},
-{
-text: "2 fresh bay leaves"
-},
-{
-text: "2 red bell peppers"
-},
-{
-text: "2 green bell peppers"
-},
-{
-text: "800g tin chopped tomatoes"
-},
-{
-text: "400g tin kidney beans"
-},
-{
-text: "400ml beef stock"
-},
-{
-text: "1/2 bunch coriander"
-}
-]
-} \ No newline at end of file
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/assets/chili.jpg b/samples/wearable/RecipeAssistant/Application/src/main/assets/chili.jpg
deleted file mode 100644
index ca5f7510f..000000000
--- a/samples/wearable/RecipeAssistant/Application/src/main/assets/chili.jpg
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/assets/guacamole.jpg b/samples/wearable/RecipeAssistant/Application/src/main/assets/guacamole.jpg
deleted file mode 100644
index 77175eb88..000000000
--- a/samples/wearable/RecipeAssistant/Application/src/main/assets/guacamole.jpg
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/assets/guacamole.json b/samples/wearable/RecipeAssistant/Application/src/main/assets/guacamole.json
deleted file mode 100644
index 5fae53fe1..000000000
--- a/samples/wearable/RecipeAssistant/Application/src/main/assets/guacamole.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
-name: "guacamole.json",
-steps: [
-{
-text: "Use a spoon to scoop the flesh of the avocados into a bowl."
-},
-{
-text: "Mash with a fork until fairly smooth and creamy. Preserve some small solid chunks to add texture."
-},
-{
-text: "Add the juice of the lime. ",
-img: "step-3-lime.jpg"
-},
-{
-text: "Add the cilantro."
-},
-{
-text: "Mix thoroughly."
-}
-],
-summary: "Some guacamole recipes call for many ingredients and can be a pain to prepare. This super simple guac can be thrown together in a couple of minutes and tastes great.",
-title: "Super simple guacamole",
-img: "guacamole.jpg",
-serving: "",
-ingredients: [
-{
-text: "2 ripe avocados"
-},
-{
-text: "1 lime"
-},
-{
-text: "2 tbsp cilantro"
-}
-]
-} \ No newline at end of file
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/assets/irish-stew.jpg b/samples/wearable/RecipeAssistant/Application/src/main/assets/irish-stew.jpg
deleted file mode 100644
index 0c20766fd..000000000
--- a/samples/wearable/RecipeAssistant/Application/src/main/assets/irish-stew.jpg
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/assets/northern-irish-vegetable-soup.json b/samples/wearable/RecipeAssistant/Application/src/main/assets/northern-irish-vegetable-soup.json
deleted file mode 100644
index 55d259190..000000000
--- a/samples/wearable/RecipeAssistant/Application/src/main/assets/northern-irish-vegetable-soup.json
+++ /dev/null
@@ -1,46 +0,0 @@
-{
-name: "northern-irish-vegetable-soup.json",
-steps: [
-{
-text: "Place the beef in a large stock pot, cover with water and stew for 1 - 2 hours."
-},
-{
-text: "Allow the stock to cool, skim off any fat."
-},
-{
-text: "Add the soup mix to the stock, bring to the boil and simmer for 1 hour."
-},
-{
-text: "Roughly chop the leeks (green and white parts), onion, carrots, celery and parsley. Add to the soup. Season well and simmer until the vegetables are soft."
-}
-],
-summary: "This recipe is apparently unique to Northern Ireland and uses soup/herb celery which is hard to find outside the area, but regular table celery can be substituted (including the leaves).",
-title: "Northern irish vegetable soup",
-img: "irish-stew.jpg",
-serving: [
-"Whole boiled potatoes are traditionally placed in the soup at time of serving."
-],
-ingredients: [
-{
-text: "2 lbs beef shin or similar beef on bone"
-},
-{
-text: "60g soup mix (30g barley, 15g red lentils, 15g split peas)"
-},
-{
-text: "3 carrots"
-},
-{
-text: "1 white onion"
-},
-{
-text: "field celery or 1 stalk celery, plus any leaves on the bunch"
-},
-{
-text: "2 leeks"
-},
-{
-text: "1 bunch parsley"
-}
-]
-} \ No newline at end of file
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/assets/recipelist.json b/samples/wearable/RecipeAssistant/Application/src/main/assets/recipelist.json
deleted file mode 100644
index efd787d35..000000000
--- a/samples/wearable/RecipeAssistant/Application/src/main/assets/recipelist.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
-recipe_list:
-[
-{
-name: "guacamole.json",
-summary: "Some guacamole recipes call for many ingredients and can be a pain to prepare. This super simple guac can be thrown together in a couple of minutes and tastes great.",
-title: "Super simple guacamole",
-img: "guacamole.jpg"
-},
-{
-name: "northern-irish-vegetable-soup.json",
-summary: "This recipe is apparently unique to Northern Ireland and uses soup/herb celery which is hard to find outside the area, but regular table celery can be substituted (including the leaves).",
-title: "Northern irish vegetable soup",
-img: "irish-stew.jpg"
-},
-{
-name: "beef-brisket-chili.json",
-summary: "",
-title: "Beef brisket chili",
-img: "chili.jpg"
-}
-]
-} \ No newline at end of file
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/assets/step-1-grind-spices.jpg b/samples/wearable/RecipeAssistant/Application/src/main/assets/step-1-grind-spices.jpg
deleted file mode 100644
index 9b5f2b978..000000000
--- a/samples/wearable/RecipeAssistant/Application/src/main/assets/step-1-grind-spices.jpg
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/assets/step-2-score-beef.jpg b/samples/wearable/RecipeAssistant/Application/src/main/assets/step-2-score-beef.jpg
deleted file mode 100644
index 66c549dfa..000000000
--- a/samples/wearable/RecipeAssistant/Application/src/main/assets/step-2-score-beef.jpg
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/assets/step-3-brown-beef.jpg b/samples/wearable/RecipeAssistant/Application/src/main/assets/step-3-brown-beef.jpg
deleted file mode 100644
index 1bb801e6e..000000000
--- a/samples/wearable/RecipeAssistant/Application/src/main/assets/step-3-brown-beef.jpg
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/assets/step-3-lime.jpg b/samples/wearable/RecipeAssistant/Application/src/main/assets/step-3-lime.jpg
deleted file mode 100644
index b615d5587..000000000
--- a/samples/wearable/RecipeAssistant/Application/src/main/assets/step-3-lime.jpg
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/assets/step-4-fry-onion.jpg b/samples/wearable/RecipeAssistant/Application/src/main/assets/step-4-fry-onion.jpg
deleted file mode 100644
index b5d2a1875..000000000
--- a/samples/wearable/RecipeAssistant/Application/src/main/assets/step-4-fry-onion.jpg
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/assets/step-6-combine.jpg b/samples/wearable/RecipeAssistant/Application/src/main/assets/step-6-combine.jpg
deleted file mode 100644
index fe2940578..000000000
--- a/samples/wearable/RecipeAssistant/Application/src/main/assets/step-6-combine.jpg
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/assets/step-8-pull.jpg b/samples/wearable/RecipeAssistant/Application/src/main/assets/step-8-pull.jpg
deleted file mode 100644
index f8288a849..000000000
--- a/samples/wearable/RecipeAssistant/Application/src/main/assets/step-8-pull.jpg
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/values/strings.xml b/samples/wearable/RecipeAssistant/Application/src/main/res/values/strings.xml
deleted file mode 100644
index 86da78c84..000000000
--- a/samples/wearable/RecipeAssistant/Application/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<resources>
- <string name="app_name">Recipe Assistant</string>
- <string name="action_settings">Settings</string>
- <string name="action_cook">Start</string>
- <string name="steps">Steps</string>
- <string name="ingredients">Ingredients</string>
- <string name="step_count">Step %1$d of %2$d</string>
-</resources>
diff --git a/samples/wearable/RecipeAssistant/_index.html b/samples/wearable/RecipeAssistant/_index.html
deleted file mode 100644
index 80dc20078..000000000
--- a/samples/wearable/RecipeAssistant/_index.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<p><b>About:</b> This phone application uses the enhanced notifications API to display recipe
-instructions using paged notifications. After starting the application on your phone, you can browse
-from a short list of recipes and select one to view. Each recipe is broken down into a number of
-steps; when ready, you can click on the START action in the action bar to send the steps to the
-wearable. On the wearable device, the steps are displayed as a multi-page notification, with one
-page for each step in the recipe.</p>
-<p><b>How to run:</b> Install the Application APK on the companion and run it like any other
-Android app.</p>
-<p><b>Screenshots:</b>
- <figure>
- <img src="screenshots/recipe_assistant_guac.png" alt="Super simple guacamole" width="216"
- height="384">
- <img src="screenshots/guac_notification.png" alt="Guacamole wearable notification"
- width="160" height="160">
- <img src="screenshots/guac_notification_step1.png" alt="Guacamole step 1" width="160"
- height="160">
- <figcaption>Making guacamole!</figcaption>
- </figure>
-</p> \ No newline at end of file
diff --git a/samples/wearable/RecipeAssistant/build.gradle b/samples/wearable/RecipeAssistant/build.gradle
deleted file mode 100644
index 8bd4ffc49..000000000
--- a/samples/wearable/RecipeAssistant/build.gradle
+++ /dev/null
@@ -1,14 +0,0 @@
-buildscript {
- repositories {
- mavenCentral()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:0.12.+'
- }
-}
-
-allprojects {
- repositories {
- mavenCentral()
- }
-}
diff --git a/samples/wearable/RecipeAssistant/gradle/wrapper/gradle-wrapper.jar b/samples/wearable/RecipeAssistant/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index 8c0fb64a8..000000000
--- a/samples/wearable/RecipeAssistant/gradle/wrapper/gradle-wrapper.jar
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/RecipeAssistant/gradle/wrapper/gradle-wrapper.properties b/samples/wearable/RecipeAssistant/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index 1e61d1fd3..000000000
--- a/samples/wearable/RecipeAssistant/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-#Wed Apr 10 15:27:10 PDT 2013
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip
diff --git a/samples/wearable/RecipeAssistant/gradlew b/samples/wearable/RecipeAssistant/gradlew
deleted file mode 100755
index 91a7e269e..000000000
--- a/samples/wearable/RecipeAssistant/gradlew
+++ /dev/null
@@ -1,164 +0,0 @@
-#!/usr/bin/env bash
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn ( ) {
- echo "$*"
-}
-
-die ( ) {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
-esac
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched.
-if $cygwin ; then
- [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-fi
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >&-
-APP_HOME="`pwd -P`"
-cd "$SAVED" >&-
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
-}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
-
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/samples/wearable/RecipeAssistant/gradlew.bat b/samples/wearable/RecipeAssistant/gradlew.bat
deleted file mode 100755
index aec99730b..000000000
--- a/samples/wearable/RecipeAssistant/gradlew.bat
+++ /dev/null
@@ -1,90 +0,0 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/samples/wearable/RecipeAssistant/screenshots/guac_notification.png b/samples/wearable/RecipeAssistant/screenshots/guac_notification.png
deleted file mode 100644
index e041b11ec..000000000
--- a/samples/wearable/RecipeAssistant/screenshots/guac_notification.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/RecipeAssistant/screenshots/guac_notification_step1.png b/samples/wearable/RecipeAssistant/screenshots/guac_notification_step1.png
deleted file mode 100644
index e0157ea7e..000000000
--- a/samples/wearable/RecipeAssistant/screenshots/guac_notification_step1.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/RecipeAssistant/screenshots/recipe_assistant_guac.png b/samples/wearable/RecipeAssistant/screenshots/recipe_assistant_guac.png
deleted file mode 100644
index a34da6e68..000000000
--- a/samples/wearable/RecipeAssistant/screenshots/recipe_assistant_guac.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/RecipeAssistant/settings.gradle b/samples/wearable/RecipeAssistant/settings.gradle
deleted file mode 100644
index aa94981a3..000000000
--- a/samples/wearable/RecipeAssistant/settings.gradle
+++ /dev/null
@@ -1 +0,0 @@
-include 'Application' \ No newline at end of file
diff --git a/samples/wearable/SkeletonWearableApp/Wearable/build.gradle b/samples/wearable/SkeletonWearableApp/Wearable/build.gradle
deleted file mode 100644
index b9450ca9a..000000000
--- a/samples/wearable/SkeletonWearableApp/Wearable/build.gradle
+++ /dev/null
@@ -1,24 +0,0 @@
-apply plugin: 'android'
-
-android {
- compileSdkVersion 20
- buildToolsVersion '20'
-
- defaultConfig {
- minSdkVersion 20
- targetSdkVersion 20
- versionCode 1
- versionName "1.0"
- }
-
- buildTypes {
- release {
- runProguard false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
- }
- }
-}
-
-dependencies {
- compile "com.google.android.support:wearable:1.0.+"
-}
diff --git a/samples/wearable/SkeletonWearableApp/Wearable/proguard-rules.txt b/samples/wearable/SkeletonWearableApp/Wearable/proguard-rules.txt
deleted file mode 100644
index 2ddbcfcdd..000000000
--- a/samples/wearable/SkeletonWearableApp/Wearable/proguard-rules.txt
+++ /dev/null
@@ -1,21 +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 *;
-#}
--dontwarn android.support.wearable.view.DelayedConfirmationView
diff --git a/samples/wearable/SkeletonWearableApp/Wearable/src/main/AndroidManifest.xml b/samples/wearable/SkeletonWearableApp/Wearable/src/main/AndroidManifest.xml
deleted file mode 100644
index 062e0dd7f..000000000
--- a/samples/wearable/SkeletonWearableApp/Wearable/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.google.wearable.app" >
-
- <uses-feature android:name="android.hardware.type.watch" />
-
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@android:style/Theme.DeviceDefault">
- <activity
- android:name="com.example.android.google.wearable.app.MainActivity"
- android:label="@string/app_name">
- <intent-filter>
- <action android:name="android.intent.action.MAIN"/>
- <category android:name="android.intent.category.LAUNCHER"/>
- </intent-filter>
- <intent-filter>
- <action android:name="com.google.android.clockwork.example.SKELETON"/>
- <category android:name="android.intent.category.DEFAULT"/>
- </intent-filter>
- </activity>
- <activity
- android:name="com.example.android.google.wearable.app.GridExampleActivity">
- <intent-filter>
- <action android:name="com.example.android.google.wearable.app.GRID_ACTIVITY"/>
- <category android:name="android.intent.category.DEFAULT"/>
- </intent-filter>
- </activity>
- </application>
-
-</manifest>
diff --git a/samples/wearable/SkeletonWearableApp/Wearable/src/main/java/com/example/android/google/wearable/app/GridExampleActivity.java b/samples/wearable/SkeletonWearableApp/Wearable/src/main/java/com/example/android/google/wearable/app/GridExampleActivity.java
deleted file mode 100644
index 0a88c04d0..000000000
--- a/samples/wearable/SkeletonWearableApp/Wearable/src/main/java/com/example/android/google/wearable/app/GridExampleActivity.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (C) 2014 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.google.wearable.app;
-
-import android.app.Activity;
-import android.app.Fragment;
-import android.app.FragmentManager;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.Paint;
-import android.graphics.Point;
-import android.graphics.Typeface;
-import android.os.Bundle;
-import android.support.wearable.view.CardFragment;
-import android.support.wearable.view.FragmentGridPagerAdapter;
-import android.support.wearable.view.GridViewPager;
-import android.support.wearable.view.ImageReference;
-import java.util.HashMap;
-import java.util.Map;
-
-public class GridExampleActivity extends Activity {
- private static final int NUM_ROWS = 10;
- private static final int NUM_COLS = 3;
-
- MainAdapter mAdapter;
- GridViewPager mPager;
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.grid_activity);
- mPager = (GridViewPager) findViewById(R.id.fragment_container);
- mAdapter = new MainAdapter(getFragmentManager());
- mPager.setAdapter(mAdapter);
-
- }
-
- private static class MainAdapter extends FragmentGridPagerAdapter{
- Map<Point, ImageReference> mBackgrounds = new HashMap<Point, ImageReference>();
-
- public MainAdapter(FragmentManager fm) {
- super(fm);
- }
-
- @Override
- public int getRowCount() {
- return NUM_ROWS;
- }
-
- @Override
- public int getColumnCount(int rowNum) {
- return NUM_COLS;
- }
-
- @Override
- public Fragment getFragment(int rowNum, int colNum) {
- return MainFragment.newInstance(rowNum, colNum);
- }
-
- @Override
- public ImageReference getBackground(int row, int column) {
- Point pt = new Point(column, row);
- ImageReference ref = mBackgrounds.get(pt);
- if (ref == null) {
- Bitmap bm = Bitmap.createBitmap(200, 200, Bitmap.Config.ARGB_8888);
- Canvas c = new Canvas(bm);
- Paint p = new Paint();
- // Clear previous image.
- c.drawRect(0, 0, 200, 200, p);
- p.setAntiAlias(true);
- p.setTypeface(Typeface.DEFAULT);
- p.setTextSize(64);
- p.setColor(Color.LTGRAY);
- c.drawText(column+ "-" + row, 20, 100, p);
- ref = ImageReference.forBitmap(bm);
- mBackgrounds.put(pt, ref);
- }
- return ref;
- }
- }
-
- public static class MainFragment extends CardFragment {
- private static MainFragment newInstance(int rowNum, int colNum) {
- Bundle args = new Bundle();
- args.putString(CardFragment.KEY_TITLE, "Row:" + rowNum);
- args.putString(CardFragment.KEY_TEXT, "Col:" + colNum);
- MainFragment f = new MainFragment();
- f.setArguments(args);
- return f;
- }
- }
-}
diff --git a/samples/wearable/SkeletonWearableApp/_index.html b/samples/wearable/SkeletonWearableApp/_index.html
deleted file mode 100644
index dc2a488d8..000000000
--- a/samples/wearable/SkeletonWearableApp/_index.html
+++ /dev/null
@@ -1,22 +0,0 @@
-<p><b>About:</b> This sample is a mostly empty wearable app that implements a fullscreen activity
-conforming to Android Wear best practices. Included in the sample are examples of GridViewPager,
-DelayedConfirmationView, and DismissOverlayView. Developers who require a fullscreen activity for
-their wearable app can use this sample as a starting point.</p>
-<p><b>How to run:</b> Install the Wearable APK on the wearable, go to the voice menu (either by
-saying "OK Google" or tapping the home screen) and select the "Start..." option. Then, select
-"Skeleton Wearable App" from the submenu.</p>
-<p><b>Wearable APIs used:</b> DelayedConfirmationView, DismissOverlayView, GridViewPager,
-CardFragment, FragmentGridPagerAdapter, ImageReference</p>
-<p><b>Screenshots:</b>
- <figure>
- <img src="screenshots/skeleton_wearable_app.png" alt="SkeletonWearableApp" width="140"
- height="140">
- <img src="screenshots/grid_view_pager.png" alt="GridViewPager" width="140" height="140">
- <img src="screenshots/delayed_confirmation.png" alt="DelayedConfirmationView" width="140"
- height="140">
- <img src="screenshots/dismiss_overlay.png" alt="DismissOverlayView" width="140"
- height="140">
- <figcaption>From left to right: the initial activity, GridViewPager,
- DelayedConfirmationView, and DismissOverlayView</figcaption>
- </figure>
-</p>
diff --git a/samples/wearable/SkeletonWearableApp/build.gradle b/samples/wearable/SkeletonWearableApp/build.gradle
deleted file mode 100644
index 43dbcd071..000000000
--- a/samples/wearable/SkeletonWearableApp/build.gradle
+++ /dev/null
@@ -1,15 +0,0 @@
-buildscript {
- repositories {
- mavenCentral()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:0.12.+'
- }
-}
-
-allprojects {
- repositories {
- mavenCentral()
- }
-}
-
diff --git a/samples/wearable/SkeletonWearableApp/gradle.properties b/samples/wearable/SkeletonWearableApp/gradle.properties
deleted file mode 100644
index 5d08ba75b..000000000
--- a/samples/wearable/SkeletonWearableApp/gradle.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-# Project-wide Gradle settings.
-
-# IDE (e.g. Android Studio) users:
-# Settings specified in this file will override any Gradle settings
-# configured through the IDE.
-
-# For more details on how to configure your build environment visit
-# http://www.gradle.org/docs/current/userguide/build_environment.html
-
-# Specifies the JVM arguments used for the daemon process.
-# The setting is particularly useful for tweaking memory settings.
-# Default value: -Xmx10248m -XX:MaxPermSize=256m
-# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
-
-# When configured, Gradle will run in incubating parallel mode.
-# This option should only be used with decoupled projects. More details, visit
-# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
-# org.gradle.parallel=true \ No newline at end of file
diff --git a/samples/wearable/SkeletonWearableApp/gradle/wrapper/gradle-wrapper.jar b/samples/wearable/SkeletonWearableApp/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index 8c0fb64a8..000000000
--- a/samples/wearable/SkeletonWearableApp/gradle/wrapper/gradle-wrapper.jar
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/SkeletonWearableApp/gradle/wrapper/gradle-wrapper.properties b/samples/wearable/SkeletonWearableApp/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index 1e61d1fd3..000000000
--- a/samples/wearable/SkeletonWearableApp/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-#Wed Apr 10 15:27:10 PDT 2013
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip
diff --git a/samples/wearable/SkeletonWearableApp/gradlew b/samples/wearable/SkeletonWearableApp/gradlew
deleted file mode 100755
index 91a7e269e..000000000
--- a/samples/wearable/SkeletonWearableApp/gradlew
+++ /dev/null
@@ -1,164 +0,0 @@
-#!/usr/bin/env bash
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn ( ) {
- echo "$*"
-}
-
-die ( ) {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
-esac
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched.
-if $cygwin ; then
- [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-fi
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >&-
-APP_HOME="`pwd -P`"
-cd "$SAVED" >&-
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
-}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
-
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/samples/wearable/SkeletonWearableApp/gradlew.bat b/samples/wearable/SkeletonWearableApp/gradlew.bat
deleted file mode 100755
index aec99730b..000000000
--- a/samples/wearable/SkeletonWearableApp/gradlew.bat
+++ /dev/null
@@ -1,90 +0,0 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/samples/wearable/SkeletonWearableApp/screenshots/delayed_confirmation.png b/samples/wearable/SkeletonWearableApp/screenshots/delayed_confirmation.png
deleted file mode 100644
index 29943617f..000000000
--- a/samples/wearable/SkeletonWearableApp/screenshots/delayed_confirmation.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/SkeletonWearableApp/screenshots/dismiss_overlay.png b/samples/wearable/SkeletonWearableApp/screenshots/dismiss_overlay.png
deleted file mode 100644
index 142d7e475..000000000
--- a/samples/wearable/SkeletonWearableApp/screenshots/dismiss_overlay.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/SkeletonWearableApp/screenshots/grid_view_pager.png b/samples/wearable/SkeletonWearableApp/screenshots/grid_view_pager.png
deleted file mode 100644
index f59c13d0d..000000000
--- a/samples/wearable/SkeletonWearableApp/screenshots/grid_view_pager.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/SkeletonWearableApp/screenshots/skeleton_wearable_app.png b/samples/wearable/SkeletonWearableApp/screenshots/skeleton_wearable_app.png
deleted file mode 100644
index 4f1727459..000000000
--- a/samples/wearable/SkeletonWearableApp/screenshots/skeleton_wearable_app.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/SkeletonWearableApp/settings.gradle b/samples/wearable/SkeletonWearableApp/settings.gradle
deleted file mode 100644
index 1d97d30e1..000000000
--- a/samples/wearable/SkeletonWearableApp/settings.gradle
+++ /dev/null
@@ -1 +0,0 @@
-include ':Wearable'
diff --git a/samples/wearable/SynchronizedNotifications/Application/build.gradle b/samples/wearable/SynchronizedNotifications/Application/build.gradle
deleted file mode 100644
index 335203852..000000000
--- a/samples/wearable/SynchronizedNotifications/Application/build.gradle
+++ /dev/null
@@ -1,28 +0,0 @@
-apply plugin: 'android'
-
-android {
- compileSdkVersion 18
- buildToolsVersion '20'
- defaultConfig {
- minSdkVersion 18
- targetSdkVersion 19
- versionCode 1
- versionName '1.0'
- }
- buildTypes {
- release {
- runProguard false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
- }
- }
- lintOptions {
- abortOnError false
- }
-}
-
-dependencies {
- compile 'com.google.android.gms:play-services:5.0.+'
- compile 'com.android.support:support-v13:20.0.+'
- compile project(':Common')
- wearApp project(':Wearable')
-}
diff --git a/samples/wearable/SynchronizedNotifications/Application/proguard-rules.txt b/samples/wearable/SynchronizedNotifications/Application/proguard-rules.txt
deleted file mode 100644
index 5b86c0858..000000000
--- a/samples/wearable/SynchronizedNotifications/Application/proguard-rules.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-# 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 proguardFiles
-# directive in build.gradle.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# Add any project specific keep options here:
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
diff --git a/samples/wearable/SynchronizedNotifications/Application/src/main/AndroidManifest.xml b/samples/wearable/SynchronizedNotifications/Application/src/main/AndroidManifest.xml
deleted file mode 100644
index 97ab5779f..000000000
--- a/samples/wearable/SynchronizedNotifications/Application/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.wearable.synchronizednotifications" >
-
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@android:style/Theme.DeviceDefault.Light" >
- <meta-data android:name="com.google.android.gms.version"
- android:value="@integer/google_play_services_version" />
- <activity
- android:name=".PhoneActivity"
- android:label="@string/app_name" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <service android:name=".DismissListener">
- <intent-filter>
- <action
- android:name="com.google.android.gms.wearable.BIND_LISTENER" />
- </intent-filter>
- <intent-filter>
- <action
- android:name="com.example.android.wearable.synchronizednotifications.DISMISS" />
- </intent-filter>
- </service>
- </application>
-
-</manifest>
diff --git a/samples/wearable/SynchronizedNotifications/Application/src/main/java/com/example/android/wearable/synchronizednotifications/DismissListener.java b/samples/wearable/SynchronizedNotifications/Application/src/main/java/com/example/android/wearable/synchronizednotifications/DismissListener.java
deleted file mode 100644
index 98747f55b..000000000
--- a/samples/wearable/SynchronizedNotifications/Application/src/main/java/com/example/android/wearable/synchronizednotifications/DismissListener.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (C) 2014 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.wearable.synchronizednotifications;
-
-import static com.google.android.gms.wearable.PutDataRequest.WEAR_URI_SCHEME;
-
-import android.content.Intent;
-import android.net.Uri;
-import android.os.Bundle;
-import android.support.v4.app.NotificationManagerCompat;
-import android.util.Log;
-
-import com.example.android.wearable.synchronizednotifications.common.Constants;
-import com.google.android.gms.common.ConnectionResult;
-import com.google.android.gms.common.api.GoogleApiClient;
-import com.google.android.gms.common.api.ResultCallback;
-import com.google.android.gms.wearable.DataApi;
-import com.google.android.gms.wearable.DataEvent;
-import com.google.android.gms.wearable.DataEventBuffer;
-import com.google.android.gms.wearable.PutDataMapRequest;
-import com.google.android.gms.wearable.Wearable;
-import com.google.android.gms.wearable.WearableListenerService;
-
-/**
- * A {@link com.google.android.gms.wearable.WearableListenerService} that is invoked when certain
- * notifications are dismissed from either the phone or watch.
- */
-public class DismissListener extends WearableListenerService
- implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener,
- ResultCallback<DataApi.DeleteDataItemsResult> {
-
- private static final String TAG = "DismissListener";
- private GoogleApiClient mGoogleApiClient;
-
- @Override
- public void onCreate() {
- super.onCreate();
- mGoogleApiClient = new GoogleApiClient.Builder(this)
- .addApi(Wearable.API)
- .addConnectionCallbacks(this)
- .addOnConnectionFailedListener(this)
- .build();
- }
-
- @Override
- public void onDataChanged(DataEventBuffer dataEvents) {
- for (DataEvent dataEvent : dataEvents) {
- if (dataEvent.getType() == DataEvent.TYPE_DELETED) {
- if (Constants.BOTH_PATH.equals(dataEvent.getDataItem().getUri().getPath())) {
- // notification on the phone should be dismissed
- NotificationManagerCompat.from(this).cancel(Constants.BOTH_ID);
- }
- }
- }
- }
-
- @Override
- public int onStartCommand(Intent intent, int flags, int startId) {
- if (null != intent) {
- String action = intent.getAction();
- if (Constants.ACTION_DISMISS.equals(action)) {
- // We need to dismiss the wearable notification. We delete the DataItem that
- // created the notification to inform the wearable.
- int notificationId = intent.getIntExtra(Constants.KEY_NOTIFICATION_ID, -1);
- if (notificationId == Constants.BOTH_ID) {
- dismissWearableNotification(notificationId);
- }
- }
- }
- return super.onStartCommand(intent, flags, startId);
- }
-
- /**
- * Removes the DataItem that was used to create a notification on the watch. By deleting the
- * data item, a {@link com.google.android.gms.wearable.WearableListenerService} on the watch
- * will be notified and the notification on the watch will be removed.
- *
- * @param id The ID of the notification that should be removed
- */
- private void dismissWearableNotification(final int id) {
- mGoogleApiClient.connect();
- }
-
- @Override // ConnectionCallbacks
- public void onConnected(Bundle bundle) {
- final Uri dataItemUri =
- new Uri.Builder().scheme(WEAR_URI_SCHEME).path(Constants.BOTH_PATH).build();
- if (Log.isLoggable(TAG, Log.DEBUG)) {
- Log.d(TAG, "Deleting Uri: " + dataItemUri.toString());
- }
- Wearable.DataApi.deleteDataItems(
- mGoogleApiClient, dataItemUri).setResultCallback(this);
- }
-
- @Override // ConnectionCallbacks
- public void onConnectionSuspended(int i) {
- }
-
- @Override // OnConnectionFailedListener
- public void onConnectionFailed(ConnectionResult connectionResult) {
- Log.e(TAG, "Failed to connect to the Google API client");
- }
-
- @Override // ResultCallback<DataApi.DeleteDataItemsResult>
- public void onResult(DataApi.DeleteDataItemsResult deleteDataItemsResult) {
- if (!deleteDataItemsResult.getStatus().isSuccess()) {
- Log.e(TAG, "dismissWearableNotification(): failed to delete DataItem");
- }
- mGoogleApiClient.disconnect();
- }
-}
diff --git a/samples/wearable/SynchronizedNotifications/Application/src/main/java/com/example/android/wearable/synchronizednotifications/PhoneActivity.java b/samples/wearable/SynchronizedNotifications/Application/src/main/java/com/example/android/wearable/synchronizednotifications/PhoneActivity.java
deleted file mode 100644
index eb0833491..000000000
--- a/samples/wearable/SynchronizedNotifications/Application/src/main/java/com/example/android/wearable/synchronizednotifications/PhoneActivity.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Copyright (C) 2014 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.wearable.synchronizednotifications;
-
-import android.app.Activity;
-import android.app.PendingIntent;
-import android.content.Intent;
-import android.os.Bundle;
-import android.support.v4.app.NotificationCompat;
-import android.support.v4.app.NotificationManagerCompat;
-import android.util.Log;
-import android.view.View;
-
-import com.example.android.wearable.synchronizednotifications.common.Constants;
-import com.google.android.gms.common.ConnectionResult;
-import com.google.android.gms.common.api.GoogleApiClient;
-import com.google.android.gms.common.api.ResultCallback;
-import com.google.android.gms.wearable.DataApi;
-import com.google.android.gms.wearable.PutDataMapRequest;
-import com.google.android.gms.wearable.PutDataRequest;
-import com.google.android.gms.wearable.Wearable;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Locale;
-
-/**
- * A simple activity that presents three buttons that would trigger three different combinations of
- * notifications on the handset and the watch:
- * <ul>
- * <li>The first button builds a simple local-only notification on the handset.</li>
- * <li>The second one creates a wearable-only notification by putting a data item in the shared data
- * store and having a {@link com.google.android.gms.wearable.WearableListenerService} listen for
- * that on the wearable</li>
- * <li>The third one creates a local notification and a wearable notification by combining the above
- * two. It, however, demonstrates how one can set things up so that the dismissal of one
- * notification results in the dismissal of the other one.</li>
- * </ul>
- */
-public class PhoneActivity extends Activity implements GoogleApiClient.ConnectionCallbacks,
- GoogleApiClient.OnConnectionFailedListener {
-
- private static final String TAG = "PhoneActivity";
- private GoogleApiClient mGoogleApiClient;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_phone);
- mGoogleApiClient = new GoogleApiClient.Builder(this)
- .addApi(Wearable.API)
- .addConnectionCallbacks(this)
- .addOnConnectionFailedListener(this)
- .build();
- }
-
- /**
- * Builds a local-only notification for the handset. This is achieved by using
- * <code>setLocalOnly(true)</code>. If <code>withDismissal</code> is set to <code>true</code>, a
- * {@link android.app.PendingIntent} will be added to handle the dismissal of notification to
- * be able to remove the mirrored notification on the wearable.
- */
- private void buildLocalOnlyNotification(String title, String content, int notificationId,
- boolean withDismissal) {
- NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
- builder.setContentTitle(title)
- .setContentText(content)
- .setLocalOnly(true)
- .setSmallIcon(R.drawable.ic_launcher);
-
- if (withDismissal) {
- Intent dismissIntent = new Intent(Constants.ACTION_DISMISS);
- dismissIntent.putExtra(Constants.KEY_NOTIFICATION_ID, Constants.BOTH_ID);
- PendingIntent pendingIntent = PendingIntent
- .getService(this, 0, dismissIntent, PendingIntent.FLAG_UPDATE_CURRENT);
- builder.setDeleteIntent(pendingIntent);
- }
- NotificationManagerCompat.from(this).notify(notificationId, builder.build());
- }
-
- /**
- * Builds a DataItem that on the wearable will be interpreted as a request to show a
- * notification. The result will be a notification that only shows up on the wearable.
- */
- private void buildWearableOnlyNotification(String title, String content, String path) {
- if (mGoogleApiClient.isConnected()) {
- PutDataMapRequest putDataMapRequest = PutDataMapRequest.create(path);
- putDataMapRequest.getDataMap().putString(Constants.KEY_CONTENT, content);
- putDataMapRequest.getDataMap().putString(Constants.KEY_TITLE, title);
- PutDataRequest request = putDataMapRequest.asPutDataRequest();
- Wearable.DataApi.putDataItem(mGoogleApiClient, request)
- .setResultCallback(new ResultCallback<DataApi.DataItemResult>() {
- @Override
- public void onResult(DataApi.DataItemResult dataItemResult) {
- if (!dataItemResult.getStatus().isSuccess()) {
- Log.e(TAG, "buildWatchOnlyNotification(): Failed to set the data, "
- + "status: " + dataItemResult.getStatus().getStatusCode());
- }
- }
- });
- } else {
- Log.e(TAG, "buildWearableOnlyNotification(): no Google API Client connection");
- }
- }
-
- /**
- * Builds a local notification and sets a DataItem that will be interpreted by the wearable as
- * a request to build a notification on the wearable as as well. The two notifications show
- * different messages.
- * Dismissing either of the notifications will result in dismissal of the other; this is
- * achieved by creating a {@link android.app.PendingIntent} that results in removal of
- * the DataItem that created the watch notification. The deletion of the DataItem is observed on
- * both sides, using WearableListenerService callbacks, and is interpreted on each side as a
- * request to dismiss the corresponding notification.
- */
- private void buildMirroredNotifications(String phoneTitle, String watchTitle, String content) {
- if (mGoogleApiClient.isConnected()) {
- // Wearable notification
- buildWearableOnlyNotification(watchTitle, content, Constants.BOTH_PATH);
-
- // Local notification, with a pending intent for dismissal
- buildLocalOnlyNotification(phoneTitle, content, Constants.BOTH_ID, true);
- }
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- mGoogleApiClient.connect();
- }
-
- @Override
- protected void onStop() {
- mGoogleApiClient.disconnect();
- super.onStop();
- }
-
- @Override
- public void onConnected(Bundle bundle) {
- }
-
- @Override
- public void onConnectionSuspended(int i) {
- }
-
- @Override
- public void onConnectionFailed(ConnectionResult connectionResult) {
- Log.e(TAG, "Failed to connect to Google API Client");
- }
-
- /**
- * Returns a string built from the current time
- */
- private String now() {
- SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss", Locale.getDefault());
- return sdf.format(new Date());
- }
-
- /**
- * Handles button clicks in the UI.
- */
- public void onClick(View view) {
- int id = view.getId();
- switch (id) {
- case R.id.phone_only:
- buildLocalOnlyNotification(getString(R.string.phone_only), now(),
- Constants.PHONE_ONLY_ID, false);
- break;
- case R.id.wear_only:
- buildWearableOnlyNotification(getString(R.string.wear_only), now(),
- Constants.WATCH_ONLY_PATH);
- break;
- case R.id.different_notifications:
- buildMirroredNotifications(getString(R.string.phone_both), getString(R.string.watch_both), now());
- break;
- }
- }
-}
diff --git a/samples/wearable/SynchronizedNotifications/Application/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/wearable/SynchronizedNotifications/Application/src/main/res/drawable-xxhdpi/ic_launcher.png
deleted file mode 100644
index 944042ca8..000000000
--- a/samples/wearable/SynchronizedNotifications/Application/src/main/res/drawable-xxhdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/SynchronizedNotifications/Application/src/main/res/layout/activity_phone.xml b/samples/wearable/SynchronizedNotifications/Application/src/main/res/layout/activity_phone.xml
deleted file mode 100644
index 0c20bc0e3..000000000
--- a/samples/wearable/SynchronizedNotifications/Application/src/main/res/layout/activity_phone.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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.
--->
-
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:paddingLeft="@dimen/activity_horizontal_margin"
- android:paddingRight="@dimen/activity_horizontal_margin"
- android:paddingTop="@dimen/activity_vertical_margin"
- android:paddingBottom="@dimen/activity_vertical_margin"
- tools:context=".PhoneActivity">
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/phone_only"
- android:id="@+id/phone_only"
- android:onClick="onClick"
- android:layout_alignParentTop="true"
- android:layout_centerHorizontal="true" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/wear_only"
- android:id="@+id/wear_only"
- android:onClick="onClick"
- android:layout_below="@+id/phone_only"
- android:layout_alignLeft="@+id/phone_only"
- android:layout_marginTop="30dp"
- android:layout_alignRight="@+id/phone_only" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/different_notifications"
- android:id="@+id/different_notifications"
- android:layout_below="@+id/wear_only"
- android:onClick="onClick"
- android:layout_alignLeft="@+id/wear_only"
- android:layout_marginTop="30dp"
- android:layout_alignRight="@+id/wear_only" />
-</RelativeLayout>
diff --git a/samples/wearable/SynchronizedNotifications/Application/src/main/res/values/strings.xml b/samples/wearable/SynchronizedNotifications/Application/src/main/res/values/strings.xml
deleted file mode 100644
index 4115af09d..000000000
--- a/samples/wearable/SynchronizedNotifications/Application/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<resources>
-
- <string name="app_name">Synchronized Notifications</string>
- <string name="wear_only">Watch Only Notification</string>
- <string name="phone_only">Phone Only Notification</string>
- <string name="different_notifications">Different Notifications</string>
- <string name="phone_both">Phone Notification</string>
- <string name="watch_both">Watch Notification</string>
-
-</resources>
diff --git a/samples/wearable/SynchronizedNotifications/Common/build.gradle b/samples/wearable/SynchronizedNotifications/Common/build.gradle
deleted file mode 100644
index f87e44cf7..000000000
--- a/samples/wearable/SynchronizedNotifications/Common/build.gradle
+++ /dev/null
@@ -1,20 +0,0 @@
-apply plugin: 'android-library'
-
-android {
- compileSdkVersion 19
- buildToolsVersion '20'
- defaultConfig {
- minSdkVersion 18
- targetSdkVersion 19
- versionCode 1
- versionName '1.0'
- }
- buildTypes {
- release {
- runProguard false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
- }
- }
- productFlavors {
- }
-}
diff --git a/samples/wearable/SynchronizedNotifications/Common/proguard-rules.txt b/samples/wearable/SynchronizedNotifications/Common/proguard-rules.txt
deleted file mode 100644
index f4a05360a..000000000
--- a/samples/wearable/SynchronizedNotifications/Common/proguard-rules.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in /usr/local/android-sdk/tools/proguard/proguard-android.txt
-# You can edit the include path and order by changing the proguardFiles
-# directive in build.gradle.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# Add any project specific keep options here:
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
diff --git a/samples/wearable/SynchronizedNotifications/Common/src/main/AndroidManifest.xml b/samples/wearable/SynchronizedNotifications/Common/src/main/AndroidManifest.xml
deleted file mode 100644
index c07d858b9..000000000
--- a/samples/wearable/SynchronizedNotifications/Common/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.wearable.synchronizednotifications.common">
-
- <application android:allowBackup="true"
- android:label="@string/app_name">
- </application>
-
-</manifest>
diff --git a/samples/wearable/SynchronizedNotifications/Common/src/main/java/com/example/android/wearable/synchronizednotifications/common/Constants.java b/samples/wearable/SynchronizedNotifications/Common/src/main/java/com/example/android/wearable/synchronizednotifications/common/Constants.java
deleted file mode 100644
index 693533f5d..000000000
--- a/samples/wearable/SynchronizedNotifications/Common/src/main/java/com/example/android/wearable/synchronizednotifications/common/Constants.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2014 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.wearable.synchronizednotifications.common;
-
-/**
- * Constants that are used in both the Application and the Wearable modules.
- */
-public final class Constants {
-
- private Constants() {};
-
- public static final int WATCH_ONLY_ID = 2;
- public static final int PHONE_ONLY_ID = 3;
- public static final int BOTH_ID = 4;
-
- public static final String BOTH_PATH = "/both";
- public static final String WATCH_ONLY_PATH = "/watch-only";
- public static final String KEY_NOTIFICATION_ID = "notification-id";
- public static final String KEY_TITLE = "title";
- public static final String KEY_CONTENT = "content";
-
- public static final String ACTION_DISMISS
- = "com.example.android.wearable.synchronizednotifications.DISMISS";
-}
diff --git a/samples/wearable/SynchronizedNotifications/Common/src/main/res/values/strings.xml b/samples/wearable/SynchronizedNotifications/Common/src/main/res/values/strings.xml
deleted file mode 100644
index b28ef6067..000000000
--- a/samples/wearable/SynchronizedNotifications/Common/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-<resources>
- <string name="app_name">Common</string>
-</resources>
diff --git a/samples/wearable/SynchronizedNotifications/Wearable/build.gradle b/samples/wearable/SynchronizedNotifications/Wearable/build.gradle
deleted file mode 100644
index 2b4731203..000000000
--- a/samples/wearable/SynchronizedNotifications/Wearable/build.gradle
+++ /dev/null
@@ -1,28 +0,0 @@
-apply plugin: 'android'
-
-android {
- compileSdkVersion 20
- buildToolsVersion '20'
- defaultConfig {
- minSdkVersion 20
- targetSdkVersion 20
- versionCode 1
- versionName '1.0'
- }
- buildTypes {
- release {
- runProguard false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
- }
- }
- lintOptions {
- abortOnError false
- }
-}
-
-dependencies {
- compile 'com.google.android.gms:play-services-wearable:+'
- compile 'com.android.support:support-v13:20.0.+'
- compile 'com.google.android.support:wearable:1.0.+'
- compile project(':Common')
-}
diff --git a/samples/wearable/SynchronizedNotifications/Wearable/proguard-rules.txt b/samples/wearable/SynchronizedNotifications/Wearable/proguard-rules.txt
deleted file mode 100644
index 5b86c0858..000000000
--- a/samples/wearable/SynchronizedNotifications/Wearable/proguard-rules.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-# 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 proguardFiles
-# directive in build.gradle.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# Add any project specific keep options here:
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
diff --git a/samples/wearable/SynchronizedNotifications/Wearable/src/main/AndroidManifest.xml b/samples/wearable/SynchronizedNotifications/Wearable/src/main/AndroidManifest.xml
deleted file mode 100644
index 8e099b3ca..000000000
--- a/samples/wearable/SynchronizedNotifications/Wearable/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.wearable.synchronizednotifications" >
-
- <uses-feature android:name="android.hardware.type.watch" />
-
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@android:style/Theme.DeviceDefault.Light" >
- <meta-data android:name="com.google.android.gms.version"
- android:value="@integer/google_play_services_version" />
- <activity
- android:name=".WearableActivity"
- android:label="@string/app_name" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <service android:name=".NotificationUpdateService">
- <intent-filter>
- <action
- android:name="com.google.android.gms.wearable.BIND_LISTENER" />
- </intent-filter>
- <intent-filter>
- <action
- android:name="com.example.android.wearable.synchronizednotifications.DISMISS" />
- </intent-filter>
- </service>
- </application>
-
-</manifest>
diff --git a/samples/wearable/SynchronizedNotifications/Wearable/src/main/java/com/example/android/wearable/synchronizednotifications/NotificationUpdateService.java b/samples/wearable/SynchronizedNotifications/Wearable/src/main/java/com/example/android/wearable/synchronizednotifications/NotificationUpdateService.java
deleted file mode 100644
index d57148379..000000000
--- a/samples/wearable/SynchronizedNotifications/Wearable/src/main/java/com/example/android/wearable/synchronizednotifications/NotificationUpdateService.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Copyright (C) 2014 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.wearable.synchronizednotifications;
-
-import static com.google.android.gms.wearable.PutDataRequest.WEAR_URI_SCHEME;
-
-import android.app.Notification;
-import android.app.NotificationManager;
-import android.app.PendingIntent;
-import android.content.Intent;
-import android.net.Uri;
-import android.os.Bundle;
-import android.util.Log;
-
-import com.example.android.wearable.synchronizednotifications.common.Constants;
-import com.google.android.gms.common.ConnectionResult;
-import com.google.android.gms.common.api.GoogleApiClient;
-import com.google.android.gms.common.api.ResultCallback;
-import com.google.android.gms.wearable.DataApi;
-import com.google.android.gms.wearable.DataEvent;
-import com.google.android.gms.wearable.DataEventBuffer;
-import com.google.android.gms.wearable.DataMap;
-import com.google.android.gms.wearable.DataMapItem;
-import com.google.android.gms.wearable.PutDataMapRequest;
-import com.google.android.gms.wearable.Wearable;
-import com.google.android.gms.wearable.WearableListenerService;
-
-/**
- * A {@link com.google.android.gms.wearable.WearableListenerService} that will be invoked when a
- * DataItem is added or deleted. The creation of a new DataItem will be interpreted as a request to
- * create a new notification and the removal of that DataItem is interpreted as a request to
- * dismiss that notification.
- */
-public class NotificationUpdateService extends WearableListenerService
- implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener,
- ResultCallback<DataApi.DeleteDataItemsResult> {
-
- private static final String TAG = "NotificationUpdate";
- private GoogleApiClient mGoogleApiClient;
-
- @Override
- public void onCreate() {
- super.onCreate();
- mGoogleApiClient = new GoogleApiClient.Builder(this)
- .addApi(Wearable.API)
- .addConnectionCallbacks(this)
- .addOnConnectionFailedListener(this)
- .build();
- }
-
- @Override
- public int onStartCommand(Intent intent, int flags, int startId) {
- if (null != intent) {
- String action = intent.getAction();
- if (Constants.ACTION_DISMISS.equals(action)) {
- // We need to dismiss the wearable notification. We delete the data item that
- // created the notification and that is how we inform the phone
- int notificationId = intent.getIntExtra(Constants.KEY_NOTIFICATION_ID, -1);
- if (notificationId == Constants.BOTH_ID) {
- dismissPhoneNotification(notificationId);
- }
- }
- }
- return super.onStartCommand(intent, flags, startId);
- }
-
- /**
- * Dismisses the phone notification, via a {@link android.app.PendingIntent} that is triggered
- * when the user dismisses the local notification. Deleting the corresponding data item notifies
- * the {@link com.google.android.gms.wearable.WearableListenerService} on the phone that the
- * matching notification on the phone side should be removed.
- */
- private void dismissPhoneNotification(int id) {
- mGoogleApiClient.connect();
- }
-
- @Override
- public void onDataChanged(DataEventBuffer dataEvents) {
- for (DataEvent dataEvent : dataEvents) {
- if (dataEvent.getType() == DataEvent.TYPE_CHANGED) {
- DataMap dataMap = DataMapItem.fromDataItem(dataEvent.getDataItem()).getDataMap();
- String content = dataMap.getString(Constants.KEY_CONTENT);
- String title = dataMap.getString(Constants.KEY_TITLE);
- if (Constants.WATCH_ONLY_PATH.equals(dataEvent.getDataItem().getUri().getPath())) {
- buildWearableOnlyNotification(title, content, false);
- } else if (Constants.BOTH_PATH.equals(dataEvent.getDataItem().getUri().getPath())) {
- buildWearableOnlyNotification(title, content, true);
- }
- } else if (dataEvent.getType() == DataEvent.TYPE_DELETED) {
- if (Log.isLoggable(TAG, Log.DEBUG)) {
- Log.d(TAG, "DataItem deleted: " + dataEvent.getDataItem().getUri().getPath());
- }
- if (Constants.BOTH_PATH.equals(dataEvent.getDataItem().getUri().getPath())) {
- // Dismiss the corresponding notification
- ((NotificationManager) getSystemService(NOTIFICATION_SERVICE))
- .cancel(Constants.WATCH_ONLY_ID);
- }
- }
- }
- }
-
- /**
- * Builds a simple notification on the wearable.
- */
- private void buildWearableOnlyNotification(String title, String content,
- boolean withDismissal) {
- Notification.Builder builder = new Notification.Builder(this)
- .setSmallIcon(R.drawable.ic_launcher)
- .setContentTitle(title)
- .setContentText(content);
-
- if (withDismissal) {
- Intent dismissIntent = new Intent(Constants.ACTION_DISMISS);
- dismissIntent.putExtra(Constants.KEY_NOTIFICATION_ID, Constants.BOTH_ID);
- PendingIntent pendingIntent = PendingIntent
- .getService(this, 0, dismissIntent, PendingIntent.FLAG_UPDATE_CURRENT);
- builder.setDeleteIntent(pendingIntent);
- }
-
- ((NotificationManager) getSystemService(NOTIFICATION_SERVICE))
- .notify(Constants.WATCH_ONLY_ID, builder.build());
- }
-
- @Override
- public void onConnected(Bundle bundle) {
- final Uri dataItemUri =
- new Uri.Builder().scheme(WEAR_URI_SCHEME).path(Constants.BOTH_PATH).build();
- if (Log.isLoggable(TAG, Log.DEBUG)) {
- Log.d(TAG, "Deleting Uri: " + dataItemUri.toString());
- }
- Wearable.DataApi.deleteDataItems(
- mGoogleApiClient, dataItemUri).setResultCallback(this);
- }
-
- @Override
- public void onConnectionSuspended(int i) {
- }
-
- @Override
- public void onConnectionFailed(ConnectionResult connectionResult) {
- }
-
- @Override
- public void onResult(DataApi.DeleteDataItemsResult deleteDataItemsResult) {
- if (!deleteDataItemsResult.getStatus().isSuccess()) {
- Log.e(TAG, "dismissWearableNotification(): failed to delete DataItem");
- }
- mGoogleApiClient.disconnect();
- }
-} \ No newline at end of file
diff --git a/samples/wearable/SynchronizedNotifications/Wearable/src/main/java/com/example/android/wearable/synchronizednotifications/WearableActivity.java b/samples/wearable/SynchronizedNotifications/Wearable/src/main/java/com/example/android/wearable/synchronizednotifications/WearableActivity.java
deleted file mode 100644
index 9c653d9b2..000000000
--- a/samples/wearable/SynchronizedNotifications/Wearable/src/main/java/com/example/android/wearable/synchronizednotifications/WearableActivity.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2014 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.wearable.synchronizednotifications;
-
-import android.app.Activity;
-import android.os.Bundle;
-
-public class WearableActivity extends Activity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_wearable);
- }
-}
diff --git a/samples/wearable/SynchronizedNotifications/Wearable/src/main/res/drawable-hdpi/ic_launcher.png b/samples/wearable/SynchronizedNotifications/Wearable/src/main/res/drawable-hdpi/ic_launcher.png
deleted file mode 100644
index f7dd9a0bd..000000000
--- a/samples/wearable/SynchronizedNotifications/Wearable/src/main/res/drawable-hdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/SynchronizedNotifications/Wearable/src/main/res/drawable-mdpi/ic_launcher.png b/samples/wearable/SynchronizedNotifications/Wearable/src/main/res/drawable-mdpi/ic_launcher.png
deleted file mode 100644
index fef2da78f..000000000
--- a/samples/wearable/SynchronizedNotifications/Wearable/src/main/res/drawable-mdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/SynchronizedNotifications/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/wearable/SynchronizedNotifications/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png
deleted file mode 100644
index f2fb03cdd..000000000
--- a/samples/wearable/SynchronizedNotifications/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/SynchronizedNotifications/Wearable/src/main/res/values/strings.xml b/samples/wearable/SynchronizedNotifications/Wearable/src/main/res/values/strings.xml
deleted file mode 100644
index 81eb3f011..000000000
--- a/samples/wearable/SynchronizedNotifications/Wearable/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<resources>
-
- <string name="app_name">Synchronized Notifications</string>
-
-</resources>
diff --git a/samples/wearable/SynchronizedNotifications/_index.html b/samples/wearable/SynchronizedNotifications/_index.html
deleted file mode 100644
index 1461ba6b6..000000000
--- a/samples/wearable/SynchronizedNotifications/_index.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<p><b>About:</b> This sample creates three simple types of notifications:
- <ol>
- <li>A phone-only notification</li>
- <li>A watch-only notification</li>
- <li>A pair of synchronized phone and watch notifications where the content shown
- on the watch notification is different from the one on the phone. These notifications
- are synchronized in the sense that dismissing one results in dismissal of the other one
- (all based on the Data Layer APIs).</li>
- </ol>
-</p>
-<p><b>How to run:</b> Install the Application APK on the companion, and the Wearable APK on the
-wearable. Start the sample by running the SynchronizedNotifications application on the companion.
-</p>
-<p><b>Wearable APIs used:</b> DataApi, WearableListenerService</p>
-<p><b>Screenshots:</b>
- <figure>
- <img src="screenshots/notification_options.png" alt="Notification options" width="216"
- height="384">
- <img src="screenshots/watch_only_notification.png" alt="Watch only notification" width="140"
- height="140">
- <img src="screenshots/different_notifications_phone.png"
- alt="Different notifications - phone" width="216" height="384">
- <img src="screenshots/different_notifications_wearable.png"
- alt="Different notifications - watch" width="140" height="140">
- <figcaption>From left to right: notification options, Watch Only Notification, Different
- Notifications - Phone, and Different Notifications - Watch</figcaption>
- </figure>
-</p> \ No newline at end of file
diff --git a/samples/wearable/SynchronizedNotifications/build.gradle b/samples/wearable/SynchronizedNotifications/build.gradle
deleted file mode 100644
index 8bd4ffc49..000000000
--- a/samples/wearable/SynchronizedNotifications/build.gradle
+++ /dev/null
@@ -1,14 +0,0 @@
-buildscript {
- repositories {
- mavenCentral()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:0.12.+'
- }
-}
-
-allprojects {
- repositories {
- mavenCentral()
- }
-}
diff --git a/samples/wearable/SynchronizedNotifications/gradle/wrapper/gradle-wrapper.jar b/samples/wearable/SynchronizedNotifications/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index 8c0fb64a8..000000000
--- a/samples/wearable/SynchronizedNotifications/gradle/wrapper/gradle-wrapper.jar
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/SynchronizedNotifications/gradle/wrapper/gradle-wrapper.properties b/samples/wearable/SynchronizedNotifications/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index 1e61d1fd3..000000000
--- a/samples/wearable/SynchronizedNotifications/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-#Wed Apr 10 15:27:10 PDT 2013
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip
diff --git a/samples/wearable/SynchronizedNotifications/gradlew b/samples/wearable/SynchronizedNotifications/gradlew
deleted file mode 100755
index 91a7e269e..000000000
--- a/samples/wearable/SynchronizedNotifications/gradlew
+++ /dev/null
@@ -1,164 +0,0 @@
-#!/usr/bin/env bash
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn ( ) {
- echo "$*"
-}
-
-die ( ) {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
-esac
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched.
-if $cygwin ; then
- [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-fi
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >&-
-APP_HOME="`pwd -P`"
-cd "$SAVED" >&-
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
-}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
-
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/samples/wearable/SynchronizedNotifications/gradlew.bat b/samples/wearable/SynchronizedNotifications/gradlew.bat
deleted file mode 100644
index aec99730b..000000000
--- a/samples/wearable/SynchronizedNotifications/gradlew.bat
+++ /dev/null
@@ -1,90 +0,0 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/samples/wearable/SynchronizedNotifications/screenshots/different_notifications_phone.png b/samples/wearable/SynchronizedNotifications/screenshots/different_notifications_phone.png
deleted file mode 100644
index cab31e090..000000000
--- a/samples/wearable/SynchronizedNotifications/screenshots/different_notifications_phone.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/SynchronizedNotifications/screenshots/different_notifications_wearable.png b/samples/wearable/SynchronizedNotifications/screenshots/different_notifications_wearable.png
deleted file mode 100644
index 97da71527..000000000
--- a/samples/wearable/SynchronizedNotifications/screenshots/different_notifications_wearable.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/SynchronizedNotifications/screenshots/notification_options.png b/samples/wearable/SynchronizedNotifications/screenshots/notification_options.png
deleted file mode 100644
index 8cd00950a..000000000
--- a/samples/wearable/SynchronizedNotifications/screenshots/notification_options.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/SynchronizedNotifications/screenshots/watch_only_notification.png b/samples/wearable/SynchronizedNotifications/screenshots/watch_only_notification.png
deleted file mode 100644
index 34e950fea..000000000
--- a/samples/wearable/SynchronizedNotifications/screenshots/watch_only_notification.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/SynchronizedNotifications/settings.gradle b/samples/wearable/SynchronizedNotifications/settings.gradle
deleted file mode 100644
index 7a1e93702..000000000
--- a/samples/wearable/SynchronizedNotifications/settings.gradle
+++ /dev/null
@@ -1 +0,0 @@
-include ':Application', ':Wearable', ':Common'
diff --git a/samples/wearable/Timer/Wearable/build.gradle b/samples/wearable/Timer/Wearable/build.gradle
deleted file mode 100644
index 9c8901452..000000000
--- a/samples/wearable/Timer/Wearable/build.gradle
+++ /dev/null
@@ -1,22 +0,0 @@
-apply plugin: 'android'
-
-android {
- compileSdkVersion 20
- buildToolsVersion '20'
- defaultConfig {
- minSdkVersion 20
- targetSdkVersion 20
- versionCode 1
- versionName '1.0'
- }
- buildTypes {
- release {
- runProguard false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
- }
- }
-}
-
-dependencies {
- compile 'com.google.android.support:wearable:+'
-}
diff --git a/samples/wearable/Timer/Wearable/proguard-rules.txt b/samples/wearable/Timer/Wearable/proguard-rules.txt
deleted file mode 100644
index 08e5bdc8d..000000000
--- a/samples/wearable/Timer/Wearable/proguard-rules.txt
+++ /dev/null
@@ -1,22 +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 *;
-#}
--dontwarn android.support.wearable.view.DelayedConfirmationView
--dontwarn android.support.wearable.view.CircledImageView
diff --git a/samples/wearable/Timer/Wearable/src/main/AndroidManifest.xml b/samples/wearable/Timer/Wearable/src/main/AndroidManifest.xml
deleted file mode 100644
index 22c7f4775..000000000
--- a/samples/wearable/Timer/Wearable/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.wearable.timer" >
-
- <uses-feature android:name="android.hardware.type.watch" />
-
- <application
- android:icon="@mipmap/ic_launcher"
- android:label="@string/app_name"
- android:theme="@android:style/Theme.DeviceDefault.Light"
- android:allowBackup="true">
-
- <!-- Timer components -->
- <activity android:name=".SetTimerActivity">
- <intent-filter>
- <action android:name="com.android.example.clockwork.timer.TIMER"/>
- <category android:name="android.intent.category.DEFAULT"/>
- </intent-filter>
- <!-- Set a timer voice command -->
- <intent-filter>
- <action android:name="android.intent.action.SET_TIMER"/>
- <category android:name="android.intent.category.DEFAULT"/>
- </intent-filter>
- </activity>
-
- <service android:name=".TimerNotificationService" />
-
- </application>
-</manifest>
diff --git a/samples/wearable/Timer/Wearable/src/main/java/com/example/android/wearable/timer/WearableListItemLayout.java b/samples/wearable/Timer/Wearable/src/main/java/com/example/android/wearable/timer/WearableListItemLayout.java
deleted file mode 100644
index 0bbc58720..000000000
--- a/samples/wearable/Timer/Wearable/src/main/java/com/example/android/wearable/timer/WearableListItemLayout.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (C) 2014 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.wearable.timer;
-
-import android.content.Context;
-import android.graphics.drawable.GradientDrawable;
-import android.support.wearable.view.WearableListView;
-import android.util.AttributeSet;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-
-public class WearableListItemLayout extends LinearLayout implements WearableListView.Item {
- private final float mFadedTextAlpha;
- private final int mFadedCircleColor;
- private final int mChosenCircleColor;
- private ImageView mCircle;
- private float mScale;
- private TextView mName;
-
- public WearableListItemLayout(Context context) {
- this(context, null);
- }
-
- public WearableListItemLayout(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public WearableListItemLayout(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- mFadedTextAlpha = getResources().getInteger(R.integer.action_text_faded_alpha) / 100f;
- mFadedCircleColor = getResources().getColor(R.color.wl_gray);
- mChosenCircleColor = getResources().getColor(R.color.wl_blue);
- }
-
- @Override
- protected void onFinishInflate() {
- super.onFinishInflate();
- mCircle = (ImageView) findViewById(R.id.circle);
- mName = (TextView) findViewById(R.id.time_text);
- }
-
- @Override
- public float getProximityMinValue() {
- return 1f;
- }
-
- @Override
- public float getProximityMaxValue() {
- return 1.6f;
- }
-
- @Override
- public float getCurrentProximityValue() {
- return mScale;
- }
-
- @Override
- public void setScalingAnimatorValue(float scale) {
- mScale = scale;
- mCircle.setScaleX(scale);
- mCircle.setScaleY(scale);
- }
-
- @Override
- public void onScaleUpStart() {
- mName.setAlpha(1f);
- ((GradientDrawable) mCircle.getDrawable()).setColor(mChosenCircleColor);
- }
-
- @Override
- public void onScaleDownStart() {
- ((GradientDrawable) mCircle.getDrawable()).setColor(mFadedCircleColor);
- mName.setAlpha(mFadedTextAlpha);
- }
-}
diff --git a/samples/wearable/Timer/_index.html b/samples/wearable/Timer/_index.html
deleted file mode 100644
index 10ccf30b5..000000000
--- a/samples/wearable/Timer/_index.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<p><b>About:</b> This simple wearable app allows the user to set a countdown timer. It runs
-independently on the wearable with no phone connection.</p>
-<p><b>How to run:</b> Install the Wearable APK on the wearable, then start the timer via the voice
-menu, either by saying "OK Google, start a timer" or by tapping the home screen and selecting
-"Start a timer".</p>
-<p><b>Wearable APIs used:</b> voice command trigger, WearableListView</p>
-<p><b>Screenshots:</b>
- <figure>
- <img src="screenshots/timer.png" alt="GridViewPager" width="140" height="140">
- <img src="screenshots/timer_countdown.png" alt="GridViewPager" width="140" height="140">
- <figcaption>A simple timer.</figcaption>
- </figure>
-</p>
diff --git a/samples/wearable/Timer/build.gradle b/samples/wearable/Timer/build.gradle
deleted file mode 100644
index 8bd4ffc49..000000000
--- a/samples/wearable/Timer/build.gradle
+++ /dev/null
@@ -1,14 +0,0 @@
-buildscript {
- repositories {
- mavenCentral()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:0.12.+'
- }
-}
-
-allprojects {
- repositories {
- mavenCentral()
- }
-}
diff --git a/samples/wearable/Timer/gradle/wrapper/gradle-wrapper.jar b/samples/wearable/Timer/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index 8c0fb64a8..000000000
--- a/samples/wearable/Timer/gradle/wrapper/gradle-wrapper.jar
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/Timer/gradle/wrapper/gradle-wrapper.properties b/samples/wearable/Timer/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index 1e61d1fd3..000000000
--- a/samples/wearable/Timer/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-#Wed Apr 10 15:27:10 PDT 2013
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip
diff --git a/samples/wearable/Timer/gradlew b/samples/wearable/Timer/gradlew
deleted file mode 100755
index 91a7e269e..000000000
--- a/samples/wearable/Timer/gradlew
+++ /dev/null
@@ -1,164 +0,0 @@
-#!/usr/bin/env bash
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn ( ) {
- echo "$*"
-}
-
-die ( ) {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
-esac
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched.
-if $cygwin ; then
- [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-fi
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >&-
-APP_HOME="`pwd -P`"
-cd "$SAVED" >&-
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
-}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
-
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/samples/wearable/Timer/gradlew.bat b/samples/wearable/Timer/gradlew.bat
deleted file mode 100755
index aec99730b..000000000
--- a/samples/wearable/Timer/gradlew.bat
+++ /dev/null
@@ -1,90 +0,0 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/samples/wearable/Timer/screenshots/timer.png b/samples/wearable/Timer/screenshots/timer.png
deleted file mode 100644
index 6ef8f869a..000000000
--- a/samples/wearable/Timer/screenshots/timer.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/Timer/screenshots/timer_countdown.png b/samples/wearable/Timer/screenshots/timer_countdown.png
deleted file mode 100644
index 505733df6..000000000
--- a/samples/wearable/Timer/screenshots/timer_countdown.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/Timer/settings.gradle b/samples/wearable/Timer/settings.gradle
deleted file mode 100644
index 1d97d30e1..000000000
--- a/samples/wearable/Timer/settings.gradle
+++ /dev/null
@@ -1 +0,0 @@
-include ':Wearable'
diff --git a/samples/wearable/WatchViewStub/Wearable/build.gradle b/samples/wearable/WatchViewStub/Wearable/build.gradle
deleted file mode 100644
index b9450ca9a..000000000
--- a/samples/wearable/WatchViewStub/Wearable/build.gradle
+++ /dev/null
@@ -1,24 +0,0 @@
-apply plugin: 'android'
-
-android {
- compileSdkVersion 20
- buildToolsVersion '20'
-
- defaultConfig {
- minSdkVersion 20
- targetSdkVersion 20
- versionCode 1
- versionName "1.0"
- }
-
- buildTypes {
- release {
- runProguard false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
- }
- }
-}
-
-dependencies {
- compile "com.google.android.support:wearable:1.0.+"
-}
diff --git a/samples/wearable/WatchViewStub/Wearable/proguard-rules.txt b/samples/wearable/WatchViewStub/Wearable/proguard-rules.txt
deleted file mode 100644
index f2fe1559a..000000000
--- a/samples/wearable/WatchViewStub/Wearable/proguard-rules.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/samples/wearable/WatchViewStub/Wearable/src/main/AndroidManifest.xml b/samples/wearable/WatchViewStub/Wearable/src/main/AndroidManifest.xml
deleted file mode 100644
index b52a494f8..000000000
--- a/samples/wearable/WatchViewStub/Wearable/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.android.google.wearable.watchviewstub" >
-
- <uses-feature android:name="android.hardware.type.watch" />
-
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@android:style/Theme.DeviceDefault">
- <activity
- android:name="com.example.android.google.wearable.watchviewstub.MainActivity"
- android:label="@string/app_name">
- <intent-filter>
- <action android:name="android.intent.action.MAIN"/>
- <category android:name="android.intent.category.LAUNCHER"/>
- </intent-filter>
- </activity>
- </application>
-
-</manifest>
diff --git a/samples/wearable/WatchViewStub/_index.html b/samples/wearable/WatchViewStub/_index.html
deleted file mode 100644
index 0e01e304e..000000000
--- a/samples/wearable/WatchViewStub/_index.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<p><b>About:</b> This sample demonstrates how to specify different layouts for round and rectangular
-screens. The layouts used in this sample are as follows:
- <ul>
- <li>Round: The background is a blue/green ring surrounding red text.</li>
- <li>Rect: The background is a blue/breen rounded rectangle with red text on top.</li>
- </ul>
-Additionally, a unique animation is played when the user clicks on the layout, depending on whether
-the screen is round or rectangular:
- <ul>
- <li>Round: The layout rotates 360 degrees.</li>
- <li>Rect: The layout shrinks to 70% and then grows back to 100%.</li>
- </ul>
-</p>
-<p><b>How to run:</b> Install the Wearable APK on the wearable, go to the voice menu (either by
-saying "OK Google" or tapping the home screen) and select the "Start..." option. Then, select
-"WatchViewStub Sample" from the submenu.</p>
-<p><b>Wearable APIs used:</b> WatchViewStub, DismissOverlayView</p>
-<p><b>Screenshots:</b>
- <figure>
- <img src="screenshots/watch_view_stub_round.png" alt="Round layout" width="180"
- height="180">
- <img src="screenshots/watch_view_stub_rectangular.png" alt="Rectangular layout" width="140"
- height="140">
- <figcaption>The layout that is inflated depends on the shape of your wearable.</figcaption>
- </figure>
-</p>
diff --git a/samples/wearable/WatchViewStub/build.gradle b/samples/wearable/WatchViewStub/build.gradle
deleted file mode 100644
index 43dbcd071..000000000
--- a/samples/wearable/WatchViewStub/build.gradle
+++ /dev/null
@@ -1,15 +0,0 @@
-buildscript {
- repositories {
- mavenCentral()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:0.12.+'
- }
-}
-
-allprojects {
- repositories {
- mavenCentral()
- }
-}
-
diff --git a/samples/wearable/WatchViewStub/gradle.properties b/samples/wearable/WatchViewStub/gradle.properties
deleted file mode 100644
index 5d08ba75b..000000000
--- a/samples/wearable/WatchViewStub/gradle.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-# Project-wide Gradle settings.
-
-# IDE (e.g. Android Studio) users:
-# Settings specified in this file will override any Gradle settings
-# configured through the IDE.
-
-# For more details on how to configure your build environment visit
-# http://www.gradle.org/docs/current/userguide/build_environment.html
-
-# Specifies the JVM arguments used for the daemon process.
-# The setting is particularly useful for tweaking memory settings.
-# Default value: -Xmx10248m -XX:MaxPermSize=256m
-# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
-
-# When configured, Gradle will run in incubating parallel mode.
-# This option should only be used with decoupled projects. More details, visit
-# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
-# org.gradle.parallel=true \ No newline at end of file
diff --git a/samples/wearable/WatchViewStub/gradle/wrapper/gradle-wrapper.jar b/samples/wearable/WatchViewStub/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index 8c0fb64a8..000000000
--- a/samples/wearable/WatchViewStub/gradle/wrapper/gradle-wrapper.jar
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/WatchViewStub/gradle/wrapper/gradle-wrapper.properties b/samples/wearable/WatchViewStub/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index 1e61d1fd3..000000000
--- a/samples/wearable/WatchViewStub/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-#Wed Apr 10 15:27:10 PDT 2013
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip
diff --git a/samples/wearable/WatchViewStub/gradlew b/samples/wearable/WatchViewStub/gradlew
deleted file mode 100755
index 91a7e269e..000000000
--- a/samples/wearable/WatchViewStub/gradlew
+++ /dev/null
@@ -1,164 +0,0 @@
-#!/usr/bin/env bash
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn ( ) {
- echo "$*"
-}
-
-die ( ) {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
-esac
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched.
-if $cygwin ; then
- [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-fi
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >&-
-APP_HOME="`pwd -P`"
-cd "$SAVED" >&-
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
-}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
-
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/samples/wearable/WatchViewStub/gradlew.bat b/samples/wearable/WatchViewStub/gradlew.bat
deleted file mode 100755
index aec99730b..000000000
--- a/samples/wearable/WatchViewStub/gradlew.bat
+++ /dev/null
@@ -1,90 +0,0 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/samples/wearable/WatchViewStub/screenshots/watch_view_stub_rectangular.png b/samples/wearable/WatchViewStub/screenshots/watch_view_stub_rectangular.png
deleted file mode 100644
index 939cb18da..000000000
--- a/samples/wearable/WatchViewStub/screenshots/watch_view_stub_rectangular.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/WatchViewStub/screenshots/watch_view_stub_round.png b/samples/wearable/WatchViewStub/screenshots/watch_view_stub_round.png
deleted file mode 100644
index 3055f6d00..000000000
--- a/samples/wearable/WatchViewStub/screenshots/watch_view_stub_round.png
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/WatchViewStub/settings.gradle b/samples/wearable/WatchViewStub/settings.gradle
deleted file mode 100644
index 1d97d30e1..000000000
--- a/samples/wearable/WatchViewStub/settings.gradle
+++ /dev/null
@@ -1 +0,0 @@
-include ':Wearable'
diff --git a/samples/wearable/build.gradle b/samples/wearable/build.gradle
deleted file mode 100644
index 6101d4da9..000000000
--- a/samples/wearable/build.gradle
+++ /dev/null
@@ -1,46 +0,0 @@
-buildscript {
- ext.topDir = file('../../../../../')
- repositories {
- mavenCentral()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:0.12.+'
- }
-}
-
-List<String> samples = [
- "AgendaData",
- "DataLayer",
- "DelayedConfirmation",
- "ElizaChat",
- "EmbeddedApp",
- "FindMyPhone",
- "Flashlight",
- "Geofencing",
- "GridViewPager",
- "JumpingJack",
- "Notifications",
- "Quiz",
- "RecipeAssistant",
- "SkeletonWearableApp",
- "SynchronizedNotifications",
- "Timer",
- "WatchViewStub",
-]
-
-List<String> taskNames = [
- "clean",
- "build",
-]
-
-taskNames.each { taskName ->
- def task = project.hasProperty(taskName) ? project.tasks[taskName] : project.task(taskName)
- samples.each { sample ->
- File sampleDir = new File(sample)
- task.dependsOn project.task([type: GradleBuild], "${sample}_${taskName}", {
- buildFile = "${sample}/build.gradle"
- dir = sample
- tasks = [taskName]
- })
- }
-}
diff --git a/samples/wearable/gradle.properties b/samples/wearable/gradle.properties
deleted file mode 100644
index 3372dc3fe..000000000
--- a/samples/wearable/gradle.properties
+++ /dev/null
@@ -1 +0,0 @@
-org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=1024m
diff --git a/samples/wearable/gradle/wrapper/gradle-wrapper.jar b/samples/wearable/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index 8c0fb64a8..000000000
--- a/samples/wearable/gradle/wrapper/gradle-wrapper.jar
+++ /dev/null
Binary files differ
diff --git a/samples/wearable/gradle/wrapper/gradle-wrapper.properties b/samples/wearable/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index 1e61d1fd3..000000000
--- a/samples/wearable/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-#Wed Apr 10 15:27:10 PDT 2013
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip
diff --git a/samples/wearable/gradlew b/samples/wearable/gradlew
deleted file mode 100755
index d8910a5b8..000000000
--- a/samples/wearable/gradlew
+++ /dev/null
@@ -1,174 +0,0 @@
-#!/usr/bin/env bash
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn ( ) {
- echo "$*"
-}
-
-die ( ) {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
-esac
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched.
-if $cygwin ; then
- [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-fi
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >&-
-APP_HOME="`pwd -P`"
-cd "$SAVED" >&-
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
-}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
-
-# Change the project's .gradle to the android out dir.
-ANDROID_GRADLE_ROOT="$APP_HOME/../../../out/host/gradle/tools/updater"
-if [[ -z "$ANDROID_CACHE_DIR" ]]; then
- ANDROID_CACHE_DIR="$ANDROID_GRADLE_ROOT/.gradle"
-fi
-
-# Change the local user directories to be under the android out dir
-export GRADLE_USER_HOME="$ANDROID_GRADLE_ROOT/.gradle"
-export M2_HOME="$ANDROID_GRADLE_ROOT/.m2"
-
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/samples/wearable/gradlew.bat b/samples/wearable/gradlew.bat
deleted file mode 100755
index aec99730b..000000000
--- a/samples/wearable/gradlew.bat
+++ /dev/null
@@ -1,90 +0,0 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/samples/wearable/settings.gradle b/samples/wearable/settings.gradle
deleted file mode 100644
index e69de29bb..000000000
--- a/samples/wearable/settings.gradle
+++ /dev/null
diff --git a/sdk/build_tools_source.prop_template b/sdk/build_tools_source.prop_template
index c9bfc2fe9..a110060a9 100644
--- a/sdk/build_tools_source.prop_template
+++ b/sdk/build_tools_source.prop_template
@@ -1,3 +1,3 @@
Pkg.UserSrc=false
-Pkg.Revision=${PLATFORM_SDK_VERSION}.0.2
+Pkg.Revision=${PLATFORM_SDK_VERSION}.1.3
diff --git a/sdk/platform_source.prop_template b/sdk/platform_source.prop_template
index 9c4705c8d..ccaa59727 100644
--- a/sdk/platform_source.prop_template
+++ b/sdk/platform_source.prop_template
@@ -1,10 +1,10 @@
Pkg.Desc=Android SDK Platform ${PLATFORM_VERSION}
Pkg.UserSrc=false
Platform.Version=${PLATFORM_VERSION}
-Platform.CodeName=L
+Platform.CodeName=LOLLIPOP
Pkg.Revision=1
AndroidVersion.ApiLevel=${PLATFORM_SDK_VERSION}
AndroidVersion.CodeName=${PLATFORM_VERSION_CODENAME}
-Layoutlib.Api=12
+Layoutlib.Api=13
Layoutlib.Revision=1
Platform.MinToolsRev=22
diff --git a/sdk/sdk_files_NOTICE.txt b/sdk/sdk_files_NOTICE.txt
index bb72a3464..2b3d8b57c 100644
--- a/sdk/sdk_files_NOTICE.txt
+++ b/sdk/sdk_files_NOTICE.txt
@@ -9740,6 +9740,7 @@ Notices for file(s):
/bin/dexdump
/bin/dx
/bin/jasmin
+/bin/split-select
/framework/android-mock-generatorlib.jar
/framework/jasmin.jar
/lib/lib64cutils.a
diff --git a/sdk/support_source.prop_template b/sdk/support_source.prop_template
index f5b217eec..78b8dd20b 100644
--- a/sdk/support_source.prop_template
+++ b/sdk/support_source.prop_template
@@ -1,5 +1,5 @@
Pkg.UserSrc=false
-Pkg.Revision=${PLATFORM_SDK_VERSION}.0.0
+Pkg.Revision=${PLATFORM_SDK_VERSION}.0.3
Extra.Vendor=android
Extra.VendorId=android
Extra.VendorDisplay=Android
diff --git a/tools/recovery_l10n/res/values-sk/strings.xml b/tools/recovery_l10n/res/values-sk/strings.xml
index cae6bce7c..e55f83fd5 100644
--- a/tools/recovery_l10n/res/values-sk/strings.xml
+++ b/tools/recovery_l10n/res/values-sk/strings.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="recovery_installing" msgid="7864047928003865598">"Inštalácia aktualizácie systému..."</string>
+ <string name="recovery_installing" msgid="7864047928003865598">"Prebieha inštalácia aktualizácie systému..."</string>
<string name="recovery_erasing" msgid="4612809744968710197">"Prebieha mazanie..."</string>
<string name="recovery_no_command" msgid="1915703879031023455">"Žiadny príkaz."</string>
<string name="recovery_error" msgid="4550265746256727080">"Chyba!"</string>