Skip to content

Commit 5b6401b

Browse files
authored
Merge pull request #51 from ChilliBits/beta
Release of version 2.3.1
2 parents 8a2ee48 + 8dea04f commit 5b6401b

30 files changed

+188
-222
lines changed

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ apply plugin: 'kotlin-android'
77
apply plugin: 'kotlin-android-extensions'
88

99
android {
10-
compileSdkVersion 29
11-
buildToolsVersion "29.0.3"
10+
compileSdkVersion 30
11+
buildToolsVersion "30.0.1"
1212
defaultConfig {
1313
applicationId "com.mrgames13.jimdo.colorconverter"
1414
minSdkVersion 21
15-
targetSdkVersion 29
16-
versionCode 2300
17-
versionName "2.3.0"
15+
targetSdkVersion 30
16+
versionCode 2301
17+
versionName "2.3.1"
1818
vectorDrawables.useSupportLibrary = true
1919
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
2020
}
@@ -38,11 +38,11 @@ dependencies {
3838
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
3939
implementation 'androidx.appcompat:appcompat:1.3.0-alpha01'
4040
implementation 'androidx.core:core-ktx:1.5.0-alpha01'
41-
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta7'
41+
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-rc1'
4242
implementation 'com.google.android.instantapps:instantapps:1.1.0'
43-
implementation 'com.google.android.play:core:1.7.3'
43+
implementation 'com.google.android.play:core:1.8.0'
4444
implementation 'androidx.palette:palette-ktx:1.0.0'
45-
implementation 'com.google.android.material:material:1.3.0-alpha01'
45+
implementation 'com.google.android.material:material:1.3.0-alpha02'
4646

4747
// External dependencies
4848
implementation 'net.margaritov.preference.colorpicker.ColorPickerPreference:ColorPickerPreference:1.0.0'
@@ -51,13 +51,13 @@ dependencies {
5151
implementation 'com.github.skydoves:colorpickerview:2.1.6'
5252
implementation 'com.mikepenz:iconics-core:5.0.3'
5353
implementation 'com.mikepenz:material-design-iconic-typeface:2.2.0.6-kotlin@aar'
54-
implementation 'com.mikepenz:fastadapter:5.1.0'
55-
implementation 'com.github.javiersantos:MaterialStyledDialogs:3.0.1'
54+
implementation 'com.mikepenz:fastadapter:5.2.2'
55+
implementation 'com.github.javiersantos:MaterialStyledDialogs:3.0.2'
5656

5757
// dependencies for testing
5858
testImplementation 'junit:junit:4.13'
59-
androidTestImplementation 'androidx.test.ext:junit:1.1.2-rc01'
60-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-rc01'
59+
androidTestImplementation 'androidx.test.ext:junit:1.1.2-rc02'
60+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-rc02'
6161
}
6262

6363
// Task for downloading all translation files
@@ -109,7 +109,7 @@ task downloadTranslations {
109109
// Main string file
110110
def f = new File("${project.projectDir}/src/main/res/values-ru/strings.xml")
111111
new URL("https://localise.biz/api/export/locale/ru.xml?format=android&key=${apiKey}").withInputStream{ i -> f.withOutputStream{ it << i }}
112-
// Color file (not translated to Russian yet)
112+
// Color file (will be added again, when the translation is complete)
113113
//f = new File("${project.projectDir}/src/main/res/values-ru/strings_colors.xml")
114114
//new URL("https://localise.biz/api/export/locale/ru.xml?format=android&key=${apiKeyColors}").withInputStream{ i -> f.withOutputStream{ it << i }}
115115
}

app/src/main/java/com/chillibits/colorconverter/ui/activity/ColorSelectionActivity.kt

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,20 @@ class ColorSelectionActivity : AppCompatActivity() {
3939
setContentView(R.layout.activity_color_selection)
4040

4141
window.run {
42-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
43-
decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
44-
decorView.setOnApplyWindowInsetsListener { _, insets ->
45-
toolbar?.setPadding(0, insets.systemWindowInsetTop, 0, 0)
46-
savedColors.setPadding(0, 0, 0, insets.systemWindowInsetBottom)
47-
insets
42+
when {
43+
Build.VERSION.SDK_INT >= Build.VERSION_CODES.R -> setDecorFitsSystemWindows(false)
44+
Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q -> {
45+
decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
46+
decorView.setOnApplyWindowInsetsListener { _, insets ->
47+
toolbar?.setPadding(0, insets.systemWindowInsetTop, 0, 0)
48+
savedColors.setPadding(0, 0, 0, insets.systemWindowInsetBottom)
49+
insets
50+
}
51+
}
52+
else -> {
53+
addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
54+
statusBarColor = ContextCompat.getColor(context, R.color.colorPrimaryDark)
4855
}
49-
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
50-
addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
51-
statusBarColor = ContextCompat.getColor(context, R.color.colorPrimaryDark)
5256
}
5357
}
5458

@@ -137,19 +141,14 @@ class ColorSelectionActivity : AppCompatActivity() {
137141
}
138142

139143
private fun animateAppAndStatusBar(toColor: Int) {
140-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
141-
val animator = ViewAnimationUtils.createCircularReveal(reveal, toolbar.width / 2, toolbar.height / 2, 0f, toolbar.width / 2.0f + 50)
142-
animator.addListener(object : AnimatorListenerAdapter() {
143-
override fun onAnimationStart(animation: Animator) { reveal.setBackgroundColor(toColor) }
144-
override fun onAnimationEnd(animation: Animator) { revealBackground.setBackgroundColor(toColor) }
145-
})
146-
147-
animator.duration = 480
148-
animator.start()
149-
reveal.visibility = View.VISIBLE
150-
} else {
151-
reveal.setBackgroundColor(toColor)
152-
revealBackground.setBackgroundColor(toColor)
153-
}
144+
val animator = ViewAnimationUtils.createCircularReveal(reveal, toolbar.width / 2, toolbar.height / 2, 0f, toolbar.width / 2.0f + 50)
145+
animator.addListener(object : AnimatorListenerAdapter() {
146+
override fun onAnimationStart(animation: Animator) { reveal.setBackgroundColor(toColor) }
147+
override fun onAnimationEnd(animation: Animator) { revealBackground.setBackgroundColor(toColor) }
148+
})
149+
150+
animator.duration = 480
151+
animator.start()
152+
reveal.visibility = View.VISIBLE
154153
}
155154
}

app/src/main/java/com/chillibits/colorconverter/ui/activity/ImageActivity.kt

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,7 @@ class ImageActivity : AppCompatActivity() {
6868
setContentView(R.layout.activity_image)
6969

7070
// Apply window insets
71-
window.run {
72-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
73-
decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
74-
decorView.setOnApplyWindowInsetsListener { _, insets ->
75-
toolbar?.setPadding(0, insets.systemWindowInsetTop, 0, 0)
76-
colorButtonContainer.setPadding(dpToPx(3), dpToPx(3), dpToPx(3), insets.systemWindowInsetBottom + dpToPx(3))
77-
insets
78-
}
79-
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
80-
addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
81-
statusBarColor = ContextCompat.getColor(context, R.color.colorPrimaryDark)
82-
}
83-
}
71+
applyWindowInsets()
8472

8573
// Initialize toolbar
8674
setSupportActionBar(toolbar)
@@ -116,7 +104,7 @@ class ImageActivity : AppCompatActivity() {
116104

117105
if(intent.hasExtra(Constants.EXTRA_IMAGE_URI)) {
118106
// Load default image
119-
val defaultImageUri = intent.getParcelableExtra(Constants.EXTRA_IMAGE_URI) as Uri
107+
val defaultImageUri = intent.getParcelableExtra<Uri>(Constants.EXTRA_IMAGE_URI)
120108
val bitmap = MediaStore.Images.Media.getBitmap(contentResolver, defaultImageUri)
121109
applyImage(bitmap)
122110
} else if(savedInstanceState == null) {
@@ -170,6 +158,27 @@ class ImageActivity : AppCompatActivity() {
170158
}
171159
}
172160

161+
private fun applyWindowInsets() {
162+
window.run {
163+
when {
164+
Build.VERSION.SDK_INT >= Build.VERSION_CODES.R -> setDecorFitsSystemWindows(false)
165+
Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q -> {
166+
decorView.systemUiVisibility =
167+
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
168+
decorView.setOnApplyWindowInsetsListener { _, insets ->
169+
toolbar?.setPadding(0, insets.systemWindowInsetTop, 0, 0)
170+
colorButtonContainer.setPadding(dpToPx(3), dpToPx(3), dpToPx(3), insets.systemWindowInsetBottom + dpToPx(3))
171+
insets
172+
}
173+
}
174+
else -> {
175+
addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
176+
statusBarColor = ContextCompat.getColor(context, R.color.colorPrimaryDark)
177+
}
178+
}
179+
}
180+
}
181+
173182
private fun applyRotation(source: Bitmap, path: String) = when (ExifInterface(path).getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED)) {
174183
ExifInterface.ORIENTATION_ROTATE_90 -> rotateImage(source, 90F)
175184
ExifInterface.ORIENTATION_ROTATE_180 -> rotateImage(source, 180F)
@@ -218,11 +227,7 @@ class ImageActivity : AppCompatActivity() {
218227
} else {
219228
if(initialized) {
220229
val colorName = cnt.getColorNameFromColor(com.chillibits.colorconverter.model.Color(0, "", valueSelectedColor, 0))
221-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
222-
tts.speak(colorName, TextToSpeech.QUEUE_FLUSH, null, null)
223-
} else {
224-
tts.speak(colorName, TextToSpeech.QUEUE_FLUSH, null)
225-
}
230+
tts.speak(colorName, TextToSpeech.QUEUE_FLUSH, null, null)
226231
} else {
227232
Toast.makeText(this, R.string.initialization_failed, Toast.LENGTH_SHORT).show()
228233
}

0 commit comments

Comments
 (0)