Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
marcauberer committed Dec 14, 2024
1 parent 73bd5d2 commit 86529d8
Show file tree
Hide file tree
Showing 17 changed files with 41 additions and 83 deletions.
13 changes: 7 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ android {

dependencies {
// base dependencies
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'androidx.core:core-ktx:1.15.0'
implementation 'androidx.constraintlayout:constraintlayout:2.2.0'
implementation 'com.google.android.instantapps:instantapps:1.1.0'
Expand All @@ -65,11 +65,12 @@ dependencies {
// External dependencies
implementation 'net.margaritov.preference.colorpicker.ColorPickerPreference:ColorPickerPreference:1.0.0'
implementation 'com.fxn769:pix:1.5.6'
implementation 'com.github.skydoves:colorpickerview:2.2.4'
implementation 'com.github.skydoves:colorpickerview:2.3.0'
implementation 'com.mikepenz:iconics-core:5.5.0-compose01'
implementation 'com.mikepenz:material-design-iconic-typeface:2.2.0.9-kotlin@aar'
implementation 'com.github.javiersantos:MaterialStyledDialogs:3.0.2'
implementation 'com.github.numerative:Five-Star-Me:2.1.2'
implementation 'com.github.florent37:inline-activity-result-kotlin:1.0.4'

// ChilliBits dependencies
implementation 'com.chillibits:simplesettings:1.3.4'
Expand All @@ -86,17 +87,17 @@ dependencies {

// dependencies for testing
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
}

// Task for downloading all translation files
task downloadTranslations {
group 'pre-build tasks'
description 'Downloads all translation files when building the app.'

ext.apiKey = 'cUnfQzJMGOihCQd0fvd4-c4FgYefuTB4'
ext.apiKeyColors = 'yHOCAB47RYyEPn9Ac_HbFp0aYMHszSwZ'
ext.apiKey = 'ZTYy3-p8ft270O7VoRKT6Z4KlB82se0v'
ext.apiKeyColors = 'bEBfSeE6O6SE-wtk-M1DqTCK5mjo3mHU'

// English
doLast {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import androidx.sqlite.db.SupportSQLiteDatabase

// Migration from SQLite API to Room
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);")
database.execSQL("INSERT INTO colors SELECT * FROM tmp;")
override fun migrate(db: SupportSQLiteDatabase) {
db.execSQL("ALTER TABLE Colors RENAME TO tmp;")
db.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);")
db.execSQL("INSERT INTO colors SELECT * FROM tmp;")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ class ClipboardTools(
android.graphics.Color.RGBToHSV(color.red, color.green, color.blue, 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(Locale.getDefault(), Constants.HSV_FORMAT_STRING, hsv[0]),
String.format(Locale.getDefault(), Constants.HSV_FORMAT_STRING, hsv[1]),
String.format(Locale.getDefault(), Constants.HSV_FORMAT_STRING, hsv[2])
)
copyTextToClipboard(getString(R.string.hsv_clipboard), hsvString)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class ImageActivity : AppCompatActivity() {
applyRotation(
BitmapFactory.decodeFile(vm.imageUri),
vm.imageUri!!
)!!
)
)
} catch (e: IOException) {
Toast.makeText(this, R.string.error, Toast.LENGTH_SHORT).show()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,13 @@ class MainActivity : AppCompatActivity(), ColorsAdapter.ColorSelectionListener,
// Tools packages
@Inject
lateinit var st: StorageTools

@Inject
lateinit var ct: ColorTools

@Inject
lateinit var cnt: ColorNameTools

@Inject
lateinit var cbt: ClipboardTools

Expand Down Expand Up @@ -158,6 +161,7 @@ class MainActivity : AppCompatActivity(), ColorsAdapter.ColorSelectionListener,
)
)
}

Constants.REQ_LOAD_COLOR -> {
if (resultCode == Activity.RESULT_OK)
updateDisplays(
Expand Down Expand Up @@ -200,6 +204,7 @@ class MainActivity : AppCompatActivity(), ColorsAdapter.ColorSelectionListener,
}
setDecorFitsSystemWindows(false)
}

Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q -> {
decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or
View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
Expand All @@ -215,6 +220,7 @@ class MainActivity : AppCompatActivity(), ColorsAdapter.ColorSelectionListener,
insets
}
}

else -> {
addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
statusBarColor = ContextCompat.getColor(context, R.color.colorPrimaryDark)
Expand All @@ -240,12 +246,9 @@ class MainActivity : AppCompatActivity(), ColorsAdapter.ColorSelectionListener,
val hexValue = dialogView.findViewById<TextInputEditText>(R.id.dialogHex)
if (!isAlphaEnabled)
hexValue.setText(
String.format(
getString(
R.string.hex_format,
"%06X".format((0xFFFFFF and vm.selectedColor.color))
.uppercase(Locale.getDefault())
)
String.format(getString(R.string.hex_format),
"%06X".format((0xFFFFFF and vm.selectedColor.color))
.uppercase(Locale.getDefault())
)
)
else
Expand Down Expand Up @@ -417,9 +420,9 @@ class MainActivity : AppCompatActivity(), ColorsAdapter.ColorSelectionListener,
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])
String.format(Locale.getDefault(), Constants.HSV_FORMAT_STRING, hsv[0]),
String.format(Locale.getDefault(), Constants.HSV_FORMAT_STRING, hsv[1]),
String.format(Locale.getDefault(), Constants.HSV_FORMAT_STRING, hsv[2])
)
// Update CMYK TextView
val cmyk = ct.getCmykFromRgb(color.red, color.green, color.blue)
Expand Down Expand Up @@ -516,9 +519,9 @@ class MainActivity : AppCompatActivity(), ColorsAdapter.ColorSelectionListener,
)
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])
String.format(Locale.getDefault(), Constants.HSV_FORMAT_STRING, hsv[0]),
String.format(Locale.getDefault(), Constants.HSV_FORMAT_STRING, hsv[1]),
String.format(Locale.getDefault(), Constants.HSV_FORMAT_STRING, hsv[2])
)
val cmyk =
ct.getCmykFromRgb(vm.selectedColor.red, vm.selectedColor.green, vm.selectedColor.blue)
Expand Down
7 changes: 1 addition & 6 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright © Marc Auberer 2017-2024. All rights reserved
-->

