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

@@ -485,7 +485,7 @@ if [ -n "$var" ] ; then
fi
fi
FirstStartMenuOptionsDefault='(ReadmeText.length() > 2 ? new Settings.ShowReadme() : new Settings.DummyMenu()), (AppUsesMouse \&\& \! ForceRelativeMouseMode ? new Settings.DisplaySizeConfig(true) : new Settings.DummyMenu()), new Settings.OptionalDownloadConfig(true), new Settings.GyroscopeCalibration()'
FirstStartMenuOptionsDefault='new Settings.ShowReadme(), (AppUsesMouse \&\& \! ForceRelativeMouseMode ? new Settings.DisplaySizeConfig(true) : new Settings.DummyMenu()), new Settings.OptionalDownloadConfig(true), new Settings.GyroscopeCalibration()'
if [ -z "$AUTO" ]; then
echo
echo "Menu items to show at startup - this is Java code snippet, leave empty for default"
@@ -630,9 +630,10 @@ fi
if [ -z "$AUTO" ]; then
echo
echo "Here you may type readme text, which will be shown during startup. Format is:"
echo "Text in English, use \\n for newline"
echo "Text in English, use \\n to separate lines"
echo "de:Text in Deutsch"
echo "ru:Text in Russian, and so on"
echo
echo "Current text:"
echo
echo "`echo $ReadmeText | tr '^' '\\n'`"

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);

View File

@@ -555,6 +555,14 @@ int main(int argc, char* argv[])
__android_log_print(ANDROID_LOG_INFO, "Ballfield", "sizeof(int) %d long %d long long %d size_t %d", sizeof(int), sizeof(long), sizeof(long long), sizeof(size_t));
__android_log_print(ANDROID_LOG_VERBOSE, "Ballfield", "On-screen buttons:");
for(i = 0; i < SDL_ANDROID_SCREENKEYBOARD_BUTTON_NUM; i++)
{
SDL_Rect r;
SDL_ANDROID_GetScreenKeyboardButtonPos(i, &r);
__android_log_print(ANDROID_LOG_VERBOSE, "Ballfield", "{ %d, %d, %d, %d },", r.x, r.y, r.x+r.h, r.y+r.w);
}
while(1)
{
SDL_Rect r;