diff options
| author | Jules Aguillon | 2023-07-18 00:31:32 +0200 |
|---|---|---|
| committer | Jules Aguillon | 2023-07-19 23:30:58 +0200 |
| commit | 458e17bf31c9ef6b4dfadd56dd0c0dfb709eb32c (patch) | |
| tree | 7e4bd6dd451f13071fd85ebecb984388c236fd39 | |
| parent | 324aa26ba4d062edcbbecab9de2f0a8f2c3c8dfc (diff) | |
| download | unexpected-keyboard-458e17bf31c9ef6b4dfadd56dd0c0dfb709eb32c.tar.gz unexpected-keyboard-458e17bf31c9ef6b4dfadd56dd0c0dfb709eb32c.zip | |
Add custom extra keys preference
This is a new section in the extra keys option that allows to enter
arbitrary strings which are then added to the keyboard.
A new string is needed for the title of the section, Android's icons and
strings are used as much as possible to avoid adding more strings.
Keys are stored in the preferences as a JSON array of strings.
| -rw-r--r-- | res/layout/custom_extra_key_add.xml | 4 | ||||
| -rw-r--r-- | res/layout/custom_extra_key_add_dialog.xml | 4 | ||||
| -rw-r--r-- | res/layout/custom_extra_key_widget.xml | 4 | ||||
| -rw-r--r-- | res/values-cs/strings.xml | 1 | ||||
| -rw-r--r-- | res/values-de/strings.xml | 1 | ||||
| -rw-r--r-- | res/values-es/strings.xml | 1 | ||||
| -rw-r--r-- | res/values-fa/strings.xml | 1 | ||||
| -rw-r--r-- | res/values-fr/strings.xml | 1 | ||||
| -rw-r--r-- | res/values-it/strings.xml | 1 | ||||
| -rw-r--r-- | res/values-ko/strings.xml | 1 | ||||
| -rw-r--r-- | res/values-lv/strings.xml | 1 | ||||
| -rw-r--r-- | res/values-pl/strings.xml | 1 | ||||
| -rw-r--r-- | res/values-pt/strings.xml | 1 | ||||
| -rw-r--r-- | res/values-ro/strings.xml | 1 | ||||
| -rw-r--r-- | res/values-ru/strings.xml | 1 | ||||
| -rw-r--r-- | res/values-tr/strings.xml | 1 | ||||
| -rw-r--r-- | res/values-vi/strings.xml | 1 | ||||
| -rw-r--r-- | res/values-zh-rCN/strings.xml | 1 | ||||
| -rw-r--r-- | res/values/strings.xml | 1 | ||||
| -rw-r--r-- | res/values/values.xml | 1 | ||||
| -rw-r--r-- | res/xml/settings.xml | 1 | ||||
| -rw-r--r-- | srcs/juloo.keyboard2/Config.java | 4 | ||||
| -rw-r--r-- | srcs/juloo.keyboard2/CustomExtraKeysPreference.java | 174 | ||||
| -rw-r--r-- | srcs/juloo.keyboard2/ExtraKeysPreference.java | 5 |
24 files changed, 211 insertions, 2 deletions
diff --git a/res/layout/custom_extra_key_add.xml b/res/layout/custom_extra_key_add.xml new file mode 100644 index 0000000..bb555b5 --- /dev/null +++ b/res/layout/custom_extra_key_add.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center"> + <View android:layout_width="@dimen/pref_button_size" android:layout_height="@dimen/pref_button_size" android:background="@android:drawable/ic_menu_add"/> +</LinearLayout> diff --git a/res/layout/custom_extra_key_add_dialog.xml b/res/layout/custom_extra_key_add_dialog.xml new file mode 100644 index 0000000..9b799e0 --- /dev/null +++ b/res/layout/custom_extra_key_add_dialog.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content"> + <EditText android:id="@+id/key_name" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margin="10dp"/> +</LinearLayout> diff --git a/res/layout/custom_extra_key_widget.xml b/res/layout/custom_extra_key_widget.xml new file mode 100644 index 0000000..7961f3c --- /dev/null +++ b/res/layout/custom_extra_key_widget.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal"> + <Button android:id="@+id/btn_custom_extra_key_remove" android:layout_width="@dimen/pref_button_size" android:layout_height="@dimen/pref_button_size" android:layout_gravity="center" android:background="@android:drawable/ic_menu_close_clear_cancel"/> +</LinearLayout> diff --git a/res/values-cs/strings.xml b/res/values-cs/strings.xml index 2dc26d4..8e753fb 100644 --- a/res/values-cs/strings.xml +++ b/res/values-cs/strings.xml @@ -27,6 +27,7 @@ <string name="pref_numpad_layout_e_high_first">Vyšší číslice jako první</string> <string name="pref_numpad_layout_e_low_first">Nižší číslice jako první</string> <string name="pref_extra_keys_title">Přidat klávesy do klávesnice</string> + <!-- <string name="pref_extra_keys_custom">Add custom keys</string> --> <!-- <string name="pref_extra_keys_internal">Select keys to add to the keyboard</string> --> <string name="pref_second_layout_title">Vedlejší rozvržení</string> <string name="pref_second_layout_none">Žádné</string> diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml index 4b0375a..57ceba8 100644 --- a/res/values-de/strings.xml +++ b/res/values-de/strings.xml @@ -27,6 +27,7 @@ <string name="pref_numpad_layout_e_high_first">Hohe Ziffern zuerst</string> <string name="pref_numpad_layout_e_low_first">Niedrige Ziffern zuerst</string> <string name="pref_extra_keys_title">Zusätzliche Zeichen zur Tastatur hinzufügen</string> + <!-- <string name="pref_extra_keys_custom">Add custom keys</string> --> <!-- <string name="pref_extra_keys_internal">Select keys to add to the keyboard</string> --> <string name="pref_second_layout_title">Zweites Layout</string> <string name="pref_second_layout_none">Keines</string> diff --git a/res/values-es/strings.xml b/res/values-es/strings.xml index 85d94a9..2fe73c5 100644 --- a/res/values-es/strings.xml +++ b/res/values-es/strings.xml @@ -27,6 +27,7 @@ <!-- <string name="pref_numpad_layout_e_high_first">High digits first</string> --> <!-- <string name="pref_numpad_layout_e_low_first">Low digits first</string> --> <!-- <string name="pref_extra_keys_title">Add keys to the keyboard</string> --> + <!-- <string name="pref_extra_keys_custom">Add custom keys</string> --> <!-- <string name="pref_extra_keys_internal">Select keys to add to the keyboard</string> --> <!-- <string name="pref_second_layout_title">Secondary layout</string> --> <!-- <string name="pref_second_layout_none">None</string> --> diff --git a/res/values-fa/strings.xml b/res/values-fa/strings.xml index c7e02d7..29a5667 100644 --- a/res/values-fa/strings.xml +++ b/res/values-fa/strings.xml @@ -27,6 +27,7 @@ <string name="pref_numpad_layout_e_high_first">ابتدا اعداد بزرگ</string> <string name="pref_numpad_layout_e_low_first">ابتدا اعداد کوچک</string> <string name="pref_extra_keys_title">افزودن کلیدها به صفحه کلید</string> + <!-- <string name="pref_extra_keys_custom">Add custom keys</string> --> <!-- <string name="pref_extra_keys_internal">Select keys to add to the keyboard</string> --> <string name="pref_second_layout_title">طرح دوم</string> <string name="pref_second_layout_none">هیچ</string> diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml index ba46e24..5398563 100644 --- a/res/values-fr/strings.xml +++ b/res/values-fr/strings.xml @@ -27,6 +27,7 @@ <string name="pref_numpad_layout_e_high_first">Du plus haut au plus bas</string> <string name="pref_numpad_layout_e_low_first">Du plus bas au plus haut</string> <string name="pref_extra_keys_title">Ajouter des touches au clavier</string> + <!-- <string name="pref_extra_keys_custom">Add custom keys</string> --> <!-- <string name="pref_extra_keys_internal">Select keys to add to the keyboard</string> --> <string name="pref_second_layout_title">Disposition secondaire</string> <string name="pref_second_layout_none">Aucune</string> diff --git a/res/values-it/strings.xml b/res/values-it/strings.xml index 8753f01..8267193 100644 --- a/res/values-it/strings.xml +++ b/res/values-it/strings.xml @@ -27,6 +27,7 @@ <!-- <string name="pref_numpad_layout_e_high_first">High digits first</string> --> <!-- <string name="pref_numpad_layout_e_low_first">Low digits first</string> --> <!-- <string name="pref_extra_keys_title">Add keys to the keyboard</string> --> + <!-- <string name="pref_extra_keys_custom">Add custom keys</string> --> <!-- <string name="pref_extra_keys_internal">Select keys to add to the keyboard</string> --> <!-- <string name="pref_second_layout_title">Secondary layout</string> --> <string name="pref_second_layout_none">Nessuno</string> diff --git a/res/values-ko/strings.xml b/res/values-ko/strings.xml index b43069d..5587a0b 100644 --- a/res/values-ko/strings.xml +++ b/res/values-ko/strings.xml @@ -27,6 +27,7 @@ <!-- <string name="pref_numpad_layout_e_high_first">High digits first</string> --> <!-- <string name="pref_numpad_layout_e_low_first">Low digits first</string> --> <!-- <string name="pref_extra_keys_title">Add keys to the keyboard</string> --> + <!-- <string name="pref_extra_keys_custom">Add custom keys</string> --> <!-- <string name="pref_extra_keys_internal">Select keys to add to the keyboard</string> --> <!-- <string name="pref_second_layout_title">Secondary layout</string> --> <!-- <string name="pref_second_layout_none">None</string> --> diff --git a/res/values-lv/strings.xml b/res/values-lv/strings.xml index 1fc0abd..d0ccbb5 100644 --- a/res/values-lv/strings.xml +++ b/res/values-lv/strings.xml @@ -27,6 +27,7 @@ <string name="pref_numpad_layout_e_high_first">Vispirms lielākie cipari</string> <string name="pref_numpad_layout_e_low_first">Vispirms mazākie cipari</string> <string name="pref_extra_keys_title">Pievienot tastatūrai taustiņus</string> + <!-- <string name="pref_extra_keys_custom">Add custom keys</string> --> <!-- <string name="pref_extra_keys_internal">Select keys to add to the keyboard</string> --> <string name="pref_second_layout_title">Otrējais izkārtojums</string> <string name="pref_second_layout_none">Neviens</string> diff --git a/res/values-pl/strings.xml b/res/values-pl/strings.xml index e0eebb3..a9b35f9 100644 --- a/res/values-pl/strings.xml +++ b/res/values-pl/strings.xml @@ -27,6 +27,7 @@ <string name="pref_numpad_layout_e_high_first">Od największej cyfry</string> <string name="pref_numpad_layout_e_low_first">Od najmniejszej cyfry</string> <string name="pref_extra_keys_title">Dodaj klawisze do klawiatury</string> + <!-- <string name="pref_extra_keys_custom">Add custom keys</string> --> <!-- <string name="pref_extra_keys_internal">Select keys to add to the keyboard</string> --> <string name="pref_second_layout_title">Drugi układ</string> <string name="pref_second_layout_none">Żaden</string> diff --git a/res/values-pt/strings.xml b/res/values-pt/strings.xml index 7db55fb..66b3f36 100644 --- a/res/values-pt/strings.xml +++ b/res/values-pt/strings.xml @@ -27,6 +27,7 @@ <string name="pref_numpad_layout_e_high_first">Dígitos maiores primeiro</string> <string name="pref_numpad_layout_e_low_first">Dígitos menores primeiro</string> <string name="pref_extra_keys_title">Adicionar teclas ao teclado</string> + <!-- <string name="pref_extra_keys_custom">Add custom keys</string> --> <!-- <string name="pref_extra_keys_internal">Select keys to add to the keyboard</string> --> <string name="pref_second_layout_title">Layout secundário</string> <string name="pref_second_layout_none">Nenhum</string> diff --git a/res/values-ro/strings.xml b/res/values-ro/strings.xml index 22b429a..c78b5ae 100644 --- a/res/values-ro/strings.xml +++ b/res/values-ro/strings.xml @@ -27,6 +27,7 @@ <string name="pref_numpad_layout_e_high_first">Mai întâi cifrele mari</string> <string name="pref_numpad_layout_e_low_first">Mai întâi cifrele mici</string> <string name="pref_extra_keys_title">Adaugă taste pe tastatură</string> + <!-- <string name="pref_extra_keys_custom">Add custom keys</string> --> <!-- <string name="pref_extra_keys_internal">Select keys to add to the keyboard</string> --> <string name="pref_second_layout_title">Aranjament secundar</string> <string name="pref_second_layout_none">Nimic</string> diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml index a3a9a5f..0cf4c81 100644 --- a/res/values-ru/strings.xml +++ b/res/values-ru/strings.xml @@ -27,6 +27,7 @@ <string name="pref_numpad_layout_e_high_first">Старшие цифры сверху</string> <string name="pref_numpad_layout_e_low_first">Младшие цифры сверху</string> <string name="pref_extra_keys_title">Добавить клавиши на клавиатуру</string> + <!-- <string name="pref_extra_keys_custom">Add custom keys</string> --> <!-- <string name="pref_extra_keys_internal">Select keys to add to the keyboard</string> --> <string name="pref_second_layout_title">Дополнительная раскладка</string> <string name="pref_second_layout_none">Нет</string> diff --git a/res/values-tr/strings.xml b/res/values-tr/strings.xml index d0677b1..770dab0 100644 --- a/res/values-tr/strings.xml +++ b/res/values-tr/strings.xml @@ -27,6 +27,7 @@ <!-- <string name="pref_numpad_layout_e_high_first">High digits first</string> --> <!-- <string name="pref_numpad_layout_e_low_first">Low digits first</string> --> <!-- <string name="pref_extra_keys_title">Add keys to the keyboard</string> --> + <!-- <string name="pref_extra_keys_custom">Add custom keys</string> --> <!-- <string name="pref_extra_keys_internal">Select keys to add to the keyboard</string> --> <!-- <string name="pref_second_layout_title">Secondary layout</string> --> <string name="pref_second_layout_none">Hiçbiri</string> diff --git a/res/values-vi/strings.xml b/res/values-vi/strings.xml index b96b76f..088810f 100644 --- a/res/values-vi/strings.xml +++ b/res/values-vi/strings.xml @@ -29,6 +29,7 @@ <string name="pref_numpad_layout_e_high_first">Số lớn nhất trước</string> <string name="pref_numpad_layout_e_low_first">Số nhỏ nhất trước</string> <string name="pref_extra_keys_title">Thêm phím vào bàn phím</string> + <!-- <string name="pref_extra_keys_custom">Add custom keys</string> --> <!-- <string name="pref_extra_keys_internal">Select keys to add to the keyboard</string> --> <string name="pref_second_layout_title">Bố cục phụ</string> <string name="pref_second_layout_none">Không</string> diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml index d25cc50..a4b20f4 100644 --- a/res/values-zh-rCN/strings.xml +++ b/res/values-zh-rCN/strings.xml @@ -27,6 +27,7 @@ <string name="pref_numpad_layout_e_high_first">大数字在上方</string> <string name="pref_numpad_layout_e_low_first">小数字在上方</string> <string name="pref_extra_keys_title">选择要显示的按键</string> + <!-- <string name="pref_extra_keys_custom">Add custom keys</string> --> <!-- <string name="pref_extra_keys_internal">Select keys to add to the keyboard</string> --> <string name="pref_second_layout_title">第二键盘布局</string> <string name="pref_second_layout_none">无</string> diff --git a/res/values/strings.xml b/res/values/strings.xml index 3c963f3..c278493 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -27,6 +27,7 @@ <string name="pref_numpad_layout_e_high_first">High digits first</string> <string name="pref_numpad_layout_e_low_first">Low digits first</string> <string name="pref_extra_keys_title">Add keys to the keyboard</string> + <string name="pref_extra_keys_custom">Add custom keys</string> <string name="pref_extra_keys_internal">Select keys to add to the keyboard</string> <string name="pref_second_layout_title">Secondary layout</string> <string name="pref_second_layout_none">None</string> diff --git a/res/values/values.xml b/res/values/values.xml index c15118e..737e7db 100644 --- a/res/values/values.xml +++ b/res/values/values.xml @@ -5,6 +5,7 @@ <dimen name="emoji_type_button_height">56dp</dimen> <dimen name="emoji_grid_height">250dp</dimen> <dimen name="emoji_text_size">28dp</dimen> + <dimen name="pref_button_size">28dp</dimen> <bool name="debug_logs" product="debug">true</bool> <bool name="debug_logs" product="default">false</bool> </resources> diff --git a/res/xml/settings.xml b/res/xml/settings.xml index 0b85487..8a8c8d7 100644 --- a/res/xml/settings.xml +++ b/res/xml/settings.xml @@ -7,6 +7,7 @@ <ListPreference android:key="show_numpad" android:title="@string/pref_show_numpad_title" android:summary="%s" android:defaultValue="1" android:entries="@array/pref_show_numpad_entries" android:entryValues="@array/pref_show_numpad_values"/> <CheckBoxPreference android:key="number_row" android:title="@string/pref_number_row_title" android:summary="@string/pref_number_row_summary" android:defaultValue="false"/> <PreferenceScreen android:title="@string/pref_extra_keys_title"> + <juloo.keyboard2.CustomExtraKeysPreference android:title="@string/pref_extra_keys_custom"/> <juloo.keyboard2.ExtraKeysPreference android:title="@string/pref_extra_keys_internal"/> </PreferenceScreen> <ListPreference android:key="numpad_layout" android:title="@string/pref_numpad_layout" android:summary="%s" android:defaultValue="high_first" android:entries="@array/pref_numpad_layout_entries" android:entryValues="@array/pref_numpad_layout_values"/> diff --git a/srcs/juloo.keyboard2/Config.java b/srcs/juloo.keyboard2/Config.java index 1bc406c..c6b3ed4 100644 --- a/srcs/juloo.keyboard2/Config.java +++ b/srcs/juloo.keyboard2/Config.java @@ -62,6 +62,7 @@ final class Config public boolean swapEnterActionKey; // Swap the "enter" and "action" keys public ExtraKeys extra_keys_subtype; public Set<KeyValue> extra_keys_param; + public List<KeyValue> extra_keys_custom; public final IKeyEventHandler handler; public boolean orientation_landscape = false; @@ -155,6 +156,7 @@ final class Config autocapitalisation = _prefs.getBoolean("autocapitalisation", true); switch_input_immediate = _prefs.getBoolean("switch_input_immediate", false); extra_keys_param = ExtraKeysPreference.get_extra_keys(_prefs); + extra_keys_custom = CustomExtraKeysPreference.get(_prefs); } KeyValue action_key() @@ -170,6 +172,7 @@ final class Config * - Replace the action key to show the right label * - Swap the enter and action keys * - Add the optional numpad and number row + * - Add the extra keys */ public KeyboardData modify_layout(KeyboardData kw) { @@ -181,6 +184,7 @@ final class Config if (extra_keys_subtype != null) extra_keys_subtype.compute(extra_keys, kw.script); extra_keys.addAll(extra_keys_param); + extra_keys.addAll(extra_keys_custom); boolean number_row = this.number_row && !show_numpad; if (number_row) KeyboardData.number_row.getKeys(remove_keys); diff --git a/srcs/juloo.keyboard2/CustomExtraKeysPreference.java b/srcs/juloo.keyboard2/CustomExtraKeysPreference.java new file mode 100644 index 0000000..228eae8 --- /dev/null +++ b/srcs/juloo.keyboard2/CustomExtraKeysPreference.java @@ -0,0 +1,174 @@ +package juloo.keyboard2; + +import android.app.AlertDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.SharedPreferences; +import android.preference.Preference; +import android.preference.PreferenceCategory; +import android.util.AttributeSet; +import android.view.View; +import android.view.ViewGroup; +import android.widget.EditText; +import java.util.ArrayList; +import java.util.List; +import org.json.JSONArray; +import org.json.JSONException; + +/** Allows to enter custom keys to be added to the keyboard. This shows up at + the top of the "Add keys to the keyboard" option. */ +public class CustomExtraKeysPreference extends PreferenceCategory +{ + /** This pref stores a list of strings encoded as JSON. */ + static String KEY = "custom_extra_keys"; + + boolean _attached = false; + /** Mutable. This is the list of the key strings, not the key names. */ + List<String> _keys; + + public CustomExtraKeysPreference(Context context, AttributeSet attrs) + { + super(context, attrs); + setKey(KEY); + setOrderingAsAdded(true); + _keys = new ArrayList<String>(); + } + + public static List<KeyValue> get(SharedPreferences prefs) + { + List<KeyValue> kvs = new ArrayList<KeyValue>(); + String inp = prefs.getString(KEY, null); + if (inp != null) + for (String key_name : load_from_string(inp)) + kvs.add(KeyValue.makeStringKey(key_name)); + return kvs; + } + + @Override + protected void onSetInitialValue(boolean restoreValue, Object defaultValue) + { + if (restoreValue) + { + String persisted = getPersistedString(null); + if (persisted != null) + set_keys(load_from_string(persisted), false); + } + else if (defaultValue != null) + set_keys(load_from_string((String)defaultValue), false); + } + + @Override + protected void onAttachedToActivity() + { + super.onAttachedToActivity(); + if (_attached) + return; + _attached = true; + reattach(); + } + + void reattach() + { + removeAll(); + for (String k : _keys) + addPreference(this.new CustomExtraKey(getContext(), k)); + addPreference(this.new AddButton(getContext())); + } + + void set_keys(List<String> v, boolean persist) + { + _keys = v; + reattach(); + if (persist) + persistString(save_to_string(_keys)); + } + + void add_key(String k) + { + _keys.add(k); + set_keys(_keys, true); + } + + void remove_key(String k) + { + _keys.remove(k); + set_keys(_keys, true); + } + + static String save_to_string(List<String> keys) + { + return (new JSONArray(keys)).toString(); + } + + static List<String> load_from_string(String inp) + { + List<String> keys = new ArrayList<String>(); + try + { + JSONArray arr = new JSONArray(inp); + for (int i = 0; i < arr.length(); i++) + keys.add(arr.getString(i)); + } + catch (JSONException e) {} + return keys; + } + + /** A preference with no key that is only intended to be rendered. */ + final class CustomExtraKey extends Preference implements View.OnClickListener + { + String _key; + + public CustomExtraKey(Context ctx, String key) + { + super(ctx); + _key = key; + setTitle(key); + setPersistent(false); + setWidgetLayoutResource(R.layout.custom_extra_key_widget); + } + + /** Remove-button listener. */ + @Override + public void onClick(View _v) + { + CustomExtraKeysPreference.this.remove_key(_key); + } + + @Override + protected View onCreateView(ViewGroup parent) + { + View v = super.onCreateView(parent); + v.findViewById(R.id.btn_custom_extra_key_remove).setOnClickListener(this); + return v; + } + } + + final class AddButton extends Preference + { + public AddButton(Context ctx) + { + super(ctx); + setPersistent(false); + setLayoutResource(R.layout.custom_extra_key_add); + } + + @Override + protected void onClick() + { + new AlertDialog.Builder(getContext()) + .setView(R.layout.custom_extra_key_add_dialog) + .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener(){ + public void onClick(DialogInterface dialog, int which) + { + EditText input = (EditText)((AlertDialog)dialog).findViewById(R.id.key_name); + String k = input.getText().toString(); + if (!k.equals("")) + CustomExtraKeysPreference.this.add_key(k); + } + }) + .setNegativeButton(android.R.string.cancel, null) + .setIcon(android.R.drawable.ic_dialog_alert) + .show(); + } + } +} diff --git a/srcs/juloo.keyboard2/ExtraKeysPreference.java b/srcs/juloo.keyboard2/ExtraKeysPreference.java index 340db1e..6b0547b 100644 --- a/srcs/juloo.keyboard2/ExtraKeysPreference.java +++ b/srcs/juloo.keyboard2/ExtraKeysPreference.java @@ -81,7 +81,7 @@ public class ExtraKeysPreference extends PreferenceCategory return ks; } - boolean _attached; /** Whether it has already been attached. */ + boolean _attached = false; /** Whether it has already been attached. */ public ExtraKeysPreference(Context context, AttributeSet attrs) { @@ -89,6 +89,7 @@ public class ExtraKeysPreference extends PreferenceCategory setOrderingAsAdded(true); } + @Override protected void onAttachedToActivity() { if (_attached) @@ -104,7 +105,7 @@ public class ExtraKeysPreference extends PreferenceCategory return "extra_key_" + key_name; } - final class ExtraKeyCheckBoxPreference extends CheckBoxPreference + static class ExtraKeyCheckBoxPreference extends CheckBoxPreference { boolean _key_font; |
