v0.24.0: R1 app 0.18.0 — a high-contrast dark look with bigger text, the status bar matches the header, suggestions indented less, a block's times line up with its name; a font for the note's text; installing on the R1 works when adb runs as root

This commit is contained in:
2026-11-21 13:51:02 -08:00
parent 5ea848bddc
commit 069fb3bfd9
9 changed files with 65 additions and 16 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ import subprocess
import sys import sys
import zipfile import zipfile
VERSION_NAME = "0.17.0" VERSION_NAME = "0.18.0"
PKG = "me.teafry.routine" PKG = "me.teafry.routine"
HERE = os.path.dirname(os.path.abspath(__file__)) HERE = os.path.dirname(os.path.abspath(__file__))
REPO = os.path.dirname(HERE) REPO = os.path.dirname(HERE)
@@ -106,6 +106,18 @@ public final class MainActivity extends Activity {
private SwipeFrame swipe; private SwipeFrame swipe;
// ── setup ── // ── setup ──
/** The status bar takes the header's colour (behind the date); dark icons on the light look (rabbit.html#statusbar). */
private void statusBar() {
android.view.Window w = getWindow();
w.addFlags(android.view.WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
w.clearFlags(android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
w.setStatusBarColor(Ui.BG);
View d = w.getDecorView();
int f = d.getSystemUiVisibility();
f = Ui.light ? f | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR : f & ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
d.setSystemUiVisibility(f);
}
@Override @Override
protected void onCreate(Bundle b) { protected void onCreate(Bundle b) {
super.onCreate(b); super.onCreate(b);
@@ -147,6 +159,7 @@ public final class MainActivity extends Activity {
anim = new AnimView(this, assetOr("animations.json", "{}")); anim = new AnimView(this, assetOr("animations.json", "{}"));
root.addView(anim, new FrameLayout.LayoutParams(-1, -1)); root.addView(anim, new FrameLayout.LayoutParams(-1, -1));
setContentView(root); setContentView(root);
statusBar();
today = Model.routineDate(schedule); today = Model.routineDate(schedule);
show(today, true); show(today, true);
@@ -200,6 +213,11 @@ public final class MainActivity extends Activity {
} }
private TextView text(String s, float sp, int color, boolean bold) { private TextView text(String s, float sp, int color, boolean bold) {
return text(s, sp * Ui.SCALE, color, bold, true);
}
/** As text(), at sp exactly: the bottom bar's tiles, which must fit its fixed height in both looks. */
private TextView text(String s, float sp, int color, boolean bold, boolean exact) {
TextView t = new TextView(this); TextView t = new TextView(this);
t.setText(s); t.setText(s);
t.setTextSize(TypedValue.COMPLEX_UNIT_SP, sp); t.setTextSize(TypedValue.COMPLEX_UNIT_SP, sp);
@@ -223,9 +241,9 @@ public final class MainActivity extends Activity {
bar.setPadding(dp(12), dp(8), dp(12), dp(8)); bar.setPadding(dp(12), dp(8), dp(12), dp(8));
bar.setBackgroundColor(Ui.BAR_BG); bar.setBackgroundColor(Ui.BAR_BG);
int line = Math.max(2, dp(1)); // the light look's outline, shared where tiles meet int line = Math.max(2, dp(1)); // the light look's outline, shared where tiles meet
tileAll = text("All", Ui.TEXT_SMALL + 2, Ui.FG, false); tileAll = text("All", Ui.TEXT_SMALL + 2, Ui.FG, false, true);
tileInc = text("To do", Ui.TEXT_SMALL + 2, Ui.FG, false); // the desktop's Incomplete, tileInc = text("To do", Ui.TEXT_SMALL + 2, Ui.FG, false, true); // the desktop's Incomplete,
tileDone = text("Done", Ui.TEXT_SMALL + 2, Ui.FG, false); // and Completed: short to fit tileDone = text("Done", Ui.TEXT_SMALL + 2, Ui.FG, false, true); // and Completed: short to fit
for (TextView t : new TextView[] {tileAll, tileInc, tileDone}) { for (TextView t : new TextView[] {tileAll, tileInc, tileDone}) {
t.setGravity(Gravity.CENTER); t.setGravity(Gravity.CENTER);
t.setPadding(dp(16), 0, dp(16), 0); t.setPadding(dp(16), 0, dp(16), 0);
@@ -411,7 +429,7 @@ public final class MainActivity extends Activity {
nl.setPadding(dp(16), dp(14), dp(16), dp(8)); nl.setPadding(dp(16), dp(14), dp(16), dp(8));
content.addView(nl); content.addView(nl);
note = new EditText(this); note = new EditText(this);
note.setTextSize(TypedValue.COMPLEX_UNIT_SP, Ui.TEXT_BODY); note.setTextSize(TypedValue.COMPLEX_UNIT_SP, Ui.TEXT_BODY * Ui.SCALE);
note.setTextColor(Ui.FG); note.setTextColor(Ui.FG);
note.setGravity(Gravity.TOP | Gravity.START); note.setGravity(Gravity.TOP | Gravity.START);
note.setMinHeight(dp(220)); note.setMinHeight(dp(220));
@@ -546,7 +564,7 @@ public final class MainActivity extends Activity {
h.block = b; h.block = b;
LinearLayout v = new LinearLayout(this); LinearLayout v = new LinearLayout(this);
v.setOrientation(LinearLayout.HORIZONTAL); v.setOrientation(LinearLayout.HORIZONTAL);
v.setGravity(Gravity.CENTER_VERTICAL); v.setBaselineAligned(true); // the name, hours and helper share one text baseline, as on the desktop
int color = blockColor(b); int color = blockColor(b);
if (style.equals("heading")) { // a little taller than before: it's a tap target now if (style.equals("heading")) { // a little taller than before: it's a tap target now
v.setPadding(dp(16), dp(16), dp(16), dp(16)); v.setPadding(dp(16), dp(16), dp(16), dp(16));
@@ -561,6 +579,7 @@ public final class MainActivity extends Activity {
chip.setBackground(rounded(color, color, 0, dp(6))); chip.setBackground(rounded(color, color, 0, dp(6)));
LinearLayout.LayoutParams cp = new LinearLayout.LayoutParams(dp(26), dp(26)); LinearLayout.LayoutParams cp = new LinearLayout.LayoutParams(dp(26), dp(26));
cp.setMargins(0, 0, dp(14), 0); cp.setMargins(0, 0, dp(14), 0);
cp.gravity = Gravity.CENTER_VERTICAL; // a swatch has no baseline: it sits in the middle
v.addView(chip, cp); v.addView(chip, cp);
} }
v.addView(text(b.optString("label"), Ui.TEXT_BIG, Ui.FG, true)); v.addView(text(b.optString("label"), Ui.TEXT_BIG, Ui.FG, true));
@@ -590,7 +609,7 @@ public final class MainActivity extends Activity {
v.setMinimumHeight(0); v.setMinimumHeight(0);
r.label = text(it.optString("label"), Ui.TEXT_SUB, Ui.GRAY, false); r.label = text(it.optString("label"), Ui.TEXT_SUB, Ui.GRAY, false);
r.label.setTypeface(r.label.getTypeface(), android.graphics.Typeface.ITALIC); r.label.setTypeface(r.label.getTypeface(), android.graphics.Typeface.ITALIC);
r.label.setPadding(dp(Ui.BOX + 20 + 12), 0, dp(8), 0); r.label.setPadding(dp(12), 0, dp(8), 0); // just its depth's indent: the R1 is too narrow to line it up past a box
v.addView(r.label, new LinearLayout.LayoutParams(0, -2, 1)); v.addView(r.label, new LinearLayout.LayoutParams(0, -2, 1));
r.view = v; r.view = v;
return r; return r;
@@ -4,7 +4,7 @@ import android.content.Context;
/** /**
* Every size and colour in one place, sizes already doubled for the R1 (rabbit.html#dp). * Every size and colour in one place, sizes already doubled for the R1 (rabbit.html#dp).
* Two looks: dark (white on black, the default: best in bright sunlight) and light (the * Two looks: dark (high contrast: only white on black, bigger text; the default: best in bright sunlight) and light (the
* desktop's: its grays, embossed boxes, block colours, the Edition date). setLight picks one; * desktop's: its grays, embossed boxes, block colours, the Edition date). setLight picks one;
* the colours below FG are set by it. * the colours below FG are set by it.
*/ */
@@ -14,6 +14,8 @@ final class Ui {
static final int WHITE = 0xFFFFFFFF, BLACK = 0xFF000000, HIGHLIGHT = 0xFF3584E4, SUN = 0xFFFFC400; static final int WHITE = 0xFFFFFFFF, BLACK = 0xFF000000, HIGHLIGHT = 0xFF3584E4, SUN = 0xFFFFC400;
static boolean light; static boolean light;
/** Text size multiplier: dark is the high-contrast look, so its text is bigger (light = the desktop's sizes). */
static float SCALE;
static int FG, BG, TASKS, BAR_BG, GRAY, DIM, NOTE_BG, NOTE_EDGE, BUTTON; static int FG, BG, TASKS, BAR_BG, GRAY, DIM, NOTE_BG, NOTE_EDGE, BUTTON;
static { static {
@@ -27,6 +29,7 @@ final class Ui {
BG = 0xFFEFEFEF; // 239: header and footer BG = 0xFFEFEFEF; // 239: header and footer
TASKS = 0xFFF7F7F7; // 247: the tasks area, a little lighter TASKS = 0xFFF7F7F7; // 247: the tasks area, a little lighter
BAR_BG = 0xFFEFEFEF; BAR_BG = 0xFFEFEFEF;
SCALE = 1f;
GRAY = 0xFF808080; GRAY = 0xFF808080;
DIM = 0xFFA8A8A8; DIM = 0xFFA8A8A8;
NOTE_BG = WHITE; NOTE_BG = WHITE;
@@ -36,10 +39,11 @@ final class Ui {
FG = WHITE; FG = WHITE;
BG = BLACK; BG = BLACK;
TASKS = BLACK; TASKS = BLACK;
BAR_BG = 0xFF111111; BAR_BG = BLACK; // high contrast: only black and white, no grays
GRAY = 0xFF8A8A8A; GRAY = WHITE;
DIM = 0xFF3A3A3A; DIM = WHITE;
NOTE_BG = 0xFF161616; SCALE = 1.2f;
NOTE_BG = BLACK;
NOTE_EDGE = DIM; NOTE_EDGE = DIM;
BUTTON = BLACK; BUTTON = BLACK;
} }
+1 -1
View File
@@ -1,2 +1,2 @@
"""Routine: a day-long, check-it-off routine for the desktop, synced with the R1 through a small sync server.""" """Routine: a day-long, check-it-off routine for the desktop, synced with the R1 through a small sync server."""
__version__ = "0.23.0" __version__ = "0.24.0"
+1 -1
View File
@@ -440,7 +440,7 @@ class Window(QWidget):
if key in ("cheat_day", "cheat_after", "emboss_history", "streak_anims"): if key in ("cheat_day", "cheat_after", "emboss_history", "streak_anims"):
self.restyled.emit(key) # streaks are counted differently / dots drawn differently self.restyled.emit(key) # streaks are counted differently / dots drawn differently
return return
if key in ("chrome_font", "note_font", "block_style", "show_year", "emboss_blocks", "show_now"): # redo the window, keep Settings open if key in ("chrome_font", "note_font", "note_text_font", "block_style", "show_year", "emboss_blocks", "show_now"): # redo the window, keep Settings open
self.look.__init__(self._mode(), self.cfg) self.look.__init__(self._mode(), self.cfg)
old, self.bottom = self.bottom, self._bottom() old, self.bottom = self.bottom, self._bottom()
self.layout().replaceWidget(old, self.bottom) self.layout().replaceWidget(old, self.bottom)
+1
View File
@@ -374,6 +374,7 @@ class DayView(QWidget):
outer.addWidget(lab) # the note: always in view too outer.addWidget(lab) # the note: always in view too
self.note = QPlainTextEdit() self.note = QPlainTextEdit()
self.note.setFixedHeight(110) self.note.setFixedHeight(110)
self.note.setFont(look.note_text_font(self.note.font()))
self.note.setPlainText(day["note"]["text"]) self.note.setPlainText(day["note"]["text"])
self.note.textChanged.connect(lambda: self.note_timer.start()) self.note.textChanged.connect(lambda: self.note_timer.start())
wrap = QWidget() wrap = QWidget()
+9
View File
@@ -93,6 +93,7 @@ class Look:
self.highlight = QColor(HIGHLIGHT) self.highlight = QColor(HIGHLIGHT)
self.chrome_family = cfg.get("chrome_font") or CHROME_FONT self.chrome_family = cfg.get("chrome_font") or CHROME_FONT
self.note_family = cfg.get("note_font") or NOTE_FONT self.note_family = cfg.get("note_font") or NOTE_FONT
self.note_text_family = cfg.get("note_text_font") or None # None: the system font
self.block_style = cfg.get("block_style") if cfg.get("block_style") in dict(BLOCK_STYLES) else "chip" self.block_style = cfg.get("block_style") if cfg.get("block_style") in dict(BLOCK_STYLES) else "chip"
self.show_year = bool(cfg.get("show_year", False)) self.show_year = bool(cfg.get("show_year", False))
self.emboss_blocks = bool(cfg.get("emboss_blocks", False)) self.emboss_blocks = bool(cfg.get("emboss_blocks", False))
@@ -121,6 +122,14 @@ class Look:
"""The note title's font.""" """The note title's font."""
return self._font(self.note_family, pt) return self._font(self.note_family, pt)
def note_text_font(self, base):
"""The font typed in the day's note: base (the box's own font) in the chosen family."""
if not self.note_text_family:
return base
f = QFont(base)
f.setFamilies([self.note_text_family] + DISPLAY_FONTS)
return f
def block_fill(self, color): def block_fill(self, color):
"""A block's colour as a background: as is in light mode; in dark, mostly the tasks gray """A block's colour as a background: as is in light mode; in dark, mostly the tasks gray
so light text stays readable.""" so light text stays readable."""
+4 -1
View File
@@ -5,7 +5,7 @@ import time
from routine.qt.QtCore import QObject, Qt, QTimer, Signal from routine.qt.QtCore import QObject, Qt, QTimer, Signal
from routine.qt.QtGui import QFont from routine.qt.QtGui import QFont
from routine.qt.QtWidgets import (QButtonGroup, QCheckBox, QColorDialog, QDialog, QDialogButtonBox, QFileDialog, QFormLayout, from routine.qt.QtWidgets import (QApplication, QButtonGroup, QCheckBox, QColorDialog, QDialog, QDialogButtonBox, QFileDialog, QFormLayout,
QGroupBox, QHBoxLayout, QLabel, QLineEdit, QListWidget, QMessageBox, QPushButton, QGroupBox, QHBoxLayout, QLabel, QLineEdit, QListWidget, QMessageBox, QPushButton,
QFontComboBox, QScrollArea, QSlider, QSpinBox, QStackedWidget, QStyle, QToolButton, QVBoxLayout, QFontComboBox, QScrollArea, QSlider, QSpinBox, QStackedWidget, QStyle, QToolButton, QVBoxLayout,
QWidget) QWidget)
@@ -102,6 +102,9 @@ class Preferences(QDialog):
f.addRow("Header font:", row) f.addRow("Header font:", row)
row, self.note_font_box = font_row("note_font", NOTE_FONT, "The title above the day's note") row, self.note_font_box = font_row("note_font", NOTE_FONT, "The title above the day's note")
f.addRow("Note title font:", row) f.addRow("Note title font:", row)
system_font = QApplication.font().family()
row, self.note_text_font_box = font_row("note_text_font", system_font, "What you type in the day's note")
f.addRow("Note text font:", row)
f.addRow("Block colours:", tiles(BLOCK_STYLES, cfg.get("block_style", "chip"), f.addRow("Block colours:", tiles(BLOCK_STYLES, cfg.get("block_style", "chip"),
lambda k: self._set("block_style", k))) lambda k: self._set("block_style", k)))
year = QCheckBox("Show the year in the date") year = QCheckBox("Show the year in the date")
+14 -1
View File
@@ -44,11 +44,24 @@ def push_config(cfg):
tmp = f.name tmp = f.name
try: try:
_run("shell", "mkdir", "-p", os.path.dirname(REMOTE_CONFIG)) _run("shell", "mkdir", "-p", os.path.dirname(REMOTE_CONFIG))
return _run("push", tmp, REMOTE_CONFIG) code, out = _run("push", tmp, REMOTE_CONFIG)
if code == 0:
hand_to_app(REMOTE_CONFIG)
return code, out
finally: finally:
os.unlink(tmp) os.unlink(tmp)
def hand_to_app(path):
"""When adb runs as root (`adb root`, e.g. for another tool), what it pushes is root's, labelled
storage_file, and the app can't read it: no sync settings, so it never syncs. Make it what a plain
shell push makes (shell:ext_data_rw, 644, media_rw_data_file); later plain pushes can then overwrite
it too. restorecon doesn't do it. The folder is left alone (it must keep its setgid bit).
As plain shell: nothing to do."""
_run("shell", 'if [ "$(id -u)" = 0 ]; then chcon u:object_r:media_rw_data_file:s0 %s'
' && chown 2000:1078 %s && chmod 644 %s; fi' % (path, path, path))
def install(cfg): def install(cfg):
"""Returns a one-line outcome for the Preferences page.""" """Returns a one-line outcome for the Preferences page."""
if not os.path.exists(paths.APK): if not os.path.exists(paths.APK):