@@ -44,8 +44,10 @@ import androidx.compose.runtime.setValue
4444import androidx.compose.ui.Modifier
4545import androidx.compose.ui.graphics.toArgb
4646import androidx.compose.ui.platform.LocalContext
47+ import androidx.compose.ui.res.stringResource
4748import androidx.compose.ui.unit.dp
4849import androidx.compose.ui.viewinterop.AndroidView
50+ import app.myfaq.android.R
4951import app.myfaq.android.screens.components.ErrorRetry
5052import app.myfaq.android.screens.components.LoadingIndicator
5153import app.myfaq.shared.api.dto.Comment
@@ -75,25 +77,26 @@ fun FaqDetailScreen(
7577 Scaffold (
7678 topBar = {
7779 TopAppBar (
78- title = { Text (" FAQ " ) },
80+ title = { Text (stringResource( R .string.faq) ) },
7981 navigationIcon = {
8082 IconButton (onClick = onBack) {
81- Icon (Icons .AutoMirrored .Filled .ArrowBack , contentDescription = " Back " )
83+ Icon (Icons .AutoMirrored .Filled .ArrowBack , contentDescription = stringResource( R .string.back) )
8284 }
8385 },
8486 actions = {
8587 if (faqState is UiState .Success ) {
8688 val context = LocalContext .current
8789 val faq = (faqState as UiState .Success <FaqDetail >).data
90+ val shareLabel = stringResource(R .string.share)
8891 IconButton (onClick = {
8992 val sendIntent =
9093 Intent (Intent .ACTION_SEND ).apply {
9194 type = " text/plain"
9295 putExtra(Intent .EXTRA_TEXT , faq.question)
9396 }
94- context.startActivity(Intent .createChooser(sendIntent, " Share " ))
97+ context.startActivity(Intent .createChooser(sendIntent, shareLabel ))
9598 }) {
96- Icon (Icons .Default .Share , contentDescription = " Share " )
99+ Icon (Icons .Default .Share , contentDescription = shareLabel )
97100 }
98101 }
99102 },
@@ -233,7 +236,7 @@ private fun FaqDetailContent(
233236 modifier = Modifier .fillMaxWidth(),
234237 ) {
235238 Icon (Icons .Default .Star , contentDescription = null )
236- Text (" Rate this FAQ " , style = MaterialTheme .typography.labelLarge)
239+ Text (" " + stringResource( R .string.rate_faq) , style = MaterialTheme .typography.labelLarge)
237240 }
238241
239242 Spacer (modifier = Modifier .height(16 .dp))
@@ -247,7 +250,7 @@ private fun FaqDetailContent(
247250@Composable
248251private fun AttachmentsSection (attachments : List <app.myfaq.shared.api.dto.Attachment >) {
249252 val context = LocalContext .current
250- Text (" Attachments " , style = MaterialTheme .typography.titleSmall)
253+ Text (stringResource( R .string.attachments) , style = MaterialTheme .typography.titleSmall)
251254 Spacer (modifier = Modifier .height(4 .dp))
252255 attachments.forEach { attachment ->
253256 TextButton (
@@ -270,14 +273,14 @@ private fun CommentsSection(state: UiState<List<Comment>>) {
270273 when (state) {
271274 is UiState .Loading -> {
272275 Text (
273- " Loading comments... " ,
276+ stringResource( R .string.loading_comments) ,
274277 style = MaterialTheme .typography.bodySmall,
275278 modifier = Modifier .padding(top = 8 .dp),
276279 )
277280 }
278281 is UiState .Error -> {
279282 Text (
280- " Could not load comments " ,
283+ stringResource( R .string.could_not_load_comments) ,
281284 style = MaterialTheme .typography.bodySmall,
282285 color = MaterialTheme .colorScheme.error,
283286 modifier = Modifier .padding(top = 8 .dp),
@@ -286,7 +289,7 @@ private fun CommentsSection(state: UiState<List<Comment>>) {
286289 is UiState .Success -> {
287290 if (state.data.isEmpty()) {
288291 Text (
289- " No comments yet " ,
292+ stringResource( R .string.no_comments) ,
290293 style = MaterialTheme .typography.bodySmall,
291294 color = MaterialTheme .colorScheme.onSurfaceVariant,
292295 modifier = Modifier .padding(top = 8 .dp),
@@ -295,9 +298,9 @@ private fun CommentsSection(state: UiState<List<Comment>>) {
295298 TextButton (onClick = { expanded = ! expanded }) {
296299 Text (
297300 if (expanded) {
298- " Hide comments ( ${ state.data.size} ) "
301+ stringResource( R .string.hide_comments, state.data.size)
299302 } else {
300- " Show comments ( ${ state.data.size} ) "
303+ stringResource( R .string.show_comments, state.data.size)
301304 },
302305 )
303306 }
@@ -359,8 +362,14 @@ private fun buildHtml(
359362 margin: 0;
360363 word-wrap: break-word;
361364 }
365+ /* Override any inline color/background from server HTML so
366+ dark-mode content stays readable. */
367+ body, body *:not(a) {
368+ color: $fgColor !important;
369+ background-color: transparent !important;
370+ }
371+ a, a * { color: #64b5f6 !important; }
362372 img { max-width: 100%; height: auto; }
363- a { color: #1a73e8; }
364373 pre, code { overflow-x: auto; }
365374 </style>
366375 </head>
0 commit comments