This commit is contained in:
2024-02-27 22:09:30 +03:00
parent bfa3231823
commit 38a3141d43
479 changed files with 36348 additions and 10142 deletions

1
core/data/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
build

View 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)
}

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest>
</manifest>

View File

@@ -0,0 +1,7 @@
package it.hamy.muza.enums
enum class AlbumSortBy {
Title,
Year,
DateAdded
}

View File

@@ -0,0 +1,6 @@
package it.hamy.muza.enums
enum class ArtistSortBy {
Name,
DateAdded
}

View File

@@ -0,0 +1,7 @@
package it.hamy.muza.enums
enum class BuiltInPlaylist {
Favorites,
Offline,
Top
}

View File

@@ -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)
}

View File

@@ -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)
}

View File

@@ -0,0 +1,7 @@
package it.hamy.muza.enums
enum class PlaylistSortBy {
Name,
DateAdded,
SongCount
}

View File

@@ -0,0 +1,7 @@
package it.hamy.muza.enums
enum class SongSortBy {
PlayTime,
Title,
DateAdded
}

View File

@@ -0,0 +1,11 @@
package it.hamy.muza.enums
enum class SortOrder {
Ascending,
Descending;
operator fun not() = when (this) {
Ascending -> Descending
Descending -> Ascending
}
}

View File

@@ -0,0 +1,3 @@
package it.hamy.muza.utils
val Int.mb get() = this * 1_048_576L

View 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)
}