Clean up getLicenseStylesheet().

This commit is contained in:
Isira Seneviratne 2022-07-23 06:00:08 +05:30 committed by Stypox
parent a9095ca2ad
commit 4b7de86a92
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
1 changed files with 11 additions and 15 deletions

View File

@ -36,21 +36,17 @@ private fun getFormattedLicense(context: Context, license: License): String {
*/ */
private fun getLicenseStylesheet(context: Context): String { private fun getLicenseStylesheet(context: Context): String {
val isLightTheme = ThemeHelper.isLightThemeSelected(context) val isLightTheme = ThemeHelper.isLightThemeSelected(context)
return ( val licenseBackgroundColor = getHexRGBColor(
"body{padding:12px 15px;margin:0;" + "background:#" + getHexRGBColor( context, if (isLightTheme) R.color.light_license_background_color else R.color.dark_license_background_color
context, )
if (isLightTheme) R.color.light_license_background_color val licenseTextColor = getHexRGBColor(
else R.color.dark_license_background_color context, if (isLightTheme) R.color.light_license_text_color else R.color.dark_license_text_color
) + ";" + "color:#" + getHexRGBColor( )
context, val youtubePrimaryColor = getHexRGBColor(
if (isLightTheme) R.color.light_license_text_color context, if (isLightTheme) R.color.light_youtube_primary_color else R.color.dark_youtube_primary_color
else R.color.dark_license_text_color )
) + "}" + "a[href]{color:#" + getHexRGBColor( return "body{padding:12px 15px;margin:0;background:#$licenseBackgroundColor;color:#$licenseTextColor}" +
context, "a[href]{color:#$youtubePrimaryColor}pre{white-space:pre-wrap}"
if (isLightTheme) R.color.light_youtube_primary_color
else R.color.dark_youtube_primary_color
) + "}" + "pre{white-space:pre-wrap}"
)
} }
/** /**