Skip to content

Commit 0742f44

Browse files
committed
feat: use material switch with icon in audio player for autoplay
1 parent de6b2e0 commit 0742f44

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<selector xmlns:android="http://schemas.android.com/apk/res/android">
3+
<item android:drawable="@drawable/ic_play" android:state_checked="true" />
4+
5+
<item android:drawable="@drawable/ic_pause" android:state_checked="false" />
6+
</selector>

app/src/main/res/layout/fragment_audio_player.xml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,13 @@
4444
android:layout_height="0dp"
4545
android:layout_weight="1" />
4646

47-
<androidx.appcompat.widget.SwitchCompat
47+
<com.google.android.material.materialswitch.MaterialSwitch
48+
style="@style/Widget.Material3.CompoundButton.MaterialSwitch"
4849
android:id="@+id/autoPlay"
4950
android:layout_width="wrap_content"
5051
android:layout_height="wrap_content"
5152
android:layout_marginEnd="5dp"
52-
android:scaleX="0.8"
53-
android:scaleY="0.8"
54-
android:thumb="@drawable/player_switch_thumb"
55-
app:thumbTint="?colorPrimary"
56-
app:track="@drawable/player_switch_track"
57-
app:trackTint="?colorControlNormal" />
53+
app:thumbIcon="@drawable/material_player_switch_thumb" />
5854

5955
</LinearLayout>
6056

0 commit comments

Comments
 (0)