diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/PlayerAlbumCoverFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/PlayerAlbumCoverFragment.kt index 395669ec..1e685b2e 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/PlayerAlbumCoverFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/PlayerAlbumCoverFragment.kt @@ -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 { diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/classic/ClassicPlayerFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/classic/ClassicPlayerFragment.kt index 95f4cb68..a38876cb 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/classic/ClassicPlayerFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/classic/ClassicPlayerFragment.kt @@ -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 { diff --git a/app/src/main/res/layout/fragment_album_card_cover.xml b/app/src/main/res/layout/fragment_album_card_cover.xml index f3e71419..2424fc9b 100644 --- a/app/src/main/res/layout/fragment_album_card_cover.xml +++ b/app/src/main/res/layout/fragment_album_card_cover.xml @@ -1,5 +1,5 @@ - + app:cardElevation="4dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_album_carousel_cover.xml b/app/src/main/res/layout/fragment_album_carousel_cover.xml index fe9b40c7..cb5656c9 100644 --- a/app/src/main/res/layout/fragment_album_carousel_cover.xml +++ b/app/src/main/res/layout/fragment_album_carousel_cover.xml @@ -13,7 +13,7 @@ --> - + app:cardElevation="8dp" + app:cardUseCompatPadding="true" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintDimensionRatio="1:1" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> + tools:srcCompat="@tools:sample/backgrounds/scenic[5]" /> - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_album_circle_cover.xml b/app/src/main/res/layout/fragment_album_circle_cover.xml index 1c33abfd..ce28ec7c 100644 --- a/app/src/main/res/layout/fragment_album_circle_cover.xml +++ b/app/src/main/res/layout/fragment_album_circle_cover.xml @@ -1,24 +1,23 @@ - - + - - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_album_flat_cover.xml b/app/src/main/res/layout/fragment_album_flat_cover.xml index 1e9be1b2..58e570a6 100644 --- a/app/src/main/res/layout/fragment_album_flat_cover.xml +++ b/app/src/main/res/layout/fragment_album_flat_cover.xml @@ -1,20 +1,20 @@ - - - - - - \ No newline at end of file + + diff --git a/app/src/main/res/layout/fragment_album_full_card_cover.xml b/app/src/main/res/layout/fragment_album_full_card_cover.xml index 0828390d..d0052e21 100644 --- a/app/src/main/res/layout/fragment_album_full_card_cover.xml +++ b/app/src/main/res/layout/fragment_album_full_card_cover.xml @@ -1,16 +1,20 @@ - + app:cardElevation="8dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_album_full_cover.xml b/app/src/main/res/layout/fragment_album_full_cover.xml index b2a3bf57..d1ca66a0 100644 --- a/app/src/main/res/layout/fragment_album_full_cover.xml +++ b/app/src/main/res/layout/fragment_album_full_cover.xml @@ -1,15 +1,20 @@ - - \ No newline at end of file + \ No newline at end of file