From 069fb3bfd92d342ae22701e61635ece073e3c4d4 Mon Sep 17 00:00:00 2001 From: trav Date: Sat, 21 Nov 2026 13:51:02 -0800 Subject: [PATCH] =?UTF-8?q?v0.24.0:=20R1=20app=200.18.0=20=E2=80=94=20a=20?= =?UTF-8?q?high-contrast=20dark=20look=20with=20bigger=20text,=20the=20sta?= =?UTF-8?q?tus=20bar=20matches=20the=20header,=20suggestions=20indented=20?= =?UTF-8?q?less,=20a=20block's=20times=20line=20up=20with=20its=20name;=20?= =?UTF-8?q?a=20font=20for=20the=20note's=20text;=20installing=20on=20the?= =?UTF-8?q?=20R1=20works=20when=20adb=20runs=20as=20root?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- android/build.py | 2 +- .../java/me/teafry/routine/MainActivity.java | 31 +++++++++++++++---- .../src/main/java/me/teafry/routine/Ui.java | 14 ++++++--- routine/__init__.py | 2 +- routine/gui/app.py | 2 +- routine/gui/dayview.py | 1 + routine/gui/look.py | 9 ++++++ routine/gui/prefs.py | 5 ++- routine/r1.py | 15 ++++++++- 9 files changed, 65 insertions(+), 16 deletions(-) diff --git a/android/build.py b/android/build.py index da53e7c..06479f3 100644 --- a/android/build.py +++ b/android/build.py @@ -16,7 +16,7 @@ import subprocess import sys import zipfile -VERSION_NAME = "0.17.0" +VERSION_NAME = "0.18.0" PKG = "me.teafry.routine" HERE = os.path.dirname(os.path.abspath(__file__)) REPO = os.path.dirname(HERE) diff --git a/android/src/main/java/me/teafry/routine/MainActivity.java b/android/src/main/java/me/teafry/routine/MainActivity.java index 4beaff9..d6cdc95 100644 --- a/android/src/main/java/me/teafry/routine/MainActivity.java +++ b/android/src/main/java/me/teafry/routine/MainActivity.java @@ -106,6 +106,18 @@ public final class MainActivity extends Activity { private SwipeFrame swipe; // ── 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 protected void onCreate(Bundle b) { super.onCreate(b); @@ -147,6 +159,7 @@ public final class MainActivity extends Activity { anim = new AnimView(this, assetOr("animations.json", "{}")); root.addView(anim, new FrameLayout.LayoutParams(-1, -1)); setContentView(root); + statusBar(); today = Model.routineDate(schedule); show(today, true); @@ -200,6 +213,11 @@ public final class MainActivity extends Activity { } 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); t.setText(s); 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.setBackgroundColor(Ui.BAR_BG); 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); - tileInc = text("To do", Ui.TEXT_SMALL + 2, Ui.FG, false); // the desktop's Incomplete, - tileDone = text("Done", Ui.TEXT_SMALL + 2, Ui.FG, false); // and Completed: short to fit + tileAll = text("All", Ui.TEXT_SMALL + 2, Ui.FG, false, true); + 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, true); // and Completed: short to fit for (TextView t : new TextView[] {tileAll, tileInc, tileDone}) { t.setGravity(Gravity.CENTER); 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)); content.addView(nl); 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.setGravity(Gravity.TOP | Gravity.START); note.setMinHeight(dp(220)); @@ -546,7 +564,7 @@ public final class MainActivity extends Activity { h.block = b; LinearLayout v = new LinearLayout(this); 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); 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)); @@ -561,6 +579,7 @@ public final class MainActivity extends Activity { chip.setBackground(rounded(color, color, 0, dp(6))); LinearLayout.LayoutParams cp = new LinearLayout.LayoutParams(dp(26), dp(26)); 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(text(b.optString("label"), Ui.TEXT_BIG, Ui.FG, true)); @@ -590,7 +609,7 @@ public final class MainActivity extends Activity { v.setMinimumHeight(0); r.label = text(it.optString("label"), Ui.TEXT_SUB, Ui.GRAY, false); 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)); r.view = v; return r; diff --git a/android/src/main/java/me/teafry/routine/Ui.java b/android/src/main/java/me/teafry/routine/Ui.java index cd8bc39..fca0c88 100644 --- a/android/src/main/java/me/teafry/routine/Ui.java +++ b/android/src/main/java/me/teafry/routine/Ui.java @@ -4,7 +4,7 @@ import android.content.Context; /** * 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; * 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 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 { @@ -27,6 +29,7 @@ final class Ui { BG = 0xFFEFEFEF; // 239: header and footer TASKS = 0xFFF7F7F7; // 247: the tasks area, a little lighter BAR_BG = 0xFFEFEFEF; + SCALE = 1f; GRAY = 0xFF808080; DIM = 0xFFA8A8A8; NOTE_BG = WHITE; @@ -36,10 +39,11 @@ final class Ui { FG = WHITE; BG = BLACK; TASKS = BLACK; - BAR_BG = 0xFF111111; - GRAY = 0xFF8A8A8A; - DIM = 0xFF3A3A3A; - NOTE_BG = 0xFF161616; + BAR_BG = BLACK; // high contrast: only black and white, no grays + GRAY = WHITE; + DIM = WHITE; + SCALE = 1.2f; + NOTE_BG = BLACK; NOTE_EDGE = DIM; BUTTON = BLACK; } diff --git a/routine/__init__.py b/routine/__init__.py index 8ba5a8d..fa08b3e 100644 --- a/routine/__init__.py +++ b/routine/__init__.py @@ -1,2 +1,2 @@ """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" diff --git a/routine/gui/app.py b/routine/gui/app.py index 3cd59f1..e2d999f 100644 --- a/routine/gui/app.py +++ b/routine/gui/app.py @@ -440,7 +440,7 @@ class Window(QWidget): if key in ("cheat_day", "cheat_after", "emboss_history", "streak_anims"): self.restyled.emit(key) # streaks are counted differently / dots drawn differently 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) old, self.bottom = self.bottom, self._bottom() self.layout().replaceWidget(old, self.bottom) diff --git a/routine/gui/dayview.py b/routine/gui/dayview.py index a566aa2..e779ba5 100644 --- a/routine/gui/dayview.py +++ b/routine/gui/dayview.py @@ -374,6 +374,7 @@ class DayView(QWidget): outer.addWidget(lab) # the note: always in view too self.note = QPlainTextEdit() self.note.setFixedHeight(110) + self.note.setFont(look.note_text_font(self.note.font())) self.note.setPlainText(day["note"]["text"]) self.note.textChanged.connect(lambda: self.note_timer.start()) wrap = QWidget() diff --git a/routine/gui/look.py b/routine/gui/look.py index 1f35ae1..d93ba8a 100644 --- a/routine/gui/look.py +++ b/routine/gui/look.py @@ -93,6 +93,7 @@ class Look: self.highlight = QColor(HIGHLIGHT) self.chrome_family = cfg.get("chrome_font") or CHROME_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.show_year = bool(cfg.get("show_year", False)) self.emboss_blocks = bool(cfg.get("emboss_blocks", False)) @@ -121,6 +122,14 @@ class Look: """The note title's font.""" 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): """A block's colour as a background: as is in light mode; in dark, mostly the tasks gray so light text stays readable.""" diff --git a/routine/gui/prefs.py b/routine/gui/prefs.py index f7da699..d1a2677 100644 --- a/routine/gui/prefs.py +++ b/routine/gui/prefs.py @@ -5,7 +5,7 @@ import time from routine.qt.QtCore import QObject, Qt, QTimer, Signal 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, QFontComboBox, QScrollArea, QSlider, QSpinBox, QStackedWidget, QStyle, QToolButton, QVBoxLayout, QWidget) @@ -102,6 +102,9 @@ class Preferences(QDialog): f.addRow("Header font:", row) row, self.note_font_box = font_row("note_font", NOTE_FONT, "The title above the day's note") 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"), lambda k: self._set("block_style", k))) year = QCheckBox("Show the year in the date") diff --git a/routine/r1.py b/routine/r1.py index 3def3b1..3051bf4 100644 --- a/routine/r1.py +++ b/routine/r1.py @@ -44,11 +44,24 @@ def push_config(cfg): tmp = f.name try: _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: 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): """Returns a one-line outcome for the Preferences page.""" if not os.path.exists(paths.APK):