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 @@ Violet Press the button to get an activity result, which will be displayed here: Get Result - + + + Fragment/Alert Dialog Fragment/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. +

+ + diff --git a/samples/Support4Demos/res/drawable-hdpi/media_route_icon.png b/samples/Support7Demos/res/drawable-hdpi/app_sample_code.png similarity index 100% rename from samples/Support4Demos/res/drawable-hdpi/media_route_icon.png rename to samples/Support7Demos/res/drawable-hdpi/app_sample_code.png diff --git a/samples/Support7Demos/res/drawable-hdpi/media_route_icon.png b/samples/Support7Demos/res/drawable-hdpi/media_route_icon.png new file mode 100755 index 0000000000000000000000000000000000000000..66a198496cfb3e77bffb2ca97007e30b2837106a GIT binary patch literal 3608 zcmV+z4(IWSP)>Yjs+!VGP=X>Hec-`Em6es-s;jFtd9cIbfR>gP zFdB^q@$jX-zVr9g)^3~Cop40VIQk#ix^=7O4QOs|hK7cQj_T@~7f_u|Isg&LF_}z_ z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&8x_(e}zye zL@*d|6bWnsU{Fw1iw$~32CSL`_3@4t7RFFp5M#qSRf5A)&m z>lLpBgF#{r!=Q5jEC%Shwk7~d8CxvIrHdD<-sJT3GzSkIA{L7kn<4QySFc=QczC$# zm|fB6n${#s4ggr7o?#djk+Wl}s&ek^*%jY0#N%<^dh<<3;||@p!IMuuiQSDGinY?AfD7Q40mU9uEf&9>C-A(%ak1*>mR@yM5c%7+$ZJ zlP|tVcXzkd7#ZWz#fyCT`R5(4%QgVzug8TDYX+bgua7S}54X0`+0kJefR>gPdU|?F z=bfFMbar;Gu`#@621qsa-_(*?zoWB*W5TM@R9ghQqB44h}AQags`O97B6ZjTQE+bM1)@cy3wkOyWcZjwp>c_DvpyR_h{Z1OINIiKhBg7%1Yi?@$J+io0NzSjgnf4iF8}}l07*qo IM6N<$f@LhcdjJ3c literal 0 HcmV?d00001 diff --git a/samples/Support4Demos/res/layout/sample_media_router.xml b/samples/Support7Demos/res/layout/sample_media_router.xml similarity index 100% rename from samples/Support4Demos/res/layout/sample_media_router.xml rename to samples/Support7Demos/res/layout/sample_media_router.xml diff --git a/samples/Support4Demos/res/menu/sample_media_router_menu.xml b/samples/Support7Demos/res/menu/sample_media_router_menu.xml similarity index 100% rename from samples/Support4Demos/res/menu/sample_media_router_menu.xml rename to samples/Support7Demos/res/menu/sample_media_router_menu.xml diff --git a/samples/Support4Demos/res/values/arrays.xml b/samples/Support7Demos/res/values/arrays.xml similarity index 100% rename from samples/Support4Demos/res/values/arrays.xml rename to samples/Support7Demos/res/values/arrays.xml diff --git a/samples/Support7Demos/res/values/strings.xml b/samples/Support7Demos/res/values/strings.xml new file mode 100644 index 000000000..d7ccc44f5 --- /dev/null +++ b/samples/Support7Demos/res/values/strings.xml @@ -0,0 +1,33 @@ + + + + + Support v7 Demos + + + + 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 + diff --git a/samples/Support7Demos/src/com/example/android/supportv7/Support7Demos.java b/samples/Support7Demos/src/com/example/android/supportv7/Support7Demos.java new file mode 100644 index 000000000..d2e633540 --- /dev/null +++ b/samples/Support7Demos/src/com/example/android/supportv7/Support7Demos.java @@ -0,0 +1,151 @@ +/* + * 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; + +import android.app.ListActivity; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; +import android.os.Bundle; +import android.view.View; +import android.widget.ListView; +import android.widget.SimpleAdapter; + +import java.text.Collator; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class Support7Demos extends ListActivity { + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + Intent intent = getIntent(); + String path = intent.getStringExtra("com.example.android.apis.Path"); + + if (path == null) { + path = ""; + } + + setListAdapter(new SimpleAdapter(this, getData(path), + android.R.layout.simple_list_item_1, new String[] { "title" }, + new int[] { android.R.id.text1 })); + getListView().setTextFilterEnabled(true); + } + + protected List> getData(String prefix) { + List> myData = new ArrayList>(); + + Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); + mainIntent.addCategory("com.example.android.supportv7.SUPPORT4_SAMPLE_CODE"); + + PackageManager pm = getPackageManager(); + List list = pm.queryIntentActivities(mainIntent, 0); + + if (null == list) + return myData; + + String[] prefixPath; + String prefixWithSlash = prefix; + + if (prefix.equals("")) { + prefixPath = null; + } else { + prefixPath = prefix.split("/"); + prefixWithSlash = prefix + "/"; + } + + int len = list.size(); + + Map entries = new HashMap(); + + for (int i = 0; i < len; i++) { + ResolveInfo info = list.get(i); + CharSequence labelSeq = info.loadLabel(pm); + String label = labelSeq != null + ? labelSeq.toString() + : info.activityInfo.name; + + if (prefixWithSlash.length() == 0 || label.startsWith(prefixWithSlash)) { + + String[] labelPath = label.split("/"); + + String nextLabel = prefixPath == null ? labelPath[0] : labelPath[prefixPath.length]; + + if ((prefixPath != null ? prefixPath.length : 0) == labelPath.length - 1) { + addItem(myData, nextLabel, activityIntent( + info.activityInfo.applicationInfo.packageName, + info.activityInfo.name)); + } else { + if (entries.get(nextLabel) == null) { + addItem(myData, nextLabel, browseIntent( + prefix.equals("") ? nextLabel : prefix + "/" + nextLabel)); + entries.put(nextLabel, true); + } + } + } + } + + Collections.sort(myData, sDisplayNameComparator); + + return myData; + } + + private final static Comparator> sDisplayNameComparator = + new Comparator>() { + private final Collator collator = Collator.getInstance(); + + @Override + public int compare(Map map1, Map map2) { + return collator.compare(map1.get("title"), map2.get("title")); + } + }; + + protected Intent activityIntent(String pkg, String componentName) { + Intent result = new Intent(); + result.setClassName(pkg, componentName); + return result; + } + + protected Intent browseIntent(String path) { + Intent result = new Intent(); + result.setClass(this, Support7Demos.class); + result.putExtra("com.example.android.apis.Path", path); + return result; + } + + protected void addItem(List> data, String name, Intent intent) { + Map temp = new HashMap(); + temp.put("title", name); + temp.put("intent", intent); + data.add(temp); + } + + @Override + @SuppressWarnings("unchecked") + protected void onListItemClick(ListView l, View v, int position, long id) { + Map map = (Map)l.getItemAtPosition(position); + + Intent intent = (Intent) map.get("intent"); + startActivity(intent); + } +} diff --git a/samples/Support7Demos/src/com/example/android/supportv7/_package.html b/samples/Support7Demos/src/com/example/android/supportv7/_package.html new file mode 100644 index 000000000..be85e7887 --- /dev/null +++ b/samples/Support7Demos/src/com/example/android/supportv7/_package.html @@ -0,0 +1,24 @@ + + + + + + + + + + + + +

