@cindex windowing limitations, android
@cindex frame parameters, android
-Due to the unusual nature of the Android windowing environment, Emacs
-only supports a limited subset of GUI features. Here is a list of
-known limitations, and features which are not implemented:
+Emacs only supports a limited subset of GUI features on Android; the
+limitations are as follows:
@itemize @bullet
@item
}
@Override
- public void
+ public final void
onDestroy ()
{
EmacsWindowAttachmentManager manager;
/* 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;
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. */
}
};
- public class FontMetrics
+ public static class FontMetrics
{
public short lbearing;
public short rbearing;
}
}
- public class FontEntity extends FontSpec
+ public static class FontEntity extends FontSpec
{
/* No extra fields here. */
};
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;
}
};
- protected class Sdk7FontEntity extends FontEntity
+ protected static final class Sdk7FontEntity extends FontEntity
{
/* The typeface. */
public Sdk7Typeface typeface;
}
};
- protected class Sdk7FontObject extends FontObject
+ protected final class Sdk7FontObject extends FontObject
{
/* The typeface. */
public Sdk7Typeface typeface;
import android.database.Cursor;
import android.database.MatrixCursor;
+import android.hardware.input.InputManager;
+
import android.net.Uri;
import android.os.BatteryManager;
import android.util.Log;
import android.util.DisplayMetrics;
-import android.hardware.input.InputManager;
+import android.widget.Toast;
class Holder<T>
{
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 ();
+ }
+ });
+ }
};
{
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;
jmethodID open_content_uri;
jmethodID check_content_uri;
jmethodID query_battery;
+ jmethodID display_toast;
};
struct android_emacs_pixmap
FIND_METHOD (check_content_uri, "checkContentUri",
"([BZZ)Z");
FIND_METHOD (query_battery, "queryBattery", "()[J");
+ FIND_METHOD (display_toast, "displayToast",
+ "(Ljava/lang/String;)V");
#undef FIND_METHOD
}
return 0;
}
+/* Display a small momentary notification on screen containing
+ TEXT, which must be in the modified UTF encoding used by the
+ JVM. */
+
+void
+android_display_toast (const char *text)
+{
+ jstring string;
+
+ /* Make the string. */
+ string = (*android_java_env)->NewStringUTF (android_java_env,
+ text);
+ android_exception_check ();
+
+ /* Display the toast. */
+ (*android_java_env)->CallVoidMethod (android_java_env,
+ emacs_service,
+ service_class.display_toast,
+ string);
+ android_exception_check_1 (string);
+
+ /* Delete the local reference to the string. */
+ ANDROID_DELETE_LOCAL_REF (string);
+}
+
\f
/* Whether or not a query is currently being made. */
extern Lisp_Object android_browse_url (Lisp_Object);
extern int android_query_battery (struct android_battery_state *);
+extern void android_display_toast (const char *);
\f
(void)
{
#ifndef ANDROID_STUBIFY
+ /* If no display connection is present, just return nil. */
+
+ if (!android_init_gui)
+ return Qnil;
+
return android_detect_mouse () ? Qt : Qnil;
#else
return Qnil;
{
jint rc;
+ if (!android_init_gui)
+ error ("Accessing clipboard without display connection");
+
block_input ();
rc = (*android_java_env)->CallIntMethod (android_java_env,
clipboard,
{
jarray bytes;
+ if (!android_init_gui)
+ error ("Accessing clipboard without display connection");
+
CHECK_STRING (string);
string = ENCODE_UTF_8 (string);
size_t length;
jbyte *data;
+ if (!android_init_gui)
+ error ("No Android display connection!");
+
method = clipboard_class.get_clipboard;
bytes
= (*android_java_env)->CallObjectMethod (android_java_env,
{
Lisp_Object value;
+ if (!android_init_gui)
+ error ("No Android display connection!");
+
CHECK_STRING (url);
value = android_browse_url (url);
if (event->xaction.action == 0)
{
- /* Action 0 either means to destroy a frame or to create a
- new frame, depending on whether or not
- event->xaction.window exists. */
+ /* Action 0 either means that a window has been destroyed
+ and its associated frame should be as well. */
if (event->xaction.window)
{
inev.ie.kind = DELETE_WINDOW_EVENT;
XSETFRAME (inev.ie.frame_or_window, f);
}
- else
- ((void) 0) /* A new frame must be created. */;
}
case ANDROID_ENTER_NOTIFY: