mirror of
https://github.com/Julow/Unexpected-Keyboard.git
synced 2024-12-28 00:48:56 +01:00
51b330c616
A new option allow to choose a secondary layout, the switching key is placed on the top edge of the space bar. The "Programming layout" option was basically doing that but it was possible to choose from a few layouts only. It is improved and renamed. The 'LayoutListPreference' allows setting the string for the first entry but otherwise share the rest of the array. Add nice icons from materialdesignicons.
26 lines
870 B
Java
26 lines
870 B
Java
package juloo.keyboard2;
|
|
|
|
import android.content.Context;
|
|
import android.content.res.Resources;
|
|
import android.content.res.TypedArray;
|
|
import android.preference.ListPreference;
|
|
import android.util.AttributeSet;
|
|
|
|
public class LayoutListPreference extends ListPreference
|
|
{
|
|
public LayoutListPreference(Context context, AttributeSet attrs)
|
|
{
|
|
super(context, attrs);
|
|
final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.LayoutListPreference);
|
|
String defaultString = a.getString(R.styleable.LayoutListPreference_defaultString);
|
|
a.recycle();
|
|
Resources res = context.getResources();
|
|
String[] entries = res.getStringArray(R.array.pref_layout_entries);
|
|
entries[0] = defaultString;
|
|
setEntries(entries);
|
|
setEntryValues(res.getStringArray(R.array.pref_layout_values));
|
|
setSummary("%s");
|
|
setDefaultValue("none");
|
|
}
|
|
}
|