Skip to content

Commit 4b5380b

Browse files
authored
Merge branch 'main' into hide-clipboard
2 parents 62c156b + a1dd2fd commit 4b5380b

32 files changed

+294
-140
lines changed

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ android {
6565
}
6666

6767
dependencies {
68-
implementation 'com.github.SimpleMobileTools:Simple-Commons:6323be1fd7'
68+
implementation 'com.github.SimpleMobileTools:Simple-Commons:a85f77a67f'
6969
implementation 'androidx.emoji2:emoji2-bundled:1.2.0'
7070

7171
kapt 'androidx.room:room-compiler:2.4.3'

app/src/main/kotlin/com/simplemobiletools/keyboard/activities/MainActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class MainActivity : SimpleActivity() {
2323
setupOptionsMenu()
2424
refreshMenuItems()
2525

26-
updateMaterialActivityViews(main_coordinator, main_holder)
26+
updateMaterialActivityViews(main_coordinator, main_holder, useTransparentNavigation = false, useTopSearchMenu = false)
2727
setupMaterialScrollListener(main_nested_scrollview, main_toolbar)
2828

2929
change_keyboard_holder.setOnClickListener {

app/src/main/kotlin/com/simplemobiletools/keyboard/activities/ManageClipboardItemsActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class ManageClipboardItemsActivity : SimpleActivity(), RefreshRecyclerViewListen
3636
updateTextColors(clipboard_items_holder)
3737
updateClips()
3838

39-
updateMaterialActivityViews(clipboard_coordinator, clipboard_items_list)
39+
updateMaterialActivityViews(clipboard_coordinator, clipboard_items_list, useTransparentNavigation = true, useTopSearchMenu = false)
4040
setupMaterialScrollListener(clipboard_nested_scrollview, clipboard_toolbar)
4141

4242
clipboard_items_placeholder.text = "${getText(R.string.manage_clipboard_empty)}\n\n${getText(R.string.manage_clips)}"

app/src/main/kotlin/com/simplemobiletools/keyboard/activities/SettingsActivity.kt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class SettingsActivity : SimpleActivity() {
2525
super.onCreate(savedInstanceState)
2626
setContentView(R.layout.activity_settings)
2727

28-
updateMaterialActivityViews(settings_coordinator, settings_holder)
28+
updateMaterialActivityViews(settings_coordinator, settings_holder, useTransparentNavigation = false, useTopSearchMenu = false)
2929
setupMaterialScrollListener(settings_nested_scrollview, settings_toolbar)
3030
}
3131

@@ -40,6 +40,7 @@ class SettingsActivity : SimpleActivity() {
4040
setupManageClipboardItems()
4141
setupVibrateOnKeypress()
4242
setupShowPopupOnKeypress()
43+
setupShowKeyBorders()
4344
setupKeyboardLanguage()
4445
setupKeyboardHeightMultiplier()
4546
setupShowClipboardContent()
@@ -107,6 +108,14 @@ class SettingsActivity : SimpleActivity() {
107108
}
108109
}
109110

111+
private fun setupShowKeyBorders() {
112+
settings_show_key_borders.isChecked = config.showKeyBorders
113+
settings_show_key_borders_holder.setOnClickListener {
114+
settings_show_key_borders.toggle()
115+
config.showKeyBorders = settings_show_key_borders.isChecked
116+
}
117+
}
118+
110119
private fun setupKeyboardLanguage() {
111120
settings_keyboard_language.text = getKeyboardLanguageText(config.keyboardLanguage)
112121
settings_keyboard_language_holder.setOnClickListener {

app/src/main/kotlin/com/simplemobiletools/keyboard/helpers/Config.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ class Config(context: Context) : BaseConfig(context) {
1717
get() = prefs.getBoolean(SHOW_POPUP_ON_KEYPRESS, true)
1818
set(showPopupOnKeypress) = prefs.edit().putBoolean(SHOW_POPUP_ON_KEYPRESS, showPopupOnKeypress).apply()
1919

20+
var showKeyBorders: Boolean
21+
get() = prefs.getBoolean(SHOW_KEY_BORDERS, false)
22+
set(showKeyBorders) = prefs.edit().putBoolean(SHOW_KEY_BORDERS, showKeyBorders).apply()
23+
2024
var lastExportedClipsFolder: String
2125
get() = prefs.getString(LAST_EXPORTED_CLIPS_FOLDER, "")!!
2226
set(lastExportedClipsFolder) = prefs.edit().putString(LAST_EXPORTED_CLIPS_FOLDER, lastExportedClipsFolder).apply()

app/src/main/kotlin/com/simplemobiletools/keyboard/helpers/Constants.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const val MAX_KEYS_PER_MINI_ROW = 9
1010
// shared prefs
1111
const val VIBRATE_ON_KEYPRESS = "vibrate_on_keypress"
1212
const val SHOW_POPUP_ON_KEYPRESS = "show_popup_on_keypress"
13+
const val SHOW_KEY_BORDERS = "show_key_borders"
1314
const val LAST_EXPORTED_CLIPS_FOLDER = "last_exported_clips_folder"
1415
const val KEYBOARD_LANGUAGE = "keyboard_language"
1516
const val HEIGHT_MULTIPLIER = "height_multiplier"

app/src/main/kotlin/com/simplemobiletools/keyboard/services/SimpleKeyboardIME.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.simplemobiletools.keyboard.services
22

3+
import android.content.SharedPreferences
34
import android.inputmethodservice.InputMethodService
45
import android.text.InputType
56
import android.text.InputType.TYPE_CLASS_DATETIME
@@ -14,14 +15,15 @@ import android.view.inputmethod.EditorInfo.IME_ACTION_NONE
1415
import android.view.inputmethod.EditorInfo.IME_FLAG_NO_ENTER_ACTION
1516
import android.view.inputmethod.EditorInfo.IME_MASK_ACTION
1617
import android.view.inputmethod.ExtractedTextRequest
18+
import com.simplemobiletools.commons.extensions.getSharedPrefs
1719
import com.simplemobiletools.keyboard.R
1820
import com.simplemobiletools.keyboard.extensions.config
1921
import com.simplemobiletools.keyboard.helpers.*
2022
import com.simplemobiletools.keyboard.views.MyKeyboardView
2123
import kotlinx.android.synthetic.main.keyboard_view_keyboard.view.*
2224

2325
// based on https://www.androidauthority.com/lets-build-custom-keyboard-android-832362/
24-
class SimpleKeyboardIME : InputMethodService(), MyKeyboardView.OnKeyboardActionListener {
26+
class SimpleKeyboardIME : InputMethodService(), MyKeyboardView.OnKeyboardActionListener, SharedPreferences.OnSharedPreferenceChangeListener {
2527
private var SHIFT_PERM_TOGGLE_SPEED = 500 // how quickly do we have to doubletap shift to enable permanent caps lock
2628
private val KEYBOARD_LETTERS = 0
2729
private val KEYBOARD_SYMBOLS = 1
@@ -38,6 +40,7 @@ class SimpleKeyboardIME : InputMethodService(), MyKeyboardView.OnKeyboardActionL
3840
override fun onInitializeInterface() {
3941
super.onInitializeInterface()
4042
keyboard = MyKeyboard(this, getKeyboardLayoutXML(), enterKeyType)
43+
getSharedPrefs().registerOnSharedPreferenceChangeListener(this)
4144
}
4245

4346
override fun onCreateInputView(): View {
@@ -275,4 +278,8 @@ class SimpleKeyboardIME : InputMethodService(), MyKeyboardView.OnKeyboardActionL
275278
else -> R.xml.keys_letters_english_qwerty
276279
}
277280
}
281+
282+
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?) {
283+
keyboardView?.setupKeyboard()
284+
}
278285
}

0 commit comments

Comments
 (0)