set keyboard icon ids per style in keyboardIconsSet instead of using styleable

increases flexibility
preparation for planned changes
This commit is contained in:
Helium314 2024-08-24 23:46:13 +02:00
parent 8a457c1821
commit aed5704582
15 changed files with 274 additions and 340 deletions

View file

@ -74,7 +74,7 @@ class ClipboardHistoryView @JvmOverloads constructor(
// in suggestionStripView the same thing works correctly, wtf? // in suggestionStripView the same thing works correctly, wtf?
// need to properly fix it (and maybe undo the inverted isActivated) when adding a toggle key // need to properly fix it (and maybe undo the inverted isActivated) when adding a toggle key
getEnabledClipboardToolbarKeys(DeviceProtectedUtils.getSharedPreferences(context)) getEnabledClipboardToolbarKeys(DeviceProtectedUtils.getSharedPreferences(context))
.forEach { toolbarKeys.add(createToolbarKey(context, keyboardAttr, it)) } .forEach { toolbarKeys.add(createToolbarKey(context, KeyboardIconsSet.instance, it)) }
keyboardAttr.recycle() keyboardAttr.recycle()
} }

View file

@ -1,31 +1,50 @@
package helium314.keyboard.keyboard.internal package helium314.keyboard.keyboard.internal
import android.content.Context
import android.content.res.Resources import android.content.res.Resources
import android.content.res.TypedArray
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import androidx.core.content.ContextCompat
import helium314.keyboard.keyboard.KeyboardTheme
import helium314.keyboard.latin.R import helium314.keyboard.latin.R
import helium314.keyboard.latin.settings.Settings
import helium314.keyboard.latin.utils.DeviceProtectedUtils
import helium314.keyboard.latin.utils.Log import helium314.keyboard.latin.utils.Log
import helium314.keyboard.latin.utils.ToolbarKey import helium314.keyboard.latin.utils.ToolbarKey
import helium314.keyboard.latin.utils.getStyleableIconId
import java.util.Locale import java.util.Locale
class KeyboardIconsSet { class KeyboardIconsSet private constructor() {
private val iconsByName = HashMap<String, Drawable>(styleableIdByName.size) private var iconIds = emptyMap<String, Int>()
private val iconsByName = HashMap<String, Drawable>(80)
fun loadIcons(keyboardAttrs: TypedArray) { fun loadIcons(context: Context) {
styleableIdByName.forEach { (name, id) -> val prefs = DeviceProtectedUtils.getSharedPreferences(context)
val theme = prefs.getString(Settings.PREF_THEME_STYLE, KeyboardTheme.STYLE_MATERIAL)
val ids = when (theme) {
KeyboardTheme.STYLE_HOLO -> keyboardIconsHolo
KeyboardTheme.STYLE_ROUNDED -> keyboardIconsRounded
else -> keyboardIconsMaterial
}
if (ids == iconIds) return
iconIds = ids
iconsByName.clear()
ids.forEach { (name, id) ->
try { try {
val icon = keyboardAttrs.getDrawable(id) ?: return@forEach val icon = ContextCompat.getDrawable(context, id) ?: return@forEach
icon.setBounds(0, 0, icon.intrinsicWidth, icon.intrinsicHeight) icon.setBounds(0, 0, icon.intrinsicWidth, icon.intrinsicHeight)
iconsByName[name] = icon iconsByName[name] = icon
} catch (e: Resources.NotFoundException) { } catch (e: Resources.NotFoundException) {
Log.w(TAG, "Drawable resource for icon #${keyboardAttrs.resources.getResourceEntryName(id)} not found") Log.w(TAG, "Drawable resource for icon $name not found")
} }
} }
} }
fun getIconDrawable(name: String?) = iconsByName[name] fun getIconDrawable(name: String?): Drawable? = iconsByName[name?.lowercase(Locale.US)]
/** gets drawable from resources, with mutate (might be necessary to avoid coloring issues...) */
fun getNewDrawable(name: String?, context: Context): Drawable? =
iconIds[name?.lowercase(Locale.US)]?.let { ContextCompat.getDrawable(context, it)?.mutate() }
// sometimes there are 2 names for the same icon for historic reasons,
// and removing needs to be handled with care to not break custom themes
companion object { companion object {
private val TAG = KeyboardIconsSet::class.simpleName private val TAG = KeyboardIconsSet::class.simpleName
const val PREFIX_ICON = "!icon/" const val PREFIX_ICON = "!icon/"
@ -60,7 +79,10 @@ class KeyboardIconsSet {
const val NAME_START_ONEHANDED_KEY = "start_onehanded_mode_key" const val NAME_START_ONEHANDED_KEY = "start_onehanded_mode_key"
const val NAME_STOP_ONEHANDED_KEY = "stop_onehanded_mode_key" const val NAME_STOP_ONEHANDED_KEY = "stop_onehanded_mode_key"
const val NAME_SWITCH_ONEHANDED_KEY = "switch_onehanded_key" const val NAME_SWITCH_ONEHANDED_KEY = "switch_onehanded_key"
const val NAME_RESIZE_ONEHANDED_KEY = "resize_onehanded_key"
const val NAME_TOOLBAR_KEY = "toolbar_key"
const val NAME_BIN = "bin"
/*
private val styleableIdByName = hashMapOf( private val styleableIdByName = hashMapOf(
NAME_SHIFT_KEY to R.styleable.Keyboard_iconShiftKey, NAME_SHIFT_KEY to R.styleable.Keyboard_iconShiftKey,
NAME_DELETE_KEY to R.styleable.Keyboard_iconDeleteKey, NAME_DELETE_KEY to R.styleable.Keyboard_iconDeleteKey,
@ -93,5 +115,217 @@ class KeyboardIconsSet {
NAME_STOP_ONEHANDED_KEY to R.styleable.Keyboard_iconStopOneHandedMode, NAME_STOP_ONEHANDED_KEY to R.styleable.Keyboard_iconStopOneHandedMode,
NAME_SWITCH_ONEHANDED_KEY to R.styleable.Keyboard_iconSwitchOneHandedMode, NAME_SWITCH_ONEHANDED_KEY to R.styleable.Keyboard_iconSwitchOneHandedMode,
).apply { ToolbarKey.entries.forEach { put(it.name.lowercase(Locale.US), getStyleableIconId(it)) } } ).apply { ToolbarKey.entries.forEach { put(it.name.lowercase(Locale.US), getStyleableIconId(it)) } }
*/
private val keyboardIconsHolo by lazy { hashMapOf(
NAME_SHIFT_KEY to R.drawable.sym_keyboard_shift_holo,
NAME_SHIFT_KEY_SHIFTED to R.drawable.sym_keyboard_shifted_holo,
NAME_SHIFT_KEY_LOCKED to R.drawable.sym_keyboard_shift_lock_holo,
NAME_DELETE_KEY to R.drawable.sym_keyboard_delete_holo,
NAME_SETTINGS_KEY to R.drawable.sym_keyboard_settings_holo,
// NAME_SPACE_KEY to null,
NAME_ENTER_KEY to R.drawable.sym_keyboard_return_holo,
// NAME_GO_KEY to null,
NAME_SEARCH_KEY to R.drawable.sym_keyboard_search_holo,
// NAME_SEND_KEY to null,
// NAME_DONE_KEY to null,
// NAME_NEXT_KEY to null,
// NAME_PREVIOUS_KEY to null,
NAME_TAB_KEY to R.drawable.sym_keyboard_tab_holo,
NAME_INCOGNITO_KEY to R.drawable.sym_keyboard_incognito_holo,
NAME_SPACE_KEY_FOR_NUMBER_LAYOUT to R.drawable.sym_keyboard_space_holo,
NAME_SHORTCUT_KEY to R.drawable.sym_keyboard_voice_holo,
NAME_SHORTCUT_KEY_DISABLED to R.drawable.sym_keyboard_voice_off_holo,
NAME_LANGUAGE_SWITCH_KEY to R.drawable.sym_keyboard_language_switch,
NAME_ZWNJ_KEY to R.drawable.sym_keyboard_zwnj_holo,
NAME_ZWJ_KEY to R.drawable.sym_keyboard_zwj_holo,
NAME_EMOJI_ACTION_KEY to R.drawable.sym_keyboard_smiley_holo,
NAME_EMOJI_NORMAL_KEY to R.drawable.sym_keyboard_smiley_holo,
NAME_CLIPBOARD_ACTION_KEY to R.drawable.sym_keyboard_clipboard_holo,
NAME_CLIPBOARD_NORMAL_KEY to R.drawable.sym_keyboard_clipboard_holo,
NAME_CLEAR_CLIPBOARD_KEY to R.drawable.sym_keyboard_clear_clipboard_holo,
NAME_CUT_KEY to R.drawable.sym_keyboard_cut,
NAME_START_ONEHANDED_KEY to R.drawable.sym_keyboard_start_onehanded_holo,
NAME_STOP_ONEHANDED_KEY to R.drawable.sym_keyboard_stop_onehanded_holo,
NAME_SWITCH_ONEHANDED_KEY to R.drawable.ic_arrow_left,
NAME_RESIZE_ONEHANDED_KEY to R.drawable.ic_arrow_horizontal,
NAME_TOOLBAR_KEY to R.drawable.ic_arrow_right,
NAME_BIN to R.drawable.ic_delete,
).apply {
ToolbarKey.entries.forEach {
put(it.name.lowercase(Locale.US), when (it) {
ToolbarKey.VOICE -> R.drawable.sym_keyboard_voice_holo
ToolbarKey.CLIPBOARD -> R.drawable.sym_keyboard_clipboard_holo
ToolbarKey.NUMPAD -> R.drawable.sym_keyboard_numpad_key_holo
ToolbarKey.UNDO -> R.drawable.ic_undo
ToolbarKey.REDO -> R.drawable.ic_redo
ToolbarKey.SETTINGS -> R.drawable.sym_keyboard_settings_holo
ToolbarKey.SELECT_ALL -> R.drawable.ic_select_all
ToolbarKey.SELECT_WORD -> R.drawable.ic_select
ToolbarKey.COPY -> R.drawable.sym_keyboard_copy
ToolbarKey.CUT -> R.drawable.sym_keyboard_cut
ToolbarKey.PASTE -> R.drawable.sym_keyboard_paste
ToolbarKey.ONE_HANDED -> R.drawable.sym_keyboard_start_onehanded_holo
ToolbarKey.INCOGNITO -> R.drawable.sym_keyboard_incognito_holo
ToolbarKey.AUTOCORRECT -> R.drawable.ic_autocorrect
ToolbarKey.CLEAR_CLIPBOARD -> R.drawable.sym_keyboard_clear_clipboard_holo
ToolbarKey.CLOSE_HISTORY -> R.drawable.ic_close
ToolbarKey.EMOJI -> R.drawable.sym_keyboard_smiley_holo
ToolbarKey.LEFT -> R.drawable.ic_dpad_left
ToolbarKey.RIGHT -> R.drawable.ic_dpad_right
ToolbarKey.UP -> R.drawable.ic_dpad_up
ToolbarKey.DOWN -> R.drawable.ic_dpad_down
ToolbarKey.WORD_LEFT -> R.drawable.ic_word_left
ToolbarKey.WORD_RIGHT -> R.drawable.ic_word_right
ToolbarKey.PAGE_UP -> R.drawable.ic_page_up
ToolbarKey.PAGE_DOWN -> R.drawable.ic_page_down
ToolbarKey.FULL_LEFT -> R.drawable.ic_to_start
ToolbarKey.FULL_RIGHT -> R.drawable.ic_to_end
ToolbarKey.PAGE_START -> R.drawable.ic_page_start
ToolbarKey.PAGE_END -> R.drawable.ic_page_end
})
}
} }
private val keyboardIconsMaterial by lazy { hashMapOf(
NAME_SHIFT_KEY to R.drawable.sym_keyboard_shift_lxx,
NAME_SHIFT_KEY_SHIFTED to R.drawable.sym_keyboard_shift_lxx,
NAME_SHIFT_KEY_LOCKED to R.drawable.sym_keyboard_shift_lock_lxx,
NAME_DELETE_KEY to R.drawable.sym_keyboard_delete_lxx,
NAME_SETTINGS_KEY to R.drawable.sym_keyboard_settings_lxx,
// NAME_SPACE_KEY to null,
NAME_ENTER_KEY to R.drawable.sym_keyboard_return_lxx,
NAME_GO_KEY to R.drawable.sym_keyboard_go_lxx,
NAME_SEARCH_KEY to R.drawable.sym_keyboard_search_lxx,
NAME_SEND_KEY to R.drawable.sym_keyboard_send_lxx,
NAME_DONE_KEY to R.drawable.sym_keyboard_done_lxx,
NAME_NEXT_KEY to R.drawable.ic_arrow_right,
NAME_PREVIOUS_KEY to R.drawable.ic_arrow_left,
NAME_TAB_KEY to R.drawable.sym_keyboard_tab_lxx,
NAME_INCOGNITO_KEY to R.drawable.sym_keyboard_incognito_lxx,
NAME_SPACE_KEY_FOR_NUMBER_LAYOUT to R.drawable.sym_keyboard_space_lxx,
NAME_SHORTCUT_KEY to R.drawable.sym_keyboard_voice_lxx,
NAME_SHORTCUT_KEY_DISABLED to R.drawable.sym_keyboard_voice_off_lxx,
NAME_LANGUAGE_SWITCH_KEY to R.drawable.sym_keyboard_language_switch_lxx,
NAME_ZWNJ_KEY to R.drawable.sym_keyboard_zwnj_lxx,
NAME_ZWJ_KEY to R.drawable.sym_keyboard_zwj_lxx,
NAME_EMOJI_ACTION_KEY to R.drawable.sym_keyboard_smiley_lxx,
NAME_EMOJI_NORMAL_KEY to R.drawable.sym_keyboard_smiley_lxx,
NAME_CLIPBOARD_ACTION_KEY to R.drawable.sym_keyboard_clipboard_lxx,
NAME_CLIPBOARD_NORMAL_KEY to R.drawable.sym_keyboard_clipboard_lxx,
NAME_CLEAR_CLIPBOARD_KEY to R.drawable.sym_keyboard_clear_clipboard_lxx,
NAME_CUT_KEY to R.drawable.sym_keyboard_cut,
NAME_START_ONEHANDED_KEY to R.drawable.sym_keyboard_start_onehanded_lxx,
NAME_STOP_ONEHANDED_KEY to R.drawable.sym_keyboard_stop_onehanded_lxx,
NAME_SWITCH_ONEHANDED_KEY to R.drawable.ic_arrow_left,
NAME_RESIZE_ONEHANDED_KEY to R.drawable.ic_arrow_horizontal,
NAME_TOOLBAR_KEY to R.drawable.ic_arrow_right,
NAME_BIN to R.drawable.ic_delete,
).apply {
ToolbarKey.entries.forEach {
put(it.name.lowercase(Locale.US), when (it) {
ToolbarKey.VOICE -> R.drawable.sym_keyboard_voice_lxx
ToolbarKey.CLIPBOARD -> R.drawable.sym_keyboard_clipboard_lxx
ToolbarKey.NUMPAD -> R.drawable.sym_keyboard_numpad_key_lxx
ToolbarKey.UNDO -> R.drawable.ic_undo
ToolbarKey.REDO -> R.drawable.ic_redo
ToolbarKey.SETTINGS -> R.drawable.sym_keyboard_settings_lxx
ToolbarKey.SELECT_ALL -> R.drawable.ic_select_all
ToolbarKey.SELECT_WORD -> R.drawable.ic_select
ToolbarKey.COPY -> R.drawable.sym_keyboard_copy
ToolbarKey.CUT -> R.drawable.sym_keyboard_cut
ToolbarKey.PASTE -> R.drawable.sym_keyboard_paste
ToolbarKey.ONE_HANDED -> R.drawable.sym_keyboard_start_onehanded_lxx
ToolbarKey.INCOGNITO -> R.drawable.sym_keyboard_incognito_lxx
ToolbarKey.AUTOCORRECT -> R.drawable.ic_autocorrect
ToolbarKey.CLEAR_CLIPBOARD -> R.drawable.sym_keyboard_clear_clipboard_lxx
ToolbarKey.CLOSE_HISTORY -> R.drawable.ic_close
ToolbarKey.EMOJI -> R.drawable.sym_keyboard_smiley_lxx
ToolbarKey.LEFT -> R.drawable.ic_dpad_left
ToolbarKey.RIGHT -> R.drawable.ic_dpad_right
ToolbarKey.UP -> R.drawable.ic_dpad_up
ToolbarKey.DOWN -> R.drawable.ic_dpad_down
ToolbarKey.WORD_LEFT -> R.drawable.ic_word_left
ToolbarKey.WORD_RIGHT -> R.drawable.ic_word_right
ToolbarKey.PAGE_UP -> R.drawable.ic_page_up
ToolbarKey.PAGE_DOWN -> R.drawable.ic_page_down
ToolbarKey.FULL_LEFT -> R.drawable.ic_to_start
ToolbarKey.FULL_RIGHT -> R.drawable.ic_to_end
ToolbarKey.PAGE_START -> R.drawable.ic_page_start
ToolbarKey.PAGE_END -> R.drawable.ic_page_end
})
}
} }
private val keyboardIconsRounded by lazy { hashMapOf(
NAME_SHIFT_KEY to R.drawable.sym_keyboard_shift_rounded,
NAME_SHIFT_KEY_SHIFTED to R.drawable.sym_keyboard_shift_rounded,
NAME_SHIFT_KEY_LOCKED to R.drawable.sym_keyboard_shift_lock_rounded,
NAME_DELETE_KEY to R.drawable.sym_keyboard_delete_rounded,
NAME_SETTINGS_KEY to R.drawable.sym_keyboard_settings_rounded,
// NAME_SPACE_KEY to null,
NAME_ENTER_KEY to R.drawable.sym_keyboard_return_rounded,
NAME_GO_KEY to R.drawable.sym_keyboard_go_rounded,
NAME_SEARCH_KEY to R.drawable.sym_keyboard_search_rounded,
NAME_SEND_KEY to R.drawable.sym_keyboard_send_rounded,
NAME_DONE_KEY to R.drawable.sym_keyboard_done_rounded,
NAME_NEXT_KEY to R.drawable.ic_arrow_right_rounded,
NAME_PREVIOUS_KEY to R.drawable.ic_arrow_left_rounded,
NAME_TAB_KEY to R.drawable.sym_keyboard_tab_rounded,
NAME_INCOGNITO_KEY to R.drawable.sym_keyboard_incognito_lxx,
NAME_SPACE_KEY_FOR_NUMBER_LAYOUT to R.drawable.sym_keyboard_space_rounded,
NAME_SHORTCUT_KEY to R.drawable.sym_keyboard_voice_rounded,
NAME_SHORTCUT_KEY_DISABLED to R.drawable.sym_keyboard_voice_off_rounded,
NAME_LANGUAGE_SWITCH_KEY to R.drawable.sym_keyboard_language_switch_lxx,
NAME_ZWNJ_KEY to R.drawable.sym_keyboard_zwnj_lxx,
NAME_ZWJ_KEY to R.drawable.sym_keyboard_zwj_lxx,
NAME_EMOJI_ACTION_KEY to R.drawable.sym_keyboard_smiley_rounded,
NAME_EMOJI_NORMAL_KEY to R.drawable.sym_keyboard_smiley_rounded,
NAME_CLIPBOARD_ACTION_KEY to R.drawable.sym_keyboard_clipboard_rounded,
NAME_CLIPBOARD_NORMAL_KEY to R.drawable.sym_keyboard_clipboard_rounded,
NAME_CLEAR_CLIPBOARD_KEY to R.drawable.sym_keyboard_clear_clipboard_rounded,
NAME_CUT_KEY to R.drawable.sym_keyboard_cut_rounded,
NAME_START_ONEHANDED_KEY to R.drawable.sym_keyboard_start_onehanded_rounded,
NAME_STOP_ONEHANDED_KEY to R.drawable.sym_keyboard_stop_onehanded_rounded,
NAME_SWITCH_ONEHANDED_KEY to R.drawable.ic_arrow_left_rounded,
NAME_RESIZE_ONEHANDED_KEY to R.drawable.ic_arrow_horizontal_rounded,
NAME_TOOLBAR_KEY to R.drawable.ic_arrow_right_rounded,
NAME_BIN to R.drawable.ic_delete_rounded,
).apply {
ToolbarKey.entries.forEach {
put(it.name.lowercase(Locale.US), when (it) {
ToolbarKey.VOICE -> R.drawable.sym_keyboard_voice_rounded
ToolbarKey.CLIPBOARD -> R.drawable.sym_keyboard_clipboard_rounded
ToolbarKey.NUMPAD -> R.drawable.sym_keyboard_numpad_key_lxx
ToolbarKey.UNDO -> R.drawable.ic_undo_rounded
ToolbarKey.REDO -> R.drawable.ic_redo_rounded
ToolbarKey.SETTINGS -> R.drawable.sym_keyboard_settings_rounded
ToolbarKey.SELECT_ALL -> R.drawable.ic_select_all_rounded
ToolbarKey.SELECT_WORD -> R.drawable.ic_select_rounded
ToolbarKey.COPY -> R.drawable.sym_keyboard_copy_rounded
ToolbarKey.CUT -> R.drawable.sym_keyboard_cut_rounded
ToolbarKey.PASTE -> R.drawable.sym_keyboard_paste_rounded
ToolbarKey.ONE_HANDED -> R.drawable.sym_keyboard_start_onehanded_rounded
ToolbarKey.INCOGNITO -> R.drawable.sym_keyboard_incognito_lxx
ToolbarKey.AUTOCORRECT -> R.drawable.ic_autocorrect_rounded
ToolbarKey.CLEAR_CLIPBOARD -> R.drawable.sym_keyboard_clear_clipboard_rounded
ToolbarKey.CLOSE_HISTORY -> R.drawable.ic_close_rounded
ToolbarKey.EMOJI -> R.drawable.sym_keyboard_smiley_rounded
ToolbarKey.LEFT -> R.drawable.ic_dpad_left_rounded
ToolbarKey.RIGHT -> R.drawable.ic_dpad_right_rounded
ToolbarKey.UP -> R.drawable.ic_dpad_up_rounded
ToolbarKey.DOWN -> R.drawable.ic_dpad_down_rounded
ToolbarKey.WORD_LEFT -> R.drawable.ic_word_left_rounded
ToolbarKey.WORD_RIGHT -> R.drawable.ic_word_right_rounded
ToolbarKey.PAGE_UP -> R.drawable.ic_page_up_rounded
ToolbarKey.PAGE_DOWN -> R.drawable.ic_page_down_rounded
ToolbarKey.FULL_LEFT -> R.drawable.ic_to_start_rounded
ToolbarKey.FULL_RIGHT -> R.drawable.ic_to_end_rounded
ToolbarKey.PAGE_START -> R.drawable.ic_page_start_rounded
ToolbarKey.PAGE_END -> R.drawable.ic_page_end_rounded
})
}
} }
val instance = KeyboardIconsSet()
} }
} }

View file

@ -80,7 +80,7 @@ public class KeyboardParams {
@NonNull @NonNull
public final ArrayList<Key> mAltCodeKeysWhileTyping = new ArrayList<>(); public final ArrayList<Key> mAltCodeKeysWhileTyping = new ArrayList<>();
@NonNull @NonNull
public final KeyboardIconsSet mIconsSet = new KeyboardIconsSet(); public final KeyboardIconsSet mIconsSet = KeyboardIconsSet.Companion.getInstance();
@NonNull // todo: not good, this only works because params are currently always created for the active subtype @NonNull // todo: not good, this only works because params are currently always created for the active subtype
public final List<Locale> mSecondaryLocales = Settings.getInstance().getCurrent().mSecondaryLocales; public final List<Locale> mSecondaryLocales = Settings.getInstance().getCurrent().mSecondaryLocales;
public final ArrayList<String> mPopupKeyTypes = new ArrayList<>(); public final ArrayList<String> mPopupKeyTypes = new ArrayList<>();
@ -267,7 +267,7 @@ public class KeyboardParams {
mMaxPopupKeysKeyboardColumn = keyAttr.getInt(R.styleable.Keyboard_Key_maxPopupKeysColumn, 5); mMaxPopupKeysKeyboardColumn = keyAttr.getInt(R.styleable.Keyboard_Key_maxPopupKeysColumn, 5);
mThemeId = keyboardAttr.getInt(R.styleable.Keyboard_themeId, 0); mThemeId = keyboardAttr.getInt(R.styleable.Keyboard_themeId, 0);
mIconsSet.loadIcons(keyboardAttr); mIconsSet.loadIcons(context);
// touchPositionResId currently is 0 for popups, and touch_position_correction_data_holo for others // touchPositionResId currently is 0 for popups, and touch_position_correction_data_holo for others
final int touchPositionResId = keyboardAttr.getResourceId(R.styleable.Keyboard_touchPositionCorrectionData, 0); final int touchPositionResId = keyboardAttr.getResourceId(R.styleable.Keyboard_touchPositionCorrectionData, 0);

View file

@ -13,6 +13,7 @@ import android.widget.FrameLayout
import android.widget.ImageButton import android.widget.ImageButton
import helium314.keyboard.keyboard.KeyboardActionListener import helium314.keyboard.keyboard.KeyboardActionListener
import helium314.keyboard.keyboard.KeyboardSwitcher import helium314.keyboard.keyboard.KeyboardSwitcher
import helium314.keyboard.keyboard.internal.KeyboardIconsSet
import helium314.keyboard.keyboard.internal.keyboard_parser.floris.KeyCode import helium314.keyboard.keyboard.internal.keyboard_parser.floris.KeyCode
import helium314.keyboard.latin.common.ColorType import helium314.keyboard.latin.common.ColorType
import helium314.keyboard.latin.common.Constants import helium314.keyboard.latin.common.Constants
@ -31,9 +32,6 @@ class KeyboardWrapperView @JvmOverloads constructor(
private lateinit var stopOneHandedModeBtn: ImageButton private lateinit var stopOneHandedModeBtn: ImageButton
private lateinit var switchOneHandedModeBtn: ImageButton private lateinit var switchOneHandedModeBtn: ImageButton
private lateinit var resizeOneHandedModeBtn: ImageButton private lateinit var resizeOneHandedModeBtn: ImageButton
private val iconStopOneHandedModeId: Int
private val iconSwitchOneHandedModeId: Int
private val iconResizeOneHandedModeId: Int
var oneHandedModeEnabled = false var oneHandedModeEnabled = false
set(enabled) { set(enabled) {
@ -53,14 +51,16 @@ class KeyboardWrapperView @JvmOverloads constructor(
@SuppressLint("ClickableViewAccessibility") @SuppressLint("ClickableViewAccessibility")
override fun onFinishInflate() { override fun onFinishInflate() {
super.onFinishInflate() super.onFinishInflate()
val keyboardIconsSet = KeyboardIconsSet.instance
keyboardIconsSet.loadIcons(context)
stopOneHandedModeBtn = findViewById(R.id.btn_stop_one_handed_mode) stopOneHandedModeBtn = findViewById(R.id.btn_stop_one_handed_mode)
stopOneHandedModeBtn.setImageResource(iconStopOneHandedModeId) stopOneHandedModeBtn.setImageDrawable(keyboardIconsSet.getNewDrawable(KeyboardIconsSet.NAME_STOP_ONEHANDED_KEY, context))
stopOneHandedModeBtn.visibility = GONE stopOneHandedModeBtn.visibility = GONE
switchOneHandedModeBtn = findViewById(R.id.btn_switch_one_handed_mode) switchOneHandedModeBtn = findViewById(R.id.btn_switch_one_handed_mode)
switchOneHandedModeBtn.setImageResource(iconSwitchOneHandedModeId) switchOneHandedModeBtn.setImageDrawable(keyboardIconsSet.getNewDrawable(KeyboardIconsSet.NAME_SWITCH_ONEHANDED_KEY, context))
switchOneHandedModeBtn.visibility = GONE switchOneHandedModeBtn.visibility = GONE
resizeOneHandedModeBtn = findViewById(R.id.btn_resize_one_handed_mode) resizeOneHandedModeBtn = findViewById(R.id.btn_resize_one_handed_mode)
resizeOneHandedModeBtn.setImageResource(iconResizeOneHandedModeId) resizeOneHandedModeBtn.setImageDrawable(keyboardIconsSet.getNewDrawable(KeyboardIconsSet.NAME_RESIZE_ONEHANDED_KEY, context))
resizeOneHandedModeBtn.visibility = GONE resizeOneHandedModeBtn.visibility = GONE
stopOneHandedModeBtn.setOnClickListener(this) stopOneHandedModeBtn.setOnClickListener(this)
@ -163,13 +163,4 @@ class KeyboardWrapperView @JvmOverloads constructor(
switchOneHandedModeBtn.setLayout((keyboardView.measuredHeight * 0.5f).toInt()) switchOneHandedModeBtn.setLayout((keyboardView.measuredHeight * 0.5f).toInt())
resizeOneHandedModeBtn.setLayout((keyboardView.measuredHeight * 0.8f).toInt()) resizeOneHandedModeBtn.setLayout((keyboardView.measuredHeight * 0.8f).toInt())
} }
init {
@SuppressLint("CustomViewStyleable")
val keyboardAttr = context.obtainStyledAttributes(attrs, R.styleable.Keyboard, defStyle, R.style.Keyboard)
iconStopOneHandedModeId = keyboardAttr.getResourceId(R.styleable.Keyboard_iconStopOneHandedMode, 0)
iconSwitchOneHandedModeId = keyboardAttr.getResourceId(R.styleable.Keyboard_iconSwitchOneHandedMode, 0)
iconResizeOneHandedModeId = keyboardAttr.getResourceId(R.styleable.Keyboard_iconResizeOneHandedMode, 0)
keyboardAttr.recycle()
}
} }

View file

@ -45,6 +45,7 @@ import helium314.keyboard.compat.ConfigurationCompatKt;
import helium314.keyboard.compat.EditorInfoCompatUtils; import helium314.keyboard.compat.EditorInfoCompatUtils;
import helium314.keyboard.keyboard.KeyboardActionListener; import helium314.keyboard.keyboard.KeyboardActionListener;
import helium314.keyboard.keyboard.KeyboardActionListenerImpl; import helium314.keyboard.keyboard.KeyboardActionListenerImpl;
import helium314.keyboard.keyboard.internal.KeyboardIconsSet;
import helium314.keyboard.keyboard.internal.keyboard_parser.floris.KeyCode; import helium314.keyboard.keyboard.internal.keyboard_parser.floris.KeyCode;
import helium314.keyboard.latin.common.InsetsOutlineProvider; import helium314.keyboard.latin.common.InsetsOutlineProvider;
import helium314.keyboard.dictionarypack.DictionaryPackConstants; import helium314.keyboard.dictionarypack.DictionaryPackConstants;
@ -570,6 +571,7 @@ public class LatinIME extends InputMethodService implements
Settings.init(this); Settings.init(this);
DebugFlags.init(this); DebugFlags.init(this);
SubtypeSettingsKt.init(this); SubtypeSettingsKt.init(this);
KeyboardIconsSet.Companion.getInstance().loadIcons(this);
RichInputMethodManager.init(this); RichInputMethodManager.init(this);
mRichImm = RichInputMethodManager.getInstance(); mRichImm = RichInputMethodManager.getInstance();
AudioAndHapticFeedbackManager.init(this); AudioAndHapticFeedbackManager.init(this);

View file

@ -4,11 +4,11 @@ import android.content.SharedPreferences
import android.os.Bundle import android.os.Bundle
import androidx.preference.Preference import androidx.preference.Preference
import helium314.keyboard.keyboard.KeyboardSwitcher import helium314.keyboard.keyboard.KeyboardSwitcher
import helium314.keyboard.keyboard.internal.KeyboardIconsSet
import helium314.keyboard.latin.R import helium314.keyboard.latin.R
import helium314.keyboard.latin.utils.defaultClipboardToolbarPref import helium314.keyboard.latin.utils.defaultClipboardToolbarPref
import helium314.keyboard.latin.utils.defaultPinnedToolbarPref import helium314.keyboard.latin.utils.defaultPinnedToolbarPref
import helium314.keyboard.latin.utils.defaultToolbarPref import helium314.keyboard.latin.utils.defaultToolbarPref
import helium314.keyboard.latin.utils.getToolbarIconByName
import helium314.keyboard.latin.utils.reorderDialog import helium314.keyboard.latin.utils.reorderDialog
class ToolbarSettingsFragment : SubScreenFragment() { class ToolbarSettingsFragment : SubScreenFragment() {
@ -16,6 +16,8 @@ class ToolbarSettingsFragment : SubScreenFragment() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
val iconsSet = KeyboardIconsSet.instance
iconsSet.loadIcons(requireContext())
addPreferencesFromResource(R.xml.prefs_screen_toolbar) addPreferencesFromResource(R.xml.prefs_screen_toolbar)
findPreference<Preference>(Settings.PREF_TOOLBAR_KEYS)?.onPreferenceClickListener = findPreference<Preference>(Settings.PREF_TOOLBAR_KEYS)?.onPreferenceClickListener =
@ -23,7 +25,7 @@ class ToolbarSettingsFragment : SubScreenFragment() {
reorderDialog( reorderDialog(
requireContext(), Settings.PREF_TOOLBAR_KEYS, defaultToolbarPref, requireContext(), Settings.PREF_TOOLBAR_KEYS, defaultToolbarPref,
R.string.toolbar_keys R.string.toolbar_keys
) { getToolbarIconByName(it, requireContext()) } ) { iconsSet.getNewDrawable(it, requireContext()) }
true true
} }
findPreference<Preference>(Settings.PREF_PINNED_TOOLBAR_KEYS)?.onPreferenceClickListener = findPreference<Preference>(Settings.PREF_PINNED_TOOLBAR_KEYS)?.onPreferenceClickListener =
@ -31,7 +33,7 @@ class ToolbarSettingsFragment : SubScreenFragment() {
reorderDialog( reorderDialog(
requireContext(), Settings.PREF_PINNED_TOOLBAR_KEYS, defaultPinnedToolbarPref, requireContext(), Settings.PREF_PINNED_TOOLBAR_KEYS, defaultPinnedToolbarPref,
R.string.pinned_toolbar_keys R.string.pinned_toolbar_keys
) { getToolbarIconByName(it, requireContext()) } ) { iconsSet.getNewDrawable(it, requireContext()) }
true true
} }
findPreference<Preference>(Settings.PREF_CLIPBOARD_TOOLBAR_KEYS)?.onPreferenceClickListener = findPreference<Preference>(Settings.PREF_CLIPBOARD_TOOLBAR_KEYS)?.onPreferenceClickListener =
@ -39,7 +41,7 @@ class ToolbarSettingsFragment : SubScreenFragment() {
reorderDialog( reorderDialog(
requireContext(), Settings.PREF_CLIPBOARD_TOOLBAR_KEYS, defaultClipboardToolbarPref, requireContext(), Settings.PREF_CLIPBOARD_TOOLBAR_KEYS, defaultClipboardToolbarPref,
R.string.clipboard_toolbar_keys R.string.clipboard_toolbar_keys
) { getToolbarIconByName(it, requireContext()) } ) { iconsSet.getNewDrawable(it, requireContext()) }
true true
} }
} }

View file

@ -13,7 +13,6 @@ import android.app.KeyguardManager;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Resources; import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
@ -43,6 +42,7 @@ import helium314.keyboard.keyboard.Keyboard;
import helium314.keyboard.keyboard.KeyboardSwitcher; import helium314.keyboard.keyboard.KeyboardSwitcher;
import helium314.keyboard.keyboard.MainKeyboardView; import helium314.keyboard.keyboard.MainKeyboardView;
import helium314.keyboard.keyboard.PopupKeysPanel; import helium314.keyboard.keyboard.PopupKeysPanel;
import helium314.keyboard.keyboard.internal.KeyboardIconsSet;
import helium314.keyboard.keyboard.internal.keyboard_parser.floris.KeyCode; import helium314.keyboard.keyboard.internal.keyboard_parser.floris.KeyCode;
import helium314.keyboard.latin.AudioAndHapticFeedbackManager; import helium314.keyboard.latin.AudioAndHapticFeedbackManager;
import helium314.keyboard.latin.Dictionary; import helium314.keyboard.latin.Dictionary;
@ -181,18 +181,17 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
R.dimen.config_more_suggestions_modal_tolerance); R.dimen.config_more_suggestions_modal_tolerance);
mMoreSuggestionsSlidingDetector = new GestureDetector(context, mMoreSuggestionsSlidingListener); mMoreSuggestionsSlidingDetector = new GestureDetector(context, mMoreSuggestionsSlidingListener);
@SuppressLint("CustomViewStyleable") final KeyboardIconsSet iconsSet = KeyboardIconsSet.Companion.getInstance();
final TypedArray keyboardAttr = context.obtainStyledAttributes(attrs, R.styleable.Keyboard, defStyle, R.style.SuggestionStripView); mIncognitoIcon = iconsSet.getNewDrawable(KeyboardIconsSet.NAME_INCOGNITO_KEY, context);
mIncognitoIcon = keyboardAttr.getDrawable(R.styleable.Keyboard_iconIncognitoKey); mToolbarArrowIcon = iconsSet.getNewDrawable(KeyboardIconsSet.NAME_TOOLBAR_KEY, context);
mToolbarArrowIcon = keyboardAttr.getDrawable(R.styleable.Keyboard_iconToolbarKey); mBinIcon = iconsSet.getNewDrawable(KeyboardIconsSet.NAME_BIN, context);
mBinIcon = keyboardAttr.getDrawable(R.styleable.Keyboard_iconBin);
final LinearLayout.LayoutParams toolbarKeyLayoutParams = new LinearLayout.LayoutParams( final LinearLayout.LayoutParams toolbarKeyLayoutParams = new LinearLayout.LayoutParams(
getResources().getDimensionPixelSize(R.dimen.config_suggestions_strip_edge_key_width), getResources().getDimensionPixelSize(R.dimen.config_suggestions_strip_edge_key_width),
LinearLayout.LayoutParams.MATCH_PARENT LinearLayout.LayoutParams.MATCH_PARENT
); );
for (final ToolbarKey key : ToolbarUtilsKt.getEnabledToolbarKeys(prefs)) { for (final ToolbarKey key : ToolbarUtilsKt.getEnabledToolbarKeys(prefs)) {
final ImageButton button = createToolbarKey(context, keyboardAttr, key); final ImageButton button = createToolbarKey(context, iconsSet, key);
button.setLayoutParams(toolbarKeyLayoutParams); button.setLayoutParams(toolbarKeyLayoutParams);
setupKey(button, colors); setupKey(button, colors);
mToolbar.addView(button); mToolbar.addView(button);
@ -216,7 +215,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
mToolbarExpandKey.getLayoutParams().width *= 0.82; mToolbarExpandKey.getLayoutParams().width *= 0.82;
for (final ToolbarKey pinnedKey : ToolbarUtilsKt.getPinnedToolbarKeys(prefs)) { for (final ToolbarKey pinnedKey : ToolbarUtilsKt.getPinnedToolbarKeys(prefs)) {
final ImageButton button = createToolbarKey(context, keyboardAttr, pinnedKey); final ImageButton button = createToolbarKey(context, iconsSet, pinnedKey);
button.setLayoutParams(toolbarKeyLayoutParams); button.setLayoutParams(toolbarKeyLayoutParams);
setupKey(button, colors); setupKey(button, colors);
mPinnedKeys.addView(button); mPinnedKeys.addView(button);
@ -226,7 +225,6 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
} }
colors.setBackground(this, ColorType.STRIP_BACKGROUND); colors.setBackground(this, ColorType.STRIP_BACKGROUND);
keyboardAttr.recycle();
} }
/** /**

View file

@ -3,13 +3,10 @@ package helium314.keyboard.latin.utils
import android.content.Context import android.content.Context
import android.content.SharedPreferences import android.content.SharedPreferences
import android.content.res.TypedArray
import android.graphics.drawable.Drawable
import android.widget.ImageButton import android.widget.ImageButton
import android.widget.ImageView import android.widget.ImageView
import androidx.appcompat.view.ContextThemeWrapper
import androidx.core.content.edit import androidx.core.content.edit
import helium314.keyboard.keyboard.KeyboardTheme import helium314.keyboard.keyboard.internal.KeyboardIconsSet
import helium314.keyboard.keyboard.internal.keyboard_parser.floris.KeyCode import helium314.keyboard.keyboard.internal.keyboard_parser.floris.KeyCode
import helium314.keyboard.latin.R import helium314.keyboard.latin.R
import helium314.keyboard.latin.settings.Settings import helium314.keyboard.latin.settings.Settings
@ -17,7 +14,7 @@ import helium314.keyboard.latin.utils.ToolbarKey.*
import java.util.EnumMap import java.util.EnumMap
import java.util.Locale import java.util.Locale
fun createToolbarKey(context: Context, keyboardAttr: TypedArray, key: ToolbarKey): ImageButton { fun createToolbarKey(context: Context, iconsSet: KeyboardIconsSet, key: ToolbarKey): ImageButton {
val button = ImageButton(context, null, R.attr.suggestionWordStyle) val button = ImageButton(context, null, R.attr.suggestionWordStyle)
button.scaleType = ImageView.ScaleType.CENTER button.scaleType = ImageView.ScaleType.CENTER
button.tag = key button.tag = key
@ -30,7 +27,7 @@ fun createToolbarKey(context: Context, keyboardAttr: TypedArray, key: ToolbarKey
AUTOCORRECT -> Settings.getInstance().current.mAutoCorrectionEnabledPerUserSettings AUTOCORRECT -> Settings.getInstance().current.mAutoCorrectionEnabledPerUserSettings
else -> true else -> true
} }
button.setImageDrawable(keyboardAttr.getDrawable(getStyleableIconId(key))?.mutate()) button.setImageDrawable(iconsSet.getNewDrawable(key.name, context))
return button return button
} }
@ -85,47 +82,6 @@ fun getCodeForToolbarKeyLongClick(key: ToolbarKey) = when (key) {
else -> KeyCode.UNSPECIFIED else -> KeyCode.UNSPECIFIED
} }
fun getStyleableIconId(key: ToolbarKey) = when (key) {
VOICE -> R.styleable.Keyboard_iconShortcutKey
CLIPBOARD -> R.styleable.Keyboard_iconClipboardNormalKey
NUMPAD -> R.styleable.Keyboard_iconNumpadKey
UNDO -> R.styleable.Keyboard_iconUndo
REDO -> R.styleable.Keyboard_iconRedo
SETTINGS -> R.styleable.Keyboard_iconSettingsKey
SELECT_ALL -> R.styleable.Keyboard_iconSelectAll
SELECT_WORD -> R.styleable.Keyboard_iconSelectWord
COPY -> R.styleable.Keyboard_iconCopyKey
CUT -> R.styleable.Keyboard_iconCutKey
PASTE -> R.styleable.Keyboard_iconPasteKey
ONE_HANDED -> R.styleable.Keyboard_iconStartOneHandedMode
INCOGNITO -> R.styleable.Keyboard_iconIncognitoKey
AUTOCORRECT -> R.styleable.Keyboard_iconAutoCorrect
CLEAR_CLIPBOARD -> R.styleable.Keyboard_iconClearClipboardKey
CLOSE_HISTORY -> R.styleable.Keyboard_iconClose
EMOJI -> R.styleable.Keyboard_iconEmojiNormalKey
LEFT -> R.styleable.Keyboard_iconArrowLeft
RIGHT -> R.styleable.Keyboard_iconArrowRight
UP -> R.styleable.Keyboard_iconArrowUp
DOWN -> R.styleable.Keyboard_iconArrowDown
WORD_LEFT -> R.styleable.Keyboard_iconWordLeft
WORD_RIGHT -> R.styleable.Keyboard_iconWordRight
PAGE_UP -> R.styleable.Keyboard_iconPageUp
PAGE_DOWN -> R.styleable.Keyboard_iconPageDown
FULL_LEFT -> R.styleable.Keyboard_iconFullLeft
FULL_RIGHT -> R.styleable.Keyboard_iconFullRight
PAGE_START -> R.styleable.Keyboard_iconPageStart
PAGE_END -> R.styleable.Keyboard_iconPageEnd
}
fun getToolbarIconByName(name: String, context: Context): Drawable? {
val key = entries.firstOrNull { it.name == name } ?: return null
val themeContext = ContextThemeWrapper(context, KeyboardTheme.getKeyboardTheme(context).mStyleId)
val attrs = themeContext.obtainStyledAttributes(null, R.styleable.Keyboard)
val icon = attrs.getDrawable(getStyleableIconId(key))?.mutate()
attrs.recycle()
return icon
}
// names need to be aligned with resources strings (using lowercase of key.name) // names need to be aligned with resources strings (using lowercase of key.name)
enum class ToolbarKey { enum class ToolbarKey {
VOICE, CLIPBOARD, NUMPAD, UNDO, REDO, SETTINGS, SELECT_ALL, SELECT_WORD, COPY, CUT, PASTE, ONE_HANDED, VOICE, CLIPBOARD, NUMPAD, UNDO, REDO, SETTINGS, SELECT_ALL, SELECT_WORD, COPY, CUT, PASTE, ONE_HANDED,

View file

@ -223,63 +223,6 @@
<attr name="verticalGapNarrow" format="fraction" /> <attr name="verticalGapNarrow" format="fraction" />
<!-- Popup keys keyboard layout template --> <!-- Popup keys keyboard layout template -->
<attr name="popupKeysTemplate" format="reference" /> <attr name="popupKeysTemplate" format="reference" />
<!-- Icon set for key top and key preview. These should be aligned with
{@link helium314.keyboard.keyboard.internal.KeyboardIconsSet#NAMES_AND_ATTR_IDS} -->
<attr name="iconShiftKey" format="reference" />
<attr name="iconDeleteKey" format="reference" />
<attr name="iconSettingsKey" format="reference" />
<attr name="iconSpaceKey" format="reference" />
<attr name="iconEnterKey" format="reference" />
<attr name="iconGoKey" format="reference" />
<attr name="iconSearchKey" format="reference" />
<attr name="iconSendKey" format="reference" />
<attr name="iconNextKey" format="reference" />
<attr name="iconDoneKey" format="reference" />
<attr name="iconPreviousKey" format="reference" />
<attr name="iconTabKey" format="reference" />
<attr name="iconShortcutKey" format="reference" />
<attr name="iconIncognitoKey" format="reference" />
<attr name="iconSpaceKeyForNumberLayout" format="reference" />
<attr name="iconShiftKeyShifted" format="reference" />
<attr name="iconShiftKeyLocked" format="reference" />
<attr name="iconShortcutKeyDisabled" format="reference" />
<attr name="iconLanguageSwitchKey" format="reference" />
<attr name="iconAutoCorrect" format="reference" />
<attr name="iconZwnjKey" format="reference" />
<attr name="iconZwjKey" format="reference" />
<attr name="iconImeKey" format="reference" />
<attr name="iconEmojiActionKey" format="reference" />
<attr name="iconEmojiNormalKey" format="reference" />
<attr name="iconClipboardActionKey" format="reference" />
<attr name="iconClipboardNormalKey" format="reference" />
<attr name="iconCopyKey" format="reference" />
<attr name="iconCutKey" format="reference" />
<attr name="iconPasteKey" format="reference" />
<attr name="iconClearClipboardKey" format="reference" />
<attr name="iconStartOneHandedMode" format="reference" />
<attr name="iconStopOneHandedMode" format="reference" />
<attr name="iconSwitchOneHandedMode" format="reference" />
<attr name="iconResizeOneHandedMode" format="reference" />
<attr name="iconNumpadKey" format="reference" />
<attr name="iconToolbarKey" format="reference" />
<attr name="iconSelectAll" format="reference" />
<attr name="iconArrowLeft" format="reference" />
<attr name="iconArrowRight" format="reference" />
<attr name="iconArrowUp" format="reference" />
<attr name="iconArrowDown" format="reference" />
<attr name="iconWordLeft" format="reference" />
<attr name="iconWordRight" format="reference" />
<attr name="iconPageUp" format="reference" />
<attr name="iconPageDown" format="reference" />
<attr name="iconFullLeft" format="reference" />
<attr name="iconFullRight" format="reference" />
<attr name="iconPageStart" format="reference" />
<attr name="iconPageEnd" format="reference" />
<attr name="iconSelectWord" format="reference" />
<attr name="iconBin" format="reference" />
<attr name="iconUndo" format="reference" />
<attr name="iconRedo" format="reference" />
<attr name="iconClose" format="reference" />
</declare-styleable> </declare-styleable>
<declare-styleable name="Keyboard_Key"> <declare-styleable name="Keyboard_Key">

View file

@ -1,61 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2013 The Android Open Source Project
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->
<resources>
<style name="KeyboardIcons.Holo">
<!-- Keyboard icons -->
<item name="iconShiftKey">@drawable/sym_keyboard_shift_holo</item>
<item name="iconDeleteKey">@drawable/sym_keyboard_delete_holo</item>
<item name="iconSettingsKey">@drawable/sym_keyboard_settings_holo</item>
<item name="iconSpaceKey">@null</item>
<item name="iconEnterKey">@drawable/sym_keyboard_return_holo</item>
<item name="iconSearchKey">@drawable/sym_keyboard_search_holo</item>
<item name="iconTabKey">@drawable/sym_keyboard_tab_holo</item>
<item name="iconShortcutKey">@drawable/sym_keyboard_voice_holo</item>
<item name="iconIncognitoKey">@drawable/sym_keyboard_incognito_holo</item>
<item name="iconSpaceKeyForNumberLayout">@drawable/sym_keyboard_space_holo</item>
<item name="iconShiftKeyShifted">@drawable/sym_keyboard_shifted_holo</item>
<item name="iconShiftKeyLocked">@drawable/sym_keyboard_shift_lock_holo</item>
<item name="iconShortcutKeyDisabled">@drawable/sym_keyboard_voice_off_holo</item>
<item name="iconLanguageSwitchKey">@drawable/sym_keyboard_language_switch</item>
<item name="iconAutoCorrect">@drawable/ic_autocorrect</item>
<item name="iconZwnjKey">@drawable/sym_keyboard_zwnj_holo</item>
<item name="iconZwjKey">@drawable/sym_keyboard_zwj_holo</item>
<item name="iconEmojiActionKey">@drawable/sym_keyboard_smiley_holo</item>
<item name="iconEmojiNormalKey">@drawable/sym_keyboard_smiley_holo</item>
<item name="iconClipboardActionKey">@drawable/sym_keyboard_clipboard_holo</item>
<item name="iconClipboardNormalKey">@drawable/sym_keyboard_clipboard_holo</item>
<item name="iconCopyKey">@drawable/sym_keyboard_copy</item>
<item name="iconCutKey">@drawable/sym_keyboard_cut</item>
<item name="iconPasteKey">@drawable/sym_keyboard_paste</item>
<item name="iconClearClipboardKey">@drawable/sym_keyboard_clear_clipboard_holo</item>
<item name="iconStartOneHandedMode">@drawable/sym_keyboard_start_onehanded_holo</item>
<item name="iconStopOneHandedMode">@drawable/sym_keyboard_stop_onehanded_holo</item>
<item name="iconSwitchOneHandedMode">@drawable/ic_arrow_left</item>
<item name="iconResizeOneHandedMode">@drawable/ic_arrow_horizontal</item>
<item name="iconNumpadKey">@drawable/sym_keyboard_numpad_key_holo</item>
<item name="iconToolbarKey">@drawable/ic_arrow_right</item>
<item name="iconSelectAll">@drawable/ic_select_all</item>
<item name="iconArrowLeft">@drawable/ic_dpad_left</item>
<item name="iconArrowRight">@drawable/ic_dpad_right</item>
<item name="iconArrowUp">@drawable/ic_dpad_up</item>
<item name="iconArrowDown">@drawable/ic_dpad_down</item>
<item name="iconWordLeft">@drawable/ic_word_left</item>
<item name="iconWordRight">@drawable/ic_word_right</item>
<item name="iconPageUp">@drawable/ic_page_up</item>
<item name="iconPageDown">@drawable/ic_page_down</item>
<item name="iconBin">@drawable/ic_delete</item>
<item name="iconUndo">@drawable/ic_undo</item>
<item name="iconRedo">@drawable/ic_redo</item>
<item name="iconFullLeft">@drawable/ic_to_start</item>
<item name="iconFullRight">@drawable/ic_to_end</item>
<item name="iconPageStart">@drawable/ic_page_start</item>
<item name="iconPageEnd">@drawable/ic_page_end</item>
<item name="iconSelectWord">@drawable/ic_select</item>
<item name="iconClose">@drawable/ic_close</item>
</style>
</resources>

View file

@ -1,66 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2014 The Android Open Source Project
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->
<resources>
<style name="KeyboardIcons.LXX_Light">
<!-- Keyboard icons -->
<item name="iconShiftKey">@drawable/sym_keyboard_shift_lxx</item>
<item name="iconShiftKeyShifted">@drawable/sym_keyboard_shift_lxx</item>
<item name="iconShiftKeyLocked">@drawable/sym_keyboard_shift_lock_lxx</item>
<item name="iconDeleteKey">@drawable/sym_keyboard_delete_lxx</item>
<item name="iconTabKey">@drawable/sym_keyboard_tab_lxx</item>
<item name="iconSettingsKey">@drawable/sym_keyboard_settings_lxx</item>
<item name="iconSpaceKey">@null</item>
<item name="iconEnterKey">@drawable/sym_keyboard_return_lxx</item>
<item name="iconGoKey">@drawable/sym_keyboard_go_lxx</item>
<item name="iconSearchKey">@drawable/sym_keyboard_search_lxx</item>
<item name="iconSendKey">@drawable/sym_keyboard_send_lxx</item>
<item name="iconNextKey">@drawable/ic_arrow_right</item>
<item name="iconDoneKey">@drawable/sym_keyboard_done_lxx</item>
<item name="iconPreviousKey">@drawable/ic_arrow_left</item>
<item name="iconShortcutKey">@drawable/sym_keyboard_voice_lxx</item>
<item name="iconShortcutKeyDisabled">@drawable/sym_keyboard_voice_off_lxx</item>
<item name="iconIncognitoKey">@drawable/sym_keyboard_incognito_lxx</item>
<item name="iconSpaceKeyForNumberLayout">@drawable/sym_keyboard_space_lxx</item>
<item name="iconLanguageSwitchKey">@drawable/sym_keyboard_language_switch_lxx</item>
<item name="iconAutoCorrect">@drawable/ic_autocorrect</item>
<item name="iconZwnjKey">@drawable/sym_keyboard_zwnj_lxx</item>
<item name="iconZwjKey">@drawable/sym_keyboard_zwj_lxx</item>
<item name="iconEmojiActionKey">@drawable/sym_keyboard_smiley_lxx</item>
<item name="iconEmojiNormalKey">@drawable/sym_keyboard_smiley_lxx</item>
<item name="iconClipboardActionKey">@drawable/sym_keyboard_clipboard_lxx</item>
<item name="iconClipboardNormalKey">@drawable/sym_keyboard_clipboard_lxx</item>
<item name="iconCopyKey">@drawable/sym_keyboard_copy</item>
<item name="iconCutKey">@drawable/sym_keyboard_cut</item>
<item name="iconPasteKey">@drawable/sym_keyboard_paste</item>
<item name="iconClearClipboardKey">@drawable/sym_keyboard_clear_clipboard_lxx</item>
<item name="iconStartOneHandedMode">@drawable/sym_keyboard_start_onehanded_lxx</item>
<item name="iconStopOneHandedMode">@drawable/sym_keyboard_stop_onehanded_lxx</item>
<item name="iconSwitchOneHandedMode">@drawable/ic_arrow_left</item>
<item name="iconResizeOneHandedMode">@drawable/ic_arrow_horizontal</item>
<item name="iconNumpadKey">@drawable/sym_keyboard_numpad_key_lxx</item>
<item name="iconToolbarKey">@drawable/ic_arrow_right</item>
<item name="iconSelectAll">@drawable/ic_select_all</item>
<item name="iconArrowLeft">@drawable/ic_dpad_left</item>
<item name="iconArrowRight">@drawable/ic_dpad_right</item>
<item name="iconArrowUp">@drawable/ic_dpad_up</item>
<item name="iconArrowDown">@drawable/ic_dpad_down</item>
<item name="iconWordLeft">@drawable/ic_word_left</item>
<item name="iconWordRight">@drawable/ic_word_right</item>
<item name="iconPageUp">@drawable/ic_page_up</item>
<item name="iconPageDown">@drawable/ic_page_down</item>
<item name="iconBin">@drawable/ic_delete</item>
<item name="iconUndo">@drawable/ic_undo</item>
<item name="iconRedo">@drawable/ic_redo</item>
<item name="iconFullLeft">@drawable/ic_to_start</item>
<item name="iconFullRight">@drawable/ic_to_end</item>
<item name="iconPageStart">@drawable/ic_page_start</item>
<item name="iconPageEnd">@drawable/ic_page_end</item>
<item name="iconSelectWord">@drawable/ic_select</item>
<item name="iconClose">@drawable/ic_close</item>
</style>
</resources>

View file

@ -1,65 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2014 The Android Open Source Project
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->
<resources>
<style name="KeyboardIcons.Rounded">
<!-- Keyboard icons -->
<item name="iconShiftKey">@drawable/sym_keyboard_shift_rounded</item>
<item name="iconShiftKeyShifted">@drawable/sym_keyboard_shift_rounded</item>
<item name="iconShiftKeyLocked">@drawable/sym_keyboard_shift_lock_rounded</item>
<item name="iconDeleteKey">@drawable/sym_keyboard_delete_rounded</item>
<item name="iconTabKey">@drawable/sym_keyboard_tab_rounded</item>
<item name="iconSettingsKey">@drawable/sym_keyboard_settings_rounded</item>
<item name="iconSpaceKey">@null</item>
<item name="iconEnterKey">@drawable/sym_keyboard_return_rounded</item>
<item name="iconGoKey">@drawable/sym_keyboard_go_rounded</item>
<item name="iconSearchKey">@drawable/sym_keyboard_search_rounded</item>
<item name="iconSendKey">@drawable/sym_keyboard_send_rounded</item>
<item name="iconNextKey">@drawable/ic_arrow_right_rounded</item>
<item name="iconDoneKey">@drawable/sym_keyboard_done_rounded</item>
<item name="iconPreviousKey">@drawable/ic_arrow_left_rounded</item>
<item name="iconShortcutKey">@drawable/sym_keyboard_voice_rounded</item>
<item name="iconShortcutKeyDisabled">@drawable/sym_keyboard_voice_off_rounded</item>
<item name="iconIncognitoKey">@drawable/sym_keyboard_incognito_lxx</item>
<item name="iconSpaceKeyForNumberLayout">@drawable/sym_keyboard_space_rounded</item>
<item name="iconLanguageSwitchKey">@drawable/sym_keyboard_language_switch_lxx</item>
<item name="iconAutoCorrect">@drawable/ic_autocorrect_rounded</item>
<item name="iconZwnjKey">@drawable/sym_keyboard_zwnj_lxx</item>
<item name="iconZwjKey">@drawable/sym_keyboard_zwj_lxx</item>
<item name="iconEmojiActionKey">@drawable/sym_keyboard_smiley_rounded</item>
<item name="iconEmojiNormalKey">@drawable/sym_keyboard_smiley_rounded</item>
<item name="iconClipboardActionKey">@drawable/sym_keyboard_clipboard_rounded</item>
<item name="iconClipboardNormalKey">@drawable/sym_keyboard_clipboard_rounded</item>
<item name="iconCopyKey">@drawable/sym_keyboard_copy_rounded</item>
<item name="iconCutKey">@drawable/sym_keyboard_cut_rounded</item>
<item name="iconPasteKey">@drawable/sym_keyboard_paste_rounded</item>
<item name="iconClearClipboardKey">@drawable/sym_keyboard_clear_clipboard_rounded</item>
<item name="iconStartOneHandedMode">@drawable/sym_keyboard_start_onehanded_rounded</item>
<item name="iconStopOneHandedMode">@drawable/sym_keyboard_stop_onehanded_rounded</item>
<item name="iconSwitchOneHandedMode">@drawable/ic_arrow_left_rounded</item>
<item name="iconResizeOneHandedMode">@drawable/ic_arrow_horizontal_rounded</item>
<item name="iconNumpadKey">@drawable/sym_keyboard_numpad_key_lxx</item>
<item name="iconToolbarKey">@drawable/ic_arrow_right_rounded</item>
<item name="iconSelectAll">@drawable/ic_select_all_rounded</item>
<item name="iconArrowLeft">@drawable/ic_dpad_left_rounded</item>
<item name="iconArrowRight">@drawable/ic_dpad_right_rounded</item>
<item name="iconArrowUp">@drawable/ic_dpad_up_rounded</item>
<item name="iconArrowDown">@drawable/ic_dpad_down_rounded</item>
<item name="iconWordLeft">@drawable/ic_word_left_rounded</item>
<item name="iconWordRight">@drawable/ic_word_right_rounded</item>
<item name="iconPageUp">@drawable/ic_page_up_rounded</item>
<item name="iconPageDown">@drawable/ic_page_down_rounded</item>
<item name="iconBin">@drawable/ic_delete_rounded</item>
<item name="iconUndo">@drawable/ic_undo_rounded</item>
<item name="iconRedo">@drawable/ic_redo_rounded</item>
<item name="iconFullLeft">@drawable/ic_to_start_rounded</item>
<item name="iconFullRight">@drawable/ic_to_end_rounded</item>
<item name="iconPageStart">@drawable/ic_page_start_rounded</item>
<item name="iconPageEnd">@drawable/ic_page_end_rounded</item>
<item name="iconSelectWord">@drawable/ic_select_rounded</item>
<item name="iconClose">@drawable/ic_close_rounded</item>
</style>
</resources>

View file

@ -6,7 +6,7 @@
--> -->
<resources xmlns:android="http://schemas.android.com/apk/res/android"> <resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="KeyboardTheme.HoloBase" parent="KeyboardIcons.Holo"> <style name="KeyboardTheme.HoloBase" parent="Keyboard">
<item name="inputViewStyle">@style/InputView</item> <item name="inputViewStyle">@style/InputView</item>
<item name="keyboardStyle">@style/Keyboard.HoloBase</item> <item name="keyboardStyle">@style/Keyboard.HoloBase</item>
<item name="keyboardViewStyle">@style/KeyboardView.HoloBase</item> <item name="keyboardViewStyle">@style/KeyboardView.HoloBase</item>

View file

@ -5,7 +5,7 @@
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
--> -->
<resources xmlns:android="http://schemas.android.com/apk/res/android"> <resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="KeyboardTheme.LXX_Base" parent="KeyboardIcons.LXX_Light"> <style name="KeyboardTheme.LXX_Base" parent="Keyboard">
<item name="inputViewStyle">@style/InputView.LXX</item> <item name="inputViewStyle">@style/InputView.LXX</item>
<item name="keyboardStyle">@style/Keyboard.LXX_Base</item> <item name="keyboardStyle">@style/Keyboard.LXX_Base</item>
<item name="keyboardViewStyle">@style/KeyboardView.LXX_Base</item> <item name="keyboardViewStyle">@style/KeyboardView.LXX_Base</item>

View file

@ -5,7 +5,7 @@
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
--> -->
<resources xmlns:android="http://schemas.android.com/apk/res/android"> <resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="KeyboardTheme.Rounded_Base" parent="KeyboardIcons.Rounded"> <style name="KeyboardTheme.Rounded_Base" parent="Keyboard">
<item name="inputViewStyle">@style/InputView.LXX</item> <item name="inputViewStyle">@style/InputView.LXX</item>
<item name="keyboardStyle">@style/Keyboard.Rounded_Base</item> <item name="keyboardStyle">@style/Keyboard.Rounded_Base</item>
<item name="keyboardViewStyle">@style/KeyboardView.Rounded_Base</item> <item name="keyboardViewStyle">@style/KeyboardView.Rounded_Base</item>