mirror of
https://github.com/kalarina-bit/Sparkledns.git
synced 2026-11-22 07:36:09 +00:00
Redesign the app
New look based on the SparkleDNS concept: a dark theme, a floating bottom panel with Home, Activity and Settings, and pages for the blocklists, apps and About. - Home: big ON/OFF switch, the current server, 24-hour stats and chart - Activity: requests, blocked, average time and cache share for 24 hours or 7 days, company dominance, and the live log with search and filter - Blocklists: HaGeZi Pro preset next to Pro++ and TIF, lists can be switched off without deleting them, automatic updates (daily or weekly, optionally Wi-Fi only) through JobScheduler - Settings: server list, custom server, server test and per-app DNS - Hourly numbers for the charts are kept on the device, without domains The server list now ships with the app; it is no longer downloaded from the repository.
This commit is contained in:
@@ -13,6 +13,7 @@ import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.heightIn
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
@@ -238,3 +239,34 @@ fun groupedShape(first: Boolean, last: Boolean, radius: Dp = 16.dp) = RoundedCor
|
||||
|
||||
val groupedBackground: Color
|
||||
@Composable get() = MaterialTheme.colorScheme.surfaceContainerHighest
|
||||
|
||||
// Short numbers for stat tiles: 812, 7.27k, 48.1k, 312k, 1.2M (decimal separator of the locale)
|
||||
fun formatCompact(value: Long): String {
|
||||
val locale = Locale.getDefault()
|
||||
return when {
|
||||
value < 1_000 -> formatCount(value)
|
||||
value < 10_000 -> String.format(locale, "%.2fk", value / 1_000.0)
|
||||
value < 100_000 -> String.format(locale, "%.1fk", value / 1_000.0)
|
||||
value < 1_000_000 -> String.format(locale, "%.0fk", value / 1_000.0)
|
||||
else -> String.format(locale, "%.1fM", value / 1_000_000.0)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun EmptyState(icon: Int, text: String) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(vertical = 40.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
) {
|
||||
IconBadge(icon, MaterialTheme.colorScheme.onSurfaceVariant, size = 64.dp)
|
||||
Spacer(Modifier.height(12.dp))
|
||||
Text(
|
||||
text,
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
textAlign = TextAlign.Center,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user