Fix tablet layout crashing

This commit is contained in:
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
), PopupTextProvider {
init {
this.setHasStableIds(true)
}
fun swapDataSet(dataSet: List<Artist>) {
this.dataSet = dataSet
notifyDataSetChanged()

View file

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

View file

@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorSurface"
android:clickable="true"
android:focusable="true">
@ -11,7 +12,9 @@
android:id="@+id/colorBackground"
android:layout_width="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"

View file

@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorSurface"
android:clickable="true"
android:focusable="true">
@ -11,7 +12,9 @@
android:id="@+id/colorBackground"
android:layout_width="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"

View file

@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorSurface"
android:clickable="true"
android:focusable="true">
@ -11,21 +12,16 @@
android:id="@+id/colorBackground"
android:layout_width="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
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/shadow_up" />
<LinearLayout
android:id="@+id/playerContent"
android:layout_width="400dp"

View file

@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorSurface"
android:clickable="true"
android:focusable="true">
@ -11,7 +12,9 @@
android:id="@+id/colorBackground"
android:layout_width="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"

View file

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

View file

@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorSurface"
android:clickable="true"
android:focusable="true">
@ -11,7 +12,9 @@
android:id="@+id/colorBackground"
android:layout_width="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"

View file

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

View file

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