Skip to content

Commit f2d68ad

Browse files
committed
Kotlin 2.0
1 parent 81408ba commit f2d68ad

10 files changed

+51
-40
lines changed

build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ plugins {
1313
alias(libs.plugins.android.application) apply false
1414
alias(libs.plugins.android.library) apply false
1515
alias(libs.plugins.androidx.navigation.safeargs) apply false
16+
alias(libs.plugins.kotlin.compose.compiler) apply false
1617
alias(libs.plugins.kotlin.android) apply false
18+
alias(libs.plugins.kotlin.kapt) apply false
1719
}
1820

1921
allprojects {

gradle/libs.versions.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
android_gradle_plugin = '8.3.2'
33
material_design = '1.12.0'
44
junit = '4.13.2'
5-
kotlin = '1.9.23'
5+
kotlin = '2.0.0'
66
kotlin_compiler_extension = '1.5.11'
77
androidx_compose_bom = '2024.05.00'
88
androidx_compose_uitest = '1.6.7'
99
androidx_core = '1.13.1'
10-
androidx_appcompat = '1.6.1'
10+
androidx_appcompat = '1.7.0'
1111
androidx_navigation = '2.7.7'
1212
androidx_preference = '1.2.1'
1313
androidx_test_junit = '1.1.5'
@@ -22,7 +22,9 @@ androidx_test_uiautomator = '2.3.0'
2222
android_application = { id = "com.android.application", version.ref = "android_gradle_plugin" }
2323
android_library = { id = "com.android.library", version.ref = "android_gradle_plugin" }
2424
androidx_navigation_safeargs = { id = "androidx.navigation.safeargs", version.ref = "androidx_navigation" }
25+
kotlin_compose_compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
2526
kotlin_android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
27+
kotlin_kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" }
2628

2729
[libraries]
2830
kotlin_stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin" }

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip

library/build.gradle

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
// Module :library
22
plugins {
3-
id 'com.android.library'
4-
id 'kotlin-android'
5-
id 'kotlin-kapt'
3+
alias(libs.plugins.android.library)
4+
alias(libs.plugins.kotlin.kapt)
5+
alias(libs.plugins.kotlin.android)
6+
alias(libs.plugins.kotlin.compose.compiler)
67
id 'maven-publish'
78
}
89

@@ -32,18 +33,21 @@ android {
3233
jvmTarget = 17
3334
}
3435

35-
composeOptions {
36-
// See the "Compose to Kotlin Compatibility Map" for compatible versions:
37-
// https://developer.android.com/jetpack/androidx/releases/compose-kotlin
38-
kotlinCompilerExtensionVersion libs.versions.kotlin.compiler.extension.get()
39-
}
40-
4136
buildFeatures {
4237
buildConfig true
4338
dataBinding true
4439
compose true
4540
}
4641

42+
composeOptions {
43+
}
44+
45+
composeCompiler {
46+
enableStrongSkippingMode = true
47+
reportsDestination = layout.buildDirectory.dir("compose_compiler")
48+
stabilityConfigurationFile = rootProject.layout.projectDirectory.file("stability_config.conf")
49+
}
50+
4751
buildTypes {
4852
debug {
4953
// it breaks the data-binding, eg. when running ./gradlew :library:publishToMavenLocal

library/src/main/java/io/syslogic/colorpicker/ColorPickerDialogFragment.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@
2828
* @author Martin Zeitler
2929
*/
3030
public class ColorPickerDialogFragment extends DialogFragment implements
31-
ViewTreeObserver.OnGlobalLayoutListener,
32-
OnColorChangedListener,
33-
View.OnClickListener {
31+
ViewTreeObserver.OnGlobalLayoutListener, OnColorChangedListener, View.OnClickListener {
3432

3533
private OnColorChangedListener listener = null;
3634
private ColorStateList mHexDefaultTextColor;

library/src/main/java/io/syslogic/colorpicker/ColorPickerPreference.java

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@
2929
* @author Martin Zeitler
3030
*/
3131
public class ColorPickerPreference extends Preference implements
32-
Preference.OnPreferenceChangeListener,
33-
Preference.OnPreferenceClickListener,
32+
Preference.OnPreferenceChangeListener, Preference.OnPreferenceClickListener,
3433
OnColorChangedListener {
3534

3635
/** {@link Log} Tag */
@@ -90,9 +89,7 @@ private void init(@NonNull Context context, @Nullable AttributeSet attrs) {
9089

9190
this.prefs = PreferenceManager.getDefaultSharedPreferences(context);
9291
this.mCurrentValue = this.prefs.getInt(this.getKey(), this.mCurrentValue);
93-
if(mDebug) {
94-
Log.d(LOG_TAG, String.format("%s: %s", this.getKey(), convertToARGB(this.mCurrentValue)));
95-
}
92+
if (mDebug) {Log.d(LOG_TAG, this.getKey() + ": " + convertToARGB(this.mCurrentValue));}
9693
this.setOnPreferenceClickListener(this);
9794
}
9895

@@ -105,11 +102,9 @@ private void init(@NonNull Context context, @Nullable AttributeSet attrs) {
105102
@NonNull
106103
@Override
107104
protected Object onGetDefaultValue(@NonNull TypedArray a, int index) {
108-
int colorInt;
109105
String mHexDefaultValue = a.getString(index);
110106
if (mHexDefaultValue != null && mHexDefaultValue.startsWith("#")) {
111-
colorInt = convertToColorInt(mHexDefaultValue);
112-
return colorInt;
107+
return convertToColorInt(mHexDefaultValue);
113108
} else {
114109
return a.getColor(index, this.mCurrentValue);
115110
}
@@ -160,7 +155,7 @@ public void onColorChanged(int color) {
160155
try {
161156
this.onPreferenceChange(this, color);
162157
} catch (NullPointerException e) {
163-
if(mDebug) {Log.e(LOG_TAG, String.format("%s", e.getMessage()));}
158+
if(mDebug) {Log.e(LOG_TAG, "NullPointerException: " + e.getMessage());}
164159
}
165160
}
166161

@@ -185,7 +180,7 @@ public void setHexValueEnabled(boolean value) {
185180
}
186181

187182
/**
188-
* String.format("#%1$02X", color)
183+
* String.format("#%1$02X", color)
189184
*
190185
* @param color the color value to convert.
191186
*/
@@ -226,7 +221,9 @@ static String convertToRGB(int color) {
226221
* @param argb the ARGB string to convert.
227222
*/
228223
static int convertToColorInt(@NonNull String argb) {
229-
if (! argb.startsWith("#")) {argb = String.format("#%s", argb);}
224+
if (! argb.startsWith("#")) {
225+
argb = String.format("#%s", argb);
226+
}
230227
return Color.parseColor(argb);
231228
}
232229

library/src/main/java/io/syslogic/colorpicker/ColorPickerView.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,15 +538,15 @@ private int chooseHeight(int mode, int size) {
538538
private int getPreferredWidth() {
539539
int width = getPreferredHeight();
540540
if (mShowAlphaPanel) {
541-
width -= (PANEL_SPACING + ALPHA_PANEL_HEIGHT);
541+
width -= (int) (PANEL_SPACING + ALPHA_PANEL_HEIGHT);
542542
}
543543
return (int) (width + HUE_PANEL_WIDTH + PANEL_SPACING);
544544
}
545545

546546
private int getPreferredHeight() {
547547
int height = (int) (200 * mDensity);
548548
if (mShowAlphaPanel) {
549-
height += PANEL_SPACING + ALPHA_PANEL_HEIGHT;
549+
height += (int) (PANEL_SPACING + ALPHA_PANEL_HEIGHT);
550550
}
551551
return height;
552552
}

lint.xml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
<issue id="InvalidPackage">
44
<ignore regexp="kotlinx.coroutines.debug.AgentPremain"/>
55
</issue>
6-
<issue id="GradleDependency">
7-
<ignore regexp="is available: .*alpha|beta"/>
6+
<issue id="AndroidGradlePluginVersion">
7+
<ignore path="gradle/libs.versions.toml"/>
8+
</issue>
9+
<issue id="StringFormatTrivial">
10+
<ignore regexp="io.syslogic.colorpicker.ColorPickerPreference"/>
811
</issue>
912
</lint>

mobile/build.gradle

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
// Module :mobile
22
plugins {
3-
id 'com.android.application'
4-
id 'androidx.navigation.safeargs'
5-
id 'kotlin-android'
6-
id 'kotlin-kapt'
3+
alias(libs.plugins.android.application)
4+
alias(libs.plugins.androidx.navigation.safeargs)
5+
alias(libs.plugins.kotlin.kapt)
6+
alias(libs.plugins.kotlin.android)
7+
alias(libs.plugins.kotlin.compose.compiler)
78
}
89

910
base {
@@ -33,18 +34,21 @@ android {
3334
jvmTarget = 17
3435
}
3536

36-
composeOptions {
37-
// See the "Compose to Kotlin Compatibility Map" for compatible versions:
38-
// https://developer.android.com/jetpack/androidx/releases/compose-kotlin
39-
kotlinCompilerExtensionVersion libs.versions.kotlin.compiler.extension.get()
40-
}
41-
4237
buildFeatures {
4338
buildConfig true
4439
dataBinding true
4540
compose true
4641
}
4742

43+
composeOptions {
44+
}
45+
46+
composeCompiler {
47+
enableStrongSkippingMode = true
48+
reportsDestination = layout.buildDirectory.dir("compose_compiler")
49+
stabilityConfigurationFile = rootProject.layout.projectDirectory.file("stability_config.conf")
50+
}
51+
4852
buildTypes {
4953
debug {
5054
minifyEnabled false

stability_config.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
io.syslogic.colorpicker.compose.*

0 commit comments

Comments
 (0)