-
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update all checkbox preferences to SUW switches
Signed-off-by: Ricky Cheung <[email protected]>
- Loading branch information
Showing
5 changed files
with
37 additions
and
15 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
app-common/src/main/java/eu/darken/capod/common/preferences/MaterialSwitchPreference.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package eu.darken.capod.common.preferences | ||
|
||
import android.content.Context | ||
import android.util.AttributeSet | ||
import androidx.preference.SwitchPreferenceCompat | ||
|
||
class MaterialSwitchPreference(context: Context, attrs: AttributeSet?) : | ||
SwitchPreferenceCompat(context, attrs) { | ||
|
||
init { | ||
// Use material switch | ||
widgetLayoutResource = eu.darken.capod.common.R.layout.preference_material_switch | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
app-common/src/main/res/layout/preference_material_switch.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<com.google.android.material.materialswitch.MaterialSwitch xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:id="@+id/switchWidget" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:background="@null" | ||
android:clickable="false" | ||
android:focusable="false" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters