Fix notification panel not expanding and added user option to toggle
This commit is contained in:
parent
19c7b826f4
commit
e6fb122796
8 changed files with 30 additions and 13 deletions
|
@ -170,7 +170,7 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
|
|||
registerReceiver(mBroadcastReceiver, mIntentFilter);
|
||||
PreferenceUtil.getInstance(this).registerOnSharedPreferenceChangedListener(this);
|
||||
|
||||
if (getIntent().hasExtra(EXPAND_PANEL)) {
|
||||
if (getIntent().hasExtra(EXPAND_PANEL) && PreferenceUtil.getInstance(this).isExpandPanel()) {
|
||||
if (getIntent().getBooleanExtra(EXPAND_PANEL, false)) {
|
||||
expandPanel();
|
||||
getIntent().putExtra(EXPAND_PANEL, false);
|
||||
|
|
|
@ -54,7 +54,7 @@ class PlayingNotificationImpl : PlayingNotification() {
|
|||
if (isFavorite) R.drawable.ic_favorite_white_24dp else R.drawable.ic_favorite_border_white_24dp
|
||||
|
||||
val action = Intent(service, MainActivity::class.java)
|
||||
action.putExtra("expand", true)
|
||||
action.putExtra(MainActivity.EXPAND_PANEL, true)
|
||||
action.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||
val clickIntent =
|
||||
PendingIntent.getActivity(service, 0, action, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
|
|
|
@ -73,7 +73,7 @@ class PlayingNotificationOreo : PlayingNotification() {
|
|||
val notificationLayoutBig = getCombinedRemoteViews(false, song)
|
||||
|
||||
val action = Intent(service, MainActivity::class.java)
|
||||
action.putExtra("expand", true)
|
||||
action.putExtra(MainActivity.EXPAND_PANEL, true)
|
||||
action.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||
|
||||
val clickIntent = PendingIntent
|
||||
|
|
|
@ -216,6 +216,7 @@ public final class PreferenceUtil {
|
|||
|
||||
private static final String FILTER_SONG = "filter_song";
|
||||
private static final String TAG = "PreferenceUtil";
|
||||
private static final String EXPAND_NOW_PLAYING_PANEL = "expand_now_playing_panel";
|
||||
private static PreferenceUtil sInstance;
|
||||
private final SharedPreferences mPreferences;
|
||||
|
||||
|
@ -974,4 +975,8 @@ public final class PreferenceUtil {
|
|||
@NonNull OnSharedPreferenceChangeListener sharedPreferenceChangeListener) {
|
||||
mPreferences.unregisterOnSharedPreferenceChangeListener(sharedPreferenceChangeListener);
|
||||
}
|
||||
|
||||
public boolean isExpandPanel() {
|
||||
return mPreferences.getBoolean(EXPAND_NOW_PLAYING_PANEL, false);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue