Enabled numbers row based on shouldShowKeyboardToolbar value
This commit is contained in:
parent
9fba023443
commit
fa4e38e94e
|
@ -23,12 +23,14 @@ val Context.config: Config get() = Config.newInstance(applicationContext.safeSto
|
|||
|
||||
val Context.safeStorageContext: Context
|
||||
get() = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && isDeviceLocked) {
|
||||
val deviceStorageContext = createDeviceProtectedStorageContext()
|
||||
deviceStorageContext
|
||||
createDeviceProtectedStorageContext()
|
||||
} else {
|
||||
this
|
||||
}
|
||||
|
||||
val Context.shouldShowKeyboardToolbar: Boolean
|
||||
get() = !isDeviceLocked
|
||||
|
||||
val Context.isDeviceLocked: Boolean
|
||||
get() = (getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager).isDeviceLocked
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.simplemobiletools.keyboard.helpers
|
|||
|
||||
import android.content.Context
|
||||
import com.simplemobiletools.commons.helpers.BaseConfig
|
||||
import com.simplemobiletools.keyboard.extensions.isDeviceLocked
|
||||
import com.simplemobiletools.keyboard.extensions.safeStorageContext
|
||||
import java.util.*
|
||||
|
||||
|
@ -43,7 +44,11 @@ class Config(context: Context) : BaseConfig(context) {
|
|||
set(showClipboardContent) = prefs.edit().putBoolean(SHOW_CLIPBOARD_CONTENT, showClipboardContent).apply()
|
||||
|
||||
var showNumbersRow: Boolean
|
||||
get() = prefs.getBoolean(SHOW_NUMBERS_ROW, false)
|
||||
get() = if (!context.isDeviceLocked) {
|
||||
prefs.getBoolean(SHOW_NUMBERS_ROW, false)
|
||||
} else {
|
||||
true
|
||||
}
|
||||
set(showNumbersRow) = prefs.edit().putBoolean(SHOW_NUMBERS_ROW, showNumbersRow).apply()
|
||||
|
||||
private fun getDefaultLanguage(): Int {
|
||||
|
|
|
@ -13,7 +13,6 @@ import android.view.inputmethod.EditorInfo.IME_FLAG_NO_ENTER_ACTION
|
|||
import android.view.inputmethod.EditorInfo.IME_MASK_ACTION
|
||||
import android.view.inputmethod.ExtractedTextRequest
|
||||
import com.simplemobiletools.commons.extensions.getSharedPrefs
|
||||
import com.simplemobiletools.commons.extensions.isDeviceLocked
|
||||
import com.simplemobiletools.keyboard.R
|
||||
import com.simplemobiletools.keyboard.extensions.config
|
||||
import com.simplemobiletools.keyboard.extensions.safeStorageContext
|
||||
|
|
|
@ -428,6 +428,8 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
|
|||
settings_cog.applyColorFilter(mTextColor)
|
||||
pinned_clipboard_items.applyColorFilter(mTextColor)
|
||||
clipboard_clear.applyColorFilter(mTextColor)
|
||||
|
||||
toolbar_holder.beInvisibleIf(!context.shouldShowKeyboardToolbar)
|
||||
}
|
||||
|
||||
mClipboardManagerHolder?.apply {
|
||||
|
|
Loading…
Reference in New Issue