mirror of
https://github.com/kalarina-bit/Sparkledns.git
synced 2026-11-22 07:36:09 +00:00
Use filled Material Symbols icons
This commit is contained in:
@@ -73,6 +73,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("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("Material Symbols", "Google", APACHE_2, APACHE_2_URL, "https://github.com/google/material-design-icons"),
|
||||
OpenSourceItem(
|
||||
"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",
|
||||
@@ -155,13 +156,13 @@ private fun AboutContent(modifier: Modifier, onOpenLicenses: () -> Unit) {
|
||||
}
|
||||
|
||||
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))
|
||||
Text(stringResource(R.string.about_privacy_policy))
|
||||
}
|
||||
|
||||
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))
|
||||
Text(stringResource(R.string.about_source))
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package cc.skysparkle.sparkledns
|
||||
import android.content.ClipData
|
||||
import android.content.ClipboardManager
|
||||
import android.widget.Toast
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.compose.foundation.Canvas
|
||||
import androidx.compose.foundation.background
|
||||
@@ -203,7 +204,7 @@ fun ActivityScreen(bottomPadding: Dp, modifier: Modifier = Modifier) {
|
||||
enabled = entries.isNotEmpty(),
|
||||
) {
|
||||
Icon(
|
||||
painterResource(R.drawable.ic_delete),
|
||||
painterResource(R.drawable.ic_delete_sweep),
|
||||
contentDescription = stringResource(R.string.mon_clear),
|
||||
tint = Palette.Fg2,
|
||||
modifier = Modifier.size(20.dp),
|
||||
@@ -222,7 +223,7 @@ fun ActivityScreen(bottomPadding: Dp, modifier: Modifier = Modifier) {
|
||||
Box {
|
||||
IconButton(onClick = { filterMenu = true }) {
|
||||
Icon(
|
||||
painterResource(R.drawable.ic_tab_settings),
|
||||
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),
|
||||
@@ -457,6 +458,7 @@ private fun QueryRow(
|
||||
if (blockedByMe) {
|
||||
DropdownMenuItem(
|
||||
text = { Text(stringResource(R.string.mon_unblock)) },
|
||||
leadingIcon = { MenuIcon(R.drawable.ic_check) },
|
||||
onClick = {
|
||||
menu = false
|
||||
onUnblock()
|
||||
@@ -465,6 +467,7 @@ private fun QueryRow(
|
||||
} else if (entry.status != QueryStatus.BLOCKED) {
|
||||
DropdownMenuItem(
|
||||
text = { Text(stringResource(R.string.mon_block)) },
|
||||
leadingIcon = { MenuIcon(R.drawable.ic_tab_block) },
|
||||
onClick = {
|
||||
menu = false
|
||||
onBlock()
|
||||
@@ -473,6 +476,7 @@ private fun QueryRow(
|
||||
}
|
||||
DropdownMenuItem(
|
||||
text = { Text(stringResource(R.string.copy)) },
|
||||
leadingIcon = { MenuIcon(R.drawable.ic_copy) },
|
||||
onClick = {
|
||||
menu = false
|
||||
onCopy()
|
||||
@@ -482,6 +486,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
|
||||
private fun initialOf(domain: String): String {
|
||||
val parts = domain.split('.').filter { it.isNotEmpty() }
|
||||
|
||||
@@ -382,7 +382,7 @@ private fun UpdatesRow(interval: UpdateInterval, wifiOnly: Boolean, onClick: ()
|
||||
.padding(horizontal = 14.dp, vertical = 10.dp),
|
||||
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))
|
||||
Column(Modifier.weight(1f)) {
|
||||
Text(stringResource(R.string.auto_update), color = Palette.Fg, fontSize = 14.sp, fontWeight = FontWeight.Bold)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package cc.skysparkle.sparkledns
|
||||
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.animation.animateColorAsState
|
||||
import androidx.compose.foundation.background
|
||||
@@ -195,7 +196,11 @@ fun SettingsScreen(
|
||||
modifier = Modifier
|
||||
.weight(1f)
|
||||
.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
|
||||
val lastSwitch = remember { arrayOf("") }
|
||||
@@ -214,6 +219,8 @@ fun SettingsScreen(
|
||||
.fillMaxWidth()
|
||||
.height(48.dp),
|
||||
) {
|
||||
Icon(painterResource(R.drawable.ic_swap), contentDescription = null, modifier = Modifier.size(18.dp))
|
||||
Spacer(Modifier.width(8.dp))
|
||||
Text(
|
||||
stringResource(R.string.switch_to, lastSwitch[0]),
|
||||
maxLines = 1,
|
||||
@@ -237,6 +244,7 @@ fun SettingsScreen(
|
||||
SectionLabel(stringResource(R.string.settings_general), Modifier.padding(top = 8.dp))
|
||||
Column(Modifier.fillMaxWidth().appCard()) {
|
||||
NavRow(
|
||||
icon = R.drawable.ic_tab_apps,
|
||||
title = stringResource(R.string.settings_apps),
|
||||
subtitle = if (excludedCount > 0) stringResource(R.string.apps_count, excludedCount)
|
||||
else stringResource(R.string.settings_apps_desc),
|
||||
@@ -244,6 +252,7 @@ fun SettingsScreen(
|
||||
)
|
||||
ListDivider()
|
||||
NavRow(
|
||||
icon = R.drawable.ic_tab_info,
|
||||
title = stringResource(R.string.tab_about),
|
||||
subtitle = "${stringResource(R.string.about_version)} ${BuildConfig.VERSION_NAME}",
|
||||
onClick = onOpenAbout,
|
||||
@@ -322,7 +331,7 @@ private fun ServerRow(
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun NavRow(title: String, subtitle: String, onClick: () -> Unit) {
|
||||
private fun NavRow(@DrawableRes icon: Int, title: String, subtitle: String, onClick: () -> Unit) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
@@ -331,6 +340,8 @@ private fun NavRow(title: String, subtitle: String, onClick: () -> Unit) {
|
||||
.padding(start = 16.dp, end = 12.dp, top = 10.dp, bottom = 10.dp),
|
||||
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)) {
|
||||
Text(title, color = Palette.Fg, fontSize = 15.sp, fontWeight = FontWeight.Bold)
|
||||
Text(subtitle, color = Palette.Fg3, fontSize = 12.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
|
||||
Reference in New Issue
Block a user