@@ -23,6 +23,7 @@ import androidx.compose.foundation.layout.IntrinsicSize
23
23
import androidx.compose.foundation.layout.PaddingValues
24
24
import androidx.compose.foundation.layout.Row
25
25
import androidx.compose.foundation.layout.Spacer
26
+ import androidx.compose.foundation.layout.fillMaxSize
26
27
import androidx.compose.foundation.layout.fillMaxWidth
27
28
import androidx.compose.foundation.layout.height
28
29
import androidx.compose.foundation.layout.heightIn
@@ -33,6 +34,7 @@ import androidx.compose.foundation.layout.wrapContentSize
33
34
import androidx.compose.foundation.lazy.LazyColumn
34
35
import androidx.compose.foundation.lazy.itemsIndexed
35
36
import androidx.compose.foundation.rememberScrollState
37
+ import androidx.compose.foundation.shape.CircleShape
36
38
import androidx.compose.foundation.shape.RoundedCornerShape
37
39
import androidx.compose.foundation.text.BasicTextField
38
40
import androidx.compose.foundation.verticalScroll
@@ -90,10 +92,10 @@ import androidx.compose.ui.tooling.preview.Preview
90
92
import androidx.compose.ui.tooling.preview.PreviewParameter
91
93
import androidx.compose.ui.unit.Dp
92
94
import androidx.compose.ui.unit.dp
95
+ import androidx.compose.ui.unit.times
93
96
import com.bumptech.glide.integration.compose.ExperimentalGlideComposeApi
94
97
import com.bumptech.glide.integration.compose.GlideSubcomposition
95
98
import com.bumptech.glide.integration.compose.RequestState
96
- import com.google.accompanist.drawablepainter.rememberDrawablePainter
97
99
import com.squareup.phrase.Phrase
98
100
import kotlinx.coroutines.CoroutineScope
99
101
import kotlinx.coroutines.Dispatchers
@@ -123,6 +125,61 @@ import org.thoughtcrime.securesms.ui.theme.primaryYellow
123
125
import org.thoughtcrime.securesms.ui.theme.transparentButtonColors
124
126
import kotlin.math.roundToInt
125
127
128
+ @Composable
129
+ fun PathDot (
130
+ modifier : Modifier = Modifier ,
131
+ dotSize : Dp = LocalDimensions .current.iconMedium,
132
+ glowSize : Dp = LocalDimensions .current.xxsSpacing,
133
+ color : Color = primaryGreen
134
+ ) {
135
+ val fullSize = dotSize + 2 * glowSize
136
+ Box (
137
+ modifier = modifier.size(fullSize),
138
+ contentAlignment = Alignment .Center
139
+ ) {
140
+ // Glow effect (outer circle with radial gradient)
141
+ Canvas (modifier = Modifier .fillMaxSize()) {
142
+ val center = Offset (this .size.width / 2 , this .size.height / 2 )
143
+ val radius = (fullSize * 0.5f ).toPx()
144
+
145
+ drawCircle(
146
+ brush = Brush .radialGradient(
147
+ colors = listOf (
148
+ color, // Start color (opaque)
149
+ color.copy(alpha = 0f ) // End color (transparent)
150
+ ),
151
+ center = center,
152
+ radius = radius
153
+ ),
154
+ center = center,
155
+ radius = radius
156
+ )
157
+ }
158
+
159
+ // Inner solid dot
160
+ Box (
161
+ modifier = Modifier
162
+ .size(dotSize)
163
+ .background(
164
+ color = color,
165
+ shape = CircleShape
166
+ )
167
+ )
168
+ }
169
+ }
170
+
171
+ @Preview
172
+ @Composable
173
+ fun PreviewPathDot (){
174
+ PreviewTheme {
175
+ Box (
176
+ modifier = Modifier .padding(20 .dp)
177
+ ) {
178
+ PathDot ()
179
+ }
180
+ }
181
+ }
182
+
126
183
data class RadioOption <T >(
127
184
val value : T ,
128
185
val title : GetString ,
@@ -202,14 +259,12 @@ fun ItemButtonWithDrawable(
202
259
shape : Shape = RectangleShape ,
203
260
onClick : () -> Unit
204
261
) {
205
- val context = LocalContext .current
206
-
207
262
ItemButton (
208
263
annotatedStringText = AnnotatedString (stringResource(textId)),
209
264
modifier = modifier,
210
265
icon = {
211
266
Image (
212
- painter = rememberDrawablePainter(drawable = AppCompatResources .getDrawable(context, icon) ),
267
+ painter = painterResource(id = icon),
213
268
contentDescription = null ,
214
269
modifier = Modifier .align(Alignment .Center )
215
270
)
@@ -280,7 +335,7 @@ fun LargeItemButton(
280
335
@Composable
281
336
fun LargeItemButton (
282
337
annotatedStringText : AnnotatedString ,
283
- @DrawableRes icon : Int ,
338
+ icon : @Composable BoxScope .() -> Unit ,
284
339
modifier : Modifier = Modifier ,
285
340
enabled : Boolean = true,
286
341
colors : ButtonColors = transparentButtonColors(),
0 commit comments