diff options
| author | Po Lu | 2025-03-03 21:57:05 +0800 |
|---|---|---|
| committer | Po Lu | 2025-03-03 21:59:41 +0800 |
| commit | 96d26b493618f59bbdd4de86be65e784735541c8 (patch) | |
| tree | eb1cc7d32aeea967c3676fb8a86b95b8866098f5 /java | |
| parent | f372508f68c9797f8d17cce0293526f3f30cb4c4 (diff) | |
| download | emacs-96d26b493618f59bbdd4de86be65e784735541c8.tar.gz emacs-96d26b493618f59bbdd4de86be65e784735541c8.zip | |
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.
Diffstat (limited to 'java')
| -rw-r--r-- | java/org/gnu/emacs/EmacsView.java | 47 | ||||
| -rw-r--r-- | java/res/values-v20/style.xml | 30 | ||||
| -rw-r--r-- | java/res/values-v29/style.xml | 8 | ||||
| -rw-r--r-- | java/res/values-v35/style.xml (renamed from java/res/values-v35/styles.xml) | 3 |
4 files changed, 65 insertions, 23 deletions
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; | |||
| 24 | import android.text.InputType; | 24 | import android.text.InputType; |
| 25 | 25 | ||
| 26 | import android.view.ContextMenu; | 26 | import android.view.ContextMenu; |
| 27 | import android.view.ContextThemeWrapper; | ||
| 27 | import android.view.DragEvent; | 28 | import android.view.DragEvent; |
| 28 | import android.view.View; | ||
| 29 | import android.view.KeyEvent; | 29 | import android.view.KeyEvent; |
| 30 | import android.view.MotionEvent; | 30 | import android.view.MotionEvent; |
| 31 | import android.view.View; | ||
| 31 | import android.view.ViewGroup; | 32 | import android.view.ViewGroup; |
| 32 | import android.view.ViewTreeObserver; | 33 | import android.view.ViewTreeObserver; |
| 33 | import android.view.WindowInsets; | 34 | import android.view.WindowInsets; |
| @@ -127,32 +128,36 @@ public final class EmacsView extends ViewGroup | |||
| 127 | public | 128 | public |
| 128 | EmacsView (EmacsWindow window) | 129 | EmacsView (EmacsWindow window) |
| 129 | { | 130 | { |
| 130 | super (EmacsService.SERVICE); | 131 | /* This is required to guarantee that popup menus respect the |
| 131 | 132 | default style. */ | |
| 132 | Object tem; | 133 | super (new ContextThemeWrapper (EmacsService.SERVICE, |
| 133 | Context context; | 134 | R.style.EmacsStyle)); |
| 135 | { | ||
| 136 | Object tem; | ||
| 137 | Context context; | ||
| 134 | 138 | ||
| 135 | this.window = window; | 139 | this.window = window; |
| 136 | this.damageRegion = new Region (); | 140 | this.damageRegion = new Region (); |
| 137 | 141 | ||
| 138 | setFocusable (true); | 142 | setFocusable (true); |
| 139 | setFocusableInTouchMode (true); | 143 | setFocusableInTouchMode (true); |
| 140 | 144 | ||
| 141 | /* Create the surface view. */ | 145 | /* Create the surface view. */ |
| 142 | this.surfaceView = new EmacsSurfaceView (this); | 146 | this.surfaceView = new EmacsSurfaceView (this); |
| 143 | addView (this.surfaceView); | 147 | addView (this.surfaceView); |
| 144 | 148 | ||
| 145 | /* Get rid of the default focus highlight. */ | 149 | /* Get rid of the default focus highlight. */ |
| 146 | if (Build.VERSION.SDK_INT > Build.VERSION_CODES.O) | 150 | if (Build.VERSION.SDK_INT > Build.VERSION_CODES.O) |
| 147 | setDefaultFocusHighlightEnabled (false); | 151 | setDefaultFocusHighlightEnabled (false); |
| 148 | 152 | ||
| 149 | /* Obtain the input method manager. */ | 153 | /* Obtain the input method manager. */ |
| 150 | context = getContext (); | 154 | context = getContext (); |
| 151 | tem = context.getSystemService (Context.INPUT_METHOD_SERVICE); | 155 | tem = context.getSystemService (Context.INPUT_METHOD_SERVICE); |
| 152 | imManager = (InputMethodManager) tem; | 156 | imManager = (InputMethodManager) tem; |
| 153 | 157 | ||
| 154 | /* Add this view as its own global layout listener. */ | 158 | /* Add this view as its own global layout listener. */ |
| 155 | getViewTreeObserver ().addOnGlobalLayoutListener (this); | 159 | getViewTreeObserver ().addOnGlobalLayoutListener (this); |
| 160 | } | ||
| 156 | } | 161 | } |
| 157 | 162 | ||
| 158 | private void | 163 | 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 @@ | |||
| 1 | <!-- Style resources for GNU Emacs on Android. | ||
| 2 | |||
| 3 | Copyright (C) 2025 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | This file is part of GNU Emacs. | ||
| 6 | |||
| 7 | GNU Emacs is free software: you can redistribute it and/or modify | ||
| 8 | it under the terms of the GNU General Public License as published by | ||
| 9 | the Free Software Foundation, either version 3 of the License, or | ||
| 10 | (at your option) any later version. | ||
| 11 | |||
| 12 | GNU Emacs is distributed in the hope that it will be useful, | ||
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | GNU General Public License for more details. | ||
| 16 | |||
| 17 | You should have received a copy of the GNU General Public License | ||
| 18 | along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. --> | ||
| 19 | |||
| 20 | <resources> | ||
| 21 | <!-- Style used for popup menus and relatives between Android 4.4 W | ||
| 22 | and Android 10. --> | ||
| 23 | <style name="EmacsStyle" | ||
| 24 | parent="@android:style/Theme.DeviceDefault.NoActionBar"> | ||
| 25 | <!-- Suppress the swipe-to-dismiss gesture enabled on certain | ||
| 26 | systems. --> | ||
| 27 | <item name="android:windowSwipeToDismiss">false</item> | ||
| 28 | </style> | ||
| 29 | <style name="EmacsStyleOpen" parent="@android:style/Theme.DeviceDefault"/> | ||
| 30 | </resources> | ||
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 | |||
| 18 | along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. --> | 18 | along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. --> |
| 19 | 19 | ||
| 20 | <resources> | 20 | <resources> |
| 21 | <!-- Style used for popup menus and relatives from Android 10.0 | 21 | <!-- Style used for popup menus and relatives from Android 10.0 to |
| 22 | onwards--> | 22 | 14.0. --> |
| 23 | <style name="EmacsStyle" parent="@android:style/Theme.DeviceDefault.DayNight"> | 23 | <style name="EmacsStyle" parent="@android:style/Theme.DeviceDefault.DayNight"> |
| 24 | <item name="android:windowActionBar">false</item> | 24 | <item name="android:windowActionBar">false</item> |
| 25 | <item name="android:windowNoTitle">true</item> | 25 | <item name="android:windowNoTitle">true</item> |
| 26 | 26 | ||
| 27 | <!-- Required to make sure the status bar text remains legible. --> | 27 | <!-- Required to make sure the status bar text remains legible. --> |
| 28 | <item name="android:statusBarColor">@android:color/black</item> | 28 | <item name="android:statusBarColor">@android:color/black</item> |
| 29 | |||
| 30 | <!-- Suppress the swipe-to-dismiss gesture enabled on certain | ||
| 31 | systems. --> | ||
| 32 | <item name="android:windowSwipeToDismiss">false</item> | ||
| 29 | </style> | 33 | </style> |
| 30 | <style name="EmacsStyleOpen" | 34 | <style name="EmacsStyleOpen" |
| 31 | parent="@android:style/Theme.DeviceDefault.DayNight"/> | 35 | parent="@android:style/Theme.DeviceDefault.DayNight"/> |
diff --git a/java/res/values-v35/styles.xml b/java/res/values-v35/style.xml index c0dc6479e18..0f7aeea5081 100644 --- a/java/res/values-v35/styles.xml +++ b/java/res/values-v35/style.xml | |||
| @@ -24,6 +24,9 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. --> | |||
| 24 | <item name="android:windowActionBar">false</item> | 24 | <item name="android:windowActionBar">false</item> |
| 25 | <item name="android:windowNoTitle">true</item> | 25 | <item name="android:windowNoTitle">true</item> |
| 26 | <item name="android:windowLightStatusBar">?android:attr/isLightTheme</item> | 26 | <item name="android:windowLightStatusBar">?android:attr/isLightTheme</item> |
| 27 | <!-- Suppress the swipe-to-dismiss gesture enabled on certain | ||
| 28 | systems. --> | ||
| 29 | <item name="android:windowSwipeToDismiss">false</item> | ||
| 27 | </style> | 30 | </style> |
| 28 | <style name="EmacsStyleOpen" | 31 | <style name="EmacsStyleOpen" |
| 29 | parent="@android:style/Theme.DeviceDefault.DayNight"/> | 32 | parent="@android:style/Theme.DeviceDefault.DayNight"/> |