From 2054272510161d46689d0149a929028cc2f2715c Mon Sep 17 00:00:00 2001 From: h4h13 Date: Tue, 29 Oct 2019 22:26:05 +0530 Subject: [PATCH] Fix peak theme background when expand --- app/src/main/assets/retro-changelog.html | 2 +- .../base/AbsSlidingMusicPanelActivity.kt | 20 +++++++++++++++++++ .../res/layout/sliding_music_panel_layout.xml | 10 +++++++++- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/app/src/main/assets/retro-changelog.html b/app/src/main/assets/retro-changelog.html index 49aac675..263b37a9 100644 --- a/app/src/main/assets/retro-changelog.html +++ b/app/src/main/assets/retro-changelog.html @@ -1 +1 @@ -

v3.4.500

v3.3.200

v.3.3.100

v3.3.000

v3.2.240

v3.2.220

v3.2.203

v3.2.135

v3.2.125

v3.2.120

v3.2.105

v3.2.100

v3.2.000

v3.1.900

v3.1.850

v3.1.800

v3.1.700

v3.1.400

v3.1.300

If you see entire app white or dark or black select same theme in settings to fix

FAQ's

*If you face any UI related issues you clear app data and cache, if its not working try to uninstall and install again.

\ No newline at end of file +

v3.4.500

v3.3.200

v.3.3.100

v3.3.000

v3.2.240

v3.2.220

v3.2.203

v3.2.135

v3.2.125

v3.2.120

v3.2.105

v3.2.100

v3.2.000

v3.1.900

v3.1.850

v3.1.800

v3.1.700

v3.1.400

v3.1.300

If you see entire app white or dark or black select same theme in settings to fix

FAQ's

*If you face any UI related issues you clear app data and cache, if its not working try to uninstall and install again.

\ No newline at end of file diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsSlidingMusicPanelActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsSlidingMusicPanelActivity.kt index e11fded1..71878da6 100644 --- a/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsSlidingMusicPanelActivity.kt +++ b/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsSlidingMusicPanelActivity.kt @@ -2,7 +2,9 @@ package code.name.monkey.retromusic.activities.base import android.animation.ValueAnimator import android.annotation.SuppressLint +import android.graphics.Rect import android.os.Bundle +import android.view.MotionEvent import android.view.View import android.view.ViewGroup import android.view.ViewTreeObserver @@ -11,6 +13,8 @@ import androidx.fragment.app.Fragment import code.name.monkey.appthemehelper.util.ATHUtil import code.name.monkey.appthemehelper.util.ColorUtil import code.name.monkey.retromusic.R +import code.name.monkey.retromusic.extensions.hide +import code.name.monkey.retromusic.extensions.show import code.name.monkey.retromusic.fragments.MiniPlayerFragment import code.name.monkey.retromusic.fragments.NowPlayingScreen import code.name.monkey.retromusic.fragments.NowPlayingScreen.* @@ -60,6 +64,8 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), AbsPlay override fun onSlide(bottomSheet: View, slideOffset: Float) { setMiniPlayerAlphaProgress(slideOffset) + dimBackground.show() + dimBackground.alpha = slideOffset } override fun onStateChanged(bottomSheet: View, newState: Int) { @@ -69,6 +75,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), AbsPlay } BottomSheetBehavior.STATE_COLLAPSED -> { onPanelCollapsed() + dimBackground.hide() } else -> { @@ -344,4 +351,17 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), AbsPlay } } } + + override fun dispatchTouchEvent(ev: MotionEvent?): Boolean { + if (ev?.action == MotionEvent.ACTION_DOWN) { + if (panelState == BottomSheetBehavior.STATE_EXPANDED) { + val outRect = Rect() + slidingPanel.getGlobalVisibleRect(outRect) + if (!outRect.contains(ev.rawX.toInt(), ev.rawY.toInt())) { + bottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED + } + } + } + return super.dispatchTouchEvent(ev) + } } \ No newline at end of file diff --git a/app/src/main/res/layout/sliding_music_panel_layout.xml b/app/src/main/res/layout/sliding_music_panel_layout.xml index 2f07a739..b4508072 100644 --- a/app/src/main/res/layout/sliding_music_panel_layout.xml +++ b/app/src/main/res/layout/sliding_music_panel_layout.xml @@ -9,8 +9,16 @@ + + + android:background="?colorOnSecondary" + android:clickable="true" + android:focusable="true" + android:visibility="gone" />