<!--
Loco xml export: Android string resources
Project: Color Converter
Release: Working copy
Locale: de, German
Exported by: ChilliBits
Exported at: Thu, 04 Jan 2024 13:56:58 +0000
Exported at: Thu, 31 Oct 2024 23:17:57 +0000
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="ok">OK</string>
Expand Down
7 changes: 1 addition & 6 deletions app/src/main/res/values-de/strings_colors.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright © Marc Auberer 2017-2024. All rights reserved
-->

<!--
Loco xml export: Android string resources
Project: Color Converter Colors
Release: Working copy
Locale: de, German
Exported by: ChilliBits
Exported at: Thu, 04 Jan 2024 13:56:58 +0000
Exported at: Thu, 31 Oct 2024 23:17:57 +0000
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="color_alice_blue">Aliceblau</string>
Expand Down
7 changes: 1 addition & 6 deletions app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright © Marc Auberer 2017-2024. All rights reserved
-->

<!--
Loco xml export: Android string resources
Project: Color Converter
Release: Working copy
Locale: es, Spanish
Exported by: ChilliBits
Exported at: Thu, 04 Jan 2024 13:56:58 +0000
Exported at: Thu, 31 Oct 2024 23:17:57 +0000
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="ok">Aceptar</string>
Expand Down
7 changes: 1 addition & 6 deletions app/src/main/res/values-es/strings_colors.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright © Marc Auberer 2017-2024. All rights reserved
-->

<!--
Loco xml export: Android string resources
Project: Color Converter Colors
Release: Working copy
Locale: es, Spanish
Exported by: ChilliBits
Exported at: Thu, 04 Jan 2024 13:56:58 +0000
Exported at: Thu, 31 Oct 2024 23:17:58 +0000
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="color_alice_blue">Azul Alicia</string>
Expand Down
7 changes: 1 addition & 6 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright © Marc Auberer 2017-2024. All rights reserved
-->

<!--
Loco xml export: Android string resources
Project: Color Converter
Release: Working copy
Locale: fr, French
Exported by: ChilliBits
Exported at: Thu, 04 Jan 2024 13:56:58 +0000
Exported at: Thu, 31 Oct 2024 23:17:57 +0000
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="ok">OK</string>
Expand Down
7 changes: 1 addition & 6 deletions app/src/main/res/values-fr/strings_colors.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright © Marc Auberer 2017-2024. All rights reserved
-->

<!--
Loco xml export: Android string resources
Project: Color Converter Colors
Release: Working copy
Locale: fr, French
Exported by: ChilliBits
Exported at: Thu, 04 Jan 2024 13:56:58 +0000
Exported at: Thu, 31 Oct 2024 23:17:57 +0000
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="color_alice_blue">Bleu alice</string>
Expand Down
7 changes: 1 addition & 6 deletions app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright © Marc Auberer 2017-2024. All rights reserved
-->

<!--
Loco xml export: Android string resources
Project: Color Converter
Release: Working copy
Locale: ru, Russian
Exported by: ChilliBits
Exported at: Thu, 04 Jan 2024 13:56:59 +0000
Exported at: Thu, 31 Oct 2024 23:17:58 +0000
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="ok">ОК</string>
Expand Down
7 changes: 1 addition & 6 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright © Marc Auberer 2017-2024. All rights reserved
-->

<!--
Loco xml export: Android string resources
Project: Color Converter
Release: Working copy
Locale: en, English
Exported by: ChilliBits
Exported at: Thu, 04 Jan 2024 13:56:57 +0000
Exported at: Thu, 31 Oct 2024 23:17:57 +0000
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="ok">OK</string>
Expand Down
7 changes: 1 addition & 6 deletions app/src/main/res/values/strings_colors.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright © Marc Auberer 2017-2024. All rights reserved
-->

<!--
Loco xml export: Android string resources
Project: Color Converter Colors
Release: Working copy
Locale: en, English
Exported by: ChilliBits
Exported at: Thu, 04 Jan 2024 13:56:58 +0000
Exported at: Thu, 31 Oct 2024 23:17:57 +0000
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="color_alice_blue">Alice Blue</string>
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ buildscript {
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath 'com.android.tools.build:gradle:8.2.2'
classpath 'com.android.tools.build:gradle:8.7.3'
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:11.2.3'
Expand Down
1 change: 0 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,5 @@ android.useAndroidX=true
android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#Tue Dec 27 23:43:05 CET 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

0 comments on commit 86529d8

Please sign in to comment.