Added capitalization setting in SettingsActivity

This commit is contained in:
merkost 2023-05-20 11:37:27 +10:00
parent 000c907a02
commit 47e5e56b30
4 changed files with 32 additions and 1 deletions

View File

@ -44,6 +44,7 @@ class SettingsActivity : SimpleActivity() {
setupKeyboardLanguage()
setupKeyboardHeightMultiplier()
setupShowClipboardContent()
setupSentencesCapitalization()
setupShowNumbersRow()
updateTextColors(settings_nested_scrollview)
@ -160,6 +161,15 @@ class SettingsActivity : SimpleActivity() {
config.showClipboardContent = settings_show_clipboard_content.isChecked
}
}
private fun setupSentencesCapitalization() {
settings_enable_sentences_capitalization_row.isChecked = config.enableSentencesCapitalization
settings_enable_capitalization_row_holder.setOnClickListener {
settings_enable_sentences_capitalization_row.toggle()
config.enableSentencesCapitalization = settings_enable_sentences_capitalization_row.isChecked
}
}
private fun setupShowNumbersRow() {
settings_show_numbers_row.isChecked = config.showNumbersRow
settings_show_numbers_row_holder.setOnClickListener {

View File

@ -17,6 +17,10 @@ class Config(context: Context) : BaseConfig(context) {
get() = prefs.getBoolean(SHOW_POPUP_ON_KEYPRESS, true)
set(showPopupOnKeypress) = prefs.edit().putBoolean(SHOW_POPUP_ON_KEYPRESS, showPopupOnKeypress).apply()
var enableSentencesCapitalization: Boolean
get() = prefs.getBoolean(SENTENCES_CAPITALIZATION, false)
set(enableCapitalization) = prefs.edit().putBoolean(SENTENCES_CAPITALIZATION, enableCapitalization).apply()
var showKeyBorders: Boolean
get() = prefs.getBoolean(SHOW_KEY_BORDERS, false)
set(showKeyBorders) = prefs.edit().putBoolean(SHOW_KEY_BORDERS, showKeyBorders).apply()

View File

@ -190,6 +190,7 @@
android:text="@string/show_clipboard_content" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_show_numbers_row_holder"
style="@style/SettingsHolderCheckboxStyle"
@ -205,6 +206,21 @@
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_enable_capitalization_row_holder"
style="@style/SettingsHolderCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/settings_enable_sentences_capitalization_row"
style="@style/SettingsCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/enable_sentences_capitalization" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_keyboard_language_holder"
style="@style/SettingsHolderTextViewStyle"

View File

@ -34,7 +34,8 @@
<string name="keyboard_height">Keyboard height</string>
<string name="show_key_borders">Show key borders</string>
<string name="show_numbers_row">Show numbers on a separate row</string>
<!-- Emojis -->
<string name="enable_sentences_capitalization">Capisalise the first word of each sentence</string>
c <!-- Emojis -->
<string name="emojis">Emojis</string>
<!--
Haven't found some strings? There's more at