Fix 16:9 screen now playing themes
This commit is contained in:
parent
c00895d094
commit
2e22c74fef
8 changed files with 88 additions and 57 deletions
|
@ -17,6 +17,7 @@ import code.name.monkey.retromusic.util.PreferenceUtil
|
|||
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
||||
import kotlinx.android.synthetic.main.fragment_player_album_cover.*
|
||||
|
||||
|
||||
class PlayerAlbumCoverFragment : AbsMusicServiceFragment(), ViewPager.OnPageChangeListener {
|
||||
private var callbacks: Callbacks? = null
|
||||
private var currentPosition: Int = 0
|
||||
|
@ -46,11 +47,21 @@ class PlayerAlbumCoverFragment : AbsMusicServiceFragment(), ViewPager.OnPageChan
|
|||
viewPager.addOnPageChangeListener(this)
|
||||
val nps = PreferenceUtil.getInstance(requireContext()).nowPlayingScreen
|
||||
|
||||
val metrics = resources.displayMetrics
|
||||
val ratio = metrics.heightPixels.toFloat() / metrics.widthPixels.toFloat()
|
||||
|
||||
|
||||
if (nps == FULL || nps == CLASSIC || nps == FIT) {
|
||||
viewPager.offscreenPageLimit = 2
|
||||
} else if (PreferenceUtil.getInstance(requireContext()).carouselEffect()) {
|
||||
viewPager.clipToPadding = false
|
||||
viewPager.setPadding(40, 40, 40, 0)
|
||||
val padding =
|
||||
if (ratio >= 1.777f) {
|
||||
40
|
||||
} else {
|
||||
100
|
||||
}
|
||||
viewPager.setPadding(padding, 0, padding, 0)
|
||||
viewPager.pageMargin = 0
|
||||
viewPager.setPageTransformer(false, CarousalPagerTransformer(requireContext()))
|
||||
} else {
|
||||
|
|
|
@ -43,8 +43,8 @@ import com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropM
|
|||
import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager
|
||||
import com.h6ah4i.android.widget.advrecyclerview.touchguard.RecyclerViewTouchActionGuardManager
|
||||
import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils
|
||||
import kotlinx.android.synthetic.main.fragment_classic_player.*
|
||||
import kotlinx.android.synthetic.main.fragment_classic_controls.*
|
||||
import kotlinx.android.synthetic.main.fragment_classic_player.*
|
||||
import kotlinx.android.synthetic.main.status_bar.*
|
||||
|
||||
|
||||
|
@ -87,6 +87,7 @@ class ClassicPlayerFragment : AbsPlayerFragment(), View.OnLayoutChangeListener,
|
|||
}
|
||||
BottomSheetBehavior.STATE_COLLAPSED -> {
|
||||
resetToCurrentPosition()
|
||||
activity.getBottomSheetBehavior().setAllowDragging(true)
|
||||
}
|
||||
else -> {
|
||||
activity.getBottomSheetBehavior().setAllowDragging(true)
|
||||
|
@ -245,10 +246,13 @@ class ClassicPlayerFragment : AbsPlayerFragment(), View.OnLayoutChangeListener,
|
|||
}
|
||||
|
||||
override fun onBackPressed(): Boolean {
|
||||
var wasExpanded = false
|
||||
if (getQueuePanel().state == BottomSheetBehavior.STATE_EXPANDED) {
|
||||
wasExpanded = getQueuePanel().state == BottomSheetBehavior.STATE_EXPANDED
|
||||
getQueuePanel().state = BottomSheetBehavior.STATE_COLLAPSED
|
||||
return wasExpanded
|
||||
}
|
||||
return false
|
||||
return wasExpanded
|
||||
}
|
||||
|
||||
override fun toolbarIconColor(): Int {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue