Fix issues

Lockscreen controls and screen wakes when locked
Removed animaked `peakheight` for Bottomsheet
Added padding for details items to show last item
Fix suggestion text for less than 26 API
This commit is contained in:
Hemanth S 2020-09-24 20:51:08 +05:30
parent 0e8010ad78
commit b9c12e20dd
11 changed files with 59 additions and 32 deletions

View file

@ -9,7 +9,8 @@ import android.view.WindowManager
import androidx.core.view.ViewCompat
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsMusicServiceActivity
import code.name.monkey.retromusic.fragments.player.lockscreen.LockScreenPlayerControlsFragment
import code.name.monkey.retromusic.extensions.whichFragment
import code.name.monkey.retromusic.fragments.player.lockscreen.LockScreenControlsFragment
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
import code.name.monkey.retromusic.glide.SongGlideRequest
import code.name.monkey.retromusic.helper.MusicPlayerRemote
@ -22,19 +23,19 @@ import com.r0adkll.slidr.model.SlidrPosition
import kotlinx.android.synthetic.main.activity_lock_screen.*
class LockScreenActivity : AbsMusicServiceActivity() {
private var fragment: LockScreenPlayerControlsFragment? = null
private var fragment: LockScreenControlsFragment? = null
override fun onCreate(savedInstanceState: Bundle?) {
setDrawUnderStatusBar()
super.onCreate(savedInstanceState)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
setShowWhenLocked(true)
setTurnScreenOn(true)
val keyguardManager = getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager
keyguardManager.requestDismissKeyguard(this, null)
} else {
this.window.addFlags(
WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD or
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
)
}
setContentView(R.layout.activity_lock_screen)
@ -67,8 +68,7 @@ class LockScreenActivity : AbsMusicServiceActivity() {
Slidr.attach(this, config)
fragment =
supportFragmentManager.findFragmentById(R.id.playback_controls_fragment) as LockScreenPlayerControlsFragment?
fragment = whichFragment<LockScreenControlsFragment>(R.id.playback_controls_fragment)
findViewById<View>(R.id.slide).apply {
translationY = 100f

View file

@ -330,7 +330,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
ViewCompat.setElevation(slidingPanel, 0f)
ViewCompat.setElevation(bottomNavigationView, 10f)
bottomSheetBehavior.isHideable = true
bottomSheetBehavior.setPeekHeight(0, true)
bottomSheetBehavior.setPeekHeight(0, false)
bottomSheetBehavior.state = STATE_COLLAPSED
}
COLLAPSED_WITH -> {
@ -341,7 +341,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
bottomSheetBehavior.isHideable = false
bottomSheetBehavior.setPeekHeight(
if (isQueueEmpty) 0 else (heightOfBar * 2) - 24,
true
false
)
bottomNavigationView.isVisible = true
}
@ -353,7 +353,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
bottomSheetBehavior.isHideable = false
bottomSheetBehavior.setPeekHeight(
if (isQueueEmpty) 0 else heightOfBar - 24,
true
false
)
bottomNavigationView.isGone = true
}