mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-06-04 05:40:17 +00:00
allow overriding sdk level for determining which emojis are shown
might show that dreaded [x] symbol, but allows newer emojis on older android versions with upgraded fonts
This commit is contained in:
parent
465fc86e61
commit
7339000df3
7 changed files with 52 additions and 4 deletions
|
@ -134,6 +134,7 @@ class AdvancedSettingsFragment : SubScreenFragment() {
|
|||
removePreference("load_gesture_library")
|
||||
}
|
||||
setupKeyLongpressTimeoutSettings()
|
||||
setupEmojiSdkSetting()
|
||||
findPreference<Preference>("load_gesture_library")?.setOnPreferenceClickListener { onClickLoadLibrary() }
|
||||
findPreference<Preference>("backup_restore")?.setOnPreferenceClickListener { showBackupRestoreDialog() }
|
||||
|
||||
|
@ -535,10 +536,45 @@ class AdvancedSettingsFragment : SubScreenFragment() {
|
|||
})
|
||||
}
|
||||
|
||||
private fun setupEmojiSdkSetting() {
|
||||
val prefs = sharedPreferences
|
||||
findPreference<SeekBarDialogPreference>(Settings.PREF_EMOJI_MAX_SDK)?.setInterface(object : ValueProxy {
|
||||
override fun writeValue(value: Int, key: String) = prefs.edit().putInt(key, value).apply()
|
||||
|
||||
override fun writeDefaultValue(key: String) = prefs.edit().remove(key).apply()
|
||||
|
||||
override fun readValue(key: String) = prefs.getInt(Settings.PREF_EMOJI_MAX_SDK, Build.VERSION.SDK_INT)
|
||||
|
||||
override fun readDefaultValue(key: String) = Build.VERSION.SDK_INT
|
||||
|
||||
override fun getValueText(value: Int) = "Android " + when(value) {
|
||||
21 -> "5.0"
|
||||
22 -> "5.1"
|
||||
23 -> "6"
|
||||
24 -> "7.0"
|
||||
25 -> "7.1"
|
||||
26 -> "8.0"
|
||||
27 -> "8.1"
|
||||
28 -> "9"
|
||||
29 -> "10"
|
||||
30 -> "11"
|
||||
31 -> "12"
|
||||
32 -> "12L"
|
||||
33 -> "13"
|
||||
34 -> "14"
|
||||
35 -> "15"
|
||||
else -> "version unknown"
|
||||
}
|
||||
|
||||
override fun feedbackValue(value: Int) {}
|
||||
})
|
||||
}
|
||||
|
||||
override fun onSharedPreferenceChanged(prefs: SharedPreferences, key: String?) {
|
||||
when (key) {
|
||||
Settings.PREF_SHOW_SETUP_WIZARD_ICON -> SystemBroadcastReceiver.toggleAppIcon(requireContext())
|
||||
Settings.PREF_MORE_POPUP_KEYS -> KeyboardLayoutSet.onSystemLocaleChanged()
|
||||
Settings.PREF_EMOJI_MAX_SDK -> KeyboardSwitcher.getInstance().forceUpdateKeyboardTheme(requireContext())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -174,6 +174,7 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
|||
public static final String PREF_SPACE_BAR_TEXT = "space_bar_text";
|
||||
|
||||
// Emoji
|
||||
public static final String PREF_EMOJI_MAX_SDK = "emoji_max_sdk";
|
||||
public static final String PREF_EMOJI_RECENT_KEYS = "emoji_recent_keys";
|
||||
public static final String PREF_LAST_SHOWN_EMOJI_CATEGORY_ID = "last_shown_emoji_category_id";
|
||||
public static final String PREF_LAST_SHOWN_EMOJI_CATEGORY_PAGE_ID = "last_shown_emoji_category_page_id";
|
||||
|
|
|
@ -11,6 +11,7 @@ import android.content.Context;
|
|||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputMethodSubtype;
|
||||
|
||||
|
@ -138,6 +139,7 @@ public class SettingsValues {
|
|||
public final boolean mIncognitoModeEnabled;
|
||||
public final boolean mLongPressSymbolsForNumpad;
|
||||
public final boolean mHasCustomFunctionalLayout;
|
||||
public final int mEmojiMaxSdk;
|
||||
|
||||
// User-defined colors
|
||||
public final Colors mColors;
|
||||
|
@ -268,6 +270,7 @@ public class SettingsValues {
|
|||
mAlphaAfterSymbolAndSpace = prefs.getBoolean(Settings.PREF_ABC_AFTER_SYMBOL_SPACE, true);
|
||||
mRemoveRedundantPopups = prefs.getBoolean(Settings.PREF_REMOVE_REDUNDANT_POPUPS, false);
|
||||
mSpaceBarText = prefs.getString(Settings.PREF_SPACE_BAR_TEXT, "");
|
||||
mEmojiMaxSdk = prefs.getInt(Settings.PREF_EMOJI_MAX_SDK, Build.VERSION.SDK_INT);
|
||||
}
|
||||
|
||||
public boolean isApplicationSpecifiedCompletionsOn() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue