diff options
| author | Po Lu | 2023-02-06 22:00:08 +0800 |
|---|---|---|
| committer | Po Lu | 2023-02-06 22:00:08 +0800 |
| commit | fc82efc1fe99415d60d9aa06f2ff8e7e92566870 (patch) | |
| tree | 350d9c170f5d8f680b57fd3d012901087073f4a6 /java | |
| parent | 7275e32d0b0db412d6a20b3d656ef72ea72d8a44 (diff) | |
| download | emacs-fc82efc1fe99415d60d9aa06f2ff8e7e92566870.tar.gz emacs-fc82efc1fe99415d60d9aa06f2ff8e7e92566870.zip | |
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.
Diffstat (limited to 'java')
| -rw-r--r-- | java/AndroidManifest.xml.in | 5 | ||||
| -rw-r--r-- | java/org/gnu/emacs/EmacsOpenActivity.java | 9 | ||||
| -rw-r--r-- | 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 923c5a005d5..3c9e30713b6 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/>. --> | |||
| 72 | android:extractNativeLibs="true"> | 72 | android:extractNativeLibs="true"> |
| 73 | 73 | ||
| 74 | <activity android:name="org.gnu.emacs.EmacsActivity" | 74 | <activity android:name="org.gnu.emacs.EmacsActivity" |
| 75 | android:launchMode="singleTop" | 75 | android:launchMode="singleInstance" |
| 76 | android:windowSoftInputMode="adjustResize" | 76 | android:windowSoftInputMode="adjustResize" |
| 77 | android:exported="true" | 77 | android:exported="true" |
| 78 | android:configChanges="orientation|screenSize|screenLayout|keyboardHidden"> | 78 | android:configChanges="orientation|screenSize|screenLayout|keyboardHidden"> |
| @@ -84,6 +84,8 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. --> | |||
| 84 | </activity> | 84 | </activity> |
| 85 | 85 | ||
| 86 | <activity android:name="org.gnu.emacs.EmacsOpenActivity" | 86 | <activity android:name="org.gnu.emacs.EmacsOpenActivity" |
| 87 | android:taskAffinity="open.dialog" | ||
| 88 | android:excludeFromRecents="true" | ||
| 87 | android:exported="true"> | 89 | android:exported="true"> |
| 88 | 90 | ||
| 89 | <!-- Allow Emacs to open all kinds of files known to Android. --> | 91 | <!-- 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/>. --> | |||
| 137 | <data android:mimeType="image/t38"/> | 139 | <data android:mimeType="image/t38"/> |
| 138 | <data android:mimeType="image/tiff"/> | 140 | <data android:mimeType="image/tiff"/> |
| 139 | <data android:mimeType="image/tiff-fx"/> | 141 | <data android:mimeType="image/tiff-fx"/> |
| 142 | <data android:mimeType="image/xpm"/> | ||
| 140 | <data android:mimeType="text/*"/> | 143 | <data android:mimeType="text/*"/> |
| 141 | <data android:mimeType="application/*xml"/> | 144 | <data android:mimeType="application/*xml"/> |
| 142 | <data android:mimeType="application/atom+xml"/> | 145 | <data android:mimeType="application/atom+xml"/> |
diff --git a/java/org/gnu/emacs/EmacsOpenActivity.java b/java/org/gnu/emacs/EmacsOpenActivity.java index 268a9abd7b1..e987e067a73 100644 --- a/java/org/gnu/emacs/EmacsOpenActivity.java +++ b/java/org/gnu/emacs/EmacsOpenActivity.java | |||
| @@ -184,7 +184,9 @@ public class EmacsOpenActivity extends Activity | |||
| 184 | 184 | ||
| 185 | intent = new Intent (EmacsOpenActivity.this, | 185 | intent = new Intent (EmacsOpenActivity.this, |
| 186 | EmacsActivity.class); | 186 | EmacsActivity.class); |
| 187 | intent.addFlags (Intent.FLAG_ACTIVITY_NEW_TASK); | 187 | |
| 188 | /* This means only an existing frame will be displayed. */ | ||
| 189 | intent.addFlags (Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); | ||
| 188 | startActivity (intent); | 190 | startActivity (intent); |
| 189 | 191 | ||
| 190 | EmacsOpenActivity.this.finish (); | 192 | EmacsOpenActivity.this.finish (); |
| @@ -285,6 +287,11 @@ public class EmacsOpenActivity extends Activity | |||
| 285 | return; | 287 | return; |
| 286 | } | 288 | } |
| 287 | 289 | ||
| 290 | /* Set an appropriate theme. */ | ||
| 291 | |||
| 292 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) | ||
| 293 | setTheme (android.R.style.Theme_DeviceDefault); | ||
| 294 | |||
| 288 | /* Now see if the action specified is supported by Emacs. */ | 295 | /* Now see if the action specified is supported by Emacs. */ |
| 289 | 296 | ||
| 290 | if (action.equals ("android.intent.action.VIEW") | 297 | if (action.equals ("android.intent.action.VIEW") |
diff --git a/java/org/gnu/emacs/EmacsWindow.java b/java/org/gnu/emacs/EmacsWindow.java index 5c2b77b0125..e921b972c2c 100644 --- a/java/org/gnu/emacs/EmacsWindow.java +++ b/java/org/gnu/emacs/EmacsWindow.java | |||
| @@ -794,7 +794,10 @@ public class EmacsWindow extends EmacsHandleObject | |||
| 794 | 794 | ||
| 795 | case MotionEvent.ACTION_UP: | 795 | case MotionEvent.ACTION_UP: |
| 796 | case MotionEvent.ACTION_POINTER_UP: | 796 | case MotionEvent.ACTION_POINTER_UP: |
| 797 | /* Touch up event. */ | 797 | case MotionEvent.ACTION_CANCEL: |
| 798 | /* Touch up event. Android documentation says ACTION_CANCEL | ||
| 799 | should be treated as more or less equivalent to ACTION_UP, | ||
| 800 | so that is what is done here. */ | ||
| 798 | EmacsNative.sendTouchUp (this.handle, (int) event.getX (index), | 801 | EmacsNative.sendTouchUp (this.handle, (int) event.getX (index), |
| 799 | (int) event.getY (index), | 802 | (int) event.getY (index), |
| 800 | event.getEventTime (), pointerID); | 803 | event.getEventTime (), pointerID); |