Skip to content

Commit

Permalink
perf: update material api
Browse files Browse the repository at this point in the history
  • Loading branch information
lisonge committed Jan 30, 2024
1 parent 51f4e8a commit c2710ba
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 67 deletions.
33 changes: 17 additions & 16 deletions app/src/main/kotlin/li/songe/gkd/ui/AboutPage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material3.Divider
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
Expand Down Expand Up @@ -80,7 +80,7 @@ fun AboutPage() {
color = MaterialTheme.colorScheme.primary,
)
}
Divider()
HorizontalDivider()
Column(
modifier = Modifier
.fillMaxWidth()
Expand All @@ -95,7 +95,7 @@ fun AboutPage() {
fontSize = 14.sp,
)
}
Divider()
HorizontalDivider()
Column(
modifier = Modifier
.fillMaxWidth()
Expand All @@ -111,19 +111,20 @@ fun AboutPage() {
)
}
@Suppress("SENSELESS_COMPARISON") if (GIT_COMMIT_URL != null && BuildConfig.GIT_COMMIT_ID != null) {
Divider()
Column(modifier = Modifier
.clickable {
appScope.launchTry {
context.startActivity(
Intent(
Intent.ACTION_VIEW, Uri.parse(GIT_COMMIT_URL)
HorizontalDivider()
Column(
modifier = Modifier
.clickable {
appScope.launchTry {
context.startActivity(
Intent(
Intent.ACTION_VIEW, Uri.parse(GIT_COMMIT_URL)
)
)
)
}
}
}
.fillMaxWidth()
.padding(10.dp)) {
.fillMaxWidth()
.padding(10.dp)) {
Text(
text = "代码记录", fontSize = 18.sp
)
Expand All @@ -135,7 +136,7 @@ fun AboutPage() {
)
}
}
Divider()
HorizontalDivider()
Column(
modifier = Modifier
.fillMaxWidth()
Expand All @@ -150,7 +151,7 @@ fun AboutPage() {
fontSize = 14.sp,
)
}
Divider()
HorizontalDivider()
Column(
modifier = Modifier
.fillMaxWidth()
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/kotlin/li/songe/gkd/ui/ClickLogPage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material.icons.outlined.Delete
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Card
import androidx.compose.material3.Divider
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
Expand Down Expand Up @@ -181,7 +181,7 @@ fun ClickLogPage() {
Text(text = (if (clickLog.ruleKey != null) "key=${clickLog.ruleKey}, " else "") + "index=${clickLog.ruleIndex}")
}
}
Divider()
HorizontalDivider()
}
item {
Spacer(modifier = Modifier.height(10.dp))
Expand Down
14 changes: 7 additions & 7 deletions app/src/main/kotlin/li/songe/gkd/ui/ControlPage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.KeyboardArrowRight
import androidx.compose.material.icons.automirrored.filled.OpenInNew
import androidx.compose.material.icons.filled.Home
import androidx.compose.material3.Divider
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
Expand Down Expand Up @@ -95,15 +95,15 @@ fun ControlPage() {
)
})
}
Divider()
HorizontalDivider()

if (!canNotif) {
AuthCard(title = "通知权限",
desc = "用于显示各类服务状态数据及前后台提示",
onAuthClick = {
checkOrRequestNotifPermission(context)
})
Divider()
HorizontalDivider()
}

if (!canDrawOverlays) {
Expand All @@ -119,7 +119,7 @@ fun ControlPage() {
context.startActivity(intent)
}
})
Divider()
HorizontalDivider()
}

TextSwitch(
Expand All @@ -146,7 +146,7 @@ fun ControlPage() {
ManageService.stop(context)
}
})
Divider()
HorizontalDivider()

Row(
horizontalArrangement = Arrangement.SpaceBetween,
Expand Down Expand Up @@ -176,7 +176,7 @@ fun ControlPage() {
}
Icon(imageVector = Icons.AutoMirrored.Filled.OpenInNew, contentDescription = null)
}
Divider()
HorizontalDivider()

Row(
horizontalArrangement = Arrangement.SpaceBetween,
Expand All @@ -201,7 +201,7 @@ fun ControlPage() {
contentDescription = null
)
}
Divider()
HorizontalDivider()

Column(
modifier = Modifier
Expand Down
22 changes: 11 additions & 11 deletions app/src/main/kotlin/li/songe/gkd/ui/DebugPage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material.icons.filled.Edit
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Divider
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.LocalTextStyle
Expand Down Expand Up @@ -128,7 +128,7 @@ fun DebugPage() {
toast("Shizuku可能没有运行")
}
})
Divider()
HorizontalDivider()
} else {
TextSwitch(name = "Shizuku模式",
desc = "高级运行模式,能更准确识别界面活动ID",
Expand Down Expand Up @@ -157,7 +157,7 @@ fun DebugPage() {
}

})
Divider()
HorizontalDivider()
}

val httpServerRunning by HttpService.isRunning.collectAsState()
Expand Down Expand Up @@ -226,14 +226,14 @@ fun DebugPage() {
}
)
}
Divider()
HorizontalDivider()

SettingItem(
title = "HTTP服务端口-${store.httpServerPort}", imageVector = Icons.Default.Edit
) {
showPortDlg = true
}
Divider()
HorizontalDivider()

