aboutsummaryrefslogtreecommitdiffstats
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
134 layout.addView (window.view); 134 layout.addView (window.view);
135 child.setConsumer (this); 135 child.setConsumer (this);
136 136
137 /* If the window isn't no-focus-on-map, focus its view. */
138 if (!child.getDontFocusOnMap ())
139 window.view.requestFocus ();
140
137 /* If the activity is iconified, send that to the window. */ 141 /* If the activity is iconified, send that to the window. */
138 if (isPaused) 142 if (isPaused)
139 window.noticeIconified (); 143 window.noticeIconified ();
@@ -233,7 +237,7 @@ public class EmacsActivity extends Activity
233 isPaused = true; 237 isPaused = true;
234 238
235 EmacsWindowAttachmentManager.MANAGER.noticeIconified (this); 239 EmacsWindowAttachmentManager.MANAGER.noticeIconified (this);
236 super.onResume (); 240 super.onPause ();
237 } 241 }
238 242
239 @Override 243 @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
116 116
117 if (file.exists ()) 117 if (file.exists ())
118 file.delete (); 118 file.delete ();
119
120 /* Make sure to clear EmacsApplication.dumpFileName, or
121 starting Emacs without restarting this program will
122 make Emacs try to load a nonexistent dump file. */
123 EmacsApplication.dumpFileName = null;
119 } 124 }
120 }); 125 });
121 layout.addView (textView); 126 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;
22import android.content.Context; 22import android.content.Context;
23import android.content.res.ColorStateList; 23import android.content.res.ColorStateList;
24 24
25import android.text.InputType;
26
25import android.view.ContextMenu; 27import android.view.ContextMenu;
26import android.view.View; 28import android.view.View;
27import android.view.KeyEvent; 29import android.view.KeyEvent;
28import android.view.MotionEvent; 30import android.view.MotionEvent;
29import android.view.ViewGroup; 31import android.view.ViewGroup;
30 32
33import android.view.inputmethod.EditorInfo;
34import android.view.inputmethod.InputConnection;
31import android.view.inputmethod.InputMethodManager; 35import android.view.inputmethod.InputMethodManager;
32 36
33import android.graphics.Bitmap; 37import android.graphics.Bitmap;
@@ -566,6 +570,8 @@ public class EmacsView extends ViewGroup
566 /* Collect the bitmap storage; it could be large. */ 570 /* Collect the bitmap storage; it could be large. */
567 Runtime.getRuntime ().gc (); 571 Runtime.getRuntime ().gc ();
568 } 572 }
573
574 super.onDetachedFromWindow ();
569 } 575 }
570 576
571 @Override 577 @Override
@@ -581,6 +587,8 @@ public class EmacsView extends ViewGroup
581 /* Now expose the view contents again. */ 587 /* Now expose the view contents again. */
582 EmacsNative.sendExpose (this.window.handle, 0, 0, 588 EmacsNative.sendExpose (this.window.handle, 0, 0,
583 measuredWidth, measuredHeight); 589 measuredWidth, measuredHeight);
590
591 super.onAttachedToWindow ();
584 } 592 }
585 593
586 public void 594 public void
@@ -615,4 +623,17 @@ public class EmacsView extends ViewGroup
615 drawingFinished = null; 623 drawingFinished = null;
616 } 624 }
617 } 625 }
626
627 @Override
628 public InputConnection
629 onCreateInputConnection (EditorInfo info)
630 {
631 /* Make sure the input method never displays a full screen input
632 box that obscures Emacs. */
633 info.imeOptions = EditorInfo.IME_FLAG_NO_FULLSCREEN;
634
635 /* But don't return an InputConnection, in order to force the on
636 screen keyboard to work correctly. */
637 return null;
638 }
618}; 639};
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
124 there is no such window manager. */ 124 there is no such window manager. */
125 private WindowManager windowManager; 125 private WindowManager windowManager;
126 126
127 /* The time of the last KEYCODE_VOLUME_DOWN press. This is used to 127 /* The time of the last KEYCODE_VOLUME_DOWN release. This is used
128 quit Emacs. */ 128 to quit Emacs. */
129 private long lastVolumeButtonPress; 129 private long lastVolumeButtonRelease;
130 130
131 public 131 public
132 EmacsWindow (short handle, final EmacsWindow parent, int x, int y, 132 EmacsWindow (short handle, final EmacsWindow parent, int x, int y,
@@ -517,7 +517,6 @@ public class EmacsWindow extends EmacsHandleObject
517 onKeyDown (int keyCode, KeyEvent event) 517 onKeyDown (int keyCode, KeyEvent event)
518 { 518 {
519 int state, state_1; 519 int state, state_1;
520 long time;
521 520
522 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) 521 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2)
523 state = event.getModifiers (); 522 state = event.getModifiers ();
@@ -549,26 +548,13 @@ public class EmacsWindow extends EmacsHandleObject
549 state, keyCode, 548 state, keyCode,
550 event.getUnicodeChar (state_1)); 549 event.getUnicodeChar (state_1));
551 lastModifiers = state; 550 lastModifiers = state;
552
553 if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)
554 {
555 /* Check if this volume down press should quit Emacs.
556 Most Android devices have no physical keyboard, so it
557 is unreasonably hard to press C-g. */
558
559 time = event.getEventTime ();
560
561 if (lastVolumeButtonPress - time < 350)
562 EmacsNative.quit ();
563
564 lastVolumeButtonPress = time;
565 }
566 } 551 }
567 552
568 public void 553 public void
569 onKeyUp (int keyCode, KeyEvent event) 554 onKeyUp (int keyCode, KeyEvent event)
570 { 555 {
571 int state, state_1; 556 int state, state_1;
557 long time;
572 558
573 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) 559 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2)
574 state = event.getModifiers (); 560 state = event.getModifiers ();
@@ -600,6 +586,20 @@ public class EmacsWindow extends EmacsHandleObject
600 state, keyCode, 586 state, keyCode,
601 event.getUnicodeChar (state_1)); 587 event.getUnicodeChar (state_1));
602 lastModifiers = state; 588 lastModifiers = state;
589
590 if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)
591 {
592 /* Check if this volume down press should quit Emacs.
593 Most Android devices have no physical keyboard, so it
594 is unreasonably hard to press C-g. */
595
596 time = event.getEventTime ();
597
598 if (time - lastVolumeButtonRelease < 350)
599 EmacsNative.quit ();
600
601 lastVolumeButtonRelease = time;
602 }
603 } 603 }
604 604
605 public void 605 public void