diff --git a/jni/emulate.c b/jni/emulate.c index 3cc9b7d..d88cd93 100644 --- a/jni/emulate.c +++ b/jni/emulate.c @@ -2483,7 +2483,7 @@ emulate() { schedule(); } - } while (!enter_debugger); + } while (!enter_debugger); // exit_state return 0; } diff --git a/res/Thumbs.db b/res/Thumbs.db deleted file mode 100644 index 6889eb6..0000000 Binary files a/res/Thumbs.db and /dev/null differ diff --git a/res/values/colors.xml b/res/values/colors.xml deleted file mode 100644 index 74d103a..0000000 --- a/res/values/colors.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - #FF000000 - #FFE35900 - #ff808080 - #bbffffff - \ No newline at end of file diff --git a/res/values/dimens.xml b/res/values/dimens.xml deleted file mode 100644 index 88eefdd..0000000 --- a/res/values/dimens.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - 61dip - 16sp - 6sp - \ No newline at end of file diff --git a/res/values/strings.xml b/res/values/strings.xml index 7ddb7f7..b13742d 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -42,4 +42,6 @@ Haptic feedback Large LCD screen Portrait mode only +Minimal controls +Also, easy shortcut: touch the LCD diff --git a/res/xml/state0.xml b/res/xml/state0.xml deleted file mode 100644 index f9cb943..0000000 --- a/res/xml/state0.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/res/xml/state1.xml b/res/xml/state1.xml deleted file mode 100644 index 6e9e34d..0000000 --- a/res/xml/state1.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/org/ab/x48/HPView.java b/src/org/ab/x48/HPView.java index 1a3dcad..8133e5b 100644 --- a/src/org/ab/x48/HPView.java +++ b/src/org/ab/x48/HPView.java @@ -6,6 +6,7 @@ import java.util.Vector; import android.content.Context; import android.content.SharedPreferences; +import android.content.SharedPreferences.Editor; import android.content.res.Configuration; import android.graphics.Bitmap; import android.graphics.BitmapFactory; @@ -106,7 +107,7 @@ public class HPView extends SurfaceView implements SurfaceHolder.Callback, Runna //private short data []; private Bitmap keys [] = new Bitmap[MAX_TOUCHES]; - private Bitmap backBuffer; + protected Bitmap backBuffer; private boolean fullWidth; public boolean isFullWidth() { @@ -126,11 +127,7 @@ public class HPView extends SurfaceView implements SurfaceHolder.Callback, Runna if (c != null) { - if (land) { - keybLite = false; - } - if (backBuffer == null) { Log.i("x48", "init backBuffer !: " + keybLite); @@ -174,7 +171,7 @@ public class HPView extends SurfaceView implements SurfaceHolder.Callback, Runna {(int)(lcd_pos_x+67*lcd_ratio), 0}, {(int)(lcd_pos_x+91*lcd_ratio), 0}, {(int)(lcd_pos_x+112*lcd_ratio), 0} }; int green = Color.rgb(80, 96, 104); p.setColor(green); - if (!keybLite) + if (!keybLite || land) backCanvas.drawRect(0, 0, usable_w, start_h+menu_key_height, p); matrixScreen = new Matrix(); @@ -191,7 +188,7 @@ public class HPView extends SurfaceView implements SurfaceHolder.Callback, Runna float key_width = 0f; float key_y = 0f; float key_height = 0f; - if (!keybLite) { + if (!keybLite || land) { if (k < 6) { // A, B, C... key_width = usable_w / 6; @@ -382,7 +379,7 @@ public class HPView extends SurfaceView implements SurfaceHolder.Callback, Runna yrank = 4; } key_x = key_width*(4-xrank); - key_y = start_h + regular_key_height_right*(yrank); + key_y = start_h + key_height*(yrank); } else key_width = 0; } @@ -412,7 +409,7 @@ public class HPView extends SurfaceView implements SurfaceHolder.Callback, Runna //ratio_ky = key_height / (float) bh; delta_y = ((int)key_height-bh)/2; } - if (!keybLite && !land && (k == 30 || k == 31 || k == 32 || + if (!keybLite && !land && !fullWidth && (k == 30 || k == 31 || k == 32 || k == 35 || k == 36 || k == 37 || k == 40 || k == 41 || k == 42 || k == 39)) { Paint p2 = new Paint(); @@ -482,9 +479,7 @@ public class HPView extends SurfaceView implements SurfaceHolder.Callback, Runna } if (code == -1 && action == MotionEvent.ACTION_DOWN && currentOrientation != Configuration.ORIENTATION_LANDSCAPE ) { //x48.flipkeyboard(); - keybLite = !keybLite; - backBuffer = null; - refreshMainScreen(null); + ((X48) getContext()).changeKeybLite(); return true; } @@ -499,6 +494,14 @@ public class HPView extends SurfaceView implements SurfaceHolder.Callback, Runna private boolean keybLite = false; + public boolean isKeybLite() { + return keybLite; + } + + public void setKeybLite(boolean keybLite) { + this.keybLite = keybLite; + } + public synchronized void key(int code, boolean down) { //Log.i("x48", "code: " + code + " / " + down); if (code < MAX_TOUCHES) { diff --git a/src/org/ab/x48/Settings.java b/src/org/ab/x48/Settings.java index 64dfc27..fb5c329 100644 --- a/src/org/ab/x48/Settings.java +++ b/src/org/ab/x48/Settings.java @@ -43,6 +43,13 @@ public class Settings extends PreferenceActivity { largeLCDPref.setDefaultValue(false); inlinePrefCat.addPreference(largeLCDPref); + CheckBoxPreference keybLitePref = new CheckBoxPreference(this); + keybLitePref.setKey("keybLite"); + keybLitePref.setTitle(R.string.show_lite_keyb); + keybLitePref.setSummary(R.string.show_lite_keyb_summary); + keybLitePref.setDefaultValue(false); + inlinePrefCat.addPreference(keybLitePref); + ListPreference listPref = new ListPreference(this); listPref.setEntries(R.array.contrast_entries); listPref.setEntryValues(R.array.contrast_values); diff --git a/src/org/ab/x48/X48.java b/src/org/ab/x48/X48.java index f6e358e..695c104 100644 --- a/src/org/ab/x48/X48.java +++ b/src/org/ab/x48/X48.java @@ -11,6 +11,7 @@ import android.app.Dialog; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; +import android.content.SharedPreferences.Editor; import android.content.res.Configuration; import android.inputmethodservice.Keyboard; import android.inputmethodservice.KeyboardView; @@ -25,12 +26,7 @@ import android.view.Window; public class X48 extends Activity { - private KeyboardView theKeyboard = null; - private Keyboard currentKeyboardLayout = null; - private Keyboard theKeyboardLayout0 = null; - private Keyboard theKeyboardLayout1 = null; - - private HPView mainView; + private HPView mainView; static final private int LOAD_ID = Menu.FIRST +1; static final private int SAVE_ID = Menu.FIRST +2; static final private int SETTINGS_ID = Menu.FIRST +5 ; @@ -39,69 +35,6 @@ public class X48 extends Activity { static final private int ROM_ID = 123; - public class theKeyboardActionListener implements OnKeyboardActionListener{ - - @Override - public void onKey(int primaryCode, int[] keyCodes) { - - } - - @Override - public void onPress(int primaryCode) { - if (mainView != null) - mainView.key(primaryCode, true); - } - - @Override - public void onRelease(int primaryCode) { - - - if (mainView != null) - mainView.key(primaryCode, false); - - if (primaryCode == 39) { - if (currentKeyboardLayout.equals(theKeyboardLayout0)) { - currentKeyboardLayout = theKeyboardLayout1; - theKeyboard.setKeyboard(currentKeyboardLayout); - } else { - if (currentKeyboardLayout.equals(theKeyboardLayout1)) { - currentKeyboardLayout = theKeyboardLayout0; - theKeyboard.setKeyboard(currentKeyboardLayout); - } - } - } - - - } - - @Override - public void onText(CharSequence text) { - // TODO Auto-generated method stub - - } - - @Override - public void swipeDown() { - - } - - @Override - public void swipeLeft() { - - } - - @Override - public void swipeRight() { - // TODO Auto-generated method stub - - } - - @Override - public void swipeUp() { - // TODO Auto-generated method stub - - }}; - // http://www.hpcalc.org/hp48/pc/emulators/gxrom-r.zip @Override @@ -142,25 +75,32 @@ public class X48 extends Activity { setContentView(R.layout.main); mainView = (HPView) findViewById(R.id.hpview); - theKeyboard = (KeyboardView) findViewById(R.id.EditKeyboard01); - currentKeyboardLayout = theKeyboardLayout0 = new Keyboard(this, R.xml.state0); - theKeyboardLayout1 = new Keyboard(this, R.xml.state1); - theKeyboard.setKeyboard(currentKeyboardLayout); - theKeyboard.setOnKeyboardActionListener(new theKeyboardActionListener()); - theKeyboard.setVisibility(View.INVISIBLE); - theKeyboard.setPreviewEnabled(false); - - SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(this); - saveonExit = mPrefs.getBoolean("saveOnExit", false); - haptic = mPrefs.getBoolean("haptic", true); - largeWidth = mPrefs.getBoolean("large_width", false); - if (mainView != null) { - mainView.setHapticFeedbackEnabled(haptic); - mainView.setFullWidth(largeWidth); - } + checkPrefs(); currentOrientation = getResources().getConfiguration().orientation; } + public void checkPrefs() { + SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(this); + saveonExit = mPrefs.getBoolean("saveOnExit", false); + if (mainView != null) { + mainView.setHapticFeedbackEnabled(mPrefs.getBoolean("haptic", true)); + mainView.setFullWidth(mPrefs.getBoolean("large_width", false)); + mainView.setKeybLite(mPrefs.getBoolean("keybLite", false)); + } + } + + public void changeKeybLite() { + if (mainView != null) { + mainView.setKeybLite(!mainView.isKeybLite()); + SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(this); + Editor e = mPrefs.edit(); + e.putBoolean("keybLite", mainView.isKeybLite()); + e.commit(); + mainView.backBuffer = null; + refreshMainScreen(null); + } + } + public void refreshMainScreen(short data []) { mainView.refreshMainScreen(data); } @@ -216,7 +156,7 @@ public class X48 extends Activity { // given them shortcuts. //menu.add(0, RESET_ID, 0, R.string.reset); - menu.add(0, SAVE_ID, 0, R.string.save_state); + menu.add(0, SAVE_ID, 0, R.string.save_state); menu.add(0, LOAD_ID, 0, R.string.load_prog); menu.add(0, SETTINGS_ID, 0, R.string.settings); menu.add(0, RESET_ID, 0, R.string.reset_memory); @@ -242,6 +182,7 @@ public class X48 extends Activity { case SAVE_ID: saveState(); return true; + case LOAD_ID: //loadProg("/data/data/org.ab.x48/SKUNK"); Intent loadFileIntent = new Intent(); @@ -374,13 +315,7 @@ public class X48 extends Activity { managePort(1, port1); String port2 = mPrefs.getString("port2", "0"); managePort(2, port2); - saveonExit = mPrefs.getBoolean("saveOnExit", false); - haptic = mPrefs.getBoolean("haptic", true); - largeWidth = mPrefs.getBoolean("large_width", false); - if (mainView != null) { - mainView.setHapticFeedbackEnabled(haptic); - mainView.setFullWidth(largeWidth); - } + checkPrefs(); } } @@ -388,9 +323,7 @@ public class X48 extends Activity { } private boolean saveonExit; - private boolean haptic; - private boolean largeWidth; - + private void managePort(int number, String value) { int size = Integer.parseInt(value); File f = AssetUtil.getSDDir(); @@ -475,22 +408,7 @@ public class X48 extends Activity { @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); - /*Log.i("x48", "corientation: " + currentOrientation); - if (currentOrientation != newConfig.orientation) { - Log.i("x48", "orientation: " + newConfig.orientation); - if (mainView != null) - mainView.pause(true); - currentOrientation = newConfig.orientation; - }*/ currentOrientation = newConfig.orientation; - if (currentOrientation == Configuration.ORIENTATION_LANDSCAPE && theKeyboard.getVisibility()==View.VISIBLE) - theKeyboard.setVisibility(View.INVISIBLE); } - public void flipkeyboard() { - if (theKeyboard.getVisibility()==View.VISIBLE) - theKeyboard.setVisibility(View.INVISIBLE); - else - theKeyboard.setVisibility(View.VISIBLE); - } } \ No newline at end of file