TextSwitch(
name = "自动清除内存订阅",
Expand All @@ -246,12 +246,12 @@ fun DebugPage() {
)
)
}
Divider()
HorizontalDivider()

SettingItem(title = "快照记录", onClick = {
navController.navigate(SnapshotPageDestination)
})
Divider()
HorizontalDivider()

val screenshotRunning by ScreenshotService.isRunning.collectAsState()
TextSwitch(
Expand All @@ -274,7 +274,7 @@ fun DebugPage() {
ScreenshotService.stop()
}
})
Divider()
HorizontalDivider()

val floatingRunning by FloatingService.isRunning.collectAsState()
TextSwitch(
Expand All @@ -296,7 +296,7 @@ fun DebugPage() {
FloatingService.stop(context)
}
}
Divider()
HorizontalDivider()
TextSwitch(
name = "音量快照",
desc = "当音量变化时,生成快照,如果悬浮窗按钮不工作,可以使用这个",
Expand All @@ -309,7 +309,7 @@ fun DebugPage() {
)
}

Divider()
HorizontalDivider()
TextSwitch(
name = "截屏快照",
desc = "当用户截屏时保存快照(需手动替换快照图片),仅支持部分小米设备",
Expand All @@ -322,7 +322,7 @@ fun DebugPage() {
)
}

Divider()
HorizontalDivider()
TextSwitch(
name = "隐藏快照状态栏",
desc = "当保存快照时,隐藏截图里的顶部状态栏高度区域",
Expand Down
34 changes: 19 additions & 15 deletions app/src/main/kotlin/li/songe/gkd/ui/SettingsPage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import androidx.compose.foundation.selection.selectable
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.KeyboardArrowRight
import androidx.compose.material.icons.automirrored.filled.KeyboardArrowRight
import androidx.compose.material.icons.filled.Settings
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Card
import androidx.compose.material3.Divider
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.LinearProgressIndicator
import androidx.compose.material3.OutlinedTextField
Expand Down Expand Up @@ -111,7 +111,7 @@ fun SettingsPage() {
)
)
})
Divider()
HorizontalDivider()

TextSwitch(name = "前台悬浮窗",
desc = "添加透明悬浮窗,关闭可能导致不点击/点击缓慢",
Expand All @@ -123,7 +123,7 @@ fun SettingsPage() {
)
)
})
Divider()
HorizontalDivider()

TextSwitch(name = "点击提示",
desc = "触发点击时提示:[${store.clickToast}]",
Expand All @@ -142,7 +142,7 @@ fun SettingsPage() {
)
)
})
Divider()
HorizontalDivider()

Row(modifier = Modifier
.clickable {
Expand All @@ -160,11 +160,12 @@ fun SettingsPage() {
?: store.updateSubsInterval.toString(), fontSize = 14.sp
)
Icon(
imageVector = Icons.Default.KeyboardArrowRight, contentDescription = "more"
imageVector = Icons.AutoMirrored.Filled.KeyboardArrowRight,
contentDescription = "more"
)
}
}
Divider()
HorizontalDivider()

TextSwitch(name = "自动更新应用",
desc = "打开应用时自动检测是否存在新版本",
Expand All @@ -176,7 +177,7 @@ fun SettingsPage() {
)
)
})
Divider()
HorizontalDivider()

SettingItem(title = if (checkUpdating) "检查更新ing" else "检查更新", onClick = {
appScope.launchTry {
Expand All @@ -187,7 +188,7 @@ fun SettingsPage() {
}
}
})
Divider()
HorizontalDivider()

Row(modifier = Modifier
.clickable {
Expand All @@ -205,11 +206,12 @@ fun SettingsPage() {
?: store.enableDarkTheme.toString(), fontSize = 14.sp
)
Icon(
imageVector = Icons.Default.KeyboardArrowRight, contentDescription = "more"
imageVector = Icons.AutoMirrored.Filled.KeyboardArrowRight,
contentDescription = "more"
)
}
}
Divider()
HorizontalDivider()

TextSwitch(name = "保存日志",
desc = "保存最近7天的日志,大概占用您5M的空间",
Expand All @@ -232,7 +234,7 @@ fun SettingsPage() {
}
}
})
Divider()
HorizontalDivider()

SettingItem(title = "分享日志", onClick = {
vm.viewModelScope.launchTry(Dispatchers.IO) {
Expand All @@ -244,12 +246,12 @@ fun SettingsPage() {
}
}
})
Divider()
HorizontalDivider()

SettingItem(title = "高级模式", onClick = {
navController.navigate(DebugPageDestination)
})
Divider()
HorizontalDivider()

SettingItem(title = "关于", onClick = {
navController.navigate(AboutPageDestination)
Expand Down Expand Up @@ -462,7 +464,9 @@ fun SettingsPage() {
AlertDialog(
title = { Text(text = "上传文件中") },
text = {
LinearProgressIndicator(progress = uploadStatusVal.progress)
LinearProgressIndicator(
progress = { uploadStatusVal.progress },
)
},
onDismissRequest = { },
confirmButton = {
Expand Down
Loading

0 comments on commit c2710ba

Please sign in to comment.