[Home] Consistent no. of lines for Home playlist buttons
This commit is contained in:
parent
e4a309af66
commit
adab132bf3
3 changed files with 18 additions and 2 deletions
|
@ -23,6 +23,7 @@ import android.view.View
|
|||
import androidx.activity.addCallback
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.core.text.HtmlCompat
|
||||
import androidx.core.view.doOnLayout
|
||||
import androidx.core.view.doOnPreDraw
|
||||
import androidx.navigation.fragment.FragmentNavigatorExtras
|
||||
import androidx.navigation.fragment.findNavController
|
||||
|
@ -87,6 +88,21 @@ class HomeFragment :
|
|||
remove()
|
||||
mainActivity.finish()
|
||||
}
|
||||
view.doOnLayout {
|
||||
adjustPlaylistButtons()
|
||||
}
|
||||
}
|
||||
|
||||
private fun adjustPlaylistButtons() {
|
||||
val buttons =
|
||||
listOf(binding.history, binding.lastAdded, binding.topPlayed, binding.actionShuffle)
|
||||
buttons.maxOf { it.lineCount }.let { maxLineCount->
|
||||
buttons.forEach { button ->
|
||||
// Set the highest line count to every button for consistency
|
||||
button.setLines(maxLineCount)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun setupListeners() {
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
android:layout_marginEnd="16dp"
|
||||
android:text="@string/my_top_tracks"
|
||||
app:icon="@drawable/ic_trending_up"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/actionShuffle"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="@+id/history"
|
||||
|
|
|
@ -223,7 +223,8 @@
|
|||
</style>
|
||||
|
||||
<style name="HomeActionButton" parent="Widget.Material3.Button.ElevatedButton.Icon">
|
||||
<item name="android:padding">16dp</item>
|
||||
<item name="android:paddingTop">16dp</item>
|
||||
<item name="android:paddingBottom">16dp</item>
|
||||
<item name="android:textColor">?attr/colorOnSurface</item>
|
||||
<item name="shapeAppearanceOverlay">
|
||||
@style/ShapeAppearanceOverlay.Material3.FloatingActionButton
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue