Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ Versions after 2.17 are `MAJOR.MINOR.PATCH` (2.17 is followed by 2.17.1 or 2.18.
`docs/testing.md`, "Versions and releases"); the headings below keep the numbers as they
were released.

## 2.30.0 — 2026-11-24

- The Android screens in the brand's fonts (#306, brass 1.5.1), as the debug page: the menu
keys, dialog titles, section bands and the dialogs' buttons in Brass Serif, everything else
(fields, check boxes, radio buttons, labels, messages, the tunnel's state line, the status
line, the version under Exit) in Brass Mono. The `.ttf` files lie next to the page's
`.woff2` in the assets and are read once; if one does not open, the system serif or
monospace stays. The menu's cells are measured in Brass Serif, so no label is clipped.
Overlays on the video keep their faces.

## 2.29.1 — 2026-11-23

- The debug page in the brass 1.5.0 fonts of the brand (#304): headings and buttons in Brass
Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ android {
applicationId "com.openipc.decoder"
minSdk 21
targetSdk 36
versionCode 71
versionName "2.29.1"
versionCode 72
versionName "2.30.0"
// Keep only these locales of the libraries' resources, as in the other OpenIPC apps
resourceConfigurations += ['en', 'ru', 'zh-rCN']

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
97 changes: 88 additions & 9 deletions android/app/src/main/java/com/openipc/decoder/Brass.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/*
* Copyright (c) OpenIPC https://openipc.org Prosperity Public License 3.0.0
*
* Brass.java — the "brass" look of the menu and the dialogs (#286, brand brass 1.3.0)
* Brass.java — the "brass" look of the menu and the dialogs (#286, brand brass 1.3.0) in the
* brand's faces (#306, brass 1.5.1)
*
*/

Expand Down Expand Up @@ -49,6 +50,79 @@ final class Brass {
private Brass() {
}

/** The brand's faces in assets/fonts (#306), the same files as the .woff2 of the debug page. */
static final String SERIF_FILE = "BrassSerif-Bold.ttf";
static final String MONO_FILE = "BrassMono-Regular.ttf";
static final String MONO_BOLD_FILE = "BrassMono-Bold.ttf";

// read once per process; null until the first view asks
private static Typeface serif, mono, monoBold;

/**
* The three faces, read from the assets once. A face whose asset does not open stays the
* system's serif or monospace, the faces the app had before.
*/
private static synchronized void loadFonts(Context c) {
if (serif != null) return;
android.content.res.AssetManager a = c.getApplicationContext().getAssets();
mono = font(a, MONO_FILE, Typeface.MONOSPACE);
monoBold = font(a, MONO_BOLD_FILE, Typeface.create(Typeface.MONOSPACE, Typeface.BOLD));
serif = font(a, SERIF_FILE, Typeface.SERIF);
}

private static Typeface font(android.content.res.AssetManager a, String name, Typeface system) {
try {
return Typeface.createFromAsset(a, "fonts/" + name);
} catch (RuntimeException e) { // "native typeface cannot be made": no such asset
return system;
}
}

/** Brass Serif (bold): menu keys, dialog titles, section bands, the dialogs' buttons. */
static Typeface serif(Context c) {
loadFonts(c);
return serif;
}

/** Brass Mono: fields, check boxes, labels, messages, the status line. */
static Typeface mono(Context c) {
loadFonts(c);
return mono;
}

static Typeface monoBold(Context c) {
loadFonts(c);
return monoBold;
}

/** Brass Mono, or Brass Mono Bold for a view that was bold. */
private static Typeface monoFor(Context c, TextView t) {
Typeface f = t.getTypeface();
return f != null && f.isBold() && f != serif(c) ? monoBold(c) : mono(c);
}

/**
* A part of a text in Brass Mono (the version under Exit in a serif key); TypefaceSpan
* takes a Typeface only from Android 9.
*/
static final class MonoSpan extends android.text.style.MetricAffectingSpan {
private final Typeface face;

MonoSpan(Context c) {
face = mono(c);
}

@Override
public void updateMeasureState(android.text.TextPaint p) {
p.setTypeface(face);
}

@Override
public void updateDrawState(android.text.TextPaint p) {
p.setTypeface(face);
}
}

/** A colour of colors.xml (Context.getColor is API 23; the app starts at 21). */
@SuppressWarnings("deprecation")
static int color(Context c, int id) {
Expand Down Expand Up @@ -114,7 +188,7 @@ static TextView band(Context c, String text, boolean gapAbove) {
TextView t = new TextView(c);
t.setText(text);
t.setAllCaps(true);
t.setTypeface(Typeface.SERIF, Typeface.BOLD);
t.setTypeface(serif(c));
t.setLetterSpacing(0.25f);
t.setTextSize(TypedValue.COMPLEX_UNIT_SP, 15);
t.setTextColor(INK_DARK);
Expand Down Expand Up @@ -208,7 +282,7 @@ private static void halves(AlertDialog dialog) {
private static void key(Context c, Button b) {
b.setBackground(keyStates(c));
b.setTextColor(INK_DARK);
b.setTypeface(Typeface.SERIF);
b.setTypeface(serif(c));
b.setLetterSpacing(0.15f);
b.setAllCaps(true);
ViewGroup.LayoutParams lp = b.getLayoutParams();
Expand All @@ -224,14 +298,15 @@ private static void styleTree(Context c, View v) {
EditText e = (EditText) v;
e.setTextColor(color(c, R.color.ink));
e.setHintTextColor(0x99B09873);
e.setTypeface(Typeface.MONOSPACE);
e.setTypeface(monoFor(c, e));
int l = e.getPaddingLeft(), t = e.getPaddingTop();
e.setBackground(displayStates(c));
int p = Math.round(10 * dp(c));
e.setPadding(Math.max(l, p), Math.max(t, p), p, p);
} else if (v instanceof CompoundButton) {
CompoundButton b = (CompoundButton) v;
b.setTextColor(color(c, R.color.ink));
b.setTypeface(monoFor(c, b));
// the app's own box and ring, untinted: on and off read under the focus too (#290)
b.setButtonTintList(null);
b.setButtonDrawable(b instanceof android.widget.RadioButton
Expand All @@ -252,13 +327,17 @@ private static void styleTree(Context c, View v) {
TextView t = (TextView) v;
if (t.getId() == android.R.id.title || isAlertTitle(t)) {
t.setTextColor(color(c, R.color.brass));
t.setTypeface(Typeface.SERIF);
t.setTypeface(serif(c));
t.setAllCaps(true);
t.setLetterSpacing(0.2f);
} else if (t.getId() == android.R.id.message) {
t.setTextColor(color(c, R.color.ink));
} else if (!Boolean.TRUE.equals(t.getTag(R.id.brass_keep))) {
t.setTextColor(color(c, R.color.dim));
} else {
// the message, the labels, the tunnel's state line, a list's rows: Brass Mono
t.setTypeface(monoFor(c, t));
if (t.getId() == android.R.id.message) {
t.setTextColor(color(c, R.color.ink));
} else if (!Boolean.TRUE.equals(t.getTag(R.id.brass_keep))) {
t.setTextColor(color(c, R.color.dim));
}
}
}
if (v instanceof ViewGroup) {
Expand Down
2 changes: 2 additions & 0 deletions android/app/src/main/java/com/openipc/decoder/Decoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,8 @@ public void onCodecChanged(boolean h265, AudioConfig audio) {
mSurface = findViewById(R.id.video_surface);
mSurface.setKeepScreenOn(true);
statusText = findViewById(R.id.status_text);
// the layout's monospace is the fallback; the brand's Brass Mono from the assets (#306)
statusText.setTypeface(Brass.mono(this));
debugUrls = findViewById(R.id.debug_urls);

mSurface.getHolder().addCallback(new SurfaceHolder.Callback() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ public boolean dispatchKeyEvent(KeyEvent event) {
String ver = "v" + version + ", " + gitHash;
SpannableString s = new SpannableString("Exit\n" + ver);
s.setSpan(new RelativeSizeSpan(0.5f), 5, s.length(), 0);
s.setSpan(new Brass.MonoSpan(activity), 5, s.length(), 0);
TextView exit = wordItem(actionRow, "Exit", cell);
exit.setSingleLine(false);
exit.setText(s);
Expand Down Expand Up @@ -465,6 +466,8 @@ private int wordCellWidth() {
android.text.TextPaint paint = new android.text.TextPaint();
paint.setTextSize(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 18,
activity.getResources().getDisplayMetrics()));
// measured in the keys' own face (#306): Brass Serif is wider than the system serif
paint.setTypeface(Brass.serif(activity));
float widest = 0;
for (String w : new String[]{"Settings", "WebUI", "Grid", "Slides",
"Exit", "Reset", "Debug", "UDP"}) {
Expand Down Expand Up @@ -510,7 +513,7 @@ private TextView createItem(String title) {
text.setText(title);
text.setPadding(dp(8), dp(6), dp(8), dp(6));
text.setTextColor(Brass.INK_DARK);
text.setTypeface(android.graphics.Typeface.SERIF);
text.setTypeface(Brass.serif(activity));
text.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
// Reachable with a remote (#91); not only by the clickable default of newer Androids
text.setFocusable(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ static void show(Activity a) {
TextView state = new TextView(a);
// the tunnel's state under Join, amber monospace as a display line (#286)
state.setTextColor(Brass.color(a, R.color.amber));
state.setTypeface(android.graphics.Typeface.MONOSPACE);
state.setTypeface(Brass.mono(a));
state.setTag(R.id.brass_keep, true);
state.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);

Expand Down
51 changes: 51 additions & 0 deletions android/app/src/test/java/com/openipc/decoder/BrassFontsTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright (c) OpenIPC https://openipc.org Prosperity Public License 3.0.0
*
* BrassFontsTest.java — the brand's faces in the assets are its files byte for byte (#306)
*
*/

package com.openipc.decoder;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.LinkedHashMap;
import java.util.Map;

public class BrassFontsTest {
/** SHA256SUMS of local/brand brass/fonts (brass 1.5.1): change both together. */
private static final Map<String, String> SUMS = new LinkedHashMap<>();

static {
SUMS.put("OFL.txt", "7e6b2818edbd8f6a01ae80641cc8f16a51080d08fb4e532be3a0b6f74adb07da");
SUMS.put(Brass.MONO_BOLD_FILE, "190657fa835af45738bcad97b968dde8148ca0e854c1e8737d518919f2394544");
SUMS.put(Brass.MONO_FILE, "e139010955613c1a95467f4fa403bd158b5a608855b4eeac7643e0f635256749");
SUMS.put(Brass.SERIF_FILE, "3d0968d62ec97a044c651bbd86b74974e02452be1522bfd4ddc7e4b50bf30bfc");
SUMS.put("BrassMono-Bold.woff2", "a533e9dc41fa7cdf54850c4f5deaccad588586bce91a641fbe8448503b8171b6");
SUMS.put("BrassMono-Regular.woff2", "82556c93d385127871fc82e7338c176b1056c12d9e79f230b49dfe9491544340");
SUMS.put("BrassSerif-Bold.woff2", "d971f32a0c6e2309fec542eaacf5e394f9995bab62a85f1dae8ab902ad3d1893");
}

@Test
public void theFontsAreTheBrandsFiles() throws IOException, NoSuchAlgorithmException {
for (Map.Entry<String, String> e : SUMS.entrySet()) {
byte[] all = Files.readAllBytes(new File("src/main/assets/fonts/" + e.getKey()).toPath());
StringBuilder hex = new StringBuilder();
for (byte b : MessageDigest.getInstance("SHA-256").digest(all)) hex.append(String.format("%02x", b));
assertEquals(e.getKey(), e.getValue(), hex.toString());
}
}

@Test
public void theAssetsHoldOnlyTheBrandsFiles() {
String[] names = new File("src/main/assets/fonts").list();
assertEquals(SUMS.size(), names == null ? -1 : names.length);
}
}
2 changes: 1 addition & 1 deletion docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ The menu is one grid: the eight slots on top, two rows of four below. Every word
| **Debug** | Text in the corner of every multi-view cell (resolution, codec, decoded/received fps, key frames, status), or none. **Long press** (remote: hold **OK**, or **Menu** on Debug): [save a report](debug.md#save-report) to `Download/OpenIPC` and share it |
| **UDP** | [The U cell](#the-u-cell) full-screen |

The menu is a brass panel of brass keys. Items that are on (Grid, Slides, Debug, UDP and the active slot) are pressed brass with an amber glow; the item the remote is on has an amber frame; a slot without a camera has dim text. On a narrow screen or with a large font the labels are shortened with an ellipsis rather than clipped.
The menu is a brass panel of brass keys, in the brand's fonts as the dialogs: keys, titles and buttons in Brass Serif, the rest in Brass Mono. Items that are on (Grid, Slides, Debug, UDP and the active slot) are pressed brass with an amber glow; the item the remote is on has an amber frame; a slot without a camera has dim text. On a narrow screen or with a large font the labels are shortened with an ellipsis rather than clipped.

## Gestures and keys

Expand Down
14 changes: 13 additions & 1 deletion tests/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
# CHROME_IMAGE headless Chromium for PAGE_SHOTS (default zenika/alpine-chrome:latest)
# NODE_IMAGE Node.js for PAGE_SHOTS's DevTools client (default node:24-slim)
# SHOTS 1: slot 1 over TCP, a lighter camera stream and screenshots in tests/out/shots
# (the picture through the tunnel, the menu, the Network dialog); the emulator's
# (the picture through the tunnel, the menu, the Network dialog, the camera's
# Settings and the Reset question, #306); the emulator's
# software decoder still drops some frames: README pictures come from a TV box
#
# Output in tests/out/ (ignored by git). Exit code 0 when all checks pass.
Expand Down Expand Up @@ -397,6 +398,17 @@ close_dialog() {
tap_text Cancel || true
sleep 2
}
if [ -n "$SHOTS" ]; then
# the other windows in the brass faces (#306): the camera's Settings and the Reset question
for w in Settings Reset; do
$ADB shell input keyevent 23
sleep 2
tap_text "$w" || echo "no $w in the menu"
sleep 3
$ADB exec-out screencap -p > "$OUT/shots/tunnel_$(echo "$w" | tr 'A-Z' 'a-z').png"
close_dialog
done
fi
if [ -z "$SHOTS" ]; then
$ADB shell input tap 640 360
sleep 2
Expand Down
Loading