Skip to content

Commit ec2469c

Browse files
committed
feat: qr placeholder
1 parent e65fa77 commit ec2469c

File tree

2 files changed

+78
-20
lines changed

2 files changed

+78
-20
lines changed

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

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import androidx.compose.foundation.Image
77
import androidx.compose.foundation.background
88
import androidx.compose.foundation.clickable
99
import androidx.compose.foundation.layout.Box
10+
import androidx.compose.foundation.layout.Column
1011
import androidx.compose.foundation.layout.aspectRatio
1112
import androidx.compose.foundation.layout.padding
1213
import androidx.compose.foundation.layout.size
@@ -112,31 +113,37 @@ fun QrCodeImage(
112113
} else {
113114
imageComposable()
114115
}
115-
}
116-
}
117-
118-
logoPainter?.let {
119-
Box(
120-
contentAlignment = Alignment.Center,
121-
modifier = Modifier
122-
.size(68.dp)
123-
.background(Color.White, shape = CircleShape)
124-
.align(Alignment.Center)
125-
) {
116+
} else {
126117
Image(
127-
painter = it,
128-
contentDescription = null,
129-
modifier = Modifier.size(50.dp)
118+
painter = painterResource(R.drawable.qr_placeholder),
119+
contentDescription = content,
120+
contentScale = ContentScale.Inside,
130121
)
131122
}
132123
}
133124

134-
if (bitmap == null) {
135-
CircularProgressIndicator(
136-
color = Colors.Black,
137-
strokeWidth = 4.dp,
138-
modifier = Modifier.size(68.dp)
139-
)
125+
Column(
126+
modifier = Modifier.align(Alignment.Center),
127+
horizontalAlignment = Alignment.CenterHorizontally
128+
) {
129+
logoPainter?.let {
130+
Box(
131+
contentAlignment = Alignment.Center,
132+
modifier = Modifier
133+
.size(68.dp)
134+
.background(Color.White, shape = CircleShape)
135+
) {
136+
Image(
137+
painter = it,
138+
contentDescription = null,
139+
modifier = Modifier.size(50.dp)
140+
)
141+
}
142+
}
143+
144+
if (bitmap == null) {
145+
CaptionB("Generating QR ...", color = Colors.Black)
146+
}
140147
}
141148
}
142149
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="311dp"
3+
android:height="311dp"
4+
android:viewportWidth="311"
5+
android:viewportHeight="311">
6+
<group>
7+
<clip-path
8+
android:pathData="M0,0V65.97H65.97V0H0ZM9.42,9.42H56.55V56.55H9.42V9.42Z"
9+
android:fillType="evenOdd"/>
10+
<path
11+
android:pathData="M65.97,0H0V65.97H65.97V0Z"
12+
android:fillColor="#00000F"/>
13+
</group>
14+
<group>
15+
<clip-path
16+
android:pathData="M47.12,18.85H18.85V47.12H47.12V18.85Z"/>
17+
<path
18+
android:pathData="M47.12,18.85H18.85V47.12H47.12V18.85Z"
19+
android:fillColor="#00000F"/>
20+
</group>
21+
<group>
22+
<clip-path
23+
android:pathData="M311,0L245.03,0V65.97H311V0ZM301.58,9.42V56.55L254.46,56.55V9.42L301.58,9.42Z"
24+
android:fillType="evenOdd"/>
25+
<path
26+
android:pathData="M311,0H245.03V65.97H311V0Z"
27+
android:fillColor="#00000F"/>
28+
</group>
29+
<group>
30+
<clip-path
31+
android:pathData="M292.15,47.12V18.85L263.88,18.85V47.12H292.15Z"/>
32+
<path
33+
android:pathData="M292.15,18.85H263.88V47.12H292.15V18.85Z"
34+
android:fillColor="#00000F"/>
35+
</group>
36+
<group>
37+
<clip-path
38+
android:pathData="M0,311H65.97V245.03H0L0,311ZM9.42,301.58L9.42,254.46H56.55L56.55,301.58H9.42Z"
39+
android:fillType="evenOdd"/>
40+
<path
41+
android:pathData="M65.97,245.03H0V311H65.97V245.03Z"
42+
android:fillColor="#00000F"/>
43+
</group>
44+
<group>
45+
<clip-path
46+
android:pathData="M18.85,263.88L18.85,292.15H47.12V263.88H18.85Z"/>
47+
<path
48+
android:pathData="M47.12,263.88H18.85V292.15H47.12V263.88Z"
49+
android:fillColor="#00000F"/>
50+
</group>
51+
</vector>

0 commit comments

Comments
 (0)