From 19b8796cbcf827c86d69250e368cb2255869a51c Mon Sep 17 00:00:00 2001 From: John Zhen Mo Date: Fri, 11 May 2018 19:21:40 -0700 Subject: [PATCH] -Fixed statistics fragment button not animating when pressed. -Removed background player notification button opacity change. --- .../newpipe/player/BackgroundPlayer.java | 27 ------------------- .../res/layout/statistic_playlist_control.xml | 5 ++-- 2 files changed, 3 insertions(+), 29 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java b/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java index b5135bd84..37b7e4c64 100644 --- a/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java @@ -26,9 +26,7 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.graphics.Bitmap; -import android.os.Build; import android.os.IBinder; -import android.support.annotation.IntRange; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.NotificationCompat; @@ -92,7 +90,6 @@ public final class BackgroundPlayer extends Service { private NotificationCompat.Builder notBuilder; private RemoteViews notRemoteView; private RemoteViews bigNotRemoteView; - private final String setAlphaMethodName = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) ? "setImageAlpha" : "setAlpha"; private boolean shouldUpdateOnProgress; @@ -246,16 +243,6 @@ public final class BackgroundPlayer extends Service { } notificationManager.notify(NOTIFICATION_ID, notBuilder.build()); } - - private void setControlsOpacity(@IntRange(from = 0, to = 255) int opacity) { - if (notRemoteView != null) notRemoteView.setInt(R.id.notificationPlayPause, setAlphaMethodName, opacity); - if (bigNotRemoteView != null) bigNotRemoteView.setInt(R.id.notificationPlayPause, setAlphaMethodName, opacity); - if (notRemoteView != null) notRemoteView.setInt(R.id.notificationFForward, setAlphaMethodName, opacity); - if (bigNotRemoteView != null) bigNotRemoteView.setInt(R.id.notificationFForward, setAlphaMethodName, opacity); - if (notRemoteView != null) notRemoteView.setInt(R.id.notificationFRewind, setAlphaMethodName, opacity); - if (bigNotRemoteView != null) bigNotRemoteView.setInt(R.id.notificationFRewind, setAlphaMethodName, opacity); - } - /*////////////////////////////////////////////////////////////////////////// // Utils //////////////////////////////////////////////////////////////////////////*/ @@ -525,32 +512,20 @@ public final class BackgroundPlayer extends Service { public void changeState(int state) { super.changeState(state); updatePlayback(); - } - - @Override - public void onBlocked() { - super.onBlocked(); - - setControlsOpacity(77); updateNotification(-1); } @Override public void onPlaying() { super.onPlaying(); - - setControlsOpacity(255); updateNotification(R.drawable.ic_pause_white); - lockManager.acquireWifiAndCpu(); } @Override public void onPaused() { super.onPaused(); - updateNotification(R.drawable.ic_play_arrow_white); - lockManager.releaseWifiAndCpu(); } @@ -558,8 +533,6 @@ public final class BackgroundPlayer extends Service { public void onCompleted() { super.onCompleted(); - setControlsOpacity(255); - resetNotification(); if (bigNotRemoteView != null) bigNotRemoteView.setProgressBar(R.id.notificationProgressBar, 100, 100, false); if (notRemoteView != null) notRemoteView.setProgressBar(R.id.notificationProgressBar, 100, 100, false); diff --git a/app/src/main/res/layout/statistic_playlist_control.xml b/app/src/main/res/layout/statistic_playlist_control.xml index 8dc4e8c08..ff2b70524 100644 --- a/app/src/main/res/layout/statistic_playlist_control.xml +++ b/app/src/main/res/layout/statistic_playlist_control.xml @@ -4,7 +4,6 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="?attr/selectableItemBackground" android:orientation="vertical"> + android:focusable="true" + android:background="?attr/selectableItemBackground"> +