From 96d26b493618f59bbdd4de86be65e784735541c8 Mon Sep 17 00:00:00 2001
From: Po Lu
Date: Mon, 3 Mar 2025 21:57:05 +0800
Subject: Fix styling issues on Android 15 QPR1
* java/org/gnu/emacs/EmacsView.java (EmacsView): Guarantee that
frame views are created with the correct theme.
* java/res/values-v20/style.xml (EmacsStyle):
* java/res/values-v29/style.xml (EmacsStyle): Disable a swiping
gesture enabled on certain Android systems.
* java/res/values-v35/style.xml: Rename from `styles'.xml.
---
java/org/gnu/emacs/EmacsView.java | 47 ++++++++++++++++++++++-----------------
java/res/values-v20/style.xml | 30 +++++++++++++++++++++++++
java/res/values-v29/style.xml | 8 +++++--
java/res/values-v35/style.xml | 33 +++++++++++++++++++++++++++
java/res/values-v35/styles.xml | 30 -------------------------
5 files changed, 95 insertions(+), 53 deletions(-)
create mode 100644 java/res/values-v20/style.xml
create mode 100644 java/res/values-v35/style.xml
delete mode 100644 java/res/values-v35/styles.xml
(limited to 'java')
diff --git a/java/org/gnu/emacs/EmacsView.java b/java/org/gnu/emacs/EmacsView.java
index 5abea711506..938e2a21d1a 100644
--- a/java/org/gnu/emacs/EmacsView.java
+++ b/java/org/gnu/emacs/EmacsView.java
@@ -24,10 +24,11 @@ import android.content.Context;
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;
@@ -127,32 +128,36 @@ public final class EmacsView extends ViewGroup
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
diff --git a/java/res/values-v20/style.xml b/java/res/values-v20/style.xml
new file mode 100644
index 00000000000..285cd61ced6
--- /dev/null
+++ b/java/res/values-v20/style.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
diff --git a/java/res/values-v29/style.xml b/java/res/values-v29/style.xml
index 5e6700a27e0..0ecfa7fc103 100644
--- a/java/res/values-v29/style.xml
+++ b/java/res/values-v29/style.xml
@@ -18,14 +18,18 @@ You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see . -->
-
+
diff --git a/java/res/values-v35/style.xml b/java/res/values-v35/style.xml
new file mode 100644
index 00000000000..0f7aeea5081
--- /dev/null
+++ b/java/res/values-v35/style.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
diff --git a/java/res/values-v35/styles.xml b/java/res/values-v35/styles.xml
deleted file mode 100644
index c0dc6479e18..00000000000
--- a/java/res/values-v35/styles.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
-
-
--
cgit v1.2.1