0
0
mirror of https://github.com/thunderbird/thunderbird-android.git synced 2024-09-19 19:52:14 +02:00

Add success, warning and info colors

This commit is contained in:
Wolf Montwé 2023-03-23 13:41:47 +01:00
parent 74b303bd62
commit 4218ce5cfe
No known key found for this signature in database
GPG Key ID: 6D45B21512ACBF72
3 changed files with 25 additions and 11 deletions

View File

@ -167,8 +167,6 @@
<ID>LongMethod:SrvServiceDiscoveryTest.kt$SrvServiceDiscoveryTest$@Test fun discover_withRequiredServices_shouldCorrectlyPrioritize()</ID>
<ID>LongMethod:TextBodyBuilderTest.kt$TextBodyBuilderTest.Companion$@JvmStatic @Parameterized.Parameters(name = "{index}: {0}") fun data(): Collection&lt;TestData&gt;</ID>
<ID>LongMethod:ThreadMessageOperationsTest.kt$ThreadMessageOperationsTest$@Test fun `merge two existing threads`()</ID>
<ID>LongParameterList:Colors.kt$( primary: Color = MaterialColor.deep_purple_200, primaryVariant: Color = MaterialColor.deep_purple_50, secondary: Color = MaterialColor.cyan_300, secondaryVariant: Color = MaterialColor.cyan_100, background: Color = MaterialColor.gray_800, surface: Color = MaterialColor.gray_900, error: Color = MaterialColor.red_300, onPrimary: Color = Color.Black, onSecondary: Color = Color.Black, onBackground: Color = Color.White, onSurface: Color = Color.White, onError: Color = Color.Black, )</ID>
<ID>LongParameterList:Colors.kt$( primary: Color = MaterialColor.deep_purple_600, primaryVariant: Color = MaterialColor.deep_purple_900, secondary: Color = MaterialColor.cyan_600, secondaryVariant: Color = MaterialColor.cyan_800, background: Color = MaterialColor.gray_200, surface: Color = Color.White, error: Color = MaterialColor.red_600, onPrimary: Color = Color.White, onSecondary: Color = Color.Black, onBackground: Color = Color.Black, onSurface: Color = Color.Black, onError: Color = Color.White, )</ID>
<ID>LongParameterList:CopyMessageOperations.kt$DatabaseMessagePart$( val id: Long, val type: Int, val root: Long, val parent: Long, val seq: Int, val mimeType: String?, val decodedBodySize: Long?, val displayName: String?, val header: ByteArray?, val encoding: String?, val charset: String?, val dataLocation: Int, val data: ByteArray?, val preamble: ByteArray?, val epilogue: ByteArray?, val boundary: String?, val contentId: String?, val serverExtra: String?, )</ID>
<ID>LongParameterList:FolderHelpers.kt$( name: String = "irrelevant", type: String = "regular", serverId: String? = null, isLocalOnly: Boolean = true, integrate: Boolean = false, inTopGroup: Boolean = false, displayClass: String = "NO_CLASS", syncClass: String? = "INHERITED", notifyClass: String? = "INHERITED", pushClass: String? = "SECOND_CLASS", lastUpdated: Long = 0L, unreadCount: Int = 0, visibleLimit: Int = 25, status: String? = null, flaggedCount: Int = 0, moreMessages: String = "unknown", )</ID>
<ID>LongParameterList:ImapSync.kt$ImapSync$( remoteFolder: ImapFolder, backendFolder: BackendFolder, largeMessages: List&lt;ImapMessage&gt;, progress: AtomicInteger, downloadedMessageCount: AtomicInteger, todo: Int, highestKnownUid: Long?, listener: SyncListener, maxDownloadSize: Int, )</ID>
@ -185,7 +183,6 @@
<ID>LongParameterList:RecipientPresenter.kt$RecipientPresenter$( private val context: Context, loaderManager: LoaderManager, private val openPgpApiManager: OpenPgpApiManager, private val recipientMvpView: RecipientMvpView, account: Account, private val composePgpInlineDecider: ComposePgpInlineDecider, private val composePgpEnableByDefaultDecider: ComposePgpEnableByDefaultDecider, private val autocryptStatusInteractor: AutocryptStatusInteractor, private val replyToParser: ReplyToParser, private val draftStateHeaderParser: AutocryptDraftStateHeaderParser, )</ID>
<ID>LongParameterList:SaveMessageOperationsTest.kt$SaveMessageOperationsTest$( subject: String? = getSubject(), date: Long = sentDate?.time ?: System.currentTimeMillis(), internalDate: Long = date, downloadState: MessageDownloadState = getDownloadState(), attachmentCount: Int = 0, previewResult: PreviewResult = PreviewResult.none(), textForSearchIndex: String? = null, encryptionType: String? = null, )</ID>
<ID>LongParameterList:SettingsImportViewModel.kt$SavedAccountState$( val accountIndex: Int, val displayName: String, val accountUuid: String, val selected: Boolean, val importStatus: ImportStatus, val incomingServerName: String?, val outgoingServerName: String?, val incomingServerPasswordNeeded: Boolean, val outgoingServerPasswordNeeded: Boolean, )</ID>
<ID>LongParameterList:Typography.kt$( h1: TextStyle, h2: TextStyle, h3: TextStyle, h4: TextStyle, h5: TextStyle, h6: TextStyle, subtitle1: TextStyle, subtitle2: TextStyle, body1: TextStyle, body2: TextStyle, button: TextStyle, caption: TextStyle, overline: TextStyle, )</ID>
<ID>LoopWithTooManyJumpStatements:AccountSetupCheckSettings.kt$AccountSetupCheckSettings$for (subjectAlternativeName in subjectAlternativeNames) { val type = subjectAlternativeName[0] as Int val value: Any? = subjectAlternativeName[1] val name: String = when (type) { 0 -&gt; { Timber.w("SubjectAltName of type OtherName not supported.") continue } 1 -&gt; value as String 2 -&gt; value as String 3 -&gt; { Timber.w("unsupported SubjectAltName of type x400Address") continue } 4 -&gt; { Timber.w("unsupported SubjectAltName of type directoryName") continue } 5 -&gt; { Timber.w("unsupported SubjectAltName of type ediPartyName") continue } 6 -&gt; value as String 7 -&gt; value as String else -&gt; { Timber.w("unsupported SubjectAltName of unknown type") continue } } // if some of the SubjectAltNames match the store or transport -host, display them if (name.equals(incomingServerHost, ignoreCase = true) || name.equals(outgoingServerHost, ignoreCase = true) ) { // TODO: localize this string altNamesText.append("Subject(alt): ").append(name).append(",...\n") } else if (name.startsWith("*.") &amp;&amp; ( incomingServerHost.endsWith(name.substring(2)) || outgoingServerHost.endsWith(name.substring(2)) ) ) { // TODO: localize this string altNamesText.append("Subject(alt): ").append(name).append(",...\n") } }</ID>
<ID>LoopWithTooManyJumpStatements:HttpUriParser.kt$HttpUriParser$while (currentPos &lt; text.length) { val c = text[currentPos] if (isHexDigit(c)) { shouldBeHex = (shouldBeHex - 1).coerceAtLeast(0) } else if (shouldBeHex == 0) { if (c in allowedCharacters) { // Everything ok here :) } else if (c == '%') { shouldBeHex = 2 } else { break } } else { break } currentPos++ }</ID>
<ID>LoopWithTooManyJumpStatements:RealImapStore.kt$RealImapStore$for (listResponse in listResponses) { val serverId = listResponse.name if (pathDelimiter == null) { pathDelimiter = listResponse.hierarchyDelimiter combinedPrefix = null } if (RealImapFolder.INBOX.equals(serverId, ignoreCase = true)) { continue } else if (listResponse.hasAttribute("\\NoSelect")) { continue } val name = getFolderDisplayName(serverId) val oldServerId = getOldServerId(serverId) val type = when { listResponse.hasAttribute("\\Archive") -&gt; FolderType.ARCHIVE listResponse.hasAttribute("\\All") -&gt; FolderType.ARCHIVE listResponse.hasAttribute("\\Drafts") -&gt; FolderType.DRAFTS listResponse.hasAttribute("\\Sent") -&gt; FolderType.SENT listResponse.hasAttribute("\\Junk") -&gt; FolderType.SPAM listResponse.hasAttribute("\\Trash") -&gt; FolderType.TRASH else -&gt; FolderType.REGULAR } val existingItem = folderMap[serverId] if (existingItem == null || existingItem.type == FolderType.REGULAR) { folderMap[serverId] = FolderListItem(serverId, name, type, oldServerId) } }</ID>
@ -464,8 +461,6 @@
<ID>MagicNumber:ThemeManager.kt$ThemeManager$28</ID>
<ID>MagicNumber:ThreadMessageOperations.kt$ThreadMessageOperations$3</ID>
<ID>MagicNumber:TimberLogger.kt$TimberLogger$26</ID>
<ID>MagicNumber:Typography.kt$0.5</ID>
<ID>MagicNumber:Typography.kt$1.5</ID>
<ID>MagicNumber:UidValidityResponse.kt$UidValidityResponse.Companion$0xFFFFFFFFL</ID>
<ID>MagicNumber:Utf8.kt$0x010000</ID>
<ID>MagicNumber:Utf8.kt$0x10000</ID>

View File

@ -13,15 +13,19 @@ data class Colors(
val secondaryVariant: Color,
val background: Color,
val surface: Color,
val success: Color,
val error: Color,
val warning: Color,
val info: Color,
val onPrimary: Color,
val onSecondary: Color,
val onBackground: Color,
val onSurface: Color,
val onError: Color,
val onMessage: Color,
val isLight: Boolean,
)
@Suppress("LongParameterList")
internal fun lightColors(
primary: Color = MaterialColor.deep_purple_600,
primaryVariant: Color = MaterialColor.deep_purple_900,
@ -29,12 +33,15 @@ internal fun lightColors(
secondaryVariant: Color = MaterialColor.cyan_800,
background: Color = MaterialColor.gray_200,
surface: Color = Color.White,
success: Color = MaterialColor.green_600,
error: Color = MaterialColor.red_600,
warning: Color = MaterialColor.orange_600,
info: Color = MaterialColor.yellow_600,
onPrimary: Color = Color.White,
onSecondary: Color = Color.Black,
onBackground: Color = Color.Black,
onSurface: Color = Color.Black,
onError: Color = Color.White,
onMessage: Color = Color.White,
) = Colors(
primary = primary,
primaryVariant = primaryVariant,
@ -42,15 +49,19 @@ internal fun lightColors(
secondaryVariant = secondaryVariant,
background = background,
surface = surface,
success = success,
error = error,
warning = warning,
info = info,
onPrimary = onPrimary,
onSecondary = onSecondary,
onBackground = onBackground,
onSurface = onSurface,
onError = onError,
onMessage = onMessage,
isLight = true,
)
@Suppress("LongParameterList")
internal fun darkColors(
primary: Color = MaterialColor.deep_purple_200,
primaryVariant: Color = MaterialColor.deep_purple_50,
@ -58,12 +69,15 @@ internal fun darkColors(
secondaryVariant: Color = MaterialColor.cyan_100,
background: Color = MaterialColor.gray_800,
surface: Color = MaterialColor.gray_900,
success: Color = MaterialColor.green_300,
error: Color = MaterialColor.red_300,
warning: Color = MaterialColor.orange_300,
info: Color = MaterialColor.yellow_300,
onPrimary: Color = Color.Black,
onSecondary: Color = Color.Black,
onBackground: Color = Color.White,
onSurface: Color = Color.White,
onError: Color = Color.Black,
onMessage: Color = Color.Black,
) = Colors(
primary = primary,
primaryVariant = primaryVariant,
@ -71,12 +85,15 @@ internal fun darkColors(
secondaryVariant = secondaryVariant,
background = background,
surface = surface,
success = success,
error = error,
warning = warning,
info = info,
onPrimary = onPrimary,
onSecondary = onSecondary,
onBackground = onBackground,
onSurface = onSurface,
onError = onError,
onMessage = onMessage,
isLight = false,
)
@ -93,7 +110,7 @@ internal fun Colors.toMaterialColors(): MaterialColors {
onSecondary = onSecondary,
onBackground = onBackground,
onSurface = onSurface,
onError = onError,
onError = onMessage,
isLight = isLight,
)
}

View File

@ -6,6 +6,7 @@ import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.sp
@Suppress("MagicNumber")
val typography = typographyFromDefaults(
h1 = TextStyle(
fontFamily = FontFamily.Default,
@ -87,6 +88,7 @@ val typography = typographyFromDefaults(
),
)
@Suppress("LongParameterList")
fun typographyFromDefaults(
h1: TextStyle,
h2: TextStyle,