Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
180a9a65fd | ||
|
|
845e975c05 | ||
|
|
0ceeb84e98 | ||
|
|
5ddff1b257 | ||
|
|
bc9d855997 | ||
|
|
8f4355a624 | ||
|
|
359bd09b9e | ||
|
|
d09a6bac6b | ||
|
|
25dcb5cb7f | ||
|
|
95c4a1b1ba | ||
|
|
33eca31c65 | ||
|
|
54b600b1ca | ||
|
|
5ff10463a3 | ||
|
|
1ec3cf780a | ||
|
|
2057ce8e8d |
@@ -0,0 +1,28 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Something doesn't work as expected
|
||||||
|
title: "[Bug] "
|
||||||
|
---
|
||||||
|
|
||||||
|
**What happened**
|
||||||
|
|
||||||
|
|
||||||
|
**Steps to reproduce**
|
||||||
|
|
||||||
|
1.
|
||||||
|
2.
|
||||||
|
3.
|
||||||
|
|
||||||
|
**What you expected**
|
||||||
|
|
||||||
|
|
||||||
|
**Environment**
|
||||||
|
|
||||||
|
- App version:
|
||||||
|
- Installed from: Gitea / GitHub / F-Droid / Google Play
|
||||||
|
- Device and Android version:
|
||||||
|
- DoH server in use:
|
||||||
|
- Network: Wi-Fi / mobile data
|
||||||
|
|
||||||
|
**Screenshots or logs** (optional — please remove domains you don't want to share)
|
||||||
|
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
blank_issues_enabled: true
|
||||||
|
contact_links:
|
||||||
|
- name: Main repository on git.skysparkle.cc
|
||||||
|
url: https://git.skysparkle.cc/kalarina/Sparkledns
|
||||||
|
about: This GitHub repository is a mirror. Issues are welcome here and on Gitea.
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
name: DoH server or blocklist
|
||||||
|
about: Suggest a DoH server or blocklist preset
|
||||||
|
title: "[Preset] "
|
||||||
|
---
|
||||||
|
|
||||||
|
- Type: DoH server / blocklist
|
||||||
|
- Name:
|
||||||
|
- URL:
|
||||||
|
- Homepage or documentation:
|
||||||
|
- Privacy policy (DoH servers) or license (blocklists):
|
||||||
|
- Donation page (DoH servers, optional):
|
||||||
|
|
||||||
|
- [ ] DoH server: public and supports RFC 8484
|
||||||
|
- [ ] Blocklist: public and actively maintained
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest an idea that fits the app
|
||||||
|
title: "[Feature] "
|
||||||
|
---
|
||||||
|
|
||||||
|
<!-- Please check the "Out of scope" list in CONTRIBUTING.md before opening this. -->
|
||||||
|
|
||||||
|
**What problem does this solve**
|
||||||
|
|
||||||
|
|
||||||
|
**Proposed solution**
|
||||||
|
|
||||||
|
|
||||||
|
**Alternatives you considered**
|
||||||
|
|
||||||
|
|
||||||
|
- [ ] I'd like to implement this myself
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
name: Translation fix
|
||||||
|
about: Report a wrong or awkward translation
|
||||||
|
title: "[Translation] "
|
||||||
|
---
|
||||||
|
|
||||||
|
<!-- Currently supported: English, Russian. For a new language, open a feature request first. -->
|
||||||
|
|
||||||
|
- Language:
|
||||||
|
- Screen or place in the app:
|
||||||
|
- Current text:
|
||||||
|
- Suggested text:
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
## What does this change
|
||||||
|
|
||||||
|
|
||||||
|
## Related issue
|
||||||
|
|
||||||
|
Closes #
|
||||||
|
|
||||||
|
## Checklist
|
||||||
|
|
||||||
|
- [ ] Discussed in an issue first (not needed for small fixes)
|
||||||
|
- [ ] `./gradlew assembleDebug` builds
|
||||||
|
- [ ] Tested on a device or emulator (Android version: )
|
||||||
|
- [ ] DNS queries only go to the selected DoH server
|
||||||
|
- [ ] No ads, analytics, trackers or Google Play Services / Firebase dependencies
|
||||||
|
- [ ] New strings added to `values/strings.xml` (missing translations noted below)
|
||||||
|
- [ ] Screenshots added for UI changes
|
||||||
|
- [ ] I agree that my contribution is licensed under GPL-3.0-or-later
|
||||||
@@ -9,6 +9,9 @@
|
|||||||
A local VPN that captures only DNS traffic and sends every query to the DoH server you choose (RFC 8484). Everything else goes through your normal connection.
|
A local VPN that captures only DNS traffic and sends every query to the DoH server you choose (RFC 8484). Everything else goes through your normal connection.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> **SparkleDNS is coming to Google Play!** The app is now in closed testing there ahead of the public release. Ideas, wishes and suggestions for improvement are very welcome — send them wherever is easiest for you: an issue on [Gitea](https://git.skysparkle.cc/kalarina/Sparkledns/issues) or [GitHub](https://github.com/kalarina-bit/Sparkledns/issues), or an email to [cuken107@proton.me](mailto:cuken107@proton.me).
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://github.com/kalarina-bit/Sparkledns/releases/latest"><img src="https://img.shields.io/github/v/release/kalarina-bit/Sparkledns?style=for-the-badge&label=release&labelColor=1b1b1b&color=2e7d32" alt="Latest release"></a>
|
<a href="https://github.com/kalarina-bit/Sparkledns/releases/latest"><img src="https://img.shields.io/github/v/release/kalarina-bit/Sparkledns?style=for-the-badge&label=release&labelColor=1b1b1b&color=2e7d32" alt="Latest release"></a>
|
||||||
</p>
|
</p>
|
||||||
@@ -21,10 +24,9 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="assets/screenshots/1-private-dns-control.png" width="160" alt="Private DNS control">
|
<img src="assets/screenshots/1-private-dns-left.png" width="160" alt="Private DNS in one tap"><img src="assets/screenshots/2-private-dns-right.png" width="160" alt="You're protected">
|
||||||
<img src="assets/screenshots/2-protected.png" width="160" alt="You're protected">
|
|
||||||
<img src="assets/screenshots/3-see-every-request.png" width="160" alt="See every request">
|
<img src="assets/screenshots/3-see-every-request.png" width="160" alt="See every request">
|
||||||
<img src="assets/screenshots/4-block-more-noise.png" width="160" alt="Block more noise">
|
<img src="assets/screenshots/4-block-ads-and-trackers.png" width="160" alt="Block ads and trackers">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
> [!TIP]
|
> [!TIP]
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ android {
|
|||||||
targetSdk = 36
|
targetSdk = 36
|
||||||
// Single source of truth: the About screen reads these through BuildConfig.
|
// Single source of truth: the About screen reads these through BuildConfig.
|
||||||
// Kept as plain literals so F-Droid can detect new versions. Code = major * 10000 + minor * 100 + patch.
|
// Kept as plain literals so F-Droid can detect new versions. Code = major * 10000 + minor * 100 + patch.
|
||||||
versionCode = 10100
|
versionCode = 10103
|
||||||
versionName = "1.1.0"
|
versionName = "1.1.3"
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
@@ -49,6 +49,21 @@ android {
|
|||||||
includeInBundle = false
|
includeInBundle = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
packaging {
|
||||||
|
resources {
|
||||||
|
// Library files the app never reads: Kotlin metadata for reflection, the coroutines debug
|
||||||
|
// agent, version markers for tooling and OkHttp's public suffix list, which only cookies use
|
||||||
|
excludes += listOf(
|
||||||
|
"/META-INF/*.version",
|
||||||
|
"/META-INF/*.kotlin_module",
|
||||||
|
"/kotlin/**",
|
||||||
|
"/kotlin-tooling-metadata.json",
|
||||||
|
"/DebugProbesKt.bin",
|
||||||
|
"/okhttp3/internal/publicsuffix/**",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
testOptions {
|
testOptions {
|
||||||
// android.util.Log and friends are no-ops in JVM unit tests
|
// android.util.Log and friends are no-ops in JVM unit tests
|
||||||
unitTests.isReturnDefaultValues = true
|
unitTests.isReturnDefaultValues = true
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ import androidx.compose.material3.TextButton
|
|||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.runtime.saveable.rememberSaveable
|
import androidx.compose.runtime.saveable.rememberSaveable
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
@@ -73,6 +74,7 @@ private val Frameworks = listOf(
|
|||||||
OpenSourceItem("AndroidX Activity", "The Android Open Source Project", APACHE_2, APACHE_2_URL, "https://developer.android.com/jetpack/androidx/releases/activity"),
|
OpenSourceItem("AndroidX Activity", "The Android Open Source Project", APACHE_2, APACHE_2_URL, "https://developer.android.com/jetpack/androidx/releases/activity"),
|
||||||
OpenSourceItem("OkHttp", "Square, Inc.", APACHE_2, APACHE_2_URL, "https://square.github.io/okhttp/"),
|
OpenSourceItem("OkHttp", "Square, Inc.", APACHE_2, APACHE_2_URL, "https://square.github.io/okhttp/"),
|
||||||
OpenSourceItem("Okio", "Square, Inc.", APACHE_2, APACHE_2_URL, "https://square.github.io/okio/"),
|
OpenSourceItem("Okio", "Square, Inc.", APACHE_2, APACHE_2_URL, "https://square.github.io/okio/"),
|
||||||
|
OpenSourceItem("Material Symbols", "Google", APACHE_2, APACHE_2_URL, "https://github.com/google/material-design-icons"),
|
||||||
OpenSourceItem(
|
OpenSourceItem(
|
||||||
"Android HttpEngine (Cronet)", "The Chromium Authors", "BSD 3-Clause",
|
"Android HttpEngine (Cronet)", "The Chromium Authors", "BSD 3-Clause",
|
||||||
"https://chromium.googlesource.com/chromium/src/+/main/LICENSE", "https://developer.android.com/reference/android/net/http/HttpEngine",
|
"https://chromium.googlesource.com/chromium/src/+/main/LICENSE", "https://developer.android.com/reference/android/net/http/HttpEngine",
|
||||||
@@ -125,7 +127,7 @@ private fun AboutContent(modifier: Modifier, onOpenLicenses: () -> Unit) {
|
|||||||
verticalArrangement = Arrangement.spacedBy(12.dp),
|
verticalArrangement = Arrangement.spacedBy(12.dp),
|
||||||
) {
|
) {
|
||||||
Image(
|
Image(
|
||||||
painterResource(R.drawable.app_logo),
|
remember { AppLogo.get(context) },
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(104.dp)
|
.size(104.dp)
|
||||||
@@ -155,13 +157,13 @@ private fun AboutContent(modifier: Modifier, onOpenLicenses: () -> Unit) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
OutlinedButton(onClick = { openUrl(context, PRIVACY_POLICY) }, modifier = Modifier.fillMaxWidth()) {
|
OutlinedButton(onClick = { openUrl(context, PRIVACY_POLICY) }, modifier = Modifier.fillMaxWidth()) {
|
||||||
Icon(painterResource(R.drawable.ic_shield_search), contentDescription = null, modifier = Modifier.size(18.dp))
|
Icon(painterResource(R.drawable.ic_policy), contentDescription = null, modifier = Modifier.size(18.dp))
|
||||||
Spacer(Modifier.width(8.dp))
|
Spacer(Modifier.width(8.dp))
|
||||||
Text(stringResource(R.string.about_privacy_policy))
|
Text(stringResource(R.string.about_privacy_policy))
|
||||||
}
|
}
|
||||||
|
|
||||||
OutlinedButton(onClick = { openUrl(context, SOURCE_CODE) }, modifier = Modifier.fillMaxWidth()) {
|
OutlinedButton(onClick = { openUrl(context, SOURCE_CODE) }, modifier = Modifier.fillMaxWidth()) {
|
||||||
Icon(painterResource(R.drawable.ic_android), contentDescription = null, modifier = Modifier.size(18.dp))
|
Icon(painterResource(R.drawable.ic_code), contentDescription = null, modifier = Modifier.size(18.dp))
|
||||||
Spacer(Modifier.width(8.dp))
|
Spacer(Modifier.width(8.dp))
|
||||||
Text(stringResource(R.string.about_source))
|
Text(stringResource(R.string.about_source))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,9 @@ package cc.skysparkle.sparkledns
|
|||||||
import android.content.ClipData
|
import android.content.ClipData
|
||||||
import android.content.ClipboardManager
|
import android.content.ClipboardManager
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
|
import androidx.annotation.DrawableRes
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
import androidx.compose.foundation.Canvas
|
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.border
|
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
@@ -14,32 +13,39 @@ import androidx.compose.foundation.layout.Column
|
|||||||
import androidx.compose.foundation.layout.PaddingValues
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
|
import androidx.compose.foundation.layout.fillMaxHeight
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.heightIn
|
import androidx.compose.foundation.layout.heightIn
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.layout.width
|
import androidx.compose.foundation.layout.width
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
|
import androidx.compose.foundation.lazy.LazyListScope
|
||||||
import androidx.compose.foundation.lazy.itemsIndexed
|
import androidx.compose.foundation.lazy.itemsIndexed
|
||||||
|
import androidx.compose.foundation.rememberScrollState
|
||||||
import androidx.compose.foundation.shape.CircleShape
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.verticalScroll
|
||||||
import androidx.compose.material3.DropdownMenu
|
import androidx.compose.material3.DropdownMenu
|
||||||
import androidx.compose.material3.DropdownMenuItem
|
import androidx.compose.material3.DropdownMenuItem
|
||||||
import androidx.compose.material3.HorizontalDivider
|
import androidx.compose.material3.HorizontalDivider
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.IconButton
|
import androidx.compose.material3.IconButton
|
||||||
|
import androidx.compose.material3.LinearProgressIndicator
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
|
import androidx.compose.runtime.derivedStateOf
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.runtime.rememberCoroutineScope
|
import androidx.compose.runtime.rememberCoroutineScope
|
||||||
import androidx.compose.runtime.saveable.rememberSaveable
|
import androidx.compose.runtime.saveable.rememberSaveable
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
|
import androidx.compose.runtime.structuralEqualityPolicy
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
|
import androidx.compose.ui.draw.drawWithCache
|
||||||
import androidx.compose.ui.geometry.Offset
|
import androidx.compose.ui.geometry.Offset
|
||||||
import androidx.compose.ui.geometry.Size
|
import androidx.compose.ui.geometry.Size
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
@@ -53,12 +59,12 @@ import androidx.compose.ui.unit.Dp
|
|||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
import kotlinx.coroutines.withContext
|
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlinx.coroutines.withContext
|
||||||
|
|
||||||
private enum class ActivityFilter(@StringRes val label: Int) {
|
private enum class ActivityFilter(@StringRes val label: Int) {
|
||||||
ALL(R.string.mon_all),
|
ALL(R.string.mon_all),
|
||||||
@@ -67,11 +73,6 @@ private enum class ActivityFilter(@StringRes val label: Int) {
|
|||||||
ERRORS(R.string.mon_errors),
|
ERRORS(R.string.mon_errors),
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum class Period(val hours: Int, @StringRes val label: Int) {
|
|
||||||
DAY(24, R.string.period_24h),
|
|
||||||
WEEK(24 * 7, R.string.period_7d),
|
|
||||||
}
|
|
||||||
|
|
||||||
private val TimeFormat = SimpleDateFormat("HH:mm:ss", Locale.ROOT)
|
private val TimeFormat = SimpleDateFormat("HH:mm:ss", Locale.ROOT)
|
||||||
|
|
||||||
// Colors of the company slices, then the rest
|
// Colors of the company slices, then the rest
|
||||||
@@ -80,6 +81,28 @@ private val OtherColor = Palette.Track
|
|||||||
|
|
||||||
private class Slice(val label: String, val share: Float, val color: Color)
|
private class Slice(val label: String, val share: Float, val color: Color)
|
||||||
|
|
||||||
|
// One row of the log: every query for a domain, shown by its newest one. A data class, so a
|
||||||
|
// rebuilt list with the same groups counts as unchanged.
|
||||||
|
private data class DomainGroup(val latest: QueryEntry, val types: List<Int>, val count: Int)
|
||||||
|
|
||||||
|
// The log is newest first, so the first entry of a domain is its newest one and the groups come
|
||||||
|
// out in the order their domains were last asked for. Names differ only in letter case when a
|
||||||
|
// resolver randomizes it, so they are compared in lower case.
|
||||||
|
private fun groupByDomain(entries: List<QueryEntry>): List<DomainGroup> {
|
||||||
|
class Builder(val latest: QueryEntry) {
|
||||||
|
val types = LinkedHashSet<Int>()
|
||||||
|
var count = 0
|
||||||
|
}
|
||||||
|
val groups = LinkedHashMap<String, Builder>()
|
||||||
|
for (entry in entries) {
|
||||||
|
val group = groups.getOrPut(entry.domain.lowercase(Locale.ROOT)) { Builder(entry) }
|
||||||
|
group.types += entry.type
|
||||||
|
group.count++
|
||||||
|
}
|
||||||
|
// Types in numeric order: A, then AAAA, then HTTPS
|
||||||
|
return groups.values.map { DomainGroup(it.latest, it.types.sorted(), it.count) }
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ActivityScreen(bottomPadding: Dp, modifier: Modifier = Modifier) {
|
fun ActivityScreen(bottomPadding: Dp, modifier: Modifier = Modifier) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
@@ -87,12 +110,11 @@ fun ActivityScreen(bottomPadding: Dp, modifier: Modifier = Modifier) {
|
|||||||
val custom by Blocklist.custom.collectAsStateWithLifecycle()
|
val custom by Blocklist.custom.collectAsStateWithLifecycle()
|
||||||
val customSet = remember(custom) { custom.toHashSet() }
|
val customSet = remember(custom) { custom.toHashSet() }
|
||||||
|
|
||||||
var period by rememberSaveable { mutableStateOf(Period.DAY) }
|
var period by rememberSaveable { mutableStateOf(StatsPeriod.DAY) }
|
||||||
var entries by remember { mutableStateOf(QueryLog.snapshot()) }
|
var entries by remember { mutableStateOf(QueryLog.snapshot()) }
|
||||||
var summary by remember { mutableStateOf(StatsStore.summary(period.hours)) }
|
var summary by remember { mutableStateOf(StatsStore.summary(period.hours)) }
|
||||||
var filter by rememberSaveable { mutableStateOf(ActivityFilter.ALL) }
|
var filter by rememberSaveable { mutableStateOf(ActivityFilter.ALL) }
|
||||||
var search by rememberSaveable { mutableStateOf("") }
|
var search by rememberSaveable { mutableStateOf("") }
|
||||||
var filterMenu by remember { mutableStateOf(false) }
|
|
||||||
|
|
||||||
OnQueryLogChange {
|
OnQueryLogChange {
|
||||||
entries = QueryLog.snapshot()
|
entries = QueryLog.snapshot()
|
||||||
@@ -101,18 +123,25 @@ fun ActivityScreen(bottomPadding: Dp, modifier: Modifier = Modifier) {
|
|||||||
val statsVersion by StatsStore.version.collectAsStateWithLifecycle()
|
val statsVersion by StatsStore.version.collectAsStateWithLifecycle()
|
||||||
LaunchedEffect(period, statsVersion) { summary = StatsStore.summary(period.hours) }
|
LaunchedEffect(period, statsVersion) { summary = StatsStore.summary(period.hours) }
|
||||||
|
|
||||||
val visible = remember(entries, filter, search) {
|
// Filtered and grouped by domain again only when the log, the filter or the search changes,
|
||||||
val term = search.trim()
|
// and the list below is updated only when the result differs: new entries that the filter
|
||||||
entries.filter { e ->
|
// hides change nothing
|
||||||
val matchesFilter = when (filter) {
|
val visible by remember {
|
||||||
ActivityFilter.ALL -> true
|
derivedStateOf(structuralEqualityPolicy()) {
|
||||||
ActivityFilter.BLOCKED -> e.status == QueryStatus.BLOCKED
|
val term = search.trim()
|
||||||
ActivityFilter.CACHED -> e.status == QueryStatus.CACHED
|
val matching = entries.filter { e ->
|
||||||
ActivityFilter.ERRORS -> e.status == QueryStatus.FAILED
|
val matchesFilter = when (filter) {
|
||||||
|
ActivityFilter.ALL -> true
|
||||||
|
ActivityFilter.BLOCKED -> e.status == QueryStatus.BLOCKED
|
||||||
|
ActivityFilter.CACHED -> e.status == QueryStatus.CACHED
|
||||||
|
ActivityFilter.ERRORS -> e.status == QueryStatus.FAILED
|
||||||
|
}
|
||||||
|
matchesFilter && (term.isEmpty() || e.domain.contains(term, ignoreCase = true))
|
||||||
}
|
}
|
||||||
matchesFilter && (term.isEmpty() || e.domain.contains(term, ignoreCase = true))
|
groupByDomain(matching)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
val canClear by remember { derivedStateOf { entries.isNotEmpty() } }
|
||||||
|
|
||||||
fun toggleBlock(domain: String, unblock: Boolean) {
|
fun toggleBlock(domain: String, unblock: Boolean) {
|
||||||
scope.launch {
|
scope.launch {
|
||||||
@@ -144,112 +173,27 @@ fun ActivityScreen(bottomPadding: Dp, modifier: Modifier = Modifier) {
|
|||||||
.setPrimaryClip(ClipData.newPlainText("domain", domain))
|
.setPrimaryClip(ClipData.newPlainText("domain", domain))
|
||||||
}
|
}
|
||||||
|
|
||||||
LazyColumn(
|
val wide = windowWidth() >= WideLayoutWidth
|
||||||
modifier = modifier,
|
val side = sidePadding(windowWidth(), if (wide) MaxWideContentWidth else MaxContentWidth)
|
||||||
contentPadding = PaddingValues(start = 20.dp, end = 20.dp, top = 16.dp, bottom = bottomPadding),
|
val clear = {
|
||||||
) {
|
QueryLog.clear()
|
||||||
item(key = "header") {
|
entries = emptyList()
|
||||||
Row(
|
}
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.heightIn(min = 44.dp),
|
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
|
||||||
) {
|
|
||||||
ScreenTitle(stringResource(R.string.tab_activity), Modifier.weight(1f))
|
|
||||||
PeriodChip(stringResource(period.label)) {
|
|
||||||
period = if (period == Period.DAY) Period.WEEK else Period.DAY
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
item(key = "stats") {
|
|
||||||
Row(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(top = 20.dp, start = 4.dp, end = 4.dp),
|
|
||||||
horizontalArrangement = Arrangement.spacedBy(6.dp),
|
|
||||||
) {
|
|
||||||
StatBlock(formatCompact(summary.total), stringResource(R.string.stat_requests), Modifier.weight(1f))
|
|
||||||
StatBlock(formatCompact(summary.blocked), stringResource(R.string.mon_blocked), Modifier.weight(1f))
|
|
||||||
StatBlock(stringResource(R.string.mon_ms, summary.avgLatencyMs), stringResource(R.string.stat_avg), Modifier.weight(1f))
|
|
||||||
val cache = if (summary.total == 0L) 0 else summary.cached * 100 / summary.total
|
|
||||||
StatBlock("$cache%", stringResource(R.string.mon_cached), Modifier.weight(1f))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
item(key = "companies") {
|
|
||||||
CompanyCard(summary, Modifier.padding(top = 20.dp))
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// The log rows, shared by the one- and two-column layouts
|
||||||
|
val log: LazyListScope.() -> Unit = {
|
||||||
item(key = "recent") {
|
item(key = "recent") {
|
||||||
Row(
|
RecentHeader(canClear, clear, Modifier.padding(top = if (wide) 0.dp else 24.dp))
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(top = 24.dp),
|
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
|
||||||
) {
|
|
||||||
Text(
|
|
||||||
stringResource(R.string.recent_title),
|
|
||||||
color = Palette.Fg,
|
|
||||||
fontSize = 17.sp,
|
|
||||||
fontWeight = FontWeight.ExtraBold,
|
|
||||||
modifier = Modifier.weight(1f),
|
|
||||||
)
|
|
||||||
IconButton(
|
|
||||||
onClick = {
|
|
||||||
QueryLog.clear()
|
|
||||||
entries = emptyList()
|
|
||||||
},
|
|
||||||
enabled = entries.isNotEmpty(),
|
|
||||||
) {
|
|
||||||
Icon(
|
|
||||||
painterResource(R.drawable.ic_delete),
|
|
||||||
contentDescription = stringResource(R.string.mon_clear),
|
|
||||||
tint = Palette.Fg2,
|
|
||||||
modifier = Modifier.size(20.dp),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
item(key = "search") {
|
item(key = "search") {
|
||||||
SearchField(
|
LogSearch(
|
||||||
value = search,
|
search = search,
|
||||||
onValueChange = { search = it },
|
onSearch = { search = it },
|
||||||
placeholder = stringResource(R.string.mon_search),
|
filter = filter,
|
||||||
|
onFilter = { filter = it },
|
||||||
modifier = Modifier.padding(top = 6.dp, bottom = 4.dp),
|
modifier = Modifier.padding(top = 6.dp, bottom = 4.dp),
|
||||||
trailing = {
|
|
||||||
Box {
|
|
||||||
IconButton(onClick = { filterMenu = true }) {
|
|
||||||
Icon(
|
|
||||||
painterResource(R.drawable.ic_tab_settings),
|
|
||||||
contentDescription = stringResource(R.string.filter),
|
|
||||||
tint = if (filter == ActivityFilter.ALL) Palette.Fg2 else Palette.Accent,
|
|
||||||
modifier = Modifier.size(18.dp),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
DropdownMenu(expanded = filterMenu, onDismissRequest = { filterMenu = false }) {
|
|
||||||
ActivityFilter.entries.forEach { option ->
|
|
||||||
DropdownMenuItem(
|
|
||||||
text = {
|
|
||||||
Text(
|
|
||||||
stringResource(option.label),
|
|
||||||
color = if (option == filter) Palette.Accent else Palette.Fg,
|
|
||||||
fontWeight = if (option == filter) FontWeight.Bold else FontWeight.Normal,
|
|
||||||
)
|
|
||||||
},
|
|
||||||
onClick = {
|
|
||||||
filter = option
|
|
||||||
filterMenu = false
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (visible.isEmpty()) {
|
if (visible.isEmpty()) {
|
||||||
item(key = "empty") {
|
item(key = "empty") {
|
||||||
EmptyState(
|
EmptyState(
|
||||||
@@ -258,12 +202,19 @@ fun ActivityScreen(bottomPadding: Dp, modifier: Modifier = Modifier) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Keyed by domain, so a new query for a domain moves its row to the top instead of adding one
|
||||||
itemsIndexed(visible, key = { _, entry -> entry.id }, contentType = { _, _ -> "query" }) { index, entry ->
|
itemsIndexed(
|
||||||
|
visible,
|
||||||
|
key = { _, group -> "domain:" + group.latest.domain.lowercase(Locale.ROOT) },
|
||||||
|
contentType = { _, _ -> "query" },
|
||||||
|
) { index, group ->
|
||||||
|
val entry = group.latest
|
||||||
val blockedByMe = entry.domain in customSet
|
val blockedByMe = entry.domain in customSet
|
||||||
QueryRow(
|
QueryRow(
|
||||||
modifier = Modifier.animateItem(),
|
modifier = Modifier.animateItem(),
|
||||||
entry = entry,
|
entry = entry,
|
||||||
|
types = group.types,
|
||||||
|
count = group.count,
|
||||||
first = index == 0,
|
first = index == 0,
|
||||||
blockedByMe = blockedByMe,
|
blockedByMe = blockedByMe,
|
||||||
onBlock = { toggleBlock(entry.domain, unblock = false) },
|
onBlock = { toggleBlock(entry.domain, unblock = false) },
|
||||||
@@ -272,28 +223,152 @@ fun ActivityScreen(bottomPadding: Dp, modifier: Modifier = Modifier) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
if (wide) {
|
||||||
private fun PeriodChip(text: String, onClick: () -> Unit) {
|
Row(
|
||||||
Row(
|
modifier = modifier.padding(horizontal = side),
|
||||||
modifier = Modifier
|
horizontalArrangement = Arrangement.spacedBy(24.dp),
|
||||||
.clip(RoundedCornerShape(18.dp))
|
) {
|
||||||
.border(1.dp, Palette.Track, RoundedCornerShape(18.dp))
|
Column(
|
||||||
.clickable(onClick = onClick)
|
Modifier
|
||||||
.padding(start = 14.dp, end = 10.dp, top = 8.dp, bottom = 8.dp),
|
.weight(1f)
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
.fillMaxHeight()
|
||||||
) {
|
.verticalScroll(rememberScrollState())
|
||||||
Text(text, color = Palette.Fg, fontSize = 12.sp, fontWeight = FontWeight.Bold)
|
.padding(top = 16.dp, bottom = bottomPadding),
|
||||||
Spacer(Modifier.width(4.dp))
|
) {
|
||||||
Icon(painterResource(R.drawable.ic_expand), contentDescription = null, tint = Palette.Fg2, modifier = Modifier.size(14.dp))
|
ActivityHeader(period) { period = it }
|
||||||
|
ActivityStats(summary, Modifier.padding(top = 20.dp))
|
||||||
|
CompanyCard(summary, entries, Modifier.padding(top = 20.dp))
|
||||||
|
}
|
||||||
|
LazyColumn(
|
||||||
|
modifier = Modifier
|
||||||
|
.weight(1f)
|
||||||
|
.fillMaxHeight(),
|
||||||
|
contentPadding = PaddingValues(top = 16.dp, bottom = bottomPadding),
|
||||||
|
content = log,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LazyColumn(
|
||||||
|
modifier = modifier,
|
||||||
|
contentPadding = PaddingValues(start = side, end = side, top = 16.dp, bottom = bottomPadding),
|
||||||
|
) {
|
||||||
|
item(key = "header") { ActivityHeader(period) { period = it } }
|
||||||
|
item(key = "stats") { ActivityStats(summary, Modifier.padding(top = 20.dp)) }
|
||||||
|
item(key = "companies") { CompanyCard(summary, entries, Modifier.padding(top = 20.dp)) }
|
||||||
|
log()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun CompanyCard(summary: StatsSummary, modifier: Modifier = Modifier) {
|
private fun ActivityHeader(period: StatsPeriod, onPeriod: (StatsPeriod) -> Unit) {
|
||||||
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.heightIn(min = 44.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
) {
|
||||||
|
ScreenTitle(stringResource(R.string.tab_activity), Modifier.weight(1f))
|
||||||
|
PeriodChip(period, onPeriod)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun ActivityStats(summary: StatsSummary, modifier: Modifier = Modifier) {
|
||||||
|
Row(
|
||||||
|
modifier = modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(horizontal = 4.dp),
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(6.dp),
|
||||||
|
) {
|
||||||
|
StatBlock(formatCompact(summary.total), stringResource(R.string.stat_requests), Modifier.weight(1f))
|
||||||
|
StatBlock(formatCompact(summary.blocked), stringResource(R.string.mon_blocked), Modifier.weight(1f))
|
||||||
|
StatBlock(stringResource(R.string.mon_ms, summary.avgLatencyMs), stringResource(R.string.stat_avg), Modifier.weight(1f))
|
||||||
|
val cache = if (summary.total == 0L) 0 else summary.cached * 100 / summary.total
|
||||||
|
StatBlock("$cache%", stringResource(R.string.mon_cached), Modifier.weight(1f))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun RecentHeader(canClear: Boolean, onClear: () -> Unit, modifier: Modifier = Modifier) {
|
||||||
|
Row(
|
||||||
|
modifier = modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.heightIn(min = 44.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
stringResource(R.string.recent_title),
|
||||||
|
color = Palette.Fg,
|
||||||
|
fontSize = 17.sp,
|
||||||
|
fontWeight = FontWeight.ExtraBold,
|
||||||
|
modifier = Modifier.weight(1f),
|
||||||
|
)
|
||||||
|
IconButton(onClick = onClear, enabled = canClear) {
|
||||||
|
Icon(
|
||||||
|
painterResource(R.drawable.ic_delete_sweep),
|
||||||
|
contentDescription = stringResource(R.string.mon_clear),
|
||||||
|
tint = Palette.Fg2,
|
||||||
|
modifier = Modifier.size(20.dp),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun LogSearch(
|
||||||
|
search: String,
|
||||||
|
onSearch: (String) -> Unit,
|
||||||
|
filter: ActivityFilter,
|
||||||
|
onFilter: (ActivityFilter) -> Unit,
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
|
) {
|
||||||
|
var menu by remember { mutableStateOf(false) }
|
||||||
|
SearchField(
|
||||||
|
value = search,
|
||||||
|
onValueChange = onSearch,
|
||||||
|
placeholder = stringResource(R.string.mon_search),
|
||||||
|
modifier = modifier,
|
||||||
|
trailing = {
|
||||||
|
Box {
|
||||||
|
IconButton(onClick = { menu = true }) {
|
||||||
|
Icon(
|
||||||
|
painterResource(R.drawable.ic_filter),
|
||||||
|
contentDescription = stringResource(R.string.filter),
|
||||||
|
tint = if (filter == ActivityFilter.ALL) Palette.Fg2 else Palette.Accent,
|
||||||
|
modifier = Modifier.size(18.dp),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
DropdownMenu(expanded = menu, onDismissRequest = { menu = false }) {
|
||||||
|
ActivityFilter.entries.forEach { option ->
|
||||||
|
DropdownMenuItem(
|
||||||
|
text = {
|
||||||
|
Text(
|
||||||
|
stringResource(option.label),
|
||||||
|
color = if (option == filter) Palette.Accent else Palette.Fg,
|
||||||
|
fontWeight = if (option == filter) FontWeight.Bold else FontWeight.Normal,
|
||||||
|
)
|
||||||
|
},
|
||||||
|
onClick = {
|
||||||
|
onFilter(option)
|
||||||
|
menu = false
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Below this many requests the shares say more about chance than about habits
|
||||||
|
private const val MIN_COMPANY_REQUESTS = 50L
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun CompanyCard(summary: StatsSummary, recent: List<QueryEntry>, modifier: Modifier = Modifier) {
|
||||||
val other = stringResource(R.string.companies_other)
|
val other = stringResource(R.string.companies_other)
|
||||||
val slices = remember(summary, other) { companySlices(summary, other) }
|
val slices = remember(summary, recent, other) { companySlices(summary, recent, other) }
|
||||||
Column(
|
Column(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
@@ -304,12 +379,19 @@ private fun CompanyCard(summary: StatsSummary, modifier: Modifier = Modifier) {
|
|||||||
Text(stringResource(R.string.companies_title), color = Palette.Fg, fontSize = 15.sp, fontWeight = FontWeight.Bold)
|
Text(stringResource(R.string.companies_title), color = Palette.Fg, fontSize = 15.sp, fontWeight = FontWeight.Bold)
|
||||||
Text(stringResource(R.string.companies_desc), color = Palette.Fg2, fontSize = 12.sp, lineHeight = 17.sp)
|
Text(stringResource(R.string.companies_desc), color = Palette.Fg2, fontSize = 12.sp, lineHeight = 17.sp)
|
||||||
Spacer(Modifier.size(10.dp))
|
Spacer(Modifier.size(10.dp))
|
||||||
if (summary.total == 0L) {
|
if (summary.total < MIN_COMPANY_REQUESTS) {
|
||||||
Text(
|
Text(
|
||||||
stringResource(R.string.no_data),
|
stringResource(R.string.companies_wait, summary.total, MIN_COMPANY_REQUESTS),
|
||||||
color = Palette.Fg3,
|
color = Palette.Fg3,
|
||||||
fontSize = 13.sp,
|
fontSize = 13.sp,
|
||||||
modifier = Modifier.padding(vertical = 12.dp),
|
)
|
||||||
|
LinearProgressIndicator(
|
||||||
|
progress = { summary.total.toFloat() / MIN_COMPANY_REQUESTS },
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(top = 10.dp, bottom = 4.dp),
|
||||||
|
color = Palette.Accent,
|
||||||
|
trackColor = Palette.Track,
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||||
@@ -333,12 +415,7 @@ private fun CompanyCard(summary: StatsSummary, modifier: Modifier = Modifier) {
|
|||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
modifier = Modifier.weight(1f),
|
modifier = Modifier.weight(1f),
|
||||||
)
|
)
|
||||||
Text(
|
Text(percentLabel(slice.share), color = Palette.Fg, fontSize = 12.sp, fontWeight = FontWeight.Bold)
|
||||||
String.format(Locale.getDefault(), "%.1f%%", slice.share * 100f),
|
|
||||||
color = Palette.Fg,
|
|
||||||
fontSize = 12.sp,
|
|
||||||
fontWeight = FontWeight.Bold,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -347,44 +424,73 @@ private fun CompanyCard(summary: StatsSummary, modifier: Modifier = Modifier) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The four companies with most requests, then everything else
|
// Whole percents; a sliver above zero shows as "<1%" rather than "0%"
|
||||||
private fun companySlices(summary: StatsSummary, otherLabel: String): List<Slice> {
|
private fun percentLabel(share: Float): String {
|
||||||
|
val percent = share * 100f
|
||||||
|
return if (percent < 1f) "<1%" else "${Math.round(percent)}%"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shares of the known companies over the period. The statistics keep no domains, so the share
|
||||||
|
// left over is split by the names of the recent queries to other domains, from the log in memory.
|
||||||
|
// Then the four largest slices and everything else; empty slices are left out.
|
||||||
|
private fun companySlices(summary: StatsSummary, recent: List<QueryEntry>, otherLabel: String): List<Slice> {
|
||||||
if (summary.total == 0L) return emptyList()
|
if (summary.total == 0L) return emptyList()
|
||||||
val top = Company.entries
|
val shares = HashMap<String, Float>()
|
||||||
.map { it to summary.companies[it.ordinal] }
|
for (company in Company.entries) {
|
||||||
.filter { it.second > 0 }
|
val count = summary.companies[company.ordinal]
|
||||||
.sortedByDescending { it.second }
|
if (count > 0) shares[company.label] = count.toFloat() / summary.total
|
||||||
.take(SliceColors.size)
|
|
||||||
val slices = top.mapIndexed { index, (company, count) ->
|
|
||||||
Slice(company.label, count.toFloat() / summary.total, SliceColors[index])
|
|
||||||
}
|
}
|
||||||
|
val unknownShare = (1f - shares.values.sum()).coerceAtLeast(0f)
|
||||||
|
val names = HashMap<String, Int>()
|
||||||
|
var unknownCount = 0
|
||||||
|
for (entry in recent) {
|
||||||
|
if (Companies.of(entry.domain) != null) continue
|
||||||
|
unknownCount++
|
||||||
|
Companies.nameOf(entry.domain)?.let { names.merge(it, 1, Int::plus) }
|
||||||
|
}
|
||||||
|
// Queries without a name (local names, reverse lookups) stay in the rest
|
||||||
|
if (unknownCount > 0) {
|
||||||
|
for ((name, count) in names) shares.merge(name, unknownShare * count / unknownCount, Float::plus)
|
||||||
|
}
|
||||||
|
val slices = shares.entries
|
||||||
|
.sortedByDescending { it.value }
|
||||||
|
.take(SliceColors.size)
|
||||||
|
.mapIndexed { index, (label, share) -> Slice(label, share, SliceColors[index]) }
|
||||||
val rest = (1f - slices.sumOf { it.share.toDouble() }.toFloat()).coerceAtLeast(0f)
|
val rest = (1f - slices.sumOf { it.share.toDouble() }.toFloat()).coerceAtLeast(0f)
|
||||||
return slices + Slice(otherLabel, rest, OtherColor)
|
return if (rest >= 0.005f) slices + Slice(otherLabel, rest, OtherColor) else slices
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun Donut(slices: List<Slice>, modifier: Modifier = Modifier) {
|
private fun Donut(slices: List<Slice>, modifier: Modifier = Modifier) {
|
||||||
Canvas(modifier) {
|
// The ring's geometry is worked out when the size changes, not every frame
|
||||||
val stroke = 14.dp.toPx()
|
Spacer(
|
||||||
val diameter = size.minDimension - stroke
|
modifier.drawWithCache {
|
||||||
val topLeft = Offset((size.width - diameter) / 2f, (size.height - diameter) / 2f)
|
val width = 14.dp.toPx()
|
||||||
val arcSize = Size(diameter, diameter)
|
val stroke = Stroke(width = width)
|
||||||
drawArc(OtherColor, 0f, 360f, useCenter = false, topLeft = topLeft, size = arcSize, style = Stroke(width = stroke))
|
val diameter = size.minDimension - width
|
||||||
var start = -90f
|
val topLeft = Offset((size.width - diameter) / 2f, (size.height - diameter) / 2f)
|
||||||
slices.forEach { slice ->
|
val arcSize = Size(diameter, diameter)
|
||||||
val sweep = slice.share * 360f
|
onDrawBehind {
|
||||||
if (sweep > 0f) {
|
drawArc(OtherColor, 0f, 360f, useCenter = false, topLeft = topLeft, size = arcSize, style = stroke)
|
||||||
drawArc(slice.color, start, sweep, useCenter = false, topLeft = topLeft, size = arcSize, style = Stroke(width = stroke))
|
var start = -90f
|
||||||
|
slices.forEach { slice ->
|
||||||
|
val sweep = slice.share * 360f
|
||||||
|
if (sweep > 0f) {
|
||||||
|
drawArc(slice.color, start, sweep, useCenter = false, topLeft = topLeft, size = arcSize, style = stroke)
|
||||||
|
}
|
||||||
|
start += sweep
|
||||||
|
}
|
||||||
}
|
}
|
||||||
start += sweep
|
|
||||||
}
|
}
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun QueryRow(
|
private fun QueryRow(
|
||||||
modifier: Modifier,
|
modifier: Modifier,
|
||||||
entry: QueryEntry,
|
entry: QueryEntry,
|
||||||
|
types: List<Int>,
|
||||||
|
count: Int,
|
||||||
first: Boolean,
|
first: Boolean,
|
||||||
blockedByMe: Boolean,
|
blockedByMe: Boolean,
|
||||||
onBlock: () -> Unit,
|
onBlock: () -> Unit,
|
||||||
@@ -404,6 +510,9 @@ private fun QueryRow(
|
|||||||
QueryStatus.BLOCKED -> stringResource(if (blockedByMe) R.string.bl_my else R.string.tab_blocklist)
|
QueryStatus.BLOCKED -> stringResource(if (blockedByMe) R.string.bl_my else R.string.tab_blocklist)
|
||||||
QueryStatus.FAILED -> stringResource(R.string.status_failed)
|
QueryStatus.FAILED -> stringResource(R.string.status_failed)
|
||||||
}
|
}
|
||||||
|
// "A, AAAA, HTTPS · ×3 · 256 ms"; the status and time are those of the newest query
|
||||||
|
val typeNames = types.joinToString(", ") { DnsMessage.typeName(it) }
|
||||||
|
val summary = if (count > 1) "$typeNames · ×$count · $detail" else "$typeNames · $detail"
|
||||||
|
|
||||||
Box(modifier.fillMaxWidth()) {
|
Box(modifier.fillMaxWidth()) {
|
||||||
Column {
|
Column {
|
||||||
@@ -435,7 +544,7 @@ private fun QueryRow(
|
|||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
"${DnsMessage.typeName(entry.type)} · $detail",
|
summary,
|
||||||
color = Palette.Fg3,
|
color = Palette.Fg3,
|
||||||
fontSize = 12.sp,
|
fontSize = 12.sp,
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
@@ -457,6 +566,7 @@ private fun QueryRow(
|
|||||||
if (blockedByMe) {
|
if (blockedByMe) {
|
||||||
DropdownMenuItem(
|
DropdownMenuItem(
|
||||||
text = { Text(stringResource(R.string.mon_unblock)) },
|
text = { Text(stringResource(R.string.mon_unblock)) },
|
||||||
|
leadingIcon = { MenuIcon(R.drawable.ic_check) },
|
||||||
onClick = {
|
onClick = {
|
||||||
menu = false
|
menu = false
|
||||||
onUnblock()
|
onUnblock()
|
||||||
@@ -465,6 +575,7 @@ private fun QueryRow(
|
|||||||
} else if (entry.status != QueryStatus.BLOCKED) {
|
} else if (entry.status != QueryStatus.BLOCKED) {
|
||||||
DropdownMenuItem(
|
DropdownMenuItem(
|
||||||
text = { Text(stringResource(R.string.mon_block)) },
|
text = { Text(stringResource(R.string.mon_block)) },
|
||||||
|
leadingIcon = { MenuIcon(R.drawable.ic_tab_block) },
|
||||||
onClick = {
|
onClick = {
|
||||||
menu = false
|
menu = false
|
||||||
onBlock()
|
onBlock()
|
||||||
@@ -473,6 +584,7 @@ private fun QueryRow(
|
|||||||
}
|
}
|
||||||
DropdownMenuItem(
|
DropdownMenuItem(
|
||||||
text = { Text(stringResource(R.string.copy)) },
|
text = { Text(stringResource(R.string.copy)) },
|
||||||
|
leadingIcon = { MenuIcon(R.drawable.ic_copy) },
|
||||||
onClick = {
|
onClick = {
|
||||||
menu = false
|
menu = false
|
||||||
onCopy()
|
onCopy()
|
||||||
@@ -482,6 +594,11 @@ private fun QueryRow(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun MenuIcon(@DrawableRes icon: Int) {
|
||||||
|
Icon(painterResource(icon), contentDescription = null, tint = Palette.Fg2, modifier = Modifier.size(20.dp))
|
||||||
|
}
|
||||||
|
|
||||||
// First letter of the main part of a domain: "a" for app-measurement.com, "g" for www.google.com
|
// First letter of the main part of a domain: "a" for app-measurement.com, "g" for www.google.com
|
||||||
private fun initialOf(domain: String): String {
|
private fun initialOf(domain: String): String {
|
||||||
val parts = domain.split('.').filter { it.isNotEmpty() }
|
val parts = domain.split('.').filter { it.isNotEmpty() }
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ import androidx.compose.runtime.setValue
|
|||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
|
import androidx.compose.ui.draw.drawBehind
|
||||||
import androidx.compose.ui.draw.shadow
|
import androidx.compose.ui.draw.shadow
|
||||||
import androidx.compose.ui.graphics.Brush
|
import androidx.compose.ui.graphics.Brush
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
@@ -59,6 +60,8 @@ private enum class Screen(@StringRes val label: Int, @DrawableRes val icon: Int,
|
|||||||
ABOUT(R.string.tab_about, R.drawable.ic_tab_info, false),
|
ABOUT(R.string.tab_about, R.drawable.ic_tab_info, false),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val Tabs = Screen.entries.filter { it.isTab }
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun AppShell() {
|
fun AppShell() {
|
||||||
var tab by rememberSaveable { mutableStateOf(Screen.HOME) }
|
var tab by rememberSaveable { mutableStateOf(Screen.HOME) }
|
||||||
@@ -101,6 +104,7 @@ fun AppShell() {
|
|||||||
Screen.HOME -> HomeScreen(
|
Screen.HOME -> HomeScreen(
|
||||||
bottomPadding = tabBottom,
|
bottomPadding = tabBottom,
|
||||||
onOpenBlocklist = { page = Screen.BLOCKLIST },
|
onOpenBlocklist = { page = Screen.BLOCKLIST },
|
||||||
|
onOpenServers = { tab = Screen.SETTINGS },
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
)
|
)
|
||||||
Screen.ACTIVITY -> ActivityScreen(bottomPadding = tabBottom, modifier = modifier)
|
Screen.ACTIVITY -> ActivityScreen(bottomPadding = tabBottom, modifier = modifier)
|
||||||
@@ -160,30 +164,34 @@ private fun NavPill(current: Screen, onSelect: (Screen) -> Unit, modifier: Modif
|
|||||||
.selectableGroup(),
|
.selectableGroup(),
|
||||||
horizontalArrangement = Arrangement.spacedBy(4.dp),
|
horizontalArrangement = Arrangement.spacedBy(4.dp),
|
||||||
) {
|
) {
|
||||||
Screen.entries.filter { it.isTab }.forEach { item ->
|
Tabs.forEach { item -> NavItem(item, selected = item == current, onSelect = onSelect) }
|
||||||
val selected = item == current
|
}
|
||||||
val background by animateColorAsState(
|
}
|
||||||
if (selected) Palette.AccentSoft else Color.Transparent,
|
|
||||||
animationSpec = Motion.color,
|
// One tab of the panel. Its own composable, so a color animation recomposes only the tabs that
|
||||||
label = "navBackground",
|
// change instead of the whole panel; the background is read only when drawing.
|
||||||
)
|
@Composable
|
||||||
val tint by animateColorAsState(
|
private fun NavItem(item: Screen, selected: Boolean, onSelect: (Screen) -> Unit) {
|
||||||
if (selected) Palette.Accent else Palette.NavIcon,
|
val background by animateColorAsState(
|
||||||
animationSpec = Motion.color,
|
if (selected) Palette.AccentSoft else Color.Transparent,
|
||||||
label = "navTint",
|
animationSpec = Motion.color,
|
||||||
)
|
label = "navBackground",
|
||||||
val label = stringResource(item.label)
|
)
|
||||||
Box(
|
val tint by animateColorAsState(
|
||||||
modifier = Modifier
|
if (selected) Palette.Accent else Palette.NavIcon,
|
||||||
.size(width = 58.dp, height = 44.dp)
|
animationSpec = Motion.color,
|
||||||
.clip(RoundedCornerShape(22.dp))
|
label = "navTint",
|
||||||
.background(background)
|
)
|
||||||
.selectable(selected = selected, onClick = { onSelect(item) }, role = Role.Tab)
|
val label = stringResource(item.label)
|
||||||
.semantics { contentDescription = label },
|
Box(
|
||||||
contentAlignment = Alignment.Center,
|
modifier = Modifier
|
||||||
) {
|
.size(width = 58.dp, height = 44.dp)
|
||||||
Icon(painterResource(item.icon), contentDescription = null, tint = tint, modifier = Modifier.size(22.dp))
|
.clip(RoundedCornerShape(22.dp))
|
||||||
}
|
.drawBehind { drawRect(background) }
|
||||||
}
|
.selectable(selected = selected, onClick = { onSelect(item) }, role = Role.Tab)
|
||||||
|
.semantics { contentDescription = label },
|
||||||
|
contentAlignment = Alignment.Center,
|
||||||
|
) {
|
||||||
|
Icon(painterResource(item.icon), contentDescription = null, tint = tint, modifier = Modifier.size(22.dp))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ import androidx.compose.material3.HorizontalDivider
|
|||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.OutlinedTextField
|
import androidx.compose.material3.OutlinedTextField
|
||||||
import androidx.compose.material3.Switch
|
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TextButton
|
import androidx.compose.material3.TextButton
|
||||||
import androidx.compose.material3.TriStateCheckbox
|
import androidx.compose.material3.TriStateCheckbox
|
||||||
@@ -338,7 +337,7 @@ private fun AppRow(modifier: Modifier, app: AppItem, enabled: Boolean, last: Boo
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
Spacer(Modifier.width(12.dp))
|
Spacer(Modifier.width(12.dp))
|
||||||
Switch(checked = enabled, onCheckedChange = null, colors = appSwitchColors())
|
AppSwitch(checked = enabled, onCheckedChange = null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,9 +66,16 @@ object Blocklist {
|
|||||||
private var customHashes = LongArray(0)
|
private var customHashes = LongArray(0)
|
||||||
private var loaded = false
|
private var loaded = false
|
||||||
|
|
||||||
|
// False until the saved lists have been read at start-up
|
||||||
|
private val _ready = MutableStateFlow(false)
|
||||||
|
val ready: StateFlow<Boolean> = _ready
|
||||||
|
|
||||||
fun isBlocked(name: String): Boolean = _enabled.value && isBlockedIn(name, listHashes, customHashes)
|
fun isBlocked(name: String): Boolean = _enabled.value && isBlockedIn(name, listHashes, customHashes)
|
||||||
|
|
||||||
fun reload(context: Context) = synchronized(lock) { load(BlocklistStore(context)) }
|
// Reads the saved lists unless something did already, such as the background update job
|
||||||
|
fun ensureLoaded(context: Context) {
|
||||||
|
synchronized(lock) { ensureLoaded(BlocklistStore(context)) }
|
||||||
|
}
|
||||||
|
|
||||||
fun setEnabled(context: Context, value: Boolean) {
|
fun setEnabled(context: Context, value: Boolean) {
|
||||||
BlocklistStore(context).enabled = value
|
BlocklistStore(context).enabled = value
|
||||||
@@ -212,6 +219,7 @@ object Blocklist {
|
|||||||
customHashes = LongArray(custom.size) { DomainHash.of(custom[it]) }.sortUnique()
|
customHashes = LongArray(custom.size) { DomainHash.of(custom[it]) }.sortUnique()
|
||||||
reloadListHashes(store)
|
reloadListHashes(store)
|
||||||
loaded = true
|
loaded = true
|
||||||
|
_ready.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun reloadListHashes(store: BlocklistStore) {
|
private fun reloadListHashes(store: BlocklistStore) {
|
||||||
@@ -226,20 +234,28 @@ object Blocklist {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// True when the name or one of its parent domains is in either sorted hash set
|
// True when the name or one of its parent domains is in either sorted hash set. Runs for every
|
||||||
|
// query, so trailing dots are skipped by index rather than trimmed off a copy of the name.
|
||||||
internal fun isBlockedIn(name: String, lists: LongArray, custom: LongArray): Boolean {
|
internal fun isBlockedIn(name: String, lists: LongArray, custom: LongArray): Boolean {
|
||||||
if (lists.isEmpty() && custom.isEmpty()) return false
|
if (lists.isEmpty() && custom.isEmpty()) return false
|
||||||
val domain = name.trimEnd('.')
|
val end = nameEnd(name)
|
||||||
var start = 0
|
var start = 0
|
||||||
while (true) {
|
while (true) {
|
||||||
val hash = DomainHash.of(domain, start)
|
val hash = DomainHash.of(name, start, end)
|
||||||
if (lists.binarySearch(hash) >= 0 || custom.binarySearch(hash) >= 0) return true
|
if (lists.binarySearch(hash) >= 0 || custom.binarySearch(hash) >= 0) return true
|
||||||
val dot = domain.indexOf('.', start)
|
val dot = name.indexOf('.', start)
|
||||||
if (dot < 0) return false
|
if (dot < 0 || dot >= end) return false
|
||||||
start = dot + 1
|
start = dot + 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Length of the name without trailing dots
|
||||||
|
internal fun nameEnd(name: String): Int {
|
||||||
|
var end = name.length
|
||||||
|
while (end > 0 && name[end - 1] == '.') end--
|
||||||
|
return end
|
||||||
|
}
|
||||||
|
|
||||||
// Number of distinct entries in both sorted sets; the custom set is small
|
// Number of distinct entries in both sorted sets; the custom set is small
|
||||||
internal fun unionSize(lists: LongArray, custom: LongArray): Int =
|
internal fun unionSize(lists: LongArray, custom: LongArray): Int =
|
||||||
lists.size + custom.count { lists.binarySearch(it) < 0 }
|
lists.size + custom.count { lists.binarySearch(it) < 0 }
|
||||||
@@ -282,10 +298,10 @@ internal object DomainHash {
|
|||||||
private const val FNV_OFFSET = -3750763034362895579L // 0xcbf29ce484222325
|
private const val FNV_OFFSET = -3750763034362895579L // 0xcbf29ce484222325
|
||||||
private const val FNV_PRIME = 1099511628211L
|
private const val FNV_PRIME = 1099511628211L
|
||||||
|
|
||||||
// FNV-1a over the domain starting at [start], so parent domains are hashed without substrings
|
// FNV-1a over the characters from [start] to [end], so parent domains are hashed without substrings
|
||||||
fun of(s: String, start: Int = 0): Long {
|
fun of(s: String, start: Int = 0, end: Int = s.length): Long {
|
||||||
var h = FNV_OFFSET
|
var h = FNV_OFFSET
|
||||||
for (i in start until s.length) {
|
for (i in start until end) {
|
||||||
h = h xor s[i].code.toLong()
|
h = h xor s[i].code.toLong()
|
||||||
h *= FNV_PRIME
|
h *= FNV_PRIME
|
||||||
}
|
}
|
||||||
@@ -316,8 +332,12 @@ private fun LongArray.sortUnique(): LongArray {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class BlocklistStore(context: Context) {
|
private class BlocklistStore(context: Context) {
|
||||||
private val dir = File(context.filesDir, "blocklist").apply { mkdirs() }
|
private val appContext = context.applicationContext
|
||||||
private val sp = context.getSharedPreferences("blocklist", Context.MODE_PRIVATE)
|
|
||||||
|
// Created on first use: switching blocking on or off, which happens on the main thread,
|
||||||
|
// touches only the settings
|
||||||
|
private val dir by lazy { File(appContext.filesDir, "blocklist").apply { mkdirs() } }
|
||||||
|
private val sp = appContext.getSharedPreferences("blocklist", Context.MODE_PRIVATE)
|
||||||
|
|
||||||
var enabled: Boolean
|
var enabled: Boolean
|
||||||
get() = sp.getBoolean("enabled", true)
|
get() = sp.getBoolean("enabled", true)
|
||||||
@@ -340,7 +360,7 @@ private class BlocklistStore(context: Context) {
|
|||||||
val array = JSONArray(raw)
|
val array = JSONArray(raw)
|
||||||
(0 until array.length()).map {
|
(0 until array.length()).map {
|
||||||
val o = array.getJSONObject(it)
|
val o = array.getJSONObject(it)
|
||||||
RemoteList(o.getString("url"), o.getInt("count"), o.getLong("updated"), o.optBoolean("enabled", true))
|
RemoteList(o.getString("url"), o.getInt("count"), o.getLong("updated"), o.getBoolean("enabled"))
|
||||||
}
|
}
|
||||||
}.getOrDefault(emptyList())
|
}.getOrDefault(emptyList())
|
||||||
}
|
}
|
||||||
@@ -357,7 +377,6 @@ private class BlocklistStore(context: Context) {
|
|||||||
|
|
||||||
fun loadListHashes(url: String): LongArray {
|
fun loadListHashes(url: String): LongArray {
|
||||||
val file = binFile(url)
|
val file = binFile(url)
|
||||||
if (!file.exists()) migrateText(url)?.let { return it }
|
|
||||||
if (!file.exists()) return LongArray(0)
|
if (!file.exists()) return LongArray(0)
|
||||||
return runCatching {
|
return runCatching {
|
||||||
FileInputStream(file).use { stream ->
|
FileInputStream(file).use { stream ->
|
||||||
@@ -371,7 +390,6 @@ private class BlocklistStore(context: Context) {
|
|||||||
|
|
||||||
fun deleteListFile(url: String) {
|
fun deleteListFile(url: String) {
|
||||||
binFile(url).delete()
|
binFile(url).delete()
|
||||||
textFile(url).delete()
|
|
||||||
sp.edit().remove(etagKey(url)).remove(modifiedKey(url)).apply()
|
sp.edit().remove(etagKey(url)).remove(modifiedKey(url)).apply()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -420,16 +438,6 @@ private class BlocklistStore(context: Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lists saved by older versions as plain text are converted once
|
|
||||||
private fun migrateText(url: String): LongArray? {
|
|
||||||
val text = textFile(url)
|
|
||||||
if (!text.exists()) return null
|
|
||||||
val result = text.readLines().map { DomainHash.of(it) }.toLongArray().sortUnique()
|
|
||||||
runCatching { write(url, result) }
|
|
||||||
text.delete()
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun etagKey(url: String) = "etag_${hash(url)}"
|
private fun etagKey(url: String) = "etag_${hash(url)}"
|
||||||
private fun modifiedKey(url: String) = "modified_${hash(url)}"
|
private fun modifiedKey(url: String) = "modified_${hash(url)}"
|
||||||
|
|
||||||
@@ -437,7 +445,6 @@ private class BlocklistStore(context: Context) {
|
|||||||
if (value == null) remove(key) else putString(key, value)
|
if (value == null) remove(key) else putString(key, value)
|
||||||
|
|
||||||
private fun binFile(url: String) = File(dir, "list_${hash(url)}.bin")
|
private fun binFile(url: String) = File(dir, "list_${hash(url)}.bin")
|
||||||
private fun textFile(url: String) = File(dir, "list_${hash(url)}.txt")
|
|
||||||
|
|
||||||
private fun hash(url: String) = MessageDigest.getInstance("SHA-256").digest(url.toByteArray())
|
private fun hash(url: String) = MessageDigest.getInstance("SHA-256").digest(url.toByteArray())
|
||||||
.take(8).joinToString("") { "%02x".format(it) }
|
.take(8).joinToString("") { "%02x".format(it) }
|
||||||
|
|||||||
@@ -75,8 +75,11 @@ private class Preset(val name: String, val url: String, @StringRes val descripti
|
|||||||
|
|
||||||
private const val HAGEZI_HOME = "https://github.com/hagezi/dns-blocklists"
|
private const val HAGEZI_HOME = "https://github.com/hagezi/dns-blocklists"
|
||||||
|
|
||||||
|
// Offered on Home when no list is switched on
|
||||||
|
internal const val HAGEZI_PRO_URL = "https://raw.githubusercontent.com/hagezi/dns-blocklists/main/adblock/pro.txt"
|
||||||
|
|
||||||
private val Presets = listOf(
|
private val Presets = listOf(
|
||||||
Preset("HaGeZi Pro", "https://raw.githubusercontent.com/hagezi/dns-blocklists/main/adblock/pro.txt", R.string.preset_pro_desc),
|
Preset("HaGeZi Pro", HAGEZI_PRO_URL, R.string.preset_pro_desc),
|
||||||
Preset("HaGeZi Pro++", "https://raw.githubusercontent.com/hagezi/dns-blocklists/main/adblock/pro.plus.txt", R.string.preset_proplus_desc),
|
Preset("HaGeZi Pro++", "https://raw.githubusercontent.com/hagezi/dns-blocklists/main/adblock/pro.plus.txt", R.string.preset_proplus_desc),
|
||||||
Preset("HaGeZi TIF", "https://raw.githubusercontent.com/hagezi/dns-blocklists/main/adblock/tif.txt", R.string.preset_tif_desc),
|
Preset("HaGeZi TIF", "https://raw.githubusercontent.com/hagezi/dns-blocklists/main/adblock/tif.txt", R.string.preset_tif_desc),
|
||||||
)
|
)
|
||||||
@@ -89,6 +92,7 @@ fun BlocklistScreen(bottomPadding: Dp, onBack: () -> Unit, modifier: Modifier =
|
|||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
val prefs = remember { Prefs(context) }
|
val prefs = remember { Prefs(context) }
|
||||||
|
val side = sidePadding(windowWidth())
|
||||||
|
|
||||||
val enabled by Blocklist.enabled.collectAsStateWithLifecycle()
|
val enabled by Blocklist.enabled.collectAsStateWithLifecycle()
|
||||||
val custom by Blocklist.custom.collectAsStateWithLifecycle()
|
val custom by Blocklist.custom.collectAsStateWithLifecycle()
|
||||||
@@ -96,8 +100,7 @@ fun BlocklistScreen(bottomPadding: Dp, onBack: () -> Unit, modifier: Modifier =
|
|||||||
// Downloads live in Blocklist, so they keep running and stay visible when the page is closed
|
// Downloads live in Blocklist, so they keep running and stay visible when the page is closed
|
||||||
val busy by Blocklist.busy.collectAsStateWithLifecycle()
|
val busy by Blocklist.busy.collectAsStateWithLifecycle()
|
||||||
val error by Blocklist.error.collectAsStateWithLifecycle()
|
val error by Blocklist.error.collectAsStateWithLifecycle()
|
||||||
val lastError = remember { arrayOf("") } // kept while the card animates out
|
val shownError = rememberLast(error).orEmpty()
|
||||||
error?.let { lastError[0] = it }
|
|
||||||
|
|
||||||
var search by rememberSaveable { mutableStateOf("") }
|
var search by rememberSaveable { mutableStateOf("") }
|
||||||
var domainsOpen by rememberSaveable { mutableStateOf(false) }
|
var domainsOpen by rememberSaveable { mutableStateOf(false) }
|
||||||
@@ -129,7 +132,7 @@ fun BlocklistScreen(bottomPadding: Dp, onBack: () -> Unit, modifier: Modifier =
|
|||||||
|
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
contentPadding = PaddingValues(start = 20.dp, end = 20.dp, bottom = bottomPadding),
|
contentPadding = PaddingValues(start = side, end = side, bottom = bottomPadding),
|
||||||
) {
|
) {
|
||||||
item(key = "header") {
|
item(key = "header") {
|
||||||
PageHeader(
|
PageHeader(
|
||||||
@@ -163,7 +166,7 @@ fun BlocklistScreen(bottomPadding: Dp, onBack: () -> Unit, modifier: Modifier =
|
|||||||
AnimatedVisibility(visible = error != null, enter = Motion.expandIn, exit = Motion.collapseOut) {
|
AnimatedVisibility(visible = error != null, enter = Motion.expandIn, exit = Motion.collapseOut) {
|
||||||
Box(Modifier.padding(top = 12.dp)) {
|
Box(Modifier.padding(top = 12.dp)) {
|
||||||
HintCard(
|
HintCard(
|
||||||
stringResource(R.string.bl_download_failed, lastError[0]),
|
stringResource(R.string.bl_download_failed, shownError),
|
||||||
icon = R.drawable.ic_alert,
|
icon = R.drawable.ic_alert,
|
||||||
tint = Palette.Blocked,
|
tint = Palette.Blocked,
|
||||||
)
|
)
|
||||||
@@ -382,7 +385,7 @@ private fun UpdatesRow(interval: UpdateInterval, wifiOnly: Boolean, onClick: ()
|
|||||||
.padding(horizontal = 14.dp, vertical = 10.dp),
|
.padding(horizontal = 14.dp, vertical = 10.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
) {
|
||||||
Icon(painterResource(R.drawable.ic_refresh), contentDescription = null, tint = Palette.Accent, modifier = Modifier.size(20.dp))
|
Icon(painterResource(R.drawable.ic_update), contentDescription = null, tint = Palette.Accent, modifier = Modifier.size(20.dp))
|
||||||
Spacer(Modifier.width(12.dp))
|
Spacer(Modifier.width(12.dp))
|
||||||
Column(Modifier.weight(1f)) {
|
Column(Modifier.weight(1f)) {
|
||||||
Text(stringResource(R.string.auto_update), color = Palette.Fg, fontSize = 14.sp, fontWeight = FontWeight.Bold)
|
Text(stringResource(R.string.auto_update), color = Palette.Fg, fontSize = 14.sp, fontWeight = FontWeight.Bold)
|
||||||
@@ -430,16 +433,7 @@ private fun BlocklistCard(
|
|||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
modifier = Modifier.weight(1f),
|
modifier = Modifier.weight(1f),
|
||||||
)
|
)
|
||||||
if (onDelete != null) {
|
if (onDelete != null) DeleteButton(onDelete)
|
||||||
IconButton(onClick = onDelete) {
|
|
||||||
Icon(
|
|
||||||
painterResource(R.drawable.ic_delete),
|
|
||||||
contentDescription = stringResource(R.string.delete),
|
|
||||||
tint = Palette.Fg3,
|
|
||||||
modifier = Modifier.size(20.dp),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
AppSwitch(checked = checked, onCheckedChange = onCheckedChange, enabled = switchEnabled)
|
AppSwitch(checked = checked, onCheckedChange = onCheckedChange, enabled = switchEnabled)
|
||||||
}
|
}
|
||||||
Text(
|
Text(
|
||||||
@@ -547,7 +541,7 @@ private fun DomainRow(domain: String, shape: Shape, onDelete: () -> Unit, modifi
|
|||||||
.clip(shape)
|
.clip(shape)
|
||||||
.background(Palette.Card)
|
.background(Palette.Card)
|
||||||
) {
|
) {
|
||||||
HorizontalDivider(modifier = Modifier.padding(horizontal = 16.dp), color = Palette.Line)
|
ListDivider()
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier.padding(start = 16.dp, end = 4.dp),
|
modifier = Modifier.padding(start = 16.dp, end = 4.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
@@ -560,18 +554,23 @@ private fun DomainRow(domain: String, shape: Shape, onDelete: () -> Unit, modifi
|
|||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
modifier = Modifier.weight(1f),
|
modifier = Modifier.weight(1f),
|
||||||
)
|
)
|
||||||
IconButton(onClick = onDelete) {
|
DeleteButton(onDelete)
|
||||||
Icon(
|
|
||||||
painterResource(R.drawable.ic_delete),
|
|
||||||
contentDescription = stringResource(R.string.delete),
|
|
||||||
tint = Palette.Fg3,
|
|
||||||
modifier = Modifier.size(20.dp),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun DeleteButton(onClick: () -> Unit) {
|
||||||
|
IconButton(onClick = onClick) {
|
||||||
|
Icon(
|
||||||
|
painterResource(R.drawable.ic_delete),
|
||||||
|
contentDescription = stringResource(R.string.delete),
|
||||||
|
tint = Palette.Fg3,
|
||||||
|
modifier = Modifier.size(20.dp),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun AddListDialog(busy: Boolean, onAdd: (String) -> Boolean, onDismiss: () -> Unit) {
|
private fun AddListDialog(busy: Boolean, onAdd: (String) -> Boolean, onDismiss: () -> Unit) {
|
||||||
var url by rememberSaveable { mutableStateOf("") }
|
var url by rememberSaveable { mutableStateOf("") }
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
package cc.skysparkle.sparkledns
|
package cc.skysparkle.sparkledns
|
||||||
|
|
||||||
|
import java.util.Locale
|
||||||
|
import java.util.TreeMap
|
||||||
|
|
||||||
// The position of each company is saved in StatsStore: add new ones at the end only
|
// The position of each company is saved in StatsStore: add new ones at the end only
|
||||||
enum class Company(val label: String) {
|
enum class Company(val label: String) {
|
||||||
GOOGLE("Google"),
|
GOOGLE("Google"),
|
||||||
@@ -17,8 +20,22 @@ enum class Company(val label: String) {
|
|||||||
// Tells which big company a domain belongs to, for the Company dominance card.
|
// Tells which big company a domain belongs to, for the Company dominance card.
|
||||||
// Matches the domain and every parent of it against a small built-in table.
|
// Matches the domain and every parent of it against a small built-in table.
|
||||||
object Companies {
|
object Companies {
|
||||||
private val bySuffix = HashMap<String, Company>().apply {
|
private const val GOOGLE_PREFIX = "google."
|
||||||
fun add(company: Company, vararg domains: String) = domains.forEach { put(it, company) }
|
|
||||||
|
// Second-level labels that belong to a country's suffix: example.co.uk, example.com.br
|
||||||
|
private val COUNTRY_SECOND_LEVELS = setOf("co", "com", "net", "org", "gov", "edu", "ac", "or", "ne", "go")
|
||||||
|
|
||||||
|
// Names that are not public sites: reverse lookups and local networks
|
||||||
|
private val PRIVATE_TLDS = setOf("arpa", "local", "lan", "home", "internal", "localhost")
|
||||||
|
|
||||||
|
// Hashes of the domains, sorted, with the company of each at the same index: this runs for
|
||||||
|
// every query, and parent domains are looked up by hash without copying the name
|
||||||
|
private val hashes: LongArray
|
||||||
|
private val owners: Array<Company>
|
||||||
|
|
||||||
|
init {
|
||||||
|
val table = TreeMap<Long, Company>()
|
||||||
|
fun add(company: Company, vararg domains: String) = domains.forEach { table[DomainHash.of(it)] = company }
|
||||||
|
|
||||||
add(
|
add(
|
||||||
Company.GOOGLE,
|
Company.GOOGLE,
|
||||||
@@ -62,18 +79,37 @@ object Companies {
|
|||||||
add(Company.YANDEX, "yandex.ru", "yandex.net", "yandex.com", "ya.ru", "yastatic.net", "yandex.by", "yandex.kz")
|
add(Company.YANDEX, "yandex.ru", "yandex.net", "yandex.com", "ya.ru", "yastatic.net", "yandex.by", "yandex.kz")
|
||||||
add(Company.SAMSUNG, "samsung.com", "samsungapps.com", "samsungcloud.com", "samsungqbe.com", "samsungosp.com")
|
add(Company.SAMSUNG, "samsung.com", "samsungapps.com", "samsungcloud.com", "samsungqbe.com", "samsungosp.com")
|
||||||
add(Company.XIAOMI, "xiaomi.com", "xiaomi.net", "mi.com", "miui.com", "mi-img.com")
|
add(Company.XIAOMI, "xiaomi.com", "xiaomi.net", "mi.com", "miui.com", "mi-img.com")
|
||||||
|
|
||||||
|
hashes = table.keys.toLongArray()
|
||||||
|
owners = table.values.toTypedArray()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun of(name: String): Company? {
|
fun of(name: String): Company? {
|
||||||
var domain = name.lowercase().trimEnd('.')
|
// Names from the tunnel are lowercase already; anything else is lowercased once
|
||||||
while (domain.isNotEmpty()) {
|
val domain = if (name.any { it.isUpperCase() }) name.lowercase() else name
|
||||||
bySuffix[domain]?.let { return it }
|
val end = nameEnd(domain)
|
||||||
|
var start = 0
|
||||||
|
while (start < end) {
|
||||||
|
val index = hashes.binarySearch(DomainHash.of(domain, start, end))
|
||||||
|
if (index >= 0) return owners[index]
|
||||||
// Google's country sites: google.de, google.co.uk, google.com.br
|
// Google's country sites: google.de, google.co.uk, google.com.br
|
||||||
if (domain.startsWith("google.") && domain.length - "google.".length <= 6) return Company.GOOGLE
|
if (end - start - GOOGLE_PREFIX.length in 1..6 && domain.startsWith(GOOGLE_PREFIX, start)) return Company.GOOGLE
|
||||||
val dot = domain.indexOf('.')
|
val dot = domain.indexOf('.', start)
|
||||||
if (dot < 0) return null
|
if (dot < 0 || dot >= end) return null
|
||||||
domain = domain.substring(dot + 1)
|
start = dot + 1
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A readable name for a domain of no known company, taken from its main label:
|
||||||
|
// "cdn.example.co.uk" gives "Example". Null for IP addresses, local names and bare labels.
|
||||||
|
fun nameOf(name: String): String? {
|
||||||
|
val labels = name.lowercase(Locale.ROOT).split('.').filter { it.isNotEmpty() }
|
||||||
|
if (labels.size < 2) return null
|
||||||
|
val tld = labels.last()
|
||||||
|
if (tld in PRIVATE_TLDS || tld.all { it.isDigit() }) return null
|
||||||
|
var index = labels.size - 2
|
||||||
|
if (tld.length == 2 && labels.size >= 3 && labels[index] in COUNTRY_SECOND_LEVELS) index--
|
||||||
|
return labels[index].replaceFirstChar { it.titlecase(Locale.ROOT) }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import android.content.Context
|
|||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Process
|
import android.os.Process
|
||||||
import android.os.StrictMode
|
import android.os.StrictMode
|
||||||
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.PrintWriter
|
import java.io.PrintWriter
|
||||||
import java.io.StringWriter
|
import java.io.StringWriter
|
||||||
@@ -17,22 +19,23 @@ class SparkleApp : Application() {
|
|||||||
Thread({
|
Thread({
|
||||||
// Reads what the first screen needs before it asks, so its first frame does not wait on storage
|
// Reads what the first screen needs before it asks, so its first frame does not wait on storage
|
||||||
Prefs(this).providerId
|
Prefs(this).providerId
|
||||||
CrashLog.preload(this)
|
CrashLog.load(this)
|
||||||
StatsStore.init(this)
|
StatsStore.init(this)
|
||||||
// Older versions cached a server list downloaded from the repository
|
|
||||||
File(filesDir, "servers.txt").delete()
|
|
||||||
AutoUpdate.apply(this)
|
AutoUpdate.apply(this)
|
||||||
// Lists can hold millions of entries; loading them should not take CPU from the first frames
|
// Lists can hold millions of entries; loading them should not take CPU from the first frames
|
||||||
Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND)
|
Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND)
|
||||||
runCatching { Blocklist.reload(this) }
|
runCatching { Blocklist.ensureLoaded(this) }
|
||||||
}, "startup-load").start()
|
}, "startup-load").start()
|
||||||
}
|
}
|
||||||
|
|
||||||
// The VPN keeps the process running long after the screens are gone; decoded app icons
|
// The VPN keeps the process running long after the screens are gone; decoded app icons
|
||||||
// (up to 10 MB) can be rendered again the next time the Apps tab opens
|
// (up to 10 MB) and the logo can be rendered again the next time they are shown
|
||||||
override fun onTrimMemory(level: Int) {
|
override fun onTrimMemory(level: Int) {
|
||||||
super.onTrimMemory(level)
|
super.onTrimMemory(level)
|
||||||
if (level >= TRIM_MEMORY_UI_HIDDEN) clearAppIconCache()
|
if (level >= TRIM_MEMORY_UI_HIDDEN) {
|
||||||
|
clearAppIconCache()
|
||||||
|
AppLogo.clear()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Debug builds only: logs disk and network access on the main thread, leaked closeables and the like
|
// Debug builds only: logs disk and network access on the main thread, leaked closeables and the like
|
||||||
@@ -46,13 +49,18 @@ class SparkleApp : Application() {
|
|||||||
object CrashLog {
|
object CrashLog {
|
||||||
private const val FILE_NAME = "last_crash.txt"
|
private const val FILE_NAME = "last_crash.txt"
|
||||||
|
|
||||||
|
// Null when there is no report, and until the startup thread has read it
|
||||||
|
private val _report = MutableStateFlow<String?>(null)
|
||||||
|
val report: StateFlow<String?> = _report
|
||||||
|
|
||||||
fun install(context: Context) {
|
fun install(context: Context) {
|
||||||
val file = File(context.filesDir, FILE_NAME)
|
val appContext = context.applicationContext
|
||||||
val previous = Thread.getDefaultUncaughtExceptionHandler()
|
val previous = Thread.getDefaultUncaughtExceptionHandler()
|
||||||
Thread.setDefaultUncaughtExceptionHandler { thread, error ->
|
Thread.setDefaultUncaughtExceptionHandler { thread, error ->
|
||||||
runCatching {
|
runCatching {
|
||||||
val trace = StringWriter().also { error.printStackTrace(PrintWriter(it)) }.toString()
|
val trace = StringWriter().also { error.printStackTrace(PrintWriter(it)) }.toString()
|
||||||
file.writeText(
|
// Looked up only now: install() runs on the main thread at start-up
|
||||||
|
File(appContext.filesDir, FILE_NAME).writeText(
|
||||||
"Thread: ${thread.name}\n" +
|
"Thread: ${thread.name}\n" +
|
||||||
"Android ${Build.VERSION.RELEASE} (API ${Build.VERSION.SDK_INT}), " +
|
"Android ${Build.VERSION.RELEASE} (API ${Build.VERSION.SDK_INT}), " +
|
||||||
"${Build.MANUFACTURER} ${Build.MODEL}\n\n$trace"
|
"${Build.MANUFACTURER} ${Build.MODEL}\n\n$trace"
|
||||||
@@ -62,24 +70,14 @@ object CrashLog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Volatile
|
// Runs on the startup thread, so the main thread never reads the file
|
||||||
private var preloaded = false
|
fun load(context: Context) {
|
||||||
|
_report.value = runCatching { File(context.filesDir, FILE_NAME).takeIf { it.exists() }?.readText() }.getOrNull()
|
||||||
@Volatile
|
|
||||||
private var report: String? = null
|
|
||||||
|
|
||||||
fun preload(context: Context) {
|
|
||||||
report = load(context)
|
|
||||||
preloaded = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun read(context: Context): String? = if (preloaded) report else load(context)
|
|
||||||
|
|
||||||
fun clear(context: Context) {
|
fun clear(context: Context) {
|
||||||
report = null
|
_report.value = null
|
||||||
File(context.filesDir, FILE_NAME).delete()
|
val appContext = context.applicationContext
|
||||||
|
Thread({ File(appContext.filesDir, FILE_NAME).delete() }, "crash-clear").start()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun load(context: Context): String? =
|
|
||||||
runCatching { File(context.filesDir, FILE_NAME).takeIf { it.exists() }?.readText() }.getOrNull()
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class DnsCache(
|
|||||||
|
|
||||||
private class Entry(
|
private class Entry(
|
||||||
val response: ByteArray,
|
val response: ByteArray,
|
||||||
val ttlOffsets: IntArray,
|
// Offset and value of each TTL field, one pair after another
|
||||||
val ttls: IntArray,
|
val ttls: IntArray,
|
||||||
val storedAt: Long,
|
val storedAt: Long,
|
||||||
val expiresAt: Long,
|
val expiresAt: Long,
|
||||||
@@ -35,7 +35,12 @@ class DnsCache(
|
|||||||
out[0] = query[0]
|
out[0] = query[0]
|
||||||
out[1] = query[1]
|
out[1] = query[1]
|
||||||
val elapsed = ((now - entry.storedAt) / 1000).toInt()
|
val elapsed = ((now - entry.storedAt) / 1000).toInt()
|
||||||
entry.ttlOffsets.forEachIndexed { i, off -> put32(out, off, maxOf(entry.ttls[i] - elapsed, 0)) }
|
val ttls = entry.ttls
|
||||||
|
var i = 0
|
||||||
|
while (i < ttls.size) {
|
||||||
|
put32(out, ttls[i], maxOf(ttls[i + 1] - elapsed, 0))
|
||||||
|
i += 2
|
||||||
|
}
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,26 +50,32 @@ class DnsCache(
|
|||||||
val rcode = response[3].toInt() and 0x0F
|
val rcode = response[3].toInt() and 0x0F
|
||||||
if (rcode != 0 && rcode != 3) return // only NOERROR and NXDOMAIN
|
if (rcode != 0 && rcode != 3) return // only NOERROR and NXDOMAIN
|
||||||
|
|
||||||
val records = parseTtls(response) ?: return
|
val ttls = parseTtls(response) ?: return
|
||||||
val minTtl = if (records.first.isEmpty()) NO_RECORDS_TTL else records.second.min()
|
var minTtl = if (ttls.isEmpty()) NO_RECORDS_TTL else Int.MAX_VALUE
|
||||||
|
var i = 1
|
||||||
|
while (i < ttls.size) {
|
||||||
|
minTtl = minOf(minTtl, ttls[i])
|
||||||
|
i += 2
|
||||||
|
}
|
||||||
val ttl = minOf(minTtl, MAX_TTL)
|
val ttl = minOf(minTtl, MAX_TTL)
|
||||||
if (ttl <= 0) return
|
if (ttl <= 0) return
|
||||||
|
|
||||||
val now = clock()
|
val now = clock()
|
||||||
val entry = Entry(response.copyOf(), records.first, records.second, now, now + ttl * 1000L)
|
val entry = Entry(response.copyOf(), ttls, now, now + ttl * 1000L)
|
||||||
synchronized(map) { map[key] = entry }
|
synchronized(map) { map[key] = entry }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Offsets and values of every TTL field except the EDNS OPT pseudo-record
|
// Offset and value of every TTL field except the EDNS OPT pseudo-record, as pairs in one array
|
||||||
private fun parseTtls(msg: ByteArray): Pair<IntArray, IntArray>? {
|
private fun parseTtls(msg: ByteArray): IntArray? {
|
||||||
var pos = 12
|
var pos = 12
|
||||||
repeat(u16(msg, 4)) {
|
repeat(u16(msg, 4)) {
|
||||||
pos = skipName(msg, pos) ?: return null
|
pos = skipName(msg, pos) ?: return null
|
||||||
pos += 4
|
pos += 4
|
||||||
}
|
}
|
||||||
val total = u16(msg, 6) + u16(msg, 8) + u16(msg, 10)
|
val total = u16(msg, 6) + u16(msg, 8) + u16(msg, 10)
|
||||||
val offsets = ArrayList<Int>(total)
|
// The counts come from the server; the array grows only if a message really has that many
|
||||||
val values = ArrayList<Int>(total)
|
var ttls = IntArray(2 * minOf(total, 16))
|
||||||
|
var n = 0
|
||||||
repeat(total) {
|
repeat(total) {
|
||||||
pos = skipName(msg, pos) ?: return null
|
pos = skipName(msg, pos) ?: return null
|
||||||
if (pos + 10 > msg.size) return null
|
if (pos + 10 > msg.size) return null
|
||||||
@@ -72,13 +83,14 @@ class DnsCache(
|
|||||||
val ttlOffset = pos + 4
|
val ttlOffset = pos + 4
|
||||||
val rdLength = u16(msg, pos + 8)
|
val rdLength = u16(msg, pos + 8)
|
||||||
if (type != TYPE_OPT) {
|
if (type != TYPE_OPT) {
|
||||||
offsets += ttlOffset
|
if (n == ttls.size) ttls = ttls.copyOf(n * 2)
|
||||||
values += minOf(u32(msg, ttlOffset), Int.MAX_VALUE.toLong()).toInt()
|
ttls[n++] = ttlOffset
|
||||||
|
ttls[n++] = minOf(u32(msg, ttlOffset), Int.MAX_VALUE.toLong()).toInt()
|
||||||
}
|
}
|
||||||
pos += 10 + rdLength
|
pos += 10 + rdLength
|
||||||
if (pos > msg.size) return null
|
if (pos > msg.size) return null
|
||||||
}
|
}
|
||||||
return offsets.toIntArray() to values.toIntArray()
|
return if (n == ttls.size) ttls else ttls.copyOf(n)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun keyOf(query: ByteArray): String? {
|
private fun keyOf(query: ByteArray): String? {
|
||||||
|
|||||||
@@ -124,7 +124,14 @@ class DohVpnService : VpnService() {
|
|||||||
stopSelf()
|
stopSelf()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
session = Session(tun, DohClient(this, provider), ::onSessionFailed).also { it.start() }
|
val next = try {
|
||||||
|
Session(tun, DohClient(this, provider), ::onSessionFailed)
|
||||||
|
} catch (e: IOException) {
|
||||||
|
// A tunnel nobody reads would swallow every DNS lookup on the device
|
||||||
|
runCatching { tun.close() }
|
||||||
|
throw e
|
||||||
|
}
|
||||||
|
session = next.also { it.start() }
|
||||||
runCatching { previous?.stop() }
|
runCatching { previous?.stop() }
|
||||||
|
|
||||||
_active.value = provider
|
_active.value = provider
|
||||||
@@ -210,6 +217,10 @@ private class Session(
|
|||||||
private val pool = Executors.newFixedThreadPool(WORKERS)
|
private val pool = Executors.newFixedThreadPool(WORKERS)
|
||||||
private val cache = DnsCache()
|
private val cache = DnsCache()
|
||||||
private val output = FileOutputStream(tun.fileDescriptor)
|
private val output = FileOutputStream(tun.fileDescriptor)
|
||||||
|
|
||||||
|
// stop() closes the write end, which wakes the reader at once. Otherwise the reader would have
|
||||||
|
// to wake up on a timer to notice that the session ended, also while the device sleeps.
|
||||||
|
private val wakeup = ParcelFileDescriptor.createPipe()
|
||||||
private val reader = Thread(::readLoop, "tun-reader")
|
private val reader = Thread(::readLoop, "tun-reader")
|
||||||
|
|
||||||
fun start() = reader.start()
|
fun start() = reader.start()
|
||||||
@@ -217,6 +228,7 @@ private class Session(
|
|||||||
fun stop() {
|
fun stop() {
|
||||||
if (!alive.getAndSet(false)) return
|
if (!alive.getAndSet(false)) return
|
||||||
pool.shutdownNow()
|
pool.shutdownNow()
|
||||||
|
runCatching { wakeup[1].close() }
|
||||||
runCatching { tun.close() }
|
runCatching { tun.close() }
|
||||||
closer.execute {
|
closer.execute {
|
||||||
try {
|
try {
|
||||||
@@ -230,43 +242,58 @@ private class Session(
|
|||||||
private fun readLoop() {
|
private fun readLoop() {
|
||||||
val input = FileInputStream(tun.fileDescriptor)
|
val input = FileInputStream(tun.fileDescriptor)
|
||||||
val buf = ByteArray(MTU)
|
val buf = ByteArray(MTU)
|
||||||
val pollFd = StructPollfd().apply {
|
val tunFd = StructPollfd().apply {
|
||||||
fd = tun.fileDescriptor
|
fd = tun.fileDescriptor
|
||||||
events = OsConstants.POLLIN.toShort()
|
events = OsConstants.POLLIN.toShort()
|
||||||
}
|
}
|
||||||
|
val wakeupFd = StructPollfd().apply {
|
||||||
|
fd = wakeup[0].fileDescriptor
|
||||||
|
events = OsConstants.POLLIN.toShort()
|
||||||
|
}
|
||||||
|
val fds = arrayOf(tunFd, wakeupFd)
|
||||||
|
|
||||||
var badPackets = 0
|
var badPackets = 0
|
||||||
|
|
||||||
while (alive.get()) {
|
try {
|
||||||
val n = try {
|
while (alive.get()) {
|
||||||
if (Os.poll(arrayOf(pollFd), 500) <= 0) continue
|
val n = try {
|
||||||
input.read(buf)
|
// Sleeps until a packet arrives or stop() closes the pipe
|
||||||
} catch (e: ErrnoException) {
|
if (Os.poll(fds, -1) <= 0) continue
|
||||||
if (e.errno == OsConstants.EINTR) continue
|
if (wakeupFd.revents.toInt() != 0) {
|
||||||
readerFailed(e)
|
// Only stop() touches the pipe, so this ends the loop
|
||||||
return
|
readerFailed(null)
|
||||||
} catch (e: IOException) {
|
return
|
||||||
readerFailed(e)
|
}
|
||||||
return
|
input.read(buf)
|
||||||
}
|
} catch (e: ErrnoException) {
|
||||||
if (n < 0) {
|
if (e.errno == OsConstants.EINTR) continue
|
||||||
readerFailed(null)
|
readerFailed(e)
|
||||||
return
|
return
|
||||||
}
|
} catch (e: IOException) {
|
||||||
try {
|
|
||||||
Packet.parseDnsQuery(buf, n)?.let(::dispatch)
|
|
||||||
badPackets = 0
|
|
||||||
} catch (e: RejectedExecutionException) {
|
|
||||||
readerFailed(e)
|
|
||||||
return
|
|
||||||
} catch (e: RuntimeException) {
|
|
||||||
// One packet the code cannot handle must not stop DNS for the whole device
|
|
||||||
Log.w(TAG, "Dropped a packet", e)
|
|
||||||
if (++badPackets >= MAX_BAD_PACKETS) {
|
|
||||||
readerFailed(e)
|
readerFailed(e)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (n < 0) {
|
||||||
|
readerFailed(null)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Packet.parseDnsQuery(buf, n)?.let(::dispatch)
|
||||||
|
badPackets = 0
|
||||||
|
} catch (e: RejectedExecutionException) {
|
||||||
|
readerFailed(e)
|
||||||
|
return
|
||||||
|
} catch (e: RuntimeException) {
|
||||||
|
// One packet the code cannot handle must not stop DNS for the whole device
|
||||||
|
Log.w(TAG, "Dropped a packet", e)
|
||||||
|
if (++badPackets >= MAX_BAD_PACKETS) {
|
||||||
|
readerFailed(e)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
runCatching { wakeup[0].close() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,11 +25,12 @@ import androidx.compose.foundation.clickable
|
|||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.foundation.layout.heightIn
|
||||||
import androidx.compose.foundation.layout.offset
|
import androidx.compose.foundation.layout.offset
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
@@ -39,6 +40,8 @@ import androidx.compose.foundation.selection.toggleable
|
|||||||
import androidx.compose.foundation.shape.CircleShape
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.foundation.verticalScroll
|
import androidx.compose.foundation.verticalScroll
|
||||||
|
import androidx.compose.material3.Button
|
||||||
|
import androidx.compose.material3.CircularProgressIndicator
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TextButton
|
import androidx.compose.material3.TextButton
|
||||||
@@ -47,63 +50,96 @@ import androidx.compose.runtime.LaunchedEffect
|
|||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
|
import androidx.compose.runtime.rememberCoroutineScope
|
||||||
|
import androidx.compose.runtime.saveable.rememberSaveable
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.draw.drawBehind
|
import androidx.compose.ui.draw.drawBehind
|
||||||
|
import androidx.compose.ui.draw.drawWithCache
|
||||||
|
import androidx.compose.ui.geometry.CornerRadius
|
||||||
import androidx.compose.ui.geometry.Offset
|
import androidx.compose.ui.geometry.Offset
|
||||||
|
import androidx.compose.ui.geometry.Size
|
||||||
import androidx.compose.ui.graphics.Brush
|
import androidx.compose.ui.graphics.Brush
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.graphics.Path
|
|
||||||
import androidx.compose.ui.graphics.PathEffect
|
import androidx.compose.ui.graphics.PathEffect
|
||||||
import androidx.compose.ui.graphics.StrokeCap
|
import androidx.compose.ui.graphics.StrokeCap
|
||||||
import androidx.compose.ui.graphics.StrokeJoin
|
|
||||||
import androidx.compose.ui.graphics.drawscope.Stroke
|
|
||||||
import androidx.compose.ui.graphics.graphicsLayer
|
import androidx.compose.ui.graphics.graphicsLayer
|
||||||
|
import androidx.compose.ui.hapticfeedback.HapticFeedbackType
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
import androidx.compose.ui.platform.LocalHapticFeedback
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.semantics.Role
|
import androidx.compose.ui.semantics.Role
|
||||||
import androidx.compose.ui.semantics.contentDescription
|
import androidx.compose.ui.semantics.contentDescription
|
||||||
import androidx.compose.ui.semantics.semantics
|
import androidx.compose.ui.semantics.semantics
|
||||||
|
import androidx.compose.ui.text.TextLayoutResult
|
||||||
import androidx.compose.ui.text.TextStyle
|
import androidx.compose.ui.text.TextStyle
|
||||||
import androidx.compose.ui.text.drawText
|
import androidx.compose.ui.text.drawText
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.text.rememberTextMeasurer
|
import androidx.compose.ui.text.rememberTextMeasurer
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
|
import androidx.compose.ui.unit.Constraints
|
||||||
import androidx.compose.ui.unit.Dp
|
import androidx.compose.ui.unit.Dp
|
||||||
|
import androidx.compose.ui.unit.IntOffset
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import kotlinx.coroutines.delay
|
|
||||||
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
|
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.Calendar
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
import java.util.TimeZone
|
||||||
|
import kotlin.math.ceil
|
||||||
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
private const val CHART_HOURS = 24
|
private const val HOUR_MS = 3_600_000L
|
||||||
|
|
||||||
|
// One bar of the chart: an hour, or a day in the 7-day view
|
||||||
|
private data class Bar(val total: Long, val blocked: Long)
|
||||||
|
|
||||||
|
// Bars with the labels under them: the first hour of the day view, or every day of the week.
|
||||||
|
// A refresh that brings equal data leaves the chart alone.
|
||||||
|
private data class Chart(val period: StatsPeriod, val bars: List<Bar>, val labels: List<String>)
|
||||||
|
|
||||||
|
private val ChartLabelStyle = TextStyle(color = Palette.Fg3, fontSize = 10.sp)
|
||||||
|
|
||||||
|
// Where the three grip lines on the knob of the power switch sit, as fractions of its width
|
||||||
|
private val KnobLines = floatArrayOf(0.29f, 0.5f, 0.71f)
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun HomeScreen(bottomPadding: Dp, onOpenBlocklist: () -> Unit, modifier: Modifier = Modifier) {
|
fun HomeScreen(
|
||||||
|
bottomPadding: Dp,
|
||||||
|
onOpenBlocklist: () -> Unit,
|
||||||
|
onOpenServers: () -> Unit,
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
|
) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val prefs = remember { Prefs(context) }
|
val prefs = remember { Prefs(context) }
|
||||||
|
val haptics = LocalHapticFeedback.current
|
||||||
|
val scope = rememberCoroutineScope()
|
||||||
val active by DohVpnService.active.collectAsStateWithLifecycle()
|
val active by DohVpnService.active.collectAsStateWithLifecycle()
|
||||||
val running = active != null
|
val running = active != null
|
||||||
val lists by Blocklist.lists.collectAsStateWithLifecycle()
|
val lists by Blocklist.lists.collectAsStateWithLifecycle()
|
||||||
val total by Blocklist.total.collectAsStateWithLifecycle()
|
val total by Blocklist.total.collectAsStateWithLifecycle()
|
||||||
val blocking by Blocklist.enabled.collectAsStateWithLifecycle()
|
val blocking by Blocklist.enabled.collectAsStateWithLifecycle()
|
||||||
|
val listsReady by Blocklist.ready.collectAsStateWithLifecycle()
|
||||||
|
val download by Blocklist.busy.collectAsStateWithLifecycle()
|
||||||
|
val downloadError by Blocklist.error.collectAsStateWithLifecycle()
|
||||||
|
|
||||||
var summary by remember { mutableStateOf(StatsStore.summary(CHART_HOURS)) }
|
var period by rememberSaveable { mutableStateOf(StatsPeriod.DAY) }
|
||||||
var points by remember { mutableStateOf(StatsStore.hourly(CHART_HOURS)) }
|
var summary by remember { mutableStateOf(StatsStore.summary(period.hours)) }
|
||||||
|
var chartData by remember { mutableStateOf(buildChart(period)) }
|
||||||
fun refreshStats() {
|
fun refreshStats() {
|
||||||
summary = StatsStore.summary(CHART_HOURS)
|
summary = StatsStore.summary(period.hours)
|
||||||
points = StatsStore.hourly(CHART_HOURS)
|
chartData = buildChart(period)
|
||||||
}
|
}
|
||||||
OnQueryLogChange { refreshStats() }
|
OnQueryLogChange { refreshStats() }
|
||||||
val statsVersion by StatsStore.version.collectAsStateWithLifecycle()
|
val statsVersion by StatsStore.version.collectAsStateWithLifecycle()
|
||||||
LaunchedEffect(statsVersion) { refreshStats() }
|
LaunchedEffect(statsVersion, period) { refreshStats() }
|
||||||
|
|
||||||
// The server is picked in Settings; this screen is composed anew each time it is shown
|
// The server is picked in Settings; this screen is composed anew each time it is shown
|
||||||
val selected = remember { prefs.resolve() }
|
val selected = remember { prefs.resolve() }
|
||||||
@@ -111,21 +147,12 @@ fun HomeScreen(bottomPadding: Dp, onOpenBlocklist: () -> Unit, modifier: Modifie
|
|||||||
val shown = active ?: selected
|
val shown = active ?: selected
|
||||||
val usesHttp3 = shown.http3 && Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE
|
val usesHttp3 = shown.http3 && Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE
|
||||||
|
|
||||||
val crashReport = remember { CrashLog.read(context) }
|
val crashReport by CrashLog.report.collectAsStateWithLifecycle()
|
||||||
var crashVisible by remember { mutableStateOf(crashReport != null) }
|
val shownReport = rememberLast(crashReport).orEmpty() // kept while the card animates out
|
||||||
// Strict Private DNS makes Android ignore the VPN's DNS server; followed while Home is visible
|
// Strict Private DNS makes Android ignore the VPN's DNS server; followed while Home is visible
|
||||||
val privateDnsHost by remember { privateDnsHosts(context) }.collectAsStateWithLifecycle(initialValue = null)
|
val privateDnsHost by remember { privateDnsHosts(context) }.collectAsStateWithLifecycle(initialValue = null)
|
||||||
|
|
||||||
// Set by a tap until the VPN state changes or the attempt gives up, so a double tap neither
|
var busy by rememberVpnBusy(active)
|
||||||
// starts two connections nor switches the VPN back on right after turning it off
|
|
||||||
var busy by remember { mutableStateOf(false) }
|
|
||||||
LaunchedEffect(active) { busy = false }
|
|
||||||
LaunchedEffect(busy) {
|
|
||||||
if (busy) {
|
|
||||||
delay(BUSY_TIMEOUT_MS)
|
|
||||||
busy = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val vpnPermission = rememberLauncherForActivityResult(
|
val vpnPermission = rememberLauncherForActivityResult(
|
||||||
ActivityResultContracts.StartActivityForResult()
|
ActivityResultContracts.StartActivityForResult()
|
||||||
@@ -148,6 +175,7 @@ fun HomeScreen(bottomPadding: Dp, onOpenBlocklist: () -> Unit, modifier: Modifie
|
|||||||
fun toggle() {
|
fun toggle() {
|
||||||
if (busy) return
|
if (busy) return
|
||||||
busy = true
|
busy = true
|
||||||
|
haptics.performHapticFeedback(if (running) HapticFeedbackType.ToggleOff else HapticFeedbackType.ToggleOn)
|
||||||
if (running) {
|
if (running) {
|
||||||
sendAction(context, DohVpnService.ACTION_STOP)
|
sendAction(context, DohVpnService.ACTION_STOP)
|
||||||
return
|
return
|
||||||
@@ -158,65 +186,50 @@ fun HomeScreen(bottomPadding: Dp, onOpenBlocklist: () -> Unit, modifier: Modifie
|
|||||||
else connectVpn()
|
else connectVpn()
|
||||||
}
|
}
|
||||||
|
|
||||||
val glow by animateFloatAsState(if (running) 1f else 0f, tween(600), label = "glow")
|
// What the blocklist card offers: nothing, switching blocking back on, or a first list
|
||||||
|
val proList = lists.firstOrNull { it.url == HAGEZI_PRO_URL }
|
||||||
Column(
|
val offer = when {
|
||||||
modifier = modifier
|
!listsReady -> BlocklistOffer.NONE
|
||||||
.verticalScroll(rememberScrollState())
|
!blocking -> BlocklistOffer.SWITCH_ON
|
||||||
.drawBehind {
|
total == 0 && lists.none { it.enabled } -> BlocklistOffer.FIRST_LIST
|
||||||
// Soft light behind the logo while protected
|
else -> BlocklistOffer.NONE
|
||||||
if (glow > 0f) {
|
}
|
||||||
drawCircle(
|
fun acceptOffer() {
|
||||||
brush = Brush.radialGradient(
|
when (offer) {
|
||||||
colors = listOf(Palette.Accent.copy(alpha = 0.22f * glow), Color.Transparent),
|
BlocklistOffer.SWITCH_ON -> Blocklist.setEnabled(context, true)
|
||||||
center = Offset(size.width / 2f, 0f),
|
BlocklistOffer.FIRST_LIST ->
|
||||||
radius = size.width * 0.65f,
|
if (proList != null) scope.editBlocklist(context) { Blocklist.setListEnabled(context, HAGEZI_PRO_URL, true) }
|
||||||
),
|
else Blocklist.download(context, HAGEZI_PRO_URL)
|
||||||
radius = size.width * 0.65f,
|
BlocklistOffer.NONE -> Unit
|
||||||
center = Offset(size.width / 2f, 0f),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.padding(top = 16.dp, bottom = bottomPadding),
|
|
||||||
verticalArrangement = Arrangement.spacedBy(20.dp),
|
|
||||||
) {
|
|
||||||
Image(
|
|
||||||
painterResource(R.drawable.app_logo),
|
|
||||||
contentDescription = null,
|
|
||||||
modifier = Modifier
|
|
||||||
.size(44.dp)
|
|
||||||
.align(Alignment.CenterHorizontally),
|
|
||||||
)
|
|
||||||
|
|
||||||
AnimatedVisibility(visible = crashVisible, enter = Motion.expandIn, exit = Motion.collapseOut) {
|
|
||||||
val report = crashReport.orEmpty()
|
|
||||||
Box(Modifier.padding(horizontal = 20.dp)) {
|
|
||||||
CrashCard(
|
|
||||||
report = report,
|
|
||||||
onCopy = {
|
|
||||||
context.getSystemService(ClipboardManager::class.java)
|
|
||||||
.setPrimaryClip(ClipData.newPlainText("SparkleDNS crash", report))
|
|
||||||
},
|
|
||||||
onDismiss = { CrashLog.clear(context); crashVisible = false },
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val glow by animateFloatAsState(if (running) 1f else 0f, tween(600), label = "glow")
|
||||||
|
val wide = windowWidth() >= WideLayoutWidth
|
||||||
|
val side = sidePadding(windowWidth(), if (wide) MaxWideContentWidth else MaxContentWidth)
|
||||||
|
// A tall screen gets a taller chart instead of empty space under the content
|
||||||
|
val chartHeight = if (wide) {
|
||||||
|
(windowHeight() - 420.dp).coerceIn(160.dp, 360.dp)
|
||||||
|
} else {
|
||||||
|
(windowHeight() - 700.dp).coerceIn(150.dp, 320.dp)
|
||||||
|
}
|
||||||
|
|
||||||
|
val status: @Composable () -> Unit = {
|
||||||
StatusCard(
|
StatusCard(
|
||||||
running = running,
|
running = running,
|
||||||
providerName = shown.displayName(context),
|
providerName = shown.displayName(context),
|
||||||
http3 = usesHttp3,
|
http3 = usesHttp3,
|
||||||
enabled = !busy && (running || canConnect),
|
enabled = !busy && (running || canConnect),
|
||||||
onToggle = ::toggle,
|
onToggle = ::toggle,
|
||||||
modifier = Modifier.padding(horizontal = 20.dp),
|
onOpenServers = onOpenServers,
|
||||||
)
|
)
|
||||||
|
PrivateDnsWarning(privateDnsHost, prefs)
|
||||||
PrivateDnsWarning(privateDnsHost, prefs, Modifier.padding(horizontal = 20.dp))
|
}
|
||||||
|
val stats: @Composable () -> Unit = {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(horizontal = 24.dp),
|
.padding(horizontal = 4.dp),
|
||||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||||
) {
|
) {
|
||||||
StatBlock(formatCompact(summary.total), stringResource(R.string.stat_requests), Modifier.weight(1f))
|
StatBlock(formatCompact(summary.total), stringResource(R.string.stat_requests), Modifier.weight(1f))
|
||||||
@@ -228,63 +241,78 @@ fun HomeScreen(bottomPadding: Dp, onOpenBlocklist: () -> Unit, modifier: Modifie
|
|||||||
)
|
)
|
||||||
StatBlock(stringResource(R.string.mon_ms, summary.avgLatencyMs), stringResource(R.string.stat_avg), Modifier.weight(1f))
|
StatBlock(stringResource(R.string.mon_ms, summary.avgLatencyMs), stringResource(R.string.stat_avg), Modifier.weight(1f))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
val chart: @Composable () -> Unit = {
|
||||||
|
ChartSection(chartData, period, chartHeight, onPeriod = { period = it })
|
||||||
|
}
|
||||||
|
val blocklist: @Composable () -> Unit = {
|
||||||
|
BlocklistCard(
|
||||||
|
info = stringResource(R.string.home_lists_info, lists.count { it.enabled }, formatCount(total.toLong())),
|
||||||
|
offer = offer,
|
||||||
|
downloading = download == HAGEZI_PRO_URL,
|
||||||
|
error = if (offer == BlocklistOffer.FIRST_LIST) downloadError else null,
|
||||||
|
canAccept = download == null,
|
||||||
|
onAccept = ::acceptOffer,
|
||||||
|
onClick = onOpenBlocklist,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
Column(verticalArrangement = Arrangement.spacedBy(6.dp)) {
|
Column(
|
||||||
Row(
|
modifier = modifier
|
||||||
modifier = Modifier
|
.verticalScroll(rememberScrollState())
|
||||||
.fillMaxWidth()
|
.drawWithCache {
|
||||||
.padding(horizontal = 20.dp),
|
// Soft light behind the logo while protected. The gradient depends on the size only;
|
||||||
horizontalArrangement = Arrangement.spacedBy(14.dp, Alignment.End),
|
// the fade is applied as alpha when drawing.
|
||||||
) {
|
val center = Offset(size.width / 2f, 0f)
|
||||||
LegendItem(stringResource(R.string.stat_requests), Palette.Accent)
|
val radius = size.width * 0.65f
|
||||||
LegendItem(stringResource(R.string.mon_blocked), Palette.Muted)
|
val light = Brush.radialGradient(
|
||||||
|
colors = listOf(Palette.Accent.copy(alpha = 0.22f), Color.Transparent),
|
||||||
|
center = center,
|
||||||
|
radius = radius,
|
||||||
|
)
|
||||||
|
onDrawBehind {
|
||||||
|
if (glow > 0f) drawCircle(brush = light, radius = radius, center = center, alpha = glow)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
TrafficChart(
|
.padding(start = side, end = side, top = 16.dp, bottom = bottomPadding),
|
||||||
points,
|
verticalArrangement = Arrangement.spacedBy(20.dp),
|
||||||
Modifier
|
) {
|
||||||
.fillMaxWidth()
|
Image(
|
||||||
.height(150.dp),
|
remember { AppLogo.get(context) },
|
||||||
|
contentDescription = null,
|
||||||
|
modifier = Modifier
|
||||||
|
.size(44.dp)
|
||||||
|
.align(Alignment.CenterHorizontally),
|
||||||
|
)
|
||||||
|
|
||||||
|
AnimatedVisibility(visible = crashReport != null, enter = Motion.expandIn, exit = Motion.collapseOut) {
|
||||||
|
CrashCard(
|
||||||
|
report = shownReport,
|
||||||
|
onCopy = {
|
||||||
|
context.getSystemService(ClipboardManager::class.java)
|
||||||
|
.setPrimaryClip(ClipData.newPlainText("SparkleDNS crash", shownReport))
|
||||||
|
},
|
||||||
|
onDismiss = { CrashLog.clear(context) },
|
||||||
)
|
)
|
||||||
val startLabel = remember(points) {
|
|
||||||
val start = System.currentTimeMillis() - (CHART_HOURS - 1) * 3_600_000L
|
|
||||||
SimpleDateFormat("HH:00", Locale.getDefault()).format(Date(start))
|
|
||||||
}
|
|
||||||
Row(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(horizontal = 20.dp),
|
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
|
||||||
) {
|
|
||||||
Text(startLabel, color = Palette.Fg3, fontSize = 11.sp, modifier = Modifier.weight(1f))
|
|
||||||
Text(
|
|
||||||
stringResource(R.string.period_24h),
|
|
||||||
color = Palette.Fg2,
|
|
||||||
fontSize = 12.sp,
|
|
||||||
fontWeight = FontWeight.Bold,
|
|
||||||
modifier = Modifier
|
|
||||||
.clip(RoundedCornerShape(16.dp))
|
|
||||||
.background(Palette.Card)
|
|
||||||
.padding(horizontal = 12.dp, vertical = 6.dp),
|
|
||||||
)
|
|
||||||
Text(
|
|
||||||
stringResource(R.string.chart_now),
|
|
||||||
color = Palette.Fg3,
|
|
||||||
fontSize = 11.sp,
|
|
||||||
textAlign = TextAlign.End,
|
|
||||||
modifier = Modifier.weight(1f),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BlocklistRow(
|
if (wide) {
|
||||||
info = if (blocking) {
|
Row(horizontalArrangement = Arrangement.spacedBy(24.dp)) {
|
||||||
stringResource(R.string.home_lists_info, lists.count { it.enabled }, formatCount(total.toLong()))
|
Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(20.dp)) {
|
||||||
} else {
|
status()
|
||||||
stringResource(R.string.blocking_off)
|
blocklist()
|
||||||
},
|
}
|
||||||
onClick = onOpenBlocklist,
|
Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(20.dp)) {
|
||||||
modifier = Modifier.padding(horizontal = 20.dp),
|
stats()
|
||||||
)
|
chart()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
status()
|
||||||
|
stats()
|
||||||
|
chart()
|
||||||
|
blocklist()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -295,15 +323,15 @@ private fun StatusCard(
|
|||||||
http3: Boolean,
|
http3: Boolean,
|
||||||
enabled: Boolean,
|
enabled: Boolean,
|
||||||
onToggle: () -> Unit,
|
onToggle: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
onOpenServers: () -> Unit,
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
modifier = modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.appCard()
|
.appCard()
|
||||||
.padding(horizontal = 20.dp, vertical = 24.dp),
|
.padding(horizontal = 20.dp, vertical = 24.dp),
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
verticalArrangement = Arrangement.spacedBy(6.dp),
|
||||||
) {
|
) {
|
||||||
AnimatedContent(
|
AnimatedContent(
|
||||||
targetState = running,
|
targetState = running,
|
||||||
@@ -319,13 +347,21 @@ private fun StatusCard(
|
|||||||
textAlign = TextAlign.Center,
|
textAlign = TextAlign.Center,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
// Tapping the server opens the server list in Settings
|
||||||
val dot by animateColorAsState(if (running) Palette.Accent else Palette.Track, Motion.color, label = "dot")
|
val dot by animateColorAsState(if (running) Palette.Accent else Palette.Track, Motion.color, label = "dot")
|
||||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.clip(RoundedCornerShape(12.dp))
|
||||||
|
.clickable(onClickLabel = stringResource(R.string.change_server), onClick = onOpenServers)
|
||||||
|
.heightIn(min = 40.dp)
|
||||||
|
.padding(start = 10.dp, end = 4.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
) {
|
||||||
Box(
|
Box(
|
||||||
Modifier
|
Modifier
|
||||||
.size(7.dp)
|
.size(7.dp)
|
||||||
.clip(CircleShape)
|
.clip(CircleShape)
|
||||||
.background(dot)
|
.drawBehind { drawRect(dot) }
|
||||||
)
|
)
|
||||||
Spacer(Modifier.width(8.dp))
|
Spacer(Modifier.width(8.dp))
|
||||||
val via = stringResource(R.string.home_via, providerName) + if (http3) " · HTTP/3" else ""
|
val via = stringResource(R.string.home_via, providerName) + if (http3) " · HTTP/3" else ""
|
||||||
@@ -336,14 +372,18 @@ private fun StatusCard(
|
|||||||
maxLines = 2,
|
maxLines = 2,
|
||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
textAlign = TextAlign.Center,
|
textAlign = TextAlign.Center,
|
||||||
|
modifier = Modifier.weight(1f, fill = false),
|
||||||
)
|
)
|
||||||
|
Spacer(Modifier.width(2.dp))
|
||||||
|
Chevron(Modifier.size(16.dp))
|
||||||
}
|
}
|
||||||
Spacer(Modifier.height(10.dp))
|
Spacer(Modifier.height(8.dp))
|
||||||
PowerToggle(on = running, enabled = enabled, onToggle = onToggle)
|
PowerToggle(on = running, enabled = enabled, onToggle = onToggle)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The big ON / OFF switch; the white knob slides across
|
// The big ON / OFF switch; the white knob slides across. The animated color and position are
|
||||||
|
// read only when drawing and placing, so the animation does not recompose the switch every frame.
|
||||||
@Composable
|
@Composable
|
||||||
private fun PowerToggle(on: Boolean, enabled: Boolean, onToggle: () -> Unit) {
|
private fun PowerToggle(on: Boolean, enabled: Boolean, onToggle: () -> Unit) {
|
||||||
val track by animateColorAsState(if (on) Palette.Accent else Palette.Track, Motion.color, label = "track")
|
val track by animateColorAsState(if (on) Palette.Accent else Palette.Track, Motion.color, label = "track")
|
||||||
@@ -354,7 +394,7 @@ private fun PowerToggle(on: Boolean, enabled: Boolean, onToggle: () -> Unit) {
|
|||||||
.size(width = 120.dp, height = 50.dp)
|
.size(width = 120.dp, height = 50.dp)
|
||||||
.graphicsLayer { alpha = if (enabled) 1f else 0.5f }
|
.graphicsLayer { alpha = if (enabled) 1f else 0.5f }
|
||||||
.clip(RoundedCornerShape(25.dp))
|
.clip(RoundedCornerShape(25.dp))
|
||||||
.background(track)
|
.drawBehind { drawRect(track) }
|
||||||
.toggleable(value = on, enabled = enabled, role = Role.Switch, onValueChange = { onToggle() })
|
.toggleable(value = on, enabled = enabled, role = Role.Switch, onValueChange = { onToggle() })
|
||||||
.semantics { contentDescription = description }
|
.semantics { contentDescription = description }
|
||||||
.padding(5.dp),
|
.padding(5.dp),
|
||||||
@@ -371,7 +411,7 @@ private fun PowerToggle(on: Boolean, enabled: Boolean, onToggle: () -> Unit) {
|
|||||||
)
|
)
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.offset(x = knob)
|
.offset { IntOffset(knob.roundToPx(), 0) }
|
||||||
.size(40.dp)
|
.size(40.dp)
|
||||||
.clip(CircleShape)
|
.clip(CircleShape)
|
||||||
.background(Color.White),
|
.background(Color.White),
|
||||||
@@ -379,7 +419,7 @@ private fun PowerToggle(on: Boolean, enabled: Boolean, onToggle: () -> Unit) {
|
|||||||
) {
|
) {
|
||||||
Canvas(Modifier.size(14.dp)) {
|
Canvas(Modifier.size(14.dp)) {
|
||||||
val stroke = 1.6.dp.toPx()
|
val stroke = 1.6.dp.toPx()
|
||||||
listOf(0.29f, 0.5f, 0.71f).forEach { fraction ->
|
KnobLines.forEach { fraction ->
|
||||||
drawLine(
|
drawLine(
|
||||||
color = Palette.Fg3,
|
color = Palette.Fg3,
|
||||||
start = Offset(size.width * fraction, size.height * 0.21f),
|
start = Offset(size.width * fraction, size.height * 0.21f),
|
||||||
@@ -394,27 +434,25 @@ private fun PowerToggle(on: Boolean, enabled: Boolean, onToggle: () -> Unit) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun PrivateDnsWarning(privateDnsHost: String?, prefs: Prefs, modifier: Modifier = Modifier) {
|
private fun PrivateDnsWarning(privateDnsHost: String?, prefs: Prefs) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val lastHost = remember { arrayOf("") }
|
val shownHost = rememberLast(privateDnsHost).orEmpty()
|
||||||
privateDnsHost?.let { lastHost[0] = it }
|
|
||||||
var dismissedHost by remember { mutableStateOf(prefs.dismissedPrivateDns) }
|
var dismissedHost by remember { mutableStateOf(prefs.dismissedPrivateDns) }
|
||||||
AnimatedVisibility(
|
AnimatedVisibility(
|
||||||
visible = privateDnsHost != null && privateDnsHost != dismissedHost,
|
visible = privateDnsHost != null && privateDnsHost != dismissedHost,
|
||||||
enter = Motion.expandIn,
|
enter = Motion.expandIn,
|
||||||
exit = Motion.collapseOut,
|
exit = Motion.collapseOut,
|
||||||
modifier = modifier,
|
|
||||||
) {
|
) {
|
||||||
HintCard(
|
HintCard(
|
||||||
text = stringResource(R.string.hint, lastHost[0]),
|
text = stringResource(R.string.hint, shownHost),
|
||||||
icon = R.drawable.ic_alert,
|
icon = R.drawable.ic_alert,
|
||||||
tint = WarningColor,
|
tint = WarningColor,
|
||||||
action = {
|
action = {
|
||||||
TextButton(onClick = { openNetworkSettings(context) }) { Text(stringResource(R.string.open_settings)) }
|
TextButton(onClick = { openNetworkSettings(context) }) { Text(stringResource(R.string.open_settings)) }
|
||||||
},
|
},
|
||||||
onDismiss = {
|
onDismiss = {
|
||||||
dismissedHost = lastHost[0]
|
dismissedHost = shownHost
|
||||||
prefs.dismissedPrivateDns = lastHost[0]
|
prefs.dismissedPrivateDns = shownHost
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -428,12 +466,62 @@ fun StatBlock(value: String, label: String, modifier: Modifier = Modifier, value
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun ChartSection(chart: Chart, period: StatsPeriod, height: Dp, onPeriod: (StatsPeriod) -> Unit) {
|
||||||
|
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||||
|
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||||
|
PeriodChip(period, onPeriod)
|
||||||
|
Spacer(Modifier.weight(1f))
|
||||||
|
LegendItem(stringResource(R.string.stat_requests), Palette.Accent)
|
||||||
|
Spacer(Modifier.width(14.dp))
|
||||||
|
LegendItem(stringResource(R.string.mon_blocked), Palette.Blocked)
|
||||||
|
}
|
||||||
|
Box(
|
||||||
|
Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.height(height),
|
||||||
|
contentAlignment = Alignment.Center,
|
||||||
|
) {
|
||||||
|
if (chart.bars.all { it.total == 0L }) {
|
||||||
|
Text(
|
||||||
|
stringResource(R.string.chart_empty),
|
||||||
|
color = Palette.Fg3,
|
||||||
|
fontSize = 13.sp,
|
||||||
|
lineHeight = 18.sp,
|
||||||
|
textAlign = TextAlign.Center,
|
||||||
|
modifier = Modifier.padding(horizontal = 24.dp),
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
TrafficChart(chart.bars, Modifier.fillMaxWidth().height(height))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Hours: first hour on the left, now on the right. Days: a label under every bar.
|
||||||
|
Row(Modifier.fillMaxWidth()) {
|
||||||
|
if (chart.period == StatsPeriod.DAY) {
|
||||||
|
Text(chart.labels.firstOrNull().orEmpty(), color = Palette.Fg3, fontSize = 11.sp, modifier = Modifier.weight(1f))
|
||||||
|
Text(stringResource(R.string.chart_now), color = Palette.Fg3, fontSize = 11.sp)
|
||||||
|
} else {
|
||||||
|
chart.labels.forEachIndexed { index, label ->
|
||||||
|
Text(
|
||||||
|
label,
|
||||||
|
color = if (index == chart.labels.lastIndex) Palette.Fg else Palette.Fg3,
|
||||||
|
fontSize = 11.sp,
|
||||||
|
maxLines = 1,
|
||||||
|
textAlign = TextAlign.Center,
|
||||||
|
modifier = Modifier.weight(1f),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun LegendItem(label: String, color: Color) {
|
private fun LegendItem(label: String, color: Color) {
|
||||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||||
Box(
|
Box(
|
||||||
Modifier
|
Modifier
|
||||||
.size(width = 12.dp, height = 3.dp)
|
.size(8.dp)
|
||||||
.clip(RoundedCornerShape(2.dp))
|
.clip(RoundedCornerShape(2.dp))
|
||||||
.background(color)
|
.background(color)
|
||||||
)
|
)
|
||||||
@@ -442,76 +530,89 @@ private fun LegendItem(label: String, color: Color) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Requests (accent line with a soft fill) and blocked queries (grey line) per hour
|
// One bar per hour or day: requests in the accent color with the blocked part at the bottom.
|
||||||
|
// Empty slots show a short stub, so a mostly empty day reads as empty instead of broken.
|
||||||
@Composable
|
@Composable
|
||||||
private fun TrafficChart(points: List<HourPoint>, modifier: Modifier = Modifier) {
|
private fun TrafficChart(bars: List<Bar>, modifier: Modifier = Modifier) {
|
||||||
val measurer = rememberTextMeasurer()
|
val measurer = rememberTextMeasurer()
|
||||||
val labelStyle = TextStyle(color = Palette.Fg3, fontSize = 10.sp)
|
// Scale, grid and grid labels are worked out when the bars or the size change, not every frame
|
||||||
Canvas(modifier) {
|
Spacer(
|
||||||
val n = points.size
|
modifier.drawWithCache {
|
||||||
if (n < 2) return@Canvas
|
val n = bars.size
|
||||||
val maxValue = niceCeiling(points.maxOf { it.total }.coerceAtLeast(1L))
|
if (n == 0) return@drawWithCache onDrawBehind {}
|
||||||
val inset = 6.dp.toPx()
|
val maxValue = niceCeiling(bars.maxOf { it.total }.coerceAtLeast(1L))
|
||||||
val top = 14.dp.toPx()
|
val top = 16.dp.toPx()
|
||||||
val base = size.height - 8.dp.toPx()
|
val base = size.height - 2.dp.toPx()
|
||||||
val span = base - top
|
val span = base - top
|
||||||
val step = (size.width - 2 * inset) / (n - 1)
|
val slot = size.width / n
|
||||||
fun x(index: Int) = inset + index * step
|
val barWidth = (slot * if (n > 10) 0.62f else 0.5f).coerceAtLeast(2.dp.toPx())
|
||||||
fun y(value: Long) = base - value.toFloat() / maxValue * span
|
val radius = CornerRadius((barWidth / 2).coerceAtMost(4.dp.toPx()))
|
||||||
|
val stub = 2.dp.toPx()
|
||||||
|
val minBar = 4.dp.toPx()
|
||||||
|
val minBlocked = 2.dp.toPx()
|
||||||
|
val gridWidth = 1.dp.toPx()
|
||||||
|
val dash = PathEffect.dashPathEffect(floatArrayOf(3.dp.toPx(), 4.dp.toPx()))
|
||||||
|
fun height(value: Long) = value.toFloat() / maxValue * span
|
||||||
|
|
||||||
listOf(maxValue / 2, maxValue).forEach { value ->
|
val grid = listOf(maxValue / 2, maxValue).filter { it > 0 }.map { value ->
|
||||||
val gridY = y(value)
|
val y = base - height(value)
|
||||||
drawLine(
|
val labelTop = y - 14.dp.toPx()
|
||||||
color = Palette.Line,
|
// The same constraints drawText() would use for a label at this spot
|
||||||
start = Offset(0f, gridY),
|
val label = measurer.measure(
|
||||||
end = Offset(size.width, gridY),
|
text = formatCompact(value),
|
||||||
strokeWidth = 1.dp.toPx(),
|
style = ChartLabelStyle,
|
||||||
pathEffect = PathEffect.dashPathEffect(floatArrayOf(3.dp.toPx(), 4.dp.toPx())),
|
constraints = Constraints(
|
||||||
)
|
maxWidth = ceil(size.width).roundToInt().coerceAtLeast(0),
|
||||||
drawText(
|
maxHeight = ceil(size.height - labelTop).roundToInt().coerceAtLeast(0),
|
||||||
textMeasurer = measurer,
|
),
|
||||||
text = formatCompact(value),
|
layoutDirection = layoutDirection,
|
||||||
topLeft = Offset(20.dp.toPx(), gridY - 15.dp.toPx()),
|
density = this,
|
||||||
style = labelStyle,
|
)
|
||||||
)
|
GridLine(y, labelTop, label)
|
||||||
}
|
}
|
||||||
|
|
||||||
val line = Path()
|
onDrawBehind {
|
||||||
val area = Path()
|
grid.forEach { line ->
|
||||||
val blocked = Path()
|
drawLine(
|
||||||
points.forEachIndexed { index, point ->
|
color = Palette.Line,
|
||||||
val px = x(index)
|
start = Offset(0f, line.y),
|
||||||
if (index == 0) {
|
end = Offset(size.width, line.y),
|
||||||
line.moveTo(px, y(point.total))
|
strokeWidth = gridWidth,
|
||||||
area.moveTo(px, base)
|
pathEffect = dash,
|
||||||
area.lineTo(px, y(point.total))
|
)
|
||||||
blocked.moveTo(px, y(point.blocked))
|
drawText(line.label, topLeft = Offset(0f, line.labelTop))
|
||||||
} else {
|
}
|
||||||
line.lineTo(px, y(point.total))
|
|
||||||
area.lineTo(px, y(point.total))
|
bars.forEachIndexed { index, bar ->
|
||||||
blocked.lineTo(px, y(point.blocked))
|
val x = index * slot + (slot - barWidth) / 2
|
||||||
|
if (bar.total == 0L) {
|
||||||
|
drawRoundRect(Palette.Line, Offset(x, base - stub), Size(barWidth, stub), CornerRadius(stub / 2))
|
||||||
|
return@forEachIndexed
|
||||||
|
}
|
||||||
|
val current = index == n - 1
|
||||||
|
val h = height(bar.total).coerceAtLeast(minBar)
|
||||||
|
drawRoundRect(
|
||||||
|
if (current) Palette.Accent else Palette.Accent.copy(alpha = 0.6f),
|
||||||
|
Offset(x, base - h),
|
||||||
|
Size(barWidth, h),
|
||||||
|
radius,
|
||||||
|
)
|
||||||
|
if (bar.blocked > 0) {
|
||||||
|
val hb = height(bar.blocked).coerceIn(minBlocked, h)
|
||||||
|
if (hb >= h - radius.x) {
|
||||||
|
drawRoundRect(Palette.Blocked, Offset(x, base - hb), Size(barWidth, hb), radius)
|
||||||
|
} else {
|
||||||
|
drawRect(Palette.Blocked, Offset(x, base - hb), Size(barWidth, hb))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
area.lineTo(x(n - 1), base)
|
)
|
||||||
area.close()
|
|
||||||
|
|
||||||
drawPath(area, Palette.Accent.copy(alpha = 0.14f))
|
|
||||||
drawPath(
|
|
||||||
blocked,
|
|
||||||
Palette.Muted,
|
|
||||||
style = Stroke(width = 1.6.dp.toPx(), cap = StrokeCap.Round, join = StrokeJoin.Round),
|
|
||||||
)
|
|
||||||
drawPath(
|
|
||||||
line,
|
|
||||||
Palette.Accent,
|
|
||||||
style = Stroke(width = 2.4.dp.toPx(), cap = StrokeCap.Round, join = StrokeJoin.Round),
|
|
||||||
)
|
|
||||||
val end = Offset(x(n - 1), y(points.last().total))
|
|
||||||
drawCircle(Palette.Bg, radius = 5.dp.toPx(), center = end)
|
|
||||||
drawCircle(Palette.Accent, radius = 5.dp.toPx(), center = end, style = Stroke(width = 2.4.dp.toPx()))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class GridLine(val y: Float, val labelTop: Float, val label: TextLayoutResult)
|
||||||
|
|
||||||
// 1, 2 or 5 times a power of ten, at least [value]: keeps the grid labels round
|
// 1, 2 or 5 times a power of ten, at least [value]: keeps the grid labels round
|
||||||
private fun niceCeiling(value: Long): Long {
|
private fun niceCeiling(value: Long): Long {
|
||||||
var magnitude = 1L
|
var magnitude = 1L
|
||||||
@@ -522,35 +623,127 @@ private fun niceCeiling(value: Long): Long {
|
|||||||
return 10 * magnitude
|
return 10 * magnitude
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Date formats of the chart for the current locale and time zone. The chart is refreshed up to
|
||||||
|
// once a second, so they are kept rather than built anew each time. Main thread only.
|
||||||
|
private class ChartFormats(val locale: Locale, val zone: String) {
|
||||||
|
val hour = SimpleDateFormat("HH:00", locale)
|
||||||
|
val day = SimpleDateFormat("EEE", locale)
|
||||||
|
}
|
||||||
|
|
||||||
|
private var chartFormats: ChartFormats? = null
|
||||||
|
|
||||||
|
private fun chartFormats(): ChartFormats {
|
||||||
|
val locale = Locale.getDefault()
|
||||||
|
val zone = TimeZone.getDefault().id
|
||||||
|
return chartFormats?.takeIf { it.locale == locale && it.zone == zone }
|
||||||
|
?: ChartFormats(locale, zone).also { chartFormats = it }
|
||||||
|
}
|
||||||
|
|
||||||
|
// 24 hourly bars, or 7 bars for the calendar days of the last week (today last)
|
||||||
|
private fun buildChart(period: StatsPeriod, now: Long = System.currentTimeMillis()): Chart {
|
||||||
|
val hours = StatsStore.hourly(period.hours, now)
|
||||||
|
val firstHour = now / HOUR_MS - (hours.size - 1)
|
||||||
|
val formats = chartFormats()
|
||||||
|
if (period == StatsPeriod.DAY) {
|
||||||
|
// Only the first hour gets a label; the other end of the axis says "now"
|
||||||
|
val label = formats.hour.format(Date(firstHour * HOUR_MS))
|
||||||
|
return Chart(period, hours.map { Bar(it.total, it.blocked) }, listOf(label))
|
||||||
|
}
|
||||||
|
val calendar = Calendar.getInstance()
|
||||||
|
fun dayKey(time: Long): Int {
|
||||||
|
calendar.timeInMillis = time
|
||||||
|
return calendar.get(Calendar.YEAR) * 1000 + calendar.get(Calendar.DAY_OF_YEAR)
|
||||||
|
}
|
||||||
|
val dayStarts = (6 downTo 0).map { back ->
|
||||||
|
calendar.timeInMillis = now
|
||||||
|
calendar.add(Calendar.DAY_OF_YEAR, -back)
|
||||||
|
calendar.timeInMillis
|
||||||
|
}
|
||||||
|
val keys = dayStarts.map { dayKey(it) }
|
||||||
|
val totals = LongArray(7)
|
||||||
|
val blocked = LongArray(7)
|
||||||
|
hours.forEachIndexed { index, point ->
|
||||||
|
val day = keys.indexOf(dayKey((firstHour + index) * HOUR_MS))
|
||||||
|
if (day >= 0) {
|
||||||
|
totals[day] += point.total
|
||||||
|
blocked[day] += point.blocked
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Chart(period, List(7) { Bar(totals[it], blocked[it]) }, dayStarts.map { formats.day.format(Date(it)) })
|
||||||
|
}
|
||||||
|
|
||||||
|
private enum class BlocklistOffer { NONE, SWITCH_ON, FIRST_LIST }
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun BlocklistRow(info: String, onClick: () -> Unit, modifier: Modifier = Modifier) {
|
private fun BlocklistCard(
|
||||||
|
info: String,
|
||||||
|
offer: BlocklistOffer,
|
||||||
|
downloading: Boolean,
|
||||||
|
error: String?,
|
||||||
|
canAccept: Boolean,
|
||||||
|
onAccept: () -> Unit,
|
||||||
|
onClick: () -> Unit,
|
||||||
|
) {
|
||||||
|
val subtitle = when {
|
||||||
|
error != null -> stringResource(R.string.bl_download_failed, error)
|
||||||
|
offer == BlocklistOffer.SWITCH_ON -> stringResource(R.string.blocklist_cta_master)
|
||||||
|
offer == BlocklistOffer.FIRST_LIST -> stringResource(R.string.blocklist_cta_lists)
|
||||||
|
else -> info
|
||||||
|
}
|
||||||
Row(
|
Row(
|
||||||
modifier = modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.appCard()
|
.appCard()
|
||||||
.clickable(onClick = onClick)
|
.clickable(onClick = onClick)
|
||||||
.padding(16.dp),
|
.padding(16.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
) {
|
||||||
|
val idle = offer != BlocklistOffer.NONE
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(40.dp)
|
.size(40.dp)
|
||||||
.clip(CircleShape)
|
.clip(CircleShape)
|
||||||
.background(Palette.Accent),
|
.background(if (idle) Palette.Track else Palette.Accent),
|
||||||
contentAlignment = Alignment.Center,
|
contentAlignment = Alignment.Center,
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
painterResource(R.drawable.ic_privacy),
|
painterResource(R.drawable.ic_privacy),
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
tint = Palette.AccentInk,
|
tint = if (idle) Palette.Fg2 else Palette.AccentInk,
|
||||||
modifier = Modifier.size(22.dp),
|
modifier = Modifier.size(22.dp),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Spacer(Modifier.width(14.dp))
|
Spacer(Modifier.width(14.dp))
|
||||||
Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(3.dp)) {
|
Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(3.dp)) {
|
||||||
Text(stringResource(R.string.blocklist_title), color = Palette.Fg, fontSize = 15.sp, fontWeight = FontWeight.Bold)
|
Text(stringResource(R.string.blocklist_title), color = Palette.Fg, fontSize = 15.sp, fontWeight = FontWeight.Bold)
|
||||||
Text(info, color = Palette.Fg2, fontSize = 12.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
Text(
|
||||||
|
subtitle,
|
||||||
|
color = if (error != null) Palette.Blocked else Palette.Fg2,
|
||||||
|
fontSize = 12.sp,
|
||||||
|
lineHeight = 16.sp,
|
||||||
|
maxLines = 3,
|
||||||
|
overflow = TextOverflow.Ellipsis,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Spacer(Modifier.width(10.dp))
|
||||||
|
if (offer == BlocklistOffer.NONE) {
|
||||||
|
Chevron()
|
||||||
|
} else {
|
||||||
|
Button(
|
||||||
|
onClick = onAccept,
|
||||||
|
enabled = canAccept && !downloading,
|
||||||
|
shape = RoundedCornerShape(14.dp),
|
||||||
|
contentPadding = PaddingValues(horizontal = 14.dp),
|
||||||
|
modifier = Modifier.heightIn(min = 40.dp),
|
||||||
|
) {
|
||||||
|
if (downloading) {
|
||||||
|
CircularProgressIndicator(Modifier.size(16.dp), strokeWidth = 2.dp, color = Palette.Fg2)
|
||||||
|
Spacer(Modifier.width(8.dp))
|
||||||
|
Text(stringResource(R.string.downloading), fontSize = 13.sp, maxLines = 1)
|
||||||
|
} else {
|
||||||
|
Text(stringResource(R.string.turn_on), fontWeight = FontWeight.Bold, fontSize = 13.sp, maxLines = 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Chevron()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,10 +25,16 @@ import androidx.compose.foundation.shape.RoundedCornerShape
|
|||||||
import androidx.compose.material3.Card
|
import androidx.compose.material3.Card
|
||||||
import androidx.compose.material3.CardDefaults
|
import androidx.compose.material3.CardDefaults
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.LocalContentColor
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TextButton
|
import androidx.compose.material3.TextButton
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.CompositionLocalProvider
|
||||||
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
|
import androidx.compose.runtime.MutableState
|
||||||
|
import androidx.compose.runtime.mutableStateOf
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.runtime.saveable.Saver
|
import androidx.compose.runtime.saveable.Saver
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
@@ -38,6 +44,7 @@ import androidx.compose.ui.text.font.FontFamily
|
|||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import kotlinx.coroutines.channels.awaitClose
|
import kotlinx.coroutines.channels.awaitClose
|
||||||
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.callbackFlow
|
import kotlinx.coroutines.flow.callbackFlow
|
||||||
import kotlinx.coroutines.flow.distinctUntilChanged
|
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||||
@@ -46,9 +53,16 @@ import kotlinx.coroutines.flow.flowOf
|
|||||||
class MainActivity : ComponentActivity() {
|
class MainActivity : ComponentActivity() {
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
AppLogo.preload(this)
|
||||||
enableEdgeToEdge()
|
enableEdgeToEdge()
|
||||||
setContent {
|
setContent {
|
||||||
MaterialTheme(colorScheme = AppColors) { AppShell() }
|
MaterialTheme(colorScheme = AppColors) {
|
||||||
|
// There is no Surface at the root, so text and icons without an explicit color
|
||||||
|
// would fall back to black and disappear on the dark background
|
||||||
|
CompositionLocalProvider(LocalContentColor provides MaterialTheme.colorScheme.onSurface) {
|
||||||
|
AppShell()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -56,7 +70,22 @@ class MainActivity : ComponentActivity() {
|
|||||||
internal class TestResult(val ok: Boolean, val text: String)
|
internal class TestResult(val ok: Boolean, val text: String)
|
||||||
|
|
||||||
// How long a tap on Connect, Disconnect or Switch blocks further taps if the VPN state never changes
|
// How long a tap on Connect, Disconnect or Switch blocks further taps if the VPN state never changes
|
||||||
internal const val BUSY_TIMEOUT_MS = 5000L
|
private const val BUSY_TIMEOUT_MS = 5000L
|
||||||
|
|
||||||
|
// Set by a tap until the VPN state changes or the attempt gives up, so a double tap neither
|
||||||
|
// starts two connections nor switches the VPN back on right after turning it off
|
||||||
|
@Composable
|
||||||
|
internal fun rememberVpnBusy(active: DohProvider?): MutableState<Boolean> {
|
||||||
|
val busy = remember { mutableStateOf(false) }
|
||||||
|
LaunchedEffect(active) { busy.value = false }
|
||||||
|
LaunchedEffect(busy.value) {
|
||||||
|
if (busy.value) {
|
||||||
|
delay(BUSY_TIMEOUT_MS)
|
||||||
|
busy.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return busy
|
||||||
|
}
|
||||||
|
|
||||||
// Keeps test results across rotation and process death
|
// Keeps test results across rotation and process death
|
||||||
internal val TestResultSaver = Saver<TestResult?, String>(
|
internal val TestResultSaver = Saver<TestResult?, String>(
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package cc.skysparkle.sparkledns
|
package cc.skysparkle.sparkledns
|
||||||
|
|
||||||
import androidx.compose.animation.SizeTransform
|
|
||||||
import androidx.compose.animation.core.CubicBezierEasing
|
import androidx.compose.animation.core.CubicBezierEasing
|
||||||
import androidx.compose.animation.core.FiniteAnimationSpec
|
import androidx.compose.animation.core.FiniteAnimationSpec
|
||||||
import androidx.compose.animation.core.tween
|
import androidx.compose.animation.core.tween
|
||||||
@@ -25,6 +24,4 @@ object Motion {
|
|||||||
|
|
||||||
val expandIn = fadeIn(enterFade) + expandVertically(size)
|
val expandIn = fadeIn(enterFade) + expandVertically(size)
|
||||||
val collapseOut = fadeOut(exitFade) + shrinkVertically(size)
|
val collapseOut = fadeOut(exitFade) + shrinkVertically(size)
|
||||||
|
|
||||||
fun sizeTransform() = SizeTransform(clip = false) { _, _ -> size }
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,10 @@ package cc.skysparkle.sparkledns
|
|||||||
import java.io.ByteArrayOutputStream
|
import java.io.ByteArrayOutputStream
|
||||||
import kotlin.random.Random
|
import kotlin.random.Random
|
||||||
|
|
||||||
|
// IPv4 addresses are kept as plain numbers, so parsing a query allocates only its payload
|
||||||
class UdpPacket(
|
class UdpPacket(
|
||||||
val srcIp: ByteArray,
|
val srcIp: Int,
|
||||||
val dstIp: ByteArray,
|
val dstIp: Int,
|
||||||
val srcPort: Int,
|
val srcPort: Int,
|
||||||
val dstPort: Int,
|
val dstPort: Int,
|
||||||
val payload: ByteArray,
|
val payload: ByteArray,
|
||||||
@@ -29,8 +30,8 @@ object Packet {
|
|||||||
if (end <= ihl + 8) return null
|
if (end <= ihl + 8) return null
|
||||||
|
|
||||||
return UdpPacket(
|
return UdpPacket(
|
||||||
srcIp = buf.copyOfRange(12, 16),
|
srcIp = i32(buf, 12),
|
||||||
dstIp = buf.copyOfRange(16, 20),
|
dstIp = i32(buf, 16),
|
||||||
srcPort = u16(buf, ihl),
|
srcPort = u16(buf, ihl),
|
||||||
dstPort = dstPort,
|
dstPort = dstPort,
|
||||||
payload = buf.copyOfRange(ihl + 8, end),
|
payload = buf.copyOfRange(ihl + 8, end),
|
||||||
@@ -47,8 +48,8 @@ object Packet {
|
|||||||
p[6] = 0x40 // don't fragment
|
p[6] = 0x40 // don't fragment
|
||||||
p[8] = 64
|
p[8] = 64
|
||||||
p[9] = 17
|
p[9] = 17
|
||||||
query.dstIp.copyInto(p, 12)
|
put32(p, 12, query.dstIp)
|
||||||
query.srcIp.copyInto(p, 16)
|
put32(p, 16, query.srcIp)
|
||||||
put16(p, 10, checksum(p, 0, 20, 0))
|
put16(p, 10, checksum(p, 0, 20, 0))
|
||||||
|
|
||||||
put16(p, 20, query.dstPort)
|
put16(p, 20, query.dstPort)
|
||||||
@@ -123,7 +124,9 @@ object DnsMessage {
|
|||||||
|
|
||||||
fun question(msg: ByteArray): Question? {
|
fun question(msg: ByteArray): Question? {
|
||||||
if (msg.size < 12 || u16(msg, 4) < 1) return null
|
if (msg.size < 12 || u16(msg, 4) < 1) return null
|
||||||
val name = StringBuilder()
|
// Sized up front, so the builder does not grow: a valid name has at most 253 characters,
|
||||||
|
// and never more than the message has bytes after the header
|
||||||
|
val name = StringBuilder(minOf(msg.size - 12, 253))
|
||||||
var p = 12
|
var p = 12
|
||||||
while (true) {
|
while (true) {
|
||||||
if (p >= msg.size) return null
|
if (p >= msg.size) return null
|
||||||
@@ -180,6 +183,8 @@ internal fun put32(b: ByteArray, off: Int, value: Int) {
|
|||||||
internal fun u32(b: ByteArray, off: Int): Long =
|
internal fun u32(b: ByteArray, off: Int): Long =
|
||||||
((u16(b, off).toLong()) shl 16) or u16(b, off + 2).toLong()
|
((u16(b, off).toLong()) shl 16) or u16(b, off + 2).toLong()
|
||||||
|
|
||||||
|
internal fun i32(b: ByteArray, off: Int): Int = (u16(b, off) shl 16) or u16(b, off + 2)
|
||||||
|
|
||||||
// Returns the offset right after a (possibly compressed) DNS name
|
// Returns the offset right after a (possibly compressed) DNS name
|
||||||
internal fun skipName(b: ByteArray, start: Int): Int? {
|
internal fun skipName(b: ByteArray, start: Int): Int? {
|
||||||
var p = start
|
var p = start
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ object Providers {
|
|||||||
),
|
),
|
||||||
DohProvider(
|
DohProvider(
|
||||||
"quad9", "Quad9", "https://dns.quad9.net/dns-query", listOf("9.9.9.9", "149.112.112.112"),
|
"quad9", "Quad9", "https://dns.quad9.net/dns-query", listOf("9.9.9.9", "149.112.112.112"),
|
||||||
|
http3 = true,
|
||||||
policy = "https://quad9.net/service/privacy/",
|
policy = "https://quad9.net/service/privacy/",
|
||||||
donate = "https://quad9.net/donate/",
|
donate = "https://quad9.net/donate/",
|
||||||
),
|
),
|
||||||
@@ -45,12 +46,10 @@ object Providers {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
val list: List<DohProvider> get() = builtIn
|
|
||||||
|
|
||||||
// The project's own server stays the default whatever order the list uses
|
// The project's own server stays the default whatever order the list uses
|
||||||
val default: DohProvider get() = list.firstOrNull { it.id == DEFAULT_ID } ?: list.first()
|
val default: DohProvider = builtIn.firstOrNull { it.id == DEFAULT_ID } ?: builtIn.first()
|
||||||
|
|
||||||
fun byId(id: String): DohProvider = list.firstOrNull { it.id == id } ?: default
|
fun byId(id: String): DohProvider = builtIn.firstOrNull { it.id == id } ?: default
|
||||||
}
|
}
|
||||||
|
|
||||||
fun parseIps(raw: String): List<String> =
|
fun parseIps(raw: String): List<String> =
|
||||||
|
|||||||
@@ -16,14 +16,6 @@ class QueryEntry(
|
|||||||
val latencyMs: Int,
|
val latencyMs: Int,
|
||||||
)
|
)
|
||||||
|
|
||||||
data class QueryStats(
|
|
||||||
val total: Long,
|
|
||||||
val cached: Long,
|
|
||||||
val blocked: Long,
|
|
||||||
val failed: Long,
|
|
||||||
val avgLatencyMs: Int,
|
|
||||||
)
|
|
||||||
|
|
||||||
// In-memory only: nothing is written to disk or sent anywhere. StatsStore keeps hourly
|
// In-memory only: nothing is written to disk or sent anywhere. StatsStore keeps hourly
|
||||||
// numbers without domains for the charts.
|
// numbers without domains for the charts.
|
||||||
object QueryLog {
|
object QueryLog {
|
||||||
@@ -31,14 +23,12 @@ object QueryLog {
|
|||||||
|
|
||||||
private val entries = ArrayDeque<QueryEntry>()
|
private val entries = ArrayDeque<QueryEntry>()
|
||||||
private var nextId = 0L
|
private var nextId = 0L
|
||||||
private var total = 0L
|
|
||||||
private var cached = 0L
|
|
||||||
private var blocked = 0L
|
|
||||||
private var failed = 0L
|
|
||||||
private var latencySum = 0L
|
|
||||||
private var latencyCount = 0L
|
|
||||||
private val version = MutableStateFlow(0L)
|
private val version = MutableStateFlow(0L)
|
||||||
|
|
||||||
|
// The last snapshot, handed out again while the log has not changed
|
||||||
|
private var lastSnapshot: List<QueryEntry> = emptyList()
|
||||||
|
private var snapshotVersion = 0L
|
||||||
|
|
||||||
// Fires right away, then at most once a second while queries keep coming: a busy log refreshes
|
// Fires right away, then at most once a second while queries keep coming: a busy log refreshes
|
||||||
// the screen no more often than the old one-second polling did, and an idle one not at all
|
// the screen no more often than the old one-second polling did, and an idle one not at all
|
||||||
fun changes(): Flow<Long> = version.transform {
|
fun changes(): Flow<Long> = version.transform {
|
||||||
@@ -48,42 +38,32 @@ object QueryLog {
|
|||||||
|
|
||||||
fun add(question: DnsMessage.Question?, status: QueryStatus, latencyMs: Int) {
|
fun add(question: DnsMessage.Question?, status: QueryStatus, latencyMs: Int) {
|
||||||
if (question == null) return
|
if (question == null) return
|
||||||
|
val time = System.currentTimeMillis()
|
||||||
synchronized(this) {
|
synchronized(this) {
|
||||||
if (entries.size >= MAX_ENTRIES) entries.removeFirst()
|
if (entries.size >= MAX_ENTRIES) entries.removeFirst()
|
||||||
entries.addLast(
|
entries.addLast(QueryEntry(nextId++, time, question.name.ifEmpty { "." }, question.type, status, latencyMs))
|
||||||
QueryEntry(nextId++, System.currentTimeMillis(), question.name.ifEmpty { "." }, question.type, status, latencyMs)
|
|
||||||
)
|
|
||||||
total++
|
|
||||||
when (status) {
|
|
||||||
QueryStatus.OK -> { latencySum += latencyMs; latencyCount++ }
|
|
||||||
QueryStatus.CACHED -> cached++
|
|
||||||
QueryStatus.BLOCKED -> blocked++
|
|
||||||
QueryStatus.FAILED -> failed++
|
|
||||||
}
|
|
||||||
version.value++
|
version.value++
|
||||||
}
|
}
|
||||||
// Hourly numbers for the charts; outside the lock above, as it takes a lock of its own
|
// Hourly numbers for the charts; outside the lock above, as it takes a lock of its own
|
||||||
StatsStore.record(status, latencyMs, Companies.of(question.name))
|
StatsStore.record(status, latencyMs, Companies.of(question.name), time)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Newest first. Builds a real copy: on API 35+ List.reversed() resolves to a live JDK view,
|
// Newest first. Builds a real copy: on API 35+ List.reversed() resolves to a live JDK view,
|
||||||
// and on older devices that method does not exist at all
|
// and on older devices that method does not exist at all. While the log does not change the
|
||||||
|
// same list comes back, so a screen refreshed with it has nothing to update.
|
||||||
@Synchronized
|
@Synchronized
|
||||||
fun snapshot(): List<QueryEntry> = List(entries.size) { entries[entries.size - 1 - it] }
|
fun snapshot(): List<QueryEntry> {
|
||||||
|
val current = version.value
|
||||||
@Synchronized
|
if (snapshotVersion != current) {
|
||||||
fun stats() = QueryStats(
|
lastSnapshot = List(entries.size) { entries[entries.size - 1 - it] }
|
||||||
total = total,
|
snapshotVersion = current
|
||||||
cached = cached,
|
}
|
||||||
blocked = blocked,
|
return lastSnapshot
|
||||||
failed = failed,
|
}
|
||||||
avgLatencyMs = if (latencyCount == 0L) 0 else (latencySum / latencyCount).toInt(),
|
|
||||||
)
|
|
||||||
|
|
||||||
@Synchronized
|
@Synchronized
|
||||||
fun clear() {
|
fun clear() {
|
||||||
entries.clear()
|
entries.clear()
|
||||||
total = 0; cached = 0; blocked = 0; failed = 0; latencySum = 0; latencyCount = 0
|
|
||||||
version.value++
|
version.value++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package cc.skysparkle.sparkledns
|
package cc.skysparkle.sparkledns
|
||||||
|
|
||||||
|
import androidx.annotation.DrawableRes
|
||||||
import androidx.compose.animation.AnimatedVisibility
|
import androidx.compose.animation.AnimatedVisibility
|
||||||
import androidx.compose.animation.animateColorAsState
|
import androidx.compose.animation.animateColorAsState
|
||||||
import androidx.compose.foundation.background
|
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
@@ -27,7 +27,6 @@ import androidx.compose.material3.OutlinedButton
|
|||||||
import androidx.compose.material3.OutlinedTextField
|
import androidx.compose.material3.OutlinedTextField
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
@@ -36,6 +35,7 @@ import androidx.compose.runtime.saveable.rememberSaveable
|
|||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.draw.drawBehind
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
@@ -50,7 +50,6 @@ import androidx.compose.ui.unit.dp
|
|||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.delay
|
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
|
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
|
||||||
@@ -65,6 +64,7 @@ fun SettingsScreen(
|
|||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val prefs = remember { Prefs(context) }
|
val prefs = remember { Prefs(context) }
|
||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
|
val side = sidePadding(windowWidth())
|
||||||
val active by DohVpnService.active.collectAsStateWithLifecycle()
|
val active by DohVpnService.active.collectAsStateWithLifecycle()
|
||||||
|
|
||||||
var selected by remember { mutableStateOf(prefs.providerId) }
|
var selected by remember { mutableStateOf(prefs.providerId) }
|
||||||
@@ -83,14 +83,7 @@ fun SettingsScreen(
|
|||||||
|
|
||||||
// Picking a server never touches a live connection; switching is an explicit action
|
// Picking a server never touches a live connection; switching is an explicit action
|
||||||
val pendingSwitch = active?.let { it != selectedProvider && canConnect } == true
|
val pendingSwitch = active?.let { it != selectedProvider && canConnect } == true
|
||||||
var busy by remember { mutableStateOf(false) }
|
var busy by rememberVpnBusy(active)
|
||||||
LaunchedEffect(active) { busy = false }
|
|
||||||
LaunchedEffect(busy) {
|
|
||||||
if (busy) {
|
|
||||||
delay(BUSY_TIMEOUT_MS)
|
|
||||||
busy = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun select(id: String) {
|
fun select(id: String) {
|
||||||
selected = id
|
selected = id
|
||||||
@@ -113,14 +106,14 @@ fun SettingsScreen(
|
|||||||
Column(
|
Column(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.verticalScroll(rememberScrollState())
|
.verticalScroll(rememberScrollState())
|
||||||
.padding(start = 20.dp, end = 20.dp, top = 16.dp, bottom = bottomPadding),
|
.padding(start = side, end = side, top = 16.dp, bottom = bottomPadding),
|
||||||
verticalArrangement = Arrangement.spacedBy(10.dp),
|
verticalArrangement = Arrangement.spacedBy(10.dp),
|
||||||
) {
|
) {
|
||||||
ScreenTitle(stringResource(R.string.tab_settings), Modifier.heightIn(min = 44.dp))
|
ScreenTitle(stringResource(R.string.tab_settings), Modifier.heightIn(min = 44.dp))
|
||||||
|
|
||||||
SectionLabel(stringResource(R.string.servers), Modifier.padding(top = 8.dp))
|
SectionLabel(stringResource(R.string.servers), Modifier.padding(top = 8.dp))
|
||||||
Column(Modifier.fillMaxWidth().appCard()) {
|
Column(Modifier.fillMaxWidth().appCard()) {
|
||||||
Providers.list.forEachIndexed { index, provider ->
|
Providers.builtIn.forEachIndexed { index, provider ->
|
||||||
if (index > 0) ListDivider()
|
if (index > 0) ListDivider()
|
||||||
ServerRow(
|
ServerRow(
|
||||||
title = provider.name,
|
title = provider.name,
|
||||||
@@ -195,11 +188,14 @@ fun SettingsScreen(
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.weight(1f)
|
.weight(1f)
|
||||||
.height(48.dp),
|
.height(48.dp),
|
||||||
) { Text(stringResource(if (testing) R.string.testing else R.string.test), maxLines = 1) }
|
) {
|
||||||
|
Icon(painterResource(R.drawable.ic_speed), contentDescription = null, modifier = Modifier.size(18.dp))
|
||||||
|
Spacer(Modifier.width(8.dp))
|
||||||
|
Text(stringResource(if (testing) R.string.testing else R.string.test), maxLines = 1)
|
||||||
|
}
|
||||||
|
|
||||||
// Remembers the last name so the button keeps its label while it animates out
|
// The button keeps its label while it animates out
|
||||||
val lastSwitch = remember { arrayOf("") }
|
val switchName = rememberLast(if (pendingSwitch) selectedProvider.displayName(context) else null).orEmpty()
|
||||||
if (pendingSwitch) lastSwitch[0] = selectedProvider.displayName(context)
|
|
||||||
AnimatedVisibility(visible = pendingSwitch, modifier = Modifier.weight(1f)) {
|
AnimatedVisibility(visible = pendingSwitch, modifier = Modifier.weight(1f)) {
|
||||||
Button(
|
Button(
|
||||||
onClick = {
|
onClick = {
|
||||||
@@ -214,8 +210,10 @@ fun SettingsScreen(
|
|||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.height(48.dp),
|
.height(48.dp),
|
||||||
) {
|
) {
|
||||||
|
Icon(painterResource(R.drawable.ic_swap), contentDescription = null, modifier = Modifier.size(18.dp))
|
||||||
|
Spacer(Modifier.width(8.dp))
|
||||||
Text(
|
Text(
|
||||||
stringResource(R.string.switch_to, lastSwitch[0]),
|
stringResource(R.string.switch_to, switchName),
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
)
|
)
|
||||||
@@ -237,6 +235,7 @@ fun SettingsScreen(
|
|||||||
SectionLabel(stringResource(R.string.settings_general), Modifier.padding(top = 8.dp))
|
SectionLabel(stringResource(R.string.settings_general), Modifier.padding(top = 8.dp))
|
||||||
Column(Modifier.fillMaxWidth().appCard()) {
|
Column(Modifier.fillMaxWidth().appCard()) {
|
||||||
NavRow(
|
NavRow(
|
||||||
|
icon = R.drawable.ic_tab_apps,
|
||||||
title = stringResource(R.string.settings_apps),
|
title = stringResource(R.string.settings_apps),
|
||||||
subtitle = if (excludedCount > 0) stringResource(R.string.apps_count, excludedCount)
|
subtitle = if (excludedCount > 0) stringResource(R.string.apps_count, excludedCount)
|
||||||
else stringResource(R.string.settings_apps_desc),
|
else stringResource(R.string.settings_apps_desc),
|
||||||
@@ -244,6 +243,7 @@ fun SettingsScreen(
|
|||||||
)
|
)
|
||||||
ListDivider()
|
ListDivider()
|
||||||
NavRow(
|
NavRow(
|
||||||
|
icon = R.drawable.ic_tab_info,
|
||||||
title = stringResource(R.string.tab_about),
|
title = stringResource(R.string.tab_about),
|
||||||
subtitle = "${stringResource(R.string.about_version)} ${BuildConfig.VERSION_NAME}",
|
subtitle = "${stringResource(R.string.about_version)} ${BuildConfig.VERSION_NAME}",
|
||||||
onClick = onOpenAbout,
|
onClick = onOpenAbout,
|
||||||
@@ -269,7 +269,8 @@ private fun ServerRow(
|
|||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.background(highlight)
|
// Read when drawing, so the fade does not recompose the row every frame
|
||||||
|
.drawBehind { drawRect(highlight) }
|
||||||
.selectable(selected = selected, onClick = onClick, role = Role.RadioButton)
|
.selectable(selected = selected, onClick = onClick, role = Role.RadioButton)
|
||||||
.heightIn(min = 60.dp)
|
.heightIn(min = 60.dp)
|
||||||
.padding(start = 16.dp, end = 8.dp, top = 8.dp, bottom = 8.dp),
|
.padding(start = 16.dp, end = 8.dp, top = 8.dp, bottom = 8.dp),
|
||||||
@@ -286,26 +287,8 @@ private fun ServerRow(
|
|||||||
)
|
)
|
||||||
Text(subtitle, color = Palette.Fg3, fontSize = 12.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
Text(subtitle, color = Palette.Fg3, fontSize = 12.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||||
}
|
}
|
||||||
if (onDonate != null) {
|
if (onDonate != null) LinkButton(R.drawable.ic_donate, stringResource(R.string.donate), onDonate)
|
||||||
IconButton(onClick = onDonate, modifier = Modifier.size(40.dp)) {
|
if (onPolicy != null) LinkButton(R.drawable.ic_policy, stringResource(R.string.about_privacy_policy), onPolicy)
|
||||||
Icon(
|
|
||||||
painterResource(R.drawable.ic_donate),
|
|
||||||
contentDescription = stringResource(R.string.donate),
|
|
||||||
tint = Palette.Fg3,
|
|
||||||
modifier = Modifier.size(18.dp),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (onPolicy != null) {
|
|
||||||
IconButton(onClick = onPolicy, modifier = Modifier.size(40.dp)) {
|
|
||||||
Icon(
|
|
||||||
painterResource(R.drawable.ic_policy),
|
|
||||||
contentDescription = stringResource(R.string.about_privacy_policy),
|
|
||||||
tint = Palette.Fg3,
|
|
||||||
modifier = Modifier.size(18.dp),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Spacer(Modifier.width(4.dp))
|
Spacer(Modifier.width(4.dp))
|
||||||
if (selected) {
|
if (selected) {
|
||||||
Icon(
|
Icon(
|
||||||
@@ -321,8 +304,16 @@ private fun ServerRow(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Small button next to a server that opens one of its pages
|
||||||
@Composable
|
@Composable
|
||||||
private fun NavRow(title: String, subtitle: String, onClick: () -> Unit) {
|
private fun LinkButton(@DrawableRes icon: Int, description: String, onClick: () -> Unit) {
|
||||||
|
IconButton(onClick = onClick, modifier = Modifier.size(40.dp)) {
|
||||||
|
Icon(painterResource(icon), contentDescription = description, tint = Palette.Fg3, modifier = Modifier.size(18.dp))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun NavRow(@DrawableRes icon: Int, title: String, subtitle: String, onClick: () -> Unit) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
@@ -331,6 +322,8 @@ private fun NavRow(title: String, subtitle: String, onClick: () -> Unit) {
|
|||||||
.padding(start = 16.dp, end = 12.dp, top = 10.dp, bottom = 10.dp),
|
.padding(start = 16.dp, end = 12.dp, top = 10.dp, bottom = 10.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
) {
|
||||||
|
Icon(painterResource(icon), contentDescription = null, tint = Palette.Accent, modifier = Modifier.size(24.dp))
|
||||||
|
Spacer(Modifier.width(14.dp))
|
||||||
Column(Modifier.weight(1f)) {
|
Column(Modifier.weight(1f)) {
|
||||||
Text(title, color = Palette.Fg, fontSize = 15.sp, fontWeight = FontWeight.Bold)
|
Text(title, color = Palette.Fg, fontSize = 15.sp, fontWeight = FontWeight.Bold)
|
||||||
Text(subtitle, color = Palette.Fg3, fontSize = 12.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
Text(subtitle, color = Palette.Fg3, fontSize = 12.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||||
|
|||||||
@@ -4,12 +4,11 @@ import android.content.Context
|
|||||||
import android.util.Log
|
import android.util.Log
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import kotlinx.coroutines.flow.StateFlow
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
import java.io.BufferedInputStream
|
import java.io.ByteArrayInputStream
|
||||||
import java.io.ByteArrayOutputStream
|
import java.io.ByteArrayOutputStream
|
||||||
import java.io.DataInputStream
|
import java.io.DataInputStream
|
||||||
import java.io.DataOutputStream
|
import java.io.DataOutputStream
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.FileInputStream
|
|
||||||
import java.util.concurrent.Executors
|
import java.util.concurrent.Executors
|
||||||
|
|
||||||
class StatsSummary(
|
class StatsSummary(
|
||||||
@@ -26,82 +25,147 @@ class HourPoint(val total: Long, val blocked: Long)
|
|||||||
// Hourly counters of the last 7 days for the charts. Only numbers are kept, never domains,
|
// Hourly counters of the last 7 days for the charts. Only numbers are kept, never domains,
|
||||||
// and they never leave the device.
|
// and they never leave the device.
|
||||||
object StatsStore {
|
object StatsStore {
|
||||||
private const val HOURS = 24 * 7
|
|
||||||
private const val HOUR_MS = 3_600_000L
|
private const val HOUR_MS = 3_600_000L
|
||||||
private const val FORMAT = 1
|
|
||||||
private const val FILE = "stats.bin"
|
private const val FILE = "stats.bin"
|
||||||
private const val SAVE_INTERVAL_MS = 60_000L
|
private const val SAVE_INTERVAL_MS = 60_000L
|
||||||
|
|
||||||
// Per hour: total, blocked, cached, latency sum and count, then one counter per company
|
private val counters = HourlyCounters()
|
||||||
private const val TOTAL = 0
|
|
||||||
private const val BLOCKED = 1
|
|
||||||
private const val CACHED = 2
|
|
||||||
private const val LATENCY_SUM = 3
|
|
||||||
private const val LATENCY_COUNT = 4
|
|
||||||
private const val FIRST_COMPANY = 5
|
|
||||||
private val FIELDS = FIRST_COMPANY + Company.entries.size
|
|
||||||
|
|
||||||
// A ring of slots; each remembers which hour (since the epoch) it currently holds
|
|
||||||
private val hourIds = LongArray(HOURS) { -1L }
|
|
||||||
private val counters = Array(HOURS) { LongArray(FIELDS) }
|
|
||||||
private var file: File? = null
|
private var file: File? = null
|
||||||
|
|
||||||
// Bumped when the numbers change without a new query: loaded from disk or cleared
|
// Bumped when the numbers change without a new query: loaded from disk
|
||||||
private val _version = MutableStateFlow(0)
|
private val _version = MutableStateFlow(0)
|
||||||
val version: StateFlow<Int> = _version
|
val version: StateFlow<Int> = _version
|
||||||
private var lastSave = 0L
|
private var lastSave = 0L
|
||||||
private var dirty = false
|
private var dirty = false
|
||||||
|
|
||||||
|
// Counts every change, so summary() can hand out its last result while nothing changed
|
||||||
|
private var changes = 0L
|
||||||
|
private var lastSummary: StatsSummary? = null
|
||||||
|
private var summaryChanges = 0L
|
||||||
|
private var summaryHours = 0
|
||||||
|
private var summaryHour = 0L
|
||||||
|
|
||||||
// Saves happen off the VPN threads, one at a time
|
// Saves happen off the VPN threads, one at a time
|
||||||
private val writer = Executors.newSingleThreadExecutor { Thread(it, "stats-writer").apply { isDaemon = true } }
|
private val writer = Executors.newSingleThreadExecutor { Thread(it, "stats-writer").apply { isDaemon = true } }
|
||||||
|
|
||||||
|
// The file is read outside the lock, so neither the DNS threads nor the screens wait for
|
||||||
|
// storage. Queries counted before it was read are added to the saved numbers.
|
||||||
fun init(context: Context) {
|
fun init(context: Context) {
|
||||||
val target = File(context.filesDir, FILE)
|
val target = File(context.filesDir, FILE)
|
||||||
|
val saved = read(target)
|
||||||
synchronized(this) {
|
synchronized(this) {
|
||||||
file = target
|
file = target
|
||||||
load(target)
|
if (saved != null) counters.merge(saved)
|
||||||
|
changes++
|
||||||
}
|
}
|
||||||
_version.value++
|
_version.value++
|
||||||
}
|
}
|
||||||
|
|
||||||
fun record(status: QueryStatus, latencyMs: Int, company: Company?, now: Long = System.currentTimeMillis()) {
|
fun record(status: QueryStatus, latencyMs: Int, company: Company?, now: Long = System.currentTimeMillis()) {
|
||||||
val snapshot = synchronized(this) {
|
val save = synchronized(this) {
|
||||||
val row = row(now / HOUR_MS)
|
counters.record(status, latencyMs, company, now / HOUR_MS)
|
||||||
row[TOTAL]++
|
changes++
|
||||||
when (status) {
|
|
||||||
QueryStatus.BLOCKED -> row[BLOCKED]++
|
|
||||||
QueryStatus.CACHED -> row[CACHED]++
|
|
||||||
QueryStatus.OK -> {
|
|
||||||
row[LATENCY_SUM] += latencyMs.toLong()
|
|
||||||
row[LATENCY_COUNT]++
|
|
||||||
}
|
|
||||||
QueryStatus.FAILED -> Unit
|
|
||||||
}
|
|
||||||
if (company != null) row[FIRST_COMPANY + company.ordinal]++
|
|
||||||
dirty = true
|
dirty = true
|
||||||
if (file != null && now - lastSave >= SAVE_INTERVAL_MS) {
|
if (file != null && now - lastSave >= SAVE_INTERVAL_MS) {
|
||||||
lastSave = now
|
lastSave = now
|
||||||
dirty = false
|
true
|
||||||
encode()
|
|
||||||
} else {
|
} else {
|
||||||
null
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
snapshot?.let(::save)
|
// The writer thread encodes the numbers itself, so this DNS thread only hands the job over
|
||||||
|
if (save) writer.execute(::save)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Totals of the last [hours] hours, the current one included
|
// Totals of the last [hours] hours, the current one included. While nothing changed the same
|
||||||
|
// object comes back, so a screen refreshed with it has nothing to recompose.
|
||||||
fun summary(hours: Int, now: Long = System.currentTimeMillis()): StatsSummary = synchronized(this) {
|
fun summary(hours: Int, now: Long = System.currentTimeMillis()): StatsSummary = synchronized(this) {
|
||||||
val current = now / HOUR_MS
|
val current = now / HOUR_MS
|
||||||
|
lastSummary?.takeIf { summaryChanges == changes && summaryHours == hours && summaryHour == current }
|
||||||
|
?: counters.summary(hours, current).also {
|
||||||
|
lastSummary = it
|
||||||
|
summaryChanges = changes
|
||||||
|
summaryHours = hours
|
||||||
|
summaryHour = current
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// One point per hour, oldest first, ending with the current hour
|
||||||
|
fun hourly(hours: Int, now: Long = System.currentTimeMillis()): List<HourPoint> =
|
||||||
|
synchronized(this) { counters.hourly(hours, now / HOUR_MS) }
|
||||||
|
|
||||||
|
// Saves what is not on disk yet; called when the VPN stops
|
||||||
|
fun flush() {
|
||||||
|
val save = synchronized(this) {
|
||||||
|
if (file != null && dirty) {
|
||||||
|
lastSave = System.currentTimeMillis()
|
||||||
|
true
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (save) writer.execute(::save)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Runs on the writer thread
|
||||||
|
private fun save() {
|
||||||
|
val (target, bytes) = synchronized(this) {
|
||||||
|
val current = file ?: return
|
||||||
|
dirty = false
|
||||||
|
current to counters.encode()
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
val tmp = File(target.parentFile, "$FILE.tmp")
|
||||||
|
tmp.writeBytes(bytes)
|
||||||
|
if (!tmp.renameTo(target)) tmp.delete()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.w("SparkleDNS", "Cannot save statistics", e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun read(source: File): HourlyCounters? {
|
||||||
|
if (!source.exists()) return null
|
||||||
|
return try {
|
||||||
|
HourlyCounters.decode(source.readBytes())
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.w("SparkleDNS", "Cannot read statistics", e)
|
||||||
|
null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// The numbers behind StatsStore: a ring of hourly rows, each remembering which hour (since the
|
||||||
|
// epoch) it holds. Plain data without locks or Android; StatsStore takes care of both.
|
||||||
|
internal class HourlyCounters {
|
||||||
|
val hourIds = LongArray(HOURS) { -1L }
|
||||||
|
val rows = Array(HOURS) { LongArray(FIELDS) }
|
||||||
|
|
||||||
|
fun record(status: QueryStatus, latencyMs: Int, company: Company?, hour: Long) {
|
||||||
|
val row = row(hour)
|
||||||
|
row[TOTAL]++
|
||||||
|
when (status) {
|
||||||
|
QueryStatus.BLOCKED -> row[BLOCKED]++
|
||||||
|
QueryStatus.CACHED -> row[CACHED]++
|
||||||
|
QueryStatus.OK -> {
|
||||||
|
row[LATENCY_SUM] += latencyMs.toLong()
|
||||||
|
row[LATENCY_COUNT]++
|
||||||
|
}
|
||||||
|
QueryStatus.FAILED -> Unit
|
||||||
|
}
|
||||||
|
if (company != null) row[FIRST_COMPANY + company.ordinal]++
|
||||||
|
}
|
||||||
|
|
||||||
|
// Totals of the last [hours] hours up to [currentHour]
|
||||||
|
fun summary(hours: Int, currentHour: Long): StatsSummary {
|
||||||
val sums = LongArray(FIELDS)
|
val sums = LongArray(FIELDS)
|
||||||
for (back in 0 until hours.coerceIn(1, HOURS)) {
|
for (back in 0 until hours.coerceIn(1, HOURS)) {
|
||||||
val id = current - back
|
val id = currentHour - back
|
||||||
val index = slot(id)
|
val index = slot(id)
|
||||||
if (hourIds[index] != id) continue
|
if (hourIds[index] != id) continue
|
||||||
val row = counters[index]
|
val row = rows[index]
|
||||||
for (field in 0 until FIELDS) sums[field] += row[field]
|
for (field in 0 until FIELDS) sums[field] += row[field]
|
||||||
}
|
}
|
||||||
StatsSummary(
|
return StatsSummary(
|
||||||
total = sums[TOTAL],
|
total = sums[TOTAL],
|
||||||
blocked = sums[BLOCKED],
|
blocked = sums[BLOCKED],
|
||||||
cached = sums[CACHED],
|
cached = sums[CACHED],
|
||||||
@@ -110,41 +174,43 @@ object StatsStore {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// One point per hour, oldest first, ending with the current hour
|
// One point per hour, oldest first, ending with [currentHour]
|
||||||
fun hourly(hours: Int, now: Long = System.currentTimeMillis()): List<HourPoint> = synchronized(this) {
|
fun hourly(hours: Int, currentHour: Long): List<HourPoint> {
|
||||||
val count = hours.coerceIn(1, HOURS)
|
val count = hours.coerceIn(1, HOURS)
|
||||||
val current = now / HOUR_MS
|
return List(count) { position ->
|
||||||
List(count) { position ->
|
val id = currentHour - (count - 1 - position)
|
||||||
val id = current - (count - 1 - position)
|
|
||||||
val index = slot(id)
|
val index = slot(id)
|
||||||
if (hourIds[index] == id) HourPoint(counters[index][TOTAL], counters[index][BLOCKED]) else HourPoint(0, 0)
|
if (hourIds[index] == id) HourPoint(rows[index][TOTAL], rows[index][BLOCKED]) else HourPoint(0, 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun clear() {
|
// Saved hours are added to the ones counted since the start; a slot keeps the newer hour
|
||||||
val snapshot = synchronized(this) {
|
fun merge(saved: HourlyCounters) {
|
||||||
hourIds.fill(-1L)
|
for (index in 0 until HOURS) {
|
||||||
counters.forEach { it.fill(0L) }
|
val id = saved.hourIds[index]
|
||||||
dirty = false
|
when {
|
||||||
lastSave = System.currentTimeMillis()
|
id < 0 || id < hourIds[index] -> Unit
|
||||||
if (file != null) encode() else null
|
id == hourIds[index] -> for (field in 0 until FIELDS) rows[index][field] += saved.rows[index][field]
|
||||||
}
|
else -> {
|
||||||
snapshot?.let(::save)
|
hourIds[index] = id
|
||||||
_version.value++
|
saved.rows[index].copyInto(rows[index])
|
||||||
}
|
}
|
||||||
|
|
||||||
// Saves what is not on disk yet; called when the VPN stops
|
|
||||||
fun flush() {
|
|
||||||
val snapshot = synchronized(this) {
|
|
||||||
if (file != null && dirty) {
|
|
||||||
dirty = false
|
|
||||||
lastSave = System.currentTimeMillis()
|
|
||||||
encode()
|
|
||||||
} else {
|
|
||||||
null
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
snapshot?.let(::save)
|
}
|
||||||
|
|
||||||
|
fun encode(): ByteArray {
|
||||||
|
val bytes = ByteArrayOutputStream(12 + HOURS * (FIELDS + 1) * 8)
|
||||||
|
DataOutputStream(bytes).use { out ->
|
||||||
|
out.writeInt(FORMAT)
|
||||||
|
out.writeInt(FIELDS)
|
||||||
|
out.writeInt(HOURS)
|
||||||
|
for (index in 0 until HOURS) {
|
||||||
|
out.writeLong(hourIds[index])
|
||||||
|
rows[index].forEach { out.writeLong(it) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return bytes.toByteArray()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun slot(id: Long): Int = (((id % HOURS) + HOURS) % HOURS).toInt()
|
private fun slot(id: Long): Int = (((id % HOURS) + HOURS) % HOURS).toInt()
|
||||||
@@ -153,58 +219,41 @@ object StatsStore {
|
|||||||
val index = slot(id)
|
val index = slot(id)
|
||||||
if (hourIds[index] != id) {
|
if (hourIds[index] != id) {
|
||||||
hourIds[index] = id
|
hourIds[index] = id
|
||||||
counters[index].fill(0L)
|
rows[index].fill(0L)
|
||||||
}
|
}
|
||||||
return counters[index]
|
return rows[index]
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun encode(): ByteArray {
|
companion object {
|
||||||
val bytes = ByteArrayOutputStream()
|
const val HOURS = 24 * 7
|
||||||
DataOutputStream(bytes).use { out ->
|
private const val FORMAT = 1
|
||||||
out.writeInt(FORMAT)
|
|
||||||
out.writeInt(FIELDS)
|
|
||||||
out.writeInt(HOURS)
|
|
||||||
for (index in 0 until HOURS) {
|
|
||||||
out.writeLong(hourIds[index])
|
|
||||||
counters[index].forEach { out.writeLong(it) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return bytes.toByteArray()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun save(bytes: ByteArray) {
|
// Per hour: total, blocked, cached, latency sum and count, then one counter per company
|
||||||
val target = file ?: return
|
private const val TOTAL = 0
|
||||||
writer.execute {
|
private const val BLOCKED = 1
|
||||||
try {
|
private const val CACHED = 2
|
||||||
val tmp = File(target.parentFile, "$FILE.tmp")
|
private const val LATENCY_SUM = 3
|
||||||
tmp.writeBytes(bytes)
|
private const val LATENCY_COUNT = 4
|
||||||
if (!tmp.renameTo(target)) tmp.delete()
|
const val FIRST_COMPANY = 5
|
||||||
} catch (e: Exception) {
|
val FIELDS = FIRST_COMPANY + Company.entries.size
|
||||||
Log.w("SparkleDNS", "Cannot save statistics", e)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Files from a version with fewer companies load fine: the new counters start at zero
|
// Files from a version with fewer companies load fine: the new counters start at zero.
|
||||||
private fun load(source: File) {
|
// Null for a file of another format.
|
||||||
if (!source.exists()) return
|
fun decode(bytes: ByteArray): HourlyCounters? {
|
||||||
try {
|
DataInputStream(ByteArrayInputStream(bytes)).use { input ->
|
||||||
DataInputStream(BufferedInputStream(FileInputStream(source))).use { input ->
|
if (input.readInt() != FORMAT) return null
|
||||||
if (input.readInt() != FORMAT) return
|
|
||||||
val fields = input.readInt()
|
val fields = input.readInt()
|
||||||
if (input.readInt() != HOURS || fields < FIRST_COMPANY) return
|
if (input.readInt() != HOURS || fields < FIRST_COMPANY) return null
|
||||||
|
val result = HourlyCounters()
|
||||||
for (index in 0 until HOURS) {
|
for (index in 0 until HOURS) {
|
||||||
hourIds[index] = input.readLong()
|
result.hourIds[index] = input.readLong()
|
||||||
for (field in 0 until fields) {
|
for (field in 0 until fields) {
|
||||||
val value = input.readLong()
|
val value = input.readLong()
|
||||||
if (field < FIELDS) counters[index][field] = value
|
if (field < FIELDS) result.rows[index][field] = value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return result
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
|
||||||
Log.w("SparkleDNS", "Cannot read statistics", e)
|
|
||||||
hourIds.fill(-1L)
|
|
||||||
counters.forEach { it.fill(0L) }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import androidx.compose.foundation.layout.BoxScope
|
|||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
|
import androidx.compose.foundation.layout.fillMaxHeight
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
@@ -14,6 +15,7 @@ import androidx.compose.foundation.layout.navigationBarsPadding
|
|||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.layout.width
|
import androidx.compose.foundation.layout.width
|
||||||
|
import androidx.compose.foundation.layout.widthIn
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.foundation.text.BasicTextField
|
import androidx.compose.foundation.text.BasicTextField
|
||||||
import androidx.compose.material3.HorizontalDivider
|
import androidx.compose.material3.HorizontalDivider
|
||||||
@@ -29,11 +31,13 @@ import androidx.compose.ui.Modifier
|
|||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.graphics.SolidColor
|
import androidx.compose.ui.graphics.SolidColor
|
||||||
|
import androidx.compose.ui.platform.LocalConfiguration
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.TextStyle
|
import androidx.compose.ui.text.TextStyle
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
|
import androidx.compose.ui.unit.Dp
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
|
|
||||||
@@ -44,7 +48,6 @@ object Palette {
|
|||||||
val CardHigh = Color(0xFF1E2026)
|
val CardHigh = Color(0xFF1E2026)
|
||||||
val Line = Color(0xFF24262C)
|
val Line = Color(0xFF24262C)
|
||||||
val Track = Color(0xFF3A3C44)
|
val Track = Color(0xFF3A3C44)
|
||||||
val Muted = Color(0xFF5B5F6B)
|
|
||||||
val Fg = Color(0xFFF2F3F5)
|
val Fg = Color(0xFFF2F3F5)
|
||||||
val Fg2 = Color(0xFF9A9DA6)
|
val Fg2 = Color(0xFF9A9DA6)
|
||||||
val Fg3 = Color(0xFF7E828C)
|
val Fg3 = Color(0xFF7E828C)
|
||||||
@@ -86,6 +89,24 @@ internal val AppColors = darkColorScheme(
|
|||||||
|
|
||||||
val CardShape = RoundedCornerShape(20.dp)
|
val CardShape = RoundedCornerShape(20.dp)
|
||||||
|
|
||||||
|
// On tablets content stays this wide and sits in the middle, so rows do not stretch across the screen
|
||||||
|
val MaxContentWidth = 560.dp
|
||||||
|
|
||||||
|
// From this width Home and Activity show two columns side by side
|
||||||
|
val WideLayoutWidth = 840.dp
|
||||||
|
val MaxWideContentWidth = 1040.dp
|
||||||
|
|
||||||
|
// Size of the app window in dp
|
||||||
|
@Composable
|
||||||
|
fun windowWidth(): Dp = LocalConfiguration.current.screenWidthDp.dp
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun windowHeight(): Dp = LocalConfiguration.current.screenHeightDp.dp
|
||||||
|
|
||||||
|
// Side padding that keeps content at most [max] wide and at least [min] away from the edges
|
||||||
|
fun sidePadding(available: Dp, max: Dp = MaxContentWidth, min: Dp = 20.dp): Dp =
|
||||||
|
maxOf(min, (available - max) / 2)
|
||||||
|
|
||||||
fun Modifier.appCard(): Modifier = clip(CardShape).background(Palette.Card)
|
fun Modifier.appCard(): Modifier = clip(CardShape).background(Palette.Card)
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@@ -105,7 +126,7 @@ fun AppSwitch(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun appSwitchColors() = SwitchDefaults.colors(
|
private fun appSwitchColors() = SwitchDefaults.colors(
|
||||||
checkedThumbColor = Color.White,
|
checkedThumbColor = Color.White,
|
||||||
checkedTrackColor = Palette.Accent,
|
checkedTrackColor = Palette.Accent,
|
||||||
checkedBorderColor = Palette.Accent,
|
checkedBorderColor = Palette.Accent,
|
||||||
@@ -174,18 +195,27 @@ fun PageHeader(
|
|||||||
// A page with a back header around content that is not built for one
|
// A page with a back header around content that is not built for one
|
||||||
@Composable
|
@Composable
|
||||||
fun SubPage(title: String, onBack: () -> Unit, modifier: Modifier = Modifier, content: @Composable BoxScope.() -> Unit) {
|
fun SubPage(title: String, onBack: () -> Unit, modifier: Modifier = Modifier, content: @Composable BoxScope.() -> Unit) {
|
||||||
Column(modifier) {
|
Box(modifier, contentAlignment = Alignment.TopCenter) {
|
||||||
PageHeader(title, onBack)
|
Column(
|
||||||
Box(
|
|
||||||
Modifier
|
Modifier
|
||||||
.weight(1f)
|
.fillMaxHeight()
|
||||||
.fillMaxSize()
|
.widthIn(max = MaxContentWidth + 32.dp)
|
||||||
.navigationBarsPadding(),
|
.fillMaxWidth()
|
||||||
content = content,
|
) {
|
||||||
)
|
PageHeader(title, onBack)
|
||||||
|
Box(
|
||||||
|
Modifier
|
||||||
|
.weight(1f)
|
||||||
|
.fillMaxSize()
|
||||||
|
.navigationBarsPadding(),
|
||||||
|
content = content,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val SearchTextStyle = TextStyle(color = Palette.Fg, fontSize = 14.sp)
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun SearchField(
|
fun SearchField(
|
||||||
value: String,
|
value: String,
|
||||||
@@ -219,7 +249,7 @@ fun SearchField(
|
|||||||
onValueChange = onValueChange,
|
onValueChange = onValueChange,
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
singleLine = true,
|
singleLine = true,
|
||||||
textStyle = TextStyle(color = Palette.Fg, fontSize = 14.sp),
|
textStyle = SearchTextStyle,
|
||||||
cursorBrush = SolidColor(Palette.Accent),
|
cursorBrush = SolidColor(Palette.Accent),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
package cc.skysparkle.sparkledns
|
package cc.skysparkle.sparkledns
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import androidx.annotation.DrawableRes
|
import androidx.annotation.DrawableRes
|
||||||
import androidx.compose.animation.AnimatedContent
|
import androidx.annotation.StringRes
|
||||||
import androidx.compose.animation.fadeIn
|
|
||||||
import androidx.compose.animation.fadeOut
|
|
||||||
import androidx.compose.animation.slideInVertically
|
|
||||||
import androidx.compose.animation.slideOutVertically
|
|
||||||
import androidx.compose.animation.togetherWith
|
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.border
|
||||||
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
@@ -29,21 +27,21 @@ import androidx.compose.material3.Text
|
|||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.runtime.rememberUpdatedState
|
import androidx.compose.runtime.rememberUpdatedState
|
||||||
import androidx.compose.runtime.setValue
|
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.graphics.ImageBitmap
|
||||||
|
import androidx.compose.ui.res.imageResource
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
|
||||||
import androidx.compose.ui.unit.Dp
|
import androidx.compose.ui.unit.Dp
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
import androidx.lifecycle.Lifecycle
|
import androidx.lifecycle.Lifecycle
|
||||||
import androidx.lifecycle.compose.LocalLifecycleOwner
|
import androidx.lifecycle.compose.LocalLifecycleOwner
|
||||||
import androidx.lifecycle.repeatOnLifecycle
|
import androidx.lifecycle.repeatOnLifecycle
|
||||||
@@ -53,6 +51,28 @@ import java.util.Locale
|
|||||||
val CachedColor = Color(0xFF7FD1AE)
|
val CachedColor = Color(0xFF7FD1AE)
|
||||||
val WarningColor = Color(0xFFFFB86B)
|
val WarningColor = Color(0xFFFFB86B)
|
||||||
|
|
||||||
|
// The 512 px logo, decoded once while the screens are in use. Home shows it each time the tab
|
||||||
|
// opens, and decoding it there would cost the main thread a frame.
|
||||||
|
object AppLogo {
|
||||||
|
@Volatile
|
||||||
|
private var bitmap: ImageBitmap? = null
|
||||||
|
|
||||||
|
// Started with the activity, so the first frame of Home usually finds the logo decoded
|
||||||
|
fun preload(context: Context) {
|
||||||
|
if (bitmap != null) return
|
||||||
|
val appContext = context.applicationContext
|
||||||
|
Thread({ runCatching { get(appContext) } }, "logo-load").start()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Synchronized
|
||||||
|
fun get(context: Context): ImageBitmap =
|
||||||
|
bitmap ?: ImageBitmap.imageResource(context.resources, R.drawable.app_logo).also { bitmap = it }
|
||||||
|
|
||||||
|
fun clear() {
|
||||||
|
bitmap = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Icon on a soft circle of its own color
|
// Icon on a soft circle of its own color
|
||||||
@Composable
|
@Composable
|
||||||
fun IconBadge(@DrawableRes icon: Int, tint: Color = MaterialTheme.colorScheme.primary, size: Dp = 40.dp) {
|
fun IconBadge(@DrawableRes icon: Int, tint: Color = MaterialTheme.colorScheme.primary, size: Dp = 40.dp) {
|
||||||
@@ -67,52 +87,6 @@ fun IconBadge(@DrawableRes icon: Int, tint: Color = MaterialTheme.colorScheme.pr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun SectionHeader(
|
|
||||||
title: String,
|
|
||||||
@DrawableRes icon: Int? = null,
|
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
action: (@Composable () -> Unit)? = null,
|
|
||||||
) {
|
|
||||||
Row(
|
|
||||||
modifier = modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.heightIn(min = 40.dp)
|
|
||||||
.padding(top = 8.dp),
|
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
|
||||||
) {
|
|
||||||
if (icon != null) {
|
|
||||||
Icon(
|
|
||||||
painterResource(icon),
|
|
||||||
contentDescription = null,
|
|
||||||
tint = MaterialTheme.colorScheme.onSurfaceVariant,
|
|
||||||
modifier = Modifier.size(18.dp),
|
|
||||||
)
|
|
||||||
Spacer(Modifier.width(8.dp))
|
|
||||||
}
|
|
||||||
Text(
|
|
||||||
title,
|
|
||||||
style = MaterialTheme.typography.titleSmall,
|
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
|
||||||
modifier = Modifier.weight(1f),
|
|
||||||
)
|
|
||||||
action?.invoke()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun Pill(text: String, color: Color) {
|
|
||||||
Text(
|
|
||||||
text,
|
|
||||||
style = MaterialTheme.typography.labelMedium,
|
|
||||||
color = color,
|
|
||||||
modifier = Modifier
|
|
||||||
.clip(RoundedCornerShape(50))
|
|
||||||
.background(color.copy(alpha = 0.14f))
|
|
||||||
.padding(horizontal = 10.dp, vertical = 3.dp),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun HintCard(
|
fun HintCard(
|
||||||
text: String,
|
text: String,
|
||||||
@@ -161,39 +135,14 @@ fun HintCard(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
private class Last<T>(var value: T?)
|
||||||
fun StatColumn(value: String, label: String, modifier: Modifier = Modifier) {
|
|
||||||
Column(modifier, horizontalAlignment = Alignment.CenterHorizontally) {
|
|
||||||
// Numbers roll up when they change
|
|
||||||
AnimatedContent(
|
|
||||||
targetState = value,
|
|
||||||
transitionSpec = {
|
|
||||||
(slideInVertically(Motion.slide) { it / 2 } + fadeIn(Motion.enterFade)) togetherWith
|
|
||||||
(slideOutVertically(Motion.slide) { -it / 2 } + fadeOut(Motion.exitFade)) using
|
|
||||||
Motion.sizeTransform()
|
|
||||||
},
|
|
||||||
label = "stat",
|
|
||||||
) { shown ->
|
|
||||||
Text(shown, style = MaterialTheme.typography.titleLarge, fontWeight = FontWeight.SemiBold, maxLines = 1)
|
|
||||||
}
|
|
||||||
Text(
|
|
||||||
label,
|
|
||||||
style = MaterialTheme.typography.labelSmall,
|
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
|
||||||
textAlign = TextAlign.Center,
|
|
||||||
maxLines = 2,
|
|
||||||
overflow = TextOverflow.Ellipsis,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// The last non-null value, so a card can keep showing its text while it animates out
|
||||||
@Composable
|
@Composable
|
||||||
fun StatDivider() {
|
fun <T : Any> rememberLast(value: T?): T? {
|
||||||
Box(
|
val last = remember { Last<T>(null) }
|
||||||
Modifier
|
if (value != null) last.value = value
|
||||||
.size(width = 1.dp, height = 32.dp)
|
return last.value
|
||||||
.background(MaterialTheme.colorScheme.outlineVariant)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Runs [onChange] when the query log changes, at most once a second and only while the screen
|
// Runs [onChange] when the query log changes, at most once a second and only while the screen
|
||||||
@@ -209,13 +158,6 @@ fun OnQueryLogChange(onChange: () -> Unit) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun rememberLiveStats(): QueryStats {
|
|
||||||
var stats by remember { mutableStateOf(QueryLog.stats()) }
|
|
||||||
OnQueryLogChange { stats = QueryLog.stats() }
|
|
||||||
return stats
|
|
||||||
}
|
|
||||||
|
|
||||||
// Called from composition only, i.e. on the main thread; rebuilt when the locale changes
|
// Called from composition only, i.e. on the main thread; rebuilt when the locale changes
|
||||||
private var countFormat: Pair<Locale, NumberFormat>? = null
|
private var countFormat: Pair<Locale, NumberFormat>? = null
|
||||||
|
|
||||||
@@ -226,9 +168,6 @@ fun formatCount(value: Long): String {
|
|||||||
return format.format(value)
|
return format.format(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun cachePercent(stats: QueryStats): String =
|
|
||||||
"${if (stats.total == 0L) 0 else stats.cached * 100 / stats.total}%"
|
|
||||||
|
|
||||||
// Rows of one visual group share a background; only the outer corners are rounded
|
// Rows of one visual group share a background; only the outer corners are rounded
|
||||||
fun groupedShape(first: Boolean, last: Boolean, radius: Dp = 16.dp) = RoundedCornerShape(
|
fun groupedShape(first: Boolean, last: Boolean, radius: Dp = 16.dp) = RoundedCornerShape(
|
||||||
topStart = if (first) radius else 0.dp,
|
topStart = if (first) radius else 0.dp,
|
||||||
@@ -270,3 +209,27 @@ fun EmptyState(icon: Int, text: String) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum class StatsPeriod(val hours: Int, @StringRes val label: Int) {
|
||||||
|
DAY(24, R.string.period_24h),
|
||||||
|
WEEK(24 * 7, R.string.period_7d),
|
||||||
|
}
|
||||||
|
|
||||||
|
// Switches between the last 24 hours and the last 7 days
|
||||||
|
@Composable
|
||||||
|
fun PeriodChip(period: StatsPeriod, onChange: (StatsPeriod) -> Unit) {
|
||||||
|
val shape = RoundedCornerShape(18.dp)
|
||||||
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.clip(shape)
|
||||||
|
.border(1.dp, Palette.Track, shape)
|
||||||
|
.clickable { onChange(if (period == StatsPeriod.DAY) StatsPeriod.WEEK else StatsPeriod.DAY) }
|
||||||
|
.heightIn(min = 36.dp)
|
||||||
|
.padding(start = 14.dp, end = 10.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
) {
|
||||||
|
Text(stringResource(period.label), color = Palette.Fg, fontSize = 12.sp, fontWeight = FontWeight.Bold)
|
||||||
|
Spacer(Modifier.width(4.dp))
|
||||||
|
Icon(painterResource(R.drawable.ic_expand), contentDescription = null, tint = Palette.Fg2, modifier = Modifier.size(16.dp))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
<!-- Material Symbols Light "add" by Google, Apache License 2.0 -->
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="256"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="256">
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FFFFFFFF"
|
android:fillColor="#FFFFFFFF"
|
||||||
android:fillType="evenOdd"
|
android:pathData="M 11.5 12.5 H 6 v -1 h 5.5 V 6 h 1 v 5.5 H 18 v 1 h -5.5 V 18 h -1 z" />
|
||||||
android:pathData="M132.0,191.5L123.0,191.5L122.3,191.0L122.0,133.0L64.0,132.7L63.5,132.0L63.5,123.0L64.0,122.3L122.0,122.0L122.3,64.0L123.0,63.5L132.0,63.5L132.7,64.0L133.0,122.0L191.0,122.3L191.5,123.0L191.5,132.0L191.0,132.7L133.0,133.0L132.7,191.0Z" />
|
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
<!-- Material Symbols Light "error" by Google, Apache License 2.0 -->
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="256"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="256">
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FFFFFFFF"
|
android:fillColor="#FFFFFFFF"
|
||||||
android:fillType="evenOdd"
|
android:pathData="M 12 16.462 q .262 0 .439 -.177 q .176 -.177 .176 -.439 q 0 -.261 -.177 -.438 T 12 15.23 t -.438 .177 t -.177 .438 t .177 .439 t .438 .177 m -.5 -3.308 h 1 v -6 h -1 z M 12.003 21 q -1.866 0 -3.51 -.708 q -1.643 -.709 -2.859 -1.924 t -1.925 -2.856 T 3 12.003 t .709 -3.51 Q 4.417 6.85 5.63 5.634 t 2.857 -1.925 T 11.997 3 t 3.51 .709 q 1.643 .708 2.859 1.922 t 1.925 2.857 t .709 3.509 t -.708 3.51 t -1.924 2.859 t -2.856 1.925 t -3.509 .709" />
|
||||||
android:pathData="M137.0,223.0L130.0,223.5L117.0,223.0L105.0,221.0L98.0,219.0L90.0,216.0L80.0,211.0L68.0,203.0L60.0,196.0L53.7,189.0L47.7,181.0L43.5,174.0L37.7,162.0L34.7,153.0L31.7,135.0L31.5,125.0L32.0,117.0L34.0,105.0L36.0,98.0L39.0,90.0L44.0,80.0L52.0,68.0L59.0,60.0L66.0,53.7L74.0,47.7L81.0,43.5L93.0,37.7L102.0,34.7L120.0,31.7L130.0,31.5L138.0,32.0L150.0,34.0L157.0,36.0L165.0,39.0L175.0,44.0L187.0,52.0L195.0,59.0L201.3,66.0L207.3,74.0L211.5,81.0L217.3,93.0L220.3,102.0L223.3,120.0L223.5,130.0L223.0,138.0L221.0,150.0L219.0,157.0L216.0,165.0L211.0,175.0L203.0,187.0L196.0,195.0L189.0,201.3L181.0,207.3L174.0,211.5L162.0,217.3L153.0,220.3ZM139.0,212.0L145.0,211.3L159.0,207.3L167.0,203.7L174.0,199.5L185.0,191.0L193.7,182.0L199.0,175.0L207.0,160.0L209.3,153.0L211.5,144.0L212.5,136.0L212.7,123.0L211.3,110.0L207.3,96.0L203.7,88.0L199.5,81.0L191.0,70.0L182.0,61.3L175.0,56.0L160.0,48.0L153.0,45.7L144.0,43.5L136.0,42.5L123.0,42.3L110.0,43.7L96.0,47.7L88.0,51.3L81.0,55.5L70.0,64.0L61.3,73.0L56.0,80.0L48.0,95.0L45.7,102.0L43.5,111.0L42.5,119.0L42.3,132.0L43.7,145.0L47.7,159.0L51.3,167.0L55.5,174.0L64.0,185.0L73.0,193.7L80.0,199.0L95.0,207.0L102.0,209.3L111.0,211.5L123.0,212.7L132.0,212.7ZM132.0,139.7L123.0,139.7L122.3,139.0L122.3,77.0L123.0,75.7L132.0,75.7L132.7,77.0L132.7,139.0ZM128.0,175.0L126.0,175.0L123.0,173.3L121.3,171.0L121.0,169.0L122.0,165.0L124.0,163.0L128.0,162.0L131.0,163.0L132.0,164.0L133.0,165.0L134.0,168.0L133.5,171.0L132.3,173.0L130.0,174.7Z" />
|
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportWidth="256"
|
|
||||||
android:viewportHeight="256">
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFFFF"
|
|
||||||
android:fillType="evenOdd"
|
|
||||||
android:pathData="M226.0,181.0L29.0,181.0L28.5,180.0L28.7,177.0L32.0,161.0L36.0,150.0L44.0,135.0L49.0,128.0L59.0,117.3L67.0,110.7L76.0,105.0L76.7,104.0L59.7,74.0L60.0,70.0L62.0,68.0L65.0,67.0L66.0,67.0L69.3,69.0L87.0,98.7L99.0,94.7L102.0,94.3L107.0,92.7L113.0,91.7L126.0,90.7L140.0,91.5L148.0,92.7L159.0,95.5L165.0,98.0L168.0,98.7L173.0,91.0L173.0,90.0L177.0,84.0L184.0,71.0L186.0,68.7L188.0,67.3L191.0,67.0L193.0,68.0L195.3,71.0L195.0,75.0L186.0,90.0L186.0,91.0L182.0,97.0L179.0,103.0L178.0,104.0L187.0,110.0L196.7,118.0L205.0,127.0L212.3,137.0L217.7,147.0L223.3,162.0L223.7,165.0L225.3,170.0L225.7,175.0L226.3,177.0L226.7,180.0ZM83.5,156.0L87.0,155.3L90.3,153.0L93.0,149.0L93.5,146.0L93.3,142.0L92.5,140.0L90.0,136.7L86.0,134.3L81.0,133.7L76.0,135.7L74.3,137.0L72.3,140.0L71.3,144.0L71.7,149.0L74.3,153.0L77.0,155.0L83.0,156.3ZM174.0,156.0L177.0,155.3L180.0,153.3L182.0,151.0L183.3,148.0L183.7,144.0L183.3,141.0L180.7,137.0L177.0,134.5L172.0,133.7L168.0,134.7L164.7,137.0L162.0,141.0L161.3,145.0L161.7,148.0L162.7,150.0L166.0,154.0L169.0,155.5L173.0,156.3Z" />
|
|
||||||
</vector>
|
|
||||||
@@ -1,11 +1,10 @@
|
|||||||
|
<!-- Material Symbols Light "arrow-back" by Google, Apache License 2.0 -->
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:autoMirrored="true"
|
android:viewportWidth="24"
|
||||||
android:viewportWidth="256"
|
android:viewportHeight="24">
|
||||||
android:viewportHeight="256">
|
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FFFFFFFF"
|
android:fillColor="#FFFFFFFF"
|
||||||
android:fillType="evenOdd"
|
android:pathData="m 6.921 12.5 l 5.793 5.792 L 12 19 l -7 -7 l 7 -7 l .714 .708 L 6.92 11.5 H 19 v 1 z" />
|
||||||
android:pathData="M128.0,201.7L127.0,201.7L53.3,128.0L53.3,127.0L127.0,53.3L128.0,53.3L134.7,60.0L134.3,61.0L74.3,121.0L73.7,122.0L74.0,122.3L201.0,122.3L202.3,123.0L202.3,132.0L201.0,132.7L73.5,133.0L134.3,194.0L134.7,195.0Z" />
|
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
<!-- Material Symbols Light "check-circle" by Google, Apache License 2.0 -->
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="256"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="256">
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FFFFFFFF"
|
android:fillColor="#FFFFFFFF"
|
||||||
android:fillType="evenOdd"
|
android:pathData="m 10.562 15.908 l 6.396 -6.396 l -.708 -.708 l -5.688 5.688 l -2.85 -2.85 l -.708 .708 z M 12.003 21 q -1.866 0 -3.51 -.708 q -1.643 -.709 -2.859 -1.924 t -1.925 -2.856 T 3 12.003 t .709 -3.51 Q 4.417 6.85 5.63 5.634 t 2.857 -1.925 T 11.997 3 t 3.51 .709 q 1.643 .708 2.859 1.922 t 1.925 2.857 t .709 3.509 t -.708 3.51 t -1.924 2.859 t -2.856 1.925 t -3.509 .709" />
|
||||||
android:pathData="M101.0,184.0L49.0,132.0L48.5,131.0L49.0,130.3L56.0,123.7L101.0,168.7L102.0,168.3L199.0,71.3L200.0,72.0L206.0,78.0L206.3,79.0Z" />
|
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@@ -1,14 +1,10 @@
|
|||||||
|
<!-- Material Symbols Light "chevron-right" by Google, Apache License 2.0 -->
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:autoMirrored="true"
|
|
||||||
android:viewportWidth="24"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="24">
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#FFFFFFFF"
|
||||||
android:pathData="M9,6l6,6l-6,6"
|
android:pathData="m 13.292 12 l -4.6 -4.6 l .708 -.708 L 14.708 12 L 9.4 17.308 l -.708 -.708 z" />
|
||||||
android:strokeWidth="2"
|
|
||||||
android:strokeColor="#FFFFFFFF"
|
|
||||||
android:strokeLineCap="round"
|
|
||||||
android:strokeLineJoin="round" />
|
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
<!-- Material Symbols Light "close" by Google, Apache License 2.0 -->
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="256"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="256">
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
android:strokeColor="#FFFFFFFF"
|
android:fillColor="#FFFFFFFF"
|
||||||
android:strokeWidth="14"
|
android:pathData="m 6.4 18.308 l -.708 -.708 l 5.6 -5.6 l -5.6 -5.6 l .708 -.708 l 5.6 5.6 l 5.6 -5.6 l .708 .708 l -5.6 5.6 l 5.6 5.6 l -.708 .708 l -5.6 -5.6 z" />
|
||||||
android:pathData="M64,64L192,192M192,64L64,192" />
|
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<!-- Material Symbols Light "code" by Google, Apache License 2.0 -->
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFFFF"
|
||||||
|
android:pathData="M 8 17.308 L 2.692 12 L 8 6.692 l .714 .714 l -4.6 4.6 L 8.708 16.6 z m 8 0 l -.713 -.714 l 4.6 -4.6 L 15.292 7.4 L 16 6.692 L 21.308 12 z" />
|
||||||
|
</vector>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<!-- Material Symbols Light "content-copy" by Google, Apache License 2.0 -->
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFFFF"
|
||||||
|
android:pathData="M 9.116 17 q -.691 0 -1.153 -.462 T 7.5 15.385 V 4.615 q 0 -.69 .463 -1.153 T 9.116 3 h 7.769 q .69 0 1.153 .462 t .462 1.153 v 10.77 q 0 .69 -.462 1.152 T 16.884 17 z m -3 3 q -.691 0 -1.153 -.462 T 4.5 18.385 V 6.615 h 1 v 11.77 q 0 .23 .192 .423 t .423 .192 h 8.77 v 1 z" />
|
||||||
|
</vector>
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
|
<!-- Material Symbols Light "copyright" by Google, Apache License 2.0 -->
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="256"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="256">
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FFFFFFFF"
|
android:fillColor="#FFFFFFFF"
|
||||||
android:fillType="evenOdd"
|
android:pathData="M 10 15.5 h 4 q .213 0 .356 -.144 T 14.5 15 v -1.5 h -1 v 1 h -3 v -5 h 3 v 1 h 1 V 9 q 0 -.214 -.144 -.357 T 14 8.5 h -4 q -.213 0 -.356 .144 T 9.5 9 v 6 q 0 .213 .144 .356 T 10 15.5 m 2.003 5.5 q -1.867 0 -3.51 -.708 q -1.643 -.709 -2.859 -1.924 t -1.925 -2.856 T 3 12.003 t .709 -3.51 Q 4.417 6.85 5.63 5.634 t 2.857 -1.925 T 11.997 3 t 3.51 .709 q 1.643 .708 2.859 1.922 t 1.925 2.857 t .709 3.509 t -.708 3.51 t -1.924 2.859 t -2.856 1.925 t -3.509 .709" />
|
||||||
android:pathData="M137.0,223.0L130.0,223.5L117.0,223.0L105.0,221.0L98.0,219.0L90.0,216.0L80.0,211.0L68.0,203.0L60.0,196.0L53.7,189.0L47.7,181.0L43.5,174.0L37.7,162.0L34.7,153.0L31.7,135.0L31.5,125.0L32.0,117.0L34.0,105.0L36.0,98.0L39.0,90.0L44.0,80.0L52.0,68.0L59.0,60.0L66.0,53.7L74.0,47.7L81.0,43.5L93.0,37.7L102.0,34.7L120.0,31.7L130.0,31.5L138.0,32.0L150.0,34.0L157.0,36.0L165.0,39.0L175.0,44.0L187.0,52.0L195.0,59.0L201.3,66.0L207.3,74.0L211.5,81.0L217.3,93.0L220.3,102.0L223.3,120.0L223.5,130.0L223.0,138.0L221.0,150.0L219.0,157.0L216.0,165.0L211.0,175.0L203.0,187.0L196.0,195.0L189.0,201.3L181.0,207.3L174.0,211.5L162.0,217.3L153.0,220.3ZM139.0,212.0L145.0,211.3L159.0,207.3L167.0,203.7L174.0,199.5L185.0,191.0L193.7,182.0L199.0,175.0L207.0,160.0L209.3,153.0L211.5,144.0L212.5,136.0L212.7,123.0L211.3,110.0L207.3,96.0L203.7,88.0L199.5,81.0L191.0,70.0L182.0,61.3L175.0,56.0L160.0,48.0L153.0,45.7L144.0,43.5L136.0,42.5L123.0,42.3L110.0,43.7L96.0,47.7L88.0,51.3L81.0,55.5L70.0,64.0L61.3,73.0L56.0,80.0L48.0,95.0L45.7,102.0L43.5,111.0L42.5,119.0L42.3,132.0L43.7,145.0L47.7,159.0L51.3,167.0L55.5,174.0L64.0,185.0L73.0,193.7L80.0,199.0L95.0,207.0L102.0,209.3L111.0,211.5L123.0,212.7L132.0,212.7ZM151.0,164.3L106.0,164.7L103.0,164.0L101.5,162.0L100.7,160.0L100.7,96.0L102.0,92.0L104.0,90.7L149.0,90.3L152.0,91.0L153.5,93.0L154.3,95.0L154.0,111.3L144.0,111.5L143.5,111.0L143.5,102.0L143.0,100.7L112.0,100.7L111.5,102.0L111.7,154.0L143.0,154.3L143.5,153.0L143.5,144.0L144.0,143.5L154.0,143.7L154.3,159.0L153.0,163.0Z" />
|
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
<!-- Material Symbols Light "delete" by Google, Apache License 2.0 -->
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="256"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="256">
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FFFFFFFF"
|
android:fillColor="#FFFFFFFF"
|
||||||
android:fillType="evenOdd"
|
android:pathData="M 7.616 20 q -.691 0 -1.153 -.462 T 6 18.384 V 6 H 5 V 5 h 4 v -.77 h 6 V 5 h 4 v 1 h -1 v 12.385 q 0 .69 -.462 1.153 T 16.384 20 z m 2.192 -3 h 1 V 8 h -1 z m 3.384 0 h 1 V 8 h -1 z" />
|
||||||
android:pathData="M179.0,212.3L79.0,212.7L75.0,212.0L71.0,210.0L67.7,207.0L65.0,203.0L63.7,199.0L63.5,196.0L63.5,64.0L63.0,63.5L54.0,63.5L52.7,63.0L53.0,53.0L95.0,52.7L95.5,52.0L95.5,45.0L96.0,44.5L159.0,44.5L159.5,45.0L159.5,52.0L160.0,52.7L202.0,53.0L202.3,63.0L201.0,63.5L192.0,63.5L191.5,64.0L191.5,197.0L190.5,202.0L189.0,205.0L185.0,209.3L182.0,211.3ZM114.7,180.0L114.7,86.0L114.0,84.7L105.0,84.7L104.0,85.0L104.0,180.0L105.0,180.7L114.0,180.7ZM151.0,180.0L151.0,86.0L150.0,84.7L141.0,84.7L140.3,86.0L140.3,180.0L141.0,180.7L150.0,180.7Z" />
|
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<!-- Material Symbols Light "delete-sweep" by Google, Apache License 2.0 -->
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFFFF"
|
||||||
|
android:pathData="M 14.885 17.5 v -1 h 3 v 1 z m 0 -8 v -1 h 6 v 1 z m 0 4 v -1 h 5 v 1 z M 4.115 8 h -1 V 7 h 3.731 v -.885 h 2.538 V 7 h 3.732 v 1 h -1 v 8.385 q 0 .69 -.463 1.153 T 10.5 18 H 5.73 q -.69 0 -1.152 -.462 t -.462 -1.153 z" />
|
||||||
|
</vector>
|
||||||
@@ -1,21 +1,10 @@
|
|||||||
|
<!-- Material Symbols Light "volunteer-activism" by Google, Apache License 2.0 -->
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="256"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="256">
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
android:pathData="M128,38 A90,90 0 1,1 128,218 A90,90 0 1,1 128,38 Z"
|
android:fillColor="#FFFFFFFF"
|
||||||
android:strokeColor="#FFFFFFFF"
|
android:pathData="M 6.385 19.583 v -6.737 h 2.08 q .137 0 .283 .028 t .283 .078 l 6.021 2.21 q .446 .163 .736 .536 q .289 .373 .289 .839 q 0 .275 -.18 .446 t -.443 .17 h -1.202 q -.51 0 -.995 -.06 t -.951 -.226 l -1.792 -.644 l -.287 .744 l 1.964 .675 q .472 .16 .976 .22 q .504 .061 1.021 .061 h 5.158 q .685 0 1.17 .45 T 21 19.5 l -6.994 2.308 z m -4 1.417 v -8.154 h 3 V 21 z m 13.307 -8.615 l -3.765 -3.608 q -.66 -.635 -1.101 -1.422 q -.442 -.788 -.442 -1.709 q 0 -1.106 .77 -1.876 T 13.032 3 q .819 0 1.49 .443 t 1.171 1.076 q .5 -.633 1.172 -1.076 q .67 -.443 1.49 -.443 q 1.106 0 1.876 .77 T 21 5.646 q 0 .921 -.438 1.709 t -1.099 1.422 z" />
|
||||||
android:strokeWidth="11" />
|
|
||||||
<path
|
|
||||||
android:pathData="M156,99 C151,88 141,82 128,82 C112,82 100,91 100,105 C100,120 113,125 128,128 C144,131 158,137 158,153 C158,167 145,175 128,175 C113,175 101,168 97,156"
|
|
||||||
android:strokeColor="#FFFFFFFF"
|
|
||||||
android:strokeWidth="11"
|
|
||||||
android:strokeLineCap="round"
|
|
||||||
android:strokeLineJoin="round" />
|
|
||||||
<path
|
|
||||||
android:pathData="M128,64 L128,82 M128,175 L128,193"
|
|
||||||
android:strokeColor="#FFFFFFFF"
|
|
||||||
android:strokeWidth="11"
|
|
||||||
android:strokeLineCap="round" />
|
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
<!-- Material Symbols Light "keyboard-arrow-down" by Google, Apache License 2.0 -->
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="256"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="256">
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FFFFFFFF"
|
android:fillColor="#FFFFFFFF"
|
||||||
android:fillType="evenOdd"
|
android:pathData="M 12 14.708 L 6.692 9.4 l .708 -.708 l 4.6 4.6 l 4.6 -4.6 l .708 .708 z" />
|
||||||
android:pathData="M128.0,201.7L127.0,201.7L53.3,128.0L53.3,127.0L60.0,120.3L61.0,120.7L121.0,180.7L122.0,181.3L122.3,181.0L122.3,54.0L123.0,52.7L132.0,52.7L132.7,54.0L133.0,181.5L194.0,120.7L195.0,120.3L201.7,127.0L201.7,128.0Z" />
|
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<!-- Material Symbols Light "filter-alt" by Google, Apache License 2.0 -->
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFFFF"
|
||||||
|
android:pathData="M 11.77 19 q -.33 0 -.55 -.22 t -.22 -.55 v -5.576 L 5.604 5.83 q -.202 -.27 -.055 -.55 t .47 -.28 h 11.962 q .323 0 .47 .28 q .147 .282 -.055 .55 L 13 12.655 v 5.577 q 0 .328 -.22 .549 t -.55 .22 z" />
|
||||||
|
</vector>
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
|
<!-- Material Symbols Light "headphones" by Google, Apache License 2.0 -->
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="256"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="256">
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FFFFFFFF"
|
android:fillColor="#FFFFFFFF"
|
||||||
android:fillType="evenOdd"
|
android:pathData="M 8.077 20 H 5.616 q -.691 0 -1.153 -.462 T 4 18.384 V 12 q 0 -1.664 .626 -3.118 T 6.34 6.34 t 2.542 -1.714 T 12 4 t 3.118 .626 T 17.66 6.34 t 1.714 2.542 T 20 12 v 6.385 q 0 .69 -.462 1.152 T 18.384 20 h -2.461 v -6.154 H 19 V 12 q 0 -2.925 -2.037 -4.962 T 12 5 T 7.038 7.038 T 5 12 v 1.846 h 3.077 z" />
|
||||||
android:pathData="M206.0,180.3L84.0,180.7L80.0,180.0L76.0,178.0L73.0,175.0L69.7,170.0L68.7,164.0L68.7,49.0L70.0,42.0L71.7,39.0L75.0,35.3L79.0,32.7L82.0,31.7L85.0,31.5L202.0,31.5L207.0,32.5L213.0,36.0L215.3,39.0L217.3,43.0L218.3,48.0L218.3,163.0L218.0,167.0L215.0,174.0L212.0,177.0ZM131.0,156.0L138.0,154.7L142.0,152.3L148.0,146.0L150.3,140.0L151.0,135.0L151.0,74.0L172.0,73.7L175.0,73.0L177.0,71.7L178.0,71.0L180.0,66.0L179.0,62.0L177.7,60.0L175.0,58.0L171.0,57.3L151.0,57.3L148.0,57.7L145.0,60.0L143.0,63.0L142.7,65.0L142.7,118.0L142.0,118.7L139.0,116.0L138.0,116.0L137.0,115.0L132.0,113.7L126.0,113.7L122.0,114.7L118.0,116.7L114.0,120.0L111.0,124.0L109.5,127.0L108.5,131.0L108.5,139.0L109.7,143.0L112.7,148.0L118.0,153.0L122.0,155.0L129.0,156.3ZM177.0,212.0L175.0,212.7L52.0,212.7L48.0,212.0L44.0,210.0L41.0,207.0L37.7,202.0L36.7,196.0L36.7,76.0L38.0,72.0L40.0,70.5L44.0,70.5L46.3,72.0L47.5,75.0L47.5,196.0L49.3,200.0L52.0,201.7L55.0,202.3L175.0,202.3L178.0,203.7L179.3,206.0L179.0,210.0Z" />
|
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
<!-- Material Symbols Light "sports-esports" by Google, Apache License 2.0 -->
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="256"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="256">
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FFFFFFFF"
|
android:fillColor="#FFFFFFFF"
|
||||||
android:fillType="evenOdd"
|
android:pathData="M 4.512 18 q -.762 0 -1.18 -.551 t -.32 -1.23 L 4.1 8.604 q .167 -1.132 .991 -1.868 Q 5.916 6 7.05 6 h 9.9 q 1.135 0 1.959 .736 t .991 1.868 l 1.089 7.615 q .098 .679 -.32 1.23 t -1.18 .551 q -.333 0 -.6 -.101 t -.508 -.341 L 15.823 15 H 8.177 l -2.558 2.558 q -.24 .24 -.507 .341 t -.6 .101 M 17 12.808 q .329 0 .568 -.24 t .24 -.568 t -.24 -.568 t -.568 -.24 t -.568 .24 t -.24 .568 t .24 .568 t .568 .24 m -2 -3 q .329 0 .568 -.24 t .24 -.568 t -.24 -.568 t -.568 -.24 t -.568 .24 t -.24 .568 t .24 .568 t .568 .24 m -6.942 2.884 h .884 v -1.75 h 1.75 v -.884 h -1.75 v -1.75 h -.884 v 1.75 h -1.75 v .884 h 1.75 z" />
|
||||||
android:pathData="M131.0,222.0L128.0,222.5L123.0,222.0L113.0,217.0L100.0,209.0L99.0,209.0L93.0,205.0L80.0,198.0L74.0,194.0L73.0,194.0L67.0,190.0L54.0,183.0L48.0,179.0L44.7,175.0L42.7,170.0L42.3,167.0L42.7,149.0L44.0,145.0L47.0,141.0L53.0,136.7L122.0,97.0L122.0,84.0L119.0,83.5L112.0,80.0L106.7,75.0L102.7,68.0L100.7,59.0L101.5,52.0L103.0,47.0L107.0,41.0L112.0,36.3L117.0,33.5L123.0,31.7L127.0,31.5L131.0,31.7L137.0,33.0L144.0,37.0L150.3,44.0L152.3,48.0L153.3,51.0L154.3,58.0L154.0,62.0L152.5,68.0L149.0,74.0L145.0,78.3L142.0,80.7L137.0,83.3L134.0,83.7L132.7,85.0L133.0,97.0L148.0,106.0L149.0,106.0L155.0,110.0L161.0,113.0L162.0,114.0L168.0,117.0L169.0,118.0L175.0,121.0L181.0,125.0L182.0,125.0L188.0,129.0L201.0,136.0L207.0,140.0L210.3,144.0L211.3,146.0L212.7,152.0L212.3,170.0L211.0,174.0L208.0,178.0L202.0,182.3L173.0,198.7L164.0,204.3L136.0,220.3ZM129.5,182.0L193.7,145.0L190.0,142.0L177.0,135.0L171.0,131.0L170.0,131.0L164.0,127.0L151.0,120.0L138.0,112.0L133.0,109.7L132.7,143.0L132.0,143.5L123.0,143.5L122.3,143.0L122.0,109.5L62.0,143.7L61.0,145.0L84.0,158.0L90.0,162.0L91.0,162.0L104.0,170.0L110.0,173.0L116.0,177.0L117.0,177.0L123.0,181.0L127.0,182.5Z" />
|
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
<!-- Material Symbols Light "image" by Google, Apache License 2.0 -->
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="256"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="256">
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FFFFFFFF"
|
android:fillColor="#FFFFFFFF"
|
||||||
android:fillType="evenOdd"
|
android:pathData="M 5.616 20 q -.691 0 -1.153 -.462 T 4 18.384 V 5.616 q 0 -.691 .463 -1.153 T 5.616 4 h 12.769 q .69 0 1.153 .463 T 20 5.616 v 12.769 q 0 .69 -.462 1.153 T 18.384 20 z M 7.5 16.5 h 9.154 l -2.827 -3.77 l -2.615 3.308 l -1.75 -2.115 z" />
|
||||||
android:pathData="M206.0,180.3L84.0,180.7L80.0,180.0L76.0,178.0L73.0,175.0L69.7,170.0L68.7,164.0L68.7,49.0L70.0,42.0L71.7,39.0L75.0,35.3L79.0,32.7L82.0,31.7L85.0,31.5L202.0,31.5L207.0,32.5L213.0,36.0L215.3,39.0L217.3,43.0L218.3,48.0L218.3,163.0L218.0,167.0L215.0,174.0L212.0,177.0ZM179.0,212.7L52.0,212.7L48.0,212.0L44.0,210.0L41.0,207.0L37.7,202.0L36.7,196.0L37.0,70.5L38.0,70.0L47.0,70.0L47.5,71.0L47.5,196.0L49.3,200.0L52.0,201.7L55.0,202.3L179.0,202.3L179.5,203.0L179.5,212.0ZM189.3,145.0L164.7,112.0L161.0,107.3L160.0,107.0L135.0,138.5L134.0,139.0L133.0,138.0L118.0,120.0L117.0,120.0L97.5,145.0L98.0,145.5L188.0,145.5Z" />
|
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
<!-- Material Symbols Light "map" by Google, Apache License 2.0 -->
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="256"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="256">
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FFFFFFFF"
|
android:fillColor="#FFFFFFFF"
|
||||||
android:fillType="evenOdd"
|
android:pathData="m 15 19.923 l -6 -2.1 l -3.958 1.53 q -.384 .143 -.713 -.083 T 4 18.634 V 6.404 q 0 -.268 .13 -.489 t .378 -.307 L 9 4.077 l 6 2.1 l 3.958 -1.53 q .384 -.143 .713 .054 t .329 .588 v 12.384 q 0 .287 -.159 .498 q -.158 .212 -.426 .298 z m -.5 -1.22 v -11.7 l -5 -1.745 v 11.7 z" />
|
||||||
android:pathData="M159.0,212.0L103.0,192.0L95.0,189.7L89.0,192.3L87.0,192.7L84.0,194.3L82.0,194.7L76.0,197.3L74.0,197.7L71.0,199.3L69.0,199.7L52.0,206.3L49.0,206.5L44.3,204.0L42.3,200.0L42.3,67.0L42.5,65.0L45.0,61.0L49.0,58.7L96.0,43.0L152.0,63.0L160.0,65.3L166.0,62.7L168.0,62.3L171.0,60.7L173.0,60.3L179.0,57.7L181.0,57.3L184.0,55.7L186.0,55.3L203.0,48.7L206.0,48.5L208.0,49.0L211.0,51.0L212.7,54.0L212.5,191.0L209.0,195.3L205.0,197.3L199.0,199.3L196.0,199.7ZM154.3,198.0L154.0,74.0L150.0,73.0L140.0,69.0L130.0,66.0L101.0,55.7L100.7,180.0L102.0,181.0L109.0,183.0L142.0,195.0L153.0,198.5L154.0,198.5Z" />
|
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
<!-- Material Symbols Light "news" by Google, Apache License 2.0 -->
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="256"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="256">
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FFFFFFFF"
|
android:fillColor="#FFFFFFFF"
|
||||||
android:fillType="evenOdd"
|
android:pathData="M 5.616 20 q -.691 0 -1.153 -.462 T 4 18.384 V 5.616 q 0 -.691 .463 -1.153 T 5.616 4 h 9.961 L 20 8.423 v 9.962 q 0 .69 -.462 1.153 T 18.384 20 z M 7.5 16 h 9 v -1 h -9 z m 0 -3.5 h 9 v -1 h -9 z M 15 9 h 4 l -4 -4 z M 7.5 9 H 12 V 8 H 7.5 z" />
|
||||||
android:pathData="M201.0,212.0L198.0,212.7L58.0,212.7L55.0,212.3L51.0,211.0L47.0,208.0L43.7,203.0L42.3,198.0L42.3,58.0L42.7,55.0L44.0,51.0L48.0,46.3L52.0,43.7L57.0,42.3L165.0,42.3L166.0,42.7L212.3,89.0L212.5,199.0L211.0,204.0L208.0,208.0L205.0,210.3ZM201.7,95.0L160.0,53.3L159.5,54.0L159.5,95.0L160.0,95.5L201.0,95.5ZM127.5,95.0L127.5,86.0L127.0,84.7L79.7,85.0L79.5,95.0L80.0,95.5L127.0,95.5ZM175.5,132.0L175.5,123.0L175.0,122.3L80.0,122.3L79.5,123.0L79.5,132.0L80.0,132.7L175.0,132.7ZM175.3,170.0L175.5,160.0L175.0,159.5L80.0,159.5L79.5,160.0L79.5,169.0L80.0,170.3Z" />
|
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
<!-- Material Symbols Light "business-center" by Google, Apache License 2.0 -->
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="256"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="256">
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FFFFFFFF"
|
android:fillColor="#FFFFFFFF"
|
||||||
android:fillType="evenOdd"
|
android:pathData="M 4.616 20 q -.691 0 -1.153 -.462 T 3 18.384 V 14.5 h 7 V 16 h 4 v -1.5 h 7 v 3.885 q 0 .69 -.462 1.152 T 19.385 20 z M 11 15 v -2 h 2 v 2 z m -8 -1.5 V 8.616 q 0 -.691 .463 -1.153 T 4.615 7 H 9 V 5.615 q 0 -.69 .463 -1.153 T 10.616 4 h 2.769 q .69 0 1.153 .462 T 15 5.615 V 7 h 4.385 q .69 0 1.152 .463 T 21 8.616 V 13.5 h -7 V 12 h -4 v 1.5 z M 10 7 h 4 V 5.615 q 0 -.23 -.192 -.423 T 13.385 5 h -2.77 q -.23 0 -.423 .192 T 10 5.615 z" />
|
||||||
android:pathData="M211.0,212.3L47.0,212.7L43.0,212.0L39.0,210.0L35.7,207.0L33.0,203.0L31.7,199.0L31.5,196.0L31.5,90.0L32.5,85.0L34.0,82.0L39.0,77.0L41.0,75.7L45.0,74.5L95.0,74.3L95.5,73.0L95.5,58.0L97.0,52.0L99.7,48.0L103.0,45.0L106.0,43.3L111.0,42.3L144.0,42.3L148.0,43.0L152.0,45.0L156.0,49.0L158.3,53.0L159.3,56.0L159.5,73.0L160.0,74.3L208.0,74.3L212.0,75.0L216.0,77.0L220.0,81.0L222.3,85.0L223.3,88.0L223.5,197.0L222.5,202.0L221.0,205.0L216.0,210.0L214.0,211.3ZM148.5,74.0L148.3,57.0L147.0,55.0L145.0,53.7L142.0,52.7L113.0,52.7L110.0,53.7L108.0,55.0L106.5,58.0L106.3,73.0L107.0,74.3Z" />
|
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
<!-- Material Symbols Light "forum" by Google, Apache License 2.0 -->
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="256"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="256">
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FFFFFFFF"
|
android:fillColor="#FFFFFFFF"
|
||||||
android:fillType="evenOdd"
|
android:pathData="M 7.23 16.23 q -.326 0 -.547 -.22 q -.221 -.222 -.221 -.549 v -1 h 11.75 l .634 .635 V 6 h 1 q .327 0 .548 .221 t .222 .548 v 12.539 l -3.078 -3.077 z m -3.845 -.691 V 3.769 q 0 -.327 .22 -.548 Q 3.828 3 4.155 3 h 11.923 q .327 0 .548 .221 t .221 .548 v 7.923 q 0 .327 -.221 .549 q -.221 .22 -.548 .22 H 6.462 z" />
|
||||||
android:pathData="M219.0,228.0L218.0,228.7L40.0,228.7L39.0,228.0L39.0,187.0L38.0,186.3L32.0,186.3L31.0,186.0L30.7,185.0L31.0,146.0L32.0,144.0L34.0,142.7L36.0,142.3L61.0,142.3L64.0,143.5L65.3,145.0L66.0,148.0L66.0,186.0L59.0,186.3L57.7,187.0L58.0,218.0L155.0,218.0L155.0,154.0L154.0,153.0L130.0,153.0L125.0,152.5L119.0,151.0L111.0,147.0L106.3,143.0L102.0,138.0L98.7,132.0L96.7,125.0L96.7,114.0L99.0,106.0L103.0,99.0L112.0,90.0L122.0,84.0L123.5,75.0L125.5,69.0L129.0,63.0L135.0,56.3L143.0,50.7L147.0,48.7L153.0,47.3L154.0,46.7L166.0,46.7L173.0,48.5L180.0,52.0L186.0,56.7L191.0,62.0L196.3,72.0L198.3,84.0L206.0,88.0L210.0,91.0L216.7,98.0L220.0,103.0L222.7,109.0L224.3,117.0L224.3,121.0L223.0,129.0L222.0,132.0L220.0,135.0L220.0,136.0L214.3,143.0L209.0,147.3L203.0,150.5L197.0,152.3L190.0,153.0L167.0,153.0L165.7,154.0L165.7,217.0L166.0,218.0L167.0,218.3L218.0,218.3L219.0,219.0ZM52.0,131.0L49.0,131.5L44.0,131.0L40.0,128.3L37.7,125.0L36.5,120.0L37.0,116.0L39.0,112.0L44.0,108.5L48.0,107.7L54.0,109.3L57.0,111.5L59.3,115.0L59.7,118.0L60.3,119.0L59.5,124.0L57.0,128.0Z" />
|
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
<!-- Material Symbols Light "android" by Google, Apache License 2.0 -->
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="256"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="256">
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FFFFFFFF"
|
android:fillColor="#FFFFFFFF"
|
||||||
android:fillType="evenOdd"
|
android:pathData="M 2.692 17.02 q .206 -2.272 1.398 -4.173 q 1.192 -1.9 3.176 -3.02 l -1.562 -2.7 q -.131 -.206 -.066 -.408 q .066 -.202 .277 -.327 q .2 -.106 .393 -.04 q .192 .065 .319 .256 l 1.565 2.715 q 1.82 -.764 3.808 -.764 t 3.808 .764 l 1.565 -2.715 q .127 -.19 .32 -.256 q .192 -.066 .391 .04 q .212 .125 .278 .327 q .065 .202 -.066 .408 l -1.561 2.7 q 1.983 1.12 3.175 3.02 q 1.192 1.901 1.398 4.172 z m 5.08 -2.328 q .445 0 .75 -.307 q .305 -.308 .305 -.753 t -.308 -.75 t -.752 -.305 t -.75 .308 t -.306 .752 q 0 .446 .308 .75 t .753 .305 m 8.462 0 q .445 0 .75 -.307 q .304 -.308 .304 -.753 t -.307 -.75 t -.753 -.305 t -.75 .308 t -.305 .752 t .307 .75 t .753 .305" />
|
||||||
android:pathData="M147.0,223.5L108.0,223.5L107.5,223.0L106.7,218.0L106.3,212.0L105.7,210.0L105.3,204.0L104.7,202.0L103.7,193.0L91.0,187.0L83.0,181.0L75.0,183.7L70.0,186.3L68.0,186.7L56.0,192.3L54.0,192.3L34.7,159.0L34.7,158.0L37.0,156.0L58.0,140.3L58.7,139.0L57.7,130.0L58.7,116.0L56.0,113.0L54.0,112.0L52.0,110.0L34.5,97.0L38.0,90.0L42.0,84.0L42.0,83.0L54.0,63.0L58.0,64.0L82.0,74.5L92.0,67.7L103.0,62.5L104.0,60.0L107.0,35.0L108.0,31.5L147.0,31.5L147.5,32.0L148.3,38.0L150.7,59.0L152.0,63.0L153.0,63.0L163.0,68.0L172.0,74.3L178.0,71.7L180.0,71.3L183.0,69.7L185.0,69.3L195.0,64.7L201.0,62.7L220.3,96.0L220.3,97.0L218.0,99.0L195.5,116.0L196.3,121.0L196.5,128.0L196.3,133.0L195.3,139.0L196.0,140.0L220.0,158.0L220.0,159.0L219.0,160.0L204.0,187.0L201.0,192.0L200.0,192.5L172.0,180.5L161.0,188.3L153.0,191.7L151.3,193.0L151.0,194.0L148.0,220.0ZM129.0,154.0L134.0,153.3L138.0,152.0L143.0,149.0L146.5,146.0L149.0,143.0L152.0,138.0L153.5,133.0L153.7,125.0L153.3,121.0L150.3,114.0L145.0,107.7L142.0,105.0L137.0,102.5L127.0,100.7L120.0,101.7L117.0,102.7L113.0,104.7L107.0,110.0L104.0,114.0L102.5,117.0L101.0,122.0L100.5,128.0L101.7,136.0L105.3,143.0L110.0,148.0L116.0,152.0L119.0,153.0L124.0,154.0Z" />
|
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
<!-- Material Symbols Light "movie" by Google, Apache License 2.0 -->
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="256"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="256">
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FFFFFFFF"
|
android:fillColor="#FFFFFFFF"
|
||||||
android:fillType="evenOdd"
|
android:pathData="m 4.616 5 l 1.5 3 h 3 l -1.5 -3 h 2 l 1.5 3 h 3 l -1.5 -3 h 2 l 1.5 3 h 3 l -1.5 -3 h 1.769 q .69 0 1.153 .463 T 21 6.616 v 10.769 q 0 .69 -.462 1.153 T 19.385 19 H 4.615 q -.69 0 -1.152 -.462 T 3 17.384 V 6.616 q 0 -.691 .463 -1.153 T 4.615 5" />
|
||||||
android:pathData="M206.0,180.3L84.0,180.7L80.0,180.0L76.0,178.0L73.0,175.0L69.7,170.0L68.7,164.0L68.7,49.0L70.0,42.0L71.7,39.0L75.0,35.3L79.0,32.7L82.0,31.7L85.0,31.5L202.0,31.5L207.0,32.5L213.0,36.0L215.3,39.0L217.3,43.0L218.3,48.0L218.3,163.0L218.0,167.0L215.0,174.0L212.0,177.0ZM177.0,212.0L175.0,212.7L52.0,212.7L48.0,212.0L44.0,210.0L41.0,207.0L37.7,202.0L36.7,196.0L36.7,76.0L38.0,72.0L40.0,70.5L44.0,70.5L46.3,72.0L47.5,75.0L47.5,196.0L49.3,200.0L52.0,201.7L55.0,202.3L175.0,202.3L178.0,203.7L179.3,206.0L179.0,210.0ZM129.5,139.0L131.0,138.7L135.0,136.3L173.0,111.7L175.5,109.0L176.3,106.0L175.3,103.0L173.0,100.7L160.0,92.0L156.0,90.0L132.0,74.0L127.0,73.3L124.0,75.0L122.3,79.0L122.3,134.0L125.0,138.0L127.0,139.0Z" />
|
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
<!-- Material Symbols Light "encrypted" by Google, Apache License 2.0 -->
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="256"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="256">
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FFFFFFFF"
|
android:fillColor="#FFFFFFFF"
|
||||||
android:fillType="evenOdd"
|
android:pathData="M 10.98 14.5 h 2.04 l -.556 -3.09 q .442 -.154 .73 -.543 T 13.48 10 q 0 -.613 -.434 -1.047 q -.433 -.434 -1.047 -.434 t -1.047 .434 T 10.519 10 q 0 .479 .288 .867 t .73 .542 z M 12 20.962 q -3.014 -.895 -5.007 -3.651 T 5 11.1 V 5.692 l 7 -2.615 l 7 2.615 V 11.1 q 0 3.454 -1.993 6.21 T 12 20.963" />
|
||||||
android:pathData="M128.0,242.3L124.0,241.5L112.0,236.0L111.0,236.0L110.0,235.0L109.0,235.0L108.0,234.0L107.0,234.0L102.0,231.0L99.0,230.0L86.0,222.0L79.0,217.0L68.0,208.0L58.3,198.0L49.7,187.0L42.7,176.0L37.7,166.0L34.7,159.0L30.7,147.0L28.3,136.0L27.7,135.0L27.3,131.0L26.7,130.0L25.3,118.0L24.7,116.0L23.5,95.0L23.7,79.0L25.0,62.0L26.0,58.0L28.0,54.0L30.7,50.0L35.0,45.7L41.0,41.7L43.0,41.3L46.0,39.7L105.0,20.3L108.0,18.7L114.0,16.7L122.0,14.7L127.0,14.3L133.0,14.7L140.0,16.5L164.0,25.0L211.0,40.5L218.0,44.0L224.3,50.0L227.0,54.0L229.3,59.0L229.7,62.0L230.3,63.0L231.5,83.0L231.3,102.0L230.5,114.0L228.5,129.0L226.0,141.0L221.0,157.0L219.0,161.0L217.0,167.0L216.0,168.0L216.0,169.0L215.0,170.0L210.0,180.0L204.0,189.0L196.0,198.7L188.0,207.0L178.0,215.3L167.0,223.3L155.0,230.3L141.0,237.3L139.0,237.7L134.0,240.3ZM128.5,225.0L139.0,220.5L151.0,214.3L161.0,208.0L170.0,201.3L185.0,187.0L191.3,179.0L198.0,169.0L199.0,166.0L200.0,165.0L203.0,159.0L203.0,158.0L207.0,149.0L209.0,141.0L210.0,139.0L212.0,130.0L214.5,113.0L215.5,98.0L215.5,83.0L214.3,65.0L213.7,63.0L211.0,59.0L209.0,57.5L204.0,55.0L185.0,49.0L133.0,31.0L127.0,30.3L123.0,30.7L87.0,42.7L84.0,44.3L49.0,55.7L46.0,57.3L43.0,60.0L40.5,66.0L39.5,83.0L39.5,98.0L40.7,115.0L41.3,117.0L41.7,122.0L43.7,133.0L44.3,134.0L44.7,138.0L47.3,145.0L47.7,148.0L51.7,158.0L57.7,170.0L64.3,180.0L70.0,187.0L81.0,198.0L91.0,206.0L105.0,215.0L106.0,215.0L110.0,217.5L127.0,225.5Z" />
|
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@@ -1,14 +1,10 @@
|
|||||||
|
<!-- Material Symbols Light "policy" by Google, Apache License 2.0 -->
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="256"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="256">
|
android:viewportHeight="24">
|
||||||
<path
|
|
||||||
android:pathData="M128,38 L58,67 L58,120 C58,165 90,200 128,217 C166,200 198,165 198,120 L198,67 Z"
|
|
||||||
android:strokeColor="#FFFFFFFF"
|
|
||||||
android:strokeWidth="11"
|
|
||||||
android:strokeLineJoin="round" />
|
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FFFFFFFF"
|
android:fillColor="#FFFFFFFF"
|
||||||
android:pathData="M127.5,86.0 L135.8,111.6 L162.7,111.6 L140.9,127.4 L149.2,152.9 L127.5,137.1 L105.8,152.9 L114.1,127.4 L92.3,111.6 L119.2,111.6 Z" />
|
android:pathData="M 12 20.962 q -3.014 -.895 -5.007 -3.651 T 5 11.1 V 5.692 l 7 -2.615 l 7 2.615 V 11.1 q 0 1.498 -.422 2.88 t -1.14 2.674 l -2.95 -2.95 q .237 -.379 .375 -.814 Q 15 12.454 15 12 q 0 -1.246 -.877 -2.123 T 12 9 t -2.123 .877 T 9 12 t .877 2.123 T 12 15 q .487 0 .941 -.147 q .455 -.147 .828 -.441 l 3.071 3.065 q -1.011 1.167 -2.18 2.11 T 12 20.962 M 12 14 q -.825 0 -1.412 -.587 T 10 12 t .588 -1.412 T 12 10 t 1.413 .588 T 14 12 t -.587 1.413 T 12 14" />
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
<!-- Material Symbols Light "verified-user" by Google, Apache License 2.0 -->
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="256"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="256">
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FFFFFFFF"
|
android:fillColor="#FFFFFFFF"
|
||||||
android:fillType="evenOdd"
|
android:pathData="M 10.95 14.858 L 15.908 9.9 l -.714 -.713 l -4.244 4.244 l -2.138 -2.139 l -.714 .714 z M 12 20.96 q -3.013 -.894 -5.007 -3.65 T 5 11.1 V 5.692 l 7 -2.615 l 7 2.615 V 11.1 q 0 3.454 -1.993 6.21 T 12 20.963" />
|
||||||
android:pathData="M196.0,182.0L186.0,182.0L174.0,180.0L157.0,174.0L152.0,171.0L145.3,165.0L140.7,159.0L133.7,147.0L130.0,143.0L128.0,142.7L125.0,143.3L122.0,146.0L113.0,161.0L106.7,168.0L101.0,172.3L87.0,178.3L84.0,178.7L80.0,180.3L76.0,180.7L75.0,181.3L65.0,182.3L58.0,182.0L46.0,180.0L29.0,174.0L27.5,172.0L24.7,164.0L24.3,161.0L22.7,157.0L20.7,147.0L19.5,137.0L19.7,118.0L19.0,117.0L14.0,117.0L13.7,116.0L21.3,86.0L22.0,85.3L27.0,85.0L28.0,82.0L30.0,80.7L56.0,77.3L57.0,76.7L58.0,77.0L76.0,75.3L78.0,74.7L89.0,74.3L94.0,73.7L123.0,72.7L153.0,73.3L176.0,74.7L206.0,78.0L227.0,81.5L227.7,84.0L228.5,85.0L233.0,85.3L233.7,86.0L241.3,116.0L241.0,117.0L234.0,117.0L233.5,118.0L234.0,131.0L233.3,142.0L231.0,157.0L228.0,171.0L227.0,173.3L220.0,176.3L218.0,176.7L215.0,178.3L212.0,178.7L208.0,180.3L204.0,180.7L203.0,181.3ZM198.0,173.0L207.0,171.3L216.0,168.3L219.0,166.7L220.3,164.0L224.0,144.0L225.0,126.0L223.3,106.0L220.0,90.0L219.0,89.0L198.0,86.0L173.0,83.5L131.0,81.7L109.0,82.0L107.0,85.0L103.0,95.0L97.0,113.0L96.0,118.0L94.0,124.0L89.5,147.0L87.7,168.0L88.0,168.3L91.0,166.7L93.0,166.3L98.0,163.3L104.0,158.0L113.0,143.0L115.0,141.0L116.0,139.0L118.3,137.0L122.0,134.7L128.0,133.7L134.0,135.0L138.0,138.0L144.3,147.0L149.7,156.0L155.0,162.0L158.0,164.0L169.0,169.0L179.0,172.0L190.0,173.5ZM56.3,172.0L59.0,151.0L63.0,131.0L63.0,129.0L69.0,105.0L75.3,86.0L75.5,85.0L75.0,84.3L64.0,85.3L63.0,86.0L58.5,96.0L54.5,107.0L49.0,127.0L45.5,148.0L44.0,169.0L45.0,170.3L51.0,172.0L55.0,172.7ZM35.3,164.0L36.7,146.0L40.0,126.0L45.0,107.0L50.0,93.0L52.0,89.0L52.0,86.7L50.0,87.3L38.0,88.7L35.0,90.0L31.0,104.0L28.5,120.0L28.5,137.0L29.7,146.0L32.7,159.0L35.0,165.0Z" />
|
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
<!-- Material Symbols Light "refresh" by Google, Apache License 2.0 -->
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="256"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="256">
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FFFFFFFF"
|
android:fillColor="#FFFFFFFF"
|
||||||
android:fillType="evenOdd"
|
android:pathData="M 12.077 19 q -2.931 0 -4.966 -2.033 q -2.034 -2.034 -2.034 -4.964 t 2.034 -4.966 T 12.077 5 q 1.783 0 3.339 .847 q 1.555 .847 2.507 2.365 V 5 h 1 v 5.23 h -5.23 v -1 h 3.7 q -.782 -1.495 -2.198 -2.363 T 12.077 6 q -2.5 0 -4.25 1.75 T 6.077 12 t 1.75 4.25 t 4.25 1.75 q 1.925 0 3.475 -1.1 t 2.175 -2.9 h 1.062 q -.662 2.246 -2.514 3.623 T 12.077 19" />
|
||||||
android:pathData="M139.0,212.3L138.3,211.0L138.3,202.0L139.0,201.3L149.0,198.3L161.0,192.3L169.0,186.3L176.3,179.0L183.0,170.0L188.5,158.0L190.5,150.0L191.5,141.0L191.3,131.0L189.3,120.0L187.3,114.0L184.3,108.0L181.3,103.0L175.0,95.0L170.0,90.0L165.0,86.0L159.0,82.0L155.0,80.0L154.0,80.0L153.0,79.0L146.0,76.7L135.0,74.5L122.0,74.5L121.7,75.0L137.7,91.0L130.0,98.5L100.3,69.0L130.0,39.3L131.0,39.7L137.3,46.0L137.0,47.0L121.0,63.0L122.0,63.5L135.0,63.7L148.0,66.0L157.0,69.0L158.0,70.0L159.0,70.0L163.0,72.0L171.0,77.0L176.0,81.0L185.0,90.0L187.3,93.0L190.3,97.0L196.3,108.0L200.3,120.0L202.3,137.0L201.5,149.0L198.5,162.0L192.0,176.0L184.0,187.0L173.0,197.3L164.0,203.3L151.0,209.3L148.0,209.7L144.0,211.3L140.0,211.7ZM116.0,211.7L107.0,210.0L98.0,207.0L88.0,202.0L81.0,197.0L71.7,188.0L64.7,179.0L58.7,168.0L58.3,166.0L55.7,160.0L53.7,151.0L52.7,139.0L53.5,128.0L55.7,118.0L58.0,111.0L63.0,101.0L69.0,92.0L75.0,85.5L82.5,93.0L76.0,100.0L72.0,106.0L68.0,114.0L66.0,120.0L64.5,126.0L63.5,136.0L63.7,145.0L65.7,156.0L68.7,164.0L74.3,174.0L79.0,180.0L87.0,188.0L94.0,193.0L102.0,197.0L109.0,199.5L116.0,201.0L116.7,202.0L116.7,211.0Z" />
|
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
<!-- Material Symbols Light "search" by Google, Apache License 2.0 -->
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="256"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="256">
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FFFFFFFF"
|
android:fillColor="#FFFFFFFF"
|
||||||
android:fillType="evenOdd"
|
android:pathData="m 19.485 20.154 l -6.262 -6.262 q -.75 .639 -1.725 .989 t -1.96 .35 q -2.402 0 -4.066 -1.663 T 3.808 9.503 T 5.47 5.436 t 4.064 -1.667 t 4.068 1.664 T 15.268 9.5 q 0 1.042 -.369 2.017 t -.97 1.668 l 6.262 6.261 z M 9.539 14.23 q 1.99 0 3.36 -1.37 t 1.37 -3.361 t -1.37 -3.36 t -3.36 -1.37 t -3.361 1.37 t -1.37 3.36 t 1.37 3.36 t 3.36 1.37" />
|
||||||
android:pathData="M208.0,214.0L207.0,214.0L141.0,148.0L140.0,148.0L131.0,154.3L122.0,158.3L116.0,159.7L115.0,160.3L112.0,160.7L111.0,161.3L99.0,162.0L89.0,161.0L76.0,157.0L67.0,152.0L63.0,149.0L56.7,143.0L52.3,138.0L47.7,131.0L42.7,120.0L40.7,111.0L40.3,96.0L41.0,89.0L44.5,77.0L48.0,70.0L52.0,64.0L59.0,56.3L64.0,52.0L70.0,48.0L78.0,43.7L89.0,40.7L97.0,39.7L104.0,39.7L115.0,41.0L125.0,44.0L136.0,50.0L141.0,54.0L148.0,61.0L154.3,70.0L158.3,78.0L161.3,88.0L162.3,96.0L162.3,105.0L160.0,118.0L154.0,132.0L148.3,140.0L214.0,206.0L214.7,207.0L214.0,208.0ZM106.0,151.0L116.0,149.3L124.0,146.3L130.0,142.7L135.0,138.7L142.0,131.0L146.5,124.0L150.0,115.0L151.5,106.0L151.3,93.0L149.3,84.0L144.3,74.0L140.0,68.0L134.0,62.0L130.0,59.0L121.0,54.0L113.0,51.5L106.0,50.5L94.0,50.7L85.0,52.7L76.0,56.7L66.0,64.3L60.0,71.0L54.0,82.0L52.0,89.0L50.7,100.0L51.7,112.0L52.3,113.0L53.7,119.0L59.7,130.0L69.0,140.0L73.0,143.0L80.0,147.0L85.0,149.0L91.0,150.5L99.0,151.3Z" />
|
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportWidth="256"
|
|
||||||
android:viewportHeight="256">
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFFFF"
|
|
||||||
android:fillType="evenOdd"
|
|
||||||
android:pathData="M127.0,223.0L116.0,219.0L108.0,215.0L107.0,214.0L106.0,214.0L92.0,204.0L82.0,194.0L74.7,185.0L68.7,176.0L63.7,167.0L57.7,152.0L57.3,149.0L55.7,145.0L53.7,133.0L52.7,119.0L52.7,61.0L54.0,59.7L56.0,59.3L59.0,57.7L64.0,56.3L67.0,54.7L72.0,53.3L75.0,51.7L80.0,50.3L83.0,48.7L88.0,47.3L91.0,45.7L96.0,44.3L99.0,42.7L104.0,41.3L107.0,39.7L112.0,38.3L126.0,32.7L128.0,32.5L202.0,60.0L202.3,118.0L201.0,135.0L199.0,145.0L195.0,158.0L191.0,167.0L188.0,172.0L188.0,173.0L181.0,184.0L179.0,186.0L146.0,153.5L137.0,158.3L132.0,159.3L121.0,159.0L116.0,157.5L111.0,155.0L107.0,152.0L103.0,148.0L100.7,145.0L98.0,140.0L95.7,131.0L95.7,124.0L97.5,116.0L100.0,111.0L103.0,107.0L107.0,103.0L110.0,100.7L115.0,98.0L124.0,95.7L131.0,95.7L139.0,97.5L144.0,100.0L148.0,103.0L154.3,110.0L157.0,115.0L158.3,119.0L159.3,124.0L159.3,132.0L157.0,140.0L154.3,146.0L177.0,168.7L178.0,169.0L182.0,161.0L182.0,160.0L183.0,159.0L187.0,148.0L189.0,141.0L190.5,133.0L191.5,121.0L191.5,68.0L191.0,67.3L127.0,43.7L124.0,45.3L108.0,50.7L105.0,52.3L100.0,53.7L97.0,55.3L92.0,56.7L89.0,58.3L84.0,59.7L78.0,62.3L73.0,63.7L70.0,65.3L65.0,66.7L63.5,68.0L63.5,121.0L64.7,135.0L65.3,136.0L65.7,140.0L67.3,145.0L67.7,148.0L69.7,154.0L71.3,157.0L71.7,159.0L76.7,169.0L83.3,179.0L90.7,188.0L100.0,197.0L110.0,204.0L122.0,210.0L128.0,211.7L132.0,210.3L141.0,206.3L153.0,198.5L159.5,206.0L159.0,207.0L146.0,215.3L136.0,220.3ZM133.5,148.0L136.0,147.3L139.7,145.0L145.5,139.0L148.5,132.0L148.3,122.0L147.3,119.0L145.5,116.0L144.0,114.0L139.0,109.5L132.0,106.5L122.0,106.7L119.0,107.7L116.0,109.5L114.0,111.0L109.5,116.0L106.5,123.0L106.7,133.0L107.7,136.0L109.5,139.0L111.0,141.0L116.0,145.5L123.0,148.5L129.0,148.7Z" />
|
|
||||||
</vector>
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<!-- Material Symbols Light "speed" by Google, Apache License 2.0 -->
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFFFF"
|
||||||
|
android:pathData="M 10.758 15.192 q .452 .452 1.18 .415 q .73 -.038 1.078 -.515 l 5.253 -7.323 l -7.361 5.216 q -.496 .334 -.559 1.035 t .409 1.172 M 5.1 19 q -.28 0 -.512 -.141 q -.232 -.142 -.392 -.386 q -.592 -1.021 -.894 -2.158 T 3 14 q 0 -1.864 .71 -3.506 q .711 -1.642 1.927 -2.857 Q 6.852 6.42 8.494 5.71 T 12 5 q 1.858 0 3.485 .698 t 2.852 1.901 t 1.938 2.817 t .72 3.472 q .005 1.24 -.294 2.409 t -.903 2.253 q -.14 .244 -.382 .347 q -.241 .103 -.522 .103 z" />
|
||||||
|
</vector>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<!-- Material Symbols Light "swap-horizontal-circle" by Google, Apache License 2.0 -->
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFFFF"
|
||||||
|
android:pathData="m 9.692 17.308 l .708 -.708 l -2.089 -2.1 H 13 v -1 H 8.312 l 2.088 -2.1 l -.708 -.708 L 6.385 14 z m 4.616 -4 L 17.616 10 l -3.308 -3.308 l -.708 .708 l 2.089 2.1 H 11 v 1 h 4.689 L 13.6 12.6 z M 12.003 21 q -1.866 0 -3.51 -.708 q -1.643 -.709 -2.859 -1.924 t -1.925 -2.856 T 3 12.003 t .709 -3.51 Q 4.417 6.85 5.63 5.634 t 2.857 -1.925 T 11.997 3 t 3.51 .709 q 1.643 .708 2.859 1.922 t 1.925 2.857 t .709 3.509 t -.708 3.51 t -1.924 2.859 t -2.856 1.925 t -3.509 .709" />
|
||||||
|
</vector>
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
|
<!-- Material Symbols Light "apps" by Google, Apache License 2.0 -->
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="256"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="256">
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FFFFFFFF"
|
android:fillColor="#FFFFFFFF"
|
||||||
android:fillType="evenOdd"
|
android:pathData="M 6 19.23 q -.508 0 -.87 -.36 T 4.77 18 t .36 -.87 t .87 -.36 t .87 .36 t .36 .87 t -.36 .87 t -.87 .36 m 6 0 q -.508 0 -.87 -.36 t -.36 -.87 t .36 -.87 t .87 -.36 t .87 .36 t .36 .87 t -.36 .87 t -.87 .36 m 6 0 q -.508 0 -.87 -.36 t -.36 -.87 t .36 -.87 t .87 -.36 t .87 .36 t .36 .87 t -.36 .87 t -.87 .36 m -12 -6 q -.508 0 -.87 -.36 T 4.77 12 t .36 -.87 t .87 -.36 t .87 .36 t .36 .87 t -.36 .87 t -.87 .36 m 6 0 q -.508 0 -.87 -.36 t -.36 -.87 t .36 -.87 t .87 -.36 t .87 .36 t .36 .87 t -.36 .87 t -.87 .36 m 6 0 q -.508 0 -.87 -.36 t -.36 -.87 t .36 -.87 t .87 -.36 t .87 .36 t .36 .87 t -.36 .87 t -.87 .36 m -12 -6 q -.508 0 -.87 -.36 T 4.77 6 t .36 -.87 t .87 -.36 t .87 .36 t .36 .87 t -.36 .87 t -.87 .36 m 6 0 q -.508 0 -.87 -.36 T 10.77 6 t .36 -.87 t .87 -.36 t .87 .36 t .36 .87 t -.36 .87 t -.87 .36 m 6 0 q -.508 0 -.87 -.36 T 16.77 6 t .36 -.87 t .87 -.36 t .87 .36 t .36 .87 t -.36 .87 t -.87 .36" />
|
||||||
android:pathData="M67.0,76.3L61.0,76.5L57.0,75.0L52.7,71.0L50.7,67.0L50.5,61.0L52.0,57.0L56.0,52.7L60.0,50.7L66.0,50.5L70.0,52.0L74.3,56.0L76.3,60.0L76.5,66.0L75.0,70.0L71.0,74.3ZM131.0,76.3L125.0,76.5L121.0,75.0L116.7,71.0L114.7,67.0L114.5,61.0L116.0,57.0L120.0,52.7L124.0,50.7L130.0,50.5L134.0,52.0L138.3,56.0L140.3,60.0L140.5,66.0L139.0,70.0L135.0,74.3ZM195.0,76.3L189.0,76.5L185.0,75.0L180.7,71.0L178.7,67.0L178.5,61.0L180.0,57.0L184.0,52.7L188.0,50.7L194.0,50.5L198.0,52.0L202.3,56.0L204.3,60.0L204.5,66.0L203.0,70.0L199.0,74.3ZM67.0,140.3L61.0,140.5L57.0,139.0L52.7,135.0L50.7,131.0L50.5,125.0L52.0,121.0L56.0,116.7L60.0,114.7L66.0,114.5L70.0,116.0L74.3,120.0L76.3,124.0L76.5,130.0L75.0,134.0L71.0,138.3ZM131.0,140.3L125.0,140.5L121.0,139.0L116.7,135.0L114.7,131.0L114.5,125.0L116.0,121.0L120.0,116.7L124.0,114.7L130.0,114.5L134.0,116.0L138.3,120.0L140.3,124.0L140.5,130.0L139.0,134.0L135.0,138.3ZM195.0,140.3L189.0,140.5L185.0,139.0L180.7,135.0L178.7,131.0L178.5,125.0L180.0,121.0L184.0,116.7L188.0,114.7L194.0,114.5L198.0,116.0L202.3,120.0L204.3,124.0L204.5,130.0L203.0,134.0L199.0,138.3ZM67.0,204.3L61.0,204.5L57.0,203.0L52.7,199.0L50.7,195.0L50.5,189.0L52.0,185.0L56.0,180.7L60.0,178.7L66.0,178.5L70.0,180.0L74.3,184.0L76.3,188.0L76.5,194.0L75.0,198.0L71.0,202.3ZM131.0,204.3L125.0,204.5L121.0,203.0L116.7,199.0L114.7,195.0L114.5,189.0L116.0,185.0L120.0,180.7L124.0,178.7L130.0,178.5L134.0,180.0L138.3,184.0L140.3,188.0L140.5,194.0L139.0,198.0L135.0,202.3ZM195.0,204.3L189.0,204.5L185.0,203.0L180.7,199.0L178.7,195.0L178.5,189.0L180.0,185.0L184.0,180.7L188.0,178.7L194.0,178.5L198.0,180.0L202.3,184.0L204.3,188.0L204.5,194.0L203.0,198.0L199.0,202.3Z" />
|
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
<!-- Material Symbols Light "do-not-disturb-on" by Google, Apache License 2.0 -->
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="256"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="256">
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FFFFFFFF"
|
android:fillColor="#FFFFFFFF"
|
||||||
android:fillType="evenOdd"
|
android:pathData="M 7.5 12.5 h 9 v -1 h -9 z m 4.503 8.5 q -1.866 0 -3.51 -.708 q -1.643 -.709 -2.859 -1.924 t -1.925 -2.856 T 3 12.003 t .709 -3.51 Q 4.417 6.85 5.63 5.634 t 2.857 -1.925 T 11.997 3 t 3.51 .709 q 1.643 .708 2.859 1.922 t 1.925 2.857 t .709 3.509 t -.708 3.51 t -1.924 2.859 t -2.856 1.925 t -3.509 .709" />
|
||||||
android:pathData="M137.0,223.0L130.0,223.5L117.0,223.0L105.0,221.0L98.0,219.0L90.0,216.0L80.0,211.0L68.0,203.0L60.0,196.0L53.7,189.0L47.7,181.0L43.5,174.0L37.7,162.0L34.7,153.0L31.7,135.0L31.5,125.0L32.0,117.0L34.0,105.0L36.0,98.0L39.0,90.0L44.0,80.0L52.0,68.0L59.0,60.0L66.0,53.7L74.0,47.7L81.0,43.5L93.0,37.7L102.0,34.7L120.0,31.7L130.0,31.5L138.0,32.0L150.0,34.0L157.0,36.0L165.0,39.0L175.0,44.0L187.0,52.0L195.0,59.0L201.3,66.0L207.3,74.0L211.5,81.0L217.3,93.0L220.3,102.0L223.3,120.0L223.5,130.0L223.0,138.0L221.0,150.0L219.0,157.0L216.0,165.0L211.0,175.0L203.0,187.0L196.0,195.0L189.0,201.3L181.0,207.3L174.0,211.5L162.0,217.3L153.0,220.3ZM192.0,183.0L194.0,181.0L201.0,171.0L207.0,159.0L210.0,150.0L212.0,140.0L212.7,132.0L212.7,123.0L211.3,110.0L207.3,96.0L203.7,88.0L199.5,81.0L191.0,70.0L182.0,61.3L175.0,56.0L169.0,52.5L160.0,48.0L153.0,45.7L144.0,43.5L136.0,42.5L119.0,42.5L106.0,44.7L94.0,48.7L86.0,52.7L77.0,58.7L73.0,62.0L71.7,64.0L191.0,183.3ZM139.0,212.0L149.0,210.3L158.0,207.3L165.0,204.3L175.0,198.3L182.0,193.0L183.3,191.0L64.0,71.7L63.0,72.0L58.0,78.0L54.0,84.0L54.0,85.0L53.0,86.0L49.0,94.0L44.7,107.0L42.5,119.0L42.5,136.0L43.7,145.0L47.7,159.0L51.3,167.0L59.0,179.0L64.0,185.0L73.0,193.7L80.0,199.0L85.0,202.0L95.0,207.0L102.0,209.3L111.0,211.5L123.0,212.7L132.0,212.7Z" />
|
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
<!-- Material Symbols Light "shield" by Google, Apache License 2.0 -->
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="256"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="256">
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FFFFFFFF"
|
android:fillColor="#FFFFFFFF"
|
||||||
android:fillType="evenOdd"
|
android:pathData="M 12 20.962 q -3.014 -.895 -5.007 -3.651 T 5 11.1 V 5.692 l 7 -2.615 l 7 2.615 V 11.1 q 0 3.454 -1.993 6.21 T 12 20.963" />
|
||||||
android:pathData="M128.0,242.3L124.0,241.5L112.0,236.0L111.0,236.0L110.0,235.0L109.0,235.0L108.0,234.0L107.0,234.0L102.0,231.0L99.0,230.0L86.0,222.0L79.0,217.0L68.0,208.0L58.3,198.0L49.7,187.0L42.7,176.0L37.7,166.0L34.7,159.0L30.7,147.0L28.3,136.0L27.7,135.0L27.3,131.0L26.7,130.0L25.3,118.0L24.7,116.0L23.5,95.0L23.7,79.0L25.0,62.0L26.0,58.0L28.0,54.0L30.7,50.0L35.0,45.7L41.0,41.7L43.0,41.3L46.0,39.7L105.0,20.3L108.0,18.7L114.0,16.7L122.0,14.7L127.0,14.3L133.0,14.7L140.0,16.5L164.0,25.0L211.0,40.5L218.0,44.0L224.3,50.0L227.0,54.0L229.3,59.0L229.7,62.0L230.3,63.0L231.5,83.0L231.3,102.0L230.5,114.0L228.5,129.0L226.0,141.0L221.0,157.0L219.0,161.0L217.0,167.0L216.0,168.0L216.0,169.0L215.0,170.0L210.0,180.0L204.0,189.0L196.0,198.7L188.0,207.0L178.0,215.3L167.0,223.3L155.0,230.3L141.0,237.3L139.0,237.7L134.0,240.3ZM128.5,225.0L139.0,220.5L151.0,214.3L161.0,208.0L170.0,201.3L185.0,187.0L191.3,179.0L198.0,169.0L199.0,166.0L200.0,165.0L203.0,159.0L203.0,158.0L207.0,149.0L209.0,141.0L210.0,139.0L212.0,130.0L214.5,113.0L215.5,98.0L215.5,83.0L214.3,65.0L213.7,63.0L211.0,59.0L209.0,57.5L204.0,55.0L185.0,49.0L133.0,31.0L127.0,30.3L123.0,30.7L87.0,42.7L84.0,44.3L49.0,55.7L46.0,57.3L43.0,60.0L40.5,66.0L39.5,83.0L39.5,98.0L40.7,115.0L41.3,117.0L41.7,122.0L43.7,133.0L44.3,134.0L44.7,138.0L47.3,145.0L47.7,148.0L51.7,158.0L57.7,170.0L64.3,180.0L70.0,187.0L81.0,198.0L91.0,206.0L105.0,215.0L106.0,215.0L110.0,217.5L127.0,225.5Z" />
|
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
<!-- Material Symbols Light "info" by Google, Apache License 2.0 -->
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="256"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="256">
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FFFFFFFF"
|
android:fillColor="#FFFFFFFF"
|
||||||
android:fillType="evenOdd"
|
android:pathData="M 11.5 16.5 h 1 V 11 h -1 z m .5 -6.923 q .262 0 .439 -.177 t .176 -.439 t -.177 -.438 T 12 8.346 t -.438 .177 t -.177 .439 t .177 .438 t .438 .177 M 12.003 21 q -1.867 0 -3.51 -.708 q -1.643 -.709 -2.859 -1.924 t -1.925 -2.856 T 3 12.003 t .709 -3.51 Q 4.417 6.85 5.63 5.634 t 2.857 -1.925 T 11.997 3 t 3.51 .709 q 1.643 .708 2.859 1.922 t 1.925 2.857 t .709 3.509 t -.708 3.51 t -1.924 2.859 t -2.856 1.925 t -3.509 .709" />
|
||||||
android:pathData="M131.0,74.0L127.0,74.3L122.0,73.3L120.0,72.3L115.7,69.0L112.5,64.0L111.7,61.0L111.5,57.0L112.7,52.0L115.0,48.0L118.0,45.0L122.0,43.0L129.0,42.3L132.0,42.7L134.0,43.5L138.0,46.0L140.0,48.0L142.5,52.0L143.5,57.0L143.3,62.0L141.0,67.0L136.0,72.0ZM138.0,212.5L118.0,212.7L116.7,212.0L116.7,105.0L117.0,104.0L118.0,103.7L137.0,103.7L138.0,104.0L138.3,105.0Z" />
|
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
<!-- Material Symbols Light "analytics" by Google, Apache License 2.0 -->
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="256"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="256">
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FFFFFFFF"
|
android:fillColor="#FFFFFFFF"
|
||||||
android:fillType="evenOdd"
|
android:pathData="M 7.73 16.5 h 1 V 12 h -1 z m 7.54 0 h 1 V 7 h -1 z m -3.77 0 h 1 V 14 h -1 z m 0 -4.5 h 1 v -2 h -1 z m -5.884 8 q -.691 0 -1.153 -.462 T 4 18.384 V 5.616 q 0 -.691 .463 -1.153 T 5.616 4 h 12.769 q .69 0 1.153 .463 T 20 5.616 v 12.769 q 0 .69 -.462 1.153 T 18.384 20 z" />
|
||||||
android:pathData="M223.0,128.7L214.0,128.7L212.7,128.0L212.7,69.0L211.0,66.0L209.0,64.0L206.0,63.5L47.0,63.7L45.0,65.0L42.5,68.0L42.3,96.0L41.0,96.7L32.0,96.7L31.5,96.0L31.5,69.0L32.5,64.0L36.0,58.0L39.0,55.7L43.0,53.7L48.0,52.7L206.0,52.7L213.0,54.0L216.0,55.7L219.7,59.0L222.3,63.0L223.3,66.0L223.5,128.0ZM76.0,175.3L74.0,175.5L71.0,174.7L68.7,172.0L49.3,133.0L32.0,132.7L31.5,132.0L31.5,123.0L32.0,122.3L53.0,122.3L56.0,123.3L59.5,129.0L74.0,157.7L75.0,157.0L76.0,154.0L77.0,153.0L77.0,152.0L79.0,149.0L79.0,148.0L80.0,147.0L80.0,146.0L81.0,145.0L81.0,144.0L82.0,143.0L82.0,142.0L83.0,141.0L83.0,140.0L84.0,139.0L84.0,138.0L85.0,137.0L85.0,136.0L86.0,135.0L86.0,134.0L87.0,133.0L88.0,130.0L89.0,129.0L89.0,128.0L90.0,127.0L90.0,126.0L91.0,125.0L91.0,124.0L92.0,123.0L92.0,122.0L93.0,121.0L93.0,120.0L94.0,119.0L94.0,118.0L95.0,117.0L96.0,114.0L97.0,113.0L97.0,112.0L98.0,111.0L99.0,108.0L100.0,107.0L100.0,106.0L101.0,105.0L102.0,102.0L103.0,101.0L103.0,100.0L104.0,99.0L104.0,98.0L105.0,97.0L106.0,94.0L107.0,93.0L107.0,92.0L109.0,89.0L109.0,88.0L110.0,87.0L110.0,86.0L111.0,85.0L111.0,84.0L114.0,80.7L117.0,80.0L119.0,80.5L121.0,82.0L122.3,84.0L142.3,124.0L142.0,125.0L135.0,130.7L134.0,131.3L133.7,131.0L117.3,98.0L117.0,97.5L116.0,98.0L78.5,173.0ZM187.0,223.0L180.0,223.5L171.0,222.5L166.0,221.0L155.0,215.0L149.7,210.0L144.7,204.0L140.7,196.0L139.3,190.0L138.7,189.0L138.3,179.0L139.0,172.0L141.0,165.0L145.0,157.0L148.0,154.0L150.0,151.0L158.0,144.7L166.0,140.7L173.0,138.7L183.0,138.3L190.0,139.0L197.0,141.0L205.0,145.5L212.3,152.0L217.0,158.0L220.3,164.0L222.7,172.0L223.5,180.0L223.0,188.0L221.0,196.0L217.0,204.0L209.0,213.0L203.0,217.3L195.0,221.3ZM116.0,202.0L49.0,202.3L42.0,201.0L40.0,200.0L35.3,196.0L32.7,192.0L31.7,189.0L31.5,159.0L32.0,158.3L41.0,158.3L42.3,159.0L42.3,186.0L44.0,189.0L46.0,191.0L49.0,191.5L113.0,191.5L113.7,192.0L114.3,194.0ZM183.3,184.0L203.3,164.0L198.0,158.5L177.3,179.0L182.0,183.7L183.0,184.3Z" />
|
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@@ -1,17 +1,10 @@
|
|||||||
|
<!-- Material Symbols Light "settings" by Google, Apache License 2.0 -->
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="24">
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#FFFFFFFF"
|
||||||
android:pathData="M4,7h9M17,7h3M4,17h3M11,17h9"
|
android:pathData="m 10.135 21 l -.362 -2.892 q -.479 -.145 -1.035 -.454 q -.557 -.31 -.947 -.664 l -2.668 1.135 l -1.865 -3.25 l 2.306 -1.739 q -.045 -.27 -.073 -.558 q -.03 -.288 -.03 -.559 q 0 -.252 .03 -.53 q .028 -.278 .073 -.626 L 3.258 9.126 l 1.865 -3.212 L 7.771 7.03 q .448 -.373 .97 -.673 q .52 -.3 1.013 -.464 L 10.134 3 h 3.732 l .361 2.912 q .575 .202 1.016 .463 t .909 .654 l 2.725 -1.115 l 1.865 3.211 l -2.382 1.796 q .082 .31 .092 .569 t .01 .51 q 0 .233 -.02 .491 q -.019 .259 -.088 .626 l 2.344 1.758 l -1.865 3.25 l -2.681 -1.154 q -.467 .393 -.94 .673 t -.985 .445 L 13.866 21 z m 1.838 -6.5 q 1.046 0 1.773 -.727 T 14.473 12 t -.727 -1.773 t -1.773 -.727 q -1.052 0 -1.776 .727 T 9.473 12 t .724 1.773 t 1.776 .727" />
|
||||||
android:strokeWidth="1.9"
|
|
||||||
android:strokeColor="#FFFFFFFF"
|
|
||||||
android:strokeLineCap="round" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M13,7a2,2 0,1 0,4 0a2,2 0,1 0,-4 0zM7,17a2,2 0,1 0,4 0a2,2 0,1 0,-4 0z"
|
|
||||||
android:strokeWidth="1.9"
|
|
||||||
android:strokeColor="#FFFFFFFF" />
|
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<!-- Material Symbols Light "update" by Google, Apache License 2.0 -->
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFFFF"
|
||||||
|
android:pathData="M 12.02 20 q -1.664 0 -3.119 -.626 T 6.359 17.66 t -1.714 -2.542 T 4.02 12 t .626 -3.118 T 6.36 6.34 T 8.9 4.626 T 12.019 4 q 1.723 0 3.282 .712 q 1.559 .711 2.718 1.984 V 4.308 h 1 v 4.154 h -4.153 v -1 h 2.48 q -1.044 -1.15 -2.41 -1.806 Q 13.572 5 12.02 5 Q 9.094 5 7.057 7.038 T 5.019 12 t 2.038 4.963 T 12.019 19 q 2.625 0 4.569 -1.71 t 2.35 -4.29 h 1.012 q -.356 3.021 -2.62 5.01 Q 15.066 20 12.02 20 m 3.146 -4.146 l -3.647 -3.646 V 7 h 1 v 4.792 l 3.354 3.354 z" />
|
||||||
|
</vector>
|
||||||
@@ -96,14 +96,12 @@
|
|||||||
<string name="period_24h">24 Stunden</string>
|
<string name="period_24h">24 Stunden</string>
|
||||||
<string name="period_7d">7 Tage</string>
|
<string name="period_7d">7 Tage</string>
|
||||||
<string name="home_lists_info">Aktive Listen: %1$d · Regeln: %2$s</string>
|
<string name="home_lists_info">Aktive Listen: %1$d · Regeln: %2$s</string>
|
||||||
<string name="blocking_off">Blockieren ist aus</string>
|
|
||||||
<string name="blocklist_title">DNS-Blocklisten</string>
|
<string name="blocklist_title">DNS-Blocklisten</string>
|
||||||
<string name="tab_activity">Aktivität</string>
|
<string name="tab_activity">Aktivität</string>
|
||||||
<string name="tab_settings">Einstellungen</string>
|
<string name="tab_settings">Einstellungen</string>
|
||||||
<string name="companies_title">Anteil der Konzerne</string>
|
<string name="companies_title">Anteil der Konzerne</string>
|
||||||
<string name="companies_desc">Welcher Anteil deiner Anfragen an die größten Konzerne geht.</string>
|
<string name="companies_desc">Welcher Anteil deiner Anfragen an die größten Konzerne und andere Websites geht.</string>
|
||||||
<string name="companies_other">Andere</string>
|
<string name="companies_other">Andere</string>
|
||||||
<string name="no_data">Noch keine Daten</string>
|
|
||||||
<string name="recent_title">Letzte Anfragen</string>
|
<string name="recent_title">Letzte Anfragen</string>
|
||||||
<string name="filter">Filter</string>
|
<string name="filter">Filter</string>
|
||||||
<string name="bl_search">Listen suchen</string>
|
<string name="bl_search">Listen suchen</string>
|
||||||
@@ -126,4 +124,11 @@
|
|||||||
<string name="settings_general">Allgemein</string>
|
<string name="settings_general">Allgemein</string>
|
||||||
<string name="settings_apps">Apps ohne SparkleDNS</string>
|
<string name="settings_apps">Apps ohne SparkleDNS</string>
|
||||||
<string name="settings_apps_desc">Ausgewählte Apps nutzen das normale DNS des Netzwerks</string>
|
<string name="settings_apps_desc">Ausgewählte Apps nutzen das normale DNS des Netzwerks</string>
|
||||||
|
<string name="chart_empty">Noch keine Daten. Nach dem Verbinden füllt sich das Diagramm Stunde für Stunde.</string>
|
||||||
|
<string name="companies_wait">Daten werden gesammelt: %1$d von %2$d Anfragen</string>
|
||||||
|
<string name="blocklist_cta_lists">Keine Liste ist aktiv. Schalte HaGeZi Pro ein, um Werbung und Tracker zu blockieren.</string>
|
||||||
|
<string name="blocklist_cta_master">Blockieren ist aus. Schalte es ein, um Werbung und Tracker zu filtern.</string>
|
||||||
|
<string name="turn_on">Einschalten</string>
|
||||||
|
<string name="downloading">Wird geladen…</string>
|
||||||
|
<string name="change_server">Server wechseln</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -96,14 +96,12 @@
|
|||||||
<string name="period_24h">24 時間</string>
|
<string name="period_24h">24 時間</string>
|
||||||
<string name="period_7d">7 日間</string>
|
<string name="period_7d">7 日間</string>
|
||||||
<string name="home_lists_info">有効なリスト: %1$d · ルール: %2$s</string>
|
<string name="home_lists_info">有効なリスト: %1$d · ルール: %2$s</string>
|
||||||
<string name="blocking_off">ブロックはオフです</string>
|
|
||||||
<string name="blocklist_title">DNS ブロックリスト</string>
|
<string name="blocklist_title">DNS ブロックリスト</string>
|
||||||
<string name="tab_activity">アクティビティ</string>
|
<string name="tab_activity">アクティビティ</string>
|
||||||
<string name="tab_settings">設定</string>
|
<string name="tab_settings">設定</string>
|
||||||
<string name="companies_title">企業の占有率</string>
|
<string name="companies_title">企業の占有率</string>
|
||||||
<string name="companies_desc">リクエストのうち大手企業に送られる割合です。</string>
|
<string name="companies_desc">リクエストのうち大手企業やその他のサイトに送られる割合です。</string>
|
||||||
<string name="companies_other">その他</string>
|
<string name="companies_other">その他</string>
|
||||||
<string name="no_data">まだデータがありません</string>
|
|
||||||
<string name="recent_title">最近のアクティビティ</string>
|
<string name="recent_title">最近のアクティビティ</string>
|
||||||
<string name="filter">フィルター</string>
|
<string name="filter">フィルター</string>
|
||||||
<string name="bl_search">リストを検索</string>
|
<string name="bl_search">リストを検索</string>
|
||||||
@@ -126,4 +124,11 @@
|
|||||||
<string name="settings_general">一般</string>
|
<string name="settings_general">一般</string>
|
||||||
<string name="settings_apps">SparkleDNS を使わないアプリ</string>
|
<string name="settings_apps">SparkleDNS を使わないアプリ</string>
|
||||||
<string name="settings_apps_desc">選んだアプリはネットワークの通常の DNS を使います</string>
|
<string name="settings_apps_desc">選んだアプリはネットワークの通常の DNS を使います</string>
|
||||||
|
<string name="chart_empty">まだデータがありません。接続すると 1 時間ごとにグラフが埋まっていきます。</string>
|
||||||
|
<string name="companies_wait">データ収集中: %2$d 件中 %1$d 件</string>
|
||||||
|
<string name="blocklist_cta_lists">有効なリストがありません。HaGeZi Pro をオンにして広告とトラッカーをブロックしましょう。</string>
|
||||||
|
<string name="blocklist_cta_master">ブロックはオフです。オンにすると広告とトラッカーをフィルタリングします。</string>
|
||||||
|
<string name="turn_on">オンにする</string>
|
||||||
|
<string name="downloading">ダウンロード中…</string>
|
||||||
|
<string name="change_server">サーバーを変更</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -96,14 +96,12 @@
|
|||||||
<string name="period_24h">24 valandos</string>
|
<string name="period_24h">24 valandos</string>
|
||||||
<string name="period_7d">7 dienos</string>
|
<string name="period_7d">7 dienos</string>
|
||||||
<string name="home_lists_info">Įjungta sąrašų: %1$d · taisyklių: %2$s</string>
|
<string name="home_lists_info">Įjungta sąrašų: %1$d · taisyklių: %2$s</string>
|
||||||
<string name="blocking_off">Blokavimas išjungtas</string>
|
|
||||||
<string name="blocklist_title">DNS blokavimo sąrašai</string>
|
<string name="blocklist_title">DNS blokavimo sąrašai</string>
|
||||||
<string name="tab_activity">Veikla</string>
|
<string name="tab_activity">Veikla</string>
|
||||||
<string name="tab_settings">Nustatymai</string>
|
<string name="tab_settings">Nustatymai</string>
|
||||||
<string name="companies_title">Įmonių dalis</string>
|
<string name="companies_title">Įmonių dalis</string>
|
||||||
<string name="companies_desc">Kokia jūsų užklausų dalis tenka didžiausioms įmonėms.</string>
|
<string name="companies_desc">Kokia jūsų užklausų dalis tenka didžiausioms įmonėms ir kitoms svetainėms.</string>
|
||||||
<string name="companies_other">Kitos</string>
|
<string name="companies_other">Kitos</string>
|
||||||
<string name="no_data">Duomenų dar nėra</string>
|
|
||||||
<string name="recent_title">Naujausios užklausos</string>
|
<string name="recent_title">Naujausios užklausos</string>
|
||||||
<string name="filter">Filtras</string>
|
<string name="filter">Filtras</string>
|
||||||
<string name="bl_search">Ieškoti sąrašų</string>
|
<string name="bl_search">Ieškoti sąrašų</string>
|
||||||
@@ -126,4 +124,11 @@
|
|||||||
<string name="settings_general">Bendrieji</string>
|
<string name="settings_general">Bendrieji</string>
|
||||||
<string name="settings_apps">Programėlės be SparkleDNS</string>
|
<string name="settings_apps">Programėlės be SparkleDNS</string>
|
||||||
<string name="settings_apps_desc">Pasirinktos programėlės naudoja įprastą tinklo DNS</string>
|
<string name="settings_apps_desc">Pasirinktos programėlės naudoja įprastą tinklo DNS</string>
|
||||||
|
<string name="chart_empty">Duomenų dar nėra. Prisijungus grafikas pildysis kas valandą.</string>
|
||||||
|
<string name="companies_wait">Renkami duomenys: %1$d iš %2$d užklausų</string>
|
||||||
|
<string name="blocklist_cta_lists">Neįjungtas nė vienas sąrašas. Įjunkite HaGeZi Pro, kad blokuotumėte reklamas ir sekiklius.</string>
|
||||||
|
<string name="blocklist_cta_master">Blokavimas išjungtas. Įjunkite jį, kad filtruotumėte reklamas ir sekiklius.</string>
|
||||||
|
<string name="turn_on">Įjungti</string>
|
||||||
|
<string name="downloading">Atsisiunčiama…</string>
|
||||||
|
<string name="change_server">Keisti serverį</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -96,14 +96,12 @@
|
|||||||
<string name="period_24h">24 часа</string>
|
<string name="period_24h">24 часа</string>
|
||||||
<string name="period_7d">7 дней</string>
|
<string name="period_7d">7 дней</string>
|
||||||
<string name="home_lists_info">Включено списков: %1$d · правил: %2$s</string>
|
<string name="home_lists_info">Включено списков: %1$d · правил: %2$s</string>
|
||||||
<string name="blocking_off">Блокировка выключена</string>
|
|
||||||
<string name="blocklist_title">Блок-листы DNS</string>
|
<string name="blocklist_title">Блок-листы DNS</string>
|
||||||
<string name="tab_activity">Активность</string>
|
<string name="tab_activity">Активность</string>
|
||||||
<string name="tab_settings">Настройки</string>
|
<string name="tab_settings">Настройки</string>
|
||||||
<string name="companies_title">Доля компаний</string>
|
<string name="companies_title">Доля компаний</string>
|
||||||
<string name="companies_desc">Какая часть ваших запросов уходит крупнейшим компаниям.</string>
|
<string name="companies_desc">Какая часть ваших запросов уходит крупнейшим компаниям и другим сайтам.</string>
|
||||||
<string name="companies_other">Другие</string>
|
<string name="companies_other">Другие</string>
|
||||||
<string name="no_data">Данных пока нет</string>
|
|
||||||
<string name="recent_title">Последние запросы</string>
|
<string name="recent_title">Последние запросы</string>
|
||||||
<string name="filter">Фильтр</string>
|
<string name="filter">Фильтр</string>
|
||||||
<string name="bl_search">Поиск списков</string>
|
<string name="bl_search">Поиск списков</string>
|
||||||
@@ -126,4 +124,11 @@
|
|||||||
<string name="settings_general">Общие</string>
|
<string name="settings_general">Общие</string>
|
||||||
<string name="settings_apps">Приложения без SparkleDNS</string>
|
<string name="settings_apps">Приложения без SparkleDNS</string>
|
||||||
<string name="settings_apps_desc">Выбранные приложения используют обычный DNS сети</string>
|
<string name="settings_apps_desc">Выбранные приложения используют обычный DNS сети</string>
|
||||||
|
<string name="chart_empty">Данных пока нет. После подключения график будет заполняться по часам.</string>
|
||||||
|
<string name="companies_wait">Собираем данные: %1$d из %2$d запросов</string>
|
||||||
|
<string name="blocklist_cta_lists">Ни один список не включён. Включите HaGeZi Pro, чтобы блокировать рекламу и трекеры.</string>
|
||||||
|
<string name="blocklist_cta_master">Блокировка выключена. Включите её, чтобы фильтровать рекламу и трекеры.</string>
|
||||||
|
<string name="turn_on">Включить</string>
|
||||||
|
<string name="downloading">Загрузка…</string>
|
||||||
|
<string name="change_server">Сменить сервер</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -96,14 +96,12 @@
|
|||||||
<string name="period_24h">24 小时</string>
|
<string name="period_24h">24 小时</string>
|
||||||
<string name="period_7d">7 天</string>
|
<string name="period_7d">7 天</string>
|
||||||
<string name="home_lists_info">已启用列表:%1$d · 规则:%2$s</string>
|
<string name="home_lists_info">已启用列表:%1$d · 规则:%2$s</string>
|
||||||
<string name="blocking_off">屏蔽已关闭</string>
|
|
||||||
<string name="blocklist_title">DNS 屏蔽列表</string>
|
<string name="blocklist_title">DNS 屏蔽列表</string>
|
||||||
<string name="tab_activity">活动</string>
|
<string name="tab_activity">活动</string>
|
||||||
<string name="tab_settings">设置</string>
|
<string name="tab_settings">设置</string>
|
||||||
<string name="companies_title">公司占比</string>
|
<string name="companies_title">公司占比</string>
|
||||||
<string name="companies_desc">你的请求中发往大公司的比例。</string>
|
<string name="companies_desc">你的请求中发往大公司和其他网站的比例。</string>
|
||||||
<string name="companies_other">其他</string>
|
<string name="companies_other">其他</string>
|
||||||
<string name="no_data">暂无数据</string>
|
|
||||||
<string name="recent_title">最近活动</string>
|
<string name="recent_title">最近活动</string>
|
||||||
<string name="filter">筛选</string>
|
<string name="filter">筛选</string>
|
||||||
<string name="bl_search">搜索列表</string>
|
<string name="bl_search">搜索列表</string>
|
||||||
@@ -126,4 +124,11 @@
|
|||||||
<string name="settings_general">通用</string>
|
<string name="settings_general">通用</string>
|
||||||
<string name="settings_apps">不使用 SparkleDNS 的应用</string>
|
<string name="settings_apps">不使用 SparkleDNS 的应用</string>
|
||||||
<string name="settings_apps_desc">选中的应用使用网络的常规 DNS</string>
|
<string name="settings_apps_desc">选中的应用使用网络的常规 DNS</string>
|
||||||
|
<string name="chart_empty">暂无数据。连接后,图表会按小时逐步填充。</string>
|
||||||
|
<string name="companies_wait">正在收集数据:%1$d / %2$d 个请求</string>
|
||||||
|
<string name="blocklist_cta_lists">没有启用任何列表。开启 HaGeZi Pro 以屏蔽广告和跟踪器。</string>
|
||||||
|
<string name="blocklist_cta_master">屏蔽已关闭。开启后即可过滤广告和跟踪器。</string>
|
||||||
|
<string name="turn_on">开启</string>
|
||||||
|
<string name="downloading">正在下载…</string>
|
||||||
|
<string name="change_server">更换服务器</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -97,14 +97,12 @@
|
|||||||
<string name="period_24h">24 hours</string>
|
<string name="period_24h">24 hours</string>
|
||||||
<string name="period_7d">7 days</string>
|
<string name="period_7d">7 days</string>
|
||||||
<string name="home_lists_info">Lists on: %1$d · rules: %2$s</string>
|
<string name="home_lists_info">Lists on: %1$d · rules: %2$s</string>
|
||||||
<string name="blocking_off">Blocking is off</string>
|
|
||||||
<string name="blocklist_title">DNS Blocklist</string>
|
<string name="blocklist_title">DNS Blocklist</string>
|
||||||
<string name="tab_activity">Activity</string>
|
<string name="tab_activity">Activity</string>
|
||||||
<string name="tab_settings">Settings</string>
|
<string name="tab_settings">Settings</string>
|
||||||
<string name="companies_title">Company dominance</string>
|
<string name="companies_title">Company dominance</string>
|
||||||
<string name="companies_desc">Share of your requests that go to the biggest companies.</string>
|
<string name="companies_desc">Share of your requests that go to the biggest companies and other sites.</string>
|
||||||
<string name="companies_other">Other</string>
|
<string name="companies_other">Other</string>
|
||||||
<string name="no_data">No data yet</string>
|
|
||||||
<string name="recent_title">Recent activity</string>
|
<string name="recent_title">Recent activity</string>
|
||||||
<string name="filter">Filter</string>
|
<string name="filter">Filter</string>
|
||||||
<string name="bl_search">Search lists</string>
|
<string name="bl_search">Search lists</string>
|
||||||
@@ -127,4 +125,11 @@
|
|||||||
<string name="settings_general">General</string>
|
<string name="settings_general">General</string>
|
||||||
<string name="settings_apps">Apps without SparkleDNS</string>
|
<string name="settings_apps">Apps without SparkleDNS</string>
|
||||||
<string name="settings_apps_desc">Picked apps use the regular DNS of the network</string>
|
<string name="settings_apps_desc">Picked apps use the regular DNS of the network</string>
|
||||||
|
<string name="chart_empty">No data yet. Connect, and the chart fills in hour by hour.</string>
|
||||||
|
<string name="companies_wait">Collecting data: %1$d of %2$d requests</string>
|
||||||
|
<string name="blocklist_cta_lists">No lists are on. Turn on HaGeZi Pro to block ads and trackers.</string>
|
||||||
|
<string name="blocklist_cta_master">Blocking is off. Turn it on to filter ads and trackers.</string>
|
||||||
|
<string name="turn_on">Turn on</string>
|
||||||
|
<string name="downloading">Downloading…</string>
|
||||||
|
<string name="change_server">Change server</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -24,6 +24,15 @@ class BlocklistMatchTest {
|
|||||||
assertFalse(isBlockedIn("ads.example.com", LongArray(0), LongArray(0)))
|
assertFalse(isBlockedIn("ads.example.com", LongArray(0), LongArray(0)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun skipsTrailingDots() {
|
||||||
|
val lists = set("example.com")
|
||||||
|
|
||||||
|
assertTrue(isBlockedIn("www.example.com..", lists, LongArray(0)))
|
||||||
|
assertFalse(isBlockedIn("example.org.", lists, LongArray(0)))
|
||||||
|
assertFalse(isBlockedIn("...", lists, LongArray(0)))
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun mergesSortedListsWithoutDuplicates() {
|
fun mergesSortedListsWithoutDuplicates() {
|
||||||
val a = longArrayOf(-5, 1, 4, 9)
|
val a = longArrayOf(-5, 1, 4, 9)
|
||||||
|
|||||||
@@ -49,5 +49,6 @@ class BlocklistParserTest {
|
|||||||
val name = "a.b.example.com"
|
val name = "a.b.example.com"
|
||||||
assertEquals(DomainHash.of("example.com"), DomainHash.of(name, name.indexOf("example")))
|
assertEquals(DomainHash.of("example.com"), DomainHash.of(name, name.indexOf("example")))
|
||||||
assertEquals(DomainHash.of(name), DomainHash.of(name, 0))
|
assertEquals(DomainHash.of(name), DomainHash.of(name, 0))
|
||||||
|
assertEquals(DomainHash.of("b.example"), DomainHash.of(name, 2, name.indexOf(".com")))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package cc.skysparkle.sparkledns
|
||||||
|
|
||||||
|
import org.junit.Assert.assertEquals
|
||||||
|
import org.junit.Assert.assertNull
|
||||||
|
import org.junit.Test
|
||||||
|
|
||||||
|
class CompaniesTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun matchesDomainsAndTheirSubdomains() {
|
||||||
|
assertEquals(Company.GOOGLE, Companies.of("youtube.com"))
|
||||||
|
assertEquals(Company.GOOGLE, Companies.of("r3---sn-abc.googlevideo.com"))
|
||||||
|
assertEquals(Company.META, Companies.of("scontent.cdninstagram.com"))
|
||||||
|
assertEquals(Company.X, Companies.of("t.co"))
|
||||||
|
assertEquals(Company.MICROSOFT, Companies.of("api.github.com"))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun ignoresCaseAndTrailingDots() {
|
||||||
|
assertEquals(Company.APPLE, Companies.of("WWW.Apple.COM"))
|
||||||
|
assertEquals(Company.AMAZON, Companies.of("s3.amazonaws.com."))
|
||||||
|
assertEquals(Company.AMAZON, Companies.of("s3.amazonaws.com.."))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun knowsGoogleCountrySites() {
|
||||||
|
assertEquals(Company.GOOGLE, Companies.of("google.de"))
|
||||||
|
assertEquals(Company.GOOGLE, Companies.of("www.google.co.uk"))
|
||||||
|
assertEquals(Company.GOOGLE, Companies.of("google.com.br"))
|
||||||
|
assertNull(Companies.of("google.example.org"))
|
||||||
|
assertNull(Companies.of("google."))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun leavesOtherDomainsAlone() {
|
||||||
|
assertNull(Companies.of("example.com"))
|
||||||
|
assertNull(Companies.of("notyoutube.com"))
|
||||||
|
assertNull(Companies.of("youtube.com.example"))
|
||||||
|
assertNull(Companies.of("com"))
|
||||||
|
assertNull(Companies.of(""))
|
||||||
|
assertNull(Companies.of("."))
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,126 @@
|
|||||||
|
package cc.skysparkle.sparkledns
|
||||||
|
|
||||||
|
import org.junit.Assert.assertArrayEquals
|
||||||
|
import org.junit.Assert.assertEquals
|
||||||
|
import org.junit.Assert.assertNull
|
||||||
|
import org.junit.Test
|
||||||
|
import java.io.ByteArrayInputStream
|
||||||
|
import java.io.ByteArrayOutputStream
|
||||||
|
import java.io.DataInputStream
|
||||||
|
import java.io.DataOutputStream
|
||||||
|
|
||||||
|
class HourlyCountersTest {
|
||||||
|
|
||||||
|
private val hours = HourlyCounters.HOURS
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun countsQueriesPerHour() {
|
||||||
|
val counters = HourlyCounters()
|
||||||
|
counters.record(QueryStatus.OK, 40, Company.GOOGLE, hour = 100)
|
||||||
|
counters.record(QueryStatus.OK, 20, null, hour = 100)
|
||||||
|
counters.record(QueryStatus.BLOCKED, 0, Company.META, hour = 100)
|
||||||
|
counters.record(QueryStatus.CACHED, 0, null, hour = 99)
|
||||||
|
counters.record(QueryStatus.FAILED, 5000, null, hour = 99)
|
||||||
|
|
||||||
|
val day = counters.summary(24, currentHour = 100)
|
||||||
|
assertEquals(5L, day.total)
|
||||||
|
assertEquals(1L, day.blocked)
|
||||||
|
assertEquals(1L, day.cached)
|
||||||
|
assertEquals(30, day.avgLatencyMs)
|
||||||
|
assertEquals(1L, day.companies[Company.GOOGLE.ordinal])
|
||||||
|
assertEquals(1L, day.companies[Company.META.ordinal])
|
||||||
|
assertEquals(3L, counters.summary(1, currentHour = 100).total)
|
||||||
|
|
||||||
|
val points = counters.hourly(3, currentHour = 100)
|
||||||
|
assertEquals(listOf(0L, 2L, 3L), points.map { it.total })
|
||||||
|
assertEquals(listOf(0L, 0L, 1L), points.map { it.blocked })
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun aSlotStartsOverAWeekLater() {
|
||||||
|
val counters = HourlyCounters()
|
||||||
|
counters.record(QueryStatus.OK, 10, null, hour = 5)
|
||||||
|
counters.record(QueryStatus.OK, 10, null, hour = 5L + hours)
|
||||||
|
|
||||||
|
assertEquals(1L, counters.summary(hours, currentHour = 5L + hours).total)
|
||||||
|
assertEquals(0L, counters.summary(1, currentHour = 5).total)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun savedNumbersReadBackUnchanged() {
|
||||||
|
val counters = HourlyCounters()
|
||||||
|
counters.record(QueryStatus.BLOCKED, 0, Company.XIAOMI, hour = 1000)
|
||||||
|
counters.record(QueryStatus.OK, 12, Company.APPLE, hour = 1001)
|
||||||
|
|
||||||
|
val copy = requireNotNull(HourlyCounters.decode(counters.encode()))
|
||||||
|
|
||||||
|
assertArrayEquals(counters.hourIds, copy.hourIds)
|
||||||
|
for (index in 0 until hours) assertArrayEquals(counters.rows[index], copy.rows[index])
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun writesFormatOne() {
|
||||||
|
val bytes = HourlyCounters().encode()
|
||||||
|
val input = DataInputStream(ByteArrayInputStream(bytes))
|
||||||
|
|
||||||
|
assertEquals(1, input.readInt())
|
||||||
|
assertEquals(HourlyCounters.FIELDS, input.readInt())
|
||||||
|
assertEquals(hours, input.readInt())
|
||||||
|
assertEquals(-1L, input.readLong())
|
||||||
|
assertEquals(12 + hours * (HourlyCounters.FIELDS + 1) * 8, bytes.size)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun readsFilesFromVersionsWithFewerCompanies() {
|
||||||
|
// A file from a version that knew two companies: field n of hour 7 holds n + 1
|
||||||
|
val fields = HourlyCounters.FIRST_COMPANY + 2
|
||||||
|
val bytes = ByteArrayOutputStream()
|
||||||
|
DataOutputStream(bytes).use { out ->
|
||||||
|
out.writeInt(1)
|
||||||
|
out.writeInt(fields)
|
||||||
|
out.writeInt(hours)
|
||||||
|
for (index in 0 until hours) {
|
||||||
|
out.writeLong(if (index == 7) 7L else -1L)
|
||||||
|
for (field in 0 until fields) out.writeLong(if (index == 7) field + 1L else 0L)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val summary = requireNotNull(HourlyCounters.decode(bytes.toByteArray())).summary(1, currentHour = 7)
|
||||||
|
|
||||||
|
assertEquals(1L, summary.total)
|
||||||
|
assertEquals(2L, summary.blocked)
|
||||||
|
assertEquals(3L, summary.cached)
|
||||||
|
assertEquals(0, summary.avgLatencyMs) // latency sum 4, count 5
|
||||||
|
assertArrayEquals(longArrayOf(6, 7) + LongArray(Company.entries.size - 2), summary.companies)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun refusesOtherFormats() {
|
||||||
|
val bytes = HourlyCounters().encode()
|
||||||
|
bytes[3] = 2
|
||||||
|
|
||||||
|
assertNull(HourlyCounters.decode(bytes))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun mergeKeepsWhatWasCountedBeforeTheFileWasRead() {
|
||||||
|
val saved = HourlyCounters()
|
||||||
|
saved.record(QueryStatus.OK, 10, null, hour = 50)
|
||||||
|
saved.record(QueryStatus.OK, 10, null, hour = 49)
|
||||||
|
|
||||||
|
val live = HourlyCounters()
|
||||||
|
live.record(QueryStatus.BLOCKED, 0, null, hour = 50)
|
||||||
|
live.merge(saved)
|
||||||
|
|
||||||
|
assertEquals(2L, live.summary(1, currentHour = 50).total)
|
||||||
|
assertEquals(1L, live.summary(1, currentHour = 50).blocked)
|
||||||
|
assertEquals(3L, live.summary(2, currentHour = 50).total)
|
||||||
|
|
||||||
|
// A slot already holding a newer hour keeps it
|
||||||
|
val later = HourlyCounters()
|
||||||
|
later.record(QueryStatus.OK, 10, null, hour = 50L + hours)
|
||||||
|
later.merge(saved)
|
||||||
|
|
||||||
|
assertEquals(1L, later.summary(1, currentHour = 50L + hours).total)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,8 +18,8 @@ class PacketTest {
|
|||||||
val parsed = requireNotNull(Packet.parseDnsQuery(packet, packet.size))
|
val parsed = requireNotNull(Packet.parseDnsQuery(packet, packet.size))
|
||||||
|
|
||||||
assertArrayEquals(query, parsed.payload)
|
assertArrayEquals(query, parsed.payload)
|
||||||
assertArrayEquals(client, parsed.srcIp)
|
assertEquals(i32(client, 0), parsed.srcIp)
|
||||||
assertArrayEquals(server, parsed.dstIp)
|
assertEquals(i32(server, 0), parsed.dstIp)
|
||||||
assertEquals(40000, parsed.srcPort)
|
assertEquals(40000, parsed.srcPort)
|
||||||
assertEquals(53, parsed.dstPort)
|
assertEquals(53, parsed.dstPort)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package cc.skysparkle.sparkledns
|
||||||
|
|
||||||
|
import org.junit.Assert.assertEquals
|
||||||
|
import org.junit.Assert.assertNotSame
|
||||||
|
import org.junit.Assert.assertSame
|
||||||
|
import org.junit.Test
|
||||||
|
|
||||||
|
// The screens refresh once a second; a refresh that brings the same object has nothing to update
|
||||||
|
class RefreshTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun logSnapshotIsReusedUntilTheLogChanges() {
|
||||||
|
QueryLog.clear()
|
||||||
|
val empty = QueryLog.snapshot()
|
||||||
|
assertSame(empty, QueryLog.snapshot())
|
||||||
|
|
||||||
|
QueryLog.add(DnsMessage.Question("example.com", 1), QueryStatus.OK, 10)
|
||||||
|
QueryLog.add(DnsMessage.Question("example.org", 28), QueryStatus.CACHED, 0)
|
||||||
|
val filled = QueryLog.snapshot()
|
||||||
|
|
||||||
|
assertNotSame(empty, filled)
|
||||||
|
assertEquals(listOf("example.org", "example.com"), filled.map { it.domain })
|
||||||
|
assertSame(filled, QueryLog.snapshot())
|
||||||
|
|
||||||
|
QueryLog.clear()
|
||||||
|
assertEquals(0, QueryLog.snapshot().size)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun summaryIsReusedUntilSomethingChanges() {
|
||||||
|
val now = 1_000 * 3_600_000L
|
||||||
|
val first = StatsStore.summary(24, now)
|
||||||
|
assertSame(first, StatsStore.summary(24, now))
|
||||||
|
assertNotSame(first, StatsStore.summary(24 * 7, now))
|
||||||
|
|
||||||
|
StatsStore.record(QueryStatus.OK, 5, null, now)
|
||||||
|
val after = StatsStore.summary(24, now)
|
||||||
|
|
||||||
|
assertNotSame(first, after)
|
||||||
|
assertEquals(first.total + 1, after.total)
|
||||||
|
assertSame(after, StatsStore.summary(24, now))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Before Width: | Height: | Size: 143 KiB |
|
After Width: | Height: | Size: 302 KiB |
|
After Width: | Height: | Size: 504 KiB |
|
Before Width: | Height: | Size: 132 KiB |
|
Before Width: | Height: | Size: 205 KiB After Width: | Height: | Size: 667 KiB |
|
After Width: | Height: | Size: 519 KiB |
|
Before Width: | Height: | Size: 158 KiB |
@@ -1,6 +1,6 @@
|
|||||||
• DNS funktioniert weiter, wenn ein unerwartetes Paket ankommt; fällt der Tunnel aus, schaltet sich das VPN ab, statt DNS still zu blockieren
|
• DNS läuft bei unerwarteten Paketen weiter; fällt der Tunnel aus, schaltet sich das VPN ab, statt DNS still zu blockieren
|
||||||
• Anfragen erholen sich schneller nach einem Wechsel zwischen WLAN und Mobilfunk und in langsamen Netzen
|
• Anfragen erholen sich schneller nach einem WLAN-Mobilfunk-Wechsel und in langsamen Netzen
|
||||||
• Weniger Arbeit im Hintergrund: ausgeblendete Bildschirme werden nicht mehr aktualisiert
|
• Weniger Hintergrundarbeit: ausgeblendete Bildschirme werden nicht mehr aktualisiert
|
||||||
• Blocklisten werden nur noch erneut geladen, wenn sie sich geändert haben
|
• Blocklisten werden nur bei Änderungen neu geladen
|
||||||
• Schärfere App-Symbole, kleinere App
|
• Schärfere App-Symbole, kleinere App
|
||||||
• Ein Doppeltipp auf „Verbinden“ verbindet nicht mehr doppelt; voller Speicher lässt die App nicht mehr abstürzen
|
• Doppeltipp auf „Verbinden“ verbindet nicht doppelt; voller Speicher führt nicht mehr zum Absturz
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
• Neue gefüllte Symbole (Material Symbols)
|
||||||
|
• Balkendiagramm für 24 Stunden oder 7 Tage, höher auf großen Bildschirmen
|
||||||
|
• Tablets: Inhalt mittig, auf breiten Bildschirmen zweispaltig
|
||||||
|
• Anteile der Konzerne erscheinen, sobald genug Daten da sind
|
||||||
|
• HaGeZi Pro direkt auf dem Startbildschirm einschalten
|
||||||
|
• Tippe auf den Server, um ihn zu wechseln
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
• Quad9 verbindet sich unter Android 14 und neuer jetzt über HTTP/3 (QUIC)
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
• Die letzte Aktivität zeigt eine Zeile pro Domain mit allen abgefragten Typen (A, AAAA, HTTPS) und der Anzahl der Anfragen
|
||||||
|
• Der Anteil der Konzerne nennt jetzt auch andere Websites, statt alle unter Andere zusammenzufassen
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
• New filled icons (Material Symbols)
|
||||||
|
• Bar chart for 24 hours or 7 days, taller on big screens
|
||||||
|
• Tablets: content stays centred, two columns on wide screens
|
||||||
|
• Company shares appear once there is enough data
|
||||||
|
• Turn on HaGeZi Pro right from Home
|
||||||
|
• Tap the server on Home to change it
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
• Quad9 now connects over HTTP/3 (QUIC) on Android 14 and newer
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
• Recent activity shows one row per domain with all requested types (A, AAAA, HTTPS) and the number of queries
|
||||||
|
• Company dominance names other sites instead of grouping them all as Other
|
||||||
|
Before Width: | Height: | Size: 143 KiB After Width: | Height: | Size: 302 KiB |
|
Before Width: | Height: | Size: 132 KiB After Width: | Height: | Size: 504 KiB |
|
Before Width: | Height: | Size: 205 KiB After Width: | Height: | Size: 667 KiB |
|
Before Width: | Height: | Size: 158 KiB After Width: | Height: | Size: 519 KiB |
@@ -0,0 +1,6 @@
|
|||||||
|
• 塗りつぶしの新しいアイコン(Material Symbols)
|
||||||
|
• 24 時間/7 日間の棒グラフ。大きな画面では高く表示
|
||||||
|
• タブレット:コンテンツを中央に、広い画面では 2 列表示
|
||||||
|
• 企業の占有率はデータが十分に集まってから表示
|
||||||
|
• ホームから HaGeZi Pro をすぐにオン
|
||||||
|
• ホームのサーバーをタップして変更
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
• Android 14 以降では Quad9 に HTTP/3(QUIC)で接続
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
• 最近のアクティビティはドメインごとに 1 行で表示し、要求されたすべての種類(A、AAAA、HTTPS)とクエリ数を表示
|
||||||
|
• 企業の占有率で、その他のサイトもまとめずに名前で表示
|
||||||