diff --git a/res/menu/actions.xml b/res/menu/actions.xml new file mode 100644 index 0000000..0f44b49 --- /dev/null +++ b/res/menu/actions.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + diff --git a/src/com/froop/app/kegs/BitmapSize.java b/src/com/froop/app/kegs/BitmapSize.java index dacd688..72764f6 100644 --- a/src/com/froop/app/kegs/BitmapSize.java +++ b/src/com/froop/app/kegs/BitmapSize.java @@ -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); diff --git a/src/com/froop/app/kegs/KegsMain.java b/src/com/froop/app/kegs/KegsMain.java index a3d6544..8664a99 100644 --- a/src/com/froop/app/kegs/KegsMain.java +++ b/src/com/froop/app/kegs/KegsMain.java @@ -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);