-Fixed statistics fragment button not animating when pressed.

-Removed background player notification button opacity change.
pull/1392/head
John Zhen Mo 2018-05-11 19:21:40 -07:00
rodzic 15fb60a845
commit 19b8796cbc
2 zmienionych plików z 3 dodań i 29 usunięć

Wyświetl plik

@ -26,9 +26,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.os.Build;
import android.os.IBinder; import android.os.IBinder;
import android.support.annotation.IntRange;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.app.NotificationCompat; import android.support.v4.app.NotificationCompat;
@ -92,7 +90,6 @@ public final class BackgroundPlayer extends Service {
private NotificationCompat.Builder notBuilder; private NotificationCompat.Builder notBuilder;
private RemoteViews notRemoteView; private RemoteViews notRemoteView;
private RemoteViews bigNotRemoteView; private RemoteViews bigNotRemoteView;
private final String setAlphaMethodName = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) ? "setImageAlpha" : "setAlpha";
private boolean shouldUpdateOnProgress; private boolean shouldUpdateOnProgress;
@ -246,16 +243,6 @@ public final class BackgroundPlayer extends Service {
} }
notificationManager.notify(NOTIFICATION_ID, notBuilder.build()); 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 // Utils
//////////////////////////////////////////////////////////////////////////*/ //////////////////////////////////////////////////////////////////////////*/
@ -525,32 +512,20 @@ public final class BackgroundPlayer extends Service {
public void changeState(int state) { public void changeState(int state) {
super.changeState(state); super.changeState(state);
updatePlayback(); updatePlayback();
}
@Override
public void onBlocked() {
super.onBlocked();
setControlsOpacity(77);
updateNotification(-1); updateNotification(-1);
} }
@Override @Override
public void onPlaying() { public void onPlaying() {
super.onPlaying(); super.onPlaying();
setControlsOpacity(255);
updateNotification(R.drawable.ic_pause_white); updateNotification(R.drawable.ic_pause_white);
lockManager.acquireWifiAndCpu(); lockManager.acquireWifiAndCpu();
} }
@Override @Override
public void onPaused() { public void onPaused() {
super.onPaused(); super.onPaused();
updateNotification(R.drawable.ic_play_arrow_white); updateNotification(R.drawable.ic_play_arrow_white);
lockManager.releaseWifiAndCpu(); lockManager.releaseWifiAndCpu();
} }
@ -558,8 +533,6 @@ public final class BackgroundPlayer extends Service {
public void onCompleted() { public void onCompleted() {
super.onCompleted(); super.onCompleted();
setControlsOpacity(255);
resetNotification(); resetNotification();
if (bigNotRemoteView != null) bigNotRemoteView.setProgressBar(R.id.notificationProgressBar, 100, 100, false); if (bigNotRemoteView != null) bigNotRemoteView.setProgressBar(R.id.notificationProgressBar, 100, 100, false);
if (notRemoteView != null) notRemoteView.setProgressBar(R.id.notificationProgressBar, 100, 100, false); if (notRemoteView != null) notRemoteView.setProgressBar(R.id.notificationProgressBar, 100, 100, false);

Wyświetl plik

@ -4,7 +4,6 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:orientation="vertical"> android:orientation="vertical">
<RelativeLayout <RelativeLayout
@ -12,7 +11,9 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:clickable="true" android:clickable="true"
android:focusable="true"> android:focusable="true"
android:background="?attr/selectableItemBackground">
<ImageView <ImageView
android:id="@+id/sortButtonIcon" android:id="@+id/sortButtonIcon"
android:layout_width="48dp" android:layout_width="48dp"