Skip to content

Commit d2ec1cc

Browse files
committed
ui: improve icon display
1 parent 6556e1d commit d2ec1cc

32 files changed

Lines changed: 69 additions & 5 deletions

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
android:fullBackupContent="false"
2323
android:icon="@mipmap/ic_launcher"
2424
android:label="@string/app_name"
25+
android:roundIcon="@mipmap/ic_launcher_round"
2526
android:supportsRtl="true"
2627
android:theme="@style/AppTheme">
2728
<activity

app/src/main/kotlin/features/about/AboutComponents.kt

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,24 @@
11
package features.about
22

33
import androidx.compose.foundation.Image
4+
import androidx.compose.foundation.background
5+
import androidx.compose.foundation.layout.Box
46
import androidx.compose.foundation.layout.Column
57
import androidx.compose.foundation.layout.Spacer
8+
import androidx.compose.foundation.layout.fillMaxSize
69
import androidx.compose.foundation.layout.fillMaxWidth
710
import androidx.compose.foundation.layout.height
811
import androidx.compose.foundation.layout.padding
912
import androidx.compose.foundation.layout.size
13+
import androidx.compose.foundation.shape.RoundedCornerShape
1014
import androidx.compose.runtime.Composable
1115
import androidx.compose.ui.Alignment
1216
import androidx.compose.ui.Modifier
17+
import androidx.compose.ui.draw.clip
18+
import androidx.compose.ui.draw.scale
19+
import androidx.compose.ui.layout.ContentScale
1320
import androidx.compose.ui.platform.LocalUriHandler
21+
import androidx.compose.ui.res.colorResource
1422
import androidx.compose.ui.unit.dp
1523
import app.R
1624
import app.ProjectInfo
@@ -25,6 +33,7 @@ import top.yukonga.miuix.kmp.theme.MiuixTheme
2533

2634
private const val ProjectSourceUri = "https://github.com/Asterisk4Magisk/AsteriskNG"
2735
private const val TelegramChannelUri = "https://t.me/AsteriskFactory"
36+
private const val AboutIconForegroundScale = 1.25f
2837

2938
@Composable
3039
internal fun AboutHeader(
@@ -37,11 +46,7 @@ internal fun AboutHeader(
3746
.padding(top = 20.dp, bottom = 12.dp),
3847
horizontalAlignment = Alignment.CenterHorizontally,
3948
) {
40-
Image(
41-
painter = painterResource(R.mipmap.ic_launcher),
42-
contentDescription = ProjectInfo.PROJECT_NAME,
43-
modifier = Modifier.size(88.dp),
44-
)
49+
AboutAppIcon()
4550
Spacer(Modifier.height(12.dp))
4651
Text(
4752
text = ProjectInfo.PROJECT_NAME,
@@ -55,6 +60,28 @@ internal fun AboutHeader(
5560
}
5661
}
5762

63+
@Composable
64+
private fun AboutAppIcon(
65+
modifier: Modifier = Modifier,
66+
) {
67+
Box(
68+
modifier = modifier
69+
.size(88.dp)
70+
.clip(RoundedCornerShape(22.dp))
71+
.background(colorResource(R.color.ic_launcher_background)),
72+
contentAlignment = Alignment.Center,
73+
) {
74+
Image(
75+
painter = painterResource(R.mipmap.ic_launcher_foreground),
76+
contentDescription = ProjectInfo.PROJECT_NAME,
77+
contentScale = ContentScale.Fit,
78+
modifier = Modifier
79+
.fillMaxSize()
80+
.scale(AboutIconForegroundScale),
81+
)
82+
}
83+
}
84+
5885
@Composable
5986
internal fun AboutRuntimeCard(
6087
modifier: Modifier = Modifier,
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3+
<background android:drawable="@color/ic_launcher_background" />
4+
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
5+
<monochrome android:drawable="@mipmap/ic_launcher_monochrome" />
6+
</adaptive-icon>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3+
<background android:drawable="@color/ic_launcher_background" />
4+
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
5+
<monochrome android:drawable="@mipmap/ic_launcher_monochrome" />
6+
</adaptive-icon>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3+
<background android:drawable="@color/ic_launcher_background" />
4+
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
5+
<monochrome android:drawable="@mipmap/ic_launcher_monochrome" />
6+
</adaptive-icon>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3+
<background android:drawable="@color/ic_launcher_background" />
4+
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
5+
<monochrome android:drawable="@mipmap/ic_launcher_monochrome" />
6+
</adaptive-icon>
7.37 KB
Loading
21.5 KB
Loading
3.28 KB
Loading
8.46 KB
Loading

0 commit comments

Comments
 (0)