From e9736ddab45ea5f74a1db68c2db4d620e1bc5488 Mon Sep 17 00:00:00 2001 From: shagrath Date: Sat, 18 Sep 2010 15:04:53 +0200 Subject: [PATCH] Added option for a full width LCD screen --- AndroidManifest.xml | 2 +- res/values/strings.xml | 4 +++- src/org/ab/x48/HPView.java | 21 ++++++++++++++++++++- src/org/ab/x48/Settings.java | 7 +++++++ src/org/ab/x48/X48.java | 13 ++++++++++--- 5 files changed, 41 insertions(+), 6 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index cd60c60..10ec303 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,6 +1,6 @@ + package="org.ab.x48" android:installLocation="auto" android:versionCode="21" android:versionName="1.21"> You can also tap the LCD screen, more convenient ! Save memory and stack on exit -Enable Haptic Feedback +Haptic feedback +Large LCD screen +Portrait mode only diff --git a/src/org/ab/x48/HPView.java b/src/org/ab/x48/HPView.java index 3ff93f3..1a3dcad 100644 --- a/src/org/ab/x48/HPView.java +++ b/src/org/ab/x48/HPView.java @@ -48,6 +48,7 @@ public class HPView extends SurfaceView implements SurfaceHolder.Callback, Runna Matrix matrixScreen; Matrix matrixBack; Paint paint; + Paint screenPaint = null; public HPView(Context context, AttributeSet attrs) { super(context, attrs); @@ -81,6 +82,9 @@ public class HPView extends SurfaceView implements SurfaceHolder.Callback, Runna paint.setStyle(Style.FILL); paint.setARGB(128, 250, 250, 250); + screenPaint = null; + screenPaint = new Paint(); + } @@ -103,7 +107,16 @@ public class HPView extends SurfaceView implements SurfaceHolder.Callback, Runna //private short data []; private Bitmap keys [] = new Bitmap[MAX_TOUCHES]; private Bitmap backBuffer; + private boolean fullWidth; + public boolean isFullWidth() { + return fullWidth; + } + + public void setFullWidth(boolean fullWidth) { + this.fullWidth = fullWidth; + } + public void refreshMainScreen(short data []) { Canvas c = null; try { @@ -119,6 +132,7 @@ public class HPView extends SurfaceView implements SurfaceHolder.Callback, Runna if (backBuffer == null) { + Log.i("x48", "init backBuffer !: " + keybLite); backBuffer = Bitmap.createBitmap(c.getWidth(), c.getHeight(), Bitmap.Config.ARGB_8888); Canvas backCanvas = new Canvas(backBuffer); @@ -130,6 +144,11 @@ public class HPView extends SurfaceView implements SurfaceHolder.Callback, Runna p.setColor(srcColor); backCanvas.drawRect(0, 0, w, h, p); float lcd_ratio = (land?h:w) / 131; + screenPaint.setFilterBitmap(false); + if (!land && fullWidth) { + screenPaint.setFilterBitmap(true); + lcd_ratio = (land?h:(float)w) / 131; + } int start_w = (int) (131*lcd_ratio); int start_h = (int) (71*lcd_ratio); float usable_w = w; @@ -416,7 +435,7 @@ public class HPView extends SurfaceView implements SurfaceHolder.Callback, Runna c.drawBitmap(backBuffer, 0, 0, null); if (data != null) mainScreen.copyPixelsFromBuffer(ShortBuffer.wrap(data)); - c.drawBitmap(mainScreen, matrixScreen, null); + c.drawBitmap(mainScreen, matrixScreen, screenPaint); for(int i=0;i