import android.text.InputType;
import android.view.ContextMenu;
+import android.view.ContextThemeWrapper;
import android.view.DragEvent;
-import android.view.View;
import android.view.KeyEvent;
import android.view.MotionEvent;
+import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.WindowInsets;
public
EmacsView (EmacsWindow window)
{
- super (EmacsService.SERVICE);
-
- Object tem;
- Context context;
+ /* This is required to guarantee that popup menus respect the
+ default style. */
+ super (new ContextThemeWrapper (EmacsService.SERVICE,
+ R.style.EmacsStyle));
+ {
+ Object tem;
+ Context context;
- this.window = window;
- this.damageRegion = new Region ();
+ this.window = window;
+ this.damageRegion = new Region ();
- setFocusable (true);
- setFocusableInTouchMode (true);
+ setFocusable (true);
+ setFocusableInTouchMode (true);
- /* Create the surface view. */
- this.surfaceView = new EmacsSurfaceView (this);
- addView (this.surfaceView);
+ /* Create the surface view. */
+ this.surfaceView = new EmacsSurfaceView (this);
+ addView (this.surfaceView);
- /* Get rid of the default focus highlight. */
- if (Build.VERSION.SDK_INT > Build.VERSION_CODES.O)
- setDefaultFocusHighlightEnabled (false);
+ /* Get rid of the default focus highlight. */
+ if (Build.VERSION.SDK_INT > Build.VERSION_CODES.O)
+ setDefaultFocusHighlightEnabled (false);
- /* Obtain the input method manager. */
- context = getContext ();
- tem = context.getSystemService (Context.INPUT_METHOD_SERVICE);
- imManager = (InputMethodManager) tem;
+ /* Obtain the input method manager. */
+ context = getContext ();
+ tem = context.getSystemService (Context.INPUT_METHOD_SERVICE);
+ imManager = (InputMethodManager) tem;
- /* Add this view as its own global layout listener. */
- getViewTreeObserver ().addOnGlobalLayoutListener (this);
+ /* Add this view as its own global layout listener. */
+ getViewTreeObserver ().addOnGlobalLayoutListener (this);
+ }
}
private void
--- /dev/null
+<!-- Style resources for GNU Emacs on Android.
+
+Copyright (C) 2025 Free Software Foundation, Inc.
+
+This file is part of GNU Emacs.
+
+GNU Emacs is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+GNU Emacs is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. -->
+
+<resources>
+ <!-- Style used for popup menus and relatives between Android 4.4 W
+ and Android 10. -->
+ <style name="EmacsStyle"
+ parent="@android:style/Theme.DeviceDefault.NoActionBar">
+ <!-- Suppress the swipe-to-dismiss gesture enabled on certain
+ systems. -->
+ <item name="android:windowSwipeToDismiss">false</item>
+ </style>
+ <style name="EmacsStyleOpen" parent="@android:style/Theme.DeviceDefault"/>
+</resources>
along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. -->
<resources>
- <!-- Style used for popup menus and relatives from Android 10.0
- onwards-->
+ <!-- Style used for popup menus and relatives from Android 10.0 to
+ 14.0. -->
<style name="EmacsStyle" parent="@android:style/Theme.DeviceDefault.DayNight">
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<!-- Required to make sure the status bar text remains legible. -->
<item name="android:statusBarColor">@android:color/black</item>
+
+ <!-- Suppress the swipe-to-dismiss gesture enabled on certain
+ systems. -->
+ <item name="android:windowSwipeToDismiss">false</item>
</style>
<style name="EmacsStyleOpen"
parent="@android:style/Theme.DeviceDefault.DayNight"/>
--- /dev/null
+<!-- Style resources for GNU Emacs on Android.
+
+Copyright (C) 2024-2025 Free Software Foundation, Inc.
+
+This file is part of GNU Emacs.
+
+GNU Emacs is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+GNU Emacs is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. -->
+
+<resources>
+ <!-- Style used for popup menus and relatives from Android 15.0
+ onwards. -->
+ <style name="EmacsStyle" parent="@android:style/Theme.DeviceDefault.DayNight">
+ <item name="android:windowActionBar">false</item>
+ <item name="android:windowNoTitle">true</item>
+ <item name="android:windowLightStatusBar">?android:attr/isLightTheme</item>
+ <!-- Suppress the swipe-to-dismiss gesture enabled on certain
+ systems. -->
+ <item name="android:windowSwipeToDismiss">false</item>
+ </style>
+ <style name="EmacsStyleOpen"
+ parent="@android:style/Theme.DeviceDefault.DayNight"/>
+</resources>
+++ /dev/null
-<!-- Style resources for GNU Emacs on Android.
-
-Copyright (C) 2024-2025 Free Software Foundation, Inc.
-
-This file is part of GNU Emacs.
-
-GNU Emacs is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-GNU Emacs is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. -->
-
-<resources>
- <!-- Style used for popup menus and relatives from Android 15.0
- onwards. -->
- <style name="EmacsStyle" parent="@android:style/Theme.DeviceDefault.DayNight">
- <item name="android:windowActionBar">false</item>
- <item name="android:windowNoTitle">true</item>
- <item name="android:windowLightStatusBar">?android:attr/isLightTheme</item>
- </style>
- <style name="EmacsStyleOpen"
- parent="@android:style/Theme.DeviceDefault.DayNight"/>
-</resources>