adding a setting for toggling clipboard visibility

This commit is contained in:
tibbi 2022-01-23 11:07:59 +01:00
parent 74dea45afe
commit 5e7edbe102
5 changed files with 35 additions and 7 deletions

View File

@ -22,6 +22,7 @@ class SettingsActivity : SimpleActivity() {
setupPurchaseThankYou()
setupCustomizeColors()
setupUseEnglish()
setupClipboard()
updateTextColors(settings_scrollview)
@ -44,7 +45,7 @@ class SettingsActivity : SimpleActivity() {
// make sure the corners at ripple fit the stroke rounded corners
if (settings_purchase_thank_you_holder.isGone()) {
settings_use_english_holder.background = resources.getDrawable(R.drawable.ripple_all_corners, theme)
settings_use_english_holder.background = resources.getDrawable(R.drawable.ripple_top_corners, theme)
}
settings_purchase_thank_you_holder.setOnClickListener {
@ -64,10 +65,7 @@ class SettingsActivity : SimpleActivity() {
settings_use_english.isChecked = config.useEnglish
if (settings_use_english_holder.isGone() && settings_purchase_thank_you_holder.isGone()) {
settings_general_settings_label.beGone()
settings_general_settings_holder.beGone()
} else if (settings_use_english_holder.isGone()) {
settings_purchase_thank_you_holder.background = resources.getDrawable(R.drawable.ripple_all_corners, theme)
settings_show_clipboard_holder.background = resources.getDrawable(R.drawable.ripple_all_corners, theme)
}
settings_use_english_holder.setOnClickListener {
@ -76,4 +74,12 @@ class SettingsActivity : SimpleActivity() {
exitProcess(0)
}
}
private fun setupClipboard() {
settings_show_clipboard.isChecked = config.showClipboard
settings_show_clipboard_holder.setOnClickListener {
settings_show_clipboard.toggle()
config.showClipboard = settings_show_clipboard.isChecked
}
}
}

View File

@ -7,4 +7,8 @@ class Config(context: Context) : BaseConfig(context) {
companion object {
fun newInstance(context: Context) = Config(context)
}
var showClipboard: Boolean
get() = prefs.getBoolean(SHOW_CLIPBOARD, true)
set(showClipboard) = prefs.edit().putBoolean(SHOW_CLIPBOARD, showClipboard).apply()
}

View File

@ -6,3 +6,6 @@ const val SHIFT_ON_PERMANENT = 2
// limit the count of alternative characters that show up at long pressing a key
const val MAX_KEYS_PER_MINI_ROW = 5
// shared prefs
const val SHOW_CLIPBOARD = "show_clipboard"

View File

@ -281,7 +281,6 @@ class MyKeyboard {
}
/**
*
* Creates a blank keyboard from the given resource file and populates it with the specified characters in left-to-right, top-to-bottom fashion,
* using the specified number of columns. If the specified number of columns is -1, then the keyboard will fit as many keys as possible in each row.
* @param context the application or service context

View File

@ -78,7 +78,7 @@
style="@style/SettingsHolderCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ripple_bottom_corners">
android:background="@drawable/ripple_background">
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/settings_use_english"
@ -88,6 +88,22 @@
android:text="@string/use_english_language" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_show_clipboard_holder"
style="@style/SettingsHolderCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ripple_bottom_corners">
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/settings_show_clipboard"
style="@style/SettingsCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/show_clipboard_content" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>