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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ Open **Settings** from the app menu.
|---|---|
| Server | Several servers, start page (or a custom path), fast page switching |
| Notifications | On or off. Background alerts: only while open, every 15/30/60 minutes, or instant. Sound and vibration per kind of alert. |
| Look | Light, dark or system theme. 6 accent colors. Force-dark pages. Text size 50–200 %, or **Auto text size**: slightly bigger text on a folded phone (110 %), slightly smaller on an unfolded phone or a tablet (90 %), and the slider adjusts it. Turning the phone does not change it. Top bar and bottom bar on or off. Pick up to 5 bottom-bar pages. Full screen. |
| Look | Light, dark or system theme. 6 accent colors. Force-dark pages. Text size 50–200 %, or **Auto text size**: slightly bigger text on a folded phone (110 %), normal size on an unfolded phone or a tablet (100 %), and the slider adjusts it. Turning the phone does not change it. Top bar and bottom bar on or off. Pick up to 5 bottom-bar pages. Full screen. |
| Behavior | Pull to refresh, keep screen on, desktop mode, open other sites in browser, double back to exit, custom CSS, user-agent suffix |
| Security | App lock (fingerprint, face or screen lock) with timeout. Privacy screen (no screenshots, hidden in recents). |
| Data | Clear cache. Sign out (cookies and site data). |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ import kotlin.math.roundToInt
/**
* "Auto text size": a base page text size taken from the screen's smallest width
* (`Configuration.smallestScreenWidthDp`), so a folded phone gets slightly larger text
* and an unfolded phone or a tablet slightly smaller text. The smallest width does not
* and an unfolded phone or a tablet normal-size text. The smallest width does not
* change when the phone is turned, so rotating never changes the size.
*
* smallest width size
* < 520 dp 110 % folded phone, cover screen (~344-411 dp)
* 520-599 dp 110 -> 90 %, straight line (560 dp -> 100 %)
* >= 600 dp 90 % unfolded phone, tablet
* 520-599 dp 110 -> 100 %, straight line (560 dp -> 105 %)
* >= 600 dp 100 % unfolded phone, tablet
*/
object AutoText {
const val PHONE_MAX_DP = 520
const val TABLET_MIN_DP = 600
const val PHONE_PERCENT = 110
const val TABLET_PERCENT = 90
const val TABLET_PERCENT = 100

/** The automatic size in percent for a screen whose smallest width is [smallestWidthDp]. */
fun percent(smallestWidthDp: Int): Int = when {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ The app saves the server and signs you in.<br><br>
<string name="force_dark_pages_summary">Darken pages that have no dark theme (dark app theme only)</string>
<string name="text_zoom">Text size</string>
<string name="auto_text_size">Auto text size</string>
<string name="auto_text_size_summary">Slightly bigger text when folded, slightly smaller when unfolded or on a tablet</string>
<string name="auto_text_size_summary">Slightly bigger text when folded, normal size when unfolded or on a tablet</string>
<string name="text_zoom_auto_summary">Adjusts the automatic size</string>
<string name="show_toolbar">Show top bar</string>
<string name="show_toolbar_summary">When off, tap the Kiro ghost peeking from the screen edge for the menu. Drag it to move it.</string>
Expand Down
24 changes: 12 additions & 12 deletions app/src/test/java/io/github/rayvader/kirocrew/core/AutoTextTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ class AutoTextTest {
}

@Test
fun unfoldedPhonesAndTabletsGetSlightlySmallerText() {
assertEquals(90, AutoText.percent(600))
assertEquals(90, AutoText.percent(673)) // unfolded Fold inner screen
assertEquals(90, AutoText.percent(880))
assertEquals(90, AutoText.percent(2000))
fun unfoldedPhonesAndTabletsGetNormalText() {
assertEquals(100, AutoText.percent(600))
assertEquals(100, AutoText.percent(673)) // unfolded Fold inner screen
assertEquals(100, AutoText.percent(880))
assertEquals(100, AutoText.percent(2000))
}

@Test
fun betweenItBlendsInAStraightLine() {
assertEquals(110, AutoText.percent(520))
assertEquals(100, AutoText.percent(560))
assertEquals(105, AutoText.percent(540))
assertEquals(95, AutoText.percent(580))
assertEquals(105, AutoText.percent(560))
assertEquals(108, AutoText.percent(540))
assertEquals(103, AutoText.percent(580))
var last = 111
for (w in 500..620) {
val p = AutoText.percent(w)
Expand Down Expand Up @@ -59,10 +59,10 @@ class AutoTextTest {
assertEquals(110, AutoText.zoom(411, 100))
assertEquals(88, AutoText.zoom(411, 80)) // 110 % x 80 %
assertEquals(132, AutoText.zoom(411, 120)) // 110 % x 120 %
assertEquals(90, AutoText.zoom(673, 100))
assertEquals(72, AutoText.zoom(673, 80)) // 90 % x 80 %
assertEquals(108, AutoText.zoom(673, 120)) // 90 % x 120 %
assertEquals(100, AutoText.zoom(560, 100))
assertEquals(100, AutoText.zoom(673, 100))
assertEquals(80, AutoText.zoom(673, 80)) // 100 % x 80 %
assertEquals(120, AutoText.zoom(673, 120)) // 100 % x 120 %
assertEquals(105, AutoText.zoom(560, 100))
}

@Test
Expand Down
Loading