Commit 4233ea42 authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Adapted notification colors for Lollipop

Plus public visibility, for being available on lockscreen
parent 25633f16
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/content"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:gravity="center_vertical"
android:orientation="horizontal"
tools:targetApi="jelly_bean" >
<ImageView
android:id="@+id/cover"
android:layout_width="64dp"
android:layout_height="64dp"
android:src="@drawable/icon" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_weight="1"
android:orientation="vertical" >
<TextView
android:id="@+id/songName"
style="@android:style/TextAppearance.Material.Notification.Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:singleLine="true"
android:text="@string/title" />
<TextView
android:id="@+id/artist"
style="@android:style/TextAppearance.Material.Notification.Info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:singleLine="true"
android:text="@string/artist" />
</LinearLayout>
<ImageButton
android:id="@+id/play_pause"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_margin="5dp"
android:background="#00ffffff"
android:clickable="true"
android:scaleType="fitXY"
android:src="@drawable/ic_play" />
<ImageButton
android:id="@+id/forward"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_margin="5dp"
android:background="#00ffffff"
android:clickable="true"
android:scaleType="fitXY"
android:src="@drawable/ic_next" />
<ImageButton
android:id="@+id/stop"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_margin="5dp"
android:background="#00ffffff"
android:clickable="true"
android:scaleType="fitXY"
android:src="@drawable/ic_stop" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/content"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:clickable="true"
tools:targetApi="jelly_bean" >
<ImageView
android:id="@+id/cover"
android:layout_width="128dp"
android:layout_height="128dp"
android:layout_marginRight="8dp"
android:src="@drawable/icon" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/buttons"
android:layout_toRightOf="@+id/cover"
android:gravity="center_vertical"
android:orientation="vertical" >
<TextView
android:id="@+id/songName"
style="@android:style/TextAppearance.Material.Notification.Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="40dp"
android:ellipsize="marquee"
android:singleLine="true"
android:text="@string/title" />
<TextView
android:id="@+id/artist"
style="@android:style/TextAppearance.Material.Notification.Line2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:singleLine="true"
android:text="@string/artist" />
<TextView
android:id="@+id/album"
style="@android:style/TextAppearance.Material.Notification.Info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:singleLine="true"
android:text="@string/album" />
</LinearLayout>
<ImageButton
android:id="@+id/stop"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentRight="true"
android:layout_margin="5dp"
android:background="#00ffffff"
android:clickable="true"
android:scaleType="fitXY"
android:src="@drawable/ic_stop" />
<LinearLayout
android:id="@+id/buttons"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_alignBottom="@id/cover"
android:layout_alignParentRight="true"
android:layout_toRightOf="@+id/cover"
android:orientation="horizontal" >
<ImageButton
android:id="@+id/backward"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#00ffffff"
android:clickable="true"
android:scaleType="centerInside"
android:src="@drawable/ic_previous" />
<ImageButton
android:id="@+id/play_pause"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_weight="1"
android:background="#00ffffff"
android:clickable="true"
android:scaleType="centerInside"
android:src="@drawable/ic_play" />
<ImageButton
android:id="@+id/forward"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#00ffffff"
android:clickable="true"
android:scaleType="centerInside"
android:src="@drawable/ic_next" />
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
......@@ -726,6 +726,8 @@ public class AudioService extends Service {
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
if (LibVlcUtil.isJellyBeanOrLater()) {
int pause = LibVlcUtil.isLolliPopOrLater() ? R.drawable.ic_pause : R.drawable.ic_pause_w;
int play = LibVlcUtil.isLolliPopOrLater() ? R.drawable.ic_play : R.drawable.ic_play_w;
Intent iBackward = new Intent(ACTION_REMOTE_BACKWARD);
Intent iPlay = new Intent(ACTION_REMOTE_PLAYPAUSE);
Intent iForward = new Intent(ACTION_REMOTE_FORWARD);
......@@ -740,7 +742,7 @@ public class AudioService extends Service {
view.setImageViewBitmap(R.id.cover, cover);
view.setTextViewText(R.id.songName, title);
view.setTextViewText(R.id.artist, artist);
view.setImageViewResource(R.id.play_pause, mLibVLC.isPlaying() ? R.drawable.ic_pause_w : R.drawable.ic_play_w);
view.setImageViewResource(R.id.play_pause, mLibVLC.isPlaying() ? pause : play);
view.setOnClickPendingIntent(R.id.play_pause, piPlay);
view.setOnClickPendingIntent(R.id.forward, piForward);
view.setOnClickPendingIntent(R.id.stop, piStop);
......@@ -752,13 +754,15 @@ public class AudioService extends Service {
view_expanded.setTextViewText(R.id.songName, title);
view_expanded.setTextViewText(R.id.artist, artist);
view_expanded.setTextViewText(R.id.album, album);
view_expanded.setImageViewResource(R.id.play_pause, mLibVLC.isPlaying() ? R.drawable.ic_pause_w : R.drawable.ic_play_w);
view_expanded.setImageViewResource(R.id.play_pause, mLibVLC.isPlaying() ? pause : play);
view_expanded.setOnClickPendingIntent(R.id.backward, piBackward);
view_expanded.setOnClickPendingIntent(R.id.play_pause, piPlay);
view_expanded.setOnClickPendingIntent(R.id.forward, piForward);
view_expanded.setOnClickPendingIntent(R.id.stop, piStop);
view_expanded.setOnClickPendingIntent(R.id.content, pendingIntent);
if (LibVlcUtil.isLolliPopOrLater())
builder.setVisibility(Notification.VISIBILITY_PUBLIC);
notification = builder.build();
notification.contentView = view;
notification.bigContentView = view_expanded;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment