You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.2 KiB
48 lines
1.2 KiB
package org.jetbrains.compose.resources |
|
|
|
import androidx.compose.runtime.Immutable |
|
|
|
@RequiresOptIn("This API is experimental and is likely to change in the future.") |
|
annotation class ExperimentalResourceApi |
|
|
|
/** |
|
* Represents a resource with an ID and a set of resource items. |
|
* |
|
* @property id The ID of the resource. |
|
* @property items The set of resource items associated with the resource. |
|
*/ |
|
@Immutable |
|
sealed class Resource( |
|
internal val id: String, |
|
internal val items: Set<ResourceItem> |
|
) { |
|
override fun equals(other: Any?): Boolean { |
|
if (this === other) return true |
|
if (other == null || this::class != other::class) return false |
|
|
|
other as Resource |
|
|
|
return id == other.id |
|
} |
|
|
|
override fun hashCode(): Int { |
|
return id.hashCode() |
|
} |
|
} |
|
|
|
/** |
|
* Represents a resource item with qualifiers and a path. |
|
* |
|
* @property qualifiers The qualifiers of the resource item. |
|
* @property path The path of the resource item. |
|
*/ |
|
@Immutable |
|
data class ResourceItem( |
|
internal val qualifiers: Set<String>, |
|
internal val path: String |
|
) |
|
|
|
internal fun Resource.getPathByEnvironment(): String { |
|
//TODO |
|
return items.first().path |
|
} |