diff --git a/build.gradle b/build.gradle
index 6be9f9b..5264eef 100644
--- a/build.gradle
+++ b/build.gradle
@@ -13,7 +13,9 @@ plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.androidx.navigation.safeargs) apply false
+ alias(libs.plugins.kotlin.compose.compiler) apply false
alias(libs.plugins.kotlin.android) apply false
+ alias(libs.plugins.kotlin.kapt) apply false
}
allprojects {
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 03b83e4..32523d2 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -2,12 +2,12 @@
android_gradle_plugin = '8.3.2'
material_design = '1.12.0'
junit = '4.13.2'
-kotlin = '1.9.23'
+kotlin = '2.0.0'
kotlin_compiler_extension = '1.5.11'
androidx_compose_bom = '2024.05.00'
androidx_compose_uitest = '1.6.7'
androidx_core = '1.13.1'
-androidx_appcompat = '1.6.1'
+androidx_appcompat = '1.7.0'
androidx_navigation = '2.7.7'
androidx_preference = '1.2.1'
androidx_test_junit = '1.1.5'
@@ -22,7 +22,9 @@ androidx_test_uiautomator = '2.3.0'
android_application = { id = "com.android.application", version.ref = "android_gradle_plugin" }
android_library = { id = "com.android.library", version.ref = "android_gradle_plugin" }
androidx_navigation_safeargs = { id = "androidx.navigation.safeargs", version.ref = "androidx_navigation" }
+kotlin_compose_compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
kotlin_android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
+kotlin_kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" }
[libraries]
kotlin_stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin" }
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 5675c56..af33044 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
diff --git a/library/build.gradle b/library/build.gradle
index 80bf8da..71767d6 100644
--- a/library/build.gradle
+++ b/library/build.gradle
@@ -1,8 +1,9 @@
// Module :library
plugins {
- id 'com.android.library'
- id 'kotlin-android'
- id 'kotlin-kapt'
+ alias(libs.plugins.android.library)
+ alias(libs.plugins.kotlin.kapt)
+ alias(libs.plugins.kotlin.android)
+ alias(libs.plugins.kotlin.compose.compiler)
id 'maven-publish'
}
@@ -32,18 +33,21 @@ android {
jvmTarget = 17
}
- composeOptions {
- // See the "Compose to Kotlin Compatibility Map" for compatible versions:
- // https://developer.android.com/jetpack/androidx/releases/compose-kotlin
- kotlinCompilerExtensionVersion libs.versions.kotlin.compiler.extension.get()
- }
-
buildFeatures {
buildConfig true
dataBinding true
compose true
}
+ composeOptions {
+ }
+
+ composeCompiler {
+ enableStrongSkippingMode = true
+ reportsDestination = layout.buildDirectory.dir("compose_compiler")
+ stabilityConfigurationFile = rootProject.layout.projectDirectory.file("stability_config.conf")
+ }
+
buildTypes {
debug {
// it breaks the data-binding, eg. when running ./gradlew :library:publishToMavenLocal
diff --git a/library/src/main/java/io/syslogic/colorpicker/ColorPickerDialogFragment.java b/library/src/main/java/io/syslogic/colorpicker/ColorPickerDialogFragment.java
index 0a16276..2750acb 100644
--- a/library/src/main/java/io/syslogic/colorpicker/ColorPickerDialogFragment.java
+++ b/library/src/main/java/io/syslogic/colorpicker/ColorPickerDialogFragment.java
@@ -28,9 +28,7 @@
* @author Martin Zeitler
*/
public class ColorPickerDialogFragment extends DialogFragment implements
- ViewTreeObserver.OnGlobalLayoutListener,
- OnColorChangedListener,
- View.OnClickListener {
+ ViewTreeObserver.OnGlobalLayoutListener, OnColorChangedListener, View.OnClickListener {
private OnColorChangedListener listener = null;
private ColorStateList mHexDefaultTextColor;
diff --git a/library/src/main/java/io/syslogic/colorpicker/ColorPickerPreference.java b/library/src/main/java/io/syslogic/colorpicker/ColorPickerPreference.java
index bd7f1ca..6814b0e 100644
--- a/library/src/main/java/io/syslogic/colorpicker/ColorPickerPreference.java
+++ b/library/src/main/java/io/syslogic/colorpicker/ColorPickerPreference.java
@@ -29,8 +29,7 @@
* @author Martin Zeitler
*/
public class ColorPickerPreference extends Preference implements
- Preference.OnPreferenceChangeListener,
- Preference.OnPreferenceClickListener,
+ Preference.OnPreferenceChangeListener, Preference.OnPreferenceClickListener,
OnColorChangedListener {
/** {@link Log} Tag */
@@ -90,9 +89,7 @@ private void init(@NonNull Context context, @Nullable AttributeSet attrs) {
this.prefs = PreferenceManager.getDefaultSharedPreferences(context);
this.mCurrentValue = this.prefs.getInt(this.getKey(), this.mCurrentValue);
- if(mDebug) {
- Log.d(LOG_TAG, String.format("%s: %s", this.getKey(), convertToARGB(this.mCurrentValue)));
- }
+ if (mDebug) {Log.d(LOG_TAG, this.getKey() + ": " + convertToARGB(this.mCurrentValue));}
this.setOnPreferenceClickListener(this);
}
@@ -105,11 +102,9 @@ private void init(@NonNull Context context, @Nullable AttributeSet attrs) {
@NonNull
@Override
protected Object onGetDefaultValue(@NonNull TypedArray a, int index) {
- int colorInt;
String mHexDefaultValue = a.getString(index);
if (mHexDefaultValue != null && mHexDefaultValue.startsWith("#")) {
- colorInt = convertToColorInt(mHexDefaultValue);
- return colorInt;
+ return convertToColorInt(mHexDefaultValue);
} else {
return a.getColor(index, this.mCurrentValue);
}
@@ -160,7 +155,7 @@ public void onColorChanged(int color) {
try {
this.onPreferenceChange(this, color);
} catch (NullPointerException e) {
- if(mDebug) {Log.e(LOG_TAG, String.format("%s", e.getMessage()));}
+ if(mDebug) {Log.e(LOG_TAG, "NullPointerException: " + e.getMessage());}
}
}
@@ -185,7 +180,7 @@ public void setHexValueEnabled(boolean value) {
}
/**
- * String.format("#%1$02X", color)
+ * String.format("#%1$02X", color)
*
* @param color the color value to convert.
*/
@@ -226,7 +221,9 @@ static String convertToRGB(int color) {
* @param argb the ARGB string to convert.
*/
static int convertToColorInt(@NonNull String argb) {
- if (! argb.startsWith("#")) {argb = String.format("#%s", argb);}
+ if (! argb.startsWith("#")) {
+ argb = String.format("#%s", argb);
+ }
return Color.parseColor(argb);
}
diff --git a/library/src/main/java/io/syslogic/colorpicker/ColorPickerView.java b/library/src/main/java/io/syslogic/colorpicker/ColorPickerView.java
index 9350915..f58d13b 100644
--- a/library/src/main/java/io/syslogic/colorpicker/ColorPickerView.java
+++ b/library/src/main/java/io/syslogic/colorpicker/ColorPickerView.java
@@ -538,7 +538,7 @@ private int chooseHeight(int mode, int size) {
private int getPreferredWidth() {
int width = getPreferredHeight();
if (mShowAlphaPanel) {
- width -= (PANEL_SPACING + ALPHA_PANEL_HEIGHT);
+ width -= (int) (PANEL_SPACING + ALPHA_PANEL_HEIGHT);
}
return (int) (width + HUE_PANEL_WIDTH + PANEL_SPACING);
}
@@ -546,7 +546,7 @@ private int getPreferredWidth() {
private int getPreferredHeight() {
int height = (int) (200 * mDensity);
if (mShowAlphaPanel) {
- height += PANEL_SPACING + ALPHA_PANEL_HEIGHT;
+ height += (int) (PANEL_SPACING + ALPHA_PANEL_HEIGHT);
}
return height;
}
diff --git a/lint.xml b/lint.xml
index dd82a35..a9d2d81 100644
--- a/lint.xml
+++ b/lint.xml
@@ -3,7 +3,10 @@
-
-
+
+
+
+
+
diff --git a/mobile/build.gradle b/mobile/build.gradle
index ecaf20a..6225b00 100644
--- a/mobile/build.gradle
+++ b/mobile/build.gradle
@@ -1,9 +1,10 @@
// Module :mobile
plugins {
- id 'com.android.application'
- id 'androidx.navigation.safeargs'
- id 'kotlin-android'
- id 'kotlin-kapt'
+ alias(libs.plugins.android.application)
+ alias(libs.plugins.androidx.navigation.safeargs)
+ alias(libs.plugins.kotlin.kapt)
+ alias(libs.plugins.kotlin.android)
+ alias(libs.plugins.kotlin.compose.compiler)
}
base {
@@ -33,18 +34,21 @@ android {
jvmTarget = 17
}
- composeOptions {
- // See the "Compose to Kotlin Compatibility Map" for compatible versions:
- // https://developer.android.com/jetpack/androidx/releases/compose-kotlin
- kotlinCompilerExtensionVersion libs.versions.kotlin.compiler.extension.get()
- }
-
buildFeatures {
buildConfig true
dataBinding true
compose true
}
+ composeOptions {
+ }
+
+ composeCompiler {
+ enableStrongSkippingMode = true
+ reportsDestination = layout.buildDirectory.dir("compose_compiler")
+ stabilityConfigurationFile = rootProject.layout.projectDirectory.file("stability_config.conf")
+ }
+
buildTypes {
debug {
minifyEnabled false
diff --git a/stability_config.conf b/stability_config.conf
new file mode 100644
index 0000000..3e12c3d
--- /dev/null
+++ b/stability_config.conf
@@ -0,0 +1 @@
+io.syslogic.colorpicker.compose.*