emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/android fc82efc1fe 2/5: Update Android port


From: Po Lu
Subject: feature/android fc82efc1fe 2/5: Update Android port
Date: Mon, 6 Feb 2023 09:56:02 -0500 (EST)

branch: feature/android
commit fc82efc1fe99415d60d9aa06f2ff8e7e92566870
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    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.
---
 java/AndroidManifest.xml.in               | 5 ++++-
 java/org/gnu/emacs/EmacsOpenActivity.java | 9 ++++++++-
 java/org/gnu/emacs/EmacsWindow.java       | 5 ++++-
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/java/AndroidManifest.xml.in b/java/AndroidManifest.xml.in
index 923c5a005d..3c9e30713b 100644
--- a/java/AndroidManifest.xml.in
+++ b/java/AndroidManifest.xml.in
@@ -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"/>
diff --git a/java/org/gnu/emacs/EmacsOpenActivity.java 
b/java/org/gnu/emacs/EmacsOpenActivity.java
index 268a9abd7b..e987e067a7 100644
--- a/java/org/gnu/emacs/EmacsOpenActivity.java
+++ b/java/org/gnu/emacs/EmacsOpenActivity.java
@@ -184,7 +184,9 @@ public class EmacsOpenActivity extends Activity
 
          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 @@ public class EmacsOpenActivity extends Activity
        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")
diff --git a/java/org/gnu/emacs/EmacsWindow.java 
b/java/org/gnu/emacs/EmacsWindow.java
index 5c2b77b012..e921b972c2 100644
--- a/java/org/gnu/emacs/EmacsWindow.java
+++ b/java/org/gnu/emacs/EmacsWindow.java
@@ -794,7 +794,10 @@ public class EmacsWindow extends EmacsHandleObject
 
       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);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]