diff --git a/CHANGELOG.md b/CHANGELOG.md index b15c87b..22a481f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,11 @@ Versions after 2.17 are `MAJOR.MINOR.PATCH` (2.17 is followed by 2.17.1 or 2.18. `docs/testing.md`, "Versions and releases"); the headings below keep the numbers as they were released. +## 2.20.1 — 2026-11-04 + +- On Android 5 **Back** closes the open menu again; it did nothing, only OK or Esc closed it + (#265). + ## 2.20.0 — 2026-11-02 - A remote with only a D-pad now reaches the actions that were touch-only (#263). With the diff --git a/android/app/build.gradle b/android/app/build.gradle index 8c141c0..987c247 100755 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -23,8 +23,8 @@ android { applicationId "com.openipc.decoder" minSdk 21 targetSdk 36 - versionCode 50 - versionName "2.20.0" + versionCode 51 + versionName "2.20.1" buildConfigField "String", "GIT_HASH", "\"${getGitHash()}\"" } diff --git a/android/app/src/main/java/com/openipc/decoder/MenuManager.java b/android/app/src/main/java/com/openipc/decoder/MenuManager.java index 8c70382..16bf533 100644 --- a/android/app/src/main/java/com/openipc/decoder/MenuManager.java +++ b/android/app/src/main/java/com/openipc/decoder/MenuManager.java @@ -11,6 +11,7 @@ import android.app.AlertDialog; import android.app.Dialog; import android.graphics.Color; +import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.GradientDrawable; import android.net.Uri; import android.os.Build; @@ -162,15 +163,24 @@ private void track(Dialog dialog) { }); } + /** + * A focusable popup that closes on Back. Below Android 6 a popup takes Back only with a + * background of its own (#265), so it gets a transparent one. + */ + private PopupWindow menuPopup(View content) { + PopupWindow popup = new PopupWindow(content, LinearLayout.LayoutParams.WRAP_CONTENT, + LinearLayout.LayoutParams.WRAP_CONTENT, true); + popup.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); + return popup; + } + void showMenu(View anchor, boolean quadEnabled, int mActive, String version, String gitHash, String[] mHosts) { boolean single = !quadEnabled && !udpShown; if (mMenuIsCached) { updateCachedMenu(quadEnabled, mActive, mHosts); if (mMenuPopup != null) return; - mMenuPopup = new PopupWindow(mMenuLayout, - LinearLayout.LayoutParams.WRAP_CONTENT, - LinearLayout.LayoutParams.WRAP_CONTENT, true); + mMenuPopup = menuPopup(mMenuLayout); int margin = dp(12); mMenuPopup.showAtLocation(anchor, Gravity.TOP | Gravity.START, margin, margin); mMenuPopup.setOnDismissListener(() -> mMenuPopup = null); @@ -203,8 +213,7 @@ public boolean dispatchKeyEvent(KeyEvent event) { layout.setOrientation(LinearLayout.VERTICAL); layout.setFocusableInTouchMode(true); - PopupWindow popup = new PopupWindow(layout, LinearLayout.LayoutParams.WRAP_CONTENT, - LinearLayout.LayoutParams.WRAP_CONTENT, true); + PopupWindow popup = menuPopup(layout); int margin = dp(12); popup.showAtLocation(anchor, Gravity.TOP | Gravity.START, margin, margin); mMenuPopup = popup;