mirror of
https://github.com/SimpleMobileTools/Simple-Keyboard.git
synced 2025-02-18 12:50:36 +01:00
use better stroke color at pure White or Black backgrounds
This commit is contained in:
parent
7a48011aa4
commit
5058167c04
@ -272,7 +272,7 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
|
|||||||
if (changedView == mini_keyboard_view) {
|
if (changedView == mini_keyboard_view) {
|
||||||
val previewBackground = background as LayerDrawable
|
val previewBackground = background as LayerDrawable
|
||||||
previewBackground.findDrawableByLayerId(R.id.button_background_shape).applyColorFilter(mBackgroundColor.darkenColor(4))
|
previewBackground.findDrawableByLayerId(R.id.button_background_shape).applyColorFilter(mBackgroundColor.darkenColor(4))
|
||||||
previewBackground.findDrawableByLayerId(R.id.button_background_stroke).applyColorFilter(mBackgroundColor.lightenColor())
|
previewBackground.findDrawableByLayerId(R.id.button_background_stroke).applyColorFilter(getPreviewStrokeColor())
|
||||||
background = previewBackground
|
background = previewBackground
|
||||||
} else {
|
} else {
|
||||||
background.applyColorFilter(mBackgroundColor.darkenColor(2))
|
background.applyColorFilter(mBackgroundColor.darkenColor(2))
|
||||||
@ -819,7 +819,7 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
|
|||||||
|
|
||||||
val previewBackground = mPreviewText!!.background as LayerDrawable
|
val previewBackground = mPreviewText!!.background as LayerDrawable
|
||||||
previewBackground.findDrawableByLayerId(R.id.button_background_shape).applyColorFilter(mBackgroundColor.darkenColor(4))
|
previewBackground.findDrawableByLayerId(R.id.button_background_shape).applyColorFilter(mBackgroundColor.darkenColor(4))
|
||||||
previewBackground.findDrawableByLayerId(R.id.button_background_stroke).applyColorFilter(mBackgroundColor.lightenColor())
|
previewBackground.findDrawableByLayerId(R.id.button_background_stroke).applyColorFilter(getPreviewStrokeColor())
|
||||||
|
|
||||||
mPreviewText!!.background = previewBackground
|
mPreviewText!!.background = previewBackground
|
||||||
mPreviewText!!.setTextColor(mTextColor)
|
mPreviewText!!.setTextColor(mTextColor)
|
||||||
@ -1379,6 +1379,15 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
|
|||||||
mClipboardManagerHolder?.clips_list?.adapter = adapter
|
mClipboardManagerHolder?.clips_list?.adapter = adapter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// stroke is usually the lighter version of the background color, but if it becomes white or black, it might be invisible. So use light grey there.
|
||||||
|
private fun getPreviewStrokeColor(): Int {
|
||||||
|
var strokeColor = mBackgroundColor.lightenColor()
|
||||||
|
if (strokeColor == Color.WHITE || strokeColor == Color.BLACK) {
|
||||||
|
strokeColor = resources.getColor(R.color.divider_grey)
|
||||||
|
}
|
||||||
|
return strokeColor
|
||||||
|
}
|
||||||
|
|
||||||
private fun closing() {
|
private fun closing() {
|
||||||
if (mPreviewPopup.isShowing) {
|
if (mPreviewPopup.isShowing) {
|
||||||
mPreviewPopup.dismiss()
|
mPreviewPopup.dismiss()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user