Skip to content

Commit

Permalink
Merge pull request #139 from ChilliBits/dev
Browse files Browse the repository at this point in the history
Release of version 2.6.0
  • Loading branch information
marcauberer committed Feb 23, 2021
2 parents d3dfd60 + 9b221f4 commit b018138
Show file tree
Hide file tree
Showing 33 changed files with 280 additions and 123 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/main.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,4 @@ jobs:
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Android Build
uses: vgaidarji/android-github-actions-build@v1.0.1
with:
args: "./gradlew assembleDebug"
run: ./gradlew assembleDebug
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ More information on our homepage: [https://chillibits.com/colorconverter](https:
You can contribute to this project by doing following things:
- If you want to contribute new features, please fork this repository to your own GitHub account. Then build your awesome feature and open a pull request back to this repo. We will check your changes and merge your contribution asap.
- If you want to add a new translation language or improve an existing translation, please write an email to: [contact@chillibits.com](mailto:contact@chillibits.com&subject=Add%20translation)
- If you want to submit a request for a new feature, please also write an email to: [contact@chillibits.com](mailto:contact@chillibits.com&subject=Feature%20request)
- If you want to submit a request for a new feature, please [open an issue on GitHub](https://github.com/ChilliBits/color-converter/issues/new).

## Used third party libraries
Thanks to following people:
Expand All @@ -37,6 +37,7 @@ Thanks to following people:
- [ColorPickerView](https://github.com/skydoves/ColorPickerView) by Jaewoong Eum
- [AndroidIconics](https://github.com/mikepenz/Android-Iconics) by Mike Penz
- [MaterialStyledDialogs](https://github.com/javiersantos/MaterialStyledDialogs) by Javier Santos
- [SimpleSettings](https://github.com/marcauberer/simple-settings) by Marc Auberer
- [AdobeColorTool](https://github.com/marcauberer/adobe-color-tool) by Marc Auberer

Thanks to all contributors and translators!
Expand Down
12 changes: 9 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ android {
applicationId "com.mrgames13.jimdo.colorconverter"
minSdkVersion 21
targetSdkVersion 30
versionCode 2504
versionName "2.5.4"
versionCode 2600
versionName "2.6.0"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
Expand All @@ -33,6 +34,10 @@ android {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
packagingOptions {
pickFirst '**/META-INFMANIFEST.MF'
pickFirst 'META-INF/library_release.kotlin_module'
}
}

dependencies {
Expand All @@ -58,6 +63,7 @@ dependencies {
implementation 'com.github.javiersantos:MaterialStyledDialogs:3.0.2'

// ChilliBits dependencies
implementation 'com.chillibits:simplesettings:1.2.0'
implementation 'com.chillibits:adobecolortool:1.0.0'

// Room dependencies
Expand All @@ -72,7 +78,7 @@ dependencies {
kapt "androidx.hilt:hilt-compiler:$hilt_viewmodel_version"

// dependencies for testing
testImplementation 'junit:junit:4.13.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class ColorRepository @Inject constructor(db: AppDatabase) {

// Variables as objects
private val colorDao = db.colorDao()
val colors = colorDao.getAll()

fun getAll() = colorDao.getAll()
fun insert(color: ColorDbo) = colorDao.insert(color)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ object Constants {
const val CMYK_REMEMBER = "CmykRemember"
const val CMYK_REMEMBER_SELECTION = "CmykRememberSelection"
const val SPEAK_COLOR = "speak_color"
const val DISABLE_ALPHA = "disable_alpha"
const val ENABLE_ALPHA = "enable_alpha"

// Other constants
const val DB_NAME = "database.db"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import androidx.room.PrimaryKey

@Entity(tableName = "colors")
data class ColorDbo(
@PrimaryKey(autoGenerate = true)
@PrimaryKey(autoGenerate = true)
@ColumnInfo(name = "id") val id: Int,
@ColumnInfo(name = "name") val 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
@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
Expand Up @@ -11,6 +11,7 @@ import com.chillibits.colorconverter.shared.copyTextToClipboard
import com.chillibits.colorconverter.shared.round
import com.chillibits.colorconverter.ui.dialog.showArgbExportDialog
import com.chillibits.colorconverter.ui.dialog.showCmykExportDialog
import com.chillibits.simplesettings.tool.getPrefBooleanValue
import com.mrgames13.jimdo.colorconverter.R
import java.util.*

Expand All @@ -23,42 +24,39 @@ class ClipboardTools(
fun copyNameToClipboard(name: String) = context.copyTextToClipboard(context.getString(R.string.color_name), name)

fun copyArgbToClipboard(color: Color) = context.run {
if (st.getBoolean(Constants.DISABLE_ALPHA)) {
copyTextToClipboard(
getString(R.string.rgb_code), String.format(
getString(R.string.rgb_clipboard),
color.red, color.green, color.blue
)
)
} else {
if (getPrefBooleanValue(Constants.ENABLE_ALPHA, true)) {
// Show multiple choice dialog
if (!st.getBoolean(Constants.ARGB_REMEMBER, false)) {
if (!getPrefBooleanValue(Constants.ARGB_REMEMBER, false)) {
showArgbExportDialog(st, color.alpha, color.red, color.green, color.blue)
} else if (st.getBoolean(Constants.ARGB_REMEMBER_SELECTION, false)) {
} 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_clipboard),
color.red, color.green, color.blue)
)
}
}

fun copyHexToClipboard(color: Color) = context.run {
copyTextToClipboard(
getString(R.string.hex_code),
if (st.getBoolean(Constants.DISABLE_ALPHA))
"#%06X".format(0xFFFFFF and color.color).toUpperCase(Locale.getDefault())
else
if (getPrefBooleanValue(Constants.ENABLE_ALPHA, true))
"#%08X".format(color.color).toUpperCase(Locale.getDefault())
else
"#%06X".format(0xFFFFFF and color.color).toUpperCase(Locale.getDefault())
)
}

Expand All @@ -72,12 +70,12 @@ class ClipboardTools(
copyTextToClipboard(getString(R.string.hsv_clipboard), hsvString)
}

fun copyCmykToClipboard(color: Color) = context.run {
fun copyCMYKToClipboard(color: Color) = context.run {
// Show multiple choice dialog
val cmyk = ct.getCmykFromRgb(color.red, color.green, color.blue)
if (!st.getBoolean(Constants.CMYK_REMEMBER, false)) {
if (!getPrefBooleanValue(Constants.CMYK_REMEMBER, false)) {
showCmykExportDialog(st, cmyk[0], cmyk[1], cmyk[2], cmyk[3])
} else if (st.getBoolean(Constants.CMYK_REMEMBER_SELECTION, false)) {
} else if (getPrefBooleanValue(Constants.CMYK_REMEMBER_SELECTION, false)) {
copyTextToClipboard(
getString(R.string.cmyk_code), String.format(
getString(R.string.cmyk_clipboard),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,11 @@
package com.chillibits.colorconverter.tools

import android.content.Context
import com.chillibits.colorconverter.shared.Constants
import com.chillibits.simplesettings.tool.getPrefs
import javax.inject.Inject

class StorageTools @Inject constructor(val context: Context) {

// Variables as objects
private val prefs = context.getSharedPreferences(Constants.SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE)

fun putBoolean(name: String, value: Boolean) = prefs.edit().putBoolean(name, value).apply()
fun getBoolean(name: String, default: Boolean = false) = prefs.getBoolean(name, default)
fun putInt(name: String, value: Int) = prefs.edit().putInt(name, value).apply()
fun getInt(name: String, default: Int = 0) = prefs.getInt(name, default)
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()
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class ColorSelectionActivity : AppCompatActivity(), ColorsAdapter.ColorSelection
supportActionBar?.setDisplayHomeAsUpEnabled(true)

// Initialize RecyclerView
adapter = ColorsAdapter(this, this, st, ct, cnt)
adapter = ColorsAdapter(this, this, ct, cnt)
savedColors.layoutManager = LinearLayoutManager(this)
savedColors.adapter = adapter

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import com.chillibits.colorconverter.tools.ColorNameTools
import com.chillibits.colorconverter.tools.StorageTools
import com.chillibits.colorconverter.view.DetailedFlagView
import com.chillibits.colorconverter.viewmodel.ImageViewModel
import com.chillibits.simplesettings.tool.getPrefBooleanValue
import com.fxn.pix.Options
import com.fxn.pix.Pix
import com.fxn.utility.PermUtil
Expand Down Expand Up @@ -71,7 +72,7 @@ class ImageActivity : AppCompatActivity() {
selectedColor.background.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(color, BlendModeCompat.SRC_IN)
if(speakItem != null && speakItem!!.isChecked) speakColor()
}
image.flagView = DetailedFlagView(this, R.layout.flag_layout, st).apply {
image.flagView = DetailedFlagView(this, R.layout.flag_layout).apply {
isFlipAble = false
}

Expand Down Expand Up @@ -99,7 +100,7 @@ class ImageActivity : AppCompatActivity() {
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
menuInflater.inflate(R.menu.menu_activity_image, menu)
speakItem = menu?.getItem(0)
speakItem?.isChecked = st.getBoolean(Constants.SPEAK_COLOR)
speakItem?.isChecked = getPrefBooleanValue(Constants.SPEAK_COLOR)
return true
}

Expand Down

0 comments on commit b018138

Please sign in to comment.