Skip to content

Commit 89047d9

Browse files
committed
update
1 parent 4610e44 commit 89047d9

File tree

7 files changed

+23
-14
lines changed

7 files changed

+23
-14
lines changed

app/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
/build
1+
/build
2+
/release

app/build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ android {
2525

2626
buildTypes {
2727
release {
28-
isMinifyEnabled = false
28+
isShrinkResources = true
29+
isMinifyEnabled = true
2930
proguardFiles(
3031
getDefaultProguardFile("proguard-android-optimize.txt"),
3132
"proguard-rules.pro"

app/proguard-rules.pro

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,6 @@
1818

1919
# If you keep the line number information, uncomment this to
2020
# hide the original source file name.
21-
#-renamesourcefileattribute SourceFile
21+
#-renamesourcefileattribute SourceFile
22+
23+
-dontwarn org.slf4j.impl.StaticLoggerBinder

app/src/main/java/com/wzq/jd/compose/app/page/home/HomeScreen.kt

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ import androidx.compose.material.icons.filled.AccountCircle
1010
import androidx.compose.material.icons.filled.Home
1111
import androidx.compose.material.icons.filled.Search
1212
import androidx.compose.material.icons.filled.ShoppingCart
13-
import androidx.compose.material3.BottomAppBar
1413
import androidx.compose.material3.CenterAlignedTopAppBar
1514
import androidx.compose.material3.ExperimentalMaterial3Api
1615
import androidx.compose.material3.Icon
1716
import androidx.compose.material3.IconButton
1817
import androidx.compose.material3.MaterialTheme
18+
import androidx.compose.material3.NavigationBar
19+
import androidx.compose.material3.NavigationBarItem
1920
import androidx.compose.material3.Scaffold
2021
import androidx.compose.material3.Text
2122
import androidx.compose.material3.TopAppBarDefaults
@@ -40,17 +41,18 @@ fun HomeScreen(viewModel: HomeViewModel, navActions: NavActions) {
4041
navActions.toSearch()
4142
}
4243
}, bottomBar = {
43-
HomeBottomBar { index ->
44+
HomeBottomBar(pagerState.currentPage) {
4445
localScope.launch {
45-
pagerState.scrollToPage(index)
46+
pagerState.scrollToPage(it)
4647
}
4748
}
4849
}) { paddingValues ->
4950
HorizontalPager(
5051
state = pagerState, modifier = Modifier
5152
.padding(paddingValues)
5253
.fillMaxSize(),
53-
beyondBoundsPageCount = pagerState.pageCount
54+
beyondBoundsPageCount = pagerState.pageCount,
55+
userScrollEnabled = false
5456
) { currentPagerNum ->
5557
when (currentPagerNum) {
5658
0 -> HomeIndexPage(
@@ -73,14 +75,18 @@ fun HomeScreen(viewModel: HomeViewModel, navActions: NavActions) {
7375
}
7476

7577
@Composable
76-
fun HomeBottomBar(onItemClick: (Int) -> Unit) {
77-
BottomAppBar(containerColor = MaterialTheme.colorScheme.secondaryContainer) {
78+
fun HomeBottomBar(selectedIndex: Int, onItemClick: (Int) -> Unit) {
79+
NavigationBar {
7880
arrayOf(
7981
Icons.Default.Home, Icons.Default.ShoppingCart, Icons.Default.AccountCircle
8082
).forEachIndexed { index, icon ->
81-
IconButton(modifier = Modifier.weight(1f), onClick = { onItemClick(index) }) {
82-
Icon(icon, null)
83-
}
83+
NavigationBarItem(
84+
selected = selectedIndex == index,
85+
onClick = { onItemClick(index) },
86+
icon = { Icon(imageVector = icon, contentDescription = null) },
87+
label = { Text(text = "label") },
88+
alwaysShowLabel = true
89+
)
8490
}
8591
}
8692
}

gradle.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
# org.gradle.parallel=true
1313
#Thu Dec 07 16:49:57 CST 2023
1414
-Xopt-in=kotlin.RequiresOptIn
15-
android.defaults.buildfeatures.buildconfig=true
1615
android.enableJetifier=false
1716
android.nonFinalResIds=true
1817
android.nonTransitiveRClass=true
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Mon Dec 11 15:36:55 CST 2023
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

publish.jks

2.43 KB
Binary file not shown.

0 commit comments

Comments
 (0)