From 19e2588df50f7e7be8d1f57c7efbf00ede6d00c4 Mon Sep 17 00:00:00 2001 From: Compot Developer Date: Fri, 20 Nov 2026 17:33:36 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20Settings=20=E2=80=94=20Cancel=20and=20Sa?= =?UTF-8?q?ve=20as=20two=20equal=20halves,=206dp=20after=20a=20radio's=20t?= =?UTF-8?q?ext=20(2.27.2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Brass rules the brand review found missed in 2.27.1 (#292): on Android TV the dialog's buttons were small, packed left and in the order Save, Cancel; the Proto radios had no space after the text, so the TCP focus ring lay on its last letter. Closes #292 --- CHANGELOG.md | 8 ++++ android/app/build.gradle | 4 +- .../main/java/com/openipc/decoder/Brass.java | 39 ++++++++++++++++++- .../com/openipc/decoder/NetworkPanel.java | 1 + 4 files changed, 48 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cbeca0f..b6dd9c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,14 @@ 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.27.2 — 2026-11-20 + +- The Settings dialog follows two brass rules it missed (#292): Cancel on the left and Save on + the right, two equal halves across the window (they were small, pressed to the left and in the + order Save, Cancel on Android TV); check boxes and radio buttons get 6dp after their text too, + so the Proto UDP text no longer touches the TCP ring and the focus frame of TCP no longer + lies on its last letter. + ## 2.27.1 — 2026-11-19 - Check boxes and radio buttons of the brass dialogs show on and off under the remote's focus diff --git a/android/app/build.gradle b/android/app/build.gradle index ccc12bb..6f3195c 100755 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -26,8 +26,8 @@ android { applicationId "com.openipc.decoder" minSdk 21 targetSdk 36 - versionCode 64 - versionName "2.27.1" + versionCode 65 + versionName "2.27.2" // Keep only these locales of the libraries' resources, as in the other OpenIPC apps resourceConfigurations += ['en', 'ru', 'zh-rCN'] diff --git a/android/app/src/main/java/com/openipc/decoder/Brass.java b/android/app/src/main/java/com/openipc/decoder/Brass.java index 9da9141..8f7d4ad 100644 --- a/android/app/src/main/java/com/openipc/decoder/Brass.java +++ b/android/app/src/main/java/com/openipc/decoder/Brass.java @@ -167,6 +167,39 @@ static void style(AlertDialog dialog) { } } + /** + * The buttons of a settings window (brass, 2026-11-20, as camex 4.3.1): Cancel on the left, + * Save on the right, two equal halves across the window with 6dp around each. The dialog's + * own button bar is reused; on Android TV it puts the positive button first and packs the + * buttons to the left, so it is reordered here. Call after {@link #style}. + */ + static void halves(AlertDialog dialog) { + Button cancel = dialog.getButton(AlertDialog.BUTTON_NEGATIVE); + Button save = dialog.getButton(AlertDialog.BUTTON_POSITIVE); + if (cancel == null || save == null || cancel.getParent() != save.getParent() + || !(save.getParent() instanceof LinearLayout)) return; + LinearLayout bar = (LinearLayout) save.getParent(); + for (int i = 0; i < bar.getChildCount(); i++) { + View v = bar.getChildAt(i); + if (v != cancel && v != save) v.setVisibility(View.GONE); + } + bar.removeView(cancel); + bar.removeView(save); + bar.setOrientation(LinearLayout.HORIZONTAL); + ViewGroup.LayoutParams blp = bar.getLayoutParams(); + if (blp != null) { + blp.width = ViewGroup.LayoutParams.MATCH_PARENT; + bar.setLayoutParams(blp); + } + int m = Math.round(6 * dp(dialog.getContext())); + for (Button b : new Button[]{cancel, save}) { + LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(0, + ViewGroup.LayoutParams.WRAP_CONTENT, 1); + lp.setMargins(m, m, m, m); + bar.addView(b, lp); + } + } + /** A dialog button as a brass key: serif capitals in dark ink, a little apart. */ private static void key(Context c, Button b) { b.setBackground(keyStates(c)); @@ -200,8 +233,10 @@ private static void styleTree(Context c, View v) { b.setButtonDrawable(b instanceof android.widget.RadioButton ? R.drawable.brass_radio : R.drawable.brass_check); int pad = Math.round(6 * dp(c)); - b.setPadding(Math.max(b.getPaddingLeft(), pad), b.getPaddingTop(), b.getPaddingRight(), - b.getPaddingBottom()); + // 6dp before the text and 6dp after it: the focus ring of a box as wide as its text + // would lie on its last letter, and a radio's text would touch the next ring (#292) + b.setPadding(Math.max(b.getPaddingLeft(), pad), b.getPaddingTop(), + Math.max(b.getPaddingRight(), pad), b.getPaddingBottom()); // the remote's focus (focus_ring.xml): views made with the activity's context miss // the dialog theme's checkboxStyle b.setBackgroundResource(R.drawable.focus_ring); diff --git a/android/app/src/main/java/com/openipc/decoder/NetworkPanel.java b/android/app/src/main/java/com/openipc/decoder/NetworkPanel.java index 66064d2..eb33367 100644 --- a/android/app/src/main/java/com/openipc/decoder/NetworkPanel.java +++ b/android/app/src/main/java/com/openipc/decoder/NetworkPanel.java @@ -463,6 +463,7 @@ protected void onMeasure(int widthSpec, int heightSpec) { Brass.frame(dialog); dialog.show(); Brass.style(dialog); + Brass.halves(dialog); } /** The state line of the Network screen. */