adding some coloring fixes

This commit is contained in:
tibbi 2021-02-05 17:29:32 +01:00
parent 9865bc5173
commit 4184caa2c3
4 changed files with 20 additions and 14 deletions

View file

@ -6,7 +6,7 @@ buildscript {
propMinSdkVersion = 21
propTargetSdkVersion = propCompileSdkVersion
propVersionCode = 1
propVersionName = '5.33.15'
propVersionName = '5.33.16'
kotlin_version = '1.4.21'
}

View file

@ -17,6 +17,7 @@ import android.provider.Settings
import android.telecom.TelecomManager
import android.view.Menu
import android.view.MenuItem
import android.view.View
import android.view.WindowManager
import android.widget.Toast
import androidx.annotation.RequiresApi
@ -130,12 +131,21 @@ abstract class BaseSimpleActivity : AppCompatActivity() {
fun updateStatusbarColor(color: Int) {
window.statusBarColor = color.darkenColor()
if (isMarshmallowPlus()) {
if (color.getContrastColor() == 0xFF333333.toInt()) {
window.decorView.systemUiVisibility = window.decorView.systemUiVisibility.addBit(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR)
} else {
window.decorView.systemUiVisibility = window.decorView.systemUiVisibility.removeBit(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR)
}
}
}
fun updateNavigationBarColor(color: Int = baseConfig.navigationBarColor) {
if (baseConfig.navigationBarColor != INVALID_NAVIGATION_BAR_COLOR) {
try {
window.navigationBarColor = color
val colorToUse = if (color == -2) -1 else color
window.navigationBarColor = colorToUse
} catch (ignored: Exception) {
}
}

View file

@ -241,8 +241,7 @@ class CustomizationActivity : BaseSimpleActivity() {
if (curTextColor == getColor(value.textColorId) &&
curBackgroundColor == getColor(value.backgroundColorId) &&
curPrimaryColor == getColor(value.primaryColorId) &&
curAppIconColor == getColor(value.appIconColorId) &&
curNavigationBarColor == getThemeNavigationColor(key)
curAppIconColor == getColor(value.appIconColorId)
) {
themeId = key
}
@ -286,7 +285,13 @@ class CustomizationActivity : BaseSimpleActivity() {
backgroundColor = curBackgroundColor
primaryColor = curPrimaryColor
appIconColor = curAppIconColor
navigationBarColor = curNavigationBarColor
// -1 is used as an invalid value, lets make use of it for white
navigationBarColor = if (curNavigationBarColor == INVALID_NAVIGATION_BAR_COLOR) {
-2
} else {
curNavigationBarColor
}
}
if (didAppIconColorChange) {

View file

@ -7,7 +7,6 @@ import androidx.appcompat.app.AlertDialog
import com.simplemobiletools.commons.R
import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.isMarshmallowPlus
import com.simplemobiletools.commons.interfaces.LineColorPickerListener
import kotlinx.android.synthetic.main.dialog_line_color_picker.view.*
import java.util.*
@ -83,14 +82,6 @@ class LineColorPickerDialog(val activity: BaseSimpleActivity, val color: Int, va
dialog?.window?.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
wasDimmedBackgroundRemoved = true
}
if (isMarshmallowPlus()) {
if (color.getContrastColor() == 0xFF333333.toInt()) {
activity.window.decorView.systemUiVisibility = view.systemUiVisibility.addBit(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR)
} else {
activity.window.decorView.systemUiVisibility = view.systemUiVisibility.removeBit(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR)
}
}
}
}