Skip to content

Commit

Permalink
Merge pull request #16 from ChilliBits/beta
Browse files Browse the repository at this point in the history
Release to version 2.1.1
  • Loading branch information
marcauberer authored Mar 3, 2020
2 parents 6033caf + e704797 commit cb9033e
Show file tree
Hide file tree
Showing 31 changed files with 211 additions and 151 deletions.
3 changes: 0 additions & 3 deletions .idea/codeStyles/Project.xml

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

3 changes: 3 additions & 0 deletions .idea/dictionaries/Marc.xml

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

4 changes: 3 additions & 1 deletion .idea/gradle.xml

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

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ Thanks to following people:

Thanks to all contributers and translators!

© ChilliBits 2017-2020 (Designed and developed by Marc Auberer from 2017 to 2020)
© ChilliBits 2017-2020 (Designed and developed by Marc Auberer)
15 changes: 7 additions & 8 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 19
targetSdkVersion 29
versionCode 210
versionName "2.1.0"
versionCode 211
versionName "2.1.1"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand All @@ -36,13 +36,13 @@ android {
dependencies {
// base dependencies
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
api 'androidx.appcompat:appcompat:1.1.0'
api 'androidx.core:core-ktx:1.2.0-rc01'
api 'androidx.constraintlayout:constraintlayout:2.0.0-beta4'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.3.0-alpha01'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4'
implementation 'com.google.android.instantapps:instantapps:1.1.0'
implementation 'com.google.android.play:core:1.6.4'
implementation 'com.google.android.play:core:1.6.5'
implementation 'androidx.palette:palette:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'net.margaritov.preference.colorpicker.ColorPickerPreference:ColorPickerPreference:1.0.0'
implementation 'com.github.bumptech.glide:glide:4.11.0'
implementation 'com.fxn769:pix:1.4.4'
Expand All @@ -52,7 +52,6 @@ dependencies {
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
api 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.61'
}

// Task for downloading all translation files
Expand Down
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
xmlns:dist="http://schemas.android.com/apk/distribution"
xmlns:tools="http://schemas.android.com/tools"
package="com.mrgames13.jimdo.colorconverter"
tools:ignore="LockedOrientationActivity"
android:installLocation="auto">

<dist:module dist:instant="true" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
package com.chillibits.colorconverter.tools

import android.content.res.ColorStateList
import android.content.res.Resources
import android.widget.ImageView
import androidx.core.widget.ImageViewCompat

fun ImageView.setTint(color: Int) {
ImageViewCompat.setImageTintList(this, ColorStateList.valueOf(color))
}
}

fun dpToPx(dp: Int) = (dp * Resources.getSystem().displayMetrics.density).toInt()
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ class ColorSelectionActivity : AppCompatActivity() {
// Load colors
colors = st.loadColors()

saved_colors.layoutManager = LinearLayoutManager(this)
saved_colors.adapter = ColorsAdapter(this, colors)
no_items.visibility = if (colors.size > 0) View.GONE else View.VISIBLE
savedColors.layoutManager = LinearLayoutManager(this)
savedColors.adapter = ColorsAdapter(this, colors)
noItems.visibility = if (colors.size > 0) View.GONE else View.VISIBLE
}

override fun onCreateOptionsMenu(menu: Menu?): Boolean {
Expand Down Expand Up @@ -105,8 +105,8 @@ class ColorSelectionActivity : AppCompatActivity() {
st.removeColor(selectedColor!!.id)
// Refresh adapters
colors = st.loadColors()
saved_colors.adapter = ColorsAdapter(this, colors)
no_items.visibility = if (colors.size > 0) View.GONE else View.VISIBLE
savedColors.adapter = ColorsAdapter(this, colors)
noItems.visibility = if (colors.size > 0) View.GONE else View.VISIBLE
}
.setNegativeButton(R.string.cancel, null)
.show()
Expand Down Expand Up @@ -144,15 +144,15 @@ class ColorSelectionActivity : AppCompatActivity() {
}

override fun onAnimationEnd(animation: Animator) {
reveal_background.setBackgroundColor(toColor)
revealBackground.setBackgroundColor(toColor)
}
})
animator.duration = 480
animator.start()
reveal.visibility = View.VISIBLE
} else {
reveal.setBackgroundColor(toColor)
reveal_background.setBackgroundColor(toColor)
revealBackground.setBackgroundColor(toColor)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,18 @@ import android.provider.MediaStore
import android.speech.tts.TextToSpeech
import android.view.Menu
import android.view.MenuItem
import android.view.View
import android.view.WindowManager
import android.widget.Toast
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.tools.ColorNameTools
import com.chillibits.colorconverter.tools.ColorTools
import com.chillibits.colorconverter.tools.StorageTools
import com.chillibits.colorconverter.tools.dpToPx
import com.chillibits.colorconverter.viewmodel.DetailedFlagView
import com.fxn.pix.Options
import com.fxn.pix.Pix
Expand All @@ -51,13 +55,13 @@ class ImageActivity : AppCompatActivity() {
// Variables as objects
private lateinit var tts: TextToSpeech
private var speakItem: MenuItem? = null
private var selectedColor: Int = Color.BLACK
private var vibrantColor: Int = Color.BLACK
private var vibrantColorLight: Int = Color.BLACK
private var vibrantColorDark: Int = Color.BLACK
private var mutedColor: Int = Color.BLACK
private var mutedColorLight: Int = Color.BLACK
private var mutedColorDark: Int = Color.BLACK
private var valueSelectedColor: Int = Color.BLACK
private var valueVibrantColor: Int = Color.BLACK
private var valueVibrantColorLight: Int = Color.BLACK
private var valueVibrantColorDark: Int = Color.BLACK
private var valueMutedColor: Int = Color.BLACK
private var valueMutedColorLight: Int = Color.BLACK
private var valueMutedColorDark: Int = Color.BLACK
private var imageUri: String? = null

// Variables
Expand All @@ -67,23 +71,36 @@ class ImageActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_image)

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
window.decorView.setOnApplyWindowInsetsListener { _, insets ->
toolbar?.setPadding(0, insets.systemWindowInsetTop, 0, 0)
val bottomInsets = insets.systemWindowInsetBottom
colorButtonContainer.setPadding(dpToPx(3), dpToPx(3), dpToPx(3), bottomInsets + dpToPx(3))
insets
}
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
window.statusBarColor = ContextCompat.getColor(this, R.color.colorPrimaryDark)
}

setSupportActionBar(toolbar)
supportActionBar?.setDisplayHomeAsUpEnabled(true)

image.colorListener = ColorListener { color, _ ->
selectedColor = color
selected_color.background.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(color, BlendModeCompat.SRC_IN)
valueSelectedColor = color
selectedColor.background.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(color, BlendModeCompat.SRC_IN)
if(speakItem != null && speakItem!!.isChecked) speakColor()
}
image.flagView = DetailedFlagView(this, R.layout.flag_layout)

selected_color.setOnClickListener { finishWithResult(selectedColor) }
vibrant_color.setOnClickListener { finishWithResult(vibrantColor) }
light_vibrant_color.setOnClickListener { finishWithResult(vibrantColorLight) }
dark_vibrant_color.setOnClickListener { finishWithResult(vibrantColorDark) }
muted_color.setOnClickListener { finishWithResult(mutedColor) }
light_muted_color.setOnClickListener { finishWithResult(mutedColorLight) }
dark_muted_color.setOnClickListener { finishWithResult(mutedColorDark) }
selectedColor.setOnClickListener { finishWithResult(valueSelectedColor) }
vibrantColor.setOnClickListener { finishWithResult(valueVibrantColor) }
lightVibrantColor.setOnClickListener { finishWithResult(valueVibrantColorLight) }
darkVibrantColor.setOnClickListener { finishWithResult(valueVibrantColorDark) }
mutedColor.setOnClickListener { finishWithResult(valueMutedColor) }
lightMutedColor.setOnClickListener { finishWithResult(valueMutedColorLight) }
darkMutedColor.setOnClickListener { finishWithResult(valueMutedColorDark) }

tts = TextToSpeech(this) { status ->
if(status == TextToSpeech.SUCCESS) {
Expand Down Expand Up @@ -170,18 +187,18 @@ class ImageActivity : AppCompatActivity() {

private fun applyImage(bitmap: Bitmap) {
image.setPaletteDrawable(BitmapDrawable(resources, bitmap))
vibrantColor = ct.getVibrantColor(bitmap)
vibrant_color.background.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(vibrantColor, BlendModeCompat.SRC_IN)
vibrantColorLight = ct.getLightVibrantColor(bitmap)
light_vibrant_color.background.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(vibrantColorLight, BlendModeCompat.SRC_IN)
vibrantColorDark = ct.getDarkVibrantColor(bitmap)
dark_vibrant_color.background.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(vibrantColorDark, BlendModeCompat.SRC_IN)
mutedColor = ct.getMutedColor(bitmap)
muted_color.background.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(mutedColor, BlendModeCompat.SRC_IN)
mutedColorLight = ct.getLightMutedColor(bitmap)
light_muted_color.background.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(mutedColorLight, BlendModeCompat.SRC_IN)
mutedColorDark = ct.getDarkMutedColor(bitmap)
dark_muted_color.background.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(mutedColorDark, BlendModeCompat.SRC_IN)
valueVibrantColor = ct.getVibrantColor(bitmap)
vibrantColor.background.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(valueVibrantColor, BlendModeCompat.SRC_IN)
valueVibrantColorLight = ct.getLightVibrantColor(bitmap)
lightVibrantColor.background.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(valueVibrantColorLight, BlendModeCompat.SRC_IN)
valueVibrantColorDark = ct.getDarkVibrantColor(bitmap)
darkVibrantColor.background.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(valueVibrantColorDark, BlendModeCompat.SRC_IN)
valueMutedColor = ct.getMutedColor(bitmap)
mutedColor.background.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(valueMutedColor, BlendModeCompat.SRC_IN)
valueMutedColorLight = ct.getLightMutedColor(bitmap)
lightMutedColor.background.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(valueMutedColorLight, BlendModeCompat.SRC_IN)
valueMutedColorDark = ct.getDarkMutedColor(bitmap)
darkMutedColor.background.colorFilter = BlendModeColorFilterCompat.createBlendModeColorFilterCompat(valueMutedColorDark, BlendModeCompat.SRC_IN)
}

override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
Expand All @@ -202,7 +219,7 @@ class ImageActivity : AppCompatActivity() {
Toast.makeText(this, R.string.audio_muted, Toast.LENGTH_SHORT).show()
} else {
if(initialized) {
val colorName = cnt.getColorNameFromColor(com.chillibits.colorconverter.model.Color(0, "", selectedColor, 0))
val colorName = cnt.getColorNameFromColor(com.chillibits.colorconverter.model.Color(0, "", valueSelectedColor, 0))
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
tts.speak(colorName, TextToSpeech.QUEUE_FLUSH, null, null)
} else {
Expand Down
Loading

0 comments on commit cb9033e

Please sign in to comment.