migrate activities to viewbinding
This commit is contained in:
parent
aa42c280c3
commit
ee2422b3c3
|
@ -12,28 +12,32 @@ import com.simplemobiletools.commons.helpers.LICENSE_GSON
|
||||||
import com.simplemobiletools.commons.models.FAQItem
|
import com.simplemobiletools.commons.models.FAQItem
|
||||||
import com.simplemobiletools.keyboard.BuildConfig
|
import com.simplemobiletools.keyboard.BuildConfig
|
||||||
import com.simplemobiletools.keyboard.R
|
import com.simplemobiletools.keyboard.R
|
||||||
import kotlinx.android.synthetic.main.activity_main.*
|
import com.simplemobiletools.keyboard.databinding.ActivityMainBinding
|
||||||
|
|
||||||
class MainActivity : SimpleActivity() {
|
class MainActivity : SimpleActivity() {
|
||||||
|
private val binding by lazy(LazyThreadSafetyMode.NONE) { ActivityMainBinding.inflate(layoutInflater) }
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
isMaterialActivity = true
|
isMaterialActivity = true
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_main)
|
setContentView(binding.root)
|
||||||
appLaunched(BuildConfig.APPLICATION_ID)
|
appLaunched(BuildConfig.APPLICATION_ID)
|
||||||
setupOptionsMenu()
|
setupOptionsMenu()
|
||||||
refreshMenuItems()
|
refreshMenuItems()
|
||||||
|
|
||||||
updateMaterialActivityViews(main_coordinator, main_holder, useTransparentNavigation = false, useTopSearchMenu = false)
|
binding.apply {
|
||||||
setupMaterialScrollListener(main_nested_scrollview, main_toolbar)
|
updateMaterialActivityViews(mainCoordinator, mainHolder, useTransparentNavigation = false, useTopSearchMenu = false)
|
||||||
|
setupMaterialScrollListener(mainNestedScrollview, mainToolbar)
|
||||||
|
|
||||||
change_keyboard_holder.setOnClickListener {
|
changeKeyboardHolder.setOnClickListener {
|
||||||
(getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager).showInputMethodPicker()
|
(getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager).showInputMethodPicker()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
setupToolbar(main_toolbar)
|
setupToolbar(binding.mainToolbar)
|
||||||
if (!isKeyboardEnabled()) {
|
if (!isKeyboardEnabled()) {
|
||||||
ConfirmationAdvancedDialog(this, messageId = R.string.redirection_note, positive = R.string.ok, negative = 0) { success ->
|
ConfirmationAdvancedDialog(this, messageId = R.string.redirection_note, positive = R.string.ok, negative = 0) { success ->
|
||||||
if (success) {
|
if (success) {
|
||||||
|
@ -47,12 +51,12 @@ class MainActivity : SimpleActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTextColors(main_nested_scrollview)
|
updateTextColors(binding.mainNestedScrollview)
|
||||||
updateChangeKeyboardColor()
|
updateChangeKeyboardColor()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupOptionsMenu() {
|
private fun setupOptionsMenu() {
|
||||||
main_toolbar.setOnMenuItemClickListener { menuItem ->
|
binding.mainToolbar.setOnMenuItemClickListener { menuItem ->
|
||||||
when (menuItem.itemId) {
|
when (menuItem.itemId) {
|
||||||
R.id.more_apps_from_us -> launchMoreAppsFromUsIntent()
|
R.id.more_apps_from_us -> launchMoreAppsFromUsIntent()
|
||||||
R.id.settings -> launchSettings()
|
R.id.settings -> launchSettings()
|
||||||
|
@ -64,7 +68,7 @@ class MainActivity : SimpleActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun refreshMenuItems() {
|
private fun refreshMenuItems() {
|
||||||
main_toolbar.menu.apply {
|
binding.mainToolbar.menu.apply {
|
||||||
findItem(R.id.more_apps_from_us).isVisible = !resources.getBoolean(R.bool.hide_google_relations)
|
findItem(R.id.more_apps_from_us).isVisible = !resources.getBoolean(R.bool.hide_google_relations)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,8 +93,10 @@ class MainActivity : SimpleActivity() {
|
||||||
private fun updateChangeKeyboardColor() {
|
private fun updateChangeKeyboardColor() {
|
||||||
val applyBackground = resources.getDrawable(R.drawable.button_background_rounded, theme) as RippleDrawable
|
val applyBackground = resources.getDrawable(R.drawable.button_background_rounded, theme) as RippleDrawable
|
||||||
(applyBackground as LayerDrawable).findDrawableByLayerId(R.id.button_background_holder).applyColorFilter(getProperPrimaryColor())
|
(applyBackground as LayerDrawable).findDrawableByLayerId(R.id.button_background_holder).applyColorFilter(getProperPrimaryColor())
|
||||||
change_keyboard.background = applyBackground
|
binding.changeKeyboard.apply {
|
||||||
change_keyboard.setTextColor(getProperPrimaryColor().getContrastColor())
|
background = applyBackground
|
||||||
|
setTextColor(getProperPrimaryColor().getContrastColor())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun isKeyboardEnabled(): Boolean {
|
private fun isKeyboardEnabled(): Boolean {
|
||||||
|
|
|
@ -13,34 +13,39 @@ import com.simplemobiletools.commons.helpers.*
|
||||||
import com.simplemobiletools.commons.interfaces.RefreshRecyclerViewListener
|
import com.simplemobiletools.commons.interfaces.RefreshRecyclerViewListener
|
||||||
import com.simplemobiletools.keyboard.R
|
import com.simplemobiletools.keyboard.R
|
||||||
import com.simplemobiletools.keyboard.adapters.ClipsActivityAdapter
|
import com.simplemobiletools.keyboard.adapters.ClipsActivityAdapter
|
||||||
|
import com.simplemobiletools.keyboard.databinding.ActivityManageClipboardItemsBinding
|
||||||
import com.simplemobiletools.keyboard.dialogs.AddOrEditClipDialog
|
import com.simplemobiletools.keyboard.dialogs.AddOrEditClipDialog
|
||||||
import com.simplemobiletools.keyboard.dialogs.ExportClipsDialog
|
import com.simplemobiletools.keyboard.dialogs.ExportClipsDialog
|
||||||
import com.simplemobiletools.keyboard.extensions.clipsDB
|
import com.simplemobiletools.keyboard.extensions.clipsDB
|
||||||
import com.simplemobiletools.keyboard.extensions.config
|
import com.simplemobiletools.keyboard.extensions.config
|
||||||
import com.simplemobiletools.keyboard.helpers.ClipsHelper
|
import com.simplemobiletools.keyboard.helpers.ClipsHelper
|
||||||
import com.simplemobiletools.keyboard.models.Clip
|
import com.simplemobiletools.keyboard.models.Clip
|
||||||
import kotlinx.android.synthetic.main.activity_manage_clipboard_items.*
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
import java.io.OutputStream
|
import java.io.OutputStream
|
||||||
|
|
||||||
class ManageClipboardItemsActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
class ManageClipboardItemsActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
||||||
private val PICK_EXPORT_CLIPS_INTENT = 21
|
companion object {
|
||||||
private val PICK_IMPORT_CLIPS_SOURCE_INTENT = 22
|
private const val PICK_EXPORT_CLIPS_INTENT = 21
|
||||||
|
private const val PICK_IMPORT_CLIPS_SOURCE_INTENT = 22
|
||||||
|
}
|
||||||
|
|
||||||
|
private val binding by lazy(LazyThreadSafetyMode.NONE) { ActivityManageClipboardItemsBinding.inflate(layoutInflater) }
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
isMaterialActivity = true
|
isMaterialActivity = true
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_manage_clipboard_items)
|
setContentView(binding.root)
|
||||||
setupOptionsMenu()
|
setupOptionsMenu()
|
||||||
updateTextColors(suggestions_items_holder)
|
updateTextColors(binding.suggestionsItemsHolder)
|
||||||
updateClips()
|
updateClips()
|
||||||
|
|
||||||
updateMaterialActivityViews(clipboard_coordinator, clipboard_items_list, useTransparentNavigation = true, useTopSearchMenu = false)
|
binding.apply {
|
||||||
setupMaterialScrollListener(clipboard_nested_scrollview, clipboard_toolbar)
|
updateMaterialActivityViews(clipboardCoordinator, clipboardItemsList, useTransparentNavigation = true, useTopSearchMenu = false)
|
||||||
|
setupMaterialScrollListener(clipboardNestedScrollview, clipboardToolbar)
|
||||||
|
|
||||||
clipboard_items_placeholder.text = "${getText(R.string.manage_clipboard_empty)}\n\n${getText(R.string.manage_clips)}"
|
clipboardItemsPlaceholder.text = "${getText(R.string.manage_clipboard_empty)}\n\n${getText(R.string.manage_clips)}"
|
||||||
clipboard_items_placeholder_2.apply {
|
clipboardItemsPlaceholder2.apply {
|
||||||
underlineText()
|
underlineText()
|
||||||
setTextColor(getProperPrimaryColor())
|
setTextColor(getProperPrimaryColor())
|
||||||
setOnClickListener {
|
setOnClickListener {
|
||||||
|
@ -48,10 +53,11 @@ class ManageClipboardItemsActivity : SimpleActivity(), RefreshRecyclerViewListen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
setupToolbar(clipboard_toolbar, NavigationIcon.Arrow)
|
setupToolbar(binding.clipboardToolbar, NavigationIcon.Arrow)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) {
|
override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) {
|
||||||
|
@ -67,7 +73,7 @@ class ManageClipboardItemsActivity : SimpleActivity(), RefreshRecyclerViewListen
|
||||||
|
|
||||||
|
|
||||||
private fun setupOptionsMenu() {
|
private fun setupOptionsMenu() {
|
||||||
clipboard_toolbar.setOnMenuItemClickListener { menuItem ->
|
binding.clipboardToolbar.setOnMenuItemClickListener { menuItem ->
|
||||||
when (menuItem.itemId) {
|
when (menuItem.itemId) {
|
||||||
R.id.add_clipboard_item -> {
|
R.id.add_clipboard_item -> {
|
||||||
addOrEditClip()
|
addOrEditClip()
|
||||||
|
@ -97,15 +103,17 @@ class ManageClipboardItemsActivity : SimpleActivity(), RefreshRecyclerViewListen
|
||||||
ensureBackgroundThread {
|
ensureBackgroundThread {
|
||||||
val clips = clipsDB.getClips().toMutableList() as ArrayList<Clip>
|
val clips = clipsDB.getClips().toMutableList() as ArrayList<Clip>
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
ClipsActivityAdapter(this, clips, clipboard_items_list, this) {
|
ClipsActivityAdapter(this, clips, binding.clipboardItemsList, this) {
|
||||||
addOrEditClip(it as Clip)
|
addOrEditClip(it as Clip)
|
||||||
}.apply {
|
}.apply {
|
||||||
clipboard_items_list.adapter = this
|
binding.clipboardItemsList.adapter = this
|
||||||
}
|
}
|
||||||
|
|
||||||
clipboard_items_list.beVisibleIf(clips.isNotEmpty())
|
binding.apply {
|
||||||
clipboard_items_placeholder.beVisibleIf(clips.isEmpty())
|
clipboardItemsList.beVisibleIf(clips.isNotEmpty())
|
||||||
clipboard_items_placeholder_2.beVisibleIf(clips.isEmpty())
|
clipboardItemsPlaceholder.beVisibleIf(clips.isEmpty())
|
||||||
|
clipboardItemsPlaceholder2.beVisibleIf(clips.isEmpty())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,29 +7,31 @@ import com.simplemobiletools.commons.extensions.*
|
||||||
import com.simplemobiletools.commons.helpers.NavigationIcon
|
import com.simplemobiletools.commons.helpers.NavigationIcon
|
||||||
import com.simplemobiletools.commons.helpers.isTiramisuPlus
|
import com.simplemobiletools.commons.helpers.isTiramisuPlus
|
||||||
import com.simplemobiletools.commons.models.RadioItem
|
import com.simplemobiletools.commons.models.RadioItem
|
||||||
import com.simplemobiletools.keyboard.R
|
import com.simplemobiletools.keyboard.databinding.ActivitySettingsBinding
|
||||||
import com.simplemobiletools.keyboard.extensions.config
|
import com.simplemobiletools.keyboard.extensions.config
|
||||||
import com.simplemobiletools.keyboard.extensions.getKeyboardLanguageText
|
import com.simplemobiletools.keyboard.extensions.getKeyboardLanguageText
|
||||||
import com.simplemobiletools.keyboard.extensions.getKeyboardLanguages
|
import com.simplemobiletools.keyboard.extensions.getKeyboardLanguages
|
||||||
import com.simplemobiletools.keyboard.helpers.*
|
import com.simplemobiletools.keyboard.helpers.*
|
||||||
import kotlinx.android.synthetic.main.activity_settings.*
|
import java.util.Locale
|
||||||
import java.util.*
|
|
||||||
import kotlin.system.exitProcess
|
import kotlin.system.exitProcess
|
||||||
|
|
||||||
class SettingsActivity : SimpleActivity() {
|
class SettingsActivity : SimpleActivity() {
|
||||||
|
private val binding by lazy(LazyThreadSafetyMode.NONE) { ActivitySettingsBinding.inflate(layoutInflater) }
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
isMaterialActivity = true
|
isMaterialActivity = true
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_settings)
|
setContentView(binding.root)
|
||||||
|
|
||||||
updateMaterialActivityViews(settings_coordinator, settings_holder, useTransparentNavigation = false, useTopSearchMenu = false)
|
binding.apply {
|
||||||
setupMaterialScrollListener(settings_nested_scrollview, settings_toolbar)
|
updateMaterialActivityViews(settingsCoordinator, settingsHolder, useTransparentNavigation = false, useTopSearchMenu = false)
|
||||||
|
setupMaterialScrollListener(settingsNestedScrollview, settingsToolbar)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
setupToolbar(settings_toolbar, NavigationIcon.Arrow)
|
setupToolbar(binding.settingsToolbar, NavigationIcon.Arrow)
|
||||||
|
|
||||||
setupPurchaseThankYou()
|
setupPurchaseThankYou()
|
||||||
setupCustomizeColors()
|
setupCustomizeColors()
|
||||||
|
@ -45,47 +47,57 @@ class SettingsActivity : SimpleActivity() {
|
||||||
setupSentencesCapitalization()
|
setupSentencesCapitalization()
|
||||||
setupShowNumbersRow()
|
setupShowNumbersRow()
|
||||||
|
|
||||||
updateTextColors(settings_nested_scrollview)
|
binding.apply {
|
||||||
|
updateTextColors(settingsNestedScrollview)
|
||||||
|
|
||||||
arrayOf(settings_color_customization_section_label, settings_general_settings_label).forEach {
|
arrayOf(settingsColorCustomizationSectionLabel, settingsGeneralSettingsLabel).forEach {
|
||||||
it.setTextColor(getProperPrimaryColor())
|
it.setTextColor(getProperPrimaryColor())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun setupPurchaseThankYou() {
|
private fun setupPurchaseThankYou() {
|
||||||
settings_purchase_thank_you_holder.beGoneIf(isOrWasThankYouInstalled())
|
binding.apply {
|
||||||
settings_purchase_thank_you_holder.setOnClickListener {
|
settingsPurchaseThankYouHolder.beGoneIf(isOrWasThankYouInstalled())
|
||||||
|
settingsPurchaseThankYouHolder.setOnClickListener {
|
||||||
launchPurchaseThankYouIntent()
|
launchPurchaseThankYouIntent()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun setupCustomizeColors() {
|
private fun setupCustomizeColors() {
|
||||||
settings_color_customization_label.text = getCustomizeColorsString()
|
binding.apply {
|
||||||
settings_color_customization_holder.setOnClickListener {
|
settingsColorCustomizationLabel.text = getCustomizeColorsString()
|
||||||
|
settingsColorCustomizationHolder.setOnClickListener {
|
||||||
handleCustomizeColorsClick()
|
handleCustomizeColorsClick()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun setupUseEnglish() {
|
private fun setupUseEnglish() {
|
||||||
settings_use_english_holder.beVisibleIf((config.wasUseEnglishToggled || Locale.getDefault().language != "en") && !isTiramisuPlus())
|
binding.apply {
|
||||||
settings_use_english.isChecked = config.useEnglish
|
settingsUseEnglishHolder.beVisibleIf((config.wasUseEnglishToggled || Locale.getDefault().language != "en") && !isTiramisuPlus())
|
||||||
settings_use_english_holder.setOnClickListener {
|
settingsUseEnglish.isChecked = config.useEnglish
|
||||||
settings_use_english.toggle()
|
settingsUseEnglishHolder.setOnClickListener {
|
||||||
config.useEnglish = settings_use_english.isChecked
|
settingsUseEnglish.toggle()
|
||||||
|
config.useEnglish = settingsUseEnglish.isChecked
|
||||||
exitProcess(0)
|
exitProcess(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun setupLanguage() {
|
private fun setupLanguage() {
|
||||||
settings_language.text = Locale.getDefault().displayLanguage
|
binding.apply {
|
||||||
settings_language_holder.beVisibleIf(isTiramisuPlus())
|
settingsLanguage.text = Locale.getDefault().displayLanguage
|
||||||
settings_language_holder.setOnClickListener {
|
settingsLanguageHolder.beVisibleIf(isTiramisuPlus())
|
||||||
|
settingsLanguageHolder.setOnClickListener {
|
||||||
launchChangeAppLanguageIntent()
|
launchChangeAppLanguageIntent()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun setupManageClipboardItems() {
|
private fun setupManageClipboardItems() {
|
||||||
settings_manage_clipboard_items_holder.setOnClickListener {
|
binding.settingsManageClipboardItemsHolder.setOnClickListener {
|
||||||
Intent(this, ManageClipboardItemsActivity::class.java).apply {
|
Intent(this, ManageClipboardItemsActivity::class.java).apply {
|
||||||
startActivity(this)
|
startActivity(this)
|
||||||
}
|
}
|
||||||
|
@ -93,43 +105,52 @@ class SettingsActivity : SimpleActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupVibrateOnKeypress() {
|
private fun setupVibrateOnKeypress() {
|
||||||
settings_vibrate_on_keypress.isChecked = config.vibrateOnKeypress
|
binding.apply {
|
||||||
settings_vibrate_on_keypress_holder.setOnClickListener {
|
settingsVibrateOnKeypress.isChecked = config.vibrateOnKeypress
|
||||||
settings_vibrate_on_keypress.toggle()
|
settingsVibrateOnKeypressHolder.setOnClickListener {
|
||||||
config.vibrateOnKeypress = settings_vibrate_on_keypress.isChecked
|
settingsVibrateOnKeypress.toggle()
|
||||||
|
config.vibrateOnKeypress = settingsVibrateOnKeypress.isChecked
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupShowPopupOnKeypress() {
|
private fun setupShowPopupOnKeypress() {
|
||||||
settings_show_popup_on_keypress.isChecked = config.showPopupOnKeypress
|
binding.apply {
|
||||||
settings_show_popup_on_keypress_holder.setOnClickListener {
|
settingsShowPopupOnKeypress.isChecked = config.showPopupOnKeypress
|
||||||
settings_show_popup_on_keypress.toggle()
|
settingsShowPopupOnKeypressHolder.setOnClickListener {
|
||||||
config.showPopupOnKeypress = settings_show_popup_on_keypress.isChecked
|
settingsShowPopupOnKeypress.toggle()
|
||||||
|
config.showPopupOnKeypress = settingsShowPopupOnKeypress.isChecked
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupShowKeyBorders() {
|
private fun setupShowKeyBorders() {
|
||||||
settings_show_key_borders.isChecked = config.showKeyBorders
|
binding.apply {
|
||||||
settings_show_key_borders_holder.setOnClickListener {
|
settingsShowKeyBorders.isChecked = config.showKeyBorders
|
||||||
settings_show_key_borders.toggle()
|
settingsShowKeyBordersHolder.setOnClickListener {
|
||||||
config.showKeyBorders = settings_show_key_borders.isChecked
|
settingsShowKeyBorders.toggle()
|
||||||
|
config.showKeyBorders = settingsShowKeyBorders.isChecked
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupKeyboardLanguage() {
|
private fun setupKeyboardLanguage() {
|
||||||
settings_keyboard_language.text = getKeyboardLanguageText(config.keyboardLanguage)
|
binding.apply {
|
||||||
settings_keyboard_language_holder.setOnClickListener {
|
settingsKeyboardLanguage.text = getKeyboardLanguageText(config.keyboardLanguage)
|
||||||
|
settingsKeyboardLanguageHolder.setOnClickListener {
|
||||||
val items = getKeyboardLanguages()
|
val items = getKeyboardLanguages()
|
||||||
RadioGroupDialog(this@SettingsActivity, items, config.keyboardLanguage) {
|
RadioGroupDialog(this@SettingsActivity, items, config.keyboardLanguage) {
|
||||||
config.keyboardLanguage = it as Int
|
config.keyboardLanguage = it as Int
|
||||||
settings_keyboard_language.text = getKeyboardLanguageText(config.keyboardLanguage)
|
settingsKeyboardLanguage.text = getKeyboardLanguageText(config.keyboardLanguage)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupKeyboardHeightMultiplier() {
|
private fun setupKeyboardHeightMultiplier() {
|
||||||
settings_keyboard_height_multiplier.text = getKeyboardHeightPercentageText(config.keyboardHeightPercentage)
|
binding.apply {
|
||||||
settings_keyboard_height_multiplier_holder.setOnClickListener {
|
settingsKeyboardHeightMultiplier.text = getKeyboardHeightPercentageText(config.keyboardHeightPercentage)
|
||||||
|
settingsKeyboardHeightMultiplierHolder.setOnClickListener {
|
||||||
val items = arrayListOf(
|
val items = arrayListOf(
|
||||||
RadioItem(KEYBOARD_HEIGHT_70_PERCENT, getKeyboardHeightPercentageText(KEYBOARD_HEIGHT_70_PERCENT)),
|
RadioItem(KEYBOARD_HEIGHT_70_PERCENT, getKeyboardHeightPercentageText(KEYBOARD_HEIGHT_70_PERCENT)),
|
||||||
RadioItem(KEYBOARD_HEIGHT_80_PERCENT, getKeyboardHeightPercentageText(KEYBOARD_HEIGHT_80_PERCENT)),
|
RadioItem(KEYBOARD_HEIGHT_80_PERCENT, getKeyboardHeightPercentageText(KEYBOARD_HEIGHT_80_PERCENT)),
|
||||||
|
@ -142,7 +163,8 @@ class SettingsActivity : SimpleActivity() {
|
||||||
|
|
||||||
RadioGroupDialog(this@SettingsActivity, items, config.keyboardHeightPercentage) {
|
RadioGroupDialog(this@SettingsActivity, items, config.keyboardHeightPercentage) {
|
||||||
config.keyboardHeightPercentage = it as Int
|
config.keyboardHeightPercentage = it as Int
|
||||||
settings_keyboard_height_multiplier.text = getKeyboardHeightPercentageText(config.keyboardHeightPercentage)
|
settingsKeyboardHeightMultiplier.text = getKeyboardHeightPercentageText(config.keyboardHeightPercentage)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -150,26 +172,32 @@ class SettingsActivity : SimpleActivity() {
|
||||||
private fun getKeyboardHeightPercentageText(keyboardHeightPercentage: Int): String = "$keyboardHeightPercentage%"
|
private fun getKeyboardHeightPercentageText(keyboardHeightPercentage: Int): String = "$keyboardHeightPercentage%"
|
||||||
|
|
||||||
private fun setupShowClipboardContent() {
|
private fun setupShowClipboardContent() {
|
||||||
settings_show_clipboard_content.isChecked = config.showClipboardContent
|
binding.apply {
|
||||||
settings_show_clipboard_content_holder.setOnClickListener {
|
settingsShowClipboardContent.isChecked = config.showClipboardContent
|
||||||
settings_show_clipboard_content.toggle()
|
settingsShowClipboardContentHolder.setOnClickListener {
|
||||||
config.showClipboardContent = settings_show_clipboard_content.isChecked
|
settingsShowClipboardContent.toggle()
|
||||||
|
config.showClipboardContent = settingsShowClipboardContent.isChecked
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupSentencesCapitalization() {
|
private fun setupSentencesCapitalization() {
|
||||||
settings_start_sentences_capitalized.isChecked = config.enableSentencesCapitalization
|
binding.apply {
|
||||||
settings_start_sentences_capitalized_holder.setOnClickListener {
|
settingsStartSentencesCapitalized.isChecked = config.enableSentencesCapitalization
|
||||||
settings_start_sentences_capitalized.toggle()
|
settingsStartSentencesCapitalizedHolder.setOnClickListener {
|
||||||
config.enableSentencesCapitalization = settings_start_sentences_capitalized.isChecked
|
settingsStartSentencesCapitalized.toggle()
|
||||||
|
config.enableSentencesCapitalization = settingsStartSentencesCapitalized.isChecked
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupShowNumbersRow() {
|
private fun setupShowNumbersRow() {
|
||||||
settings_show_numbers_row.isChecked = config.showNumbersRow
|
binding.apply {
|
||||||
settings_show_numbers_row_holder.setOnClickListener {
|
settingsShowNumbersRow.isChecked = config.showNumbersRow
|
||||||
settings_show_numbers_row.toggle()
|
settingsShowNumbersRowHolder.setOnClickListener {
|
||||||
config.showNumbersRow = settings_show_numbers_row.isChecked
|
settingsShowNumbersRow.toggle()
|
||||||
|
config.showNumbersRow = settingsShowNumbersRow.isChecked
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue