From e6fb122796f99724ce29f3fb70bcce63410a6229 Mon Sep 17 00:00:00 2001 From: h4h13 Date: Sun, 1 Mar 2020 22:13:31 +0530 Subject: [PATCH] Fix notification panel not expanding and added user option to toggle --- app/build.gradle | 2 +- app/nofont/release/output.json | 1 + .../retromusic/activities/MainActivity.java | 2 +- .../notification/PlayingNotificationImpl.kt | 2 +- .../notification/PlayingNotificationOreo.kt | 2 +- .../retromusic/util/PreferenceUtil.java | 5 ++++ app/src/main/res/values/strings.xml | 2 ++ .../main/res/xml/pref_now_playing_screen.xml | 27 ++++++++++++------- 8 files changed, 30 insertions(+), 13 deletions(-) create mode 100644 app/nofont/release/output.json diff --git a/app/build.gradle b/app/build.gradle index 4eabf32c..8783caa9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -14,7 +14,7 @@ proguardDictionaries { android { compileSdkVersion 29 - buildToolsVersion = '29.0.2' + buildToolsVersion = '29.0.3' defaultConfig { minSdkVersion 21 diff --git a/app/nofont/release/output.json b/app/nofont/release/output.json new file mode 100644 index 00000000..4b92e851 --- /dev/null +++ b/app/nofont/release/output.json @@ -0,0 +1 @@ +[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":10414,"versionName":"3.4.970_0301","enabled":true,"outputFile":"app-nofont-release.apk","fullName":"nofontRelease","baseName":"nofont-release","dirName":""},"path":"app-nofont-release.apk","properties":{}}] \ No newline at end of file diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/MainActivity.java b/app/src/main/java/code/name/monkey/retromusic/activities/MainActivity.java index c81c3d90..bed4f50c 100644 --- a/app/src/main/java/code/name/monkey/retromusic/activities/MainActivity.java +++ b/app/src/main/java/code/name/monkey/retromusic/activities/MainActivity.java @@ -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); diff --git a/app/src/main/java/code/name/monkey/retromusic/service/notification/PlayingNotificationImpl.kt b/app/src/main/java/code/name/monkey/retromusic/service/notification/PlayingNotificationImpl.kt index f2a95ef5..3ad46be2 100644 --- a/app/src/main/java/code/name/monkey/retromusic/service/notification/PlayingNotificationImpl.kt +++ b/app/src/main/java/code/name/monkey/retromusic/service/notification/PlayingNotificationImpl.kt @@ -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) diff --git a/app/src/main/java/code/name/monkey/retromusic/service/notification/PlayingNotificationOreo.kt b/app/src/main/java/code/name/monkey/retromusic/service/notification/PlayingNotificationOreo.kt index 39ce02f9..3bdc3ab5 100644 --- a/app/src/main/java/code/name/monkey/retromusic/service/notification/PlayingNotificationOreo.kt +++ b/app/src/main/java/code/name/monkey/retromusic/service/notification/PlayingNotificationOreo.kt @@ -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 diff --git a/app/src/main/java/code/name/monkey/retromusic/util/PreferenceUtil.java b/app/src/main/java/code/name/monkey/retromusic/util/PreferenceUtil.java index db892f6f..65ab3e55 100644 --- a/app/src/main/java/code/name/monkey/retromusic/util/PreferenceUtil.java +++ b/app/src/main/java/code/name/monkey/retromusic/util/PreferenceUtil.java @@ -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); + } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0b962047..6e35de1e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -842,4 +842,6 @@ Amount Note(Optional) Start payment + Show now playing screen + Clicking on the notification will show now playing screen instead of the home screen diff --git a/app/src/main/res/xml/pref_now_playing_screen.xml b/app/src/main/res/xml/pref_now_playing_screen.xml index edb39ff1..556c9fc6 100644 --- a/app/src/main/res/xml/pref_now_playing_screen.xml +++ b/app/src/main/res/xml/pref_now_playing_screen.xml @@ -62,16 +62,25 @@ app:key="toggle_volume" app:summary="@string/pref_summary_toggle_volume" app:title="@string/pref_title_toggle_volume" /> + + + + - \ No newline at end of file