Skip to content

Commit df4a518

Browse files
committed
Revert "2-column settings layout: left=Credentials+Display, right=Network; full-width Debug Logs + System"
This reverts commit 5922029.
1 parent 5922029 commit df4a518

1 file changed

Lines changed: 57 additions & 77 deletions

File tree

src/com/bpmct/trmnl_nook_simple_touch/SettingsActivity.java

Lines changed: 57 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -60,35 +60,16 @@ protected void onCreate(Bundle savedInstanceState) {
6060
title.setTextColor(0xFF000000);
6161
main.addView(title);
6262

63-
// ── 2-column layout ──────────────────────────────────────────────
64-
LinearLayout columns = new LinearLayout(this);
65-
columns.setOrientation(LinearLayout.HORIZONTAL);
66-
LinearLayout.LayoutParams columnsParams = new LinearLayout.LayoutParams(
67-
ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
68-
columnsParams.topMargin = 4;
69-
70-
LinearLayout left = new LinearLayout(this);
71-
left.setOrientation(LinearLayout.VERTICAL);
72-
LinearLayout.LayoutParams leftParams = new LinearLayout.LayoutParams(
73-
0, ViewGroup.LayoutParams.WRAP_CONTENT, 1f);
74-
leftParams.rightMargin = 12;
75-
76-
LinearLayout right = new LinearLayout(this);
77-
right.setOrientation(LinearLayout.VERTICAL);
78-
LinearLayout.LayoutParams rightParams = new LinearLayout.LayoutParams(
79-
0, ViewGroup.LayoutParams.WRAP_CONTENT, 1f);
80-
81-
// ── LEFT: Credentials ────────────────────────────────────────────
82-
left.addView(createSectionLabel("Credentials"));
63+
// Credentials
64+
main.addView(createSectionLabel("Credentials"));
8365
statusView = new TextView(this);
8466
statusView.setTextSize(12);
8567
statusView.setTextColor(0xFF444444);
8668
statusView.setText(ApiPrefs.hasCredentials(this) ? "Configured" : "Not set");
8769
LinearLayout.LayoutParams statusParams = new LinearLayout.LayoutParams(
8870
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
89-
statusParams.topMargin = 4;
90-
left.addView(statusView, statusParams);
91-
71+
statusParams.topMargin = 6;
72+
main.addView(statusView, statusParams);
9273
Button editButton = createGreyButton("Edit Credentials");
9374
editButton.setOnClickListener(new View.OnClickListener() {
9475
public void onClick(View v) {
@@ -97,16 +78,38 @@ public void onClick(View v) {
9778
});
9879
LinearLayout.LayoutParams editParams = new LinearLayout.LayoutParams(
9980
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
100-
editParams.topMargin = 6;
101-
left.addView(editButton, editParams);
81+
editParams.topMargin = 8;
82+
main.addView(editButton, editParams);
83+
84+
// Display
85+
main.addView(createSectionLabel("Display"));
86+
allowSleepCheck = new CheckBox(this);
87+
allowSleepCheck.setText("Sleep between updates");
88+
allowSleepCheck.setTextColor(0xFF000000);
89+
allowSleepCheck.setChecked(ApiPrefs.isAllowSleep(this));
90+
main.addView(allowSleepCheck);
10291

92+
sleepHint = new TextView(this);
93+
sleepHint.setText("Set screensaver to TRMNL, sleep after 2 min");
94+
sleepHint.setTextSize(11);
95+
sleepHint.setTextColor(0xFF888888);
96+
sleepHint.setPadding(40, 0, 0, 0);
97+
sleepHint.setVisibility(allowSleepCheck.isChecked() ? View.VISIBLE : View.GONE);
98+
main.addView(sleepHint);
99+
100+
allowSleepCheck.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
101+
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
102+
sleepHint.setVisibility(isChecked ? View.VISIBLE : View.GONE);
103+
flashRefresh();
104+
}
105+
});
106+
107+
// Gift Mode
108+
main.addView(createSectionLabel("Gift Mode"));
103109
giftModeCheck = new CheckBox(this);
104-
giftModeCheck.setText("Gift mode");
110+
giftModeCheck.setText("Enable gift mode");
105111
giftModeCheck.setTextColor(0xFF000000);
106112
giftModeCheck.setChecked(ApiPrefs.isGiftModeEnabled(this));
107-
LinearLayout.LayoutParams giftCheckParams = new LinearLayout.LayoutParams(
108-
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
109-
giftCheckParams.topMargin = 6;
110113
giftModeCheck.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
111114
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
112115
updateGiftSettingsVisibility();
@@ -115,7 +118,7 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
115118
}
116119
}
117120
});
118-
left.addView(giftModeCheck, giftCheckParams);
121+
main.addView(giftModeCheck);
119122

120123
giftSettingsButton = createGreyButton("Configure Gift Mode");
121124
giftSettingsButton.setOnClickListener(new View.OnClickListener() {
@@ -125,79 +128,59 @@ public void onClick(View v) {
125128
});
126129
LinearLayout.LayoutParams giftBtnParams = new LinearLayout.LayoutParams(
127130
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
128-
giftBtnParams.topMargin = 4;
129-
left.addView(giftSettingsButton, giftBtnParams);
131+
giftBtnParams.topMargin = 6;
132+
main.addView(giftSettingsButton, giftBtnParams);
130133
updateGiftSettingsVisibility();
131134

132-
// ── LEFT: Display ─────────────────────────────────────────────────
133-
left.addView(createSectionLabel("Display"));
134-
allowSleepCheck = new CheckBox(this);
135-
allowSleepCheck.setText("Sleep between updates");
136-
allowSleepCheck.setTextColor(0xFF000000);
137-
allowSleepCheck.setChecked(ApiPrefs.isAllowSleep(this));
138-
left.addView(allowSleepCheck);
139-
140-
sleepHint = new TextView(this);
141-
sleepHint.setText("Screensaver + sleep 2 min");
142-
sleepHint.setTextSize(11);
143-
sleepHint.setTextColor(0xFF888888);
144-
sleepHint.setPadding(40, 0, 0, 0);
145-
sleepHint.setVisibility(allowSleepCheck.isChecked() ? View.VISIBLE : View.GONE);
146-
left.addView(sleepHint);
147-
148-
allowSleepCheck.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
149-
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
150-
sleepHint.setVisibility(isChecked ? View.VISIBLE : View.GONE);
151-
flashRefresh();
152-
}
153-
});
154-
155-
// ── RIGHT: Network ────────────────────────────────────────────────
156-
right.addView(createSectionLabel("Network"));
135+
// Network (for self-hosted/BYOS setups)
136+
main.addView(createSectionLabel("Network"));
157137
allowHttpCheck = new CheckBox(this);
158-
allowHttpCheck.setText("Allow HTTP");
138+
allowHttpCheck.setText("Allow HTTP (insecure)");
159139
allowHttpCheck.setTextColor(0xFF000000);
160140
allowHttpCheck.setChecked(ApiPrefs.isAllowHttp(this));
161-
right.addView(allowHttpCheck);
141+
main.addView(allowHttpCheck);
162142

163143
TextView httpHint = new TextView(this);
164-
httpHint.setText("For local/BYOS servers");
144+
httpHint.setText("Enable for local/BYOS servers without HTTPS");
165145
httpHint.setTextSize(11);
166146
httpHint.setTextColor(0xFF888888);
167147
httpHint.setPadding(40, 0, 0, 0);
168-
right.addView(httpHint);
148+
main.addView(httpHint);
169149

170150
allowSelfSignedCheck = new CheckBox(this);
171-
allowSelfSignedCheck.setText("Self-signed certs");
151+
allowSelfSignedCheck.setText("Allow self-signed certificates");
172152
allowSelfSignedCheck.setTextColor(0xFF000000);
173153
allowSelfSignedCheck.setChecked(ApiPrefs.isAllowSelfSignedCerts(this));
174154
LinearLayout.LayoutParams selfSignedParams = new LinearLayout.LayoutParams(
175155
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
176-
selfSignedParams.topMargin = 6;
177-
right.addView(allowSelfSignedCheck, selfSignedParams);
156+
selfSignedParams.topMargin = 8;
157+
main.addView(allowSelfSignedCheck, selfSignedParams);
158+
159+
TextView selfSignedHint = new TextView(this);
160+
selfSignedHint.setText("Trust HTTPS servers with self-signed certs");
161+
selfSignedHint.setTextSize(11);
162+
selfSignedHint.setTextColor(0xFF888888);
163+
selfSignedHint.setPadding(40, 0, 0, 0);
164+
main.addView(selfSignedHint);
178165

179166
autoDisableWifiCheck = new CheckBox(this);
180167
autoDisableWifiCheck.setText("Auto-disable WiFi");
181168
autoDisableWifiCheck.setTextColor(0xFF000000);
182169
autoDisableWifiCheck.setChecked(ApiPrefs.isAutoDisableWifi(this));
183170
LinearLayout.LayoutParams wifiParams = new LinearLayout.LayoutParams(
184171
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
185-
wifiParams.topMargin = 6;
186-
right.addView(autoDisableWifiCheck, wifiParams);
172+
wifiParams.topMargin = 8;
173+
main.addView(autoDisableWifiCheck, wifiParams);
187174

188175
TextView wifiHint = new TextView(this);
189-
wifiHint.setText("Save battery between fetches");
176+
wifiHint.setText("Turn off WiFi between fetches to save battery");
190177
wifiHint.setTextSize(11);
191178
wifiHint.setTextColor(0xFF888888);
192179
wifiHint.setPadding(40, 0, 0, 0);
193-
right.addView(wifiHint);
180+
main.addView(wifiHint);
194181

195-
columns.addView(left, leftParams);
196-
columns.addView(right, rightParams);
197-
main.addView(columns, columnsParams);
198-
199-
// ── Debug Logs (full width) ───────────────────────────────────────
200-
main.addView(createSectionLabel("Debug Logs"));
182+
// Debug & Device
183+
main.addView(createSectionLabel("Debug & Device"));
201184
fileLoggingCheck = new CheckBox(this);
202185
fileLoggingCheck.setText("Save logs to file");
203186
fileLoggingCheck.setTextColor(0xFF000000);
@@ -222,9 +205,6 @@ public void onClick(View v) {
222205
clearParams.topMargin = 6;
223206
main.addView(clearLogsButton, clearParams);
224207

225-
// ── System (full width) ───────────────────────────────────────────
226-
main.addView(createSectionLabel("System"));
227-
228208
LinearLayout deviceRow = new LinearLayout(this);
229209
deviceRow.setOrientation(LinearLayout.HORIZONTAL);
230210
LinearLayout.LayoutParams deviceRowParams = new LinearLayout.LayoutParams(

0 commit comments

Comments
 (0)