[Scummvm-git-logs] scummvm master -> 8b4c3ea30253d8113d6a2a3ac7c8f9182e6e8abd
bluegr
bluegr at gmail.com
Tue Aug 20 13:32:55 CEST 2019
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
12c232eefc ANDROID: Add a button to show the virtual keyboard
8b4c3ea302 ANDROID: Use a better icon for the on screen control
Commit: 12c232eefc7c78f7d40da9894e395dee4ce6d8c2
https://github.com/scummvm/scummvm/commit/12c232eefc7c78f7d40da9894e395dee4ce6d8c2
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2019-08-20T14:32:50+03:00
Commit Message:
ANDROID: Add a button to show the virtual keyboard
Changed paths:
A dists/android/res/drawable-hdpi/ic_action_settings.png
A dists/android/res/drawable-mdpi/ic_action_settings.png
A dists/android/res/drawable-xhdpi/ic_action_settings.png
A dists/android/res/drawable-xxhdpi/ic_action_settings.png
backends/platform/android/android.cpp
backends/platform/android/android.mk
backends/platform/android/jni.cpp
backends/platform/android/jni.h
backends/platform/android/org/scummvm/scummvm/ScummVM.java
backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
dists/android/res/layout/main.xml
diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp
index f3dc0b5..2ae36c8 100644
--- a/backends/platform/android/android.cpp
+++ b/backends/platform/android/android.cpp
@@ -350,6 +350,7 @@ void OSystem_Android::initBackend() {
ConfMan.registerDefault("fullscreen", true);
ConfMan.registerDefault("aspect_ratio", true);
ConfMan.registerDefault("touchpad_mouse_mode", true);
+ ConfMan.registerDefault("onscreen_control", true);
ConfMan.setInt("autosave_period", 0);
ConfMan.setBool("FM_high_quality", false);
@@ -360,6 +361,11 @@ void OSystem_Android::initBackend() {
else
ConfMan.setBool("touchpad_mouse_mode", true);
+ if (ConfMan.hasKey("onscreen_control"))
+ JNI::showKeyboardControl(ConfMan.getBool("onscreen_control"));
+ else
+ ConfMan.setBool("onscreen_control", true);
+
// must happen before creating TimerManager to avoid race in
// creating EventManager
setupKeymapper();
@@ -411,6 +417,7 @@ bool OSystem_Android::hasFeature(Feature f) {
f == kFeatureOverlaySupportsAlpha ||
f == kFeatureOpenUrl ||
f == kFeatureTouchpadMode ||
+ f == kFeatureOnScreenControl ||
f == kFeatureClipboardSupport);
}
@@ -439,6 +446,10 @@ void OSystem_Android::setFeatureState(Feature f, bool enable) {
ConfMan.setBool("touchpad_mouse_mode", enable);
_touchpad_mode = enable;
break;
+ case kFeatureOnScreenControl:
+ ConfMan.setBool("onscreen_control", enable);
+ JNI::showKeyboardControl(enable);
+ break;
default:
break;
}
@@ -456,6 +467,8 @@ bool OSystem_Android::getFeatureState(Feature f) {
return _use_mouse_palette;
case kFeatureTouchpadMode:
return ConfMan.getBool("touchpad_mouse_mode");
+ case kFeatureOnScreenControl:
+ return ConfMan.getBool("onscreen_control");
default:
return false;
}
diff --git a/backends/platform/android/android.mk b/backends/platform/android/android.mk
index b5f559c..eaae5dd 100644
--- a/backends/platform/android/android.mk
+++ b/backends/platform/android/android.mk
@@ -21,7 +21,11 @@ RESOURCES = \
$(PATH_BUILD_RES)/drawable/scummvm.png \
$(PATH_BUILD_RES)/drawable/scummvm_big.png \
$(PATH_BUILD_RES)/drawable-xhdpi/leanback_icon.png \
- $(PATH_BUILD_RES)/drawable-xhdpi/ouya_icon.png
+ $(PATH_BUILD_RES)/drawable-xhdpi/ouya_icon.png \
+ $(PATH_BUILD_RES)/drawable-hdpi/ic_action_settings.png \
+ $(PATH_BUILD_RES)/drawable-mdpi/ic_action_settings.png \
+ $(PATH_BUILD_RES)/drawable-xhdpi/ic_action_settings.png \
+ $(PATH_BUILD_RES)/drawable-xxhdpi/ic_action_settings.png
DIST_ANDROID_MK = $(PATH_DIST)/jni/Android.mk
DIST_BUILD_XML = $(PATH_DIST)/custom_rules.xml
diff --git a/backends/platform/android/jni.cpp b/backends/platform/android/jni.cpp
index ffe6006..905423a 100644
--- a/backends/platform/android/jni.cpp
+++ b/backends/platform/android/jni.cpp
@@ -84,6 +84,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_getSysArchives = 0;
jmethodID JNI::_MID_initSurface = 0;
jmethodID JNI::_MID_deinitSurface = 0;
@@ -361,6 +362,19 @@ void JNI::showVirtualKeyboard(bool enable) {
}
}
+void JNI::showKeyboardControl(bool enable) {
+ JNIEnv *env = JNI::getEnv();
+
+ env->CallVoidMethod(_jobj, _MID_showKeyboardControl, enable);
+
+ if (env->ExceptionCheck()) {
+ LOGE("Error trying to show virtual keyboard control");
+
+ env->ExceptionDescribe();
+ env->ExceptionClear();
+ }
+}
+
void JNI::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
JNIEnv *env = JNI::getEnv();
@@ -517,6 +531,7 @@ void JNI::create(JNIEnv *env, jobject self, jobject asset_manager,
FIND_METHOD(, setTextInClipboard, "([B)Z");
FIND_METHOD(, isConnectionLimited, "()Z");
FIND_METHOD(, showVirtualKeyboard, "(Z)V");
+ FIND_METHOD(, showKeyboardControl, "(Z)V");
FIND_METHOD(, getSysArchives, "()[Ljava/lang/String;");
FIND_METHOD(, initSurface, "()Ljavax/microedition/khronos/egl/EGLSurface;");
FIND_METHOD(, deinitSurface, "()V");
diff --git a/backends/platform/android/jni.h b/backends/platform/android/jni.h
index e65e7f5..aa89174 100644
--- a/backends/platform/android/jni.h
+++ b/backends/platform/android/jni.h
@@ -64,6 +64,7 @@ public:
static bool setTextInClipboard(const Common::String &text);
static bool isConnectionLimited();
static void showVirtualKeyboard(bool enable);
+ static void showKeyboardControl(bool enable);
static void addSysArchivesToSearchSet(Common::SearchSet &s, int priority);
static inline bool haveSurface();
@@ -101,6 +102,7 @@ private:
static jmethodID _MID_isConnectionLimited;
static jmethodID _MID_setWindowCaption;
static jmethodID _MID_showVirtualKeyboard;
+ static jmethodID _MID_showKeyboardControl;
static jmethodID _MID_getSysArchives;
static jmethodID _MID_initSurface;
static jmethodID _MID_deinitSurface;
diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVM.java b/backends/platform/android/org/scummvm/scummvm/ScummVM.java
index 7b6627f..37fe76e 100644
--- a/backends/platform/android/org/scummvm/scummvm/ScummVM.java
+++ b/backends/platform/android/org/scummvm/scummvm/ScummVM.java
@@ -61,6 +61,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 String[] getSysArchives();
public ScummVM(AssetManager asset_manager, SurfaceHolder holder) {
diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
index 58af703..7bb0fe8 100644
--- a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
+++ b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
@@ -15,10 +15,12 @@ import android.os.Environment;
import android.text.ClipboardManager;
import android.util.DisplayMetrics;
import android.util.Log;
+import android.view.View;
import android.view.SurfaceView;
import android.view.SurfaceHolder;
import android.view.MotionEvent;
import android.view.inputmethod.InputMethodManager;
+import android.widget.ImageView;
import android.widget.Toast;
import java.io.File;
@@ -39,6 +41,17 @@ public class ScummVMActivity extends Activity {
}
}
+ public View.OnClickListener keyboardBtnOnClickListener = new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ runOnUiThread(new Runnable() {
+ public void run() {
+ toggleKeyboard();
+ }
+ });
+ }
+ };
+
private class MyScummVM extends ScummVM {
private boolean usingSmallScreen() {
// Multiple screen sizes came in with Android 1.6. Have
@@ -151,6 +164,15 @@ public class ScummVMActivity extends Activity {
}
@Override
+ protected void showKeyboardControl(final boolean enable) {
+ runOnUiThread(new Runnable() {
+ public void run() {
+ showKeyboardView(enable);
+ }
+ });
+ }
+
+ @Override
protected String[] getSysArchives() {
return new String[0];
}
@@ -233,6 +255,9 @@ public class ScummVMActivity extends Activity {
_events = new ScummVMEventsHoneycomb(this, _scummvm, _mouseHelper);
}
+ // On screen button listener
+ ((ImageView)findViewById(R.id.show_keyboard)).setOnClickListener(keyboardBtnOnClickListener);
+
main_surface.setOnKeyListener(_events);
main_surface.setOnTouchListener(_events);
@@ -324,6 +349,25 @@ public class ScummVMActivity extends Activity {
InputMethodManager.HIDE_IMPLICIT_ONLY);
}
+ private void toggleKeyboard() {
+ SurfaceView main_surface = (SurfaceView)findViewById(R.id.main_surface);
+ InputMethodManager imm = (InputMethodManager)
+ getSystemService(INPUT_METHOD_SERVICE);
+
+ imm.toggleSoftInputFromWindow(main_surface.getWindowToken(),
+ InputMethodManager.SHOW_IMPLICIT,
+ InputMethodManager.HIDE_IMPLICIT_ONLY);
+ }
+
+ private void showKeyboardView(boolean show) {
+ ImageView keyboardBtn = (ImageView)findViewById(R.id.show_keyboard);
+
+ if (show)
+ keyboardBtn.setVisibility(View.VISIBLE);
+ else
+ keyboardBtn.setVisibility(View.GONE);
+ }
+
private void showMouseCursor(boolean show) {
/* Currently hiding the system mouse cursor is only
supported on OUYA. If other systems provide similar
diff --git a/dists/android/res/drawable-hdpi/ic_action_settings.png b/dists/android/res/drawable-hdpi/ic_action_settings.png
new file mode 100755
index 0000000..d973325
Binary files /dev/null and b/dists/android/res/drawable-hdpi/ic_action_settings.png differ
diff --git a/dists/android/res/drawable-mdpi/ic_action_settings.png b/dists/android/res/drawable-mdpi/ic_action_settings.png
new file mode 100755
index 0000000..8987358
Binary files /dev/null and b/dists/android/res/drawable-mdpi/ic_action_settings.png differ
diff --git a/dists/android/res/drawable-xhdpi/ic_action_settings.png b/dists/android/res/drawable-xhdpi/ic_action_settings.png
new file mode 100755
index 0000000..fb8f334
Binary files /dev/null and b/dists/android/res/drawable-xhdpi/ic_action_settings.png differ
diff --git a/dists/android/res/drawable-xxhdpi/ic_action_settings.png b/dists/android/res/drawable-xxhdpi/ic_action_settings.png
new file mode 100755
index 0000000..51f7527
Binary files /dev/null and b/dists/android/res/drawable-xxhdpi/ic_action_settings.png differ
diff --git a/dists/android/res/layout/main.xml b/dists/android/res/layout/main.xml
index 8b0d515..fa4bb66 100644
--- a/dists/android/res/layout/main.xml
+++ b/dists/android/res/layout/main.xml
@@ -1,12 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
<org.scummvm.scummvm.EditableSurfaceView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/main_surface"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
android:gravity="center"
android:keepScreenOn="true"
android:focusable="true"
android:focusableInTouchMode="true"
/>
+
+<ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/ic_action_settings"
+ android:id="@+id/show_keyboard"
+ android:layout_alignParentTop="true"
+ android:layout_alignParentRight="true"
+ android:layout_marginRight="10dp"
+ android:layout_marginTop="10dp" />
+
+</RelativeLayout>
Commit: 8b4c3ea30253d8113d6a2a3ac7c8f9182e6e8abd
https://github.com/scummvm/scummvm/commit/8b4c3ea30253d8113d6a2a3ac7c8f9182e6e8abd
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2019-08-20T14:32:50+03:00
Commit Message:
ANDROID: Use a better icon for the on screen control
Modified from https://www.iconfinder.com/icons/352464/keyboard_icon, which is available under the Creative Commons (Attribution-Share Alike 3.0 Unported) license.
Changed paths:
A dists/android/res/drawable-hdpi/ic_action_keyboard.png
A dists/android/res/drawable-mdpi/ic_action_keyboard.png
A dists/android/res/drawable-xhdpi/ic_action_keyboard.png
A dists/android/res/drawable-xxhdpi/ic_action_keyboard.png
R dists/android/res/drawable-hdpi/ic_action_settings.png
R dists/android/res/drawable-mdpi/ic_action_settings.png
R dists/android/res/drawable-xhdpi/ic_action_settings.png
R dists/android/res/drawable-xxhdpi/ic_action_settings.png
backends/platform/android/android.mk
dists/android/res/layout/main.xml
diff --git a/backends/platform/android/android.mk b/backends/platform/android/android.mk
index eaae5dd..42fc718 100644
--- a/backends/platform/android/android.mk
+++ b/backends/platform/android/android.mk
@@ -22,10 +22,10 @@ RESOURCES = \
$(PATH_BUILD_RES)/drawable/scummvm_big.png \
$(PATH_BUILD_RES)/drawable-xhdpi/leanback_icon.png \
$(PATH_BUILD_RES)/drawable-xhdpi/ouya_icon.png \
- $(PATH_BUILD_RES)/drawable-hdpi/ic_action_settings.png \
- $(PATH_BUILD_RES)/drawable-mdpi/ic_action_settings.png \
- $(PATH_BUILD_RES)/drawable-xhdpi/ic_action_settings.png \
- $(PATH_BUILD_RES)/drawable-xxhdpi/ic_action_settings.png
+ $(PATH_BUILD_RES)/drawable-hdpi/ic_action_keyboard.png \
+ $(PATH_BUILD_RES)/drawable-mdpi/ic_action_keyboard.png \
+ $(PATH_BUILD_RES)/drawable-xhdpi/ic_action_keyboard.png \
+ $(PATH_BUILD_RES)/drawable-xxhdpi/ic_action_keyboard.png
DIST_ANDROID_MK = $(PATH_DIST)/jni/Android.mk
DIST_BUILD_XML = $(PATH_DIST)/custom_rules.xml
diff --git a/dists/android/res/drawable-hdpi/ic_action_keyboard.png b/dists/android/res/drawable-hdpi/ic_action_keyboard.png
new file mode 100644
index 0000000..69491c9
Binary files /dev/null and b/dists/android/res/drawable-hdpi/ic_action_keyboard.png differ
diff --git a/dists/android/res/drawable-hdpi/ic_action_settings.png b/dists/android/res/drawable-hdpi/ic_action_settings.png
deleted file mode 100755
index d973325..0000000
Binary files a/dists/android/res/drawable-hdpi/ic_action_settings.png and /dev/null differ
diff --git a/dists/android/res/drawable-mdpi/ic_action_keyboard.png b/dists/android/res/drawable-mdpi/ic_action_keyboard.png
new file mode 100644
index 0000000..3c3b3ca
Binary files /dev/null and b/dists/android/res/drawable-mdpi/ic_action_keyboard.png differ
diff --git a/dists/android/res/drawable-mdpi/ic_action_settings.png b/dists/android/res/drawable-mdpi/ic_action_settings.png
deleted file mode 100755
index 8987358..0000000
Binary files a/dists/android/res/drawable-mdpi/ic_action_settings.png and /dev/null differ
diff --git a/dists/android/res/drawable-xhdpi/ic_action_keyboard.png b/dists/android/res/drawable-xhdpi/ic_action_keyboard.png
new file mode 100644
index 0000000..6acead0
Binary files /dev/null and b/dists/android/res/drawable-xhdpi/ic_action_keyboard.png differ
diff --git a/dists/android/res/drawable-xhdpi/ic_action_settings.png b/dists/android/res/drawable-xhdpi/ic_action_settings.png
deleted file mode 100755
index fb8f334..0000000
Binary files a/dists/android/res/drawable-xhdpi/ic_action_settings.png and /dev/null differ
diff --git a/dists/android/res/drawable-xxhdpi/ic_action_keyboard.png b/dists/android/res/drawable-xxhdpi/ic_action_keyboard.png
new file mode 100644
index 0000000..dae5aa6
Binary files /dev/null and b/dists/android/res/drawable-xxhdpi/ic_action_keyboard.png differ
diff --git a/dists/android/res/drawable-xxhdpi/ic_action_settings.png b/dists/android/res/drawable-xxhdpi/ic_action_settings.png
deleted file mode 100755
index 51f7527..0000000
Binary files a/dists/android/res/drawable-xxhdpi/ic_action_settings.png and /dev/null differ
diff --git a/dists/android/res/layout/main.xml b/dists/android/res/layout/main.xml
index fa4bb66..79ce4b6 100644
--- a/dists/android/res/layout/main.xml
+++ b/dists/android/res/layout/main.xml
@@ -19,7 +19,7 @@
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:src="@drawable/ic_action_settings"
+ android:src="@drawable/ic_action_keyboard"
android:id="@+id/show_keyboard"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
More information about the Scummvm-git-logs
mailing list