Browse Source

[resources] Use regular classes for resource qualifiers. (#4892)

To avoid data classes in the public API.
pull/4901/head
Konstantin 7 months ago committed by GitHub
parent
commit
bf47d0b9e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 42
      components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/Qualifier.kt

42
components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/Qualifier.kt

@ -3,14 +3,48 @@ package org.jetbrains.compose.resources
interface Qualifier interface Qualifier
@InternalResourceApi @InternalResourceApi
data class LanguageQualifier( class LanguageQualifier(
val language: String val language: String
) : Qualifier ) : Qualifier {
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other == null || this::class != other::class) return false
other as LanguageQualifier
return language == other.language
}
override fun hashCode(): Int {
return language.hashCode()
}
override fun toString(): String {
return "LanguageQualifier(language='$language')"
}
}
@InternalResourceApi @InternalResourceApi
data class RegionQualifier( class RegionQualifier(
val region: String val region: String
) : Qualifier ) : Qualifier {
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other == null || this::class != other::class) return false
other as RegionQualifier
return region == other.region
}
override fun hashCode(): Int {
return region.hashCode()
}
override fun toString(): String {
return "RegionQualifier(region='$region')"
}
}
@InternalResourceApi @InternalResourceApi
enum class ThemeQualifier : Qualifier { enum class ThemeQualifier : Qualifier {

Loading…
Cancel
Save