0.6.0
This commit is contained in:
1
core/data/.gitignore
vendored
Normal file
1
core/data/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
build
|
||||
22
core/data/build.gradle.kts
Normal file
22
core/data/build.gradle.kts
Normal file
@@ -0,0 +1,22 @@
|
||||
plugins {
|
||||
alias(libs.plugins.kotlin.android)
|
||||
alias(libs.plugins.android.library)
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "it.hamy.compose.core.data"
|
||||
compileSdk = 34
|
||||
|
||||
defaultConfig {
|
||||
minSdk = 21
|
||||
}
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvmToolchain(libs.versions.jvm.get().toInt())
|
||||
}
|
||||
|
||||
dependencies {
|
||||
detektPlugins(libs.detekt.compose)
|
||||
detektPlugins(libs.detekt.formatting)
|
||||
}
|
||||
4
core/data/src/main/AndroidManifest.xml
Normal file
4
core/data/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest>
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,7 @@
|
||||
package it.hamy.muza.enums
|
||||
|
||||
enum class AlbumSortBy {
|
||||
Title,
|
||||
Year,
|
||||
DateAdded
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package it.hamy.muza.enums
|
||||
|
||||
enum class ArtistSortBy {
|
||||
Name,
|
||||
DateAdded
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package it.hamy.muza.enums
|
||||
|
||||
enum class BuiltInPlaylist {
|
||||
Favorites,
|
||||
Offline,
|
||||
Top
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package it.hamy.muza.enums
|
||||
|
||||
import it.hamy.muza.utils.mb
|
||||
|
||||
@Suppress("unused", "EnumEntryName")
|
||||
enum class CoilDiskCacheSize(val bytes: Long) {
|
||||
`64MB`(bytes = 64.mb),
|
||||
`128MB`(bytes = 128.mb),
|
||||
`256MB`(bytes = 256.mb),
|
||||
`512MB`(bytes = 512.mb),
|
||||
`1GB`(bytes = 1024.mb),
|
||||
`2GB`(bytes = 2048.mb)
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package it.hamy.muza.enums
|
||||
|
||||
import it.hamy.muza.utils.mb
|
||||
|
||||
@Suppress("EnumEntryName", "unused")
|
||||
enum class ExoPlayerDiskCacheSize(val bytes: Long) {
|
||||
`32MB`(bytes = 32.mb),
|
||||
`64MB`(bytes = 64.mb),
|
||||
`128MB`(bytes = 128.mb),
|
||||
`256MB`(bytes = 256.mb),
|
||||
`512MB`(bytes = 512.mb),
|
||||
`1GB`(bytes = 1024.mb),
|
||||
`2GB`(bytes = 2048.mb),
|
||||
`4GB`(bytes = 4096.mb),
|
||||
`8GB`(bytes = 8192.mb),
|
||||
Unlimited(bytes = 0)
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package it.hamy.muza.enums
|
||||
|
||||
enum class PlaylistSortBy {
|
||||
Name,
|
||||
DateAdded,
|
||||
SongCount
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package it.hamy.muza.enums
|
||||
|
||||
enum class SongSortBy {
|
||||
PlayTime,
|
||||
Title,
|
||||
DateAdded
|
||||
}
|
||||
11
core/data/src/main/kotlin/it/hamy/muza/enums/SortOrder.kt
Normal file
11
core/data/src/main/kotlin/it/hamy/muza/enums/SortOrder.kt
Normal file
@@ -0,0 +1,11 @@
|
||||
package it.hamy.muza.enums
|
||||
|
||||
enum class SortOrder {
|
||||
Ascending,
|
||||
Descending;
|
||||
|
||||
operator fun not() = when (this) {
|
||||
Ascending -> Descending
|
||||
Descending -> Ascending
|
||||
}
|
||||
}
|
||||
3
core/data/src/main/kotlin/it/hamy/muza/utils/Bytes.kt
Normal file
3
core/data/src/main/kotlin/it/hamy/muza/utils/Bytes.kt
Normal file
@@ -0,0 +1,3 @@
|
||||
package it.hamy.muza.utils
|
||||
|
||||
val Int.mb get() = this * 1_048_576L
|
||||
20
core/data/src/main/kotlin/it/hamy/muza/utils/Versions.kt
Normal file
20
core/data/src/main/kotlin/it/hamy/muza/utils/Versions.kt
Normal file
@@ -0,0 +1,20 @@
|
||||
package it.hamy.muza.utils
|
||||
|
||||
inline val String.version get() = Version(value = this)
|
||||
|
||||
@JvmInline
|
||||
value class Version(private val parts: List<Int>) {
|
||||
constructor(value: String) : this(value.split(".").mapNotNull { it.toIntOrNull() })
|
||||
|
||||
val major get() = parts.firstOrNull()
|
||||
val minor get() = parts.getOrNull(1)
|
||||
val patch get() = parts.getOrNull(2)
|
||||
|
||||
companion object {
|
||||
private val comparator = compareBy<Version> { it.major } then
|
||||
compareBy { it.minor } then
|
||||
compareBy { it.patch }
|
||||
}
|
||||
|
||||
operator fun compareTo(other: Version) = comparator.compare(this, other)
|
||||
}
|
||||
Reference in New Issue
Block a user