From b26f52f2c06ee64f4e154f560c93f65982817482 Mon Sep 17 00:00:00 2001 From: Jae Seo Date: Tue, 25 Aug 2015 13:58:27 +0900 Subject: [PATCH] MediaRouter: Add a sample for the custom route icon Bug: 23116379 Change-Id: Ie744f40584e4f39cf17cd58d238f98059a8a88a3 --- .../res/drawable-hdpi/ic_android.png | Bin 0 -> 358 bytes .../res/drawable-mdpi/ic_android.png | Bin 0 -> 226 bytes .../supportv7/media/SampleMediaRouteProvider.java | 13 +++++++------ 3 files changed, 7 insertions(+), 6 deletions(-) create mode 100755 samples/Support7Demos/res/drawable-hdpi/ic_android.png create mode 100755 samples/Support7Demos/res/drawable-mdpi/ic_android.png diff --git a/samples/Support7Demos/res/drawable-hdpi/ic_android.png b/samples/Support7Demos/res/drawable-hdpi/ic_android.png new file mode 100755 index 0000000000000000000000000000000000000000..94b8fb1fa04ec19ebb35c408c3ee73b814bb8747 GIT binary patch literal 358 zcmV-s0h#`ZP)KF$0R7yEF@J6&9)17;lKbdFei%=us!M~4fNqH}gi=94MgcF3{M zoEfi3rL1HMa2aTWXC%@i>&rlGUJ&9v(XvBV$S+}qw#bnpkE;O=Uw-Fo+MpYxEXCI# zPa3Xk8F>yqG+ zP>L@~E6CJXp!%=sNpomi`9ui11bpHn~ofOdXvwChKQp+HL%C(danSG?R!9 z!OaVj56`q_R@bshdz#?Y&Ar1&lQmiD4!gM9&xF5WKAYlK*AyI4wRqBOCwb?S<3xiS zMghq?OpHWq3T-|$^04mmWRt9ys42WQYu+l63g^Zf>R)4j>Q`#U+4Gg~uPs_oopE#z ZgHE29^7mlPPN1V1JYD@<);T3K0RS#_QELDI literal 0 HcmV?d00001 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 7bd6e6f4d..8c5d2262b 100644 --- a/samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouteProvider.java +++ b/samples/Support7Demos/src/com/example/android/supportv7/media/SampleMediaRouteProvider.java @@ -133,18 +133,16 @@ final class SampleMediaRouteProvider extends MediaRouteProvider { f6.addAction(MediaControlIntent.ACTION_GET_SESSION_STATUS); f6.addAction(MediaControlIntent.ACTION_END_SESSION); - CONTROL_FILTERS_BASIC = new ArrayList(); + CONTROL_FILTERS_BASIC = new ArrayList<>(); CONTROL_FILTERS_BASIC.add(f1); CONTROL_FILTERS_BASIC.add(f2); CONTROL_FILTERS_BASIC.add(f3); - CONTROL_FILTERS_QUEUING = - new ArrayList(CONTROL_FILTERS_BASIC); + CONTROL_FILTERS_QUEUING = new ArrayList<>(CONTROL_FILTERS_BASIC); CONTROL_FILTERS_QUEUING.add(f4); CONTROL_FILTERS_QUEUING.add(f5); - CONTROL_FILTERS_SESSION = - new ArrayList(CONTROL_FILTERS_QUEUING); + CONTROL_FILTERS_SESSION = new ArrayList<>(CONTROL_FILTERS_QUEUING); CONTROL_FILTERS_SESSION.add(f6); } @@ -157,7 +155,6 @@ final class SampleMediaRouteProvider extends MediaRouteProvider { } private int mVolume = 5; - private int mEnqueueCount; public SampleMediaRouteProvider(Context context) { super(context); @@ -243,6 +240,9 @@ final class SampleMediaRouteProvider extends MediaRouteProvider { .setVolume(mVolume) .build(); + Uri iconUri = Uri.parse("android.resource://com.example.android.supportv7/" + + R.drawable.ic_android); + MediaRouteDescriptor routeDescriptor6 = new MediaRouteDescriptor.Builder( MIXED_VOLUME_ROUTE_GROUP_ID, r.getString(R.string.mixed_volume_route_group_name)) @@ -250,6 +250,7 @@ final class SampleMediaRouteProvider extends MediaRouteProvider { .addChildId(VARIABLE_VOLUME_BASIC_ROUTE_ID) .addChildId(VARIABLE_VOLUME_QUEUING_ROUTE_ID) .setDescription(r.getString(R.string.sample_route_description)) + .setIconUri(iconUri) .addControlFilters(CONTROL_FILTERS_SESSION) .setPlaybackStream(AudioManager.STREAM_MUSIC) .setPlaybackType(MediaRouter.RouteInfo.PLAYBACK_TYPE_REMOTE)