+Examples of how to use support library APIs. See: + +

    +
  1. sdk.app for examples + of using the application package support APIs. +
+

+ + + + diff --git a/samples/Support7Demos/src/com/example/android/supportv7/app/_index.html b/samples/Support7Demos/src/com/example/android/supportv7/app/_index.html new file mode 100644 index 000000000..d203ffb6b --- /dev/null +++ b/samples/Support7Demos/src/com/example/android/supportv7/app/_index.html @@ -0,0 +1,102 @@ + +

This section includes samples showing the use of the application +package features of the static support library, in particular fragments +and loaders.

+ + + +

Fragment

+
+
Fragment Alert Dialog
+
Demonstrates how to use a DialogFragment to show and manage an + AlertDialog.
+ +
Fragment Arguments
+
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.
+ +
Fragment Context Menu
+
Demonstrates how to display and respond to a context menu that is + display from a fragment's view hierarchy.
+ +
Fragment Custom Animation
+
Demonstrates the use of a custom animation for pushing and popping fragments + on the back stack.
+ +
Fragment Dialog
+
Demonstrates use of DialogFragment to show various types of dialogs.
+ +
Fragment Dialog or Activity
+
Demonstrates how the same Fragment implementation can be used to provide the UI + for either an Activity or Dialog.
+ +
Fragment Hide Show
+
Demonstrates hiding and showing fragments.
+ +
Fragment Layout
+
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.
+ +
Fragment List Array
+
Demonstrates use of ListFragment to show the contents of a simple ArrayAdapter.
+ +
Fragment Menu
+
Demonstrates populating custom menu items from a Fragment.
+ +
Fragment Pager Support
+
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.
+ +
Fragment State Pager Support
+
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.
+ +
Fragment Receive Result
+
Demonstrates starting a new Activity from a Fragment, and receiving + a result back from it.
+ +
Fragment Retain Instance
+
Demonstrates a Fragment can be used to easily retain active state across + an Activity's configuration change.
+ +
Fragment Stack
+
Demonstrates creating a stack of Fragment instances similar to the + traditional stack of activities.
+ +
Fragment Tabs
+
Demonstrates the use of fragments to implement switching between + tabs in a TabHost.
+ +
Fragment Tabs Pager
+
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.
+ +
+ +

LoaderManager

+
+
Loader Cursor
+
Demonstrates use of LoaderManager to perform a query for a Cursor that + populates a ListFragment.
+ +
Loader Custom
+
Demonstrates implementation and use of a custom Loader class. The + custom class here "loads" the currently installed applications.
+ +
Loader Throttle
+
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.

+ + + +

MediaRouter

+
+
Media Route Provider
+
Demonstrates how to implement a MediaRouteProvider to discover, + publish and control custom media routes.
+ +
Media Route Provider Service
+
Demonstrates how to make a MediaRouteProvider available to all + running applications by registering it as a service.
+ +
Media Router Activity
+
Demonstrates how to use MediaRouter within an Activity to support + remote media playback.
+
+ \ No newline at end of file