mirror of
https://github.com/Julow/Unexpected-Keyboard.git
synced 2025-02-10 14:49:59 +01:00
Fix empty text box when editing custom extra keys
This commit is contained in:
parent
2060e6ab07
commit
7c85870352
@ -10,6 +10,7 @@ import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -48,10 +49,12 @@ public class CustomExtraKeysPreference extends ListGroupPreference<String>
|
||||
String label_of_value(String value, int i) { return value; }
|
||||
|
||||
@Override
|
||||
void select(final SelectionCallback<String> callback)
|
||||
void select(final SelectionCallback<String> callback, String old_value)
|
||||
{
|
||||
View content = View.inflate(getContext(), R.layout.dialog_edit_text, null);
|
||||
((TextView)content.findViewById(R.id.text)).setText(old_value);
|
||||
new AlertDialog.Builder(getContext())
|
||||
.setView(View.inflate(getContext(), R.layout.dialog_edit_text, null))
|
||||
.setView(content)
|
||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener(){
|
||||
public void onClick(DialogInterface dialog, int which)
|
||||
{
|
||||
|
@ -145,8 +145,7 @@ public class LayoutsPreference extends ListGroupPreference<LayoutsPreference.Lay
|
||||
@Override
|
||||
ListGroupPreference.Serializer<Layout> get_serializer() { return SERIALIZER; }
|
||||
|
||||
@Override
|
||||
void select(final SelectionCallback callback)
|
||||
void select_dialog(final SelectionCallback callback)
|
||||
{
|
||||
ArrayAdapter layouts = new ArrayAdapter(getContext(), android.R.layout.simple_list_item_1, _layout_display_names);
|
||||
new AlertDialog.Builder(getContext())
|
||||
@ -207,10 +206,10 @@ public class LayoutsPreference extends ListGroupPreference<LayoutsPreference.Lay
|
||||
@Override
|
||||
void select(final SelectionCallback callback, Layout prev_layout)
|
||||
{
|
||||
if (prev_layout instanceof CustomLayout)
|
||||
if (prev_layout != null && prev_layout instanceof CustomLayout)
|
||||
select_custom(callback, ((CustomLayout)prev_layout).xml);
|
||||
else
|
||||
select(callback);
|
||||
select_dialog(callback);
|
||||
}
|
||||
|
||||
/** The initial text for the custom layout entry box. The qwerty_us layout is
|
||||
|
@ -54,14 +54,9 @@ public abstract class ListGroupPreference<E> extends PreferenceGroup
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Called when an item is added or modified. */
|
||||
abstract void select(SelectionCallback<E> callback);
|
||||
|
||||
/** Called when an item is modified. */
|
||||
void select(SelectionCallback<E> callback, E _old_value)
|
||||
{
|
||||
select(callback);
|
||||
}
|
||||
/** Called when an item is added or modified. [old_value] is [null] if the
|
||||
item is being added. */
|
||||
abstract void select(SelectionCallback<E> callback, E old_value);
|
||||
|
||||
/** A separate class is used as the same serializer must be used in the
|
||||
static context. See [Serializer] below. */
|
||||
@ -261,7 +256,7 @@ public abstract class ListGroupPreference<E> extends PreferenceGroup
|
||||
}
|
||||
|
||||
public boolean allow_remove() { return false; }
|
||||
});
|
||||
}, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user