[Scummvm-git-logs] scummvm branch-2-8 -> e2b1299d85564c29a1642185aeb6b96e56ded206
lephilousophe
noreply at scummvm.org
Sat Apr 13 17:57:30 UTC 2024
This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
b8d11f417b ANDROID: Rename showKeyboardControl to showOnScreenControls
b8874fc265 ANDROID: Make on screen icons depend on screen orientation
61a832e5bb ANDROID: Don't display burger menu when in launcher
e2b1299d85 ANDROID: Hide on-screen buttons while native code is not started
Commit: b8d11f417bf92715e1d39b4032086fc2fc6c780d
https://github.com/scummvm/scummvm/commit/b8d11f417bf92715e1d39b4032086fc2fc6c780d
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2024-04-13T19:43:31+02:00
Commit Message:
ANDROID: Rename showKeyboardControl to showOnScreenControls
This matches what the function really do: hide input method and main
menu icons
Changed paths:
backends/platform/android/jni-android.cpp
backends/platform/android/jni-android.h
backends/platform/android/options.cpp
backends/platform/android/org/scummvm/scummvm/ScummVM.java
backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
diff --git a/backends/platform/android/jni-android.cpp b/backends/platform/android/jni-android.cpp
index 6ea15f70c26..3072dee18ba 100644
--- a/backends/platform/android/jni-android.cpp
+++ b/backends/platform/android/jni-android.cpp
@@ -90,7 +90,7 @@ jmethodID JNI::_MID_setTextInClipboard = 0;
jmethodID JNI::_MID_isConnectionLimited = 0;
jmethodID JNI::_MID_setWindowCaption = 0;
jmethodID JNI::_MID_showVirtualKeyboard = 0;
-jmethodID JNI::_MID_showKeyboardControl = 0;
+jmethodID JNI::_MID_showOnScreenControls = 0;
jmethodID JNI::_MID_getBitmapResource = 0;
jmethodID JNI::_MID_setTouchMode = 0;
jmethodID JNI::_MID_getTouchMode = 0;
@@ -419,13 +419,13 @@ void JNI::showVirtualKeyboard(bool enable) {
}
}
-void JNI::showKeyboardControl(bool enable) {
+void JNI::showOnScreenControls(bool enable) {
JNIEnv *env = JNI::getEnv();
- env->CallVoidMethod(_jobj, _MID_showKeyboardControl, enable);
+ env->CallVoidMethod(_jobj, _MID_showOnScreenControls, enable);
if (env->ExceptionCheck()) {
- LOGE("Error trying to show virtual keyboard control");
+ LOGE("Error trying to show on screen controls");
env->ExceptionDescribe();
env->ExceptionClear();
@@ -795,7 +795,7 @@ void JNI::create(JNIEnv *env, jobject self, jobject asset_manager,
FIND_METHOD(, setTextInClipboard, "(Ljava/lang/String;)Z");
FIND_METHOD(, isConnectionLimited, "()Z");
FIND_METHOD(, showVirtualKeyboard, "(Z)V");
- FIND_METHOD(, showKeyboardControl, "(Z)V");
+ FIND_METHOD(, showOnScreenControls, "(Z)V");
FIND_METHOD(, getBitmapResource, "(I)Landroid/graphics/Bitmap;");
FIND_METHOD(, setTouchMode, "(I)V");
FIND_METHOD(, getTouchMode, "()I");
diff --git a/backends/platform/android/jni-android.h b/backends/platform/android/jni-android.h
index 27476aed196..af1948e826c 100644
--- a/backends/platform/android/jni-android.h
+++ b/backends/platform/android/jni-android.h
@@ -86,7 +86,7 @@ public:
static bool setTextInClipboard(const Common::U32String &text);
static bool isConnectionLimited();
static void showVirtualKeyboard(bool enable);
- static void showKeyboardControl(bool enable);
+ static void showOnScreenControls(bool enable);
static Graphics::Surface *getBitmapResource(BitmapResources resource);
static void setTouchMode(int touchMode);
static int getTouchMode();
@@ -148,7 +148,7 @@ private:
static jmethodID _MID_isConnectionLimited;
static jmethodID _MID_setWindowCaption;
static jmethodID _MID_showVirtualKeyboard;
- static jmethodID _MID_showKeyboardControl;
+ static jmethodID _MID_showOnScreenControls;
static jmethodID _MID_getBitmapResource;
static jmethodID _MID_setTouchMode;
static jmethodID _MID_getTouchMode;
diff --git a/backends/platform/android/options.cpp b/backends/platform/android/options.cpp
index 8c6186d0572..ed3fee818e8 100644
--- a/backends/platform/android/options.cpp
+++ b/backends/platform/android/options.cpp
@@ -476,7 +476,7 @@ void OSystem_Android::applyOrientationSettings() {
}
void OSystem_Android::applyBackendSettings() {
- JNI::showKeyboardControl(ConfMan.getBool("onscreen_control"));
+ JNI::showOnScreenControls(ConfMan.getBool("onscreen_control"));
}
SAFRemoveDialog::SAFRemoveDialog() : GUI::Dialog("SAFBrowser") {
diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVM.java b/backends/platform/android/org/scummvm/scummvm/ScummVM.java
index 7e29a1a55d4..d4a7c0f35c5 100644
--- a/backends/platform/android/org/scummvm/scummvm/ScummVM.java
+++ b/backends/platform/android/org/scummvm/scummvm/ScummVM.java
@@ -76,7 +76,7 @@ public abstract class ScummVM implements SurfaceHolder.Callback, Runnable {
abstract protected boolean isConnectionLimited();
abstract protected void setWindowCaption(String caption);
abstract protected void showVirtualKeyboard(boolean enable);
- abstract protected void showKeyboardControl(boolean enable);
+ abstract protected void showOnScreenControls(boolean enable);
abstract protected Bitmap getBitmapResource(int resource);
abstract protected void setTouchMode(int touchMode);
abstract protected int getTouchMode();
diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
index de6f7529cee..636957ae6e5 100644
--- a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
+++ b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
@@ -749,10 +749,10 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
}
@Override
- protected void showKeyboardControl(final boolean enable) {
+ protected void showOnScreenControls(final boolean enable) {
runOnUiThread(new Runnable() {
public void run() {
- showToggleKeyboardBtnIcon(enable);
+ showToggleOnScreenBtnIcons(enable);
}
});
}
@@ -1111,7 +1111,7 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
if (isScreenKeyboardShown()) {
hideScreenKeyboard();
}
- showToggleKeyboardBtnIcon(false);
+ showToggleOnScreenBtnIcons(false);
}
@@ -1285,8 +1285,8 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
// }
// Show or hide the semi-transparent onscreen controls
- // Called by the override of showKeyboardControl()
- private void showToggleKeyboardBtnIcon(boolean show) {
+ // Called by the override of showOnScreenControls()
+ private void showToggleOnScreenBtnIcons(boolean show) {
if (_openMenuBtnIcon != null ) {
_openMenuBtnIcon.setVisibility(show ? View.VISIBLE : View.GONE);
}
Commit: b8874fc265efa0c3892571afa03c143cbb2509e5
https://github.com/scummvm/scummvm/commit/b8874fc265efa0c3892571afa03c143cbb2509e5
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2024-04-13T19:43:31+02:00
Commit Message:
ANDROID: Make on screen icons depend on screen orientation
Changed paths:
backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
index 636957ae6e5..af8153b1562 100644
--- a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
+++ b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
@@ -124,6 +124,7 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
FrameLayout _videoLayout = null;
private EditableSurfaceView _main_surface = null;
+ private LinearLayout _buttonLayout = null;
private ImageView _toggleTouchModeKeyboardBtnIcon = null;
private ImageView _openMenuBtnIcon = null;
@@ -154,6 +155,8 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
if (hwKeyboard) {
hideScreenKeyboard();
}
+
+ layoutButtonLayout(newConfig.orientation, false);
}
private boolean isHWKeyboardConnected() {
@@ -520,6 +523,28 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
}
}
+ private void layoutButtonLayout(int orientation, boolean force) {
+ int newOrientation = orientation == Configuration.ORIENTATION_LANDSCAPE ? LinearLayout.VERTICAL : LinearLayout.HORIZONTAL;
+
+ if (!force && newOrientation == _buttonLayout.getOrientation()) {
+ return;
+ }
+
+ _buttonLayout.setOrientation(newOrientation);
+ _buttonLayout.removeAllViews();
+ if (newOrientation == LinearLayout.VERTICAL) {
+ _buttonLayout.addView(_openMenuBtnIcon, new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT));
+ _buttonLayout.bringChildToFront(_openMenuBtnIcon);
+ _buttonLayout.addView(_toggleTouchModeKeyboardBtnIcon, new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT));
+ _buttonLayout.bringChildToFront(_toggleTouchModeKeyboardBtnIcon);
+ } else {
+ _buttonLayout.addView(_toggleTouchModeKeyboardBtnIcon, new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT));
+ _buttonLayout.bringChildToFront(_toggleTouchModeKeyboardBtnIcon);
+ _buttonLayout.addView(_openMenuBtnIcon, new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT));
+ _buttonLayout.bringChildToFront(_openMenuBtnIcon);
+ }
+ }
+
public void showScreenKeyboard() {
final boolean bGlobalsCompatibilityHacksTextInputEmulatesHwKeyboard = true;
final int dGlobalsTextInputKeyboard = 1;
@@ -910,22 +935,19 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
_videoLayout.addView(_main_surface, new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT));
- LinearLayout buttonLayout = new LinearLayout(this);
- buttonLayout.setOrientation(LinearLayout.HORIZONTAL);
+ _buttonLayout = new LinearLayout(this);
FrameLayout.LayoutParams buttonLayoutParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.TOP | Gravity.RIGHT);
buttonLayoutParams.topMargin = 5;
buttonLayoutParams.rightMargin = 5;
- _videoLayout.addView(buttonLayout, buttonLayoutParams);
- _videoLayout.bringChildToFront(buttonLayout);
-
- _toggleTouchModeKeyboardBtnIcon = new ImageView(this);
- buttonLayout.addView(_toggleTouchModeKeyboardBtnIcon, new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT));
- buttonLayout.bringChildToFront(_toggleTouchModeKeyboardBtnIcon);
+ _videoLayout.addView(_buttonLayout, buttonLayoutParams);
+ _videoLayout.bringChildToFront(_buttonLayout);
_openMenuBtnIcon = new ImageView(this);
_openMenuBtnIcon.setImageResource(R.drawable.ic_action_menu);
- buttonLayout.addView(_openMenuBtnIcon, new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT));
- buttonLayout.bringChildToFront(_openMenuBtnIcon);
+
+ _toggleTouchModeKeyboardBtnIcon = new ImageView(this);
+
+ layoutButtonLayout(getResources().getConfiguration().orientation, true);
_main_surface.setFocusable(true);
_main_surface.setFocusableInTouchMode(true);
Commit: 61a832e5bb1ffa7140c1f57bf83ba2fe5520b805
https://github.com/scummvm/scummvm/commit/61a832e5bb1ffa7140c1f57bf83ba2fe5520b805
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2024-04-13T19:45:55+02:00
Commit Message:
ANDROID: Don't display burger menu when in launcher
Changed paths:
backends/platform/android/android.cpp
backends/platform/android/android.h
backends/platform/android/jni-android.cpp
backends/platform/android/jni-android.h
backends/platform/android/options.cpp
backends/platform/android/org/scummvm/scummvm/ScummVM.java
backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp
index 3db3d83f7d2..a905d277968 100644
--- a/backends/platform/android/android.cpp
+++ b/backends/platform/android/android.cpp
@@ -192,6 +192,7 @@ OSystem_Android::OSystem_Android(int audio_sample_rate, int audio_buffer_size) :
_thirdPointerId(-1),
_trackball_scale(2),
_joystick_scale(10),
+ _engineRunning(false),
_defaultConfigFileName(""),
_defaultLogFileName(""),
_systemPropertiesSummaryStr(""),
@@ -578,6 +579,28 @@ void OSystem_Android::initBackend() {
BaseBackend::initBackend();
}
+void OSystem_Android::engineInit() {
+ _engineRunning = true;
+ updateOnScreenControls();
+
+}
+
+void OSystem_Android::engineDone() {
+ _engineRunning = false;
+ updateOnScreenControls();
+}
+
+void OSystem_Android::updateOnScreenControls() {
+ int enableMask = SHOW_ON_SCREEN_ALL;
+ if (!ConfMan.getBool("onscreen_control")) {
+ enableMask = SHOW_ON_SCREEN_NONE;
+ } else if (!_engineRunning) {
+ // Don't show the menu icon if the engine is not running
+ enableMask &= ~SHOW_ON_SCREEN_MENU;
+ }
+ JNI::showOnScreenControls(enableMask);
+}
+
Common::String OSystem_Android::getDefaultConfigFileName() {
// if possible, skip JNI call which is more costly (performance wise)
if (_defaultConfigFileName.empty()) {
diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h
index 7be989a4a77..a4719632366 100644
--- a/backends/platform/android/android.h
+++ b/backends/platform/android/android.h
@@ -165,6 +165,8 @@ private:
TouchControls _touchControls;
+ bool _engineRunning;
+
Common::String _defaultConfigFileName;
Common::String _defaultLogFileName;
Common::String _systemPropertiesSummaryStr;
@@ -197,10 +199,19 @@ public:
SCREEN_ORIENTATION_PORTRAIT = 1
};
+ enum {
+ SHOW_ON_SCREEN_NONE = 0,
+ SHOW_ON_SCREEN_MENU = 1,
+ SHOW_ON_SCREEN_INPUT_MODE = 2,
+ SHOW_ON_SCREEN_ALL = 0xffffffff,
+ };
+
OSystem_Android(int audio_sample_rate, int audio_buffer_size);
virtual ~OSystem_Android();
void initBackend() override;
+ void engineInit() override;
+ void engineDone() override;
bool hasFeature(OSystem::Feature f) override;
void setFeatureState(OSystem::Feature f, bool enable) override;
@@ -217,6 +228,8 @@ public:
void applyOrientationSettings();
+ void updateOnScreenControls();
+
bool pollEvent(Common::Event &event) override;
Common::HardwareInputSet *getHardwareInputSet() override;
Common::KeymapArray getGlobalKeymaps() override;
diff --git a/backends/platform/android/jni-android.cpp b/backends/platform/android/jni-android.cpp
index 3072dee18ba..cc5ff5b7a40 100644
--- a/backends/platform/android/jni-android.cpp
+++ b/backends/platform/android/jni-android.cpp
@@ -419,10 +419,10 @@ void JNI::showVirtualKeyboard(bool enable) {
}
}
-void JNI::showOnScreenControls(bool enable) {
+void JNI::showOnScreenControls(int enableMask) {
JNIEnv *env = JNI::getEnv();
- env->CallVoidMethod(_jobj, _MID_showOnScreenControls, enable);
+ env->CallVoidMethod(_jobj, _MID_showOnScreenControls, enableMask);
if (env->ExceptionCheck()) {
LOGE("Error trying to show on screen controls");
@@ -795,7 +795,7 @@ void JNI::create(JNIEnv *env, jobject self, jobject asset_manager,
FIND_METHOD(, setTextInClipboard, "(Ljava/lang/String;)Z");
FIND_METHOD(, isConnectionLimited, "()Z");
FIND_METHOD(, showVirtualKeyboard, "(Z)V");
- FIND_METHOD(, showOnScreenControls, "(Z)V");
+ FIND_METHOD(, showOnScreenControls, "(I)V");
FIND_METHOD(, getBitmapResource, "(I)Landroid/graphics/Bitmap;");
FIND_METHOD(, setTouchMode, "(I)V");
FIND_METHOD(, getTouchMode, "()I");
diff --git a/backends/platform/android/jni-android.h b/backends/platform/android/jni-android.h
index af1948e826c..a7223c11812 100644
--- a/backends/platform/android/jni-android.h
+++ b/backends/platform/android/jni-android.h
@@ -86,7 +86,7 @@ public:
static bool setTextInClipboard(const Common::U32String &text);
static bool isConnectionLimited();
static void showVirtualKeyboard(bool enable);
- static void showOnScreenControls(bool enable);
+ static void showOnScreenControls(int enableMask);
static Graphics::Surface *getBitmapResource(BitmapResources resource);
static void setTouchMode(int touchMode);
static int getTouchMode();
diff --git a/backends/platform/android/options.cpp b/backends/platform/android/options.cpp
index ed3fee818e8..4974e4dac7f 100644
--- a/backends/platform/android/options.cpp
+++ b/backends/platform/android/options.cpp
@@ -476,7 +476,7 @@ void OSystem_Android::applyOrientationSettings() {
}
void OSystem_Android::applyBackendSettings() {
- JNI::showOnScreenControls(ConfMan.getBool("onscreen_control"));
+ updateOnScreenControls();
}
SAFRemoveDialog::SAFRemoveDialog() : GUI::Dialog("SAFBrowser") {
diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVM.java b/backends/platform/android/org/scummvm/scummvm/ScummVM.java
index d4a7c0f35c5..76e1e5cb693 100644
--- a/backends/platform/android/org/scummvm/scummvm/ScummVM.java
+++ b/backends/platform/android/org/scummvm/scummvm/ScummVM.java
@@ -24,6 +24,9 @@ import javax.microedition.khronos.egl.EGLSurface;
import javax.microedition.khronos.opengles.GL10;
public abstract class ScummVM implements SurfaceHolder.Callback, Runnable {
+ public static final int SHOW_ON_SCREEN_MENU = 1;
+ public static final int SHOW_ON_SCREEN_INPUT_MODE = 2;
+
final protected static String LOG_TAG = "ScummVM";
final private AssetManager _asset_manager;
final private Object _sem_surface;
@@ -76,7 +79,7 @@ public abstract class ScummVM implements SurfaceHolder.Callback, Runnable {
abstract protected boolean isConnectionLimited();
abstract protected void setWindowCaption(String caption);
abstract protected void showVirtualKeyboard(boolean enable);
- abstract protected void showOnScreenControls(boolean enable);
+ abstract protected void showOnScreenControls(int enableMask);
abstract protected Bitmap getBitmapResource(int resource);
abstract protected void setTouchMode(int touchMode);
abstract protected int getTouchMode();
diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
index af8153b1562..9a9ce3a7f65 100644
--- a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
+++ b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
@@ -774,10 +774,10 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
}
@Override
- protected void showOnScreenControls(final boolean enable) {
+ protected void showOnScreenControls(final int enableMask) {
runOnUiThread(new Runnable() {
public void run() {
- showToggleOnScreenBtnIcons(enable);
+ showToggleOnScreenBtnIcons(enableMask);
}
});
}
@@ -1133,7 +1133,7 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
if (isScreenKeyboardShown()) {
hideScreenKeyboard();
}
- showToggleOnScreenBtnIcons(false);
+ showToggleOnScreenBtnIcons(0);
}
@@ -1308,13 +1308,13 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
// Show or hide the semi-transparent onscreen controls
// Called by the override of showOnScreenControls()
- private void showToggleOnScreenBtnIcons(boolean show) {
+ private void showToggleOnScreenBtnIcons(int enableMask) {
if (_openMenuBtnIcon != null ) {
- _openMenuBtnIcon.setVisibility(show ? View.VISIBLE : View.GONE);
+ _openMenuBtnIcon.setVisibility((enableMask & ScummVM.SHOW_ON_SCREEN_MENU) != 0 ? View.VISIBLE : View.GONE);
}
if (_toggleTouchModeKeyboardBtnIcon != null ) {
- _toggleTouchModeKeyboardBtnIcon.setVisibility(show ? View.VISIBLE : View.GONE);
+ _toggleTouchModeKeyboardBtnIcon.setVisibility((enableMask & ScummVM.SHOW_ON_SCREEN_INPUT_MODE) != 0 ? View.VISIBLE : View.GONE);
}
}
Commit: e2b1299d85564c29a1642185aeb6b96e56ded206
https://github.com/scummvm/scummvm/commit/e2b1299d85564c29a1642185aeb6b96e56ded206
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2024-04-13T19:45:55+02:00
Commit Message:
ANDROID: Hide on-screen buttons while native code is not started
Changed paths:
backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
index 9a9ce3a7f65..d11ea6749ae 100644
--- a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
+++ b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
@@ -947,6 +947,8 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
_toggleTouchModeKeyboardBtnIcon = new ImageView(this);
+ // Hide by default all buttons, they will be shown when native code will start
+ showToggleOnScreenBtnIcons(0);
layoutButtonLayout(getResources().getConfiguration().orientation, true);
_main_surface.setFocusable(true);
More information about the Scummvm-git-logs
mailing list