Skip to content

Commit

Permalink
Merge pull request #38 from ChilliBits/beta
Browse files Browse the repository at this point in the history
Release to version 2.3.0
  • Loading branch information
marcauberer authored Jun 30, 2020
2 parents 6ab1d69 + af3f2d8 commit 8a2ee48
Show file tree
Hide file tree
Showing 57 changed files with 771 additions and 283 deletions.
8 changes: 7 additions & 1 deletion .idea/dictionaries/I516467.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/dictionaries/Marc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ More information on our homepage: [https://chillibits.com/colorconverter](https:
## Features
- Pick colors
- Get name of picked colors
- Display picked colors in different formats (ARGB, HEX, HSV)
- Display picked colors in different formats (ARGB, HEX, HSV, CMYK)
- Generate random colors
- Pick color from a photo / image
- Save / load colors
- Copy colors to clipboard

## Screenshots (Android 10)
<img src="https://github.com/chillibits/color-converter/raw/master/screenshots/1.png" width="256" title="Screenshot 1"><img src="https://github.com/chillibits/color-converter/raw/master/screenshots/2.png" width="256" title="Screenshot 2"><img src="https://github.com/chillibits/color-converter/raw/master/screenshots/3.png" width="256" title="Screenshot 3"><img src="https://github.com/chillibits/color-converter/raw/master/screenshots/4.png" width="256" title="Screenshot 4"><img src="https://github.com/chillibits/color-converter/raw/master/screenshots/5.png" width="256" title="Screenshot 5"><img src="https://github.com/chillibits/color-converter/raw/master/screenshots/6.png" width="256" title="Screenshot 6">
Expand All @@ -28,7 +29,6 @@ You can contribute to this project by doing following things:

## Used third party libraries
Thanks to following people:

- [Glide](https://github.com/bumptech/glide) by Bump Technologies
- [ColorPickerPreference](https://github.com/attenzione/android-ColorPickerPreference) by Sergey Margaritov
- [PixImagePicker](https://github.com/akshay2211/PixImagePicker) by Akshay Sharma
Expand Down
33 changes: 21 additions & 12 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ android {
applicationId "com.mrgames13.jimdo.colorconverter"
minSdkVersion 21
targetSdkVersion 29
versionCode 2201
versionName "2.2.1"
versionCode 2300
versionName "2.3.0"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand All @@ -37,12 +37,12 @@ dependencies {
// base dependencies
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.3.0-alpha01'
implementation 'androidx.core:core-ktx:1.4.0-alpha01'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta6'
implementation 'androidx.core:core-ktx:1.5.0-alpha01'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta7'
implementation 'com.google.android.instantapps:instantapps:1.1.0'
implementation 'com.google.android.play:core:1.7.3'
implementation 'androidx.palette:palette-ktx:1.0.0'
implementation 'com.google.android.material:material:1.2.0-alpha06'
implementation 'com.google.android.material:material:1.3.0-alpha01'

// External dependencies
implementation 'net.margaritov.preference.colorpicker.ColorPickerPreference:ColorPickerPreference:1.0.0'
Expand All @@ -51,13 +51,13 @@ dependencies {
implementation 'com.github.skydoves:colorpickerview:2.1.6'
implementation 'com.mikepenz:iconics-core:5.0.3'
implementation 'com.mikepenz:material-design-iconic-typeface:2.2.0.6-kotlin@aar'
implementation 'com.mikepenz:fastadapter:5.0.2'
implementation 'com.mikepenz:fastadapter:5.1.0'
implementation 'com.github.javiersantos:MaterialStyledDialogs:3.0.1'

// dependencies for testing
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.2-beta02'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-beta02'
androidTestImplementation 'androidx.test.ext:junit:1.1.2-rc01'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-rc01'
}

// Task for downloading all translation files
Expand All @@ -68,7 +68,7 @@ task downloadTranslations {
ext.apiKey = 'IEKWn_DI-otivDlUWAN-NvNIT3bBWO_h'
ext.apiKeyColors = 'ReBhdq025DTUFKoKIvmvLLyY6hznXyCg'

//English
// English
doLast {
// Main string file
def f = new File("${project.projectDir}/src/main/res/values/strings.xml")
Expand All @@ -77,7 +77,7 @@ task downloadTranslations {
f = new File("${project.projectDir}/src/main/res/values/strings_colors.xml")
new URL("https://localise.biz/api/export/locale/en.xml?format=android&key=${apiKeyColors}").withInputStream{ i -> f.withOutputStream{ it << i }}
}
//French
// French
doLast {
// Main string file
def f = new File("${project.projectDir}/src/main/res/values-fr/strings.xml")
Expand All @@ -86,7 +86,7 @@ task downloadTranslations {
f = new File("${project.projectDir}/src/main/res/values-fr/strings_colors.xml")
new URL("https://localise.biz/api/export/locale/fr.xml?format=android&key=${apiKeyColors}").withInputStream{ i -> f.withOutputStream{ it << i }}
}
//German
// German
doLast {
// Main string file
def f = new File("${project.projectDir}/src/main/res/values-de/strings.xml")
Expand All @@ -95,7 +95,7 @@ task downloadTranslations {
f = new File("${project.projectDir}/src/main/res/values-de/strings_colors.xml")
new URL("https://localise.biz/api/export/locale/de.xml?format=android&key=${apiKeyColors}").withInputStream{ i -> f.withOutputStream{ it << i }}
}
//Spanish
// Spanish
doLast {
// Main string file
def f = new File("${project.projectDir}/src/main/res/values-es/strings.xml")
Expand All @@ -104,6 +104,15 @@ task downloadTranslations {
f = new File("${project.projectDir}/src/main/res/values-es/strings_colors.xml")
new URL("https://localise.biz/api/export/locale/es.xml?format=android&key=${apiKeyColors}").withInputStream{ i -> f.withOutputStream{ it << i }}
}
// Russian
doLast {
// Main string file
def f = new File("${project.projectDir}/src/main/res/values-ru/strings.xml")
new URL("https://localise.biz/api/export/locale/ru.xml?format=android&key=${apiKey}").withInputStream{ i -> f.withOutputStream{ it << i }}
// Color file (not translated to Russian yet)
//f = new File("${project.projectDir}/src/main/res/values-ru/strings_colors.xml")
//new URL("https://localise.biz/api/export/locale/ru.xml?format=android&key=${apiKeyColors}").withInputStream{ i -> f.withOutputStream{ it << i }}
}
}

preBuild.dependsOn downloadTranslations
Binary file added app/src/main/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import org.jetbrains.annotations.NotNull
class Color: Comparable<Color> {

// Attributes
var id: Int
val id: Int
var name: String
var color: Int
var alpha: Int
var red: Int
var green: Int
var blue: Int
var creationTimestamp: Long = System.currentTimeMillis()
var creationTimestamp = System.currentTimeMillis()

constructor(id: Int, name: String, color: Int, creationTimestamp: Long) {
this.id = id
Expand Down
69 changes: 34 additions & 35 deletions app/src/main/java/com/chillibits/colorconverter/tools/ColorTools.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,49 +12,48 @@ import android.graphics.Color
import androidx.core.content.ContextCompat
import androidx.palette.graphics.Palette
import com.mrgames13.jimdo.colorconverter.R

import kotlin.math.max
import kotlin.math.roundToInt

class ColorTools(private var context: Context) {
fun getVibrantColor(image: Bitmap): Int {
val palette = Palette.from(image).generate()
return palette.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): Int {
val palette = Palette.from(image).generate()
return palette.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): Int {
val palette = Palette.from(image).generate()
return palette.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): Int {
val palette = Palette.from(image).generate()
return palette.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): Int {
val palette = Palette.from(image).generate()
return palette.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): Int {
val palette = Palette.from(image).generate()
return palette.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): Int {
return 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 {
return when (activity.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK) {
Configuration.UI_MODE_NIGHT_NO -> Color.BLACK
Configuration.UI_MODE_NIGHT_YES -> Color.WHITE
else -> Color.BLACK
}
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 {
when (activity.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK) {
Configuration.UI_MODE_NIGHT_NO -> Color.BLACK
Configuration.UI_MODE_NIGHT_YES -> Color.WHITE
else -> Color.BLACK
}
}

fun getCmykFromRgb(red: Int, green: Int, blue: Int): Array<Int> {
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
val k = 100.0 - max(max(redPercentage, greenPercentage), bluePercentage)
val c = (100.0 - redPercentage - k) / (100.0 - k) * 100.0
val m = (100.0 - greenPercentage - k) / (100.0 - k) * 100.0
val y = (100.0 - bluePercentage - k) / (100.0 - k) * 100.0
return arrayOf(c.roundToInt(), m.roundToInt(), y.roundToInt(), k.roundToInt())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,17 @@ object Constants {
const val EXTRA_COLOR = "Color"
const val EXTRA_SELECTED_COLOR = "SelectedColor"

// Shared Preferences keys
const val ARGB_REMEMBER = "ArgbRemember"
const val ARGB_REMEMBER_SELECTION = "ArgbRememberSelection"
const val CMYK_REMEMBER = "CmykRemember"
const val CMYK_REMEMBER_SELECTION = "CmykRememberSelection"
const val SPEAK_COLOR = "speak_color"
const val DISABLE_ALPHA = "disable_alpha"

// Other 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"
const val ARGB_REMEMBER = "ArgbRemember"
const val ARGB_REMEMBER_SELECTION = "ArgbRememberSelection"
}
Loading

0 comments on commit 8a2ee48

Please sign in to comment.