Update Android port

* java/AndroidManifest.xml.in: Prevent the Emacs activity from
being overlayed by the emacsclient wrapper.
* java/org/gnu/emacs/EmacsOpenActivity.java (run): Likewise.
(onCreate): Set an appropriate theme on ICS and up.

* java/org/gnu/emacs/EmacsWindow.java (onTouchEvent): Handle
ACTION_CANCEL correctly.
This commit is contained in:
Po Lu 2023-02-06 22:00:08 +08:00
parent 7275e32d0b
commit fc82efc1fe
3 changed files with 16 additions and 3 deletions

View file

@ -72,7 +72,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. -->
android:extractNativeLibs="true">
<activity android:name="org.gnu.emacs.EmacsActivity"
android:launchMode="singleTop"
android:launchMode="singleInstance"
android:windowSoftInputMode="adjustResize"
android:exported="true"
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden">
@ -84,6 +84,8 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. -->
</activity>
<activity android:name="org.gnu.emacs.EmacsOpenActivity"
android:taskAffinity="open.dialog"
android:excludeFromRecents="true"
android:exported="true">
<!-- Allow Emacs to open all kinds of files known to Android. -->
@ -137,6 +139,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. -->
<data android:mimeType="image/t38"/>
<data android:mimeType="image/tiff"/>
<data android:mimeType="image/tiff-fx"/>
<data android:mimeType="image/xpm"/>
<data android:mimeType="text/*"/>
<data android:mimeType="application/*xml"/>
<data android:mimeType="application/atom+xml"/>

View file

@ -184,7 +184,9 @@ private class EmacsClientThread extends Thread
intent = new Intent (EmacsOpenActivity.this,
EmacsActivity.class);
intent.addFlags (Intent.FLAG_ACTIVITY_NEW_TASK);
/* This means only an existing frame will be displayed. */
intent.addFlags (Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
startActivity (intent);
EmacsOpenActivity.this.finish ();
@ -285,6 +287,11 @@ else if (apiLevel >= Build.VERSION_CODES.DONUT)
return;
}
/* Set an appropriate theme. */
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH)
setTheme (android.R.style.Theme_DeviceDefault);
/* Now see if the action specified is supported by Emacs. */
if (action.equals ("android.intent.action.VIEW")

View file

@ -794,7 +794,10 @@ private class Coordinate
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_POINTER_UP:
/* Touch up event. */
case MotionEvent.ACTION_CANCEL:
/* Touch up event. Android documentation says ACTION_CANCEL
should be treated as more or less equivalent to ACTION_UP,
so that is what is done here. */
EmacsNative.sendTouchUp (this.handle, (int) event.getX (index),
(int) event.getY (index),
event.getEventTime (), pointerID);