Skip to content

Commit

Permalink
Merge branch 'Nailik-patch-1' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
mikepenz committed May 10, 2022
2 parents c56917f + 2b9991f commit e01b8ba
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
Expand Down Expand Up @@ -120,7 +122,8 @@ fun Libraries(
modifier = Modifier.verticalScroll(scrollState),
) {
HtmlText(
library.licenses.firstOrNull()?.htmlReadyLicenseContent.orEmpty(),
html = library.licenses.firstOrNull()?.htmlReadyLicenseContent.orEmpty(),
color = colors.contentColor,
)
}
},
Expand All @@ -133,10 +136,10 @@ fun Libraries(
}

@Composable
fun HtmlText(html: String, modifier: Modifier = Modifier) {
fun HtmlText(html: String, modifier: Modifier = Modifier, color: Color = Color.Black) {
AndroidView(
modifier = modifier,
factory = { context -> TextView(context) },
factory = { context -> TextView(context).apply { setTextColor(color.toArgb()) } },
update = { it.text = HtmlCompat.fromHtml(html, HtmlCompat.FROM_HTML_MODE_COMPACT) }
)
}
Expand Down Expand Up @@ -174,4 +177,4 @@ fun PreviewLibrary() {
}
}
}
}
}

0 comments on commit e01b8ba

Please sign in to comment.