1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-09 13:10:57 -08:00

Update Android port

* doc/emacs/android.texi (Android Windowing): Reword
documentation.
* java/org/gnu/emacs/EmacsActivity.java (EmacsActivity):
* java/org/gnu/emacs/EmacsContextMenu.java (EmacsContextMenu):
* java/org/gnu/emacs/EmacsFontDriver.java (EmacsFontDriver):
* java/org/gnu/emacs/EmacsSdk7FontDriver.java
(EmacsSdk7FontDriver):
* java/org/gnu/emacs/EmacsService.java (queryBattery):
* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow): Make
functions final and classes static where necessary.
* src/android.c (struct android_emacs_service): New method
`display_toast'.
(android_init_emacs_service): Load new method.
(android_display_toast): New function.
* src/android.h: Export.
* src/androidfns.c (Fandroid_detect_mouse):
* src/androidselect.c (Fandroid_clipboard_owner_p)
(Fandroid_set_clipboard, Fandroid_get_clipboard)
(Fandroid_browse_url): Prevent crashes when called from
libandroid-emacs.so.
* src/androidterm.c (handle_one_android_event): Fix out of date
commentary.
This commit is contained in:
Po Lu 2023-03-02 09:27:37 +08:00
parent 5e416d02c5
commit 7fb3c0d039
12 changed files with 83 additions and 18 deletions

View file

@ -207,7 +207,7 @@ public class EmacsActivity extends Activity
}
@Override
public void
public final void
onDestroy ()
{
EmacsWindowAttachmentManager manager;

View file

@ -52,7 +52,7 @@ public final class EmacsContextMenu
/* Whether or not a submenu was selected. */
public static boolean wasSubmenuSelected;
private class Item implements MenuItem.OnMenuItemClickListener
private static class Item implements MenuItem.OnMenuItemClickListener
{
public int itemID;
public String itemName, tooltip;

View file

@ -65,7 +65,7 @@ public abstract class EmacsFontDriver
public static final int MONO = 100;
public static final int CHARCELL = 110;
public class FontSpec
public static class FontSpec
{
/* The fields below mean the same as they do in enum
font_property_index in font.h. */
@ -99,7 +99,7 @@ public abstract class EmacsFontDriver
}
};
public class FontMetrics
public static class FontMetrics
{
public short lbearing;
public short rbearing;
@ -119,7 +119,7 @@ public abstract class EmacsFontDriver
}
}
public class FontEntity extends FontSpec
public static class FontEntity extends FontSpec
{
/* No extra fields here. */
};

View file

@ -40,7 +40,7 @@ public class EmacsSdk7FontDriver extends EmacsFontDriver
private static final String EM_STRING = "m";
private static final String TAG = "EmacsSdk7FontDriver";
protected class Sdk7Typeface
protected static final class Sdk7Typeface
{
/* The typeface and paint. */
public Typeface typeface;
@ -164,7 +164,7 @@ public class EmacsSdk7FontDriver extends EmacsFontDriver
}
};
protected class Sdk7FontEntity extends FontEntity
protected static final class Sdk7FontEntity extends FontEntity
{
/* The typeface. */
public Sdk7Typeface typeface;
@ -187,7 +187,7 @@ public class EmacsSdk7FontDriver extends EmacsFontDriver
}
};
protected class Sdk7FontObject extends FontObject
protected final class Sdk7FontObject extends FontObject
{
/* The typeface. */
public Sdk7Typeface typeface;

View file

@ -54,6 +54,8 @@ import android.content.res.AssetManager;
import android.database.Cursor;
import android.database.MatrixCursor;
import android.hardware.input.InputManager;
import android.net.Uri;
import android.os.BatteryManager;
@ -72,7 +74,7 @@ import android.provider.DocumentsContract.Document;
import android.util.Log;
import android.util.DisplayMetrics;
import android.hardware.input.InputManager;
import android.widget.Toast;
class Holder<T>
{
@ -821,4 +823,24 @@ public final class EmacsService extends Service
return new long[] { capacity, chargeCounter, currentAvg,
currentNow, remaining, status, };
}
/* Display the specified STRING in a small dialog box on the main
thread. */
public void
displayToast (final String string)
{
runOnUiThread (new Runnable () {
@Override
public void
run ()
{
Toast toast;
toast = Toast.makeText (getApplicationContext (),
string, Toast.LENGTH_SHORT);
toast.show ();
}
});
}
};

View file

@ -64,11 +64,12 @@ public final class EmacsWindow extends EmacsHandleObject
{
private static final String TAG = "EmacsWindow";
private class Coordinate
private static class Coordinate
{
/* Integral coordinate. */
int x, y;
public
Coordinate (int x, int y)
{
this.x = x;