Put on-screen keys to their places in the screen keyboard layout dialog

This commit is contained in:
Sergii Pylypenko
2013-04-25 17:24:57 +03:00
parent 7d66c0353c
commit df8da1adee
5 changed files with 35 additions and 20 deletions

View File

@@ -105,7 +105,7 @@ class Globals
public static int RemapHwKeycode[] = new int[SDL_Keys.JAVA_KEYCODE_LAST];
public static int RemapScreenKbKeycode[] = new int[6];
public static boolean ScreenKbControlsShown[] = new boolean[8]; /* Also joystick and text input button added */
public static int ScreenKbControlsLayout[][] = new int[8][4];
public static int ScreenKbControlsLayout[][] = new int[][] { { 712, 392, 800, 480 }, { 624, 392, 712, 480 }, { 712, 304, 800, 392 }, { 624, 304, 712, 392 }, { 712, 216, 800, 304 }, { 624, 216, 712, 304 }, { 0, 0, 48, 48 }, { 0, 303, 177, 480 } }; // Values for 800x480 resolution
public static int RemapMultitouchGestureKeycode[] = new int[4];
public static boolean MultitouchGesturesUsed[] = new boolean[4];
public static int MultitouchGestureSensitivity = 1;

View File

@@ -218,6 +218,22 @@ class Settings
}
for( int i = 0; i < Globals.MultitouchGesturesUsed.length; i++ )
Globals.MultitouchGesturesUsed[i] = true;
// Adjust coordinates of on-screen buttons from 800x480
int displayX = 800;
int displayY = 480;
try {
DisplayMetrics dm = new DisplayMetrics();
p.getWindowManager().getDefaultDisplay().getMetrics(dm);
displayX = dm.widthPixels;
displayY = dm.heightPixels;
} catch (Exception eeeee) {}
for( int i = 0; i < Globals.ScreenKbControlsLayout.length; i++ )
{
Globals.ScreenKbControlsLayout[i][0] *= (float)displayX / 800.0f;
Globals.ScreenKbControlsLayout[i][2] *= (float)displayX / 800.0f;
Globals.ScreenKbControlsLayout[i][1] *= (float)displayY / 480.0f;
Globals.ScreenKbControlsLayout[i][3] *= (float)displayY / 480.0f;
}
System.out.println("android.os.Build.MODEL: " + android.os.Build.MODEL);
if( (android.os.Build.MODEL.equals("GT-N7000") || android.os.Build.MODEL.equals("SGH-I717"))
@@ -2078,22 +2094,6 @@ class Settings
layout.addView(imgs[i]);
Matrix m = new Matrix();
RectF src = new RectF(0, 0, bmps[i].getWidth(), bmps[i].getHeight());
if( Globals.ScreenKbControlsLayout[i][0] == Globals.ScreenKbControlsLayout[i][2] ||
Globals.ScreenKbControlsLayout[i][1] == Globals.ScreenKbControlsLayout[i][3] )
{
int displayX = 800;
int displayY = 480;
try {
DisplayMetrics dm = new DisplayMetrics();
p.getWindowManager().getDefaultDisplay().getMetrics(dm);
displayX = dm.widthPixels;
displayY = dm.heightPixels;
} catch (Exception eeeee) {}
Globals.ScreenKbControlsLayout[i][0] = displayX / 2 - displayX / 10;
Globals.ScreenKbControlsLayout[i][2] = displayX / 2 + displayX / 10;
Globals.ScreenKbControlsLayout[i][1] = displayY / 2 - displayY / 8;
Globals.ScreenKbControlsLayout[i][3] = displayY / 2 + displayY / 8;
}
RectF dst = new RectF(Globals.ScreenKbControlsLayout[i][0], Globals.ScreenKbControlsLayout[i][1],
Globals.ScreenKbControlsLayout[i][2], Globals.ScreenKbControlsLayout[i][3]);
m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL);
@@ -2300,6 +2300,12 @@ class Settings
if( r.startsWith(lang) )
readme = r.substring(lang.length());
}
readme = readme.trim();
if( readme.length() <= 2 )
{
goBack(p);
return;
}
TextView text = new TextView(p);
text.setMaxLines(1000);
text.setText(readme);