@@ -39,6 +39,7 @@ import androidx.compose.ui.res.dimensionResource
39
39
import androidx.compose.ui.res.painterResource
40
40
import androidx.compose.ui.res.stringResource
41
41
import androidx.compose.ui.text.input.ImeAction
42
+ import androidx.compose.ui.text.style.TextAlign
42
43
import androidx.compose.ui.unit.dp
43
44
import coil.compose.SubcomposeAsyncImage
44
45
import coil.request.ImageRequest.Builder
@@ -169,13 +170,20 @@ private fun AdDataSection(
169
170
.fillMaxWidth(),
170
171
horizontalAlignment = Alignment .CenterHorizontally
171
172
) {
172
- WCOutlinedTextField (
173
- value = viewState.tagLine,
174
- onValueChange = onTagLineChanged,
175
- label = stringResource(id = string.blaze_campaign_edit_ad_change_tagline_title),
176
- singleLine = true ,
177
- keyboardOptions = KeyboardOptions (imeAction = ImeAction .Next )
178
- )
173
+ Box {
174
+ WCOutlinedTextField (
175
+ value = viewState.tagLine,
176
+ onValueChange = onTagLineChanged,
177
+ label = stringResource(id = string.blaze_campaign_edit_ad_change_tagline_title),
178
+ singleLine = true ,
179
+ keyboardOptions = KeyboardOptions (imeAction = ImeAction .Next )
180
+ )
181
+
182
+ CornerCharacterWarning (
183
+ charsLeft = viewState.taglineCharactersRemaining,
184
+ modifier = Modifier .align(Alignment .TopEnd )
185
+ )
186
+ }
179
187
180
188
Text (
181
189
text = stringResource(
@@ -189,16 +197,24 @@ private fun AdDataSection(
189
197
.fillMaxWidth()
190
198
)
191
199
192
- WCOutlinedTextField (
193
- value = viewState.description,
194
- onValueChange = onDescriptionChanged,
195
- label = stringResource(id = string.blaze_campaign_edit_ad_change_description_title),
196
- maxLines = 3 ,
197
- minLines = 3 ,
198
- keyboardOptions = KeyboardOptions (imeAction = ImeAction .Next ),
200
+ Box (
199
201
modifier = Modifier
200
202
.padding(top = dimensionResource(id = dimen.major_150))
201
- )
203
+ ) {
204
+ WCOutlinedTextField (
205
+ value = viewState.description,
206
+ onValueChange = onDescriptionChanged,
207
+ label = stringResource(id = string.blaze_campaign_edit_ad_change_description_title),
208
+ maxLines = 3 ,
209
+ minLines = 3 ,
210
+ keyboardOptions = KeyboardOptions (imeAction = ImeAction .Next )
211
+ )
212
+
213
+ CornerCharacterWarning (
214
+ charsLeft = viewState.descriptionCharactersRemaining,
215
+ modifier = Modifier .align(Alignment .TopEnd )
216
+ )
217
+ }
202
218
203
219
Text (
204
220
text = stringResource(
@@ -247,6 +263,23 @@ private fun AdDataSection(
247
263
}
248
264
}
249
265
266
+ @Composable
267
+ private fun CornerCharacterWarning (charsLeft : Int , modifier : Modifier = Modifier ) {
268
+ if (charsLeft < 10 ) {
269
+ Text (
270
+ text = charsLeft.toString(),
271
+ style = MaterialTheme .typography.caption,
272
+ color = colorResource(id = color.color_error),
273
+ textAlign = TextAlign .End ,
274
+ modifier = modifier
275
+ .padding(
276
+ top = dimensionResource(id = dimen.major_75),
277
+ end = dimensionResource(id = dimen.minor_75)
278
+ )
279
+ )
280
+ }
281
+ }
282
+
250
283
@Composable
251
284
private fun AdImageSection (viewState : ViewState , onChangeImageTapped : () -> Unit ) {
252
285
Column (
0 commit comments