Make Theme.Monet able to export (#719)

This commit is contained in:
heddxh 2025-05-09 21:10:00 +08:00 committed by GitHub
parent e414817d01
commit 81e04ec06b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 31 additions and 0 deletions

View File

@ -323,5 +323,33 @@ sealed class Theme : Parcelable {
genericActiveBackgroundColor = primary,
genericActiveForegroundColor = onPrimary
)
@OptIn(ExperimentalStdlibApi::class)
fun toCustom() = Custom(
name = name + "#" + this.accentKeyBackgroundColor.toHexString(), // Use primary color as identifier
isDark = isDark,
backgroundImage = null,
backgroundColor = backgroundColor,
barColor = barColor,
keyboardColor = keyboardColor,
keyBackgroundColor = keyBackgroundColor,
keyTextColor = keyTextColor,
candidateTextColor = candidateTextColor,
candidateLabelColor = candidateLabelColor,
candidateCommentColor = candidateCommentColor,
altKeyBackgroundColor = altKeyBackgroundColor,
altKeyTextColor = altKeyTextColor,
accentKeyBackgroundColor = accentKeyBackgroundColor,
accentKeyTextColor = accentKeyTextColor,
keyPressHighlightColor = keyPressHighlightColor,
keyShadowColor = keyShadowColor,
popupBackgroundColor = popupBackgroundColor,
popupTextColor = popupTextColor,
spaceBarColor = spaceBarColor,
dividerColor = dividerColor,
clipboardEntryColor = clipboardEntryColor,
genericActiveBackgroundColor = genericActiveBackgroundColor,
genericActiveForegroundColor = genericActiveForegroundColor
)
}
}

View File

@ -127,6 +127,9 @@ abstract class ThemeListAdapter : RecyclerView.Adapter<ThemeListAdapter.ViewHold
if (theme is Theme.Custom) {
onExportTheme(theme)
true
} else if (theme is Theme.Monet) {
onExportTheme(theme.toCustom())
true
} else false
}
editButton.setOnClickListener {