abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2/CustomExtraKeysPreference.java
diff options
context:
space:
mode:
Diffstat (limited to 'srcs/juloo.keyboard2/CustomExtraKeysPreference.java')
-rw-r--r--srcs/juloo.keyboard2/CustomExtraKeysPreference.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/srcs/juloo.keyboard2/CustomExtraKeysPreference.java b/srcs/juloo.keyboard2/CustomExtraKeysPreference.java
index 7bbc449..465b2e7 100644
--- a/srcs/juloo.keyboard2/CustomExtraKeysPreference.java
+++ b/srcs/juloo.keyboard2/CustomExtraKeysPreference.java
@@ -17,10 +17,12 @@ 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 ListGroupPreference
+public class CustomExtraKeysPreference extends ListGroupPreference<String>
{
/** This pref stores a list of strings encoded as JSON. */
static final String KEY = "custom_extra_keys";
+ static final ListGroupPreference.Serializer<String> SERIALIZER =
+ new ListGroupPreference.StringSerializer();
public CustomExtraKeysPreference(Context context, AttributeSet attrs)
{
@@ -31,7 +33,7 @@ public class CustomExtraKeysPreference extends ListGroupPreference
public static List<KeyValue> get(SharedPreferences prefs)
{
List<KeyValue> kvs = new ArrayList<KeyValue>();
- List<String> key_names = load_from_preferences(KEY, prefs, null);
+ List<String> key_names = load_from_preferences(KEY, prefs, null, SERIALIZER);
if (key_names != null)
{
for (String key_name : key_names)
@@ -40,8 +42,10 @@ public class CustomExtraKeysPreference extends ListGroupPreference
return kvs;
}
+ String label_of_value(String value, int i) { return value; }
+
@Override
- void select(final SelectionCallback callback)
+ void select(final SelectionCallback<String> callback)
{
new AlertDialog.Builder(getContext())
.setView(R.layout.custom_extra_key_add_dialog)
@@ -58,4 +62,7 @@ public class CustomExtraKeysPreference extends ListGroupPreference
.setIcon(android.R.drawable.ic_dialog_alert)
.show();
}
+
+ @Override
+ Serializer<String> get_serializer() { return SERIALIZER; }
}