Skip to content

Commit

Permalink
[optimize]优化小工具“实验性”标签的显示;“风格转换”功能成熟
Browse files Browse the repository at this point in the history
  • Loading branch information
SkyD666 committed Sep 25, 2023
1 parent 1448eb6 commit 725d4eb
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 28 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ android {
minSdk 24
targetSdk 34
versionCode 33
versionName "1.6-beta01"
versionName "1.6-beta02"
flavorDimensions = ["versionName"]

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,18 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Science
import androidx.compose.material3.BadgedBox
import androidx.compose.material3.Icon
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedCard
import androidx.compose.material3.PlainTooltip
import androidx.compose.material3.Text
import androidx.compose.material3.TooltipBox
import androidx.compose.material3.TooltipDefaults
import androidx.compose.material3.rememberTooltipState
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import com.skyd.rays.R
Expand All @@ -42,6 +39,7 @@ fun MiniTool1Item(
data: MiniTool1Bean,
onClickListener: ((data: MiniTool1Bean) -> Unit)? = null
) {
val context = LocalContext.current
OutlinedCard(
modifier = modifier.padding(vertical = 6.dp),
shape = RoundedCornerShape(16)
Expand All @@ -62,25 +60,28 @@ fun MiniTool1Item(
imageVector = data.icon,
contentDescription = null,
)
Text(
modifier = Modifier.padding(horizontal = 10.dp),
text = data.title,
style = MaterialTheme.typography.titleMedium,
maxLines = 2,
textAlign = TextAlign.Center
)
if (data.experimental) {
TooltipBox(
positionProvider = TooltipDefaults.rememberPlainTooltipPositionProvider(),
tooltip = { PlainTooltip { Text(stringResource(R.string.mini_tool_experimental)) } },
state = rememberTooltipState()
) {
Icon(
imageVector = Icons.Default.Science,
contentDescription = stringResource(R.string.mini_tool_experimental),
tint = LocalContentColor.current.copy(alpha = 0.5f),
)
BadgedBox(
modifier = Modifier.padding(horizontal = 12.dp),
badge = {
if (data.experimental) {
Text(
text = stringResource(R.string.mini_tool_experimental),
modifier = Modifier.semantics {
contentDescription =
context.getString(R.string.mini_tool_experimental)
},
style = MaterialTheme.typography.labelSmall,
color = MaterialTheme.colorScheme.primary,
)
}
}
) {
Text(
text = data.title,
style = MaterialTheme.typography.titleMedium,
maxLines = 2,
textAlign = TextAlign.Center
)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ fun MiniToolScreen() {
MiniTool1Bean(
title = stringResource(R.string.style_transfer_screen_name),
icon = Icons.Default.Style,
experimental = true,
experimental = false,
action = { navController.navigate(STYLE_TRANSFER_SCREEN_ROUTE) }
),
)
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@
<string name="share_config_screen_file_extension">File extension</string>
<string name="share_config_screen_file_extension_description">Add the file extension name when sharing a sticker</string>
<string name="mini_tool_screen_name">Mini Tool</string>
<string name="mini_tool_experimental">Experimental</string>
<string name="mini_tool_experimental">Beta</string>
<string name="style_transfer_screen_name">Style Transfer</string>
<string name="style_transfer_screen_transfer">Transfer</string>
<string name="style_transfer_screen_image_not_selected">Please select the target style image and content image before transferring</string>
Expand Down

0 comments on commit 725d4eb

Please sign in to comment.