0
0
mirror of https://github.com/florisboard/florisboard.git synced 2024-09-20 03:52:18 +02:00

Merge pull request #8 from hamedsj/master

Add Disable Checkbox for "Preview Popup" feature
This commit is contained in:
Patrick Goldinger 2020-08-10 21:54:45 +02:00 committed by GitHub
commit 9a9445dab1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 49 additions and 3 deletions

View File

@ -44,7 +44,8 @@
{ "code": 1577, "label": "ة" }
],
"ک": [
{ "code": 1603, "label": "ك" }
{ "code": 1603, "label": "ك" },
{ "code": 1706, "label": "ڪ"}
],
"ز": [
{ "code": 1688, "label": "ژ" }

View File

@ -21,6 +21,7 @@
] },
{ "code": 32, "label": " " },
{ "code": 8204, "label": "half_space", "variation": "normal" },
{ "code": 1600, "label": "kashida", "variation": "normal" },
{ "code": 46, "label": ".", "variation": "email_address" },
{ "code": 46, "label": ".", "variation": "normal" },
{ "code": 46, "label": ".", "variation": "uri" },

View File

@ -41,6 +41,7 @@ class PrefHelper(
val keyboard = Keyboard(this)
val looknfeel = Looknfeel(this)
val suggestion = Suggestion(this)
val popup = PopUp(this)
val theme = Theme(this)
/**
@ -268,6 +269,19 @@ class PrefHelper(
private set
}
/**
* Wrapper class for popup preferences.
*/
class PopUp(private val prefHelper: PrefHelper) {
companion object {
const val ENABLED = "popup__enabled"
}
var enabled: Boolean = false
get() = prefHelper.getPref(ENABLED, true)
private set
}
/**
* Wrapper class for theme preferences.
*/

View File

@ -70,5 +70,6 @@ object KeyCode {
const val TOGGLE_ONE_HANDED_MODE = -215
const val URI_COMPONENT_TLD = -255
const val KESHIDA = 1600
const val HALF_SPACE = 8204
}

View File

@ -174,7 +174,11 @@ class KeyView(
event ?: return false
when (event.actionMasked) {
MotionEvent.ACTION_DOWN -> {
keyboardView.popupManager.show(this)
florisboard?.prefs?.popup?.let {
if (it.enabled){
keyboardView.popupManager.show(this)
}
}
isKeyPressed = true
florisboard?.keyPressVibrate()
florisboard?.keyPressSound(data)
@ -426,7 +430,7 @@ class KeyView(
updateKeyPressedBackground()
if (data.type == KeyType.CHARACTER && data.code != KeyCode.SPACE
&& data.code != KeyCode.HALF_SPACE || data.type == KeyType.NUMERIC
&& data.code != KeyCode.HALF_SPACE && data.code != KeyCode.KESHIDA || data.type == KeyType.NUMERIC
) {
label = getComputedLetter()
} else {
@ -516,6 +520,9 @@ class KeyView(
KeyCode.HALF_SPACE -> {
label = resources.getString(R.string.key__view_half_space)
}
KeyCode.KESHIDA -> {
label = resources.getString(R.string.key__view_keshida)
}
}
}

View File

@ -58,8 +58,11 @@
<string name="pref__suggestion__use_pref_words__label">Suggerimenti per la parola successiva</string>
<string name="pref__suggestion__use_pref_words__summary">Utilizzare le parole precedenti per generare suggerimenti</string>
<string name="pref__correction__title">Correzioni</string>
<string name="pref__popup__title">PopUp</string>
<string name="pref__correction__double_space_period__label">Doppio tocco barra spaziatrice</string>
<string name="pref__correction__double_space_period__summary">Doppio tocco su barra spaziatrice per mettere il punto (.) seguito da uno spazio</string>
<string name="pref__popup__visible__label">Visibilità Popup</string>
<string name="pref__popup__visible__summary">Mostra popup quando si preme un tasto</string>
<string name="settings__looknfeel__title">Aspetto &amp; funzionalità</string>
<string name="pref__looknfeel__group_layout__label">Layout</string>

View File

@ -59,8 +59,11 @@
<string name="pref__suggestion__use_pref_words__label">[NYI] Next-word suggestions</string>
<string name="pref__suggestion__use_pref_words__summary">Use previous words for generating suggestions</string>
<string name="pref__correction__title">Corrections</string>
<string name="pref__popup__title">PopUp</string>
<string name="pref__correction__double_space_period__label">Double-space period</string>
<string name="pref__correction__double_space_period__summary">Tapping twice on spacebar inserts a period followed by a space</string>
<string name="pref__popup__visible__label">PopUp Visibility</string>
<string name="pref__popup__visible__summary">Show popup when you press a key</string>
<string name="settings__looknfeel__title">Look &amp; feel</string>
<string name="pref__looknfeel__group_layout__label">Layout</string>

View File

@ -11,6 +11,7 @@
<string name="key__view_symbols" translatable="false">\?123</string>
<string name="key__view_symbols2" translatable="false">=\\&lt;</string>
<string name="key__view_half_space" translatable="false">&#8626;</string>
<string name="key__view_keshida" translatable="false">"یــــ"</string>
<!-- Media strings -->
<string name="media__tab__emoticons_label" translatable="false">;-)</string>

View File

@ -36,4 +36,19 @@
</PreferenceCategory>
<PreferenceCategory
app:iconSpaceReserved="false"
app:title="@string/pref__popup__title">
<SwitchPreferenceCompat
android:defaultValue="true"
app:key="popup__enabled"
app:iconSpaceReserved="false"
app:title="@string/pref__popup__visible__label"
app:summary="@string/pref__popup__visible__summary"/>
</PreferenceCategory>
</PreferenceScreen>