From 2292312f402048db15107bebb6c36236e5bcf591 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Mon, 24 Mar 2014 20:36:34 -0700 Subject: #313 Add x for remote, make it stop + disconnect --- res/layout/notification_expanded.xml | 35 ++++++++++++++++------ .../daneren2005/dsub/service/DownloadService.java | 6 ++++ src/github/daneren2005/dsub/util/Util.java | 14 +++++++-- 3 files changed, 43 insertions(+), 12 deletions(-) diff --git a/res/layout/notification_expanded.xml b/res/layout/notification_expanded.xml index 3e2c7fcd..5fc4156a 100644 --- a/res/layout/notification_expanded.xml +++ b/res/layout/notification_expanded.xml @@ -19,15 +19,32 @@ android:orientation="vertical" android:paddingLeft="11.0dip" > - + + + + + + = Build.VERSION_CODES.JELLY_BEAN){ RemoteViews expandedContentView = new RemoteViews(context.getPackageName(), R.layout.notification_expanded); - setupViews(expandedContentView,context,song, playing); + setupViews(expandedContentView,context,song, playing, remote); notification.bigContentView = expandedContentView; } RemoteViews smallContentView = new RemoteViews(context.getPackageName(), R.layout.notification); - setupViews(smallContentView, context, song, playing); + setupViews(smallContentView, context, song, playing, remote); notification.contentView = smallContentView; Intent notificationIntent = new Intent(context, SubsonicFragmentActivity.class); @@ -1005,7 +1008,7 @@ public final class Util { DSubWidgetProvider.notifyInstances(context, downloadService, playing); } - private static void setupViews(RemoteViews rv, Context context, MusicDirectory.Entry song, boolean playing){ + private static void setupViews(RemoteViews rv, Context context, MusicDirectory.Entry song, boolean playing, boolean remote){ // Use the same text for the ticker and the expanded notification String title = song.getTitle(); @@ -1062,6 +1065,11 @@ public final class Util { next = R.id.control_next; } + if(remote && close == 0) { + close = R.id.notification_close; + rv.setViewVisibility(close, View.VISIBLE); + } + if(previous > 0) { Intent prevIntent = new Intent("KEYCODE_MEDIA_PREVIOUS"); prevIntent.setComponent(new ComponentName(context, DownloadService.class)); -- cgit v1.2.3