From cd89365cac38585da1ec8cd0c1dc9fa8160f6c97 Mon Sep 17 00:00:00 2001 From: Sergii Pylypenko Date: Wed, 24 Apr 2013 20:53:17 +0300 Subject: [PATCH 1/4] Redesigned on-screen key layout config dialog, readme text option now supported by default, updated translations --- changeAppSettings.sh | 9 +- project/java/Settings.java | 174 ++++++++++-------- .../java/translations/values-fr/strings.xml | 5 +- .../java/translations/values-ru/strings.xml | 4 +- .../java/translations/values-uk/strings.xml | 30 ++- project/java/translations/values/strings.xml | 5 +- project/jni/application/openarena/engine | 2 +- 7 files changed, 118 insertions(+), 111 deletions(-) diff --git a/changeAppSettings.sh b/changeAppSettings.sh index 5804ea834..98b6ad3e8 100755 --- a/changeAppSettings.sh +++ b/changeAppSettings.sh @@ -485,7 +485,7 @@ if [ -n "$var" ] ; then fi fi -FirstStartMenuOptionsDefault='(AppUsesMouse \&\& \! ForceRelativeMouseMode ? new Settings.DisplaySizeConfig(true) : new Settings.DummyMenu()), new Settings.OptionalDownloadConfig(true), new Settings.GyroscopeCalibration()' +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()' if [ -z "$AUTO" ]; then echo echo "Menu items to show at startup - this is Java code snippet, leave empty for default" @@ -627,9 +627,12 @@ if [ -n "$var" ] ; then fi fi -if [ -z "$ReadmeText" -o -z "$AUTO" ]; then +if [ -z "$AUTO" ]; then echo -echo "Here you may type some short readme text - it is currently not used anywhere" +echo "Here you may type readme text, which will be shown during startup. Format is:" +echo "Text in English, use \\n for newline" +echo "de:Text in Deutsch" +echo "ru:Text in Russian, and so on" echo "Current text:" echo echo "`echo $ReadmeText | tr '^' '\\n'`" diff --git a/project/java/Settings.java b/project/java/Settings.java index 0ccc6e1d0..1553b65fe 100644 --- a/project/java/Settings.java +++ b/project/java/Settings.java @@ -2033,6 +2033,8 @@ class Settings R.drawable.b5, R.drawable.b6 }; + int oldX = 0, oldY = 0; + boolean resizing = false; public CustomizeScreenKbLayoutTool(MainActivity _p) { @@ -2045,7 +2047,7 @@ class Settings boundaryBmp = BitmapFactory.decodeResource( p.getResources(), R.drawable.rectangle ); boundary.setImageBitmap(boundaryBmp); layout.addView(boundary); - currentButton = 0; + currentButton = -1; if( Globals.TouchscreenKeyboardTheme == 2 ) { int buttons2[] = { @@ -2063,6 +2065,10 @@ class Settings for( int i = 0; i < Globals.ScreenKbControlsLayout.length; i++ ) { + if( ! Globals.ScreenKbControlsShown[currentButton] ) + continue; + if( currentButton == -1 ) + currentButton = i; imgs[i] = new ImageView(p); imgs[i].setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); imgs[i].setScaleType(ImageView.ScaleType.MATRIX); @@ -2072,115 +2078,123 @@ 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 / 6; + Globals.ScreenKbControlsLayout[i][2] = displayX / 2 + displayX / 6; + Globals.ScreenKbControlsLayout[i][1] = displayY / 2 - displayY / 4; + Globals.ScreenKbControlsLayout[i][3] = displayY / 2 + displayY / 4; + } 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); imgs[i].setImageMatrix(m); } boundary.bringToFront(); - - setupButton(true); + if( currentButton == -1 ) + onKeyEvent( KeyEvent.KEYCODE_BACK ); // All buttons disabled - do not show anything + else + setupButton(currentButton); } - void setupButton(boolean undo) + void setupButton(int i) { - do { - currentButton += (undo ? -1 : 1); - if(currentButton >= Globals.ScreenKbControlsLayout.length) - { - p.getVideoLayout().removeView(layout); - layout = null; - p.touchListener = null; - p.keyListener = null; - goBack(p); - return; - } - if(currentButton < 0) - { - currentButton = 0; - undo = false; - } - } while( ! Globals.ScreenKbControlsShown[currentButton] ); - - if( Globals.ScreenKbControlsLayout[currentButton][0] == Globals.ScreenKbControlsLayout[currentButton][2] || - Globals.ScreenKbControlsLayout[currentButton][1] == Globals.ScreenKbControlsLayout[currentButton][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[currentButton][0] = displayX / 2 - displayX / 6; - Globals.ScreenKbControlsLayout[currentButton][2] = displayX / 2 + displayX / 6; - Globals.ScreenKbControlsLayout[currentButton][1] = displayY / 2 - displayY / 4; - Globals.ScreenKbControlsLayout[currentButton][3] = displayY / 2 + displayY / 4; - } Matrix m = new Matrix(); - RectF src = new RectF(0, 0, bmps[currentButton].getWidth(), bmps[currentButton].getHeight()); - RectF dst = new RectF(Globals.ScreenKbControlsLayout[currentButton][0], Globals.ScreenKbControlsLayout[currentButton][1], - Globals.ScreenKbControlsLayout[currentButton][2], Globals.ScreenKbControlsLayout[currentButton][3]); + RectF src = new RectF(0, 0, bmps[i].getWidth(), bmps[i].getHeight()); + 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); - imgs[currentButton].setImageMatrix(m); + imgs[i].setImageMatrix(m); m = new Matrix(); src = new RectF(0, 0, boundaryBmp.getWidth(), boundaryBmp.getHeight()); m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL); boundary.setImageMatrix(m); - String buttonText = (currentButton == 0 ? "DPAD" : ( currentButton == 1 ? "Text input" : "" )); - if ( currentButton >= 2 && currentButton - 2 < Globals.AppTouchscreenKeyboardKeysNames.length ) - buttonText = Globals.AppTouchscreenKeyboardKeysNames[currentButton - 2]; + String buttonText = (i == 0 ? "Joystick" : ( i == 1 ? "Text input" : "" )); + if ( i >= 2 && i - 2 < Globals.AppTouchscreenKeyboardKeysNames.length ) + buttonText = Globals.AppTouchscreenKeyboardKeysNames[i - 2]; p.setText(p.getResources().getString(R.string.screenkb_custom_layout_help) + "\n" + buttonText.replace("_", " ")); } public void onTouchEvent(final MotionEvent ev) { - if(currentButton >= Globals.ScreenKbControlsLayout.length) - { - setupButton(false); - return; - } if( ev.getAction() == MotionEvent.ACTION_DOWN ) { - Globals.ScreenKbControlsLayout[currentButton][0] = (int)ev.getX(); - Globals.ScreenKbControlsLayout[currentButton][1] = (int)ev.getY(); - Globals.ScreenKbControlsLayout[currentButton][2] = (int)ev.getX(); - Globals.ScreenKbControlsLayout[currentButton][3] = (int)ev.getY(); + oldX = (int)ev.getX(); + oldY = (int)ev.getY(); + resizing = true; + for( int i = 0; i < Globals.ScreenKbControlsLayout.length; i++ ) + { + if( ! Globals.ScreenKbControlsShown[currentButton] ) + continue; + if( Globals.ScreenKbControlsLayout[currentButton][0] <= oldX && + Globals.ScreenKbControlsLayout[currentButton][2] >= oldX && + Globals.ScreenKbControlsLayout[currentButton][1] <= oldY && + Globals.ScreenKbControlsLayout[currentButton][2] >= oldY ) + { + currentButton = i; + setupButton(currentButton); + resizing = false; + break; + } + } } if( ev.getAction() == MotionEvent.ACTION_MOVE ) { - if( Globals.ScreenKbControlsLayout[currentButton][0] > (int)ev.getX() ) - Globals.ScreenKbControlsLayout[currentButton][0] = (int)ev.getX(); - if( Globals.ScreenKbControlsLayout[currentButton][1] > (int)ev.getY() ) - Globals.ScreenKbControlsLayout[currentButton][1] = (int)ev.getY(); - if( Globals.ScreenKbControlsLayout[currentButton][2] < (int)ev.getX() ) - Globals.ScreenKbControlsLayout[currentButton][2] = (int)ev.getX(); - if( Globals.ScreenKbControlsLayout[currentButton][3] < (int)ev.getY() ) - Globals.ScreenKbControlsLayout[currentButton][3] = (int)ev.getY(); + int dx = (int)ev.getX() - oldX; + int dy = (int)ev.getY() - oldY; + if( resizing ) + { + // Resize slowly, with 1/3 of movement speed + dx /= 6; + dy /= 6; + Globals.ScreenKbControlsLayout[currentButton][0] -= dx; + Globals.ScreenKbControlsLayout[currentButton][2] += dx; + Globals.ScreenKbControlsLayout[currentButton][1] -= dy; + Globals.ScreenKbControlsLayout[currentButton][3] += dy; + dx *= 6; + dy *= 6; + } + else + { + Globals.ScreenKbControlsLayout[currentButton][0] += dx; + Globals.ScreenKbControlsLayout[currentButton][2] += dx; + Globals.ScreenKbControlsLayout[currentButton][1] += dy; + Globals.ScreenKbControlsLayout[currentButton][3] += dy; + } + oldX += dx; + oldY += dy; + Matrix m = new Matrix(); + RectF src = new RectF(0, 0, bmps[currentButton].getWidth(), bmps[currentButton].getHeight()); + RectF dst = new RectF(Globals.ScreenKbControlsLayout[currentButton][0], Globals.ScreenKbControlsLayout[currentButton][1], + Globals.ScreenKbControlsLayout[currentButton][2], Globals.ScreenKbControlsLayout[currentButton][3]); + m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL); + imgs[currentButton].setImageMatrix(m); + m = new Matrix(); + src = new RectF(0, 0, boundaryBmp.getWidth(), boundaryBmp.getHeight()); + m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL); + boundary.setImageMatrix(m); } - - Matrix m = new Matrix(); - RectF src = new RectF(0, 0, bmps[currentButton].getWidth(), bmps[currentButton].getHeight()); - RectF dst = new RectF(Globals.ScreenKbControlsLayout[currentButton][0], Globals.ScreenKbControlsLayout[currentButton][1], - Globals.ScreenKbControlsLayout[currentButton][2], Globals.ScreenKbControlsLayout[currentButton][3]); - m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL); - imgs[currentButton].setImageMatrix(m); - m = new Matrix(); - src = new RectF(0, 0, boundaryBmp.getWidth(), boundaryBmp.getHeight()); - m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL); - boundary.setImageMatrix(m); - - if( ev.getAction() == MotionEvent.ACTION_UP ) - setupButton(false); } public void onKeyEvent(final int keyCode) { - if( layout != null && imgs[currentButton] != null ) - layout.removeView(imgs[currentButton]); - imgs[currentButton] = null; - setupButton(true); + if( keyCode == KeyEvent.KEYCODE_BACK ) + { + p.getVideoLayout().removeView(layout); + layout = null; + p.touchListener = null; + p.keyListener = null; + goBack(p); + } } } } diff --git a/project/java/translations/values-fr/strings.xml b/project/java/translations/values-fr/strings.xml index 3224cc78a..33f606fc2 100644 --- a/project/java/translations/values-fr/strings.xml +++ b/project/java/translations/values-fr/strings.xml @@ -137,7 +137,6 @@ Geste de rotation à droite avec deux doigts Personnalisation de la présentation du clavier à l\'écran -Faites glisser l\'écran pour ajouter le bouton, appuyez sur Retour/BACK pour annuler le dernier bouton Calibrer l\'écran tactile Touchez les bords de l\'écran, appuyez sur Retour/BACK lorsque vous avez terminé @@ -158,9 +157,6 @@ Afficher plus d\'options -Erreur interne détectée (OS/LibC) -Certaines librairies sont mal installées et cette application va probablement ne pas fonctionner. Merci de mettre à jour votre système, flash, ROM custom, ou bien de copier le fichier /system/lib/libc.so depuis un autre système (Attention, Experts uniquement !). - Hardware mouse detected, disabling mouse emulation Not enough RAM This app needs %1$d Mb RAM, your device has %2$d Mb @@ -175,4 +171,5 @@ You can resume it later, the data will not be downloaded twice. Yes No +Press BACK when done. Resize buttons by sliding on empty space. diff --git a/project/java/translations/values-ru/strings.xml b/project/java/translations/values-ru/strings.xml index c10d240e4..b81408e8b 100644 --- a/project/java/translations/values-ru/strings.xml +++ b/project/java/translations/values-ru/strings.xml @@ -99,7 +99,7 @@ Калибровка сенсорного экрана Дотроньтесь до всех краев экрана, потом нажмите Назад/BACK Настройка расположения кнопок -Проведите по экрану, чтобы добавить кнопку, нажмите клавишу Назад/BACK, чтобы отменить последнюю кнопку +Нажмите клавишу Назад/BACK для завершения. Проведите по пустому месту, чтобы изменить размер кнопки Физическая кнопка Наэкранная лупа Настройки видео @@ -126,8 +126,6 @@ Маленький (телефон) Крохотный Показать больше параметров -Обнаружена бракованная прошивка -Ваше устройство содержит дефективные системные библиотеки, данное приложение скорее всего не будет работать. Пожалуйста, установите обновление, либо установите неофициальную прошивку, либо скопируйте /system/lib/libc.so с другого устройства (только для специалистов!) Размер изображения кнопок Маленький, режим тачпада Крохотный, режим тачпада diff --git a/project/java/translations/values-uk/strings.xml b/project/java/translations/values-uk/strings.xml index 11b168d89..d9573df4a 100644 --- a/project/java/translations/values-uk/strings.xml +++ b/project/java/translations/values-uk/strings.xml @@ -99,7 +99,7 @@ Калібрування сенсорного екрану Доторкнiться до всіх країв екрану, потiм натисніть Назад/BACK Налаштування положення кнопок -Проведiть по екрану, щоб додати кнопку, натисніть Назад/BACK, щоб скасувати останню кнопку +Натисніть Назад/BACK для завершення. Проведiть по екрану, щоб змінити розмір кнопки Фізична кнопка Наекранна лупа Налаштування відео @@ -131,19 +131,17 @@ Крихiтний, режим тачпаду Виявлена зовнiшня миша, емуляція миші вимкнена -Broken OS detected -Your device has broken system libraries, this application will most probably crash. Please install a system update, or flash a custom ROM, or copy file /system/lib/libc.so from another device (experts only!) -Not enough RAM -This app needs %1$d Mb RAM, your device has %2$d Mb -Ignore -Calibrate gyroscope -Put your phone on a flat surface -Reset config to defaults -Cancel -Your device does not have gyroscope -Reset all options to default values? -Cancel data downloading? -You can resume it later, the data will not be downloaded twice. -Yes -No +Недостатньо пам’яті +Потрібно %1$d Mb пам’яті, доступно лише %2$d Mb +Ігнорувати +Калібрувати гіроскоп +Покладіть телефон на рівну поверхню +Скинути всі налаштування +Відмінити +Гіроскоп відсутній +Скинути всі налаштування у значення за замовчуванням? +Припинити завантаження? +Завантаження може бути відновлено пізніше. +Так +Ні diff --git a/project/java/translations/values/strings.xml b/project/java/translations/values/strings.xml index c8bc65289..f232b23d4 100644 --- a/project/java/translations/values/strings.xml +++ b/project/java/translations/values/strings.xml @@ -136,7 +136,7 @@ Rotate right two-finger gesture Customize on-screen keyboard layout - Slide screen to add button, press BACK to undo last button + Press BACK when done. Resize buttons by sliding on empty space. Calibrate touchscreen Touch all edges of the screen, press BACK when done @@ -157,9 +157,6 @@ Show more options - Broken OS detected - Your device has broken system libraries, this application will most probably crash. Please install a system update, or flash a custom ROM, or copy file /system/lib/libc.so from another device (experts only!) - Hardware mouse detected, disabling mouse emulation Not enough RAM diff --git a/project/jni/application/openarena/engine b/project/jni/application/openarena/engine index 386bfea5e..4997b5070 160000 --- a/project/jni/application/openarena/engine +++ b/project/jni/application/openarena/engine @@ -1 +1 @@ -Subproject commit 386bfea5ea71757fbf369bdddd2e24a03c3d1e33 +Subproject commit 4997b50704c7134585a48a03dd595b4155cf3d14 From 7d66c0353cc6bb5e1cd9b8be1408ec4b0ddc7459 Mon Sep 17 00:00:00 2001 From: Sergii Pylypenko Date: Wed, 24 Apr 2013 21:19:00 +0300 Subject: [PATCH 2/4] Fixes to screen keyboard layout dialog. --- project/java/Settings.java | 24 +++++++++---------- .../commandergenius/commandergenius | 2 +- .../openarena/AndroidAppSettings.cfg | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/project/java/Settings.java b/project/java/Settings.java index f893a1787..a48184241 100644 --- a/project/java/Settings.java +++ b/project/java/Settings.java @@ -2065,7 +2065,7 @@ class Settings for( int i = 0; i < Globals.ScreenKbControlsLayout.length; i++ ) { - if( ! Globals.ScreenKbControlsShown[currentButton] ) + if( ! Globals.ScreenKbControlsShown[i] ) continue; if( currentButton == -1 ) currentButton = i; @@ -2089,10 +2089,10 @@ class Settings displayX = dm.widthPixels; displayY = dm.heightPixels; } catch (Exception eeeee) {} - Globals.ScreenKbControlsLayout[i][0] = displayX / 2 - displayX / 6; - Globals.ScreenKbControlsLayout[i][2] = displayX / 2 + displayX / 6; - Globals.ScreenKbControlsLayout[i][1] = displayY / 2 - displayY / 4; - Globals.ScreenKbControlsLayout[i][3] = displayY / 2 + displayY / 4; + 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]); @@ -2133,12 +2133,12 @@ class Settings resizing = true; for( int i = 0; i < Globals.ScreenKbControlsLayout.length; i++ ) { - if( ! Globals.ScreenKbControlsShown[currentButton] ) + if( ! Globals.ScreenKbControlsShown[i] ) continue; - if( Globals.ScreenKbControlsLayout[currentButton][0] <= oldX && - Globals.ScreenKbControlsLayout[currentButton][2] >= oldX && - Globals.ScreenKbControlsLayout[currentButton][1] <= oldY && - Globals.ScreenKbControlsLayout[currentButton][2] >= oldY ) + if( Globals.ScreenKbControlsLayout[i][0] <= oldX && + Globals.ScreenKbControlsLayout[i][2] >= oldX && + Globals.ScreenKbControlsLayout[i][1] <= oldY && + Globals.ScreenKbControlsLayout[i][3] >= oldY ) { currentButton = i; setupButton(currentButton); @@ -2158,8 +2158,8 @@ class Settings dy /= 6; Globals.ScreenKbControlsLayout[currentButton][0] -= dx; Globals.ScreenKbControlsLayout[currentButton][2] += dx; - Globals.ScreenKbControlsLayout[currentButton][1] -= dy; - Globals.ScreenKbControlsLayout[currentButton][3] += dy; + Globals.ScreenKbControlsLayout[currentButton][1] += dy; + Globals.ScreenKbControlsLayout[currentButton][3] -= dy; dx *= 6; dy *= 6; } diff --git a/project/jni/application/commandergenius/commandergenius b/project/jni/application/commandergenius/commandergenius index 108739d28..d1b8a7ae0 160000 --- a/project/jni/application/commandergenius/commandergenius +++ b/project/jni/application/commandergenius/commandergenius @@ -1 +1 @@ -Subproject commit 108739d28474c677da9b6caee7da2075a66e0e00 +Subproject commit d1b8a7ae03b1a0960722abbab38bbb8fca98e7cd diff --git a/project/jni/application/openarena/AndroidAppSettings.cfg b/project/jni/application/openarena/AndroidAppSettings.cfg index cc8fa67d8..b862d4d64 100644 --- a/project/jni/application/openarena/AndroidAppSettings.cfg +++ b/project/jni/application/openarena/AndroidAppSettings.cfg @@ -34,7 +34,7 @@ AppUsesMultitouch=y AppRecordsAudio=y NonBlockingSwapBuffers=n RedefinedKeys="SPACE SPACE NO_REMAP NO_REMAP RETURN ESCAPE LCTRL" -AppTouchscreenKeyboardKeysAmount=5 +AppTouchscreenKeyboardKeysAmount=6 AppTouchscreenKeyboardKeysAmountAutoFire=0 RedefinedKeysScreenKb="SLASH BACKSPACE TAB END LCTRL SPACE UNKNOWN UNKNOWN UNKNOWN UNKNOWN" RedefinedKeysScreenKbNames="Change_weapon Sniper_view Show_scores Center_view Fire Jump" From df8da1adeef5ca9749e77f9ff081f7051f52447b Mon Sep 17 00:00:00 2001 From: Sergii Pylypenko Date: Thu, 25 Apr 2013 17:24:57 +0300 Subject: [PATCH 3/4] Put on-screen keys to their places in the screen keyboard layout dialog --- changeAppSettings.sh | 5 ++- project/java/Globals.java | 2 +- project/java/Settings.java | 38 +++++++++++-------- .../jni/application/ballfield/ballfield.cpp | 8 ++++ project/jni/application/openarena/engine | 2 +- 5 files changed, 35 insertions(+), 20 deletions(-) diff --git a/changeAppSettings.sh b/changeAppSettings.sh index 98b6ad3e8..6ecd3f454 100755 --- a/changeAppSettings.sh +++ b/changeAppSettings.sh @@ -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'`" diff --git a/project/java/Globals.java b/project/java/Globals.java index e53f30913..d9ecccc80 100644 --- a/project/java/Globals.java +++ b/project/java/Globals.java @@ -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; diff --git a/project/java/Settings.java b/project/java/Settings.java index a48184241..31fbf6124 100644 --- a/project/java/Settings.java +++ b/project/java/Settings.java @@ -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); diff --git a/project/jni/application/ballfield/ballfield.cpp b/project/jni/application/ballfield/ballfield.cpp index 1210ff8c5..46bb8b42a 100644 --- a/project/jni/application/ballfield/ballfield.cpp +++ b/project/jni/application/ballfield/ballfield.cpp @@ -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; diff --git a/project/jni/application/openarena/engine b/project/jni/application/openarena/engine index 4997b5070..00e839b40 160000 --- a/project/jni/application/openarena/engine +++ b/project/jni/application/openarena/engine @@ -1 +1 @@ -Subproject commit 4997b50704c7134585a48a03dd595b4155cf3d14 +Subproject commit 00e839b4082aa1682434d70a6e5bd44c39d262c9 From 384574b8804506cb9409cf9a4d1328b49e35f236 Mon Sep 17 00:00:00 2001 From: Sergii Pylypenko Date: Fri, 26 Apr 2013 21:09:50 +0300 Subject: [PATCH 4/4] Fixes for on-screen keyboard layout dialog --- project/java/Globals.java | 2 +- project/java/Settings.java | 43 +++++++++++++++++-- .../ballfield/AndroidAppSettings.cfg | 2 +- project/jni/application/openarena/engine | 2 +- project/jni/application/openarena/vm | 2 +- 5 files changed, 43 insertions(+), 8 deletions(-) diff --git a/project/java/Globals.java b/project/java/Globals.java index d9ecccc80..373621782 100644 --- a/project/java/Globals.java +++ b/project/java/Globals.java @@ -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[][] { { 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 ScreenKbControlsLayout[][] = new int[][] { { 0, 303, 177, 480 }, { 0, 0, 48, 48 }, { 712, 392, 800, 480 }, { 624, 392, 712, 480 }, { 712, 304, 800, 392 }, { 624, 304, 712, 392 }, { 712, 216, 800, 304 }, { 624, 216, 712, 304 } }; // Values for 800x480 resolution public static int RemapMultitouchGestureKeycode[] = new int[4]; public static boolean MultitouchGesturesUsed[] = new boolean[4]; public static int MultitouchGestureSensitivity = 1; diff --git a/project/java/Settings.java b/project/java/Settings.java index 31fbf6124..8e8d0e951 100644 --- a/project/java/Settings.java +++ b/project/java/Settings.java @@ -2066,7 +2066,7 @@ class Settings currentButton = -1; if( Globals.TouchscreenKeyboardTheme == 2 ) { - int buttons2[] = { + buttons = new int[] { R.drawable.sun_dpad, R.drawable.sun_keyboard, R.drawable.sun_b1, @@ -2076,15 +2076,50 @@ class Settings R.drawable.sun_b5, R.drawable.sun_b6 }; - buttons = buttons2; } + 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++ ) { if( ! Globals.ScreenKbControlsShown[i] ) continue; if( currentButton == -1 ) currentButton = i; + + // Check if the button is off screen edge or shrunk to zero + if( Globals.ScreenKbControlsLayout[i][0] > Globals.ScreenKbControlsLayout[i][2] - displayX/15 ) + Globals.ScreenKbControlsLayout[i][0] = Globals.ScreenKbControlsLayout[i][2] - displayX/15; + if( Globals.ScreenKbControlsLayout[i][1] > Globals.ScreenKbControlsLayout[i][3] - displayY/15 ) + Globals.ScreenKbControlsLayout[i][1] = Globals.ScreenKbControlsLayout[i][3] - displayY/15; + if( Globals.ScreenKbControlsLayout[i][0] < 0 ) + { + Globals.ScreenKbControlsLayout[i][2] = -Globals.ScreenKbControlsLayout[i][0]; + Globals.ScreenKbControlsLayout[i][0] = 0; + } + if( Globals.ScreenKbControlsLayout[i][2] > displayX ) + { + Globals.ScreenKbControlsLayout[i][0] = Globals.ScreenKbControlsLayout[i][2] - displayX; + Globals.ScreenKbControlsLayout[i][2] = displayX; + } + if( Globals.ScreenKbControlsLayout[i][1] < 0 ) + { + Globals.ScreenKbControlsLayout[i][3] = -Globals.ScreenKbControlsLayout[i][0]; + Globals.ScreenKbControlsLayout[i][1] = 0; + } + if( Globals.ScreenKbControlsLayout[i][3] > displayY ) + { + Globals.ScreenKbControlsLayout[i][1] = Globals.ScreenKbControlsLayout[i][2] - displayY; + Globals.ScreenKbControlsLayout[i][3] = displayY; + } + imgs[i] = new ImageView(p); imgs[i].setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); imgs[i].setScaleType(ImageView.ScaleType.MATRIX); @@ -2636,14 +2671,14 @@ class Settings Globals.AppTouchscreenKeyboardKeysAmountAutoFire, Globals.TouchscreenKeyboardTransparency ); SetupTouchscreenKeyboardGraphics(p); - for( int i = 0; i < Globals.ScreenKbControlsShown.length; i++ ) - nativeSetScreenKbKeyUsed(i, Globals.ScreenKbControlsShown[i] ? 1 : 0); for( int i = 0; i < Globals.RemapScreenKbKeycode.length; i++ ) nativeSetKeymapKeyScreenKb(i, SDL_Keys.values[Globals.RemapScreenKbKeycode[i]]); for( int i = 0; i < Globals.ScreenKbControlsLayout.length; i++ ) if( Globals.ScreenKbControlsLayout[i][0] < Globals.ScreenKbControlsLayout[i][2] ) nativeSetScreenKbKeyLayout( i, Globals.ScreenKbControlsLayout[i][0], Globals.ScreenKbControlsLayout[i][1], Globals.ScreenKbControlsLayout[i][2], Globals.ScreenKbControlsLayout[i][3]); + for( int i = 0; i < Globals.ScreenKbControlsShown.length; i++ ) + nativeSetScreenKbKeyUsed(i, Globals.ScreenKbControlsShown[i] ? 1 : 0); } else Globals.UseTouchscreenKeyboard = false; diff --git a/project/jni/application/ballfield/AndroidAppSettings.cfg b/project/jni/application/ballfield/AndroidAppSettings.cfg index e6a9d87b8..08466b91f 100644 --- a/project/jni/application/ballfield/AndroidAppSettings.cfg +++ b/project/jni/application/ballfield/AndroidAppSettings.cfg @@ -34,7 +34,7 @@ AppUsesMultitouch=y AppRecordsAudio=n NonBlockingSwapBuffers=n RedefinedKeys="SPACE RETURN NO_REMAP NO_REMAP SPACE ESCAPE" -AppTouchscreenKeyboardKeysAmount=6 +AppTouchscreenKeyboardKeysAmount=1 AppTouchscreenKeyboardKeysAmountAutoFire=0 RedefinedKeysScreenKb="0 1 2 3 4 5 6 7 8 9" RedefinedKeysScreenKbNames="0 1 2 3 4 5 6 7 8 9" diff --git a/project/jni/application/openarena/engine b/project/jni/application/openarena/engine index 00e839b40..1c3f8aa9c 160000 --- a/project/jni/application/openarena/engine +++ b/project/jni/application/openarena/engine @@ -1 +1 @@ -Subproject commit 00e839b4082aa1682434d70a6e5bd44c39d262c9 +Subproject commit 1c3f8aa9c102c1a1c70e18b2bcb0a955decc2033 diff --git a/project/jni/application/openarena/vm b/project/jni/application/openarena/vm index 2fa31601b..c88124ddc 160000 --- a/project/jni/application/openarena/vm +++ b/project/jni/application/openarena/vm @@ -1 +1 @@ -Subproject commit 2fa31601b2ae97b92daac0d43060fdf560c90345 +Subproject commit c88124ddcb2f6b7857ac72497d30a30459d3545e