Merge pull request #140 from smrtrfszm/hide-clipboard
Add a toggle to hide the clipboard
This commit is contained in:
commit
308c686d1a
|
@ -43,6 +43,7 @@ class SettingsActivity : SimpleActivity() {
|
|||
setupShowKeyBorders()
|
||||
setupKeyboardLanguage()
|
||||
setupKeyboardHeightMultiplier()
|
||||
setupShowClipboardContent()
|
||||
|
||||
updateTextColors(settings_nested_scrollview)
|
||||
|
||||
|
@ -150,4 +151,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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,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
|
||||
|
|
|
@ -14,6 +14,7 @@ const val SHOW_KEY_BORDERS = "show_key_borders"
|
|||
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
|
||||
|
|
|
@ -701,7 +701,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 {
|
||||
|
|
|
@ -176,6 +176,21 @@
|
|||
|
||||
</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>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/settings_keyboard_language_holder"
|
||||
style="@style/SettingsHolderTextViewStyle"
|
||||
|
|
Loading…
Reference in New Issue