mirror of
https://github.com/shagr4th/droid48
synced 2025-01-14 08:01:41 +01:00
Small adjustments on labels positions
This commit is contained in:
parent
067b23ced8
commit
45d2375873
1 changed files with 151 additions and 102 deletions
|
@ -51,7 +51,7 @@ public class HPView extends SurfaceView implements SurfaceHolder.Callback, Runna
|
|||
protected boolean needFlip;
|
||||
private short buf [];
|
||||
private short audiobuf [];
|
||||
private int currentOrientation;
|
||||
int currentOrientation;
|
||||
private boolean multiTouch;
|
||||
private AudioTrack track;
|
||||
private TimerTask audioTask;
|
||||
|
@ -86,6 +86,11 @@ public class HPView extends SurfaceView implements SurfaceHolder.Callback, Runna
|
|||
int topLeftColor;
|
||||
int topRightColor;
|
||||
|
||||
Paint systemOptionsPaint;
|
||||
int systemOptions_x;
|
||||
int systemOptions_y;
|
||||
boolean systemOptionDisplayed = true;
|
||||
|
||||
Paint buttonBorderPaint = new Paint();
|
||||
|
||||
String topLefts [] = new String [MAX_TOUCHES];
|
||||
|
@ -254,58 +259,94 @@ public class HPView extends SurfaceView implements SurfaceHolder.Callback, Runna
|
|||
|
||||
}
|
||||
|
||||
if (drawHeadersAndFooters && topLeft != null) {
|
||||
int tlWidth = 0;
|
||||
int tlHeight = 0;
|
||||
int trWidth = 0;
|
||||
int trHeight = 0;
|
||||
|
||||
Paint HeadPurplePaint = regularHeadPurplePaint;
|
||||
if (drawHeadersAndFooters && topLeft != null) {
|
||||
|
||||
//Paint HeadPurplePaint = regularHeadPurplePaint;
|
||||
if (topLeft.startsWith("$")) {
|
||||
topLeft = topLeft.substring(1);
|
||||
HeadPurplePaint = asanaHeadPurplePaint;
|
||||
}
|
||||
|
||||
boolean centered = false;
|
||||
//boolean centered = false;
|
||||
//if (topLeft.startsWith("/")) {
|
||||
// topLeft = topLeft.substring(1);
|
||||
// centered = true;
|
||||
//}
|
||||
if (topLeft.startsWith("/")) {
|
||||
topLeft = topLeft.substring(1);
|
||||
centered = true;
|
||||
}
|
||||
|
||||
Rect bounds = new Rect();
|
||||
HeadPurplePaint.getTextBounds(topLeft, 0, topLeft.length(), bounds);
|
||||
int width = bounds.width();
|
||||
//int width = bounds.width();
|
||||
tlWidth = bounds.width();
|
||||
HeadPurplePaint.getTextBounds("A", 0, 1, bounds);
|
||||
int height = bounds.height();
|
||||
//int height = bounds.height();
|
||||
tlHeight = bounds.height();
|
||||
|
||||
int cX = centered?(x0 + ((x1 - x0 - width)/2)):x0;
|
||||
//int cX = centered?(x0 + ((x1 - x0 - width)/2)):x0;
|
||||
|
||||
backCanvas.drawText(topLeft, cX, height + y0, HeadPurplePaint);
|
||||
//backCanvas.drawText(topLeft, cX, height + y0, HeadPurplePaint);
|
||||
|
||||
}
|
||||
|
||||
Paint HeadGreenPaint = regularHeadGreenPaint;
|
||||
if (drawHeadersAndFooters && topRight != null) {
|
||||
|
||||
Paint HeadGreenPaint = regularHeadGreenPaint;
|
||||
//Paint HeadGreenPaint = regularHeadGreenPaint;
|
||||
if (topRight.startsWith("$")) {
|
||||
topRight = topRight.substring(1);
|
||||
HeadGreenPaint = asanaHeadGreenPaint;
|
||||
}
|
||||
|
||||
boolean centered = false;
|
||||
//boolean centered = false;
|
||||
//if (topRight.startsWith("/")) {
|
||||
// topRight = topRight.substring(1);
|
||||
// centered = true;
|
||||
//}
|
||||
if (topRight.startsWith("/")) {
|
||||
topRight = topRight.substring(1);
|
||||
centered = true;
|
||||
}
|
||||
|
||||
Rect bounds = new Rect();
|
||||
HeadGreenPaint.getTextBounds(topRight, 0, topRight.length(), bounds);
|
||||
int width = bounds.width();
|
||||
//int width = bounds.width();
|
||||
trWidth = bounds.width();
|
||||
HeadGreenPaint.getTextBounds("A", 0, 1, bounds);
|
||||
int height = bounds.height();
|
||||
//int height = bounds.height();
|
||||
trHeight = bounds.height();
|
||||
|
||||
int cX = centered?(x0 + ((x1 - x0 - width)/2)):(x1 - width);
|
||||
//int cX = centered?(x0 + ((x1 - x0 - width)/2)):(x1 - width);
|
||||
|
||||
backCanvas.drawText(topRight, cX, height + y0, HeadGreenPaint);
|
||||
//backCanvas.drawText(topRight, cX, height + y0, HeadGreenPaint);
|
||||
|
||||
}
|
||||
|
||||
|
||||
int pad = 0;
|
||||
if ((tlWidth > 0) && (trWidth > 0)) {
|
||||
// There is text in top-left and top-right so we calculate a
|
||||
// suitable width for padding to separate them.
|
||||
pad = (x1 - x0 - (tlWidth + trWidth)) / 3;
|
||||
}
|
||||
|
||||
int totalWidth = tlWidth + trWidth + pad;
|
||||
|
||||
int cX = x0 + ((x1 - x0 - totalWidth)/2);
|
||||
if (tlWidth > 0) {
|
||||
backCanvas.drawText(topLeft, cX , tlHeight + y0, HeadPurplePaint);
|
||||
}
|
||||
if (trWidth > 0) {
|
||||
backCanvas.drawText(topRight, cX + tlWidth + pad, trHeight + y0, HeadGreenPaint);
|
||||
}
|
||||
|
||||
|
||||
if (drawHeadersAndFooters && bottomRight != null) {
|
||||
|
||||
Rect bounds = new Rect();
|
||||
|
@ -327,7 +368,6 @@ public class HPView extends SurfaceView implements SurfaceHolder.Callback, Runna
|
|||
if (c != null) {
|
||||
|
||||
if (backBuffer == null) {
|
||||
|
||||
if (x48.isBitmapSkin()) {
|
||||
BitmapFactory.Options opts = new BitmapFactory.Options();
|
||||
opts.inScaled = false;
|
||||
|
@ -482,6 +522,12 @@ public class HPView extends SurfaceView implements SurfaceHolder.Callback, Runna
|
|||
asanaFootWhitePaint.setTextSize(asanabuttonTextHeaderSizeDpi);
|
||||
asanaFootWhitePaint.setColor(Color.WHITE);
|
||||
|
||||
systemOptionsPaint = new Paint();
|
||||
systemOptionsPaint.setTypeface(regularBold);
|
||||
systemOptionsPaint.setAntiAlias(antialias);
|
||||
systemOptionsPaint.setTextSize(regularbuttonTextHeaderSizeDpi);
|
||||
systemOptionsPaint.setColor(Color.BLACK);
|
||||
|
||||
regularHeadGreenPaint = new Paint();
|
||||
regularHeadGreenPaint.setTypeface(regularBold);
|
||||
regularHeadGreenPaint.setAntiAlias(antialias);
|
||||
|
@ -550,6 +596,9 @@ public class HPView extends SurfaceView implements SurfaceHolder.Callback, Runna
|
|||
menu_key_height = regular_key_height*11/18;
|
||||
}
|
||||
|
||||
systemOptions_x = lcd_pos_x;
|
||||
systemOptions_y = (int) (4*lcd_ratio);
|
||||
|
||||
icons_coords = new int [][] { { lcd_pos_x, 0 }, {(int)(lcd_pos_x+21*lcd_ratio), 0}, {(int)(lcd_pos_x+45*lcd_ratio), 0},
|
||||
{(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);
|
||||
|
@ -867,6 +916,12 @@ public class HPView extends SurfaceView implements SurfaceHolder.Callback, Runna
|
|||
c.drawBitmap(annImages[i], icons_coords[i][0], icons_coords[i][1], null);
|
||||
}
|
||||
|
||||
|
||||
if (systemOptionDisplayed) {
|
||||
c.drawText(getContext().getString(R.string.show_menu), systemOptions_x, systemOptions_y, systemOptionsPaint);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
//Log.i("x48", "null canvas !");
|
||||
}
|
||||
|
@ -890,7 +945,7 @@ public class HPView extends SurfaceView implements SurfaceHolder.Callback, Runna
|
|||
int actionCode = action & MotionEvent.ACTION_MASK;
|
||||
int code = -1;
|
||||
int pointerID = 0;
|
||||
|
||||
systemOptionDisplayed = false;
|
||||
if (multiTouch) {
|
||||
if( actionCode == MotionEvent.ACTION_DOWN || actionCode == MotionEvent.ACTION_UP ||
|
||||
actionCode == MotionEvent.ACTION_POINTER_DOWN || actionCode == MotionEvent.ACTION_POINTER_UP ) {
|
||||
|
@ -919,14 +974,8 @@ public class HPView extends SurfaceView implements SurfaceHolder.Callback, Runna
|
|||
}
|
||||
}
|
||||
if (code == -1 && actionCode == MotionEvent.ACTION_DOWN ) {
|
||||
/*if (x >= menu_button[0] && x <= menu_button[2] && y >= menu_button[1] && y <= menu_button[3]) {
|
||||
// call menu
|
||||
} else if (x >= hidemenu_button[0] && x <= hidemenu_button[2] && y >= hidemenu_button[1] && y <= hidemenu_button[3]) {
|
||||
// hide menu
|
||||
} else*/ if (currentOrientation != Configuration.ORIENTATION_LANDSCAPE ) {
|
||||
((X48) getContext()).changeKeybLite();
|
||||
((X48) getContext()).openOptionsMenu();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (code > -1) {
|
||||
|
@ -949,7 +998,7 @@ public class HPView extends SurfaceView implements SurfaceHolder.Callback, Runna
|
|||
}
|
||||
}
|
||||
if (code == -1 && action == MotionEvent.ACTION_DOWN && currentOrientation != Configuration.ORIENTATION_LANDSCAPE ) {
|
||||
((X48) getContext()).changeKeybLite();
|
||||
((X48) getContext()).openOptionsMenu();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue