fix: GitHub 大小写错误
顺便修改彩蛋触发逻辑
This commit is contained in:
parent
f890801922
commit
18764daccc
2 changed files with 29 additions and 12 deletions
|
|
@ -6,13 +6,13 @@ import androidx.compose.ui.graphics.vector.ImageVector
|
||||||
import androidx.compose.ui.graphics.vector.path
|
import androidx.compose.ui.graphics.vector.path
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
|
||||||
val GithubIcon: ImageVector
|
val GitHubIcon: ImageVector
|
||||||
get() {
|
get() {
|
||||||
if (_GithubIcon != null) {
|
if (_GitHubIcon != null) {
|
||||||
return _GithubIcon!!
|
return _GitHubIcon!!
|
||||||
}
|
}
|
||||||
_GithubIcon = ImageVector.Builder(
|
_GitHubIcon = ImageVector.Builder(
|
||||||
name = "GithubIcon",
|
name = "GitHubIcon",
|
||||||
defaultWidth = 24.dp,
|
defaultWidth = 24.dp,
|
||||||
defaultHeight = 24.dp,
|
defaultHeight = 24.dp,
|
||||||
viewportWidth = 24f,
|
viewportWidth = 24f,
|
||||||
|
|
@ -49,8 +49,8 @@ val GithubIcon: ImageVector
|
||||||
}
|
}
|
||||||
}.build()
|
}.build()
|
||||||
|
|
||||||
return _GithubIcon!!
|
return _GitHubIcon!!
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("ObjectPropertyName")
|
@Suppress("ObjectPropertyName")
|
||||||
private var _GithubIcon: ImageVector? = null
|
private var _GitHubIcon: ImageVector? = null
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package cn.super12138.todo.ui.pages.settings
|
package cn.super12138.todo.ui.pages.settings
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.net.Uri
|
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
|
|
@ -15,20 +14,24 @@ import androidx.compose.material.icons.outlined.Person4
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.material3.TopAppBarDefaults
|
import androidx.compose.material3.TopAppBarDefaults
|
||||||
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.mutableIntStateOf
|
import androidx.compose.runtime.mutableIntStateOf
|
||||||
|
import androidx.compose.runtime.mutableLongStateOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.core.net.toUri
|
||||||
import cn.super12138.todo.R
|
import cn.super12138.todo.R
|
||||||
import cn.super12138.todo.constants.Constants
|
import cn.super12138.todo.constants.Constants
|
||||||
import cn.super12138.todo.ui.components.LargeTopAppBarScaffold
|
import cn.super12138.todo.ui.components.LargeTopAppBarScaffold
|
||||||
import cn.super12138.todo.ui.icons.GithubIcon
|
import cn.super12138.todo.ui.icons.GitHubIcon
|
||||||
import cn.super12138.todo.ui.pages.settings.components.SettingsItem
|
import cn.super12138.todo.ui.pages.settings.components.SettingsItem
|
||||||
import cn.super12138.todo.utils.SystemUtils
|
import cn.super12138.todo.utils.SystemUtils
|
||||||
|
import kotlinx.coroutines.delay
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
|
|
@ -53,6 +56,20 @@ fun SettingsAbout(
|
||||||
.verticalScroll(rememberScrollState())
|
.verticalScroll(rememberScrollState())
|
||||||
) {
|
) {
|
||||||
var clickCount by remember { mutableIntStateOf(0) }
|
var clickCount by remember { mutableIntStateOf(0) }
|
||||||
|
var lastClickTime by remember { mutableLongStateOf(0L) }
|
||||||
|
|
||||||
|
LaunchedEffect(clickCount) {
|
||||||
|
if (clickCount > 0) {
|
||||||
|
lastClickTime = System.currentTimeMillis()
|
||||||
|
val currentClickTime = lastClickTime
|
||||||
|
delay(300L)
|
||||||
|
|
||||||
|
if (currentClickTime == lastClickTime) {
|
||||||
|
clickCount = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SettingsItem(
|
SettingsItem(
|
||||||
leadingIcon = Icons.Outlined.Numbers,
|
leadingIcon = Icons.Outlined.Numbers,
|
||||||
title = stringResource(R.string.pref_app_version),
|
title = stringResource(R.string.pref_app_version),
|
||||||
|
|
@ -74,16 +91,16 @@ fun SettingsAbout(
|
||||||
title = stringResource(R.string.pref_developer),
|
title = stringResource(R.string.pref_developer),
|
||||||
description = stringResource(R.string.developer_name),
|
description = stringResource(R.string.developer_name),
|
||||||
onClick = {
|
onClick = {
|
||||||
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(Constants.DEVELOPER_GITHUB))
|
val intent = Intent(Intent.ACTION_VIEW, Constants.DEVELOPER_GITHUB.toUri())
|
||||||
context.startActivity(intent)
|
context.startActivity(intent)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
SettingsItem(
|
SettingsItem(
|
||||||
leadingIcon = GithubIcon,
|
leadingIcon = GitHubIcon,
|
||||||
title = stringResource(R.string.pref_view_on_github),
|
title = stringResource(R.string.pref_view_on_github),
|
||||||
description = stringResource(R.string.pref_view_on_github_desc),
|
description = stringResource(R.string.pref_view_on_github_desc),
|
||||||
onClick = {
|
onClick = {
|
||||||
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(Constants.GITHUB_REPO))
|
val intent = Intent(Intent.ACTION_VIEW, Constants.GITHUB_REPO.toUri())
|
||||||
context.startActivity(intent)
|
context.startActivity(intent)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue