Skip to content

Commit

Permalink
Merge pull request #308 from chillibits/dev
Browse files Browse the repository at this point in the history
Release of version 2.8.1
  • Loading branch information
marcauberer authored Mar 24, 2023
2 parents 5a3eb6a + ecfc671 commit 361d325
Show file tree
Hide file tree
Showing 117 changed files with 670 additions and 367 deletions.
24 changes: 12 additions & 12 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
25 changes: 13 additions & 12 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © Marc Auberer 2017-2022. All rights reserved
* Copyright © Marc Auberer 2017-2023. All rights reserved
*/

plugins {
Expand All @@ -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"
}
Expand Down Expand Up @@ -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
Expand All @@ -85,17 +86,17 @@ 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
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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © Marc Auberer 2017-2022. All rights reserved
* Copyright © Marc Auberer 2017-2023. All rights reserved
*/

package com.chillibits.colorconverter
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright © Marc Auberer 2017-2022. All rights reserved
~ Copyright © Marc Auberer 2017-2023. All rights reserved
-->

<manifest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © Marc Auberer 2017-2022. All rights reserved
* Copyright © Marc Auberer 2017-2023. All rights reserved
*/

package com.chillibits.colorconverter
Expand All @@ -8,4 +8,4 @@ import android.app.Application
import dagger.hilt.android.HiltAndroidApp

@HiltAndroidApp
class ColorConverterApplication: Application()
class ColorConverterApplication : Application()
17 changes: 12 additions & 5 deletions app/src/main/java/com/chillibits/colorconverter/model/Color.kt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -8,22 +8,29 @@ import androidx.core.graphics.alpha
import androidx.core.graphics.blue
import androidx.core.graphics.green
import androidx.core.graphics.red
import org.jetbrains.annotations.NotNull

class Color(
var id: Int,
var name: String,
var color: Int,
var creationTimestamp: Long = System.currentTimeMillis()
): Comparable<Color> {
) : Comparable<Color> {

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)
}
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"
Expand All @@ -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"
}
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
}
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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);")
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
)
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)) {
Expand All @@ -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
)
)
}
}
Expand All @@ -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)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
}
Loading

0 comments on commit 361d325

Please sign in to comment.