restyle notification

This commit is contained in:
Adrian Ulrich 2014-10-14 20:36:49 +02:00
parent bab6b91fdd
commit 7fe8d9fd43
2 changed files with 98 additions and 94 deletions

View File

@ -19,110 +19,112 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:orientation="vertical">
android:orientation="horizontal">
<ImageView
android:id="@+id/cover"
android:scaleType="fitCenter"
android:layout_width="128dip"
android:layout_height="128dip"
android:layout_marginRight="8dip"
android:contentDescription="@string/cover_art" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:orientation="horizontal">
<ImageView
android:id="@+id/cover"
android:scaleType="fitCenter"
android:layout_width="96dip"
android:layout_height="96dip"
android:layout_marginRight="8dip"
android:contentDescription="@string/cover_art" />
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="0dp"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@android:style/TextAppearance.StatusBar.EventContent.Title"
android:singleLine="true"
android:ellipsize="marquee" />
<TextView
android:id="@+id/album"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@android:style/TextAppearance.StatusBar.EventContent"
android:singleLine="true"
android:ellipsize="marquee" />
<TextView
android:id="@+id/artist"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@android:style/TextAppearance.StatusBar.EventContent"
android:singleLine="true"
android:ellipsize="marquee" />
android:orientation="horizontal">
<LinearLayout
android:layout_marginTop="4dip"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@android:style/TextAppearance.StatusBar.EventContent.Title"
android:singleLine="true"
android:ellipsize="marquee" />
<TextView
android:id="@+id/artist"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@android:style/TextAppearance.StatusBar.EventContent"
android:singleLine="true"
android:ellipsize="marquee" />
<TextView
android:id="@+id/album"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@android:style/TextAppearance.StatusBar.EventContent"
android:singleLine="true"
android:ellipsize="marquee" />
</LinearLayout>
<ImageButton
android:id="@+id/close"
android:padding="5dip"
android:layout_width="32dp"
android:layout_height="32dp"
android:scaleType="fitCenter"
android:background="?android:attr/selectableItemBackground"
android:src="@drawable/notification_close"
android:contentDescription="@string/close_notification" />
</LinearLayout>
<ImageButton
android:id="@+id/close"
android:padding="5dip"
<!-- start controll buttons -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_width="24dip"
android:layout_gravity="top"
android:scaleType="fitCenter"
android:src="@drawable/notification_close"
android:background="?android:attr/selectableItemBackground"
android:contentDescription="@string/close_notification" />
android:orientation="horizontal">
<ImageButton
android:id="@+id/previous"
android:paddingTop="5dip"
android:paddingBottom="5dip"
android:layout_height="42dip"
android:layout_width="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:background="?android:attr/selectableItemBackground"
android:scaleType="fitCenter"
android:src="@drawable/previous"
android:contentDescription="@string/next_song" />
<ImageButton
android:id="@+id/play_pause"
android:paddingTop="5dip"
android:paddingBottom="5dip"
android:layout_height="42dip"
android:layout_width="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:background="?android:attr/selectableItemBackground"
android:scaleType="fitCenter"
android:src="@drawable/play"
android:contentDescription="@string/play_pause" />
<ImageButton
android:id="@+id/next"
android:paddingTop="5dip"
android:paddingBottom="5dip"
android:layout_height="42dip"
android:layout_width="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:background="?android:attr/selectableItemBackground"
android:scaleType="fitCenter"
android:src="@drawable/next"
android:contentDescription="@string/next_song" />
</LinearLayout>
<!-- end controll buttons -->
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<ImageButton
android:id="@+id/previous"
android:paddingTop="5dip"
android:paddingBottom="5dip"
android:layout_height="42dip"
android:layout_width="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:background="?android:attr/selectableItemBackground"
android:scaleType="fitCenter"
android:src="@drawable/previous"
android:contentDescription="@string/next_song" />
<ImageButton
android:id="@+id/play_pause"
android:paddingTop="5dip"
android:paddingBottom="5dip"
android:layout_height="42dip"
android:layout_width="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:background="?android:attr/selectableItemBackground"
android:scaleType="fitCenter"
android:src="@drawable/play"
android:contentDescription="@string/play_pause" />
<ImageButton
android:id="@+id/next"
android:paddingTop="5dip"
android:paddingBottom="5dip"
android:layout_height="42dip"
android:layout_width="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:background="?android:attr/selectableItemBackground"
android:scaleType="fitCenter"
android:src="@drawable/next"
android:contentDescription="@string/next_song" />
</LinearLayout>
</LinearLayout>

View File

@ -1880,7 +1880,9 @@ public final class PlaybackService extends Service
notification.flags |= Notification.FLAG_ONGOING_EVENT;
notification.contentIntent = mNotificationAction;
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
notification.bigContentView = expanded; // expanded view is available since 4.1
// expanded view is available since 4.1
notification.bigContentView = expanded;
notification.priority = 42;
}
return notification;
}