1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-03-09 08:21:30 -07:00

Simplify handling of command-line arguments on Android

* java/org/gnu/emacs/EmacsActivity.java
(EXTRA_STARTUP_ARGUMENTS): New constant.
(onCreate): Read a string array, not a string extra from the
intent with this key.

* java/org/gnu/emacs/EmacsOpenActivity.java (EmacsOpenActivity)
<fileToOpen>: Delete field.
(onCreate): Provide file name as a command line argument when
starting the Emacs service.

* java/org/gnu/emacs/EmacsPreferencesActivity.java (startEmacsQ)
(startEmacsDebugInit): In like manner, replace ad-hoc
command-line argument extra with a proper array.

* java/org/gnu/emacs/EmacsService.java (EmacsService): Rename
extraStartupArgument to extraStartupArguments, and change its
type to a string array.
(onCreate): Adjust to match.

* java/org/gnu/emacs/EmacsThread.java (EmacsThread)
<extraStartupArguments>: Ditto.
<fileToOpen>: Delete field.
(run): Adjust correspondingly.
This commit is contained in:
Po Lu 2024-05-04 16:06:00 +08:00
parent ecfbd0ff99
commit 41dd78cd36
5 changed files with 32 additions and 41 deletions

View file

@ -70,11 +70,6 @@ public final class EmacsOpenActivity extends Activity
{
private static final String TAG = "EmacsOpenActivity";
/* The name of any file that should be opened as EmacsThread starts
Emacs. This is never cleared, even if EmacsOpenActivity is
started a second time, as EmacsThread only starts once. */
public static String fileToOpen;
/* Any currently focused EmacsOpenActivity. Used to show pop ups
while the activity is active and Emacs doesn't have permission to
display over other programs. */
@ -697,9 +692,10 @@ public final class EmacsOpenActivity extends Activity
if (EmacsService.SERVICE == null)
{
fileToOpen = fileName;
intent = new Intent (EmacsOpenActivity.this,
EmacsActivity.class);
intent.putExtra (EmacsActivity.EXTRA_STARTUP_ARGUMENTS,
new String [] { fileName, });
finish ();
startActivity (intent);
return;