From bda0c731681aae85372f33910237a9870cefb48f Mon Sep 17 00:00:00 2001
From: Jeff Brown
Date: Tue, 19 Mar 2013 17:06:22 -0700
Subject: [PATCH] Move media router samples to new Support7Demos project.
Add media router support library to SDK build.
Bug: 8175766
Change-Id: I2f333d40ad39e820e8d706a7dab086241692a861
---
build/sdk.atree | 11 ++
samples/Support4Demos/AndroidManifest.xml | 17 --
samples/Support4Demos/res/values/strings.xml | 18 +--
samples/Support7Demos/Android.mk | 38 +++++
samples/Support7Demos/AndroidManifest.xml | 64 ++++++++
samples/Support7Demos/_index.html | 30 ++++
.../res/drawable-hdpi/app_sample_code.png} | Bin
.../res/drawable-hdpi/media_route_icon.png | Bin 0 -> 3608 bytes
.../res/drawable-mdpi/app_sample_code.png} | Bin
.../res/drawable-mdpi/media_route_icon.png | Bin 0 -> 5198 bytes
.../res/layout/sample_media_router.xml | 0
.../res/menu/sample_media_router_menu.xml | 0
.../res/values/arrays.xml | 0
samples/Support7Demos/res/values/strings.xml | 33 ++++
.../android/supportv7/Support7Demos.java | 151 ++++++++++++++++++
.../example/android/supportv7/_package.html | 24 +++
.../example/android/supportv7/app/_index.html | 102 ++++++++++++
.../media/SampleMediaRouteProvider.java | 10 +-
.../SampleMediaRouteProviderService.java | 6 +-
.../media/SampleMediaRouterActivity.java | 12 +-
.../android/supportv7/media/_index.html | 23 +++
21 files changed, 494 insertions(+), 45 deletions(-)
create mode 100644 samples/Support7Demos/Android.mk
create mode 100644 samples/Support7Demos/AndroidManifest.xml
create mode 100644 samples/Support7Demos/_index.html
rename samples/{Support4Demos/res/drawable-hdpi/media_route_icon.png => Support7Demos/res/drawable-hdpi/app_sample_code.png} (100%)
create mode 100755 samples/Support7Demos/res/drawable-hdpi/media_route_icon.png
rename samples/{Support4Demos/res/drawable-mdpi/media_route_icon.png => Support7Demos/res/drawable-mdpi/app_sample_code.png} (100%)
create mode 100644 samples/Support7Demos/res/drawable-mdpi/media_route_icon.png
rename samples/{Support4Demos => Support7Demos}/res/layout/sample_media_router.xml (100%)
rename samples/{Support4Demos => Support7Demos}/res/menu/sample_media_router_menu.xml (100%)
rename samples/{Support4Demos => Support7Demos}/res/values/arrays.xml (100%)
create mode 100644 samples/Support7Demos/res/values/strings.xml
create mode 100644 samples/Support7Demos/src/com/example/android/supportv7/Support7Demos.java
create mode 100644 samples/Support7Demos/src/com/example/android/supportv7/_package.html
create mode 100644 samples/Support7Demos/src/com/example/android/supportv7/app/_index.html
rename samples/{Support4Demos/src/com/example/android/supportv4 => Support7Demos/src/com/example/android/supportv7}/media/SampleMediaRouteProvider.java (96%)
rename samples/{Support4Demos/src/com/example/android/supportv4 => Support7Demos/src/com/example/android/supportv7}/media/SampleMediaRouteProviderService.java (86%)
rename samples/{Support4Demos/src/com/example/android/supportv4 => Support7Demos/src/com/example/android/supportv7}/media/SampleMediaRouterActivity.java (97%)
create mode 100644 samples/Support7Demos/src/com/example/android/supportv7/media/_index.html
diff --git a/build/sdk.atree b/build/sdk.atree
index 410a43c42..7b14b28f6 100644
--- a/build/sdk.atree
+++ b/build/sdk.atree
@@ -252,6 +252,17 @@ frameworks/support/v7/appcompat/res
frameworks/support/v7/appcompat/src/.readme extras/android/support/v7/appcompat/src/.readme
${OUT_DIR}/target/common/obj/PACKAGING/android-support-v7-appcompat_intermediates/android-support-v7-appcompat.jar extras/android/support/appcompat/libs/android-support-v7-appcompat.jar
+frameworks/support/v7/mediarouter/README.txt extras/android/support/v7/mediarouter/README.txt
+frameworks/support/v7/mediarouter/.project extras/android/support/v7/mediarouter/.project
+frameworks/support/v7/mediarouter/.classpath extras/android/support/v7/mediarouter/.classpath
+frameworks/support/v7/mediarouter/AndroidManifest.xml extras/android/support/v7/mediarouter/AndroidManifest.xml
+frameworks/support/v7/mediarouter/project.properties extras/android/support/v7/mediarouter/project.properties
+frameworks/support/v7/mediarouter/res extras/android/support/v7/mediarouter/res
+frameworks/support/v7/mediarouter/src/.readme extras/android/support/v7/mediarouter/src/.readme
+${OUT_DIR}/target/common/obj/PACKAGING/android-support-v7-mediarouter_intermediates/android-support-v7-mediarouter.jar extras/android/support/v7/mediarouter/libs/android-support-v7-mediarouter.jar
+
+development/samples/Support7Demos extras/android/support/samples/Support7Demos
+
##############################################################################
# Tests Component
##############################################################################
diff --git a/samples/Support4Demos/AndroidManifest.xml b/samples/Support4Demos/AndroidManifest.xml
index 023034863..99bacd482 100644
--- a/samples/Support4Demos/AndroidManifest.xml
+++ b/samples/Support4Demos/AndroidManifest.xml
@@ -309,22 +309,5 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/samples/Support4Demos/res/values/strings.xml b/samples/Support4Demos/res/values/strings.xml
index 3a58835b6..977db2f64 100644
--- a/samples/Support4Demos/res/values/strings.xml
+++ b/samples/Support4Demos/res/values/strings.xml
@@ -32,7 +32,9 @@
VioletPress the button to get an activity result, which will be displayed here:Get Result
-
+
+
+
Fragment/Alert DialogFragment/Arguments
@@ -136,19 +138,7 @@
FileProvider example
-
-
- Media/MediaRouter
- This activity demonstrates how to
- use MediaRouter from the support library. Select a route from the action bar.
- Play on...
-
- Play
- Show Statistics
-
- Media Route Provider Service Support Library Sample
- Fixed Volume Remote Playback Route
- Variable Volume Remote Playback Route
+
Without BidiFormatter:With BidiFormatter:
diff --git a/samples/Support7Demos/Android.mk b/samples/Support7Demos/Android.mk
new file mode 100644
index 000000000..0e43e3d44
--- /dev/null
+++ b/samples/Support7Demos/Android.mk
@@ -0,0 +1,38 @@
+# 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.
+
+LOCAL_PATH:= $(call my-dir)
+
+# Build the samples.
+# We need to add some special AAPT flags to generate R classes
+# for resources that are included from the libraries.
+include $(CLEAR_VARS)
+LOCAL_PACKAGE_NAME := Support7Demos
+LOCAL_MODULE_TAGS := samples tests
+LOCAL_SDK_VERSION := current
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ android-support-v4 \
+ android-support-v7-appcompat \
+ android-support-v7-gridlayout \
+ android-support-v7-mediarouter
+LOCAL_RESOURCE_DIR = \
+ $(LOCAL_PATH)/res \
+ frameworks/support/v7/appcompat/res \
+ frameworks/support/v7/gridlayout/res \
+ frameworks/support/v7/mediarouter/res
+LOCAL_AAPT_FLAGS := \
+ --auto-add-overlay \
+ --extra-packages android.support.v7.appcompat:android.support.v7.gridlayout:android.support.v7.mediarouter
+include $(BUILD_PACKAGE)
diff --git a/samples/Support7Demos/AndroidManifest.xml b/samples/Support7Demos/AndroidManifest.xml
new file mode 100644
index 000000000..6d93b62a0
--- /dev/null
+++ b/samples/Support7Demos/AndroidManifest.xml
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/Support7Demos/_index.html b/samples/Support7Demos/_index.html
new file mode 100644
index 000000000..0c017ab6d
--- /dev/null
+++ b/samples/Support7Demos/_index.html
@@ -0,0 +1,30 @@
+
The Support v7 Demos application contains a variety of small sample
+code showing how to use key features of the Android API 7+ Support Library.
+This library contains code that you can
+build in to your application to access new features and common
+utilities while being able to run down to version 2.1 (API 7)
+of the platform.
+
This section includes samples showing the use of the application
+package features of the static support library, in particular fragments
+and loaders.
Demonstrates how a fragment can be initialized with arguments,
+ supplying them either as an argument Bundle at runtime or XML attributes
+ in a <fragment> tag.
Demonstrates use of the <fragment> tag to embed a Fragment in
+ an Activity's content view layout, and making the layout change based on
+ configuration to achieve different UI flows.
Demonstrates the use of the support class ViewPager with a
+ FragmentPagerAdapter to build a user interface where the user can fling
+ left or right to switch between fragments.
Demonstrates the use of the support class ViewPager with a
+ FragmentStatePagerAdapter to build a user interface where the user can fling
+ left or right to switch between fragments. This versions of the adapter
+ doesn't keep around the fragment instances that ViewPager has destroyed.
Demonstrates the use of fragments to implement switching between
+ tabs in a TabHost, using a ViewPager to manager the fragments so that
+ the user can also fling left and right to switch tabs.
Complete end-to-end demonstration of a simple content provider that
+ populates data in a list through a cursor loader. The UI allows the list
+ to be populated with a series of items, showing how AsyncTaskLoader's
+ throttling facility can be used to control how much a Loader is refreshed
+ in this case.
+
+
\ No newline at end of file
diff --git a/samples/Support4Demos/src/com/example/android/supportv4/media/SampleMediaRouteProvider.java b/samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouteProvider.java
similarity index 96%
rename from samples/Support4Demos/src/com/example/android/supportv4/media/SampleMediaRouteProvider.java
rename to samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouteProvider.java
index 7dc191397..3d8abc992 100644
--- a/samples/Support4Demos/src/com/example/android/supportv4/media/SampleMediaRouteProvider.java
+++ b/samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouteProvider.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.example.android.supportv4.media;
+package com.example.android.supportv7.media;
-import com.example.android.supportv4.R;
+import com.example.android.supportv7.R;
import android.content.Context;
import android.content.Intent;
@@ -26,9 +26,9 @@ import android.content.res.Resources;
import android.media.MediaRouter;
import android.net.Uri;
import android.os.Bundle;
-import android.support.v4.media.MediaControlIntent;
-import android.support.v4.media.MediaRouteProvider;
-import android.support.v4.media.MediaRouter.ControlRequestCallback;
+import android.support.v7.media.MediaControlIntent;
+import android.support.v7.media.MediaRouteProvider;
+import android.support.v7.media.MediaRouter.ControlRequestCallback;
import android.util.Log;
import android.widget.Toast;
diff --git a/samples/Support4Demos/src/com/example/android/supportv4/media/SampleMediaRouteProviderService.java b/samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouteProviderService.java
similarity index 86%
rename from samples/Support4Demos/src/com/example/android/supportv4/media/SampleMediaRouteProviderService.java
rename to samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouteProviderService.java
index 4528e3985..bb0aa07e2 100644
--- a/samples/Support4Demos/src/com/example/android/supportv4/media/SampleMediaRouteProviderService.java
+++ b/samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouteProviderService.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.example.android.supportv4.media;
+package com.example.android.supportv7.media;
-import android.support.v4.media.MediaRouteProvider;
-import android.support.v4.media.MediaRouteProviderService;
+import android.support.v7.media.MediaRouteProvider;
+import android.support.v7.media.MediaRouteProviderService;
/**
* Demonstrates how to register a custom media route provider service
diff --git a/samples/Support4Demos/src/com/example/android/supportv4/media/SampleMediaRouterActivity.java b/samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouterActivity.java
similarity index 97%
rename from samples/Support4Demos/src/com/example/android/supportv4/media/SampleMediaRouterActivity.java
rename to samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouterActivity.java
index 48afad214..c3ead3c0a 100644
--- a/samples/Support4Demos/src/com/example/android/supportv4/media/SampleMediaRouterActivity.java
+++ b/samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouterActivity.java
@@ -14,19 +14,19 @@
* limitations under the License.
*/
-package com.example.android.supportv4.media;
+package com.example.android.supportv7.media;
-import com.example.android.supportv4.R;
+import com.example.android.supportv7.R;
import android.app.Activity;
import android.app.MediaRouteActionProvider;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
-import android.support.v4.media.MediaControlIntent;
-import android.support.v4.media.MediaRouter;
-import android.support.v4.media.MediaRouter.RouteInfo;
-import android.support.v4.media.MediaRouter.ProviderInfo;
+import android.support.v7.media.MediaControlIntent;
+import android.support.v7.media.MediaRouter;
+import android.support.v7.media.MediaRouter.RouteInfo;
+import android.support.v7.media.MediaRouter.ProviderInfo;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
diff --git a/samples/Support7Demos/src/com/example/android/supportv7/media/_index.html b/samples/Support7Demos/src/com/example/android/supportv7/media/_index.html
new file mode 100644
index 000000000..a443287cc
--- /dev/null
+++ b/samples/Support7Demos/src/com/example/android/supportv7/media/_index.html
@@ -0,0 +1,23 @@
+
+
This section includes samples showing the use of the application
+package features of the static support library.