diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 2649f96d..54e23054 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,14 +1,14 @@ version: 2 updates: -- package-ecosystem: gradle - directory: "/" - schedule: - interval: daily - time: "04:00" - timezone: Europe/Berlin - open-pull-requests-limit: 15 - target-branch: dev - reviewers: - - marcauberer - assignees: - - marcauberer + - package-ecosystem: gradle + directory: "/" + schedule: + interval: daily + time: "04:00" + timezone: Europe/Berlin + open-pull-requests-limit: 15 + target-branch: dev + reviewers: + - chillibits/android-core-development + assignees: + - marcauberer diff --git a/README.md b/README.md index bcb92c16..d28dc1c8 100644 --- a/README.md +++ b/README.md @@ -44,4 +44,4 @@ Thanks to following people: Thanks to all contributors and translators! -© ChilliBits 2017-2022 (Designed and developed by Marc Auberer) +© ChilliBits 2017-2023 (Designed and developed by Marc Auberer) diff --git a/app/build.gradle b/app/build.gradle index 3fc3a383..3b4d1768 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,5 +1,5 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ plugins { @@ -17,8 +17,8 @@ android { applicationId "com.mrgames13.jimdo.colorconverter" minSdkVersion 21 targetSdkVersion 33 - versionCode 2800 - versionName "2.8.0" + versionCode 2801 + versionName "2.8.1" vectorDrawables.useSupportLibrary = true testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } @@ -49,16 +49,17 @@ android { dependencies { // base dependencies - implementation 'androidx.appcompat:appcompat:1.5.1' + implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'com.google.android.instantapps:instantapps:1.1.0' implementation 'com.google.android.play:core:1.10.3' implementation 'androidx.palette:palette-ktx:1.0.0' - implementation 'androidx.exifinterface:exifinterface:1.3.5' - implementation 'com.google.android.material:material:1.7.0' - implementation 'androidx.fragment:fragment-ktx:1.5.5' - implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1' + implementation 'androidx.exifinterface:exifinterface:1.3.6' + implementation 'com.google.android.material:material:1.8.0' + implementation 'androidx.fragment:fragment-ktx:1.5.6' + implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1' + implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.6.1" implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' // External dependencies @@ -85,8 +86,8 @@ dependencies { // dependencies for testing testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.4' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0' + androidTestImplementation 'androidx.test.ext:junit:1.1.5' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' } // Task for downloading all translation files @@ -94,8 +95,8 @@ task downloadTranslations { group 'pre-build tasks' description 'Downloads all translation files when building the app.' - ext.apiKey = 'IEKWn_DI-otivDlUWAN-NvNIT3bBWO_h' - ext.apiKeyColors = 'ReBhdq025DTUFKoKIvmvLLyY6hznXyCg' + ext.apiKey = 'cUnfQzJMGOihCQd0fvd4-c4FgYefuTB4' + ext.apiKeyColors = 'yHOCAB47RYyEPn9Ac_HbFp0aYMHszSwZ' // English doLast { diff --git a/app/src/androidTest/java/com/chillibits/colorconverter/ExampleInstrumentedTest.kt b/app/src/androidTest/java/com/chillibits/colorconverter/ExampleInstrumentedTest.kt index 14535196..50fc01ff 100644 --- a/app/src/androidTest/java/com/chillibits/colorconverter/ExampleInstrumentedTest.kt +++ b/app/src/androidTest/java/com/chillibits/colorconverter/ExampleInstrumentedTest.kt @@ -1,5 +1,5 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ package com.chillibits.colorconverter diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index e22580a5..401c5cd7 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,6 +1,6 @@ { +) : Comparable { var alpha = color.alpha var red = color.red var green = color.green var blue = color.blue - constructor(id: Int, name: String, alpha: Int, red: Int, green: Int, blue: Int, creationTimestamp: Long): + constructor( + id: Int, + name: String, + alpha: Int, + red: Int, + green: Int, + blue: Int, + creationTimestamp: Long + ) : this(id, name, android.graphics.Color.argb(alpha, red, green, blue), creationTimestamp) - override fun compareTo(@NotNull other: Color) = other.creationTimestamp.compareTo(creationTimestamp) + override fun compareTo(other: Color) = other.creationTimestamp.compareTo(creationTimestamp) } \ No newline at end of file diff --git a/app/src/main/java/com/chillibits/colorconverter/model/ColorName.kt b/app/src/main/java/com/chillibits/colorconverter/model/ColorName.kt index 9edd48ee..cb53ad76 100644 --- a/app/src/main/java/com/chillibits/colorconverter/model/ColorName.kt +++ b/app/src/main/java/com/chillibits/colorconverter/model/ColorName.kt @@ -1,5 +1,5 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ package com.chillibits.colorconverter.model diff --git a/app/src/main/java/com/chillibits/colorconverter/repository/ColorRepository.kt b/app/src/main/java/com/chillibits/colorconverter/repository/ColorRepository.kt index 70fe7528..3e2d5ee1 100644 --- a/app/src/main/java/com/chillibits/colorconverter/repository/ColorRepository.kt +++ b/app/src/main/java/com/chillibits/colorconverter/repository/ColorRepository.kt @@ -1,5 +1,5 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ package com.chillibits.colorconverter.repository diff --git a/app/src/main/java/com/chillibits/colorconverter/shared/Constants.kt b/app/src/main/java/com/chillibits/colorconverter/shared/Constants.kt index d58ab3a3..c8b43ae6 100644 --- a/app/src/main/java/com/chillibits/colorconverter/shared/Constants.kt +++ b/app/src/main/java/com/chillibits/colorconverter/shared/Constants.kt @@ -1,5 +1,5 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ package com.chillibits.colorconverter.shared @@ -17,7 +17,6 @@ object Constants { const val EXTRA_CHOOSE_COLOR = "ChooseColor" const val EXTRA_IMAGE_URI = "ImageUri" const val EXTRA_COLOR = "Color" - const val EXTRA_SELECTED_COLOR = "SelectedColor" // Shared Preferences keys const val ARGB_REMEMBER = "ArgbRemember" @@ -32,5 +31,4 @@ object Constants { const val COLOR_ANIMATION_DURATION = 500L const val NAME_SELECTED_COLOR = "Selection" const val HSV_FORMAT_STRING = "%.02f" - const val SHARED_PREFERENCES_NAME = "com.mrgames13.jimdo.colorconverter_preferences" } \ No newline at end of file diff --git a/app/src/main/java/com/chillibits/colorconverter/shared/Extensions.kt b/app/src/main/java/com/chillibits/colorconverter/shared/Extensions.kt index 63223fc5..c295fb48 100644 --- a/app/src/main/java/com/chillibits/colorconverter/shared/Extensions.kt +++ b/app/src/main/java/com/chillibits/colorconverter/shared/Extensions.kt @@ -1,5 +1,5 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ package com.chillibits.colorconverter.shared diff --git a/app/src/main/java/com/chillibits/colorconverter/shared/HiltInstanceProviders.kt b/app/src/main/java/com/chillibits/colorconverter/shared/HiltInstanceProviders.kt index b264ac75..70f8bf9e 100644 --- a/app/src/main/java/com/chillibits/colorconverter/shared/HiltInstanceProviders.kt +++ b/app/src/main/java/com/chillibits/colorconverter/shared/HiltInstanceProviders.kt @@ -1,5 +1,5 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ package com.chillibits.colorconverter.shared diff --git a/app/src/main/java/com/chillibits/colorconverter/shared/SimpleOnSeekBarChangeListener.kt b/app/src/main/java/com/chillibits/colorconverter/shared/SimpleOnSeekBarChangeListener.kt index e8b983f3..da561c58 100644 --- a/app/src/main/java/com/chillibits/colorconverter/shared/SimpleOnSeekBarChangeListener.kt +++ b/app/src/main/java/com/chillibits/colorconverter/shared/SimpleOnSeekBarChangeListener.kt @@ -1,5 +1,5 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ package com.chillibits.colorconverter.shared diff --git a/app/src/main/java/com/chillibits/colorconverter/storage/AppDatabase.kt b/app/src/main/java/com/chillibits/colorconverter/storage/AppDatabase.kt index 81208051..44c0068f 100644 --- a/app/src/main/java/com/chillibits/colorconverter/storage/AppDatabase.kt +++ b/app/src/main/java/com/chillibits/colorconverter/storage/AppDatabase.kt @@ -1,5 +1,5 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ package com.chillibits.colorconverter.storage @@ -11,6 +11,6 @@ import com.chillibits.colorconverter.storage.dbo.ColorDbo // Increase version whenever the structure of the local db changes @Database(entities = [ColorDbo::class], exportSchema = false, version = 3) -abstract class AppDatabase: RoomDatabase() { +abstract class AppDatabase : RoomDatabase() { abstract fun colorDao(): ColorDao } \ No newline at end of file diff --git a/app/src/main/java/com/chillibits/colorconverter/storage/DatabaseMigrations.kt b/app/src/main/java/com/chillibits/colorconverter/storage/DatabaseMigrations.kt index 28f51799..20a5941d 100644 --- a/app/src/main/java/com/chillibits/colorconverter/storage/DatabaseMigrations.kt +++ b/app/src/main/java/com/chillibits/colorconverter/storage/DatabaseMigrations.kt @@ -1,5 +1,5 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ package com.chillibits.colorconverter.storage @@ -8,7 +8,7 @@ import androidx.room.migration.Migration import androidx.sqlite.db.SupportSQLiteDatabase // Migration from SQLite API to Room -val MIGRATION_2_3 = object: Migration(2, 3) { +val MIGRATION_2_3 = object : Migration(2, 3) { override fun migrate(database: SupportSQLiteDatabase) { database.execSQL("ALTER TABLE Colors RENAME TO tmp;") database.execSQL("CREATE TABLE colors (id INTEGER PRIMARY KEY NOT NULL, name TEXT NOT NULL, red INTEGER NOT NULL, green INTEGER NOT NULL, blue INTEGER NOT NULL, creation_timestamp INTEGER NOT NULL, alpha INTEGER NOT NULL);") diff --git a/app/src/main/java/com/chillibits/colorconverter/storage/dao/ColorDao.kt b/app/src/main/java/com/chillibits/colorconverter/storage/dao/ColorDao.kt index 62e970b9..4584227a 100644 --- a/app/src/main/java/com/chillibits/colorconverter/storage/dao/ColorDao.kt +++ b/app/src/main/java/com/chillibits/colorconverter/storage/dao/ColorDao.kt @@ -1,5 +1,5 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ package com.chillibits.colorconverter.storage.dao diff --git a/app/src/main/java/com/chillibits/colorconverter/storage/dbo/ColorDbo.kt b/app/src/main/java/com/chillibits/colorconverter/storage/dbo/ColorDbo.kt index 8d1e93f8..d184a3c7 100644 --- a/app/src/main/java/com/chillibits/colorconverter/storage/dbo/ColorDbo.kt +++ b/app/src/main/java/com/chillibits/colorconverter/storage/dbo/ColorDbo.kt @@ -1,5 +1,5 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ package com.chillibits.colorconverter.storage.dbo @@ -10,12 +10,12 @@ import androidx.room.PrimaryKey @Entity(tableName = "colors") data class ColorDbo( - @PrimaryKey(autoGenerate = true) - @ColumnInfo(name = "id") val id: Int, - @ColumnInfo(name = "name") var name: String, - @ColumnInfo(name = "alpha") val alpha: Int, - @ColumnInfo(name = "red") val red: Int, - @ColumnInfo(name = "green") val green: Int, - @ColumnInfo(name = "blue") val blue: Int, - @ColumnInfo(name = "creation_timestamp") val creationTimestamp: Long + @PrimaryKey(autoGenerate = true) + @ColumnInfo(name = "id") val id: Int, + @ColumnInfo(name = "name") var name: String, + @ColumnInfo(name = "alpha") val alpha: Int, + @ColumnInfo(name = "red") val red: Int, + @ColumnInfo(name = "green") val green: Int, + @ColumnInfo(name = "blue") val blue: Int, + @ColumnInfo(name = "creation_timestamp") val creationTimestamp: Long ) diff --git a/app/src/main/java/com/chillibits/colorconverter/tools/ClipboardTools.kt b/app/src/main/java/com/chillibits/colorconverter/tools/ClipboardTools.kt index d56d5c76..6c665e17 100644 --- a/app/src/main/java/com/chillibits/colorconverter/tools/ClipboardTools.kt +++ b/app/src/main/java/com/chillibits/colorconverter/tools/ClipboardTools.kt @@ -1,5 +1,5 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ package com.chillibits.colorconverter.tools @@ -21,7 +21,8 @@ class ClipboardTools( private val ct: ColorTools ) { - fun copyNameToClipboard(name: String) = context.copyTextToClipboard(context.getString(R.string.name), name) + fun copyNameToClipboard(name: String) = + context.copyTextToClipboard(context.getString(R.string.name), name) fun copyArgbToClipboard(color: Color) = context.run { if (getPrefBooleanValue(Constants.ENABLE_ALPHA, true)) { @@ -30,22 +31,25 @@ class ClipboardTools( showArgbExportDialog(st, color.alpha, color.red, color.green, color.blue) } else if (getPrefBooleanValue(Constants.ARGB_REMEMBER_SELECTION, false)) { copyTextToClipboard( - getString(R.string.argb_code), String.format( + getString(R.string.argb_code), String.format( getString(R.string.argb_clipboard), - color.alpha, color.red, color.green, color.blue) + color.alpha, color.red, color.green, color.blue + ) ) } else { copyTextToClipboard( - getString(R.string.argb_code), String.format( + getString(R.string.argb_code), String.format( getString(R.string.rgba_clipboard_css), - color.red, color.green, color.blue, (color.alpha / 255.0).round(3)) + color.red, color.green, color.blue, (color.alpha / 255.0).round(3) + ) ) } } else { copyTextToClipboard( - getString(R.string.rgb_code), String.format( + getString(R.string.rgb_code), String.format( getString(R.string.rgb_clipboard), - color.red, color.green, color.blue) + color.red, color.green, color.blue + ) ) } } @@ -63,10 +67,12 @@ class ClipboardTools( fun copyHsvToClipboard(color: Color) = context.run { val hsv = FloatArray(3) android.graphics.Color.RGBToHSV(color.red, color.green, color.blue, hsv) - val hsvString = String.format(getString(R.string.hsv_), + val hsvString = String.format( + getString(R.string.hsv_), String.format(Constants.HSV_FORMAT_STRING, hsv[0]), String.format(Constants.HSV_FORMAT_STRING, hsv[1]), - String.format(Constants.HSV_FORMAT_STRING, hsv[2])) + String.format(Constants.HSV_FORMAT_STRING, hsv[2]) + ) copyTextToClipboard(getString(R.string.hsv_clipboard), hsvString) } diff --git a/app/src/main/java/com/chillibits/colorconverter/tools/ColorNameTools.kt b/app/src/main/java/com/chillibits/colorconverter/tools/ColorNameTools.kt index 5d2d6dfa..efca4ded 100644 --- a/app/src/main/java/com/chillibits/colorconverter/tools/ColorNameTools.kt +++ b/app/src/main/java/com/chillibits/colorconverter/tools/ColorNameTools.kt @@ -1,5 +1,5 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ package com.chillibits.colorconverter.tools @@ -169,5 +169,6 @@ class ColorNameTools(private val c: Context) { return closestMatch?.name ?: "No color" } - fun getColorNameFromColor(color: Color) = getColorNameFromRgb(color.red, color.green, color.blue) + fun getColorNameFromColor(color: Color) = + getColorNameFromRgb(color.red, color.green, color.blue) } \ No newline at end of file diff --git a/app/src/main/java/com/chillibits/colorconverter/tools/ColorTools.kt b/app/src/main/java/com/chillibits/colorconverter/tools/ColorTools.kt index ca1a96be..ac629ed7 100644 --- a/app/src/main/java/com/chillibits/colorconverter/tools/ColorTools.kt +++ b/app/src/main/java/com/chillibits/colorconverter/tools/ColorTools.kt @@ -1,5 +1,5 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ package com.chillibits.colorconverter.tools @@ -18,25 +18,25 @@ import kotlin.math.max import kotlin.math.roundToInt class ColorTools(private var context: Context) { - fun getVibrantColor(image: Bitmap) - = Palette.from(image).generate().getVibrantColor(ContextCompat.getColor(context, R.color.gray)) + fun getVibrantColor(image: Bitmap) = Palette.from(image).generate() + .getVibrantColor(ContextCompat.getColor(context, R.color.gray)) - fun getLightVibrantColor(image: Bitmap) - = Palette.from(image).generate().getLightVibrantColor(ContextCompat.getColor(context, R.color.gray)) + fun getLightVibrantColor(image: Bitmap) = Palette.from(image).generate() + .getLightVibrantColor(ContextCompat.getColor(context, R.color.gray)) - fun getDarkVibrantColor(image: Bitmap) - = Palette.from(image).generate().getDarkVibrantColor(ContextCompat.getColor(context, R.color.gray)) + fun getDarkVibrantColor(image: Bitmap) = Palette.from(image).generate() + .getDarkVibrantColor(ContextCompat.getColor(context, R.color.gray)) - fun getMutedColor(image: Bitmap) - = Palette.from(image).generate().getMutedColor(ContextCompat.getColor(context, R.color.gray)) + fun getMutedColor(image: Bitmap) = + Palette.from(image).generate().getMutedColor(ContextCompat.getColor(context, R.color.gray)) - fun getLightMutedColor(image: Bitmap) - = Palette.from(image).generate().getLightMutedColor(ContextCompat.getColor(context, R.color.gray)) + fun getLightMutedColor(image: Bitmap) = Palette.from(image).generate() + .getLightMutedColor(ContextCompat.getColor(context, R.color.gray)) - fun getDarkMutedColor(image: Bitmap) - = Palette.from(image).generate().getDarkMutedColor(ContextCompat.getColor(context, R.color.gray)) + fun getDarkMutedColor(image: Bitmap) = Palette.from(image).generate() + .getDarkMutedColor(ContextCompat.getColor(context, R.color.gray)) - fun getTextColor(activity: Activity, color: Int) = if(Color.alpha(color) > 127) { + fun getTextColor(activity: Activity, color: Int) = if (Color.alpha(color) > 127) { val sum = Color.red(color) + Color.green(color) + Color.blue(color) if (sum > 384) Color.BLACK else Color.WHITE } else { @@ -48,7 +48,7 @@ class ColorTools(private var context: Context) { } fun getCmykFromRgb(red: Int, green: Int, blue: Int): Array { - if(red == 0 && green == 0 && blue == 0) return arrayOf(0, 0, 0, 100) + if (red == 0 && green == 0 && blue == 0) return arrayOf(0, 0, 0, 100) val redPercentage = red / 255.0 * 100.0 val greenPercentage = green / 255.0 * 100.0 val bluePercentage = blue / 255.0 * 100.0 @@ -64,6 +64,14 @@ class ColorTools(private var context: Context) { val red = random.nextInt(256) val green = random.nextInt(256) val blue = random.nextInt(256) - return com.chillibits.colorconverter.model.Color(0, Constants.NAME_SELECTED_COLOR, 255, red, green, blue, -1) + return com.chillibits.colorconverter.model.Color( + 0, + Constants.NAME_SELECTED_COLOR, + 255, + red, + green, + blue, + -1 + ) } } \ No newline at end of file diff --git a/app/src/main/java/com/chillibits/colorconverter/tools/StorageTools.kt b/app/src/main/java/com/chillibits/colorconverter/tools/StorageTools.kt index 89cadc58..407136eb 100644 --- a/app/src/main/java/com/chillibits/colorconverter/tools/StorageTools.kt +++ b/app/src/main/java/com/chillibits/colorconverter/tools/StorageTools.kt @@ -1,5 +1,5 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ package com.chillibits.colorconverter.tools @@ -10,6 +10,8 @@ import javax.inject.Inject class StorageTools @Inject constructor(val context: Context) { - fun putBoolean(name: String, value: Boolean) = context.getPrefs().edit().putBoolean(name, value).apply() + fun putBoolean(name: String, value: Boolean) = + context.getPrefs().edit().putBoolean(name, value).apply() + fun putInt(name: String, value: Int) = context.getPrefs().edit().putInt(name, value).apply() } \ No newline at end of file diff --git a/app/src/main/java/com/chillibits/colorconverter/ui/activity/ColorSelectionActivity.kt b/app/src/main/java/com/chillibits/colorconverter/ui/activity/ColorSelectionActivity.kt index 20be5267..a69a1206 100644 --- a/app/src/main/java/com/chillibits/colorconverter/ui/activity/ColorSelectionActivity.kt +++ b/app/src/main/java/com/chillibits/colorconverter/ui/activity/ColorSelectionActivity.kt @@ -1,5 +1,5 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ package com.chillibits.colorconverter.ui.activity @@ -42,10 +42,14 @@ import javax.inject.Inject class ColorSelectionActivity : AppCompatActivity(), ColorsAdapter.ColorSelectionListener { // Tools packages - @Inject lateinit var db: AppDatabase - @Inject lateinit var st: StorageTools - @Inject lateinit var ct: ColorTools - @Inject lateinit var cnt: ColorNameTools + @Inject + lateinit var db: AppDatabase + @Inject + lateinit var st: StorageTools + @Inject + lateinit var ct: ColorTools + @Inject + lateinit var cnt: ColorNameTools // Variables as objects private lateinit var binding: ActivityColorSelectionBinding @@ -90,8 +94,14 @@ class ColorSelectionActivity : AppCompatActivity(), ColorsAdapter.ColorSelection } override fun onOptionsItemSelected(item: MenuItem): Boolean { - when(item.itemId) { - R.id.action_import_export -> vm.colors.value?.let { showPaletteImportExportDialog(this, vm, it) } + when (item.itemId) { + R.id.action_import_export -> vm.colors.value?.let { + showPaletteImportExportDialog( + this, + vm, + it + ) + } R.id.action_edit -> showRenameColorDialog() R.id.action_delete -> showDeleteColorDialog() R.id.action_done -> done() @@ -135,7 +145,7 @@ class ColorSelectionActivity : AppCompatActivity(), ColorsAdapter.ColorSelection } private fun showRenameColorDialog() { - showRenameDialog(RenameDialogMode.RENAME, object: OnRenameListener { + showRenameDialog(RenameDialogMode.RENAME, object : OnRenameListener { override fun onRenameComplete(newName: String) { vm.selectedColor?.name = newName // Update color diff --git a/app/src/main/java/com/chillibits/colorconverter/ui/activity/ImageActivity.kt b/app/src/main/java/com/chillibits/colorconverter/ui/activity/ImageActivity.kt index 3b5261d9..8a68fca8 100644 --- a/app/src/main/java/com/chillibits/colorconverter/ui/activity/ImageActivity.kt +++ b/app/src/main/java/com/chillibits/colorconverter/ui/activity/ImageActivity.kt @@ -1,5 +1,5 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ package com.chillibits.colorconverter.ui.activity @@ -13,7 +13,6 @@ import android.graphics.BitmapFactory import android.graphics.Matrix import android.graphics.drawable.BitmapDrawable import android.media.AudioManager -import androidx.exifinterface.media.ExifInterface import android.net.Uri import android.os.Build import android.os.Bundle @@ -26,6 +25,7 @@ import androidx.appcompat.app.AppCompatActivity import androidx.core.content.ContextCompat import androidx.core.graphics.BlendModeColorFilterCompat import androidx.core.graphics.BlendModeCompat +import androidx.exifinterface.media.ExifInterface import com.chillibits.colorconverter.shared.Constants import com.chillibits.colorconverter.shared.dpToPx import com.chillibits.colorconverter.tools.ColorNameTools @@ -47,8 +47,10 @@ import javax.inject.Inject class ImageActivity : AppCompatActivity() { // Tools packages - @Inject lateinit var cnt: ColorNameTools - @Inject lateinit var st: StorageTools + @Inject + lateinit var cnt: ColorNameTools + @Inject + lateinit var st: StorageTools // Variables as objects private lateinit var binding: ActivityImageBinding @@ -57,7 +59,7 @@ class ImageActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - binding = ActivityImageBinding.inflate(layoutInflater); + binding = ActivityImageBinding.inflate(layoutInflater) setContentView(binding.root) // Apply window insets @@ -71,8 +73,12 @@ class ImageActivity : AppCompatActivity() { // Initialize other layout components binding.image.colorListener = ColorListener { color, _ -> vm.valueSelectedColor = color - binding.selectedColor.background.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(color, BlendModeCompat.SRC_IN) - if(speakItem != null && speakItem!!.isChecked) speakColor() + binding.selectedColor.background.colorFilter = + BlendModeColorFilterCompat.createBlendModeColorFilterCompat( + color, + BlendModeCompat.SRC_IN + ) + if (speakItem != null && speakItem!!.isChecked) speakColor() } binding.image.flagView = DetailedFlagView(this, R.layout.flag_layout).apply { isFlipAble = false @@ -86,12 +92,12 @@ class ImageActivity : AppCompatActivity() { binding.lightMutedColor.setOnClickListener { finishWithResult(vm.valueMutedColorLight) } binding.darkMutedColor.setOnClickListener { finishWithResult(vm.valueMutedColorDark) } - if(intent.hasExtra(Constants.EXTRA_IMAGE_URI)) { + if (intent.hasExtra(Constants.EXTRA_IMAGE_URI)) { // Load default image val defaultImageUri = intent.getParcelableExtra(Constants.EXTRA_IMAGE_URI) val bitmap = MediaStore.Images.Media.getBitmap(contentResolver, defaultImageUri) applyImage(bitmap) - } else if(savedInstanceState == null) { + } else if (savedInstanceState == null) { // Launch image picker chooseImage() } @@ -107,7 +113,7 @@ class ImageActivity : AppCompatActivity() { } override fun onOptionsItemSelected(item: MenuItem): Boolean { - when(item.itemId) { + when (item.itemId) { android.R.id.home -> finish() R.id.action_speak -> { val newState = !item.isChecked @@ -122,11 +128,17 @@ class ImageActivity : AppCompatActivity() { @Deprecated("Deprecated in Java") override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) - if(requestCode == Constants.REQ_IMAGE_PICKER) { - if(resultCode == Activity.RESULT_OK) { - try{ - vm.imageUri = data?.getStringArrayListExtra(Pix.IMAGE_RESULTS)?.get(0).toString() - applyImage(applyRotation(BitmapFactory.decodeFile(vm.imageUri), vm.imageUri!!)!!) + if (requestCode == Constants.REQ_IMAGE_PICKER) { + if (resultCode == Activity.RESULT_OK) { + try { + vm.imageUri = + data?.getStringArrayListExtra(Pix.IMAGE_RESULTS)?.get(0).toString() + applyImage( + applyRotation( + BitmapFactory.decodeFile(vm.imageUri), + vm.imageUri!! + )!! + ) } catch (e: IOException) { Toast.makeText(this, R.string.error, Toast.LENGTH_SHORT).show() } @@ -139,9 +151,14 @@ class ImageActivity : AppCompatActivity() { Build.VERSION.SDK_INT >= Build.VERSION_CODES.R -> { decorView.setOnApplyWindowInsetsListener { _, insets -> val systemInsets = insets.getInsets(WindowInsets.Type.systemBars()) - if(systemInsets.top > 0) { + if (systemInsets.top > 0) { binding.toolbar.setPadding(0, systemInsets.top, 0, 0) - binding.colorButtonContainer.setPadding(dpToPx(3), dpToPx(3), dpToPx(3), systemInsets.bottom + dpToPx(3)) + binding.colorButtonContainer.setPadding( + dpToPx(3), + dpToPx(3), + dpToPx(3), + systemInsets.bottom + dpToPx(3) + ) } insets } @@ -152,7 +169,12 @@ class ImageActivity : AppCompatActivity() { View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR decorView.setOnApplyWindowInsetsListener { _, insets -> binding.toolbar.setPadding(0, insets.systemWindowInsetTop, 0, 0) - binding.colorButtonContainer.setPadding(dpToPx(3), dpToPx(3), dpToPx(3), insets.systemWindowInsetBottom + dpToPx(3)) + binding.colorButtonContainer.setPadding( + dpToPx(3), + dpToPx(3), + dpToPx(3), + insets.systemWindowInsetBottom + dpToPx(3) + ) insets } } @@ -163,12 +185,16 @@ class ImageActivity : AppCompatActivity() { } } - private fun applyRotation(source: Bitmap, path: String) = when (ExifInterface(path).getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED)) { - ExifInterface.ORIENTATION_ROTATE_90 -> rotateImage(source, 90F) - ExifInterface.ORIENTATION_ROTATE_180 -> rotateImage(source, 180F) - ExifInterface.ORIENTATION_ROTATE_270 -> rotateImage(source, 270F) - else -> source - } + private fun applyRotation(source: Bitmap, path: String) = + when (ExifInterface(path).getAttributeInt( + ExifInterface.TAG_ORIENTATION, + ExifInterface.ORIENTATION_UNDEFINED + )) { + ExifInterface.ORIENTATION_ROTATE_90 -> rotateImage(source, 90F) + ExifInterface.ORIENTATION_ROTATE_180 -> rotateImage(source, 180F) + ExifInterface.ORIENTATION_ROTATE_270 -> rotateImage(source, 270F) + else -> source + } private fun rotateImage(source: Bitmap, angle: Float) = Matrix().run { postRotate(angle) @@ -178,19 +204,48 @@ class ImageActivity : AppCompatActivity() { private fun applyImage(bitmap: Bitmap) { vm.computeVibrantColors(bitmap) binding.image.setPaletteDrawable(BitmapDrawable(resources, bitmap)) - binding.vibrantColor.background.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(vm.valueVibrantColor, BlendModeCompat.SRC_IN) - binding.lightVibrantColor.background.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(vm.valueVibrantColorLight, BlendModeCompat.SRC_IN) - binding.darkVibrantColor.background.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(vm.valueVibrantColorDark, BlendModeCompat.SRC_IN) - binding.mutedColor.background.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(vm.valueMutedColor, BlendModeCompat.SRC_IN) - binding.lightMutedColor.background.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(vm.valueMutedColorLight, BlendModeCompat.SRC_IN) - binding.darkMutedColor.background.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(vm.valueMutedColorDark, BlendModeCompat.SRC_IN) + binding.vibrantColor.background.colorFilter = + BlendModeColorFilterCompat.createBlendModeColorFilterCompat( + vm.valueVibrantColor, + BlendModeCompat.SRC_IN + ) + binding.lightVibrantColor.background.colorFilter = + BlendModeColorFilterCompat.createBlendModeColorFilterCompat( + vm.valueVibrantColorLight, + BlendModeCompat.SRC_IN + ) + binding.darkVibrantColor.background.colorFilter = + BlendModeColorFilterCompat.createBlendModeColorFilterCompat( + vm.valueVibrantColorDark, + BlendModeCompat.SRC_IN + ) + binding.mutedColor.background.colorFilter = + BlendModeColorFilterCompat.createBlendModeColorFilterCompat( + vm.valueMutedColor, + BlendModeCompat.SRC_IN + ) + binding.lightMutedColor.background.colorFilter = + BlendModeColorFilterCompat.createBlendModeColorFilterCompat( + vm.valueMutedColorLight, + BlendModeCompat.SRC_IN + ) + binding.darkMutedColor.background.colorFilter = + BlendModeColorFilterCompat.createBlendModeColorFilterCompat( + vm.valueMutedColorDark, + BlendModeCompat.SRC_IN + ) binding.image.visibility = View.VISIBLE } - override fun onRequestPermissionsResult(requestCode: Int, permissions: Array, grantResults: IntArray) { + override fun onRequestPermissionsResult( + requestCode: Int, + permissions: Array, + grantResults: IntArray + ) { super.onRequestPermissionsResult(requestCode, permissions, grantResults) - if(requestCode == PermUtil.REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS && - grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) { + if (requestCode == PermUtil.REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS && + grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED + ) { chooseImage() } else { Toast.makeText(this, R.string.approve_permissions, Toast.LENGTH_SHORT).show() @@ -206,11 +261,18 @@ class ImageActivity : AppCompatActivity() { } private fun speakColor() { - if(isAudioMuted()) { + if (isAudioMuted()) { Toast.makeText(this, R.string.audio_muted, Toast.LENGTH_SHORT).show() } else { - if(vm.initialized) { - val colorName = cnt.getColorNameFromColor(com.chillibits.colorconverter.model.Color(0, "", vm.valueSelectedColor, 0)) + if (vm.initialized) { + val colorName = cnt.getColorNameFromColor( + com.chillibits.colorconverter.model.Color( + 0, + "", + vm.valueSelectedColor, + 0 + ) + ) vm.tts.speak(colorName, TextToSpeech.QUEUE_FLUSH, null, null) } else { Toast.makeText(this, R.string.initialization_failed, Toast.LENGTH_SHORT).show() diff --git a/app/src/main/java/com/chillibits/colorconverter/ui/activity/MainActivity.kt b/app/src/main/java/com/chillibits/colorconverter/ui/activity/MainActivity.kt index 7c625b67..12db0ed1 100644 --- a/app/src/main/java/com/chillibits/colorconverter/ui/activity/MainActivity.kt +++ b/app/src/main/java/com/chillibits/colorconverter/ui/activity/MainActivity.kt @@ -1,5 +1,5 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ package com.chillibits.colorconverter.ui.activity @@ -47,13 +47,18 @@ import java.util.* import javax.inject.Inject @AndroidEntryPoint -class MainActivity : AppCompatActivity(), ColorsAdapter.ColorSelectionListener, SimpleSettingsConfig.OptionsItemSelectedCallback { +class MainActivity : AppCompatActivity(), ColorsAdapter.ColorSelectionListener, + SimpleSettingsConfig.OptionsItemSelectedCallback { // Tools packages - @Inject lateinit var st: StorageTools - @Inject lateinit var ct: ColorTools - @Inject lateinit var cnt: ColorNameTools - @Inject lateinit var cbt: ClipboardTools + @Inject + lateinit var st: StorageTools + @Inject + lateinit var ct: ColorTools + @Inject + lateinit var cnt: ColorNameTools + @Inject + lateinit var cbt: ClipboardTools // Variables as objects private lateinit var binding: ActivityMainBinding @@ -64,7 +69,7 @@ class MainActivity : AppCompatActivity(), ColorsAdapter.ColorSelectionListener, override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - binding = ActivityMainBinding.inflate(layoutInflater); + binding = ActivityMainBinding.inflate(layoutInflater) setContentView(binding.root) // Apply window insets @@ -87,7 +92,8 @@ class MainActivity : AppCompatActivity(), ColorsAdapter.ColorSelectionListener, // Redirect to ImageActivity, if needed if (intent.hasExtra(Constants.EXTRA_ACTION) && - intent.getStringExtra(Constants.EXTRA_ACTION) == "image") { + intent.getStringExtra(Constants.EXTRA_ACTION) == "image" + ) { pickColorFromImage() } else { // Show in-app rating dialog @@ -97,7 +103,8 @@ class MainActivity : AppCompatActivity(), ColorsAdapter.ColorSelectionListener, // Set to choose color mode, if required if (intent.hasExtra(Constants.EXTRA_CHOOSE_COLOR)) { binding.finishWithColor.setOnClickListener { finishWithSelectedColor() } - val color = intent.getIntExtra(Constants.EXTRA_CHOOSE_COLOR, android.graphics.Color.BLACK) + val color = + intent.getIntExtra(Constants.EXTRA_CHOOSE_COLOR, android.graphics.Color.BLACK) updateDisplays(Color(0, Constants.NAME_SELECTED_COLOR, color, -1)) } else { binding.finishWithColor.visibility = View.GONE @@ -125,7 +132,7 @@ class MainActivity : AppCompatActivity(), ColorsAdapter.ColorSelectionListener, } override fun onOptionsItemSelected(item: MenuItem): Boolean { - when(item.itemId) { + when (item.itemId) { R.id.action_transparency -> showTransparencyWarning() R.id.action_palette -> showColorPaletteDialog(this, cnt, ct) R.id.action_settings -> showSettings() @@ -140,24 +147,38 @@ class MainActivity : AppCompatActivity(), ColorsAdapter.ColorSelectionListener, @Deprecated("Deprecated in Java") override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) - when(requestCode) { + when (requestCode) { Constants.REQ_PICK_COLOR_FROM_IMAGE -> { - if(resultCode == Activity.RESULT_OK) - updateDisplays(Color(0, Constants.NAME_SELECTED_COLOR, data!!.getIntExtra( - Constants.EXTRA_COLOR, 0), -1)) + if (resultCode == Activity.RESULT_OK) + updateDisplays( + Color( + 0, Constants.NAME_SELECTED_COLOR, data!!.getIntExtra( + Constants.EXTRA_COLOR, 0 + ), -1 + ) + ) } Constants.REQ_LOAD_COLOR -> { - if(resultCode == Activity.RESULT_OK) - updateDisplays(Color(0, Constants.NAME_SELECTED_COLOR, data!!.getIntExtra( - Constants.EXTRA_COLOR, 0), -1)) + if (resultCode == Activity.RESULT_OK) + updateDisplays( + Color( + 0, Constants.NAME_SELECTED_COLOR, data!!.getIntExtra( + Constants.EXTRA_COLOR, 0 + ), -1 + ) + ) } } } - override fun onRequestPermissionsResult(requestCode: Int, permissions: Array, grantResults: IntArray) { + override fun onRequestPermissionsResult( + requestCode: Int, + permissions: Array, + grantResults: IntArray + ) { super.onRequestPermissionsResult(requestCode, permissions, grantResults) - if(requestCode == Constants.REQ_PERMISSIONS) { - if(grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED && grantResults[1] == PackageManager.PERMISSION_GRANTED) { + if (requestCode == Constants.REQ_PERMISSIONS) { + if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED && grantResults[1] == PackageManager.PERMISSION_GRANTED) { pickColorFromImage() } else { Toast.makeText(this, R.string.approve_permissions, Toast.LENGTH_SHORT).show() @@ -170,8 +191,8 @@ class MainActivity : AppCompatActivity(), ColorsAdapter.ColorSelectionListener, Build.VERSION.SDK_INT >= Build.VERSION_CODES.R -> { decorView.setOnApplyWindowInsetsListener { _, insets -> val systemInsets = insets.getInsets(WindowInsets.Type.systemBars()) - if(systemInsets.top > 0) { - binding.toolbar?.setPadding(0, systemInsets.top, 0, 0) + if (systemInsets.top > 0) { + binding.toolbar.setPadding(0, systemInsets.top, 0, 0) binding.scrollContainer.setPadding(0, 0, 0, systemInsets.bottom) binding.finishWithColorWrapper.setPadding(0, 0, 0, systemInsets.bottom) } @@ -183,9 +204,14 @@ class MainActivity : AppCompatActivity(), ColorsAdapter.ColorSelectionListener, decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR decorView.setOnApplyWindowInsetsListener { _, insets -> - binding.toolbar?.setPadding(0, insets.systemWindowInsetTop, 0, 0) + binding.toolbar.setPadding(0, insets.systemWindowInsetTop, 0, 0) binding.scrollContainer.setPadding(0, 0, 0, insets.systemWindowInsetBottom) - binding.finishWithColorWrapper.setPadding(0, 0, 0, insets.systemWindowInsetBottom) + binding.finishWithColorWrapper.setPadding( + 0, + 0, + 0, + insets.systemWindowInsetBottom + ) insets } } @@ -201,7 +227,7 @@ class MainActivity : AppCompatActivity(), ColorsAdapter.ColorSelectionListener, showInstantAppInstallDialog(R.string.instant_install_m) } else { Intent(this, ImageActivity::class.java).run { - if(defaultImageUri != null) putExtra("ImageUri", defaultImageUri) + if (defaultImageUri != null) putExtra("ImageUri", defaultImageUri) startActivityForResult(this, Constants.REQ_PICK_COLOR_FROM_IMAGE) } } @@ -209,16 +235,26 @@ class MainActivity : AppCompatActivity(), ColorsAdapter.ColorSelectionListener, private fun editHexCode() { // Initialize views - val dialogView = LayoutInflater.from(this).inflate(R.layout.dialog_edit_hex, binding.container, false) - val hexValue = dialogView.findViewById(R.id.dialogHex); - if(!isAlphaEnabled) - hexValue.setText(String.format(getString(R.string.hex_format, - "%06X".format((0xFFFFFF and vm.selectedColor.color)).uppercase(Locale.getDefault()) - ))) + val dialogView = + LayoutInflater.from(this).inflate(R.layout.dialog_edit_hex, binding.container, false) + val hexValue = dialogView.findViewById(R.id.dialogHex) + if (!isAlphaEnabled) + hexValue.setText( + String.format( + getString( + R.string.hex_format, + "%06X".format((0xFFFFFF and vm.selectedColor.color)) + .uppercase(Locale.getDefault()) + ) + ) + ) else - hexValue.setText(String.format(getString(R.string.hex_format), - "%08X".format(vm.selectedColor.color).uppercase(Locale.getDefault()) - )) + hexValue.setText( + String.format( + getString(R.string.hex_format), + "%08X".format(vm.selectedColor.color).uppercase(Locale.getDefault()) + ) + ) Selection.setSelection(hexValue.text, hexValue.text.toString().length) // Create dialog @@ -226,12 +262,18 @@ class MainActivity : AppCompatActivity(), ColorsAdapter.ColorSelectionListener, .setTitle(R.string.hex_code) .setView(dialogView) .setNegativeButton(R.string.cancel, null) - .setPositiveButton( R.string.choose_color) { _, _ -> + .setPositiveButton(R.string.choose_color) { _, _ -> var hex = hexValue.text.toString() - if(!isAlphaEnabled && hex.length == 4) - hex = hex.replace(Regex("#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])"), "#$1$1$2$2$3$3") - if(isAlphaEnabled && hex.length == 5) - hex = hex.replace(Regex("#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])"), "#$1$1$2$2$3$3$4$4") + if (!isAlphaEnabled && hex.length == 4) + hex = hex.replace( + Regex("#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])"), + "#$1$1$2$2$3$3" + ) + if (isAlphaEnabled && hex.length == 5) + hex = hex.replace( + Regex("#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])"), + "#$1$1$2$2$3$3$4$4" + ) val tmp = vm.selectedColor tmp.apply { color = android.graphics.Color.parseColor(hex) @@ -247,19 +289,22 @@ class MainActivity : AppCompatActivity(), ColorsAdapter.ColorSelectionListener, // Prepare views hexValue.doAfterTextChanged { s -> val value = s.toString() - if(!value.startsWith("#")) { + if (!value.startsWith("#")) { hexValue.setText("#") Selection.setSelection(hexValue.text, hexValue.text.toString().length) } else { - if(value.length > 1 && !value.matches("#[a-fA-F0-9]+".toRegex())) s?.delete(value.length -1, value.length) - dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = if(isAlphaEnabled) { + if (value.length > 1 && !value.matches("#[a-fA-F0-9]+".toRegex())) s?.delete( + value.length - 1, + value.length + ) + dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = if (isAlphaEnabled) { s.toString().length == 9 || s.toString().length == 5 || s.toString().length == 7 } else { s.toString().length == 7 || s.toString().length == 4 } } } - hexValue.setSelection(1, if(isAlphaEnabled) 9 else 7) + hexValue.setSelection(1, if (isAlphaEnabled) 9 else 7) hexValue.requestFocus() dialog.window?.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) dialog.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) @@ -267,7 +312,8 @@ class MainActivity : AppCompatActivity(), ColorsAdapter.ColorSelectionListener, private fun editHSVCode() { // Initialize views - val container = LayoutInflater.from(this).inflate(R.layout.dialog_edit_hsv, binding.container, false) + val container = + LayoutInflater.from(this).inflate(R.layout.dialog_edit_hsv, binding.container, false) val dialogH = container.findViewById(R.id.dialogH) val dialogS = container.findViewById(R.id.dialogS) val dialogV = container.findViewById(R.id.dialogV) @@ -324,7 +370,7 @@ class MainActivity : AppCompatActivity(), ColorsAdapter.ColorSelectionListener, private fun chooseColor() { val colorPicker = ColorPickerDialog(this, vm.selectedColor.color) - if(isAlphaEnabled) colorPicker.alphaSliderVisible = true + if (isAlphaEnabled) colorPicker.alphaSliderVisible = true colorPicker.hexValueEnabled = true colorPicker.setTitle(R.string.choose_color) colorPicker.setOnColorChangedListener { color -> @@ -339,41 +385,61 @@ class MainActivity : AppCompatActivity(), ColorsAdapter.ColorSelectionListener, binding.displayRed.text = color.red.toString() binding.displayGreen.text = color.green.toString() binding.displayBlue.text = color.blue.toString() - binding.displayName.text = String.format(getString(R.string.name_), cnt.getColorNameFromColor(color)) + binding.displayName.text = + String.format(getString(R.string.name_), cnt.getColorNameFromColor(color)) // Update ARGB TextView - binding.displayArgb.text = if(isAlphaEnabled) { - String.format(getString(R.string.argb_), color.alpha, color.red, color.green, color.blue) + binding.displayArgb.text = if (isAlphaEnabled) { + String.format( + getString(R.string.argb_), + color.alpha, + color.red, + color.green, + color.blue + ) } else { String.format(getString(R.string.rgb_), color.red, color.green, color.blue) } // Update HEX TextView - binding.displayHex.text = if(isAlphaEnabled) { - String.format(getString(R.string.hex_), + binding.displayHex.text = if (isAlphaEnabled) { + String.format( + getString(R.string.hex_), "%08X".format(color.color).uppercase(Locale.getDefault()) ) } else { - String.format(getString(R.string.hex_), + String.format( + getString(R.string.hex_), "%06X".format(0xFFFFFF and color.color).uppercase(Locale.getDefault()) ) } // Update HSV TextView val hsv = FloatArray(3) android.graphics.Color.RGBToHSV(color.red, color.green, color.blue, hsv) - binding.displayHsv.text = String.format(getString(R.string.hsv_), String.format(Constants.HSV_FORMAT_STRING, hsv[0]), - String.format(Constants.HSV_FORMAT_STRING, hsv[1]), String.format(Constants.HSV_FORMAT_STRING, hsv[2])) + binding.displayHsv.text = String.format( + getString(R.string.hsv_), + String.format(Constants.HSV_FORMAT_STRING, hsv[0]), + String.format(Constants.HSV_FORMAT_STRING, hsv[1]), + String.format(Constants.HSV_FORMAT_STRING, hsv[2]) + ) // Update CMYK TextView val cmyk = ct.getCmykFromRgb(color.red, color.green, color.blue) - binding.displayCmyk.text = String.format(getString(R.string.cmyk_), cmyk[0], cmyk[1], cmyk[2], cmyk[3]) + binding.displayCmyk.text = + String.format(getString(R.string.cmyk_), cmyk[0], cmyk[1], cmyk[2], cmyk[3]) // Update text colors - val textColor = ct.getTextColor(this, android.graphics.Color.argb(color.alpha, color.red, color.green, color.blue)) + val textColor = ct.getTextColor( + this, + android.graphics.Color.argb(color.alpha, color.red, color.green, color.blue) + ) binding.displayName.setTextColor(textColor) binding.displayArgb.setTextColor(textColor) binding.displayHex.setTextColor(textColor) binding.displayHsv.setTextColor(textColor) binding.displayCmyk.setTextColor(textColor) - val colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(textColor, BlendModeCompat.SRC_ATOP) + val colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat( + textColor, + BlendModeCompat.SRC_ATOP + ) binding.copyName.colorFilter = colorFilter binding.copyArgb.colorFilter = colorFilter binding.copyHex.colorFilter = colorFilter @@ -394,17 +460,23 @@ class MainActivity : AppCompatActivity(), ColorsAdapter.ColorSelectionListener, ValueAnimator.ofInt(binding.colorRed.progress, color.red).apply { duration = Constants.COLOR_ANIMATION_DURATION - addUpdateListener { valueAnimator -> binding.colorRed.progress = valueAnimator.animatedValue as Int } + addUpdateListener { valueAnimator -> + binding.colorRed.progress = valueAnimator.animatedValue as Int + } }.start() ValueAnimator.ofInt(binding.colorGreen.progress, color.green).apply { duration = Constants.COLOR_ANIMATION_DURATION - addUpdateListener { valueAnimator -> binding.colorGreen.progress = valueAnimator.animatedValue as Int } + addUpdateListener { valueAnimator -> + binding.colorGreen.progress = valueAnimator.animatedValue as Int + } }.start() ValueAnimator.ofInt(binding.colorBlue.progress, color.blue).apply { duration = Constants.COLOR_ANIMATION_DURATION - addUpdateListener { valueAnimator -> binding.colorBlue.progress = valueAnimator.animatedValue as Int } + addUpdateListener { valueAnimator -> + binding.colorBlue.progress = valueAnimator.animatedValue as Int + } }.start() // Save color to shared preferences for restoring on the next app start @@ -420,25 +492,36 @@ class MainActivity : AppCompatActivity(), ColorsAdapter.ColorSelectionListener, private fun setDefaultComponentValues() { // Initialize views - binding.displayName.text = String.format(getString(R.string.name_), cnt.getColorNameFromColor(vm.selectedColor)) + binding.displayName.text = + String.format(getString(R.string.name_), cnt.getColorNameFromColor(vm.selectedColor)) binding.displayArgb.text = String.format( getString(R.string.argb_), - vm.selectedColor.alpha, vm.selectedColor.red, vm.selectedColor.green, vm.selectedColor.blue + vm.selectedColor.alpha, + vm.selectedColor.red, + vm.selectedColor.green, + vm.selectedColor.blue ) - binding.displayHex.text = String.format(getString(R.string.hex_), + binding.displayHex.text = String.format( + getString(R.string.hex_), "%08X".format(vm.selectedColor.color).uppercase( Locale.getDefault() ) ) val hsv = FloatArray(3) - android.graphics.Color.RGBToHSV(vm.selectedColor.red, vm.selectedColor.green, vm.selectedColor.blue, hsv) + android.graphics.Color.RGBToHSV( + vm.selectedColor.red, + vm.selectedColor.green, + vm.selectedColor.blue, + hsv + ) binding.displayHsv.text = String.format( getString(R.string.hsv_), String.format(Constants.HSV_FORMAT_STRING, hsv[0]), String.format(Constants.HSV_FORMAT_STRING, hsv[1]), String.format(Constants.HSV_FORMAT_STRING, hsv[2]) ) - val cmyk = ct.getCmykFromRgb(vm.selectedColor.red, vm.selectedColor.green, vm.selectedColor.blue) + val cmyk = + ct.getCmykFromRgb(vm.selectedColor.red, vm.selectedColor.green, vm.selectedColor.blue) binding.displayCmyk.text = String.format(getString(R.string.cmyk_), cmyk[0], cmyk[1], cmyk[2], cmyk[3]) } @@ -485,38 +568,46 @@ class MainActivity : AppCompatActivity(), ColorsAdapter.ColorSelectionListener, private fun initializeSeekBarSection() { // Initialize other layout components - binding.colorAlpha.thumb.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat( - ContextCompat.getColor(this, R.color.gray), BlendModeCompat.SRC_ATOP - ) + binding.colorAlpha.thumb.colorFilter = + BlendModeColorFilterCompat.createBlendModeColorFilterCompat( + ContextCompat.getColor(this, R.color.gray), BlendModeCompat.SRC_ATOP + ) binding.colorRed.progressDrawable.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat( ContextCompat.getColor(this, R.color.red), BlendModeCompat.SRC_ATOP ) - binding.colorRed.thumb.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat( - ContextCompat.getColor(this, R.color.red), BlendModeCompat.SRC_ATOP - ) + binding.colorRed.thumb.colorFilter = + BlendModeColorFilterCompat.createBlendModeColorFilterCompat( + ContextCompat.getColor(this, R.color.red), BlendModeCompat.SRC_ATOP + ) binding.colorGreen.progressDrawable.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat( ContextCompat.getColor(this, R.color.green), BlendModeCompat.SRC_ATOP ) - binding.colorGreen.thumb.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat( - ContextCompat.getColor(this, R.color.green), BlendModeCompat.SRC_ATOP - ) + binding.colorGreen.thumb.colorFilter = + BlendModeColorFilterCompat.createBlendModeColorFilterCompat( + ContextCompat.getColor(this, R.color.green), BlendModeCompat.SRC_ATOP + ) binding.colorBlue.progressDrawable.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat( ContextCompat.getColor(this, R.color.blue), BlendModeCompat.SRC_ATOP ) - binding.colorBlue.thumb.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat( - ContextCompat.getColor(this, R.color.blue), BlendModeCompat.SRC_ATOP - ) + binding.colorBlue.thumb.colorFilter = + BlendModeColorFilterCompat.createBlendModeColorFilterCompat( + ContextCompat.getColor(this, R.color.blue), BlendModeCompat.SRC_ATOP + ) binding.colorAlpha.setOnSeekBarChangeListener(object : SimpleOnSeekBarChangeListener() { override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) { if (fromUser) { val value = progress.toString() binding.displayAlpha.text = value - updateDisplays(Color(0, Constants.NAME_SELECTED_COLOR, progress, binding.colorRed.progress, - binding.colorGreen.progress, binding.colorBlue.progress, -1)) + updateDisplays( + Color( + 0, Constants.NAME_SELECTED_COLOR, progress, binding.colorRed.progress, + binding.colorGreen.progress, binding.colorBlue.progress, -1 + ) + ) } if ((vm.showTransparencyWarning && progress > 20) || (!vm.showTransparencyWarning && progress <= 20)) { vm.showTransparencyWarning = !vm.showTransparencyWarning @@ -529,8 +620,12 @@ class MainActivity : AppCompatActivity(), ColorsAdapter.ColorSelectionListener, if (fromUser) { val value = progress.toString() binding.displayRed.text = value - updateDisplays(Color(0, Constants.NAME_SELECTED_COLOR, binding.colorAlpha.progress, - progress, binding.colorGreen.progress, binding.colorBlue.progress, -1)) + updateDisplays( + Color( + 0, Constants.NAME_SELECTED_COLOR, binding.colorAlpha.progress, + progress, binding.colorGreen.progress, binding.colorBlue.progress, -1 + ) + ) } } }) @@ -539,8 +634,12 @@ class MainActivity : AppCompatActivity(), ColorsAdapter.ColorSelectionListener, if (fromUser) { val value = progress.toString() binding.displayGreen.text = value - updateDisplays(Color(0, Constants.NAME_SELECTED_COLOR, binding.colorAlpha.progress, - binding.colorRed.progress, progress, binding.colorBlue.progress, -1)) + updateDisplays( + Color( + 0, Constants.NAME_SELECTED_COLOR, binding.colorAlpha.progress, + binding.colorRed.progress, progress, binding.colorBlue.progress, -1 + ) + ) } } }) @@ -549,26 +648,34 @@ class MainActivity : AppCompatActivity(), ColorsAdapter.ColorSelectionListener, if (fromUser) { val value = progress.toString() binding.displayBlue.text = value - updateDisplays(Color(0, Constants.NAME_SELECTED_COLOR, binding.colorAlpha.progress, - binding.colorRed.progress, binding.colorGreen.progress, progress, -1)) + updateDisplays( + Color( + 0, Constants.NAME_SELECTED_COLOR, binding.colorAlpha.progress, + binding.colorRed.progress, binding.colorGreen.progress, progress, -1 + ) + ) } } }) } override fun onSettingsOptionsItemSelected(itemId: Int) { - when(itemId) { + when (itemId) { R.id.action_rate -> showRatingDialog() - R.id.action_share-> showRecommendationDialog() + R.id.action_share -> showRecommendationDialog() } } private fun enableAlpha(enabled: Boolean) { // Set alpha to 100% - updateDisplays(Color(0, Constants.NAME_SELECTED_COLOR, 255, vm.selectedColor.red, - vm.selectedColor.green, vm.selectedColor.blue, -1)) + updateDisplays( + Color( + 0, Constants.NAME_SELECTED_COLOR, 255, vm.selectedColor.red, + vm.selectedColor.green, vm.selectedColor.blue, -1 + ) + ) // Show / hide components - val visibility = if(enabled) View.VISIBLE else View.GONE + val visibility = if (enabled) View.VISIBLE else View.GONE binding.colorAlpha.visibility = visibility binding.displayAlpha.visibility = visibility binding.displayAlphaLabel.visibility = visibility diff --git a/app/src/main/java/com/chillibits/colorconverter/ui/adapter/ColorsAdapter.kt b/app/src/main/java/com/chillibits/colorconverter/ui/adapter/ColorsAdapter.kt index 6dd1361c..71668581 100644 --- a/app/src/main/java/com/chillibits/colorconverter/ui/adapter/ColorsAdapter.kt +++ b/app/src/main/java/com/chillibits/colorconverter/ui/adapter/ColorsAdapter.kt @@ -1,9 +1,10 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ package com.chillibits.colorconverter.ui.adapter +import android.annotation.SuppressLint import android.content.Context import android.view.LayoutInflater import android.view.View @@ -25,7 +26,7 @@ class ColorsAdapter @Inject constructor( private val listener: ColorSelectionListener, private val ct: ColorTools, private var colors: List = emptyList() -): RecyclerView.Adapter() { +) : RecyclerView.Adapter() { // Variables private val isAlphaDisabled = context.getPrefBooleanValue(Constants.ENABLE_ALPHA, true) @@ -35,6 +36,7 @@ class ColorsAdapter @Inject constructor( fun onColorSelected(color: Color) } + @SuppressLint("NotifyDataSetChanged") fun updateData(data: List) { this.colors = data notifyDataSetChanged() @@ -58,7 +60,7 @@ class ColorsAdapter @Inject constructor( android.graphics.Color.RGBToHSV(color.red, color.green, color.blue, hsv) val cmyk = ct.getCmykFromRgb(color.red, color.green, color.blue) - findViewById(R.id.itemColorValues).text = if(isAlphaDisabled) + findViewById(R.id.itemColorValues).text = if (isAlphaDisabled) String.format( context.getString(R.string.color_summary_alpha_disabled), color.red, color.green, color.blue, diff --git a/app/src/main/java/com/chillibits/colorconverter/ui/dialog/ArgbExportDialog.kt b/app/src/main/java/com/chillibits/colorconverter/ui/dialog/ArgbExportDialog.kt index 15dab278..04da0f31 100644 --- a/app/src/main/java/com/chillibits/colorconverter/ui/dialog/ArgbExportDialog.kt +++ b/app/src/main/java/com/chillibits/colorconverter/ui/dialog/ArgbExportDialog.kt @@ -1,5 +1,5 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ package com.chillibits.colorconverter.ui.dialog @@ -22,7 +22,7 @@ fun Context.showArgbExportDialog(st: StorageTools, alpha: Int, red: Int, green: .setView(this) .show() - val rememberSelection = findViewById(R.id.rememberSelection); + val rememberSelection = findViewById(R.id.rememberSelection) findViewById(R.id.formatArgb).setOnClickListener { if (rememberSelection.isChecked) st.putBoolean(Constants.ARGB_REMEMBER_SELECTION, true) copyTextToClipboard( diff --git a/app/src/main/java/com/chillibits/colorconverter/ui/dialog/CmykExportDialog.kt b/app/src/main/java/com/chillibits/colorconverter/ui/dialog/CmykExportDialog.kt index 3edc1988..de40173b 100644 --- a/app/src/main/java/com/chillibits/colorconverter/ui/dialog/CmykExportDialog.kt +++ b/app/src/main/java/com/chillibits/colorconverter/ui/dialog/CmykExportDialog.kt @@ -1,5 +1,5 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ package com.chillibits.colorconverter.ui.dialog @@ -23,15 +23,21 @@ fun Context.showCmykExportDialog(st: StorageTools, cyan: Int, magenta: Int, yell val rememberSelection = findViewById(R.id.rememberSelection) findViewById(R.id.formatCmyk).setOnClickListener { - if(rememberSelection.isChecked) st.putBoolean(Constants.CMYK_REMEMBER_SELECTION, true) - copyTextToClipboard(getString(R.string.cmyk_code), String.format(getString(R.string.cmyk_clipboard), - cyan / 100.0, magenta / 100.0, yellow / 100.0, key / 100.0)) + if (rememberSelection.isChecked) st.putBoolean(Constants.CMYK_REMEMBER_SELECTION, true) + copyTextToClipboard( + getString(R.string.cmyk_code), String.format( + getString(R.string.cmyk_clipboard), + cyan / 100.0, magenta / 100.0, yellow / 100.0, key / 100.0 + ) + ) dialog.dismiss() } findViewById(R.id.formatCmykCss).setOnClickListener { - if(rememberSelection.isChecked) st.putBoolean(Constants.CMYK_REMEMBER_SELECTION, false) - copyTextToClipboard(getString(R.string.cmyk_code), - String.format(getString(R.string.cmyk_clipboard_css), cyan, magenta, yellow, key)) + if (rememberSelection.isChecked) st.putBoolean(Constants.CMYK_REMEMBER_SELECTION, false) + copyTextToClipboard( + getString(R.string.cmyk_code), + String.format(getString(R.string.cmyk_clipboard_css), cyan, magenta, yellow, key) + ) dialog.dismiss() } rememberSelection.setOnCheckedChangeListener { _, isChecked -> diff --git a/app/src/main/java/com/chillibits/colorconverter/ui/dialog/ColorPaletteDialog.kt b/app/src/main/java/com/chillibits/colorconverter/ui/dialog/ColorPaletteDialog.kt index b74c724f..0dc28d31 100644 --- a/app/src/main/java/com/chillibits/colorconverter/ui/dialog/ColorPaletteDialog.kt +++ b/app/src/main/java/com/chillibits/colorconverter/ui/dialog/ColorPaletteDialog.kt @@ -1,5 +1,5 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ package com.chillibits.colorconverter.ui.dialog diff --git a/app/src/main/java/com/chillibits/colorconverter/ui/dialog/InstallAppDialog.kt b/app/src/main/java/com/chillibits/colorconverter/ui/dialog/InstallAppDialog.kt index 6922088e..9bf7e8eb 100644 --- a/app/src/main/java/com/chillibits/colorconverter/ui/dialog/InstallAppDialog.kt +++ b/app/src/main/java/com/chillibits/colorconverter/ui/dialog/InstallAppDialog.kt @@ -1,5 +1,5 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ package com.chillibits.colorconverter.ui.dialog @@ -33,7 +33,12 @@ fun Activity.showInstantAppInstallDialog(@StringRes message: Int) { .setNegativeText(R.string.cancel) .onPositive { Intent(this, MainActivity::class.java).run { - InstantApps.showInstallPrompt(this@showInstantAppInstallDialog, this, Constants.REQ_INSTANT_INSTALL, "") + InstantApps.showInstallPrompt( + this@showInstantAppInstallDialog, + this, + Constants.REQ_INSTANT_INSTALL, + "" + ) } } .show() diff --git a/app/src/main/java/com/chillibits/colorconverter/ui/dialog/PaletteImportExportDialog.kt b/app/src/main/java/com/chillibits/colorconverter/ui/dialog/PaletteImportExportDialog.kt index fa475741..ae84835c 100644 --- a/app/src/main/java/com/chillibits/colorconverter/ui/dialog/PaletteImportExportDialog.kt +++ b/app/src/main/java/com/chillibits/colorconverter/ui/dialog/PaletteImportExportDialog.kt @@ -1,5 +1,5 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ package com.chillibits.colorconverter.ui.dialog @@ -31,7 +31,7 @@ fun Context.showPaletteImportExportDialog( ) { val colorTool = AdobeColorTool(activity) val importTimestamp = System.currentTimeMillis() - val importListener = object: AdobeColorTool.AdobeImportListener { + val importListener = object : AdobeColorTool.AdobeImportListener { override fun onComplete(groups: Map>) { val importedColors = ArrayList() CoroutineScope(Dispatchers.IO).launch { @@ -53,7 +53,8 @@ fun Context.showPaletteImportExportDialog( } } - val adobeColors = colors.map { AdobeColor(android.graphics.Color.rgb(it.red, it.green, it.blue), it.name) } + val adobeColors = + colors.map { AdobeColor(android.graphics.Color.rgb(it.red, it.green, it.blue), it.name) } val view = LayoutInflater.from(this).inflate(R.layout.dialog_export_palette, null) val dialog = AlertDialog.Builder(this) @@ -61,7 +62,7 @@ fun Context.showPaletteImportExportDialog( .show() view.findViewById(R.id.exportACO).setOnClickListener { - showRenameDialog(RenameDialogMode.EXPORT, object: OnRenameListener { + showRenameDialog(RenameDialogMode.EXPORT, object : OnRenameListener { override fun onRenameComplete(newName: String) { colorTool.exportColorListAsACO(adobeColors, newName) } @@ -69,7 +70,7 @@ fun Context.showPaletteImportExportDialog( dialog.dismiss() } view.findViewById(R.id.exportASE).setOnClickListener { - showRenameDialog(RenameDialogMode.EXPORT, object: OnRenameListener { + showRenameDialog(RenameDialogMode.EXPORT, object : OnRenameListener { override fun onRenameComplete(newName: String) { colorTool.exportColorListAsASE(adobeColors, newName) } diff --git a/app/src/main/java/com/chillibits/colorconverter/ui/dialog/RatingDialog.kt b/app/src/main/java/com/chillibits/colorconverter/ui/dialog/RatingDialog.kt index 2c6617d1..86b7846a 100644 --- a/app/src/main/java/com/chillibits/colorconverter/ui/dialog/RatingDialog.kt +++ b/app/src/main/java/com/chillibits/colorconverter/ui/dialog/RatingDialog.kt @@ -1,5 +1,5 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ package com.chillibits.colorconverter.ui.dialog diff --git a/app/src/main/java/com/chillibits/colorconverter/ui/dialog/RecommendationDialog.kt b/app/src/main/java/com/chillibits/colorconverter/ui/dialog/RecommendationDialog.kt index 908664a5..b451213c 100644 --- a/app/src/main/java/com/chillibits/colorconverter/ui/dialog/RecommendationDialog.kt +++ b/app/src/main/java/com/chillibits/colorconverter/ui/dialog/RecommendationDialog.kt @@ -1,5 +1,5 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ package com.chillibits.colorconverter.ui.dialog diff --git a/app/src/main/java/com/chillibits/colorconverter/ui/dialog/RenameDialog.kt b/app/src/main/java/com/chillibits/colorconverter/ui/dialog/RenameDialog.kt index 0642bf3e..631286f9 100644 --- a/app/src/main/java/com/chillibits/colorconverter/ui/dialog/RenameDialog.kt +++ b/app/src/main/java/com/chillibits/colorconverter/ui/dialog/RenameDialog.kt @@ -1,5 +1,5 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ package com.chillibits.colorconverter.ui.dialog @@ -22,7 +22,11 @@ enum class RenameDialogMode { EXPORT } -fun Context.showRenameDialog(mode: RenameDialogMode, listener: OnRenameListener, oldName: String = "") { +fun Context.showRenameDialog( + mode: RenameDialogMode, + listener: OnRenameListener, + oldName: String = "" +) { val dialogView = LayoutInflater.from(this).inflate(R.layout.dialog_rename, null) val newName = dialogView.findViewById(R.id.dialogName) newName.setText(oldName) @@ -37,7 +41,7 @@ fun Context.showRenameDialog(mode: RenameDialogMode, listener: OnRenameListener, val name = newName.text.toString().trim() if (name.isNotEmpty()) listener.onRenameComplete(name) } - .setNegativeButton(R.string.cancel) { _, _ -> listener.onRenameCancel()} + .setNegativeButton(R.string.cancel) { _, _ -> listener.onRenameCancel() } .show() // Prepare views diff --git a/app/src/main/java/com/chillibits/colorconverter/ui/dialog/SaveColorDialog.kt b/app/src/main/java/com/chillibits/colorconverter/ui/dialog/SaveColorDialog.kt index 8e4e7dec..3fbcb2fa 100644 --- a/app/src/main/java/com/chillibits/colorconverter/ui/dialog/SaveColorDialog.kt +++ b/app/src/main/java/com/chillibits/colorconverter/ui/dialog/SaveColorDialog.kt @@ -1,5 +1,5 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ package com.chillibits.colorconverter.ui.dialog @@ -22,7 +22,7 @@ fun Context.showSaveColorDialog(cnt: ColorNameTools, vm: MainViewModel) { // Initialize views val dialogView = LayoutInflater.from(this).inflate(R.layout.dialog_rename, null) - val dialogName = dialogView.findViewById(R.id.dialogName); + val dialogName = dialogView.findViewById(R.id.dialogName) dialogName.setText(defaultName) // Create dialog diff --git a/app/src/main/java/com/chillibits/colorconverter/ui/dialog/TransparencyWarningDialog.kt b/app/src/main/java/com/chillibits/colorconverter/ui/dialog/TransparencyWarningDialog.kt index 86bad16d..61d7b210 100644 --- a/app/src/main/java/com/chillibits/colorconverter/ui/dialog/TransparencyWarningDialog.kt +++ b/app/src/main/java/com/chillibits/colorconverter/ui/dialog/TransparencyWarningDialog.kt @@ -1,5 +1,5 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ package com.chillibits.colorconverter.ui.dialog diff --git a/app/src/main/java/com/chillibits/colorconverter/ui/templates/SettingsScreen.kt b/app/src/main/java/com/chillibits/colorconverter/ui/templates/SettingsScreen.kt index a45d0180..017977c3 100644 --- a/app/src/main/java/com/chillibits/colorconverter/ui/templates/SettingsScreen.kt +++ b/app/src/main/java/com/chillibits/colorconverter/ui/templates/SettingsScreen.kt @@ -1,5 +1,5 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ package com.chillibits.colorconverter.ui.templates @@ -41,7 +41,10 @@ fun Context.showSettings() { TextPref { titleRes = R.string.colorconverter_on_github summaryRes = R.string.tap_to_visit_us_on_github - onClick = WebsiteClickListener(this@showSettings, this@showSettings.getString(R.string.url_github)) + onClick = WebsiteClickListener( + this@showSettings, + this@showSettings.getString(R.string.url_github) + ) } LibsPref { title = context.resources.getText(R.string.open_source_licenses).toString() @@ -49,18 +52,27 @@ fun Context.showSettings() { } TextPref { titleRes = R.string.app_version - summary = packageManager.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES).versionName + summary = packageManager.getPackageInfo( + packageName, + PackageManager.GET_ACTIVITIES + ).versionName onClick = PlayStoreClickListener(this@showSettings) } TextPref { titleRes = R.string.the_developers summaryRes = R.string.developers - onClick = WebsiteClickListener(this@showSettings, this@showSettings.getString(R.string.url_homepage)) + onClick = WebsiteClickListener( + this@showSettings, + this@showSettings.getString(R.string.url_homepage) + ) } TextPref { titleRes = R.string.more_apps_from_us summaryRes = R.string.our_playstore_page - onClick = WebsiteClickListener(this@showSettings, this@showSettings.getString(R.string.url_play_developers_page)) + onClick = WebsiteClickListener( + this@showSettings, + this@showSettings.getString(R.string.url_play_developers_page) + ) } } } diff --git a/app/src/main/java/com/chillibits/colorconverter/view/DetailedFlagView.kt b/app/src/main/java/com/chillibits/colorconverter/view/DetailedFlagView.kt index 91c76be2..280ff1a4 100644 --- a/app/src/main/java/com/chillibits/colorconverter/view/DetailedFlagView.kt +++ b/app/src/main/java/com/chillibits/colorconverter/view/DetailedFlagView.kt @@ -1,5 +1,5 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ package com.chillibits.colorconverter.view @@ -22,28 +22,56 @@ class DetailedFlagView(context: Context, layout: Int) : FlagView(context, layout private val isAlphaDisabled = context.getPrefBooleanValue(Constants.ENABLE_ALPHA, true) override fun onRefresh(envelope: ColorEnvelope?) { - val flagColor = findViewById(R.id.flagColor); - val flagColorArgb = findViewById(R.id.flagColorArgb); - val flagColorHex = findViewById(R.id.flagColorHex); - val flagColorHsv = findViewById(R.id.flagColorHsv); + val flagColor = findViewById(R.id.flagColor) + val flagColorArgb = findViewById(R.id.flagColorArgb) + val flagColorHex = findViewById(R.id.flagColorHex) + val flagColorHsv = findViewById(R.id.flagColorHsv) - flagColor.background.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(envelope!!.color, BlendModeCompat.SRC_IN) - flagColorArgb.text = if(isAlphaDisabled) { - String.format(context.getString(R.string.rgb_), envelope.color.red, envelope.color.green, envelope.color.blue) + flagColor.background.colorFilter = + BlendModeColorFilterCompat.createBlendModeColorFilterCompat( + envelope!!.color, + BlendModeCompat.SRC_IN + ) + flagColorArgb.text = if (isAlphaDisabled) { + String.format( + context.getString(R.string.rgb_), + envelope.color.red, + envelope.color.green, + envelope.color.blue + ) } else { - String.format(context.getString(R.string.argb_), envelope.color.alpha, envelope.color.red, envelope.color.green, envelope.color.blue) + String.format( + context.getString(R.string.argb_), + envelope.color.alpha, + envelope.color.red, + envelope.color.green, + envelope.color.blue + ) } - flagColorHex.text = if(isAlphaDisabled) - String.format(context.getString(R.string.hex_), + flagColorHex.text = if (isAlphaDisabled) + String.format( + context.getString(R.string.hex_), "%06X".format(0xFFFFFF and envelope.color).uppercase(Locale.getDefault()) ) else - String.format(context.getString(R.string.hex_), + String.format( + context.getString(R.string.hex_), "%08X".format(envelope.color).uppercase(Locale.getDefault()) ) val hsv = FloatArray(3) - android.graphics.Color.RGBToHSV(envelope.color.red, envelope.color.green, envelope.color.blue, hsv) - flagColorHsv.text = String.format(context.getString(R.string.hsv_), String.format(Constants.HSV_FORMAT_STRING, hsv[0]), String.format( - Constants.HSV_FORMAT_STRING, hsv[1]), String.format(Constants.HSV_FORMAT_STRING, hsv[2])) + android.graphics.Color.RGBToHSV( + envelope.color.red, + envelope.color.green, + envelope.color.blue, + hsv + ) + flagColorHsv.text = String.format( + context.getString(R.string.hsv_), + String.format(Constants.HSV_FORMAT_STRING, hsv[0]), + String.format( + Constants.HSV_FORMAT_STRING, hsv[1] + ), + String.format(Constants.HSV_FORMAT_STRING, hsv[2]) + ) } } \ No newline at end of file diff --git a/app/src/main/java/com/chillibits/colorconverter/viewmodel/ColorSelectionViewModel.kt b/app/src/main/java/com/chillibits/colorconverter/viewmodel/ColorSelectionViewModel.kt index a347206d..7bb7981f 100644 --- a/app/src/main/java/com/chillibits/colorconverter/viewmodel/ColorSelectionViewModel.kt +++ b/app/src/main/java/com/chillibits/colorconverter/viewmodel/ColorSelectionViewModel.kt @@ -1,5 +1,5 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ package com.chillibits.colorconverter.viewmodel @@ -7,7 +7,7 @@ package com.chillibits.colorconverter.viewmodel import android.app.Application import androidx.lifecycle.AndroidViewModel import androidx.lifecycle.LiveData -import androidx.lifecycle.Transformations +import androidx.lifecycle.map import com.chillibits.colorconverter.model.Color import com.chillibits.colorconverter.repository.ColorRepository import com.chillibits.colorconverter.shared.toDbo @@ -25,12 +25,9 @@ class ColorSelectionViewModel @Inject constructor( ): AndroidViewModel(application) { // Variables as objects - val colors: LiveData> = Transformations.map(repository.getAll()) { colors -> + val colors: LiveData> = repository.getAll().map { colors -> colors.forEach { color -> - color.name = if (color.name.isEmpty()) - cnt.getColorNameFromColor(color.toObj()) - else - color.name + color.name = color.name.ifEmpty { cnt.getColorNameFromColor(color.toObj()) } } colors } diff --git a/app/src/main/java/com/chillibits/colorconverter/viewmodel/ImageViewModel.kt b/app/src/main/java/com/chillibits/colorconverter/viewmodel/ImageViewModel.kt index a8a90629..11d99d3f 100644 --- a/app/src/main/java/com/chillibits/colorconverter/viewmodel/ImageViewModel.kt +++ b/app/src/main/java/com/chillibits/colorconverter/viewmodel/ImageViewModel.kt @@ -1,5 +1,5 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ package com.chillibits.colorconverter.viewmodel @@ -20,7 +20,7 @@ import javax.inject.Inject class ImageViewModel @Inject constructor( application: Application, private val ct: ColorTools -): AndroidViewModel(application) { +) : AndroidViewModel(application) { // Variables as objects private val context = application @@ -54,12 +54,14 @@ class ImageViewModel @Inject constructor( private fun initializeTTS() { // Initialize tts tts = TextToSpeech(context) { status -> - if(status == TextToSpeech.SUCCESS) { + if (status == TextToSpeech.SUCCESS) { val result = tts.setLanguage(Locale.getDefault()) if (result == TextToSpeech.LANG_MISSING_DATA || result == TextToSpeech.LANG_NOT_SUPPORTED) { - Toast.makeText(context, R.string.language_not_available, Toast.LENGTH_SHORT).show() + Toast.makeText(context, R.string.language_not_available, Toast.LENGTH_SHORT) + .show() } else initialized = true - } else Toast.makeText(context, R.string.initialization_failed, Toast.LENGTH_SHORT).show() + } else Toast.makeText(context, R.string.initialization_failed, Toast.LENGTH_SHORT) + .show() } } } \ No newline at end of file diff --git a/app/src/main/java/com/chillibits/colorconverter/viewmodel/MainViewModel.kt b/app/src/main/java/com/chillibits/colorconverter/viewmodel/MainViewModel.kt index b42ffa7d..909dc2a3 100644 --- a/app/src/main/java/com/chillibits/colorconverter/viewmodel/MainViewModel.kt +++ b/app/src/main/java/com/chillibits/colorconverter/viewmodel/MainViewModel.kt @@ -1,5 +1,5 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ package com.chillibits.colorconverter.viewmodel @@ -26,7 +26,7 @@ class MainViewModel @Inject constructor( application: Application, private val repository: ColorRepository, private val cnt: ColorNameTools -): AndroidViewModel(application) { +) : AndroidViewModel(application) { // Variables as objects private val context = application @@ -50,21 +50,25 @@ class MainViewModel @Inject constructor( if (status == TextToSpeech.SUCCESS) { val result = tts.setLanguage(Locale.getDefault()) if (result == TextToSpeech.LANG_MISSING_DATA || result == TextToSpeech.LANG_NOT_SUPPORTED) { - Toast.makeText(context, R.string.language_not_available, Toast.LENGTH_SHORT).show() + Toast.makeText(context, R.string.language_not_available, Toast.LENGTH_SHORT) + .show() } else initialized = true - } else Toast.makeText(context, R.string.initialization_failed, Toast.LENGTH_SHORT).show() + } else Toast.makeText(context, R.string.initialization_failed, Toast.LENGTH_SHORT) + .show() } } @Suppress("DEPRECATION") fun speakColor() { when { - isAudioMuted() -> Toast.makeText(context, R.string.audio_muted, Toast.LENGTH_SHORT).show() + isAudioMuted() -> Toast.makeText(context, R.string.audio_muted, Toast.LENGTH_SHORT) + .show() initialized -> { val colorName = cnt.getColorNameFromColor(selectedColor) tts.speak(colorName, TextToSpeech.QUEUE_FLUSH, null, null) } - else -> Toast.makeText(context, R.string.initialization_failed, Toast.LENGTH_SHORT).show() + else -> Toast.makeText(context, R.string.initialization_failed, Toast.LENGTH_SHORT) + .show() } } diff --git a/app/src/main/res/drawable-night/splash.xml b/app/src/main/res/drawable-night/splash.xml index 6de1190f..6ae1bff0 100644 --- a/app/src/main/res/drawable-night/splash.xml +++ b/app/src/main/res/drawable-night/splash.xml @@ -1,6 +1,6 @@ diff --git a/app/src/main/res/drawable/alpha_progress.xml b/app/src/main/res/drawable/alpha_progress.xml index 26f5d70c..e1016ee1 100644 --- a/app/src/main/res/drawable/alpha_progress.xml +++ b/app/src/main/res/drawable/alpha_progress.xml @@ -1,6 +1,6 @@ diff --git a/app/src/main/res/drawable/autorenew.xml b/app/src/main/res/drawable/autorenew.xml index d55ee67f..3ce83c50 100644 --- a/app/src/main/res/drawable/autorenew.xml +++ b/app/src/main/res/drawable/autorenew.xml @@ -1,5 +1,5 @@ diff --git a/app/src/main/res/drawable/button_outline_rounded.xml b/app/src/main/res/drawable/button_outline_rounded.xml index c06c46be..46c7531d 100644 --- a/app/src/main/res/drawable/button_outline_rounded.xml +++ b/app/src/main/res/drawable/button_outline_rounded.xml @@ -1,6 +1,6 @@ diff --git a/app/src/main/res/drawable/button_outline_text.xml b/app/src/main/res/drawable/button_outline_text.xml index 6759de09..a61fc310 100644 --- a/app/src/main/res/drawable/button_outline_text.xml +++ b/app/src/main/res/drawable/button_outline_text.xml @@ -1,6 +1,6 @@ diff --git a/app/src/main/res/drawable/color_export.xml b/app/src/main/res/drawable/color_export.xml index 99d9e246..81854265 100644 --- a/app/src/main/res/drawable/color_export.xml +++ b/app/src/main/res/drawable/color_export.xml @@ -1,5 +1,5 @@ diff --git a/app/src/main/res/drawable/css_logo.xml b/app/src/main/res/drawable/css_logo.xml index f5aedc03..6c6ee0b5 100644 --- a/app/src/main/res/drawable/css_logo.xml +++ b/app/src/main/res/drawable/css_logo.xml @@ -1,5 +1,5 @@ diff --git a/app/src/main/res/drawable/star_outline.xml b/app/src/main/res/drawable/star_outline.xml index 2acde2d2..118e440f 100644 --- a/app/src/main/res/drawable/star_outline.xml +++ b/app/src/main/res/drawable/star_outline.xml @@ -1,5 +1,5 @@ diff --git a/app/src/main/res/drawable/tear_button_middle.xml b/app/src/main/res/drawable/tear_button_middle.xml index ea33a4d3..518dbd85 100644 --- a/app/src/main/res/drawable/tear_button_middle.xml +++ b/app/src/main/res/drawable/tear_button_middle.xml @@ -1,6 +1,6 @@ diff --git a/app/src/main/res/drawable/tear_button_right.xml b/app/src/main/res/drawable/tear_button_right.xml index a8765551..8fab9a20 100644 --- a/app/src/main/res/drawable/tear_button_right.xml +++ b/app/src/main/res/drawable/tear_button_right.xml @@ -1,6 +1,6 @@ diff --git a/app/src/main/res/drawable/volume_up.xml b/app/src/main/res/drawable/volume_up.xml index bbf22318..f2fe1aac 100644 --- a/app/src/main/res/drawable/volume_up.xml +++ b/app/src/main/res/drawable/volume_up.xml @@ -1,5 +1,5 @@ diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml index e236d4f7..e2cfb33e 100644 --- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -1,6 +1,6 @@ diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index aad23178..80d60213 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -1,11 +1,15 @@ + + OK diff --git a/app/src/main/res/values-de/strings_colors.xml b/app/src/main/res/values-de/strings_colors.xml index fa888d6d..6b359ed8 100644 --- a/app/src/main/res/values-de/strings_colors.xml +++ b/app/src/main/res/values-de/strings_colors.xml @@ -1,11 +1,15 @@ + + Aliceblau diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index a12ed896..8568bbd6 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -1,11 +1,15 @@ + + Aceptar diff --git a/app/src/main/res/values-es/strings_colors.xml b/app/src/main/res/values-es/strings_colors.xml index c67a3406..8b8ff719 100644 --- a/app/src/main/res/values-es/strings_colors.xml +++ b/app/src/main/res/values-es/strings_colors.xml @@ -1,11 +1,15 @@ + + Azul Alicia diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 920658e3..90dc7163 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -1,11 +1,15 @@ + + OK diff --git a/app/src/main/res/values-fr/strings_colors.xml b/app/src/main/res/values-fr/strings_colors.xml index 389d0c2c..fe08e0ae 100644 --- a/app/src/main/res/values-fr/strings_colors.xml +++ b/app/src/main/res/values-fr/strings_colors.xml @@ -1,11 +1,15 @@ + + Bleu alice diff --git a/app/src/main/res/values-night/colors.xml b/app/src/main/res/values-night/colors.xml index 415d5a4d..19076561 100644 --- a/app/src/main/res/values-night/colors.xml +++ b/app/src/main/res/values-night/colors.xml @@ -1,6 +1,6 @@ diff --git a/app/src/main/res/values-night/styles.xml b/app/src/main/res/values-night/styles.xml index 56bc775b..965b84ac 100644 --- a/app/src/main/res/values-night/styles.xml +++ b/app/src/main/res/values-night/styles.xml @@ -1,6 +1,6 @@ diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index d0ed70aa..f2e96e29 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -1,11 +1,15 @@ + + ОК diff --git a/app/src/main/res/values-v29/styles.xml b/app/src/main/res/values-v29/styles.xml index ca97bbec..0c54cf93 100644 --- a/app/src/main/res/values-v29/styles.xml +++ b/app/src/main/res/values-v29/styles.xml @@ -1,6 +1,6 @@ diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index a230813f..dcb2dfae 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -1,6 +1,6 @@ diff --git a/app/src/main/res/values/dimen.xml b/app/src/main/res/values/dimen.xml index 05b902fa..d448bb63 100644 --- a/app/src/main/res/values/dimen.xml +++ b/app/src/main/res/values/dimen.xml @@ -1,6 +1,6 @@ diff --git a/app/src/main/res/values/font_certs.xml b/app/src/main/res/values/font_certs.xml index 9c4b3373..597a87fd 100644 --- a/app/src/main/res/values/font_certs.xml +++ b/app/src/main/res/values/font_certs.xml @@ -1,6 +1,6 @@ diff --git a/app/src/main/res/values/integers.xml b/app/src/main/res/values/integers.xml index 5726b0c5..5b505f6a 100644 --- a/app/src/main/res/values/integers.xml +++ b/app/src/main/res/values/integers.xml @@ -1,6 +1,6 @@ diff --git a/app/src/main/res/values/preloaded_fonts.xml b/app/src/main/res/values/preloaded_fonts.xml index 84556c0b..db17357c 100644 --- a/app/src/main/res/values/preloaded_fonts.xml +++ b/app/src/main/res/values/preloaded_fonts.xml @@ -1,6 +1,6 @@ diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 830a7ae2..1e0c4c9f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,11 +1,15 @@ + + OK diff --git a/app/src/main/res/values/strings_colors.xml b/app/src/main/res/values/strings_colors.xml index f8bad6c5..0ccc1f57 100644 --- a/app/src/main/res/values/strings_colors.xml +++ b/app/src/main/res/values/strings_colors.xml @@ -1,11 +1,15 @@ + + Alice Blue diff --git a/app/src/main/res/values/strings_untranslatable.xml b/app/src/main/res/values/strings_untranslatable.xml index 07dedc63..49b303ea 100644 --- a/app/src/main/res/values/strings_untranslatable.xml +++ b/app/src/main/res/values/strings_untranslatable.xml @@ -1,6 +1,6 @@ diff --git a/app/src/main/res/values/strings_urls.xml b/app/src/main/res/values/strings_urls.xml index 7a117394..c46a6ff3 100644 --- a/app/src/main/res/values/strings_urls.xml +++ b/app/src/main/res/values/strings_urls.xml @@ -1,6 +1,6 @@ diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 181bbe33..7408cf9d 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -1,5 +1,5 @@ diff --git a/app/src/main/res/xml-v25/shortcuts.xml b/app/src/main/res/xml-v25/shortcuts.xml index 4c9b92a5..f28947bc 100644 --- a/app/src/main/res/xml-v25/shortcuts.xml +++ b/app/src/main/res/xml-v25/shortcuts.xml @@ -1,6 +1,6 @@ diff --git a/app/src/main/res/xml/file_paths.xml b/app/src/main/res/xml/file_paths.xml index e523710d..c309e59d 100644 --- a/app/src/main/res/xml/file_paths.xml +++ b/app/src/main/res/xml/file_paths.xml @@ -1,6 +1,6 @@ diff --git a/app/src/main/res/xml/shortcuts.xml b/app/src/main/res/xml/shortcuts.xml index a7f7eb1b..68f623b4 100644 --- a/app/src/main/res/xml/shortcuts.xml +++ b/app/src/main/res/xml/shortcuts.xml @@ -1,6 +1,6 @@ diff --git a/app/src/test/java/com/chillibits/colorconverter/ExampleUnitTest.kt b/app/src/test/java/com/chillibits/colorconverter/ExampleUnitTest.kt index 21e5ebb9..654faf6c 100644 --- a/app/src/test/java/com/chillibits/colorconverter/ExampleUnitTest.kt +++ b/app/src/test/java/com/chillibits/colorconverter/ExampleUnitTest.kt @@ -1,5 +1,5 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ package com.chillibits.colorconverter diff --git a/build.gradle b/build.gradle index c4be28a0..229c00e9 100644 --- a/build.gradle +++ b/build.gradle @@ -1,21 +1,21 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ buildscript { - ext.kotlin_version = '1.8.0' - ext.room_version = '2.4.3' - ext.hilt_version = '2.44.2' + ext.kotlin_version = '1.8.10' + ext.room_version = '2.5.1' + ext.hilt_version = '2.45' repositories { google() mavenCentral() maven { url "https://plugins.gradle.org/m2/" } } dependencies { - classpath 'com.android.tools.build:gradle:7.3.1' + classpath 'com.android.tools.build:gradle:7.4.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version" - classpath 'com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:10.5.2' + classpath 'com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:10.6.1' } } diff --git a/gradle.properties b/gradle.properties index 5f98880f..181444bb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ # -# Copyright © Marc Auberer 2017-2022. All rights reserved +# Copyright © Marc Auberer 2017-2023. All rights reserved # # Project-wide Gradle settings. diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index aed6ae51..6755eeb5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,10 @@ +# +# Copyright © Marc Auberer 2017-2023. All rights reserved +# + #Tue Dec 27 23:43:05 CET 2022 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 70375b55..09b282c0 100644 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ #!/usr/bin/env sh # -# Copyright © Marc Auberer 2017-2022. All rights reserved +# Copyright © Marc Auberer 2017-2023. All rights reserved # ############################################################################## diff --git a/settings.gradle b/settings.gradle index 2997ed1c..2d9bec06 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,5 +1,5 @@ /* - * Copyright © Marc Auberer 2017-2022. All rights reserved + * Copyright © Marc Auberer 2017-2023. All rights reserved */ include ':app'