v0.2.0: bubble for Android 0.2.0 — chat search, swipe for unread, faster chat opening
Desktop: - Search lists chats whose own name matches first, so a named group isn't pushed out of the top 8 by chats that merely include a member. Android (Rabbit R1) app, 0.2.0: - Pull the chat list past its top for a search box (name, person, number, then group members; archived chats too; Back clears it). - Swipe right to left marks a chat unread / read over a magenta band; left to right still archives (SwipeActions replaces SwipeArchive). - Google Voice chats don't offer voice notes in the paperclip bubble. - Chats open with their newest 60 messages, then the full history; marking read (and the Google Voice network call) waits until they're on screen. Cached pictures show at once, and one slow download no longer blocks the other images. Fixed a contacts reload race. - Sandbox data gains filler chats, a named group and a 4,000-message chat. Also: the Android app, Google Voice support, media, export, emoji and the other work since the first commit, and a CLAUDE.md carrying the privacy rule.
This commit is contained in:
@@ -0,0 +1,123 @@
|
||||
package me.teafry.voipmessages;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.Switch;
|
||||
import android.widget.TextView;
|
||||
|
||||
/** Background checks, notifications, and what's connected. */
|
||||
public final class SettingsActivity extends BaseActivity {
|
||||
private static final int[] INTERVALS = {0, 5, 10, 15, 30, 60, 120};
|
||||
private LinearLayout box;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle b) {
|
||||
super.onCreate(b);
|
||||
ScrollView scroll = new ScrollView(this);
|
||||
box = new LinearLayout(this);
|
||||
box.setOrientation(LinearLayout.VERTICAL);
|
||||
box.setPadding(Ui.dp(this, 28), Ui.dp(this, 12), Ui.dp(this, 28), Ui.dp(this, 28));
|
||||
scroll.addView(box);
|
||||
setContentView(scroll);
|
||||
}
|
||||
|
||||
private static String intervalLabel(int m) {
|
||||
if (m == 0) return "Never (pull to refresh)";
|
||||
if (m < 60) return "Every " + m + " minutes";
|
||||
return m == 60 ? "Every hour" : "Every " + (m / 60) + " hours";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changed() {
|
||||
if (box == null) return;
|
||||
Context c = this;
|
||||
box.removeAllViews();
|
||||
box.addView(Ui.bold(Ui.text(c, "Settings", Ui.T_TITLE, Ui.TEXT)));
|
||||
|
||||
section("Checking for messages");
|
||||
int current = Config.pollMinutes(c);
|
||||
row("In the background", intervalLabel(current), v -> {
|
||||
String[] labels = new String[INTERVALS.length];
|
||||
int sel = 0;
|
||||
for (int i = 0; i < INTERVALS.length; i++) {
|
||||
labels[i] = intervalLabel(INTERVALS[i]);
|
||||
if (INTERVALS[i] == current) sel = i;
|
||||
}
|
||||
new AlertDialog.Builder(c).setTitle("Check in the background").setSingleChoiceItems(labels, sel, (d, i) -> {
|
||||
Config.prefs(c).edit().putInt("pollMinutes", INTERVALS[i]).apply();
|
||||
Alarms.schedule(c);
|
||||
d.dismiss();
|
||||
changed();
|
||||
}).show();
|
||||
});
|
||||
String last = Store.get(c).get("last_poll");
|
||||
note(last == null ? "Not checked yet. Pull down on the chat list to check now."
|
||||
: "Last checked " + Ui.shortTime(c, Long.parseLong(last)).toLowerCase() + ". Pull down on the chat list to check now.");
|
||||
|
||||
Switch notify = new Switch(c);
|
||||
notify.setText("Notifications for new messages");
|
||||
notify.setTextColor(Ui.TEXT);
|
||||
notify.setTextSize(Ui.T_SMALL + 2);
|
||||
notify.setChecked(Config.notifications(c));
|
||||
notify.setPadding(0, Ui.dp(c, 16), 0, Ui.dp(c, 16));
|
||||
notify.setOnCheckedChangeListener((v, on) -> Config.prefs(c).edit().putBoolean("notifications", on).apply());
|
||||
box.addView(notify);
|
||||
|
||||
section("Accounts");
|
||||
Config cfg = Config.get(c);
|
||||
kv("voip.ms", cfg.voipUser == null ? "Not set up" : Sync.voipError != null ? "⚠ " + Sync.voipError : cfg.voipUser);
|
||||
for (Config.Did d : cfg.dids) if (!d.gv) kv(" Number", Phone.format(d.did) + (d.description.isEmpty() ? "" : " · " + d.description));
|
||||
kv("Google Voice", cfg.gvNumber == null ? "Not set up"
|
||||
: Sync.gvSignedOut ? "⚠ Signed out" : Sync.gvError != null ? "⚠ " + Sync.gvError : Phone.format(cfg.gvNumber));
|
||||
note("Accounts come from the desktop app: Settings → Rabbit → Sync to Rabbit copies them here again (e.g. after reconnecting Google Voice there).");
|
||||
|
||||
section("About");
|
||||
String version = "?";
|
||||
try {
|
||||
PackageInfo p = getPackageManager().getPackageInfo(getPackageName(), 0);
|
||||
version = p.versionName;
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
kv("Version", version);
|
||||
}
|
||||
|
||||
private void section(String title) {
|
||||
TextView t = Ui.bold(Ui.text(this, title.toUpperCase(), Ui.T_TINY, Ui.MUTED));
|
||||
t.setPadding(0, Ui.dp(this, 28), 0, Ui.dp(this, 6));
|
||||
box.addView(t);
|
||||
}
|
||||
|
||||
private void note(String s) {
|
||||
TextView t = Ui.text(this, s, Ui.T_TINY, Ui.FAINT);
|
||||
t.setPadding(0, Ui.dp(this, 4), 0, Ui.dp(this, 8));
|
||||
box.addView(t);
|
||||
}
|
||||
|
||||
private void kv(String k, String v) {
|
||||
LinearLayout r = new LinearLayout(this);
|
||||
r.setPadding(0, Ui.dp(this, 8), 0, Ui.dp(this, 8));
|
||||
r.addView(Ui.text(this, k, Ui.T_SMALL, Ui.TEXT), new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1));
|
||||
TextView val = Ui.text(this, v, Ui.T_SMALL, Ui.MUTED);
|
||||
val.setGravity(Gravity.END);
|
||||
r.addView(val, new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1.4f));
|
||||
box.addView(r);
|
||||
}
|
||||
|
||||
private void row(String label, String value, View.OnClickListener onClick) {
|
||||
LinearLayout r = new LinearLayout(this);
|
||||
r.setOrientation(LinearLayout.VERTICAL);
|
||||
r.setPadding(Ui.dp(this, 20), Ui.dp(this, 14), Ui.dp(this, 20), Ui.dp(this, 14));
|
||||
r.setBackground(Ui.round(Ui.INPUT, Ui.dp(this, 16)));
|
||||
r.addView(Ui.text(this, label, Ui.T_SMALL, Ui.TEXT));
|
||||
r.addView(Ui.text(this, value, Ui.T_SMALL, Ui.ACCENT));
|
||||
r.setOnClickListener(onClick);
|
||||
box.addView(r);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user