mirror of
https://github.com/mauiaaron/apple2.git
synced 2024-12-27 06:29:19 +00:00
Beginnings of customized alt touch keyboard layout
This commit is contained in:
parent
59cb3e49f9
commit
49c99d5ab7
@ -173,6 +173,49 @@ public class Apple2KeyboardSettingsMenu extends Apple2AbstractMenu {
|
||||
});
|
||||
return convertView;
|
||||
}
|
||||
},
|
||||
KEYBOARD_CHOOSE_ALT {
|
||||
@Override
|
||||
public final String getTitle(Apple2Activity activity) {
|
||||
return activity.getResources().getString(R.string.keyboard_choose_alt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String getSummary(Apple2Activity activity) {
|
||||
return activity.getResources().getString(R.string.keyboard_choose_alt_summary);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final View getView(final Apple2Activity activity, View convertView) {
|
||||
convertView = _basicView(activity, this, convertView);
|
||||
_addPopupIcon(activity, this, convertView);
|
||||
return convertView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleSelection(final Apple2Activity activity, final Apple2AbstractMenu settingsMenu, boolean isChecked) {
|
||||
String[] titles = new String[Apple2Preferences.KeyboardAltPreset.size + 1];
|
||||
titles[0] = activity.getResources().getString(R.string.keyboard_preset_custom);
|
||||
System.arraycopy(Apple2Preferences.KeyboardAltPreset.titles(activity), 0, titles, 1, Apple2Preferences.KeyboardAltPreset.size);
|
||||
|
||||
_alertDialogHandleSelection(activity, R.string.keyboard_choose_alt_title, titles, new IPreferenceLoadSave() {
|
||||
@Override
|
||||
public int intValue() {
|
||||
return Apple2Preferences.KEYBOARD_ALT.intValue(activity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveInt(int value) {
|
||||
Apple2Preferences.KEYBOARD_ALT.saveInt(activity, value);
|
||||
if (value == 0) {
|
||||
Apple2KeyboardSettingsMenu keyboardSettingsMenu = (Apple2KeyboardSettingsMenu) settingsMenu;
|
||||
////TODO FIXME ... keyboardSettingsMenu.chooseAltKeyboard(activity);
|
||||
} else {
|
||||
Apple2Preferences.KeyboardAltPreset.values()[value - 1].apply(activity);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
public static final int size = SETTINGS.values().length;
|
||||
|
@ -512,6 +512,17 @@ public enum Apple2Preferences {
|
||||
return activity.getPreferences(Context.MODE_PRIVATE).getInt(toString(), defaultLatency);
|
||||
}
|
||||
},
|
||||
KEYBOARD_ALT {
|
||||
@Override
|
||||
public void load(Apple2Activity activity) {
|
||||
/* ... */
|
||||
}
|
||||
|
||||
@Override
|
||||
public int intValue(Apple2Activity activity) {
|
||||
return activity.getPreferences(Context.MODE_PRIVATE).getInt(toString(), 1);
|
||||
}
|
||||
},
|
||||
KEYBOARD_VISIBILITY_ACTIVE {
|
||||
@Override
|
||||
public void load(Apple2Activity activity) {
|
||||
@ -763,6 +774,46 @@ public enum Apple2Preferences {
|
||||
}
|
||||
}
|
||||
|
||||
public enum KeyboardAltPreset {
|
||||
DEFAULT {
|
||||
@Override
|
||||
public String getTitle(Apple2Activity activity) {
|
||||
return activity.getResources().getString(R.string.keyboard_preset_default);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(Apple2Activity activity) {
|
||||
// TODO FIXME ...
|
||||
}
|
||||
},
|
||||
U4 {
|
||||
@Override
|
||||
public String getTitle(Apple2Activity activity) {
|
||||
return activity.getResources().getString(R.string.keyboard_preset_u4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(Apple2Activity activity) {
|
||||
// TODO FIXME ...
|
||||
}
|
||||
};
|
||||
|
||||
public abstract String getTitle(Apple2Activity activity);
|
||||
|
||||
public abstract void apply(Apple2Activity activity);
|
||||
|
||||
public static final int size = KeyboardAltPreset.values().length;
|
||||
|
||||
public static String[] titles(Apple2Activity activity) {
|
||||
String[] titles = new String[size];
|
||||
int i = 0;
|
||||
for (KeyboardAltPreset preset : values()) {
|
||||
titles[i++] = preset.getTitle(activity);
|
||||
}
|
||||
return titles;
|
||||
}
|
||||
}
|
||||
|
||||
public final static int DECENT_AMOUNT_OF_CHOICES = 20;
|
||||
public final static int AUDIO_LATENCY_NUM_CHOICES = DECENT_AMOUNT_OF_CHOICES;
|
||||
public final static int ALPHA_SLIDER_NUM_CHOICES = DECENT_AMOUNT_OF_CHOICES;
|
||||
|
@ -71,10 +71,16 @@
|
||||
<string name="key_space">[Space]</string>
|
||||
<string name="key_up">↑</string>
|
||||
<string name="keyboard">Keyboard</string>
|
||||
<string name="keyboard_choose_alt">Choose alt keyboard…</string>
|
||||
<string name="keyboard_choose_alt_summary">Choose alternative customized layout</string>
|
||||
<string name="keyboard_choose_alt_title">Alt keyboard layout</string>
|
||||
<string name="keyboard_configure">Configure keyboard…</string>
|
||||
<string name="keyboard_configure_summary">Transparency, lowercase, custom keys</string>
|
||||
<string name="keyboard_lowercase_enabled">Enable lowercase</string>
|
||||
<string name="keyboard_lowercase_enabled_summary">Enable lowercase keys</string>
|
||||
<string name="keyboard_preset_custom">Load custom…</string>
|
||||
<string name="keyboard_preset_default">Default</string>
|
||||
<string name="keyboard_preset_u4">U4 optimized</string>
|
||||
<string name="keyboard_visibility_active">Visibility when active</string>
|
||||
<string name="keyboard_visibility_active_summary">Keyboard visibility when active</string>
|
||||
<string name="keyboard_visibility_inactive">Visibility when inactive</string>
|
||||
|
@ -84,9 +84,9 @@ static char kbdTemplateAlt[KBD_TEMPLATE_ROWS][KBD_TEMPLATE_COLS+1] = {
|
||||
static char kbdTemplateArrow[KBD_TEMPLATE_ROWS][KBD_TEMPLATE_COLS+1] = {
|
||||
"@ @ @ @ @ ",
|
||||
" ",
|
||||
" T@ ",
|
||||
"A @@@ ",
|
||||
" C@ ",
|
||||
" @ ",
|
||||
" @@@ ",
|
||||
" @ ",
|
||||
" ",
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user