Added an option to enable/disable swipe
This commit is contained in:
parent
3c26c39a5a
commit
4b08919d7d
6 changed files with 22 additions and 9 deletions
|
@ -167,4 +167,5 @@ const val SCREEN_ON_LYRICS = "screen_on_lyrics"
|
|||
const val CIRCLE_PLAY_BUTTON = "circle_play_button"
|
||||
const val SWIPE_ANYWHERE_NOW_PLAYING = "swipe_anywhere_now_playing"
|
||||
const val PAUSE_HISTORY = "pause_history"
|
||||
const val MANAGE_AUDIO_FOCUS = "manage_audio_focus"
|
||||
const val MANAGE_AUDIO_FOCUS = "manage_audio_focus"
|
||||
const val SWIPE_DOWN_DISMISS = "swipe_to_dismiss"
|
|
@ -148,7 +148,7 @@ class MainActivity : AbsCastActivity(), OnSharedPreferenceChangeListener {
|
|||
}
|
||||
|
||||
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?) {
|
||||
if (key == GENERAL_THEME || key == MATERIAL_YOU || key == WALLPAPER_ACCENT || key == BLACK_THEME || key == ADAPTIVE_COLOR_APP || key == USER_NAME || key == TOGGLE_FULL_SCREEN || key == TOGGLE_VOLUME || key == ROUND_CORNERS || key == CAROUSEL_EFFECT || key == NOW_PLAYING_SCREEN_ID || key == TOGGLE_GENRE || key == BANNER_IMAGE_PATH || key == PROFILE_IMAGE_PATH || key == CIRCULAR_ALBUM_ART || key == KEEP_SCREEN_ON || key == TOGGLE_SEPARATE_LINE || key == TOGGLE_HOME_BANNER || key == TOGGLE_ADD_CONTROLS || key == ALBUM_COVER_STYLE || key == HOME_ARTIST_GRID_STYLE || key == ALBUM_COVER_TRANSFORM || key == DESATURATED_COLOR || key == EXTRA_SONG_INFO || key == TAB_TEXT_MODE || key == LANGUAGE_NAME || key == LIBRARY_CATEGORIES || key == CUSTOM_FONT || key == APPBAR_MODE || key == CIRCLE_PLAY_BUTTON) {
|
||||
if (key == GENERAL_THEME || key == MATERIAL_YOU || key == WALLPAPER_ACCENT || key == BLACK_THEME || key == ADAPTIVE_COLOR_APP || key == USER_NAME || key == TOGGLE_FULL_SCREEN || key == TOGGLE_VOLUME || key == ROUND_CORNERS || key == CAROUSEL_EFFECT || key == NOW_PLAYING_SCREEN_ID || key == TOGGLE_GENRE || key == BANNER_IMAGE_PATH || key == PROFILE_IMAGE_PATH || key == CIRCULAR_ALBUM_ART || key == KEEP_SCREEN_ON || key == TOGGLE_SEPARATE_LINE || key == TOGGLE_HOME_BANNER || key == TOGGLE_ADD_CONTROLS || key == ALBUM_COVER_STYLE || key == HOME_ARTIST_GRID_STYLE || key == ALBUM_COVER_TRANSFORM || key == DESATURATED_COLOR || key == EXTRA_SONG_INFO || key == TAB_TEXT_MODE || key == LANGUAGE_NAME || key == LIBRARY_CATEGORIES || key == CUSTOM_FONT || key == APPBAR_MODE || key == CIRCLE_PLAY_BUTTON || key == SWIPE_DOWN_DISMISS) {
|
||||
postRecreate()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -160,7 +160,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
|
|||
private fun setupBottomSheet() {
|
||||
bottomSheetBehavior = from(binding.slidingPanel)
|
||||
bottomSheetBehavior.addBottomSheetCallback(bottomSheetCallbackList)
|
||||
bottomSheetBehavior.isHideable = true
|
||||
if (PreferenceUtil.swipeDownToDismiss) bottomSheetBehavior.isHideable = true
|
||||
setMiniPlayerAlphaProgress(0F)
|
||||
}
|
||||
|
||||
|
@ -298,7 +298,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
|
|||
navigationBarColor = surfaceColor()
|
||||
setTaskDescColor(paletteColor)
|
||||
val isColorLight = paletteColor.isColorLight
|
||||
if (PreferenceUtil.isAdaptiveColor && (nowPlayingScreen == Normal || nowPlayingScreen == Flat || nowPlayingScreen == Material)) {
|
||||
if (PreferenceUtil.isAdaptiveColor && (nowPlayingScreen == Normal || nowPlayingScreen == Flat || nowPlayingScreen == Material)) {
|
||||
setLightNavigationBar(true)
|
||||
setLightStatusBar(isColorLight)
|
||||
} else if (nowPlayingScreen == Card || nowPlayingScreen == Blur || nowPlayingScreen == BlurCard) {
|
||||
|
@ -357,7 +357,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
|
|||
fun setBottomNavVisibility(
|
||||
visible: Boolean,
|
||||
animate: Boolean = false,
|
||||
hideBottomSheet: Boolean = MusicPlayerRemote.playingQueue.isEmpty()
|
||||
hideBottomSheet: Boolean = MusicPlayerRemote.playingQueue.isEmpty(),
|
||||
) {
|
||||
if (isInOneTabMode) {
|
||||
hideBottomSheet(
|
||||
|
@ -391,7 +391,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
|
|||
fun hideBottomSheet(
|
||||
hide: Boolean,
|
||||
animate: Boolean = false,
|
||||
isBottomNavVisible: Boolean = bottomNavigationView.isVisible
|
||||
isBottomNavVisible: Boolean = bottomNavigationView.isVisible,
|
||||
) {
|
||||
val heightOfBar =
|
||||
windowInsets.safeGetBottomInsets() +
|
||||
|
|
|
@ -67,12 +67,12 @@ object PreferenceUtil {
|
|||
}
|
||||
|
||||
fun registerOnSharedPreferenceChangedListener(
|
||||
listener: OnSharedPreferenceChangeListener
|
||||
listener: OnSharedPreferenceChangeListener,
|
||||
) = sharedPreferences.registerOnSharedPreferenceChangeListener(listener)
|
||||
|
||||
|
||||
fun unregisterOnSharedPreferenceChangedListener(
|
||||
changeListener: OnSharedPreferenceChangeListener
|
||||
changeListener: OnSharedPreferenceChangeListener,
|
||||
) = sharedPreferences.unregisterOnSharedPreferenceChangeListener(changeListener)
|
||||
|
||||
|
||||
|
@ -394,7 +394,7 @@ object PreferenceUtil {
|
|||
val filterLength get() = sharedPreferences.getInt(FILTER_SONG, 20)
|
||||
|
||||
var lastVersion
|
||||
// This was stored as an integer before now it's a long, so avoid a ClassCastException
|
||||
// This was stored as an integer before now it's a long, so avoid a ClassCastException
|
||||
get() = try {
|
||||
sharedPreferences.getLong(LAST_CHANGELOG_VERSION, 0)
|
||||
} catch (e: ClassCastException) {
|
||||
|
@ -725,6 +725,9 @@ object PreferenceUtil {
|
|||
|
||||
val swipeAnywhereToChangeSong
|
||||
get() = sharedPreferences.getBoolean(SWIPE_ANYWHERE_NOW_PLAYING, true)
|
||||
|
||||
val swipeDownToDismiss
|
||||
get() = sharedPreferences.getBoolean(SWIPE_DOWN_DISMISS, true)
|
||||
}
|
||||
|
||||
enum class LyricsType {
|
||||
|
|
|
@ -553,4 +553,6 @@
|
|||
<string name="you_have_to_select_at_least_one_category">You have to select at least one category.</string>
|
||||
<string name="you_will_be_forwarded_to_the_issue_tracker_website">You will be forwarded to the issue tracker website.</string>
|
||||
<string name="your_account_data_is_only_used_for_authentication">Your account data is only used for authentication.</string>
|
||||
<string name="pref_summary_swipe_to_dismiss">Swipe down to dismiss mini player</string>
|
||||
<string name="pref_title_swipe_to_dismiss">Dismiss with swipe down</string>
|
||||
</resources>
|
||||
|
|
|
@ -80,6 +80,13 @@
|
|||
android:layout="@layout/preference_category_title"
|
||||
android:title="@string/pref_header_controls">
|
||||
|
||||
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATESwitchPreference
|
||||
android:layout="@layout/list_item_view_switch"
|
||||
app:defaultValue="false"
|
||||
app:key="swipe_to_dismiss"
|
||||
app:summary="@string/pref_summary_swipe_to_dismiss"
|
||||
app:title="@string/pref_title_swipe_to_dismiss" />
|
||||
|
||||
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATESwitchPreference
|
||||
android:layout="@layout/list_item_view_switch"
|
||||
app:defaultValue="false"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue