MD3 Play & Shuffle button

This commit is contained in:
Prathamesh More 2021-09-25 18:49:21 +05:30
parent 2997095bb3
commit 289557898e
4 changed files with 23 additions and 48 deletions

View file

@ -79,10 +79,13 @@ abstract class AbsRecyclerViewFragment<A : RecyclerView.Adapter<*>, LM : Recycle
} }
}) })
binding.shuffleButton.setOnClickListener { binding.shuffleButton.apply {
setOnClickListener {
onShuffleClicked() onShuffleClicked()
} }
binding.shuffleButton.accentColor() accentColor()
hide()
}
} else { } else {
binding.shuffleButton.isVisible = false binding.shuffleButton.isVisible = false
} }

View file

@ -8,18 +8,14 @@
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/playAction" android:id="@+id/playAction"
style="@style/Widget.MaterialComponents.Button.OutlinedButton" style="@style/Widget.Material3.Button.OutlinedButton"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginEnd="4dp" android:layout_marginEnd="4dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:text="@string/action_play_all" android:text="@string/action_play_all"
android:textAppearance="@style/TextViewButton" android:textAppearance="@style/TextViewButton"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
app:backgroundTint="?attr/colorSurface"
app:cornerRadius="8dp"
app:icon="@drawable/ic_play_arrow" app:icon="@drawable/ic_play_arrow"
app:layout_constraintEnd_toStartOf="@+id/shuffleAction" app:layout_constraintEnd_toStartOf="@+id/shuffleAction"
app:layout_constraintHorizontal_bias="0.5" app:layout_constraintHorizontal_bias="0.5"
@ -28,18 +24,14 @@
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/shuffleAction" android:id="@+id/shuffleAction"
style="@style/Widget.MaterialComponents.Button.TextButton" style="@style/Widget.Material3.Button.Icon"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="4dp" android:layout_marginStart="4dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:text="@string/shuffle" android:text="@string/shuffle"
android:textAppearance="@style/TextViewButton" android:textAppearance="@style/TextViewButton"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
app:backgroundTint="?attr/colorSurface"
app:cornerRadius="8dp"
app:icon="@drawable/ic_shuffle" app:icon="@drawable/ic_shuffle"
app:layout_constraintBottom_toBottomOf="@+id/playAction" app:layout_constraintBottom_toBottomOf="@+id/playAction"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"

View file

@ -8,18 +8,15 @@
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/playAction" android:id="@+id/playAction"
style="@style/Widget.MaterialComponents.Button.OutlinedButton" style="@style/Widget.Material3.Button.OutlinedButton"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginEnd="4dp" android:layout_marginEnd="4dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:text="@string/action_play_all" android:text="@string/action_play_all"
android:textAppearance="@style/TextViewButton" android:textAppearance="@style/TextViewButton"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
app:backgroundTint="?attr/colorSurface" app:backgroundTint="?attr/colorSurface"
app:cornerRadius="8dp"
app:icon="@drawable/ic_play_arrow" app:icon="@drawable/ic_play_arrow"
app:layout_constraintEnd_toStartOf="@+id/shuffleAction" app:layout_constraintEnd_toStartOf="@+id/shuffleAction"
app:layout_constraintHorizontal_bias="0.5" app:layout_constraintHorizontal_bias="0.5"
@ -28,18 +25,15 @@
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/shuffleAction" android:id="@+id/shuffleAction"
style="@style/Widget.MaterialComponents.Button.TextButton" style="@style/Widget.Material3.Button.Icon"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="4dp" android:layout_marginStart="4dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:text="@string/shuffle" android:text="@string/shuffle"
android:textAppearance="@style/TextViewButton" android:textAppearance="@style/TextViewButton"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
app:backgroundTint="?attr/colorSurface" app:backgroundTint="?attr/colorSurface"
app:cornerRadius="8dp"
app:icon="@drawable/ic_shuffle" app:icon="@drawable/ic_shuffle"
app:layout_constraintBottom_toBottomOf="@+id/playAction" app:layout_constraintBottom_toBottomOf="@+id/playAction"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"

View file

@ -12,52 +12,38 @@
~ See the GNU General Public License for more details. ~ See the GNU General Public License for more details.
--> -->
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal"
android:paddingHorizontal="16dp"
android:paddingVertical="10dp">
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/playAction" android:id="@+id/playAction"
style="@style/Widget.MaterialComponents.Button.OutlinedButton" style="@style/Widget.Material3.Button.OutlinedButton"
android:layout_width="0dp" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="4dp" android:layout_marginEnd="4dp"
android:paddingTop="10dp" android:layout_weight="1"
android:paddingBottom="10dp"
android:text="@string/action_play_all" android:text="@string/action_play_all"
android:textAppearance="@style/TextViewButton" android:textAppearance="@style/TextViewButton"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
app:backgroundTint="?attr/colorSurface" app:backgroundTint="?attr/colorSurface"
app:cornerRadius="8dp" app:icon="@drawable/ic_play_arrow" />
app:icon="@drawable/ic_play_arrow"
app:layout_constraintEnd_toStartOf="@+id/shuffleAction"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/shuffleAction" android:id="@+id/shuffleAction"
style="@style/Widget.MaterialComponents.Button.TextButton" style="@style/Widget.Material3.Button.Icon"
android:layout_width="0dp" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="4dp" android:layout_marginStart="4dp"
android:layout_marginEnd="16dp" android:layout_weight="1"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:text="@string/shuffle" android:text="@string/shuffle"
android:textAppearance="@style/TextViewButton" android:textAppearance="@style/TextViewButton"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
app:backgroundTint="?attr/colorSurface" app:icon="@drawable/ic_shuffle" />
app:cornerRadius="8dp"
app:icon="@drawable/ic_shuffle"
app:layout_constraintBottom_toBottomOf="@+id/playAction"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/playAction"
app:layout_constraintTop_toTopOf="@+id/playAction" />
</androidx.constraintlayout.widget.ConstraintLayout> </LinearLayout>