summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/org/gnu/emacs/EmacsActivity.java6
-rw-r--r--java/org/gnu/emacs/EmacsPreferencesActivity.java5
-rw-r--r--java/org/gnu/emacs/EmacsView.java21
-rw-r--r--java/org/gnu/emacs/EmacsWindow.java36
4 files changed, 49 insertions, 19 deletions
diff --git a/java/org/gnu/emacs/EmacsActivity.java b/java/org/gnu/emacs/EmacsActivity.java
index d377cf982ef..30eaf85805a 100644
--- a/java/org/gnu/emacs/EmacsActivity.java
+++ b/java/org/gnu/emacs/EmacsActivity.java
@@ -134,6 +134,10 @@ public class EmacsActivity extends Activity
layout.addView (window.view);
child.setConsumer (this);
+ /* If the window isn't no-focus-on-map, focus its view. */
+ if (!child.getDontFocusOnMap ())
+ window.view.requestFocus ();
+
/* If the activity is iconified, send that to the window. */
if (isPaused)
window.noticeIconified ();
@@ -233,7 +237,7 @@ public class EmacsActivity extends Activity
isPaused = true;
EmacsWindowAttachmentManager.MANAGER.noticeIconified (this);
- super.onResume ();
+ super.onPause ();
}
@Override
diff --git a/java/org/gnu/emacs/EmacsPreferencesActivity.java b/java/org/gnu/emacs/EmacsPreferencesActivity.java
index ed1db68f732..6cef7c37516 100644
--- a/java/org/gnu/emacs/EmacsPreferencesActivity.java
+++ b/java/org/gnu/emacs/EmacsPreferencesActivity.java
@@ -116,6 +116,11 @@ public class EmacsPreferencesActivity extends Activity
if (file.exists ())
file.delete ();
+
+ /* Make sure to clear EmacsApplication.dumpFileName, or
+ starting Emacs without restarting this program will
+ make Emacs try to load a nonexistent dump file. */
+ EmacsApplication.dumpFileName = null;
}
});
layout.addView (textView);
diff --git a/java/org/gnu/emacs/EmacsView.java b/java/org/gnu/emacs/EmacsView.java
index a1953f683bd..730ed02d4f1 100644
--- a/java/org/gnu/emacs/EmacsView.java
+++ b/java/org/gnu/emacs/EmacsView.java
@@ -22,12 +22,16 @@ package org.gnu.emacs;
import android.content.Context;
import android.content.res.ColorStateList;
+import android.text.InputType;
+
import android.view.ContextMenu;
import android.view.View;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.ViewGroup;
+import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputConnection;
import android.view.inputmethod.InputMethodManager;
import android.graphics.Bitmap;
@@ -566,6 +570,8 @@ public class EmacsView extends ViewGroup
/* Collect the bitmap storage; it could be large. */
Runtime.getRuntime ().gc ();
}
+
+ super.onDetachedFromWindow ();
}
@Override
@@ -581,6 +587,8 @@ public class EmacsView extends ViewGroup
/* Now expose the view contents again. */
EmacsNative.sendExpose (this.window.handle, 0, 0,
measuredWidth, measuredHeight);
+
+ super.onAttachedToWindow ();
}
public void
@@ -615,4 +623,17 @@ public class EmacsView extends ViewGroup
drawingFinished = null;
}
}
+
+ @Override
+ public InputConnection
+ onCreateInputConnection (EditorInfo info)
+ {
+ /* Make sure the input method never displays a full screen input
+ box that obscures Emacs. */
+ info.imeOptions = EditorInfo.IME_FLAG_NO_FULLSCREEN;
+
+ /* But don't return an InputConnection, in order to force the on
+ screen keyboard to work correctly. */
+ return null;
+ }
};
diff --git a/java/org/gnu/emacs/EmacsWindow.java b/java/org/gnu/emacs/EmacsWindow.java
index 39eaf2fff80..5c2b77b0125 100644
--- a/java/org/gnu/emacs/EmacsWindow.java
+++ b/java/org/gnu/emacs/EmacsWindow.java
@@ -124,9 +124,9 @@ public class EmacsWindow extends EmacsHandleObject
there is no such window manager. */
private WindowManager windowManager;
- /* The time of the last KEYCODE_VOLUME_DOWN press. This is used to
- quit Emacs. */
- private long lastVolumeButtonPress;
+ /* The time of the last KEYCODE_VOLUME_DOWN release. This is used
+ to quit Emacs. */
+ private long lastVolumeButtonRelease;
public
EmacsWindow (short handle, final EmacsWindow parent, int x, int y,
@@ -517,7 +517,6 @@ public class EmacsWindow extends EmacsHandleObject
onKeyDown (int keyCode, KeyEvent event)
{
int state, state_1;
- long time;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2)
state = event.getModifiers ();
@@ -549,26 +548,13 @@ public class EmacsWindow extends EmacsHandleObject
state, keyCode,
event.getUnicodeChar (state_1));
lastModifiers = state;
-
- if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)
- {
- /* Check if this volume down press should quit Emacs.
- Most Android devices have no physical keyboard, so it
- is unreasonably hard to press C-g. */
-
- time = event.getEventTime ();
-
- if (lastVolumeButtonPress - time < 350)
- EmacsNative.quit ();
-
- lastVolumeButtonPress = time;
- }
}
public void
onKeyUp (int keyCode, KeyEvent event)
{
int state, state_1;
+ long time;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2)
state = event.getModifiers ();
@@ -600,6 +586,20 @@ public class EmacsWindow extends EmacsHandleObject
state, keyCode,
event.getUnicodeChar (state_1));
lastModifiers = state;
+
+ if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)
+ {
+ /* Check if this volume down press should quit Emacs.
+ Most Android devices have no physical keyboard, so it
+ is unreasonably hard to press C-g. */
+
+ time = event.getEventTime ();
+
+ if (time - lastVolumeButtonRelease < 350)
+ EmacsNative.quit ();
+
+ lastVolumeButtonRelease = time;
+ }
}
public void