aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-22 11:34:54 +0200
committerDanilo M. <danix@danix.xyz>2026-10-22 11:34:54 +0200
commit40b12e5b4cd6a4352e37cd1b6e85b1da10624436 (patch)
tree5d27bf60fe0e64ab876144fd27112654d3c5a3ca
parentfcef800cfe8d4eaba59bf345f5c0d8097ca5e1f7 (diff)
downloadmygram-droid-40b12e5b4cd6a4352e37cd1b6e85b1da10624436.tar.gz
mygram-droid-40b12e5b4cd6a4352e37cd1b6e85b1da10624436.zip
Mask password fields, submit login from the keyboard, size picker entries
setSingleLine() after setInputType() reset the password transformation, so the viewer password showed in clear text in setup and settings. On the TV the on-screen keyboard keeps the D-pad, so the keyboard done key now logs in. Instance entries wrap their text so the focus zoom no longer clips the first letter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
-rw-r--r--app/src/main/java/mygram/droid/SetupActivity.java11
-rw-r--r--app/src/main/java/mygram/droid/Ui.java4
2 files changed, 11 insertions, 4 deletions
diff --git a/app/src/main/java/mygram/droid/SetupActivity.java b/app/src/main/java/mygram/droid/SetupActivity.java
index 3f33d76..79686e6 100644
--- a/app/src/main/java/mygram/droid/SetupActivity.java
+++ b/app/src/main/java/mygram/droid/SetupActivity.java
@@ -18,6 +18,7 @@ import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.InputType;
+import android.view.View;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
@@ -61,7 +62,8 @@ public final class SetupActivity extends Activity {
t.setPadding(p * 2, p, p * 2, p);
Ui.focusable(t);
t.setOnClickListener(v -> choose(e.getKey()));
- box.addView(t);
+ box.addView(t, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
+ LinearLayout.LayoutParams.WRAP_CONTENT)); // full width the zoom clips the text
}
actions();
box.getChildAt(1).requestFocus();
@@ -106,7 +108,7 @@ public final class SetupActivity extends Activity {
reset("Viewer password for " + base);
EditText pw = Ui.field(this, "Password", Ui.password());
box.addView(pw);
- box.addView(Ui.iconButton(this, R.drawable.ic_check, "Log in", v -> {
+ View login = Ui.iconButton(this, R.drawable.ic_check, "Log in", v -> {
String s = pw.getText().toString();
Api.async(() -> {
Api.login(base, s);
@@ -114,7 +116,10 @@ public final class SetupActivity extends Activity {
}, ok -> save(base, s), e -> Toast.makeText(this,
e instanceof Api.HttpError && ((Api.HttpError) e).code == 401 ? "Wrong password" : e.getMessage(),
Toast.LENGTH_LONG).show());
- }));
+ });
+ box.addView(login);
+ // The keyboard's done key logs in; the D-pad cannot leave the keyboard.
+ pw.setOnEditorActionListener((v, action, event) -> login.performClick());
pw.requestFocus();
}
diff --git a/app/src/main/java/mygram/droid/Ui.java b/app/src/main/java/mygram/droid/Ui.java
index 852fe54..757b7fe 100644
--- a/app/src/main/java/mygram/droid/Ui.java
+++ b/app/src/main/java/mygram/droid/Ui.java
@@ -72,11 +72,13 @@ final class Ui {
static EditText field(Context c, String hint, int inputType) {
EditText e = new EditText(c);
e.setHint(hint);
+ // setSingleLine() resets the input type's transformation, unmasking
+ // passwords; it must come first.
+ e.setSingleLine(true);
e.setInputType(inputType);
e.setTextColor(Color.WHITE);
e.setHintTextColor(Color.GRAY);
e.setMinWidth(dp(c, 400));
- e.setSingleLine(true);
return e;
}