]> git.eshelyaron.com Git - emacs.git/commitdiff
Circumvent another styling issue in Android 15 QPR1
authorPo Lu <luangruo@yahoo.com>
Tue, 4 Mar 2025 01:36:19 +0000 (09:36 +0800)
committerEshel Yaron <me@eshelyaron.com>
Tue, 4 Mar 2025 21:05:03 +0000 (22:05 +0100)
* java/org/gnu/emacs/EmacsView.java (popupMenu): On Android 15
and later, reload the default theme before displaying popup
menus.

(cherry picked from commit d6aea7cc948f13615237a91d347b0383a3089a8a)

java/org/gnu/emacs/EmacsView.java

index 938e2a21d1aad34c00c1f1b8e327ecacaf7c9058..8f16dbad257d41e675c9644b79c3da465bc5add9 100644 (file)
@@ -707,6 +707,8 @@ public final class EmacsView extends ViewGroup
   popupMenu (EmacsContextMenu menu, int xPosition,
             int yPosition, boolean force)
   {
+    ContextThemeWrapper context;
+
     if (popupActive && !force)
       return false;
 
@@ -720,6 +722,16 @@ public final class EmacsView extends ViewGroup
     contextMenu = menu;
     popupActive = true;
 
+    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM)
+      {
+       context = (ContextThemeWrapper) getContext ();
+       /* It is necessary to reload the current theme before attempting
+          to display a new popup menu, or any previously applied system
+          theme will continue to apply to it.  */
+       context.setTheme (R.style.EmacsStyleOpen);
+       context.setTheme (R.style.EmacsStyle);
+      }
+
     /* Use showContextMenu (float, float) on N to get actual popup
        behavior.  */
     if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)