Skip to content

Commit 3008838

Browse files
committed
chore(home/bottom): update tip card asset; simplify BottomBarAction use
Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1 parent e612130 commit 3008838

2 files changed

Lines changed: 41 additions & 28 deletions

File tree

app/src/main/java/com/getcode/view/main/home/components/HomeBottom.kt

Lines changed: 41 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ internal fun HomeBottom(
6161
modifier = Modifier.weight(1f),
6262
label = stringResource(R.string.action_give),
6363
painter = painterResource(R.drawable.ic_kin_white_small),
64+
badgeCount = 0,
6465
onClick = { onPress(action) }
6566
)
6667
}
@@ -70,6 +71,7 @@ internal fun HomeBottom(
7071
modifier = Modifier.weight(1f),
7172
label = stringResource(R.string.action_receive),
7273
painter = painterResource(R.drawable.ic_wallet),
74+
badgeCount = 0,
7375
onClick = { onPress(action) },
7476
)
7577
}
@@ -79,20 +81,8 @@ internal fun HomeBottom(
7981
modifier = Modifier.weight(1f),
8082
label = stringResource(R.string.action_balance),
8183
painter = painterResource(R.drawable.ic_balance),
84+
badgeCount = state.notificationUnreadCount,
8285
onClick = { onPress(HomeAction.BALANCE) },
83-
badge = {
84-
Badge(
85-
modifier = Modifier.padding(top = 6.dp, end = 1.dp),
86-
count = state.notificationUnreadCount,
87-
color = ChatNodeDefaults.UnreadIndicator,
88-
enterTransition = scaleIn(
89-
animationSpec = tween(
90-
durationMillis = 300,
91-
delayMillis = 1000
92-
)
93-
) + fadeIn()
94-
)
95-
}
9686
)
9787
}
9888

@@ -102,19 +92,7 @@ internal fun HomeBottom(
10292
label = stringResource(R.string.action_receive),
10393
painter = painterResource(R.drawable.ic_tip_card),
10494
onClick = { onPress(action) },
105-
badge = {
106-
Badge(
107-
modifier = Modifier.padding(top = 6.dp, end = 1.dp),
108-
count = if (state.splatTipCard) 1 else 0,
109-
color = ChatNodeDefaults.UnreadIndicator,
110-
enterTransition = scaleIn(
111-
animationSpec = tween(
112-
durationMillis = 300,
113-
delayMillis = 1000
114-
)
115-
) + fadeIn()
116-
)
117-
}
95+
badgeCount = if (state.splatTipCard) 1 else 0,
11896
)
11997
}
12098

@@ -123,6 +101,7 @@ internal fun HomeBottom(
123101
modifier = Modifier.weight(1f),
124102
label = stringResource(R.string.action_chat),
125103
painter = painterResource(R.drawable.ic_chat),
104+
badgeCount = 0,
126105
onClick = { onPress(action) },
127106
)
128107
}
@@ -134,6 +113,7 @@ internal fun HomeBottom(
134113
.alpha(0f),
135114
label = "",
136115
painter = painterResource(R.drawable.ic_tip_card),
116+
badgeCount = 0,
137117
onClick = null,
138118
)
139119
}
@@ -142,6 +122,41 @@ internal fun HomeBottom(
142122
}
143123
}
144124

125+
@Composable
126+
private fun BottomBarAction(
127+
modifier: Modifier = Modifier,
128+
label: String,
129+
contentPadding: PaddingValues = PaddingValues(
130+
vertical = CodeTheme.dimens.grid.x2
131+
),
132+
painter: Painter,
133+
imageSize: Dp = CodeTheme.dimens.staticGrid.x10,
134+
badgeCount: Int = 0,
135+
onClick: (() -> Unit)?,
136+
) {
137+
BottomBarAction(
138+
modifier = modifier,
139+
label = label,
140+
contentPadding = contentPadding,
141+
painter = painter,
142+
imageSize = imageSize,
143+
badge = {
144+
Badge(
145+
modifier = Modifier.padding(top = 6.dp, end = 1.dp),
146+
count = badgeCount,
147+
color = ChatNodeDefaults.UnreadIndicator,
148+
enterTransition = scaleIn(
149+
animationSpec = tween(
150+
durationMillis = 300,
151+
delayMillis = 1000
152+
)
153+
) + fadeIn()
154+
)
155+
},
156+
onClick = onClick
157+
)
158+
}
159+
145160
@Composable
146161
private fun BottomBarAction(
147162
modifier: Modifier = Modifier,

app/src/main/res/drawable/ic_tip_card.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@
66
<path
77
android:pathData="M13,7h24v36h-24z"
88
android:strokeWidth="4"
9-
android:fillColor="#00000000"
109
android:strokeColor="#ffffff"/>
1110
<path
1211
android:pathData="M25,21.182m-6.136,0a6.136,6.136 0,1 1,12.273 0a6.136,6.136 0,1 1,-12.273 0"
1312
android:strokeWidth="3"
14-
android:fillColor="#00000000"
1513
android:strokeColor="#ffffff"/>
1614
</vector>

0 commit comments

Comments
 (0)