Fix tablet layout crashing

main
h4h13 2020-02-17 21:47:47 +05:30
parent f578aa0937
commit d4d9df6ba5
11 changed files with 39 additions and 35 deletions

View File

@ -35,6 +35,10 @@ class ArtistAdapter(
activity, cabHolder, R.menu.menu_media_selection activity, cabHolder, R.menu.menu_media_selection
), PopupTextProvider { ), PopupTextProvider {
init {
this.setHasStableIds(true)
}
fun swapDataSet(dataSet: List<Artist>) { fun swapDataSet(dataSet: List<Artist>) {
this.dataSet = dataSet this.dataSet = dataSet
notifyDataSetChanged() notifyDataSetChanged()

View File

@ -54,7 +54,7 @@ class BlurPlayerFragment : AbsPlayerFragment(), SharedPreferences.OnSharedPrefer
} }
private fun setUpPlayerToolbar() { private fun setUpPlayerToolbar() {
playerToolbar!!.apply { playerToolbar.apply {
inflateMenu(R.menu.menu_player) inflateMenu(R.menu.menu_player)
setNavigationOnClickListener { activity!!.onBackPressed() } setNavigationOnClickListener { activity!!.onBackPressed() }
ToolbarContentTintHelper.colorizeToolbar(this, Color.WHITE, activity) ToolbarContentTintHelper.colorizeToolbar(this, Color.WHITE, activity)
@ -68,8 +68,8 @@ class BlurPlayerFragment : AbsPlayerFragment(), SharedPreferences.OnSharedPrefer
override fun onColorChanged(color: Int) { override fun onColorChanged(color: Int) {
playbackControlsFragment.setDark(color) playbackControlsFragment.setDark(color)
lastColor = color lastColor = color
callbacks!!.onPaletteColorChanged() callbacks?.onPaletteColorChanged()
ToolbarContentTintHelper.colorizeToolbar(playerToolbar!!, Color.WHITE, activity) ToolbarContentTintHelper.colorizeToolbar(playerToolbar, Color.WHITE, activity)
} }
override fun toggleFavorite(song: Song) { override fun toggleFavorite(song: Song) {
@ -99,17 +99,16 @@ class BlurPlayerFragment : AbsPlayerFragment(), SharedPreferences.OnSharedPrefer
private fun updateBlur() { private fun updateBlur() {
val blurAmount = PreferenceManager.getDefaultSharedPreferences(requireContext()) val blurAmount = PreferenceManager.getDefaultSharedPreferences(requireContext())
.getInt(PreferenceUtil.NEW_BLUR_AMOUNT, 25) .getInt(PreferenceUtil.NEW_BLUR_AMOUNT, 25)
colorBackground!!.clearColorFilter() colorBackground.clearColorFilter()
SongGlideRequest.Builder.from(Glide.with(requireActivity()), MusicPlayerRemote.currentSong) SongGlideRequest.Builder.from(Glide.with(requireActivity()), MusicPlayerRemote.currentSong)
.checkIgnoreMediaStore(requireContext()) .checkIgnoreMediaStore(requireContext())
.generatePalette(requireContext()).build() .generatePalette(requireContext()).build()
.dontAnimate()
.transform(BlurTransformation.Builder(requireContext()).blurRadius(blurAmount.toFloat()).build()) .transform(BlurTransformation.Builder(requireContext()).blurRadius(blurAmount.toFloat()).build())
//.centerCrop()
//.override(320, 480)
.into(object : RetroMusicColoredTarget(colorBackground) { .into(object : RetroMusicColoredTarget(colorBackground) {
override fun onColorReady(color: Int) { override fun onColorReady(color: Int) {
if (color == defaultFooterColor) { if (color == defaultFooterColor) {
colorBackground!!.setColorFilter(color) colorBackground.setColorFilter(color)
} }
} }
}) })

View File

@ -133,13 +133,12 @@ class CardBlurFragment : AbsPlayerFragment(), SharedPreferences.OnSharedPreferen
SongGlideRequest.Builder.from(Glide.with(requireActivity()), MusicPlayerRemote.currentSong) SongGlideRequest.Builder.from(Glide.with(requireActivity()), MusicPlayerRemote.currentSong)
.checkIgnoreMediaStore(requireContext()) .checkIgnoreMediaStore(requireContext())
.generatePalette(requireContext()).build() .generatePalette(requireContext()).build()
.dontAnimate()
.transform(BlurTransformation.Builder(requireContext()).blurRadius(blurAmount.toFloat()).build()) .transform(BlurTransformation.Builder(requireContext()).blurRadius(blurAmount.toFloat()).build())
//.centerCrop()
//.override(320, 480)
.into(object : RetroMusicColoredTarget(colorBackground) { .into(object : RetroMusicColoredTarget(colorBackground) {
override fun onColorReady(color: Int) { override fun onColorReady(color: Int) {
if (color == defaultFooterColor) { if (color == defaultFooterColor) {
colorBackground!!.setColorFilter(color) colorBackground.setColorFilter(color)
} }
} }
}) })

View File

@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/colorSurface"
android:clickable="true" android:clickable="true"
android:focusable="true"> android:focusable="true">
@ -11,7 +12,9 @@
android:id="@+id/colorBackground" android:id="@+id/colorBackground"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:scaleType="centerCrop" /> android:background="?attr/colorSurface"
android:scaleType="centerCrop"
app:srcCompat="@color/black_color" />
<View <View
android:id="@+id/mask" android:id="@+id/mask"

View File

@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/colorSurface"
android:clickable="true" android:clickable="true"
android:focusable="true"> android:focusable="true">
@ -11,7 +12,9 @@
android:id="@+id/colorBackground" android:id="@+id/colorBackground"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:scaleType="centerCrop" /> android:background="?attr/colorSurface"
android:scaleType="centerCrop"
app:srcCompat="@color/black_color" />
<View <View
android:id="@+id/mask" android:id="@+id/mask"

View File

@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/colorSurface"
android:clickable="true" android:clickable="true"
android:focusable="true"> android:focusable="true">
@ -11,21 +12,16 @@
android:id="@+id/colorBackground" android:id="@+id/colorBackground"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:scaleType="centerCrop" /> android:background="?attr/colorSurface"
android:scaleType="centerCrop"
app:srcCompat="@color/black_color" />
<View
android:id="@+id/mask"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/md_black_1000"
android:visibility="gone" />
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@drawable/shadow_up" /> android:background="@drawable/shadow_up" />
<LinearLayout <LinearLayout
android:id="@+id/playerContent" android:id="@+id/playerContent"
android:layout_width="400dp" android:layout_width="400dp"

View File

@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/colorSurface"
android:clickable="true" android:clickable="true"
android:focusable="true"> android:focusable="true">
@ -11,7 +12,9 @@
android:id="@+id/colorBackground" android:id="@+id/colorBackground"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:scaleType="centerCrop" /> android:background="?attr/colorSurface"
android:scaleType="centerCrop"
app:srcCompat="@color/black_color" />
<View <View
android:id="@+id/mask" android:id="@+id/mask"

View File

@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/colorSurface"
android:clickable="true" android:clickable="true"
android:focusable="true"> android:focusable="true">
@ -11,17 +12,15 @@
android:id="@+id/colorBackground" android:id="@+id/colorBackground"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:scaleType="centerCrop" /> android:background="?attr/colorSurface"
android:scaleType="centerCrop"
app:srcCompat="@color/black_color" />
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/shadow_up_full_theme" /> android:background="@drawable/shadow_up_full_theme" />
<View
android:id="@+id/mask"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -52,8 +51,7 @@
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1">
tools:background="@color/md_white_1000">
<fragment <fragment
android:id="@+id/playbackControlsFragment" android:id="@+id/playbackControlsFragment"

View File

@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/colorSurface"
android:clickable="true" android:clickable="true"
android:focusable="true"> android:focusable="true">
@ -11,7 +12,9 @@
android:id="@+id/colorBackground" android:id="@+id/colorBackground"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:scaleType="centerCrop" /> android:background="?attr/colorSurface"
android:scaleType="centerCrop"
app:srcCompat="@color/black_color" />
<View <View
android:id="@+id/mask" android:id="@+id/mask"

View File

@ -32,7 +32,6 @@
android:paddingStart="16dp" android:paddingStart="16dp"
android:paddingEnd="16dp"> android:paddingEnd="16dp">
<com.google.android.material.textview.MaterialTextView <com.google.android.material.textview.MaterialTextView
android:id="@+id/songCurrentProgress" android:id="@+id/songCurrentProgress"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -40,11 +39,9 @@
android:layout_weight="1" android:layout_weight="1"
android:paddingStart="8dp" android:paddingStart="8dp"
android:paddingEnd="8dp" android:paddingEnd="8dp"
android:textAppearance="@style/TextViewOverline"
android:textStyle="bold" android:textStyle="bold"
tools:text="22.00" /> tools:text="22.00" />
<com.google.android.material.textview.MaterialTextView <com.google.android.material.textview.MaterialTextView
android:id="@+id/songTotalTime" android:id="@+id/songTotalTime"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -52,7 +49,6 @@
android:layout_weight="0" android:layout_weight="0"
android:paddingStart="8dp" android:paddingStart="8dp"
android:paddingEnd="8dp" android:paddingEnd="8dp"
android:textAppearance="@style/TextViewOverline"
android:textStyle="bold" android:textStyle="bold"
tools:text="22.00" /> tools:text="22.00" />
</LinearLayout> </LinearLayout>
@ -81,8 +77,8 @@
android:maxLines="1" android:maxLines="1"
android:paddingStart="16dp" android:paddingStart="16dp"
android:paddingTop="8dp" android:paddingTop="8dp"
android:paddingBottom="8dp"
android:paddingEnd="16dp" android:paddingEnd="16dp"
android:paddingBottom="8dp"
android:textSize="12sp" android:textSize="12sp"
tools:text="@tools:sample/lorem/random" /> tools:text="@tools:sample/lorem/random" />
</LinearLayout> </LinearLayout>

View File

@ -49,5 +49,5 @@
<dimen name="bottom_sheet_peek_1_height">56dp</dimen> <dimen name="bottom_sheet_peek_1_height">56dp</dimen>
<dimen name="bottom_sheet_peek_2_height">32dp</dimen> <dimen name="bottom_sheet_peek_2_height">32dp</dimen>
<dimen name="list_pref_guideline_begin">56dp</dimen> <dimen name="list_pref_guideline_begin">56dp</dimen>
<dimen name="pref_title_padding">70dp</dimen> <dimen name="pref_title_padding">72dp</dimen>
</resources> </resources>