Added option to disable changing song by swiping anywhere on the now playing screen

This commit is contained in:
Prathamesh More 2022-01-29 22:35:25 +05:30
parent 7c5a97c410
commit 8db4afa502
5 changed files with 22 additions and 6 deletions

View file

@ -55,6 +55,7 @@ object Constants {
) )
const val NUMBER_OF_TOP_TRACKS = 99 const val NUMBER_OF_TOP_TRACKS = 99
} }
const val EXTRA_PLAYLIST_TYPE = "type" const val EXTRA_PLAYLIST_TYPE = "type"
const val EXTRA_GENRE = "extra_genre" const val EXTRA_GENRE = "extra_genre"
const val EXTRA_PLAYLIST = "extra_playlist" const val EXTRA_PLAYLIST = "extra_playlist"
@ -162,3 +163,4 @@ const val APPBAR_MODE = "appbar_mode"
const val WALLPAPER_ACCENT = "wallpaper_accent" const val WALLPAPER_ACCENT = "wallpaper_accent"
const val SCREEN_ON_LYRICS = "screen_on_lyrics" const val SCREEN_ON_LYRICS = "screen_on_lyrics"
const val CIRCLE_PLAY_BUTTON = "circle_play_button" const val CIRCLE_PLAY_BUTTON = "circle_play_button"
const val SWIPE_ANYWHERE_NOW_PLAYING = "swipe_anywhere_now_playing"

View file

@ -315,11 +315,13 @@ abstract class AbsPlayerFragment(@LayoutRes layout: Int) : AbsMainActivityFragme
} }
} }
requireView().setOnTouchListener( requireView().setOnTouchListener(
if (PreferenceUtil.swipeAnywhereToChangeSong) {
SwipeDetector( SwipeDetector(
requireContext(), requireContext(),
playerAlbumCoverFragment?.viewPager, playerAlbumCoverFragment?.viewPager,
requireView() requireView()
) )
} else null
) )
} }

View file

@ -708,6 +708,9 @@ object PreferenceUtil {
val circlePlayButton val circlePlayButton
get() = sharedPreferences.getBoolean(CIRCLE_PLAY_BUTTON, false) get() = sharedPreferences.getBoolean(CIRCLE_PLAY_BUTTON, false)
val swipeAnywhereToChangeSong
get() = sharedPreferences.getBoolean(SWIPE_ANYWHERE_NOW_PLAYING, true)
} }
enum class LyricsType { enum class LyricsType {
REPLACE_COVER, OVER_COVER REPLACE_COVER, OVER_COVER

View file

@ -347,6 +347,7 @@
<string name="pref_summary_remember_tab">Navigate to the last used tab on start</string> <string name="pref_summary_remember_tab">Navigate to the last used tab on start</string>
<string name="pref_summary_show_lyrics">Display synced lyrics over album cover</string> <string name="pref_summary_show_lyrics">Display synced lyrics over album cover</string>
<string name="pref_summary_suggestions">Show New Music Mix on homescreen</string> <string name="pref_summary_suggestions">Show New Music Mix on homescreen</string>
<string name="pref_summary_swipe_anywhere_now_playing">Enables changing song by swiping anywhere on the now playing screen</string>
<string name="pref_summary_toggle_full_screen">Immersive mode</string> <string name="pref_summary_toggle_full_screen">Immersive mode</string>
<string name="pref_summary_toggle_headset">Start playing immediately after headphones are connected</string> <string name="pref_summary_toggle_headset">Start playing immediately after headphones are connected</string>
<string name="pref_summary_toggle_shuffle">Shuffle mode will turn off when playing a new list of songs</string> <string name="pref_summary_toggle_shuffle">Shuffle mode will turn off when playing a new list of songs</string>
@ -390,6 +391,7 @@
<string name="pref_title_remember_tab">Remember last tab</string> <string name="pref_title_remember_tab">Remember last tab</string>
<string name="pref_title_show_lyrics">Show lyrics</string> <string name="pref_title_show_lyrics">Show lyrics</string>
<string name="pref_title_suggestions">Show suggestions</string> <string name="pref_title_suggestions">Show suggestions</string>
<string name="pref_title_swipe_anywhere_now_playing">Swipe anywhere to change song</string>
<string name="pref_title_tab_text_mode">Tab titles mode</string> <string name="pref_title_tab_text_mode">Tab titles mode</string>
<string name="pref_title_toggle_carousel_effect">Carousel effect</string> <string name="pref_title_toggle_carousel_effect">Carousel effect</string>
<string name="pref_title_toggle_full_screen">Fullscreen app</string> <string name="pref_title_toggle_full_screen">Fullscreen app</string>

View file

@ -42,6 +42,13 @@
android:layout="@layout/list_item_view_switch_no_title" android:layout="@layout/list_item_view_switch_no_title"
android:title="@string/pref_title_circle_button" /> android:title="@string/pref_title_circle_button" />
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATESwitchPreference
android:defaultValue="true"
android:key="swipe_anywhere_now_playing"
android:layout="@layout/list_item_view_switch"
android:summary="@string/pref_summary_swipe_anywhere_now_playing"
android:title="@string/pref_title_swipe_anywhere_now_playing" />
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory <code.name.monkey.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory
android:layout="@layout/preference_category_title" android:layout="@layout/preference_category_title"
android:title="@string/pref_header_album"> android:title="@string/pref_header_album">