Skip to content

Commit 6df68ed

Browse files
committed
fix: menu layout bugs — camRow width, URL wrapping, interval OK button
- camRow uses WRAP_CONTENT to anchor popup width; all 8 buttons visible - Other menu items use MATCH_PARENT to stretch uniformly - createEdit: replaced setSingleLine with setMaxLines(3), cursor at start - Added explicit OK button in carousel interval row for D-pad remotes - Hide divider in Settings sub-menu - Bump version 1.17 → 1.18
1 parent cd29245 commit 6df68ed

File tree

2 files changed

+25
-19
lines changed

2 files changed

+25
-19
lines changed

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ android {
1818
applicationId "com.openipc.decoder"
1919
minSdk 21
2020
targetSdk 36
21-
versionCode 17
22-
versionName "1.17"
21+
versionCode 18
22+
versionName "1.18"
2323
}
2424

2525
// Signing credentials from environment variables; null when absent.

app/src/main/java/com/openipc/decoder/Decoder.java

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -534,22 +534,22 @@ private void createMenu(View menu) {
534534
LinearLayout.LayoutParams.WRAP_CONTENT, true);
535535
popup.showAtLocation(menu, Gravity.TOP | Gravity.START, 0, 0);
536536

537-
// camera slot selector: horizontal row [1] [2] [3] [4]
537+
// camRow must be WRAP_CONTENT to anchor the popup width to all 8 buttons;
538+
// other menu items use default MATCH_PARENT to stretch and align uniformly
538539
LinearLayout camRow = new LinearLayout(this);
539540
camRow.setOrientation(LinearLayout.HORIZONTAL);
540-
layout.addView(camRow);
541+
LinearLayout.LayoutParams wrapParams = new LinearLayout.LayoutParams(
542+
LinearLayout.LayoutParams.WRAP_CONTENT,
543+
LinearLayout.LayoutParams.WRAP_CONTENT);
544+
layout.addView(camRow, wrapParams);
541545

542546
LinearLayout header = new LinearLayout(this);
543547
header.setOrientation(LinearLayout.VERTICAL);
544548
header.setVisibility(View.GONE);
545549
layout.addView(header);
546550

547-
LinearLayout.LayoutParams wrapParams = new LinearLayout.LayoutParams(
548-
LinearLayout.LayoutParams.WRAP_CONTENT,
549-
LinearLayout.LayoutParams.WRAP_CONTENT);
550-
551551
TextView settings = createItem("Settings");
552-
layout.addView(settings, wrapParams);
552+
layout.addView(settings);
553553

554554
EditText host = createEdit(mHosts[mActive]);
555555
header.addView(host);
@@ -650,7 +650,7 @@ private void createMenu(View menu) {
650650
intervalRow.addView(intervalEdit, new LinearLayout.LayoutParams(
651651
0, LinearLayout.LayoutParams.WRAP_CONTENT, 1f));
652652

653-
// apply interval: extracted so it can be triggered by IME, Enter key, or focus loss
653+
// apply interval: extracted so it can be triggered by IME, Enter key, OK button, or focus loss
654654
Runnable applyInterval = () -> {
655655
try {
656656
int val = Integer.parseInt(intervalEdit.getText().toString().trim());
@@ -666,6 +666,12 @@ private void createMenu(View menu) {
666666
}
667667
};
668668

669+
// Explicit OK button for reliable apply on Android TV / D-pad remotes
670+
TextView okButton = createItem("OK");
671+
okButton.setPadding(dp(12), dp(6), dp(12), dp(6));
672+
intervalRow.addView(okButton);
673+
okButton.setOnClickListener(v -> applyInterval.run());
674+
669675
intervalEdit.setOnEditorActionListener((v, actionId, event) -> {
670676
if (actionId == EditorInfo.IME_ACTION_DONE
671677
|| (event != null && event.getKeyCode() == KeyEvent.KEYCODE_ENTER
@@ -699,17 +705,17 @@ private void createMenu(View menu) {
699705
});
700706

701707
TextView webui = createItem("WebUI");
702-
layout.addView(webui, wrapParams);
708+
layout.addView(webui);
703709
webui.setOnClickListener(v -> {
704710
startBrowser();
705711
popup.dismiss();
706712
});
707713

708-
layout.addView(carouselToggle, wrapParams);
709-
layout.addView(carouselPanel, wrapParams);
714+
layout.addView(carouselToggle);
715+
layout.addView(carouselPanel);
710716

711717
TextView quadToggle = createItem(quadEnabled ? "Quadrator: ON" : "Quadrator: OFF");
712-
layout.addView(quadToggle, wrapParams);
718+
layout.addView(quadToggle);
713719
quadToggle.setOnClickListener(v -> {
714720
popup.dismiss();
715721
if (quadEnabled) stopQuad(); else startQuad();
@@ -727,7 +733,7 @@ private void createMenu(View menu) {
727733
LinearLayout.LayoutParams.MATCH_PARENT, dp(1)));
728734

729735
TextView exit = createItem("Exit");
730-
layout.addView(exit, wrapParams);
736+
layout.addView(exit);
731737
exit.setText(s);
732738
exit.setOnClickListener(v -> finishAndRemoveTask());
733739

@@ -740,6 +746,7 @@ private void createMenu(View menu) {
740746
carouselToggle.setVisibility(closing ? View.VISIBLE : View.GONE);
741747
carouselPanel.setVisibility(View.GONE);
742748
quadToggle.setVisibility(closing ? View.VISIBLE : View.GONE);
749+
divider.setVisibility(closing ? View.VISIBLE : View.GONE);
743750
exit.setVisibility(closing ? View.VISIBLE : View.GONE);
744751
// expand to full width for the URL field; shrink back for the main menu
745752
popup.update(closing ? LinearLayout.LayoutParams.WRAP_CONTENT
@@ -781,11 +788,10 @@ private EditText createEdit(String title) {
781788
text.setTextColor(Color.WHITE);
782789
text.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
783790
text.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI);
784-
text.setSingleLine(true);
785-
text.setHorizontallyScrolling(false);
786-
text.setEllipsize(null);
791+
// Allow visual wrapping so long URLs are fully visible
792+
text.setMaxLines(3);
787793
text.setImeOptions(EditorInfo.IME_ACTION_DONE);
788-
text.setSelection(text.getText().length());
794+
text.setSelection(0);
789795
focusChange(text);
790796

791797
return text;

0 commit comments

Comments
 (0)