Add toggle to hide clipboard
This commit is contained in:
parent
d8f39bd92f
commit
4348cff5b1
|
@ -42,6 +42,7 @@ class SettingsActivity : SimpleActivity() {
|
|||
setupShowPopupOnKeypress()
|
||||
setupKeyboardLanguage()
|
||||
setupKeyboardHeightMultiplier()
|
||||
setupShowClipboardContent()
|
||||
|
||||
updateTextColors(settings_nested_scrollview)
|
||||
|
||||
|
@ -141,4 +142,12 @@ class SettingsActivity : SimpleActivity() {
|
|||
else -> getString(R.string.small)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupShowClipboardContent() {
|
||||
settings_show_clipboard_content.isChecked = config.showClipboardContent
|
||||
settings_show_clipboard_content_holder.setOnClickListener {
|
||||
settings_show_clipboard_content.toggle()
|
||||
config.showClipboardContent = settings_show_clipboard_content.isChecked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,10 @@ class Config(context: Context) : BaseConfig(context) {
|
|||
get() = prefs.getInt(HEIGHT_MULTIPLIER, 1)
|
||||
set(keyboardHeightMultiplier) = prefs.edit().putInt(HEIGHT_MULTIPLIER, keyboardHeightMultiplier).apply()
|
||||
|
||||
var showClipboardContent: Boolean
|
||||
get() = prefs.getBoolean(SHOW_CLIPBOARD_CONTENT, true)
|
||||
set(showClipboardContent) = prefs.edit().putBoolean(SHOW_CLIPBOARD_CONTENT, showClipboardContent).apply()
|
||||
|
||||
|
||||
private fun getDefaultLanguage(): Int {
|
||||
val conf = context.resources.configuration
|
||||
|
|
|
@ -13,6 +13,7 @@ const val SHOW_POPUP_ON_KEYPRESS = "show_popup_on_keypress"
|
|||
const val LAST_EXPORTED_CLIPS_FOLDER = "last_exported_clips_folder"
|
||||
const val KEYBOARD_LANGUAGE = "keyboard_language"
|
||||
const val HEIGHT_MULTIPLIER = "height_multiplier"
|
||||
const val SHOW_CLIPBOARD_CONTENT = "show_clipboard_content"
|
||||
|
||||
// differentiate current and pinned clips at the keyboards' Clipboard section
|
||||
const val ITEM_SECTION_LABEL = 0
|
||||
|
|
|
@ -657,7 +657,7 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
|
|||
}
|
||||
|
||||
private fun handleClipboard() {
|
||||
if (mToolbarHolder != null && mPopupParent.id != R.id.mini_keyboard_view) {
|
||||
if (mToolbarHolder != null && mPopupParent.id != R.id.mini_keyboard_view && context.config.showClipboardContent) {
|
||||
val clipboardContent = context.getCurrentClip()
|
||||
if (clipboardContent?.isNotEmpty() == true) {
|
||||
mToolbarHolder?.apply {
|
||||
|
|
|
@ -206,6 +206,21 @@
|
|||
tools:text="@string/small" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/settings_show_clipboard_content_holder"
|
||||
style="@style/SettingsHolderCheckboxStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
|
||||
android:id="@+id/settings_show_clipboard_content"
|
||||
style="@style/SettingsCheckboxStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/show_clipboard_content" />
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
|
Loading…
Reference in New Issue