From aa8bad2aef9262721c243475306c60541cfcc1fa Mon Sep 17 00:00:00 2001 From: Jamal Mulla Date: Sun, 22 May 2022 16:40:04 +0100 Subject: [PATCH] Added option for changing ListPref button color --- ComposePrefs/build.gradle | 4 ++-- .../main/java/com/jamal/composeprefs/ui/prefs/ListPref.kt | 6 ++++-- README.md | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ComposePrefs/build.gradle b/ComposePrefs/build.gradle index dea255a..078b8dd 100644 --- a/ComposePrefs/build.gradle +++ b/ComposePrefs/build.gradle @@ -11,7 +11,7 @@ android { minSdk 21 targetSdk 31 versionCode 2 - versionName "1.0.3" + versionName "1.0.4" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles "consumer-rules.pro" @@ -54,7 +54,7 @@ afterEvaluate { groupId = 'com.github.jamalmulla' artifactId = 'ComposePrefs' - version = '1.0.3' + version = '1.0.4' } } } diff --git a/ComposePrefs/src/main/java/com/jamal/composeprefs/ui/prefs/ListPref.kt b/ComposePrefs/src/main/java/com/jamal/composeprefs/ui/prefs/ListPref.kt index e47a943..a9ac2bb 100644 --- a/ComposePrefs/src/main/java/com/jamal/composeprefs/ui/prefs/ListPref.kt +++ b/ComposePrefs/src/main/java/com/jamal/composeprefs/ui/prefs/ListPref.kt @@ -34,8 +34,9 @@ import java.lang.Exception * @param useSelectedAsSummary If true, uses the current selected item as the summary * @param dialogBackgroundColor Background color of the Dialog * @param contentColor Preferred content color passed to dialog's children - * @param textColor Text colour of the [title] and [summary] + * @param textColor Text colour of the [title], [summary] and [entries] * @param selectionColor Colour of the radiobutton of the selected item + * @param buttonColor Colour of the cancel button * @param enabled If false, this Pref cannot be clicked and the Dialog cannot be shown. * @param entries Map of keys to values for entries that should be shown in the Dialog. */ @@ -54,6 +55,7 @@ fun ListPref( contentColor: Color = contentColorFor(dialogBackgroundColor), textColor: Color = MaterialTheme.colors.onBackground, selectionColor: Color = MaterialTheme.colors.primary, + buttonColor: Color = MaterialTheme.colors.primary, enabled: Boolean = true, entries: Map = mapOf(), //TODO: Change to List? ) { @@ -137,7 +139,7 @@ fun ListPref( TextButton( onClick = { showDialog = false }, ) { - Text("Cancel", style = MaterialTheme.typography.body1, color = textColor) + Text("Cancel", style = MaterialTheme.typography.body1, color = buttonColor) } }, diff --git a/README.md b/README.md index 88cb90d..cfa115f 100644 --- a/README.md +++ b/README.md @@ -219,7 +219,7 @@ maven { url "https://jitpack.io" } and in your module `build.gradle` file add the dependencies ``` groovy -implementation "com.github.JamalMulla:ComposePrefs:" // Current is 1.0.3 +implementation "com.github.JamalMulla:ComposePrefs:" // Current is 1.0.4 implementation "androidx.datastore:datastore-preferences:1.0.0" ```