Skip to content

Commit eaed822

Browse files
committed
feat: Custom icons for buttons & sections on activity detail
1 parent 0f9ae56 commit eaed822

File tree

7 files changed

+166
-20
lines changed

7 files changed

+166
-20
lines changed

app/src/main/java/to/bitkit/ui/components/Button.kt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package to.bitkit.ui.components
22

33
import androidx.compose.foundation.BorderStroke
44
import androidx.compose.foundation.layout.Arrangement
5+
import androidx.compose.foundation.layout.Box
56
import androidx.compose.foundation.layout.Column
67
import androidx.compose.foundation.layout.PaddingValues
78
import androidx.compose.foundation.layout.Spacer
@@ -20,6 +21,7 @@ import androidx.compose.material3.Text
2021
import androidx.compose.material3.TextButton
2122
import androidx.compose.runtime.Composable
2223
import androidx.compose.ui.Modifier
24+
import androidx.compose.ui.draw.alpha
2325
import androidx.compose.ui.graphics.Color
2426
import androidx.compose.ui.text.style.TextOverflow
2527
import androidx.compose.ui.tooling.preview.Preview
@@ -74,7 +76,9 @@ fun PrimaryButton(
7476
)
7577
} else {
7678
if (icon != null) {
77-
icon()
79+
Box(modifier = if (enabled) Modifier else Modifier.alpha(0.5f)) {
80+
icon()
81+
}
7882
Spacer(modifier = Modifier.width(8.dp))
7983
}
8084
Text(
@@ -200,6 +204,13 @@ private fun PrimaryButtonPreview() {
200204
PrimaryButton(
201205
text = "Primary Disabled",
202206
onClick = {},
207+
icon = {
208+
Icon(
209+
imageVector = Icons.Filled.Favorite,
210+
contentDescription = null,
211+
modifier = Modifier.size(16.dp)
212+
)
213+
},
203214
enabled = false,
204215
)
205216
PrimaryButton(

app/src/main/java/to/bitkit/ui/screens/wallets/activity/ActivityItemScreen.kt

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@ import androidx.compose.foundation.layout.height
1313
import androidx.compose.foundation.layout.padding
1414
import androidx.compose.foundation.layout.size
1515
import androidx.compose.foundation.layout.width
16-
import androidx.compose.material.icons.Icons
17-
import androidx.compose.material.icons.outlined.AccountCircle
18-
import androidx.compose.material.icons.outlined.CalendarMonth
19-
import androidx.compose.material.icons.outlined.Explore
20-
import androidx.compose.material.icons.outlined.Schedule
21-
import androidx.compose.material.icons.outlined.Tag
22-
import androidx.compose.material.icons.outlined.Timer
2316
import androidx.compose.material3.HorizontalDivider
2417
import androidx.compose.material3.Icon
2518
import androidx.compose.runtime.Composable
@@ -151,7 +144,7 @@ private fun ActivityItemView(
151144
)
152145
Row(verticalAlignment = Alignment.CenterVertically) {
153146
Icon(
154-
imageVector = Icons.Outlined.CalendarMonth,
147+
painter = painterResource(R.drawable.ic_calendar),
155148
contentDescription = null,
156149
tint = accentColor,
157150
modifier = Modifier.size(16.dp)
@@ -172,7 +165,7 @@ private fun ActivityItemView(
172165
)
173166
Row(verticalAlignment = Alignment.CenterVertically) {
174167
Icon(
175-
imageVector = Icons.Outlined.Schedule,
168+
painter = painterResource(R.drawable.ic_clock),
176169
contentDescription = null,
177170
tint = accentColor,
178171
modifier = Modifier.size(16.dp)
@@ -199,7 +192,7 @@ private fun ActivityItemView(
199192
)
200193
Row(verticalAlignment = Alignment.CenterVertically) {
201194
Icon(
202-
imageVector = Icons.Outlined.AccountCircle,
195+
painter = painterResource(R.drawable.ic_user),
203196
contentDescription = null,
204197
tint = accentColor,
205198
modifier = Modifier.size(16.dp)
@@ -221,7 +214,7 @@ private fun ActivityItemView(
221214
)
222215
Row(verticalAlignment = Alignment.CenterVertically) {
223216
Icon(
224-
imageVector = Icons.Outlined.Timer,
217+
painter = painterResource(R.drawable.ic_speed_normal),
225218
contentDescription = null,
226219
tint = accentColor,
227220
modifier = Modifier.size(16.dp)
@@ -295,7 +288,7 @@ private fun ActivityItemView(
295288
Spacer(modifier = Modifier.height(16.dp))
296289

297290
// Action buttons
298-
// TODO add buttons action & disable boost for LN
291+
// TODO add buttons action
299292
Column(
300293
verticalArrangement = Arrangement.spacedBy(16.dp),
301294
modifier = Modifier.fillMaxWidth()
@@ -310,7 +303,7 @@ private fun ActivityItemView(
310303
onClick = { /* TODO: Implement assign functionality */ },
311304
icon = {
312305
Icon(
313-
imageVector = Icons.Outlined.AccountCircle,
306+
painter = painterResource(R.drawable.ic_user_plus),
314307
contentDescription = null,
315308
tint = accentColor,
316309
modifier = Modifier.size(16.dp)
@@ -324,7 +317,7 @@ private fun ActivityItemView(
324317
onClick = { /* TODO: Implement tag functionality */ },
325318
icon = {
326319
Icon(
327-
imageVector = Icons.Outlined.Tag,
320+
painter = painterResource(R.drawable.ic_tag),
328321
contentDescription = null,
329322
tint = accentColor,
330323
modifier = Modifier.size(16.dp)
@@ -341,9 +334,10 @@ private fun ActivityItemView(
341334
text = stringResource(R.string.wallet__activity_boost),
342335
size = ButtonSize.Small,
343336
onClick = { /* TODO: Implement boost functionality */ },
337+
enabled = !isLightning, // TODO add logic to enable/disable boost for onchain activities
344338
icon = {
345339
Icon(
346-
imageVector = Icons.Outlined.Timer,
340+
painter = painterResource(R.drawable.ic_timer_alt),
347341
contentDescription = null,
348342
tint = accentColor,
349343
modifier = Modifier.size(16.dp)
@@ -357,7 +351,7 @@ private fun ActivityItemView(
357351
onClick = { /* TODO: Implement explore functionality */ },
358352
icon = {
359353
Icon(
360-
imageVector = Icons.Outlined.Explore,
354+
painter = painterResource(R.drawable.ic_git_branch),
361355
contentDescription = null,
362356
tint = accentColor,
363357
modifier = Modifier.size(16.dp)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="16dp"
3+
android:height="16dp"
4+
android:autoMirrored="true"
5+
android:viewportWidth="16"
6+
android:viewportHeight="16">
7+
8+
<path
9+
android:fillAlpha="0.2"
10+
android:fillColor="#FFFFFF"
11+
android:pathData="M2.5,13.5H13.5V4.333C13.5,3.847 13.447,3.381 13.354,3.037C13.26,2.693 13.133,2.5 13,2.5H3C2.867,2.5 2.74,2.693 2.646,3.037C2.553,3.381 2.5,3.847 2.5,4.333V13.5Z"
12+
android:strokeAlpha="0.2" />
13+
14+
<path
15+
android:fillColor="#FFFFFF"
16+
android:fillType="evenOdd"
17+
android:pathData="M2,3C2,2.448 2.448,2 3,2H13C13.552,2 14,2.448 14,3V13C14,13.552 13.552,14 13,14H3C2.448,14 2,13.552 2,13V3ZM13,3H3V13H13V3Z" />
18+
19+
<path
20+
android:fillColor="#FFFFFF"
21+
android:fillType="evenOdd"
22+
android:pathData="M11,1C11.276,1 11.5,1.224 11.5,1.5V3.5C11.5,3.776 11.276,4 11,4C10.724,4 10.5,3.776 10.5,3.5V1.5C10.5,1.224 10.724,1 11,1Z" />
23+
24+
<path
25+
android:fillColor="#FFFFFF"
26+
android:fillType="evenOdd"
27+
android:pathData="M5,1C5.276,1 5.5,1.224 5.5,1.5V3.5C5.5,3.776 5.276,4 5,4C4.724,4 4.5,3.776 4.5,3.5V1.5C4.5,1.224 4.724,1 5,1Z" />
28+
29+
<path
30+
android:fillColor="#FFFFFF"
31+
android:fillType="evenOdd"
32+
android:pathData="M2,5.5C2,5.224 2.224,5 2.5,5H13.5C13.776,5 14,5.224 14,5.5C14,5.776 13.776,6 13.5,6H2.5C2.224,6 2,5.776 2,5.5Z" />
33+
34+
</vector>
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="16dp"
3+
android:height="16dp"
4+
android:autoMirrored="true"
5+
android:viewportWidth="16"
6+
android:viewportHeight="16">
7+
8+
<path
9+
android:fillAlpha="0.2"
10+
android:fillColor="#ffffff"
11+
android:pathData="m11.75,6c0.966,0 1.75,-0.784 1.75,-1.75s-0.784,-1.75 -1.75,-1.75 -1.75,0.784 -1.75,1.75 0.784,1.75 1.75,1.75z"
12+
android:strokeAlpha="0.2" />
13+
14+
<path
15+
android:fillColor="#00000000"
16+
android:pathData="m4.249,10v-0.5c0,-0.398 0.158,-0.779 0.439,-1.061s0.663,-0.439 1.061,-0.439l4.5,-0c0.398,0 0.779,-0.158 1.061,-0.439 0.281,-0.281 0.439,-0.663 0.439,-1.061v-0.5"
17+
android:strokeWidth="1"
18+
android:strokeColor="#ffffff"
19+
android:strokeLineCap="round"
20+
android:strokeLineJoin="round" />
21+
22+
<path
23+
android:fillColor="#00000000"
24+
android:pathData="m4.249,6v4"
25+
android:strokeWidth="1"
26+
android:strokeColor="#ffffff"
27+
android:strokeLineCap="round"
28+
android:strokeLineJoin="round" />
29+
30+
<path
31+
android:fillColor="#00000000"
32+
android:pathData="m4.25,13.5c0.966,0 1.75,-0.784 1.75,-1.75s-0.784,-1.75 -1.75,-1.75 -1.75,0.784 -1.75,1.75 0.784,1.75 1.75,1.75z"
33+
android:strokeWidth="1"
34+
android:strokeColor="#ffffff"
35+
android:strokeLineCap="round"
36+
android:strokeLineJoin="round" />
37+
38+
<path
39+
android:fillColor="#00000000"
40+
android:pathData="m11.75,6c0.966,0 1.75,-0.784 1.75,-1.75s-0.784,-1.75 -1.75,-1.75 -1.75,0.784 -1.75,1.75 0.784,1.75 1.75,1.75z"
41+
android:strokeWidth="1"
42+
android:strokeColor="#ffffff"
43+
android:strokeLineCap="round"
44+
android:strokeLineJoin="round" />
45+
46+
<path
47+
android:fillColor="#00000000"
48+
android:pathData="m4.25,6c0.966,0 1.75,-0.784 1.75,-1.75s-0.784,-1.75 -1.75,-1.75 -1.75,0.784 -1.75,1.75 0.784,1.75 1.75,1.75z"
49+
android:strokeWidth="1"
50+
android:strokeColor="#ffffff"
51+
android:strokeLineCap="round"
52+
android:strokeLineJoin="round" />
53+
54+
</vector>

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
<path
77
android:pathData="M7.666,1.618L2.625,2.626L1.617,7.667C1.601,7.747 1.605,7.831 1.629,7.91C1.653,7.988 1.696,8.06 1.754,8.118L8.282,14.647C8.329,14.693 8.384,14.73 8.444,14.755C8.505,14.78 8.57,14.793 8.636,14.793C8.701,14.793 8.766,14.78 8.827,14.755C8.888,14.73 8.943,14.693 8.989,14.647L14.646,8.99C14.693,8.943 14.729,8.888 14.755,8.828C14.78,8.767 14.793,8.702 14.793,8.636C14.793,8.571 14.78,8.506 14.755,8.445C14.729,8.384 14.693,8.329 14.646,8.283L8.118,1.754C8.06,1.696 7.988,1.653 7.909,1.629C7.83,1.606 7.747,1.601 7.666,1.618Z"
88
android:strokeAlpha="0.2"
9-
android:fillColor="#FF4400"
9+
android:fillColor="#FFFFFF"
1010
android:fillAlpha="0.2"/>
1111
<path
1212
android:pathData="M7.568,1.127C7.73,1.095 7.897,1.103 8.054,1.151C8.212,1.199 8.355,1.284 8.471,1.401L7.643,1.503M7.643,1.503L7.568,1.127L7.643,1.503ZM2.527,2.136L7.568,1.127L7.643,1.503M3.05,3.051L2.107,7.765L8.636,14.293L14.293,8.636L7.764,2.108L3.05,3.051ZM8.471,1.401L15,7.929C15.092,8.022 15.166,8.132 15.217,8.254C15.267,8.375 15.293,8.505 15.293,8.636C15.293,8.768 15.267,8.898 15.217,9.019C15.166,9.14 15.092,9.25 15,9.343L9.343,15C9.25,15.093 9.14,15.167 9.018,15.217C8.897,15.267 8.767,15.293 8.636,15.293C8.504,15.293 8.374,15.267 8.253,15.217C8.132,15.167 8.021,15.093 7.929,15L1.4,8.472C1.284,8.355 1.198,8.212 1.15,8.055C1.103,7.897 1.095,7.73 1.127,7.569L2.135,2.528C2.175,2.33 2.329,2.175 2.527,2.136"
13-
android:fillColor="#FF4400"
13+
android:fillColor="#FFFFFF"
1414
android:fillType="evenOdd"/>
1515
<path
1616
android:pathData="M5.249,6C5.663,6 5.999,5.664 5.999,5.25C5.999,4.836 5.663,4.5 5.249,4.5C4.835,4.5 4.499,4.836 4.499,5.25C4.499,5.664 4.835,6 5.249,6Z"
17-
android:fillColor="#FF4400"/>
17+
android:fillColor="#FFFFFF"/>
1818
</vector>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="32dp"
3+
android:height="32dp"
4+
android:autoMirrored="true"
5+
android:viewportWidth="32"
6+
android:viewportHeight="32">
7+
8+
<path
9+
android:fillAlpha="0.2"
10+
android:fillColor="#ffffff"
11+
android:pathData="M16,20a8,8 0,1 0,0 -16,8 8,0 0,0 0,16"
12+
android:strokeAlpha="0.2" />
13+
14+
<path
15+
android:fillColor="#ffffff"
16+
android:fillType="evenOdd"
17+
android:pathData="M16,5a7,7 0,1 0,0 14,7 7,0 0,0 0,-14m-9,7a9,9 0,1 1,18 0,9 9,0 0,1 -18,0" />
18+
19+
<path
20+
android:fillColor="#ffffff"
21+
android:fillType="evenOdd"
22+
android:pathData="M16,21a13,13 0,0 0,-11.26 6.5,1 1,0 0,1 -1.732,-1.001 15.005,15.005 0,0 1,25.984 0,1 1,0 0,1 -1.731,1A13,13 0,0 0,16 21" />
23+
24+
</vector>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="32dp"
3+
android:height="32dp"
4+
android:autoMirrored="true"
5+
android:viewportWidth="32"
6+
android:viewportHeight="32">
7+
8+
<path
9+
android:fillAlpha="0.2"
10+
android:fillColor="#ffffff"
11+
android:pathData="M16,20a8,8 0,1 0,0 -16,8 8,0 0,0 0,16"
12+
android:strokeAlpha="0.2" />
13+
14+
<path
15+
android:fillColor="#ffffff"
16+
android:fillType="evenOdd"
17+
android:pathData="M21,7a1,1 0,0 1,1 -1h6a1,1 0,1 1,0 2h-6a1,1 0,0 1,-1 -1" />
18+
19+
<path
20+
android:fillColor="#ffffff"
21+
android:fillType="evenOdd"
22+
android:pathData="M25,3a1,1 0,0 1,1 1v6a1,1 0,1 1,-2 0V4a1,1 0,0 1,1 -1M16,21a13,13 0,0 0,-11.26 6.5,1 1,0 0,1 -1.732,-1.001 15.005,15.005 0,0 1,25.984 0,1 1,0 0,1 -1.731,1A13,13 0,0 0,16 21" />
23+
24+
<path
25+
android:fillColor="#ffffff"
26+
android:fillType="evenOdd"
27+
android:pathData="M17.617,5.188a6.996,6.996 0,1 0,4.952 9.237,1 1,0 1,1 1.875,0.695 8.996,8.996 0,1 1,-6.367 -11.879,1 1,0 0,1 -0.46,1.947" />
28+
29+
</vector>

0 commit comments

Comments
 (0)