aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-11-06 17:24:32 -0800
committerScott Jackson <daneren2005@gmail.com>2013-11-06 17:24:32 -0800
commitf485e54048ea911039448987552269429e3de9a4 (patch)
tree6945bb8acc13e8f369fc0f8458b570a8fe5d206c
parent8ec81cc164f5518175d74bffee5754a452728f50 (diff)
downloaddsub-f485e54048ea911039448987552269429e3de9a4.tar.gz
dsub-f485e54048ea911039448987552269429e3de9a4.tar.bz2
dsub-f485e54048ea911039448987552269429e3de9a4.zip
Closes #178 Made persistent notification more like standard, updated icons
-rw-r--r--res/drawable-hdpi-v11/notification_close.pngbin0 -> 384 bytes
-rw-r--r--res/drawable-hdpi-v11/notification_next.pngbin0 -> 525 bytes
-rw-r--r--res/drawable-hdpi-v11/notification_pause.pngbin0 -> 210 bytes
-rw-r--r--res/drawable-hdpi-v11/notification_play.pngbin0 -> 385 bytes
-rw-r--r--res/drawable-hdpi-v11/notification_previous.pngbin0 -> 541 bytes
-rw-r--r--res/drawable-hdpi/notification_close.pngbin0 -> 501 bytes
-rw-r--r--res/drawable-hdpi/notification_next.pngbin941 -> 651 bytes
-rw-r--r--res/drawable-hdpi/notification_pause.pngbin233 -> 459 bytes
-rw-r--r--res/drawable-hdpi/notification_play.pngbin807 -> 599 bytes
-rw-r--r--res/drawable-hdpi/notification_prev.pngbin957 -> 0 bytes
-rw-r--r--res/drawable-hdpi/notification_previous.pngbin0 -> 633 bytes
-rw-r--r--res/drawable-hdpi/notification_stop.pngbin338 -> 0 bytes
-rw-r--r--res/drawable-mdpi-v11/notification_close.pngbin0 -> 241 bytes
-rw-r--r--res/drawable-mdpi-v11/notification_next.pngbin0 -> 341 bytes
-rw-r--r--res/drawable-mdpi-v11/notification_pause.pngbin0 -> 156 bytes
-rw-r--r--res/drawable-mdpi-v11/notification_play.pngbin0 -> 280 bytes
-rw-r--r--res/drawable-mdpi-v11/notification_previous.pngbin0 -> 355 bytes
-rw-r--r--res/drawable-mdpi/notification_close.pngbin0 -> 337 bytes
-rw-r--r--res/drawable-mdpi/notification_next.pngbin0 -> 460 bytes
-rw-r--r--res/drawable-mdpi/notification_pause.pngbin0 -> 361 bytes
-rw-r--r--res/drawable-mdpi/notification_play.pngbin0 -> 417 bytes
-rw-r--r--res/drawable-mdpi/notification_previous.pngbin0 -> 476 bytes
-rw-r--r--res/drawable-xhdpi-v11/notification_close.pngbin0 -> 491 bytes
-rw-r--r--res/drawable-xhdpi-v11/notification_next.pngbin0 -> 731 bytes
-rw-r--r--res/drawable-xhdpi-v11/notification_pause.pngbin0 -> 257 bytes
-rw-r--r--res/drawable-xhdpi-v11/notification_play.pngbin0 -> 493 bytes
-rw-r--r--res/drawable-xhdpi-v11/notification_previous.pngbin0 -> 750 bytes
-rw-r--r--res/drawable-xhdpi/notification_close.pngbin0 -> 538 bytes
-rw-r--r--res/drawable-xhdpi/notification_next.pngbin0 -> 886 bytes
-rw-r--r--res/drawable-xhdpi/notification_pause.pngbin0 -> 529 bytes
-rw-r--r--res/drawable-xhdpi/notification_play.pngbin0 -> 753 bytes
-rw-r--r--res/drawable-xhdpi/notification_previous.pngbin0 -> 891 bytes
-rw-r--r--res/drawable-xxhdpi-v11/notification_close.pngbin0 -> 712 bytes
-rw-r--r--res/drawable-xxhdpi-v11/notification_next.pngbin0 -> 1105 bytes
-rw-r--r--res/drawable-xxhdpi-v11/notification_pause.pngbin0 -> 358 bytes
-rw-r--r--res/drawable-xxhdpi-v11/notification_play.pngbin0 -> 781 bytes
-rw-r--r--res/drawable-xxhdpi-v11/notification_previous.pngbin0 -> 1143 bytes
-rw-r--r--res/drawable-xxhdpi/notification_close.pngbin0 -> 1081 bytes
-rw-r--r--res/drawable-xxhdpi/notification_next.pngbin0 -> 1292 bytes
-rw-r--r--res/drawable-xxhdpi/notification_pause.pngbin0 -> 724 bytes
-rw-r--r--res/drawable-xxhdpi/notification_play.pngbin0 -> 1125 bytes
-rw-r--r--res/drawable-xxhdpi/notification_previous.pngbin0 -> 1261 bytes
-rw-r--r--res/layout/notification.xml120
-rw-r--r--res/layout/notification_expanded.xml2
-rw-r--r--src/github/daneren2005/dsub/util/Util.java63
45 files changed, 94 insertions, 91 deletions
diff --git a/res/drawable-hdpi-v11/notification_close.png b/res/drawable-hdpi-v11/notification_close.png
new file mode 100644
index 00000000..254e130f
--- /dev/null
+++ b/res/drawable-hdpi-v11/notification_close.png
Binary files differ
diff --git a/res/drawable-hdpi-v11/notification_next.png b/res/drawable-hdpi-v11/notification_next.png
new file mode 100644
index 00000000..59239305
--- /dev/null
+++ b/res/drawable-hdpi-v11/notification_next.png
Binary files differ
diff --git a/res/drawable-hdpi-v11/notification_pause.png b/res/drawable-hdpi-v11/notification_pause.png
new file mode 100644
index 00000000..cbd61795
--- /dev/null
+++ b/res/drawable-hdpi-v11/notification_pause.png
Binary files differ
diff --git a/res/drawable-hdpi-v11/notification_play.png b/res/drawable-hdpi-v11/notification_play.png
new file mode 100644
index 00000000..78b4d5bf
--- /dev/null
+++ b/res/drawable-hdpi-v11/notification_play.png
Binary files differ
diff --git a/res/drawable-hdpi-v11/notification_previous.png b/res/drawable-hdpi-v11/notification_previous.png
new file mode 100644
index 00000000..556eaec3
--- /dev/null
+++ b/res/drawable-hdpi-v11/notification_previous.png
Binary files differ
diff --git a/res/drawable-hdpi/notification_close.png b/res/drawable-hdpi/notification_close.png
new file mode 100644
index 00000000..916c9a0f
--- /dev/null
+++ b/res/drawable-hdpi/notification_close.png
Binary files differ
diff --git a/res/drawable-hdpi/notification_next.png b/res/drawable-hdpi/notification_next.png
index 5835f654..078c310f 100644
--- a/res/drawable-hdpi/notification_next.png
+++ b/res/drawable-hdpi/notification_next.png
Binary files differ
diff --git a/res/drawable-hdpi/notification_pause.png b/res/drawable-hdpi/notification_pause.png
index 3324f88f..16627e44 100644
--- a/res/drawable-hdpi/notification_pause.png
+++ b/res/drawable-hdpi/notification_pause.png
Binary files differ
diff --git a/res/drawable-hdpi/notification_play.png b/res/drawable-hdpi/notification_play.png
index 8c95b6a5..02f38944 100644
--- a/res/drawable-hdpi/notification_play.png
+++ b/res/drawable-hdpi/notification_play.png
Binary files differ
diff --git a/res/drawable-hdpi/notification_prev.png b/res/drawable-hdpi/notification_prev.png
deleted file mode 100644
index 73fb16f2..00000000
--- a/res/drawable-hdpi/notification_prev.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/notification_previous.png b/res/drawable-hdpi/notification_previous.png
new file mode 100644
index 00000000..9d10abd9
--- /dev/null
+++ b/res/drawable-hdpi/notification_previous.png
Binary files differ
diff --git a/res/drawable-hdpi/notification_stop.png b/res/drawable-hdpi/notification_stop.png
deleted file mode 100644
index ab98e188..00000000
--- a/res/drawable-hdpi/notification_stop.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi-v11/notification_close.png b/res/drawable-mdpi-v11/notification_close.png
new file mode 100644
index 00000000..a056fe61
--- /dev/null
+++ b/res/drawable-mdpi-v11/notification_close.png
Binary files differ
diff --git a/res/drawable-mdpi-v11/notification_next.png b/res/drawable-mdpi-v11/notification_next.png
new file mode 100644
index 00000000..7297577f
--- /dev/null
+++ b/res/drawable-mdpi-v11/notification_next.png
Binary files differ
diff --git a/res/drawable-mdpi-v11/notification_pause.png b/res/drawable-mdpi-v11/notification_pause.png
new file mode 100644
index 00000000..5d3ca3f2
--- /dev/null
+++ b/res/drawable-mdpi-v11/notification_pause.png
Binary files differ
diff --git a/res/drawable-mdpi-v11/notification_play.png b/res/drawable-mdpi-v11/notification_play.png
new file mode 100644
index 00000000..999ce798
--- /dev/null
+++ b/res/drawable-mdpi-v11/notification_play.png
Binary files differ
diff --git a/res/drawable-mdpi-v11/notification_previous.png b/res/drawable-mdpi-v11/notification_previous.png
new file mode 100644
index 00000000..55a1f326
--- /dev/null
+++ b/res/drawable-mdpi-v11/notification_previous.png
Binary files differ
diff --git a/res/drawable-mdpi/notification_close.png b/res/drawable-mdpi/notification_close.png
new file mode 100644
index 00000000..2a8f9a36
--- /dev/null
+++ b/res/drawable-mdpi/notification_close.png
Binary files differ
diff --git a/res/drawable-mdpi/notification_next.png b/res/drawable-mdpi/notification_next.png
new file mode 100644
index 00000000..f85d45a5
--- /dev/null
+++ b/res/drawable-mdpi/notification_next.png
Binary files differ
diff --git a/res/drawable-mdpi/notification_pause.png b/res/drawable-mdpi/notification_pause.png
new file mode 100644
index 00000000..06c3cf9d
--- /dev/null
+++ b/res/drawable-mdpi/notification_pause.png
Binary files differ
diff --git a/res/drawable-mdpi/notification_play.png b/res/drawable-mdpi/notification_play.png
new file mode 100644
index 00000000..0248c1cc
--- /dev/null
+++ b/res/drawable-mdpi/notification_play.png
Binary files differ
diff --git a/res/drawable-mdpi/notification_previous.png b/res/drawable-mdpi/notification_previous.png
new file mode 100644
index 00000000..167d7d05
--- /dev/null
+++ b/res/drawable-mdpi/notification_previous.png
Binary files differ
diff --git a/res/drawable-xhdpi-v11/notification_close.png b/res/drawable-xhdpi-v11/notification_close.png
new file mode 100644
index 00000000..f1013578
--- /dev/null
+++ b/res/drawable-xhdpi-v11/notification_close.png
Binary files differ
diff --git a/res/drawable-xhdpi-v11/notification_next.png b/res/drawable-xhdpi-v11/notification_next.png
new file mode 100644
index 00000000..ad070680
--- /dev/null
+++ b/res/drawable-xhdpi-v11/notification_next.png
Binary files differ
diff --git a/res/drawable-xhdpi-v11/notification_pause.png b/res/drawable-xhdpi-v11/notification_pause.png
new file mode 100644
index 00000000..709602aa
--- /dev/null
+++ b/res/drawable-xhdpi-v11/notification_pause.png
Binary files differ
diff --git a/res/drawable-xhdpi-v11/notification_play.png b/res/drawable-xhdpi-v11/notification_play.png
new file mode 100644
index 00000000..e2bafa6a
--- /dev/null
+++ b/res/drawable-xhdpi-v11/notification_play.png
Binary files differ
diff --git a/res/drawable-xhdpi-v11/notification_previous.png b/res/drawable-xhdpi-v11/notification_previous.png
new file mode 100644
index 00000000..d22488cb
--- /dev/null
+++ b/res/drawable-xhdpi-v11/notification_previous.png
Binary files differ
diff --git a/res/drawable-xhdpi/notification_close.png b/res/drawable-xhdpi/notification_close.png
new file mode 100644
index 00000000..4230842e
--- /dev/null
+++ b/res/drawable-xhdpi/notification_close.png
Binary files differ
diff --git a/res/drawable-xhdpi/notification_next.png b/res/drawable-xhdpi/notification_next.png
new file mode 100644
index 00000000..44dbbd12
--- /dev/null
+++ b/res/drawable-xhdpi/notification_next.png
Binary files differ
diff --git a/res/drawable-xhdpi/notification_pause.png b/res/drawable-xhdpi/notification_pause.png
new file mode 100644
index 00000000..e8d8c535
--- /dev/null
+++ b/res/drawable-xhdpi/notification_pause.png
Binary files differ
diff --git a/res/drawable-xhdpi/notification_play.png b/res/drawable-xhdpi/notification_play.png
new file mode 100644
index 00000000..532041fa
--- /dev/null
+++ b/res/drawable-xhdpi/notification_play.png
Binary files differ
diff --git a/res/drawable-xhdpi/notification_previous.png b/res/drawable-xhdpi/notification_previous.png
new file mode 100644
index 00000000..87ee8d2f
--- /dev/null
+++ b/res/drawable-xhdpi/notification_previous.png
Binary files differ
diff --git a/res/drawable-xxhdpi-v11/notification_close.png b/res/drawable-xxhdpi-v11/notification_close.png
new file mode 100644
index 00000000..c3ac026a
--- /dev/null
+++ b/res/drawable-xxhdpi-v11/notification_close.png
Binary files differ
diff --git a/res/drawable-xxhdpi-v11/notification_next.png b/res/drawable-xxhdpi-v11/notification_next.png
new file mode 100644
index 00000000..06911082
--- /dev/null
+++ b/res/drawable-xxhdpi-v11/notification_next.png
Binary files differ
diff --git a/res/drawable-xxhdpi-v11/notification_pause.png b/res/drawable-xxhdpi-v11/notification_pause.png
new file mode 100644
index 00000000..1513f9d9
--- /dev/null
+++ b/res/drawable-xxhdpi-v11/notification_pause.png
Binary files differ
diff --git a/res/drawable-xxhdpi-v11/notification_play.png b/res/drawable-xxhdpi-v11/notification_play.png
new file mode 100644
index 00000000..9138a760
--- /dev/null
+++ b/res/drawable-xxhdpi-v11/notification_play.png
Binary files differ
diff --git a/res/drawable-xxhdpi-v11/notification_previous.png b/res/drawable-xxhdpi-v11/notification_previous.png
new file mode 100644
index 00000000..b4456c16
--- /dev/null
+++ b/res/drawable-xxhdpi-v11/notification_previous.png
Binary files differ
diff --git a/res/drawable-xxhdpi/notification_close.png b/res/drawable-xxhdpi/notification_close.png
new file mode 100644
index 00000000..022a6780
--- /dev/null
+++ b/res/drawable-xxhdpi/notification_close.png
Binary files differ
diff --git a/res/drawable-xxhdpi/notification_next.png b/res/drawable-xxhdpi/notification_next.png
new file mode 100644
index 00000000..dfe129db
--- /dev/null
+++ b/res/drawable-xxhdpi/notification_next.png
Binary files differ
diff --git a/res/drawable-xxhdpi/notification_pause.png b/res/drawable-xxhdpi/notification_pause.png
new file mode 100644
index 00000000..9c952207
--- /dev/null
+++ b/res/drawable-xxhdpi/notification_pause.png
Binary files differ
diff --git a/res/drawable-xxhdpi/notification_play.png b/res/drawable-xxhdpi/notification_play.png
new file mode 100644
index 00000000..4ee0a5eb
--- /dev/null
+++ b/res/drawable-xxhdpi/notification_play.png
Binary files differ
diff --git a/res/drawable-xxhdpi/notification_previous.png b/res/drawable-xxhdpi/notification_previous.png
new file mode 100644
index 00000000..e6908126
--- /dev/null
+++ b/res/drawable-xxhdpi/notification_previous.png
Binary files differ
diff --git a/res/layout/notification.xml b/res/layout/notification.xml
index 22e2cb63..55c7be2a 100644
--- a/res/layout/notification.xml
+++ b/res/layout/notification.xml
@@ -14,10 +14,12 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
android:orientation="vertical"
- android:paddingLeft="11.0dip">
+ android:paddingLeft="11.0dip"
+ android:layout_gravity="center_vertical">
<TextView
android:id="@+id/notification_title"
@@ -28,76 +30,54 @@
android:ellipsize="marquee"
android:focusable="true"
android:singleLine="true" />
-
- <LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:orientation="horizontal" >
-
- <LinearLayout
- android:layout_width="0.0dp"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
- android:layout_weight="1.0"
- android:orientation="vertical">
- <TextView
- android:id="@+id/notification_artist"
- style="@android:style/TextAppearance.StatusBar.EventContent"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="left"
- android:ellipsize="end"
- android:scrollHorizontally="true"
- android:singleLine="true" />
+ <TextView
+ android:id="@+id/notification_artist"
+ style="@android:style/TextAppearance.StatusBar.EventContent"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="left"
+ android:ellipsize="end"
+ android:scrollHorizontally="true"
+ android:singleLine="true" />
- <TextView
- android:id="@+id/notification_album"
- style="@android:style/TextAppearance.StatusBar.EventContent"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="left"
- android:ellipsize="end"
- android:scrollHorizontally="true"
- android:singleLine="true" />
- </LinearLayout>
+ <TextView
+ android:id="@+id/notification_album"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:visibility="gone"/>
+ </LinearLayout>
- <ImageButton
- android:id="@+id/control_previous"
- android:src="@drawable/notification_prev"
- android:background="@drawable/btn_bg"
- android:layout_width="34dip"
- android:layout_height="34dip"
- android:layout_gravity="center|right"
- android:layout_marginRight="10dip"
- android:layout_marginTop="2dip"
- android:layout_weight="0.0"
- android:scaleType="fitXY"/>
+ <ImageButton
+ android:id="@+id/control_previous"
+ android:src="@drawable/notification_previous"
+ android:background="@drawable/btn_bg"
+ android:layout_width="46dip"
+ android:layout_height="fill_parent"
+ android:layout_gravity="center|right"
+ android:padding="8.0dip"
+ android:layout_weight="0.0"
+ android:scaleType="fitCenter"/>
- <ImageButton
- android:id="@+id/control_pause"
- android:src="@drawable/notification_pause"
- android:background="@drawable/btn_bg"
- android:layout_width="34dip"
- android:layout_height="34dip"
- android:layout_gravity="center|right"
- android:layout_marginRight="10dip"
- android:layout_marginTop="2dip"
- android:layout_weight="0.0"
- android:scaleType="fitXY"/>
+ <ImageButton
+ android:id="@+id/control_pause"
+ android:src="@drawable/notification_pause"
+ android:background="@drawable/btn_bg"
+ android:layout_width="46dip"
+ android:layout_height="fill_parent"
+ android:layout_gravity="center|right"
+ android:padding="8.0dip"
+ android:layout_weight="0.0"
+ android:scaleType="fitCenter"/>
- <ImageButton
- android:id="@+id/control_next"
- android:src="@drawable/notification_next"
- android:background="@drawable/btn_bg"
- android:layout_width="34dip"
- android:layout_height="34dip"
- android:layout_gravity="center|right"
- android:layout_marginRight="10dip"
- android:layout_marginTop="2dip"
- android:layout_weight="0.0"
- android:scaleType="fitXY"/>
- </LinearLayout>
- </LinearLayout>
+ <ImageButton
+ android:id="@+id/control_next"
+ android:src="@drawable/notification_next"
+ android:background="@drawable/btn_bg"
+ android:layout_width="46dip"
+ android:layout_height="fill_parent"
+ android:layout_gravity="center|right"
+ android:padding="8.0dip"
+ android:layout_weight="0.0"
+ android:scaleType="fitCenter"/>
</LinearLayout>
diff --git a/res/layout/notification_expanded.xml b/res/layout/notification_expanded.xml
index 70e7269c..e2246506 100644
--- a/res/layout/notification_expanded.xml
+++ b/res/layout/notification_expanded.xml
@@ -70,7 +70,7 @@
android:layout_weight="0.0"
android:background="@drawable/btn_bg"
android:scaleType="fitXY"
- android:src="@drawable/notification_prev" />
+ android:src="@drawable/notification_previous" />
<ImageButton
android:id="@+id/control_pause"
diff --git a/src/github/daneren2005/dsub/util/Util.java b/src/github/daneren2005/dsub/util/Util.java
index f8a0af79..a28608f4 100644
--- a/src/github/daneren2005/dsub/util/Util.java
+++ b/src/github/daneren2005/dsub/util/Util.java
@@ -886,39 +886,62 @@ public final class Util {
if (colors.getSecond() != null) {
rv.setTextColor(R.id.notification_artist, colors.getSecond());
}
-
- if(!playing) {
- rv.setImageViewResource(R.id.control_pause, R.drawable.notification_play);
- rv.setImageViewResource(R.id.control_previous, R.drawable.notification_stop);
+
+ if(Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_PERSISTENT_NOTIFICATION, false)) {
+ rv.setImageViewResource(R.id.control_previous, playing ? R.drawable.notification_pause : R.drawable.notification_play);
+ rv.setImageViewResource(R.id.control_pause, R.drawable.notification_next);
+ rv.setImageViewResource(R.id.control_next, R.drawable.notification_close);
}
// Create actions for media buttons
PendingIntent pendingIntent;
- if(playing) {
+ int previous = 0, pause = 0, next = 0, close = 0;
+ if(Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_PERSISTENT_NOTIFICATION, false)) {
+ pause = R.id.control_previous;
+ next = R.id.control_pause;
+ close = R.id.control_next;
+ } else {
+ previous = R.id.control_previous;
+ pause = R.id.control_pause;
+ next = R.id.control_next;
+ }
+
+ if(previous > 0) {
Intent prevIntent = new Intent("KEYCODE_MEDIA_PREVIOUS");
prevIntent.setComponent(new ComponentName(context, DownloadServiceImpl.class));
prevIntent.putExtra(Intent.EXTRA_KEY_EVENT, new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_MEDIA_PREVIOUS));
pendingIntent = PendingIntent.getService(context, 0, prevIntent, 0);
- rv.setOnClickPendingIntent(R.id.control_previous, pendingIntent);
- } else {
+ rv.setOnClickPendingIntent(previous, pendingIntent);
+ }
+ if(pause > 0) {
+ if(playing) {
+ Intent pauseIntent = new Intent("KEYCODE_MEDIA_PLAY_PAUSE");
+ pauseIntent.setComponent(new ComponentName(context, DownloadServiceImpl.class));
+ pauseIntent.putExtra(Intent.EXTRA_KEY_EVENT, new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE));
+ pendingIntent = PendingIntent.getService(context, 0, pauseIntent, 0);
+ rv.setOnClickPendingIntent(pause, pendingIntent);
+ } else {
+ Intent prevIntent = new Intent("KEYCODE_MEDIA_START");
+ prevIntent.setComponent(new ComponentName(context, DownloadServiceImpl.class));
+ prevIntent.putExtra(Intent.EXTRA_KEY_EVENT, new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_MEDIA_PLAY));
+ pendingIntent = PendingIntent.getService(context, 0, prevIntent, 0);
+ rv.setOnClickPendingIntent(pause, pendingIntent);
+ }
+ }
+ if(next > 0) {
+ Intent nextIntent = new Intent("KEYCODE_MEDIA_NEXT");
+ nextIntent.setComponent(new ComponentName(context, DownloadServiceImpl.class));
+ nextIntent.putExtra(Intent.EXTRA_KEY_EVENT, new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_MEDIA_NEXT));
+ pendingIntent = PendingIntent.getService(context, 0, nextIntent, 0);
+ rv.setOnClickPendingIntent(next, pendingIntent);
+ }
+ if(close > 0) {
Intent prevIntent = new Intent("KEYCODE_MEDIA_STOP");
prevIntent.setComponent(new ComponentName(context, DownloadServiceImpl.class));
prevIntent.putExtra(Intent.EXTRA_KEY_EVENT, new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_MEDIA_STOP));
pendingIntent = PendingIntent.getService(context, 0, prevIntent, 0);
- rv.setOnClickPendingIntent(R.id.control_previous, pendingIntent);
+ rv.setOnClickPendingIntent(close, pendingIntent);
}
-
- Intent pauseIntent = new Intent("KEYCODE_MEDIA_PLAY_PAUSE");
- pauseIntent.setComponent(new ComponentName(context, DownloadServiceImpl.class));
- pauseIntent.putExtra(Intent.EXTRA_KEY_EVENT, new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE));
- pendingIntent = PendingIntent.getService(context, 0, pauseIntent, 0);
- rv.setOnClickPendingIntent(R.id.control_pause, pendingIntent);
-
- Intent nextIntent = new Intent("KEYCODE_MEDIA_NEXT");
- nextIntent.setComponent(new ComponentName(context, DownloadServiceImpl.class));
- nextIntent.putExtra(Intent.EXTRA_KEY_EVENT, new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_MEDIA_NEXT));
- pendingIntent = PendingIntent.getService(context, 0, nextIntent, 0);
- rv.setOnClickPendingIntent(R.id.control_next, pendingIntent);
}
public static void hidePlayingNotification(final Context context, final DownloadServiceImpl downloadService, Handler handler) {