mirror of
https://github.com/jamessanford/kegs.git
synced 2024-06-03 05:29:42 +00:00
ActionBar
This commit is contained in:
parent
b3a3ffe648
commit
b023e66caf
30
res/menu/actions.xml
Normal file
30
res/menu/actions.xml
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- ic_bt_keyboard_hid, ic_lockscreen_ime -->
|
||||
<item android:id="@+id/action_keyboard"
|
||||
android:icon="@drawable/ic_bt_keyboard_hid"
|
||||
android:showAsAction="ifRoom"
|
||||
android:title="Keyboard" />
|
||||
|
||||
<item android:id="@+id/action_joystick"
|
||||
android:icon="@drawable/ic_bt_misc_hid"
|
||||
android:showAsAction="ifRoom"
|
||||
android:title="Use Joystick" />
|
||||
|
||||
<item android:id="@+id/action_speed"
|
||||
android:icon="@drawable/dial"
|
||||
android:showAsAction="ifRoom"
|
||||
android:title="Emulation Speed" />
|
||||
|
||||
<item android:id="@+id/action_function"
|
||||
android:icon="@drawable/ic_dialog_attach"
|
||||
android:showAsAction="never"
|
||||
android:title="Special Keys" />
|
||||
|
||||
<item android:id="@+id/action_diskimage"
|
||||
android:icon="@drawable/ic_menu_save"
|
||||
android:showAsAction="ifRoom"
|
||||
android:title="Disk Images" />
|
||||
|
||||
</menu>
|
|
@ -92,6 +92,9 @@ class BitmapSize {
|
|||
scaleX = Math.max(1, scaleX);
|
||||
scaleY = Math.min(scaleX, height / 400.0f);
|
||||
|
||||
// NOTE: scaleY should really never be less than '1',
|
||||
// although theoretically 0.5-1 would look OK, it causes poor performance
|
||||
|
||||
// If Y would be compressed in a weird way, reduce the scale and use 1:1.
|
||||
if ((scaleX - scaleY) > 0.5) {
|
||||
scaleX = Math.max(1, scaleX - 1);
|
||||
|
|
|
@ -278,6 +278,48 @@ public class KegsMain extends Activity implements KegsKeyboard.StickyReset {
|
|||
// return super.dispatchGenericMotionEvent(event);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// BUG: no overflow menu on devices with menu button
|
||||
// BUG: when action bar is hidden, menu bar only shows overflow items
|
||||
getMenuInflater().inflate(R.menu.actions, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||
// TODO: add code to adjust anything that might change
|
||||
return super.onPrepareOptionsMenu(menu);
|
||||
}
|
||||
|
||||
// TODO: FIXME: Seriously in progress.
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Action bar was clicked.
|
||||
final int item_id = item.getItemId();
|
||||
if (item_id == R.id.action_keyboard) {
|
||||
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (imm != null) {
|
||||
imm.toggleSoftInput(0, 0);
|
||||
}
|
||||
return true;
|
||||
} else if (item_id == R.id.action_speed) {
|
||||
new SpeedFragment().show(getFragmentManager(), FRAGMENT_SPEED);
|
||||
return true;
|
||||
} else if (item_id == R.id.action_joystick) {
|
||||
mModeMouse = !mModeMouse;
|
||||
// TOAST...'now using...joystick or mouse'
|
||||
return true;
|
||||
} else if (item_id == R.id.action_function) {
|
||||
// drop down menu for special keys...?
|
||||
return true;
|
||||
} else if (item_id == R.id.action_diskimage) {
|
||||
// start fragment for disk images
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
|
Loading…
Reference in New Issue
Block a user