Notification text color changes to match the background. Cleaned up notification related code.
This commit is contained in:
parent
66d1d6285f
commit
357ef1df69
15 changed files with 86 additions and 380 deletions
|
|
@ -13,6 +13,8 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
|
|
@ -26,12 +28,15 @@ import com.kabouzeid.gramophone.service.MusicService;
|
|||
import com.kabouzeid.gramophone.ui.activities.MainActivity;
|
||||
import com.kabouzeid.gramophone.util.MusicUtil;
|
||||
import com.kabouzeid.gramophone.util.PreferenceUtil;
|
||||
import com.nostra13.universalimageloader.core.DisplayImageOptions;
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
import com.nostra13.universalimageloader.core.assist.FailReason;
|
||||
import com.nostra13.universalimageloader.core.assist.ImageSize;
|
||||
import com.nostra13.universalimageloader.core.assist.ViewScaleType;
|
||||
import com.nostra13.universalimageloader.core.imageaware.ImageAware;
|
||||
import com.nostra13.universalimageloader.core.imageaware.NonViewAware;
|
||||
import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener;
|
||||
import com.nostra13.universalimageloader.core.process.BitmapProcessor;
|
||||
|
||||
public class PlayingNotificationHelper {
|
||||
|
||||
|
|
@ -53,13 +58,13 @@ public class PlayingNotificationHelper {
|
|||
|
||||
private Song currentSong;
|
||||
private boolean isPlaying;
|
||||
private String currentAlbumArtUri;
|
||||
|
||||
private boolean isDark;
|
||||
private boolean isColored;
|
||||
private boolean isReceiverRegistered;
|
||||
private boolean isNotificationShown;
|
||||
|
||||
private int bigNotificationImageSize;
|
||||
private ImageAware notificationImageAware;
|
||||
|
||||
@NonNull
|
||||
final IntentFilter intentFilter;
|
||||
|
|
@ -72,7 +77,8 @@ public class PlayingNotificationHelper {
|
|||
intentFilter = new IntentFilter();
|
||||
intentFilter.addAction(ACTION_NOTIFICATION_COLOR_PREFERENCE_CHANGED);
|
||||
|
||||
bigNotificationImageSize = service.getResources().getDimensionPixelSize(R.dimen.notification_big_image_size);
|
||||
int bigNotificationImageSize = service.getResources().getDimensionPixelSize(R.dimen.notification_big_image_size);
|
||||
notificationImageAware = new NonViewAware(new ImageSize(bigNotificationImageSize, bigNotificationImageSize), ViewScaleType.CROP);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
|
@ -106,10 +112,8 @@ public class PlayingNotificationHelper {
|
|||
isReceiverRegistered = true;
|
||||
isNotificationShown = true;
|
||||
|
||||
notificationLayout = new RemoteViews(service.getPackageName(),
|
||||
isColored ? R.layout.notification_controller_colored : R.layout.notification_controller);
|
||||
notificationLayoutExpanded = new RemoteViews(service.getPackageName(),
|
||||
isColored ? R.layout.notification_controller_big_colored : R.layout.notification_controller_big);
|
||||
notificationLayout = new RemoteViews(service.getPackageName(), R.layout.notification);
|
||||
notificationLayoutExpanded = new RemoteViews(service.getPackageName(), R.layout.notification_big);
|
||||
|
||||
notification = new NotificationCompat.Builder(service)
|
||||
.setSmallIcon(R.drawable.ic_notification)
|
||||
|
|
@ -148,8 +152,7 @@ public class PlayingNotificationHelper {
|
|||
notificationLayoutExpanded.setOnClickPendingIntent(R.id.action_quit,
|
||||
retrievePlaybackActions(4));
|
||||
|
||||
notificationLayoutExpanded.setImageViewResource(R.id.action_play_pause,
|
||||
isPlaying ? R.drawable.ic_pause_white_36dp : R.drawable.ic_play_arrow_white_36dp);
|
||||
notificationLayoutExpanded.setImageViewResource(R.id.action_play_pause, getPlayPauseRes());
|
||||
}
|
||||
|
||||
private void setUpPlaybackActions() {
|
||||
|
|
@ -162,8 +165,7 @@ public class PlayingNotificationHelper {
|
|||
notificationLayout.setOnClickPendingIntent(R.id.action_prev,
|
||||
retrievePlaybackActions(3));
|
||||
|
||||
notificationLayout.setImageViewResource(R.id.action_play_pause,
|
||||
isPlaying ? R.drawable.ic_pause_white_36dp : R.drawable.ic_play_arrow_white_36dp);
|
||||
notificationLayout.setImageViewResource(R.id.action_play_pause, getPlayPauseRes());
|
||||
}
|
||||
|
||||
private PendingIntent retrievePlaybackActions(final int which) {
|
||||
|
|
@ -214,41 +216,55 @@ public class PlayingNotificationHelper {
|
|||
}
|
||||
|
||||
private void loadAlbumArt() {
|
||||
currentAlbumArtUri = MusicUtil.getSongImageLoaderString(currentSong);
|
||||
ImageLoader.getInstance().cancelDisplayTask(notificationImageAware);
|
||||
ImageLoader.getInstance().displayImage(
|
||||
currentAlbumArtUri,
|
||||
new NonViewAware(new ImageSize(bigNotificationImageSize, bigNotificationImageSize), ViewScaleType.CROP),
|
||||
MusicUtil.getSongImageLoaderString(currentSong),
|
||||
notificationImageAware,
|
||||
new DisplayImageOptions.Builder()
|
||||
.postProcessor(new BitmapProcessor() {
|
||||
@Override
|
||||
public Bitmap process(Bitmap bitmap) {
|
||||
setAlbumArt(bitmap);
|
||||
return bitmap;
|
||||
}
|
||||
}).build(),
|
||||
new SimpleImageLoadingListener() {
|
||||
@Override
|
||||
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
|
||||
if (currentAlbumArtUri.equals(imageUri))
|
||||
setAlbumArt(loadedImage);
|
||||
if (loadedImage == null) {
|
||||
onLoadingFailed(imageUri, view, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
|
||||
if (currentAlbumArtUri.equals(imageUri))
|
||||
setAlbumArt(null);
|
||||
setAlbumArt(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setAlbumArt(@Nullable Bitmap albumArt) {
|
||||
boolean backgroundColorSet = false;
|
||||
if (albumArt != null) {
|
||||
notificationLayout.setImageViewBitmap(R.id.icon, albumArt);
|
||||
notificationLayoutExpanded.setImageViewBitmap(R.id.icon, albumArt);
|
||||
if (isColored) {
|
||||
int defaultColor = service.getResources().getColor(R.color.default_colored_notification_color);
|
||||
int newColor = Palette.from(albumArt).resizeBitmapSize(100).generate().getVibrantColor(defaultColor);
|
||||
setBackgroundColor(newColor);
|
||||
Palette.Swatch vibrantSwatch = Palette.from(albumArt).resizeBitmapSize(100).generate().getVibrantSwatch();
|
||||
if (vibrantSwatch != null) {
|
||||
int bgColor = vibrantSwatch.getRgb();
|
||||
setBackgroundColor(bgColor);
|
||||
setNotificationTextDark((Color.red(bgColor) * 0.299 + Color.green(bgColor) * 0.587 + Color.blue(bgColor) * 0.114) > 186);
|
||||
backgroundColorSet = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
notificationLayout.setImageViewResource(R.id.icon, R.drawable.default_album_art);
|
||||
notificationLayoutExpanded.setImageViewResource(R.id.icon, R.drawable.default_album_art);
|
||||
if (isColored) {
|
||||
int defaultColor = service.getResources().getColor(R.color.default_colored_notification_color);
|
||||
setBackgroundColor(defaultColor);
|
||||
}
|
||||
}
|
||||
|
||||
if (!backgroundColorSet) {
|
||||
setBackgroundColor(Color.TRANSPARENT);
|
||||
setNotificationTextDark(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP);
|
||||
}
|
||||
|
||||
if (notification != null) {
|
||||
|
|
@ -270,20 +286,50 @@ public class PlayingNotificationHelper {
|
|||
isNotificationShown = false;
|
||||
}
|
||||
|
||||
public void updatePlayState(final boolean isPlaying) {
|
||||
this.isPlaying = isPlaying;
|
||||
public void updatePlayState(final boolean setPlaying) {
|
||||
isPlaying = setPlaying;
|
||||
|
||||
if (notification == null) {
|
||||
updateNotification();
|
||||
}
|
||||
int playPauseRes = getPlayPauseRes();
|
||||
if (notificationLayout != null) {
|
||||
notificationLayout.setImageViewResource(R.id.action_play_pause,
|
||||
isPlaying ? R.drawable.ic_pause_white_36dp : R.drawable.ic_play_arrow_white_36dp);
|
||||
notificationLayout.setImageViewResource(R.id.action_play_pause, playPauseRes);
|
||||
}
|
||||
if (notificationLayoutExpanded != null) {
|
||||
notificationLayoutExpanded.setImageViewResource(R.id.action_play_pause,
|
||||
isPlaying ? R.drawable.ic_pause_white_36dp : R.drawable.ic_play_arrow_white_36dp);
|
||||
notificationLayoutExpanded.setImageViewResource(R.id.action_play_pause, playPauseRes);
|
||||
}
|
||||
notificationManager.notify(NOTIFICATION_ID, notification);
|
||||
}
|
||||
|
||||
private void setNotificationTextDark(boolean setDark) {
|
||||
isDark = setDark;
|
||||
|
||||
if (notificationLayout != null && notificationLayoutExpanded != null) {
|
||||
int darkContentColor = service.getResources().getColor(R.color.notification_dark_text_content_color);
|
||||
int darkContentSecondaryColor = service.getResources().getColor(R.color.notification_dark_text_secondary_content_color);
|
||||
int contentColor = service.getResources().getColor(R.color.notification_content_color);
|
||||
int contentSecondaryColor = service.getResources().getColor(R.color.notification_secondary_content_color);
|
||||
|
||||
notificationLayout.setTextColor(R.id.title, setDark ? darkContentColor : contentColor);
|
||||
notificationLayout.setTextColor(R.id.text, setDark ? darkContentSecondaryColor : contentSecondaryColor);
|
||||
notificationLayout.setImageViewResource(R.id.action_prev, setDark ? R.drawable.ic_skip_previous_black_36dp : R.drawable.ic_skip_previous_white_36dp);
|
||||
notificationLayout.setImageViewResource(R.id.action_play_pause, getPlayPauseRes());
|
||||
notificationLayout.setImageViewResource(R.id.action_next, setDark ? R.drawable.ic_skip_next_black_36dp : R.drawable.ic_skip_next_white_36dp);
|
||||
|
||||
notificationLayoutExpanded.setTextColor(R.id.title, setDark ? darkContentColor : contentColor);
|
||||
notificationLayoutExpanded.setTextColor(R.id.text, setDark ? darkContentSecondaryColor : contentSecondaryColor);
|
||||
notificationLayoutExpanded.setTextColor(R.id.text2, setDark ? darkContentSecondaryColor : contentSecondaryColor);
|
||||
notificationLayoutExpanded.setImageViewResource(R.id.action_prev, setDark ? R.drawable.ic_skip_previous_black_36dp : R.drawable.ic_skip_previous_white_36dp);
|
||||
notificationLayoutExpanded.setImageViewResource(R.id.action_play_pause, getPlayPauseRes());
|
||||
notificationLayoutExpanded.setImageViewResource(R.id.action_next, setDark ? R.drawable.ic_skip_next_black_36dp : R.drawable.ic_skip_next_white_36dp);
|
||||
notificationLayoutExpanded.setImageViewResource(R.id.action_quit, setDark ? R.drawable.ic_close_black_24dp : R.drawable.ic_close_white_24dp);
|
||||
}
|
||||
}
|
||||
|
||||
private int getPlayPauseRes() {
|
||||
return isPlaying ?
|
||||
(isDark ? R.drawable.ic_pause_black_36dp : R.drawable.ic_pause_white_36dp) :
|
||||
(isDark ? R.drawable.ic_play_arrow_black_36dp : R.drawable.ic_play_arrow_white_36dp);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
BIN
app/src/main/res/drawable-hdpi/ic_close_black_24dp.png
Normal file
BIN
app/src/main/res/drawable-hdpi/ic_close_black_24dp.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 244 B |
BIN
app/src/main/res/drawable-mdpi/ic_close_black_24dp.png
Normal file
BIN
app/src/main/res/drawable-mdpi/ic_close_black_24dp.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 195 B |
BIN
app/src/main/res/drawable-xhdpi/ic_close_black_24dp.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_close_black_24dp.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 314 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_close_black_24dp.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/ic_close_black_24dp.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 383 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_close_black_24dp.png
Normal file
BIN
app/src/main/res/drawable-xxxhdpi/ic_close_black_24dp.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 513 B |
|
|
@ -63,7 +63,7 @@
|
|||
android:gravity="bottom"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/Theme.MaterialMusic.Notification.Title"
|
||||
android:textColor="@color/default_notification_content_color"
|
||||
android:textColor="@color/notification_content_color"
|
||||
tools:ignore="NestedWeights" />
|
||||
|
||||
<TextView
|
||||
|
|
@ -76,7 +76,7 @@
|
|||
android:fadingEdge="horizontal"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/Theme.MaterialMusic.Notification"
|
||||
android:textColor="@color/default_notification_secondary_content_color" />
|
||||
android:textColor="@color/notification_secondary_content_color" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
|
@ -103,7 +103,6 @@
|
|||
android:padding="8dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/ic_skip_previous_white_36dp"
|
||||
android:tint="@color/default_notification_content_color"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<ImageButton xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
|
@ -119,7 +118,6 @@
|
|||
android:padding="8dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/ic_play_arrow_white_36dp"
|
||||
android:tint="@color/default_notification_content_color"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<ImageButton xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
|
@ -135,7 +133,6 @@
|
|||
android:padding="8dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/ic_skip_next_white_36dp"
|
||||
android:tint="@color/default_notification_content_color"
|
||||
tools:ignore="ContentDescription" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
|
@ -41,7 +41,6 @@
|
|||
android:layout_marginTop="2dp"
|
||||
android:background="@drawable/notification_selector"
|
||||
android:src="@drawable/ic_close_white_24dp"
|
||||
android:tint="@color/default_notification_content_color"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<LinearLayout
|
||||
|
|
@ -68,7 +67,7 @@
|
|||
android:fadingEdge="horizontal"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/Theme.MaterialMusic.Notification.Title"
|
||||
android:textColor="@color/default_notification_content_color" />
|
||||
android:textColor="@color/notification_content_color" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text"
|
||||
|
|
@ -81,7 +80,7 @@
|
|||
android:fadingEdge="horizontal"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/Theme.MaterialMusic.Notification"
|
||||
android:textColor="@color/default_notification_secondary_content_color" />
|
||||
android:textColor="@color/notification_secondary_content_color" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text2"
|
||||
|
|
@ -93,7 +92,7 @@
|
|||
android:fadingEdge="horizontal"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/Theme.MaterialMusic.Notification"
|
||||
android:textColor="@color/default_notification_secondary_content_color" />
|
||||
android:textColor="@color/notification_secondary_content_color" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
|
@ -122,7 +121,6 @@
|
|||
android:padding="8dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/ic_skip_previous_white_36dp"
|
||||
android:tint="@color/default_notification_content_color"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<ImageButton xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
|
@ -138,7 +136,6 @@
|
|||
android:padding="8dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/ic_play_arrow_white_36dp"
|
||||
android:tint="@color/default_notification_content_color"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<ImageButton xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
|
@ -154,7 +151,6 @@
|
|||
android:padding="8dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/ic_skip_next_white_36dp"
|
||||
android:tint="@color/default_notification_content_color"
|
||||
tools:ignore="ContentDescription" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
|
@ -1,160 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (C) 2014 The Android Open Source Project
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License
|
||||
-->
|
||||
|
||||
<!-- Layout to be used with only max 3 actions. It has a much larger picture at the left side-->
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="128dp"
|
||||
android:background="@color/default_colored_notification_color">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="@dimen/notification_big_image_size"
|
||||
android:layout_height="@dimen/notification_big_image_size"
|
||||
android:scaleType="centerCrop"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<ImageButton xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/action_quit"
|
||||
style="@style/Widget.AppCompat.Button.Borderless"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginEnd="2dp"
|
||||
android:layout_marginRight="2dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:background="@drawable/colored_notification_selector"
|
||||
android:src="@drawable/ic_close_white_24dp"
|
||||
android:tint="@color/default_colored_notification_content_color"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/text_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="64dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_toEndOf="@id/icon"
|
||||
android:layout_toLeftOf="@id/action_quit"
|
||||
android:layout_toRightOf="@id/icon"
|
||||
android:layout_toStartOf="@id/action_quit"
|
||||
android:minHeight="@dimen/notification_large_icon_height"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="marquee"
|
||||
android:fadingEdge="horizontal"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/Theme.MaterialMusic.Notification.Title"
|
||||
android:textColor="@color/default_colored_notification_content_color" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="-1dp"
|
||||
android:layout_marginTop="-1dp"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="marquee"
|
||||
android:fadingEdge="horizontal"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/Theme.MaterialMusic.Notification"
|
||||
android:textColor="@color/default_colored_notification_secondary_content_color" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="marquee"
|
||||
android:fadingEdge="horizontal"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/Theme.MaterialMusic.Notification"
|
||||
android:textColor="@color/default_colored_notification_secondary_content_color" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/media_actions"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_below="@+id/text_container"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_toEndOf="@id/icon"
|
||||
android:layout_toRightOf="@id/icon"
|
||||
android:layoutDirection="ltr"
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="UnusedAttribute">
|
||||
<!-- media buttons will be added here -->
|
||||
<ImageButton xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/action_prev"
|
||||
style="@style/Widget.AppCompat.Button.Borderless"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="2dp"
|
||||
android:layout_marginRight="2dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/colored_notification_selector"
|
||||
android:gravity="center"
|
||||
android:padding="8dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/ic_skip_previous_white_36dp"
|
||||
android:tint="@color/default_colored_notification_content_color"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<ImageButton xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/action_play_pause"
|
||||
style="@style/Widget.AppCompat.Button.Borderless"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="2dp"
|
||||
android:layout_marginRight="2dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/colored_notification_selector"
|
||||
android:gravity="center"
|
||||
android:padding="8dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/ic_play_arrow_white_36dp"
|
||||
android:tint="@color/default_colored_notification_content_color"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<ImageButton xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/action_next"
|
||||
style="@style/Widget.AppCompat.Button.Borderless"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="2dp"
|
||||
android:layout_marginRight="2dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/colored_notification_selector"
|
||||
android:gravity="center"
|
||||
android:padding="8dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/ic_skip_next_white_36dp"
|
||||
android:tint="@color/default_colored_notification_content_color"
|
||||
tools:ignore="ContentDescription" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
|
@ -1,141 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (C) 2014 The Android Open Source Project
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:internal="http://schemas.android.com/apk/prv/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="64dp"
|
||||
android:background="@color/default_colored_notification_color"
|
||||
android:orientation="horizontal"
|
||||
internal:layout_maxHeight="64dp"
|
||||
internal:layout_minHeight="64dp"
|
||||
tools:ignore="DisableBaselineAlignment">
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:internal="http://schemas.android.com/apk/prv/res/android"
|
||||
android:id="@+id/icon_group"
|
||||
android:layout_width="@dimen/notification_large_icon_width"
|
||||
android:layout_height="@dimen/notification_large_icon_height"
|
||||
android:layout_weight="0">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:scaleType="centerInside"
|
||||
tools:ignore="ContentDescription" />
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="fill_vertical"
|
||||
android:layout_weight="1"
|
||||
android:minHeight="@dimen/notification_large_icon_height"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="marquee"
|
||||
android:fadingEdge="horizontal"
|
||||
android:gravity="bottom"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/Theme.MaterialMusic.Notification.Title"
|
||||
android:textColor="@color/default_colored_notification_content_color"
|
||||
tools:ignore="NestedWeights" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="marquee"
|
||||
android:fadingEdge="horizontal"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/Theme.MaterialMusic.Notification"
|
||||
android:textColor="@color/default_colored_notification_secondary_content_color" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/media_actions"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:layout_marginRight="6dp"
|
||||
android:layoutDirection="ltr"
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="UnusedAttribute">
|
||||
<!-- media buttons will be added here -->
|
||||
<ImageButton xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/action_prev"
|
||||
style="@style/Widget.AppCompat.Button.Borderless"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="2dp"
|
||||
android:layout_marginRight="2dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/colored_notification_selector"
|
||||
android:gravity="center"
|
||||
android:padding="8dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/ic_skip_previous_white_36dp"
|
||||
android:tint="@color/default_colored_notification_content_color"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<ImageButton xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/action_play_pause"
|
||||
style="@style/Widget.AppCompat.Button.Borderless"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="2dp"
|
||||
android:layout_marginRight="2dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/colored_notification_selector"
|
||||
android:gravity="center"
|
||||
android:padding="8dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/ic_play_arrow_white_36dp"
|
||||
android:tint="@color/default_colored_notification_content_color"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<ImageButton xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/action_next"
|
||||
style="@style/Widget.AppCompat.Button.Borderless"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="2dp"
|
||||
android:layout_marginRight="2dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/colored_notification_selector"
|
||||
android:gravity="center"
|
||||
android:padding="8dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/ic_skip_next_white_36dp"
|
||||
android:tint="@color/default_colored_notification_content_color"
|
||||
tools:ignore="ContentDescription" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="default_notification_content_color">#de000000</color>
|
||||
<color name="default_notification_secondary_content_color">#aa000000</color>
|
||||
|
||||
<color name="default_colored_notification_color">@color/grey_800</color>
|
||||
<color name="default_colored_notification_content_color">#deFFFFFF</color>
|
||||
<color name="default_colored_notification_secondary_content_color">#aaFFFFFF</color>
|
||||
|
||||
<!--must be solid colors so the ripple will not be semi transparent. Note: the color have no effect on the ripple-->
|
||||
<!--<color name="button_selected">#FFFFFFFF</color>-->
|
||||
<!--<color name="button_selected_dark">#FFFFFFFF</color>-->
|
||||
</resources>
|
||||
|
|
@ -22,11 +22,6 @@
|
|||
<item name="android:transitionName">@string/transition_fab</item>
|
||||
</style>
|
||||
|
||||
<style name="NotificationButton" parent="NotificationButtonParent">
|
||||
<item name="android:background">@drawable/notification_selector</item>
|
||||
<item name="android:tint">@color/default_notification_content_color</item>
|
||||
</style>
|
||||
|
||||
<style name="MusicProgressSlider" parent="MusicProgressSliderParent">
|
||||
<item name="android:elevation">2dp</item>
|
||||
<item name="android:padding">0dp</item>
|
||||
|
|
|
|||
|
|
@ -25,11 +25,10 @@
|
|||
<color name="sliding_tabs_deactivated">#99FFFFFF</color>
|
||||
|
||||
<!--notification-->
|
||||
<color name="default_notification_content_color">#deFFFFFF</color>
|
||||
<color name="default_notification_secondary_content_color">#aaFFFFFF</color>
|
||||
<color name="notification_content_color">#deFFFFFF</color>
|
||||
<color name="notification_secondary_content_color">#aaFFFFFF</color>
|
||||
|
||||
<color name="default_colored_notification_color">@android:color/transparent</color>
|
||||
<color name="default_colored_notification_content_color">#deFFFFFF</color>
|
||||
<color name="default_colored_notification_secondary_content_color">#aaFFFFFF</color>
|
||||
<color name="notification_dark_text_content_color">#de000000</color>
|
||||
<color name="notification_dark_text_secondary_content_color">#aa000000</color>
|
||||
|
||||
</resources>
|
||||
|
|
@ -31,10 +31,6 @@
|
|||
|
||||
<style name="PlayPauseFab" parent="PlayPauseFabParent" />
|
||||
|
||||
<style name="NotificationButton" parent="NotificationButtonParent">
|
||||
<item name="android:background">?android:attr/selectableItemBackground</item>
|
||||
</style>
|
||||
|
||||
<style name="MusicProgressSlider" parent="MusicProgressSliderParent">
|
||||
<item name="android:thumbOffset">0dp</item>
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -73,15 +73,6 @@
|
|||
<item name="android:layout_height">wrap_content</item>
|
||||
</style>
|
||||
|
||||
<style name="NotificationButtonParent">
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
<item name="android:layout_height">match_parent</item>
|
||||
<item name="android:scaleType">fitCenter</item>
|
||||
<item name="android:layout_gravity">center</item>
|
||||
<item name="android:layout_weight">1</item>
|
||||
</style>
|
||||
|
||||
|
||||
<style name="MusicProgressSliderParent">
|
||||
<item name="android:progressDrawable">@android:color/transparent</item>
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue