Skip to content

Commit

Permalink
Merge pull request #51 from ChilliBits/beta
Browse files Browse the repository at this point in the history
Release of version 2.3.1
  • Loading branch information
marcauberer authored Aug 1, 2020
2 parents 8a2ee48 + 8dea04f commit 5b6401b
Show file tree
Hide file tree
Showing 30 changed files with 188 additions and 222 deletions.
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.

26 changes: 13 additions & 13 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
compileSdkVersion 30
buildToolsVersion "30.0.1"
defaultConfig {
applicationId "com.mrgames13.jimdo.colorconverter"
minSdkVersion 21
targetSdkVersion 29
versionCode 2300
versionName "2.3.0"
targetSdkVersion 30
versionCode 2301
versionName "2.3.1"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand All @@ -38,11 +38,11 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.3.0-alpha01'
implementation 'androidx.core:core-ktx:1.5.0-alpha01'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta7'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-rc1'
implementation 'com.google.android.instantapps:instantapps:1.1.0'
implementation 'com.google.android.play:core:1.7.3'
implementation 'com.google.android.play:core:1.8.0'
implementation 'androidx.palette:palette-ktx:1.0.0'
implementation 'com.google.android.material:material:1.3.0-alpha01'
implementation 'com.google.android.material:material:1.3.0-alpha02'

// 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.1.0'
implementation 'com.github.javiersantos:MaterialStyledDialogs:3.0.1'
implementation 'com.mikepenz:fastadapter:5.2.2'
implementation 'com.github.javiersantos:MaterialStyledDialogs:3.0.2'

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

// Task for downloading all translation files
Expand Down Expand Up @@ -109,7 +109,7 @@ task downloadTranslations {
// 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)
// Color file (will be added again, when the translation is complete)
//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 }}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,20 @@ class ColorSelectionActivity : AppCompatActivity() {
setContentView(R.layout.activity_color_selection)

window.run {
if (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
decorView.setOnApplyWindowInsetsListener { _, insets ->
toolbar?.setPadding(0, insets.systemWindowInsetTop, 0, 0)
savedColors.setPadding(0, 0, 0, insets.systemWindowInsetBottom)
insets
when {
Build.VERSION.SDK_INT >= Build.VERSION_CODES.R -> 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
decorView.setOnApplyWindowInsetsListener { _, insets ->
toolbar?.setPadding(0, insets.systemWindowInsetTop, 0, 0)
savedColors.setPadding(0, 0, 0, insets.systemWindowInsetBottom)
insets
}
}
else -> {
addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
statusBarColor = ContextCompat.getColor(context, R.color.colorPrimaryDark)
}
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
statusBarColor = ContextCompat.getColor(context, R.color.colorPrimaryDark)
}
}

Expand Down Expand Up @@ -137,19 +141,14 @@ class ColorSelectionActivity : AppCompatActivity() {
}

private fun animateAppAndStatusBar(toColor: Int) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
val animator = ViewAnimationUtils.createCircularReveal(reveal, toolbar.width / 2, toolbar.height / 2, 0f, toolbar.width / 2.0f + 50)
animator.addListener(object : AnimatorListenerAdapter() {
override fun onAnimationStart(animation: Animator) { reveal.setBackgroundColor(toColor) }
override fun onAnimationEnd(animation: Animator) { revealBackground.setBackgroundColor(toColor) }
})

animator.duration = 480
animator.start()
reveal.visibility = View.VISIBLE
} else {
reveal.setBackgroundColor(toColor)
revealBackground.setBackgroundColor(toColor)
}
val animator = ViewAnimationUtils.createCircularReveal(reveal, toolbar.width / 2, toolbar.height / 2, 0f, toolbar.width / 2.0f + 50)
animator.addListener(object : AnimatorListenerAdapter() {
override fun onAnimationStart(animation: Animator) { reveal.setBackgroundColor(toColor) }
override fun onAnimationEnd(animation: Animator) { revealBackground.setBackgroundColor(toColor) }
})

animator.duration = 480
animator.start()
reveal.visibility = View.VISIBLE
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,7 @@ class ImageActivity : AppCompatActivity() {
setContentView(R.layout.activity_image)

// Apply window insets
window.run {
if (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
decorView.setOnApplyWindowInsetsListener { _, insets ->
toolbar?.setPadding(0, insets.systemWindowInsetTop, 0, 0)
colorButtonContainer.setPadding(dpToPx(3), dpToPx(3), dpToPx(3), insets.systemWindowInsetBottom + dpToPx(3))
insets
}
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
statusBarColor = ContextCompat.getColor(context, R.color.colorPrimaryDark)
}
}
applyWindowInsets()

// Initialize toolbar
setSupportActionBar(toolbar)
Expand Down Expand Up @@ -116,7 +104,7 @@ class ImageActivity : AppCompatActivity() {

if(intent.hasExtra(Constants.EXTRA_IMAGE_URI)) {
// Load default image
val defaultImageUri = intent.getParcelableExtra(Constants.EXTRA_IMAGE_URI) as Uri
val defaultImageUri = intent.getParcelableExtra<Uri>(Constants.EXTRA_IMAGE_URI)
val bitmap = MediaStore.Images.Media.getBitmap(contentResolver, defaultImageUri)
applyImage(bitmap)
} else if(savedInstanceState == null) {
Expand Down Expand Up @@ -170,6 +158,27 @@ class ImageActivity : AppCompatActivity() {
}
}

private fun applyWindowInsets() {
window.run {
when {
Build.VERSION.SDK_INT >= Build.VERSION_CODES.R -> 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
decorView.setOnApplyWindowInsetsListener { _, insets ->
toolbar?.setPadding(0, insets.systemWindowInsetTop, 0, 0)
colorButtonContainer.setPadding(dpToPx(3), dpToPx(3), dpToPx(3), insets.systemWindowInsetBottom + dpToPx(3))
insets
}
}
else -> {
addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
statusBarColor = ContextCompat.getColor(context, R.color.colorPrimaryDark)
}
}
}
}

private fun applyRotation(source: Bitmap, path: String) = when (ExifInterface(path).getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED)) {
ExifInterface.ORIENTATION_ROTATE_90 -> rotateImage(source, 90F)
ExifInterface.ORIENTATION_ROTATE_180 -> rotateImage(source, 180F)
Expand Down Expand Up @@ -218,11 +227,7 @@ class ImageActivity : AppCompatActivity() {
} else {
if(initialized) {
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 {
tts.speak(colorName, TextToSpeech.QUEUE_FLUSH, null)
}
tts.speak(colorName, TextToSpeech.QUEUE_FLUSH, null, null)
} else {
Toast.makeText(this, R.string.initialization_failed, Toast.LENGTH_SHORT).show()
}
Expand Down
Loading

0 comments on commit 5b6401b

Please sign in to comment.