From 05f9ae143834638f472d790e53594f2be4eae27e Mon Sep 17 00:00:00 2001 From: Shivam <69040506+brahmkshatriya@users.noreply.github.com> Date: Mon, 19 Feb 2024 19:38:52 +0530 Subject: [PATCH] Switch to common library (#4) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * We playing with extenzion with this one 🗣️🗣️🔥🔥 * Move to library * Actually Move to library * Remove Local Extenzion * Remove library dependency --- app/build.gradle.kts | 4 ++ .../echo/data/clients/AlbumClient.kt | 12 ---- .../echo/data/clients/ArtistClient.kt | 11 ---- .../echo/data/clients/HomeFeedClient.kt | 11 ---- .../echo/data/clients/PlaylistClient.kt | 7 --- .../echo/data/clients/RadioClient.kt | 13 ---- .../echo/data/clients/SearchClient.kt | 11 ---- .../echo/data/clients/TrackClient.kt | 11 ---- .../echo/data/clients/UserClient.kt | 21 ------- .../data/extensions/LocalExtensionRepo.kt | 12 ++++ .../echo/data/extensions/OfflineExtension.kt | 44 +++++++++----- .../brahmkshatriya/echo/data/models/Album.kt | 31 ---------- .../brahmkshatriya/echo/data/models/Artist.kt | 26 -------- .../echo/data/models/EchoMediaItem.kt | 34 ----------- .../echo/data/models/ImageHolder.kt | 25 -------- .../echo/data/models/MediaItemsContainer.kt | 13 ---- .../echo/data/models/Playlist.kt | 29 --------- .../echo/data/models/QuickSearchItem.kt | 6 -- .../echo/data/models/StreamableAudio.kt | 16 ----- .../brahmkshatriya/echo/data/models/Track.kt | 15 ----- .../brahmkshatriya/echo/data/models/User.kt | 16 ----- .../echo/data/offline/LocalAlbum.kt | 16 ++--- .../echo/data/offline/LocalArtist.kt | 10 ++-- .../echo/data/offline/LocalHelper.kt | 2 +- .../echo/data/offline/LocalStream.kt | 4 +- .../echo/data/offline/LocalTrack.kt | 20 +++---- .../echo/di/ContextProviderForRepo.kt | 17 ++++++ .../brahmkshatriya/echo/di/PluginModule.kt | 59 +++++++++++++++---- .../echo/player/PlaybackService.kt | 4 +- .../echo/player/PlayerHelper.kt | 6 +- .../echo/player/PlayerListener.kt | 2 +- .../echo/player/PlayerSessionCallback.kt | 8 +-- .../echo/player/PlayerUIViewModel.kt | 2 +- .../echo/player/PlayerViewModel.kt | 6 +- .../echo/ui/adapters/MediaItemAdapter.kt | 4 +- .../ui/adapters/MediaItemsContainerAdapter.kt | 14 +++-- .../echo/ui/home/HomeFragment.kt | 2 +- .../echo/ui/home/HomeViewModel.kt | 4 +- .../echo/ui/search/SearchFragment.kt | 2 +- .../echo/ui/search/SearchViewModel.kt | 4 +- .../echo/ui/utils/ImageLoading.kt | 2 +- settings.gradle.kts | 2 +- 42 files changed, 167 insertions(+), 391 deletions(-) delete mode 100644 app/src/main/java/dev/brahmkshatriya/echo/data/clients/AlbumClient.kt delete mode 100644 app/src/main/java/dev/brahmkshatriya/echo/data/clients/ArtistClient.kt delete mode 100644 app/src/main/java/dev/brahmkshatriya/echo/data/clients/HomeFeedClient.kt delete mode 100644 app/src/main/java/dev/brahmkshatriya/echo/data/clients/PlaylistClient.kt delete mode 100644 app/src/main/java/dev/brahmkshatriya/echo/data/clients/RadioClient.kt delete mode 100644 app/src/main/java/dev/brahmkshatriya/echo/data/clients/SearchClient.kt delete mode 100644 app/src/main/java/dev/brahmkshatriya/echo/data/clients/TrackClient.kt delete mode 100644 app/src/main/java/dev/brahmkshatriya/echo/data/clients/UserClient.kt create mode 100644 app/src/main/java/dev/brahmkshatriya/echo/data/extensions/LocalExtensionRepo.kt delete mode 100644 app/src/main/java/dev/brahmkshatriya/echo/data/models/Album.kt delete mode 100644 app/src/main/java/dev/brahmkshatriya/echo/data/models/Artist.kt delete mode 100644 app/src/main/java/dev/brahmkshatriya/echo/data/models/EchoMediaItem.kt delete mode 100644 app/src/main/java/dev/brahmkshatriya/echo/data/models/ImageHolder.kt delete mode 100644 app/src/main/java/dev/brahmkshatriya/echo/data/models/MediaItemsContainer.kt delete mode 100644 app/src/main/java/dev/brahmkshatriya/echo/data/models/Playlist.kt delete mode 100644 app/src/main/java/dev/brahmkshatriya/echo/data/models/QuickSearchItem.kt delete mode 100644 app/src/main/java/dev/brahmkshatriya/echo/data/models/StreamableAudio.kt delete mode 100644 app/src/main/java/dev/brahmkshatriya/echo/data/models/Track.kt delete mode 100644 app/src/main/java/dev/brahmkshatriya/echo/data/models/User.kt create mode 100644 app/src/main/java/dev/brahmkshatriya/echo/di/ContextProviderForRepo.kt diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 527aa74f..582cb3cb 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -45,6 +45,10 @@ android { } dependencies { + + implementation("com.github.brahmkshatriya:echo-common:0.0.1") + implementation("com.github.JeelPatel231:plugger:1.0.1") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-guava:1.7.1") implementation("androidx.appcompat:appcompat:1.6.1") diff --git a/app/src/main/java/dev/brahmkshatriya/echo/data/clients/AlbumClient.kt b/app/src/main/java/dev/brahmkshatriya/echo/data/clients/AlbumClient.kt deleted file mode 100644 index c3a80bda..00000000 --- a/app/src/main/java/dev/brahmkshatriya/echo/data/clients/AlbumClient.kt +++ /dev/null @@ -1,12 +0,0 @@ -package dev.brahmkshatriya.echo.data.clients - -import androidx.paging.PagingData -import dev.brahmkshatriya.echo.data.models.Album -import dev.brahmkshatriya.echo.data.models.MediaItemsContainer -import kotlinx.coroutines.flow.Flow - -interface AlbumClient { - suspend fun loadAlbum(small: Album.Small): Album.Full - suspend fun getMediaItems(album: Album.Small): Flow> - -} \ No newline at end of file diff --git a/app/src/main/java/dev/brahmkshatriya/echo/data/clients/ArtistClient.kt b/app/src/main/java/dev/brahmkshatriya/echo/data/clients/ArtistClient.kt deleted file mode 100644 index 9a76b284..00000000 --- a/app/src/main/java/dev/brahmkshatriya/echo/data/clients/ArtistClient.kt +++ /dev/null @@ -1,11 +0,0 @@ -package dev.brahmkshatriya.echo.data.clients - -import androidx.paging.PagingData -import dev.brahmkshatriya.echo.data.models.Artist -import dev.brahmkshatriya.echo.data.models.MediaItemsContainer -import kotlinx.coroutines.flow.Flow - -interface ArtistClient { - suspend fun loadArtist(small: Artist.Small): Artist.Full - suspend fun getMediaItems(artist: Artist.Full): Flow> -} \ No newline at end of file diff --git a/app/src/main/java/dev/brahmkshatriya/echo/data/clients/HomeFeedClient.kt b/app/src/main/java/dev/brahmkshatriya/echo/data/clients/HomeFeedClient.kt deleted file mode 100644 index 47f56d77..00000000 --- a/app/src/main/java/dev/brahmkshatriya/echo/data/clients/HomeFeedClient.kt +++ /dev/null @@ -1,11 +0,0 @@ -package dev.brahmkshatriya.echo.data.clients - -import androidx.paging.PagingData -import dev.brahmkshatriya.echo.data.models.MediaItemsContainer -import kotlinx.coroutines.flow.Flow - -interface HomeFeedClient { - suspend fun getHomeGenres() : List - suspend fun getHomeFeed(genre:String?) : Flow> - -} \ No newline at end of file diff --git a/app/src/main/java/dev/brahmkshatriya/echo/data/clients/PlaylistClient.kt b/app/src/main/java/dev/brahmkshatriya/echo/data/clients/PlaylistClient.kt deleted file mode 100644 index e7d7b734..00000000 --- a/app/src/main/java/dev/brahmkshatriya/echo/data/clients/PlaylistClient.kt +++ /dev/null @@ -1,7 +0,0 @@ -package dev.brahmkshatriya.echo.data.clients - -import dev.brahmkshatriya.echo.data.models.Playlist - -interface PlaylistClient { - suspend fun loadPlaylist(playlist: Playlist.Small): Playlist.Full -} \ No newline at end of file diff --git a/app/src/main/java/dev/brahmkshatriya/echo/data/clients/RadioClient.kt b/app/src/main/java/dev/brahmkshatriya/echo/data/clients/RadioClient.kt deleted file mode 100644 index aef3cc2c..00000000 --- a/app/src/main/java/dev/brahmkshatriya/echo/data/clients/RadioClient.kt +++ /dev/null @@ -1,13 +0,0 @@ -package dev.brahmkshatriya.echo.data.clients - -import dev.brahmkshatriya.echo.data.models.Album -import dev.brahmkshatriya.echo.data.models.Artist -import dev.brahmkshatriya.echo.data.models.Playlist -import dev.brahmkshatriya.echo.data.models.Track - -interface RadioClient { - suspend fun radio(track: Track): Playlist.Full - suspend fun radio(album: Album.Small): Playlist.Full - suspend fun radio(artist: Artist.Small): Playlist.Full - suspend fun radio(playlist: Playlist.Small): Playlist.Full -} \ No newline at end of file diff --git a/app/src/main/java/dev/brahmkshatriya/echo/data/clients/SearchClient.kt b/app/src/main/java/dev/brahmkshatriya/echo/data/clients/SearchClient.kt deleted file mode 100644 index 308ebe18..00000000 --- a/app/src/main/java/dev/brahmkshatriya/echo/data/clients/SearchClient.kt +++ /dev/null @@ -1,11 +0,0 @@ -package dev.brahmkshatriya.echo.data.clients - -import androidx.paging.PagingData -import dev.brahmkshatriya.echo.data.models.MediaItemsContainer -import dev.brahmkshatriya.echo.data.models.QuickSearchItem -import kotlinx.coroutines.flow.Flow - -interface SearchClient { - suspend fun quickSearch(query: String): List - suspend fun search(query: String): Flow> -} \ No newline at end of file diff --git a/app/src/main/java/dev/brahmkshatriya/echo/data/clients/TrackClient.kt b/app/src/main/java/dev/brahmkshatriya/echo/data/clients/TrackClient.kt deleted file mode 100644 index 851eac16..00000000 --- a/app/src/main/java/dev/brahmkshatriya/echo/data/clients/TrackClient.kt +++ /dev/null @@ -1,11 +0,0 @@ -package dev.brahmkshatriya.echo.data.clients - -import android.net.Uri -import dev.brahmkshatriya.echo.data.models.StreamableAudio -import dev.brahmkshatriya.echo.data.models.Track - -interface TrackClient { - suspend fun getTrack(uri: Uri): Track? - suspend fun getStreamable(track: Track): StreamableAudio - -} \ No newline at end of file diff --git a/app/src/main/java/dev/brahmkshatriya/echo/data/clients/UserClient.kt b/app/src/main/java/dev/brahmkshatriya/echo/data/clients/UserClient.kt deleted file mode 100644 index 09780e0a..00000000 --- a/app/src/main/java/dev/brahmkshatriya/echo/data/clients/UserClient.kt +++ /dev/null @@ -1,21 +0,0 @@ -package dev.brahmkshatriya.echo.data.clients - -import androidx.paging.PagingData -import dev.brahmkshatriya.echo.data.models.Artist -import dev.brahmkshatriya.echo.data.models.Playlist -import dev.brahmkshatriya.echo.data.models.Track -import dev.brahmkshatriya.echo.data.models.User -import kotlinx.coroutines.flow.Flow - -interface UserClient { - suspend fun login(data:String) - suspend fun logout() - suspend fun user() : User.WithCover? - suspend fun likedTracks() : Flow> - suspend fun playlists() : Flow> - suspend fun createPlaylist(name:String, description:String?, tracks: List) : Playlist.WithCover - suspend fun like(track: Track): Boolean - suspend fun unlike(track: Track): Boolean - suspend fun subscribe(artist: Artist.Small): Boolean - suspend fun unsubscribe(artist: Artist.Small): Boolean -} \ No newline at end of file diff --git a/app/src/main/java/dev/brahmkshatriya/echo/data/extensions/LocalExtensionRepo.kt b/app/src/main/java/dev/brahmkshatriya/echo/data/extensions/LocalExtensionRepo.kt new file mode 100644 index 00000000..d99fcdfd --- /dev/null +++ b/app/src/main/java/dev/brahmkshatriya/echo/data/extensions/LocalExtensionRepo.kt @@ -0,0 +1,12 @@ +package dev.brahmkshatriya.echo.data.extensions + +import dev.brahmkshatriya.echo.common.clients.ExtensionClient +import dev.brahmkshatriya.echo.common.data.extensions.OfflineExtension +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.flowOf +import tel.jeelpa.plugger.PluginRepo + +class LocalExtensionRepo : PluginRepo { + override fun getAllPlugins(): Flow> = + flowOf(listOf(OfflineExtension())) +} \ No newline at end of file diff --git a/app/src/main/java/dev/brahmkshatriya/echo/data/extensions/OfflineExtension.kt b/app/src/main/java/dev/brahmkshatriya/echo/data/extensions/OfflineExtension.kt index a2cd931f..dd3f878c 100644 --- a/app/src/main/java/dev/brahmkshatriya/echo/data/extensions/OfflineExtension.kt +++ b/app/src/main/java/dev/brahmkshatriya/echo/data/extensions/OfflineExtension.kt @@ -1,4 +1,4 @@ -package dev.brahmkshatriya.echo.data.extensions +package dev.brahmkshatriya.echo.common.data.extensions import android.content.Context import android.net.Uri @@ -7,25 +7,36 @@ import androidx.paging.PagingConfig import androidx.paging.PagingData import androidx.paging.PagingSource import androidx.paging.PagingState -import dev.brahmkshatriya.echo.data.clients.HomeFeedClient -import dev.brahmkshatriya.echo.data.clients.SearchClient -import dev.brahmkshatriya.echo.data.clients.TrackClient -import dev.brahmkshatriya.echo.data.models.EchoMediaItem.Companion.toMediaItem -import dev.brahmkshatriya.echo.data.models.EchoMediaItem.Companion.toMediaItemsContainer -import dev.brahmkshatriya.echo.data.models.MediaItemsContainer -import dev.brahmkshatriya.echo.data.models.QuickSearchItem -import dev.brahmkshatriya.echo.data.models.StreamableAudio -import dev.brahmkshatriya.echo.data.models.StreamableAudio.Companion.toAudio -import dev.brahmkshatriya.echo.data.models.Track -import dev.brahmkshatriya.echo.data.offline.LocalAlbum -import dev.brahmkshatriya.echo.data.offline.LocalArtist -import dev.brahmkshatriya.echo.data.offline.LocalStream -import dev.brahmkshatriya.echo.data.offline.LocalTrack +import dev.brahmkshatriya.echo.common.clients.ExtensionClient +import dev.brahmkshatriya.echo.common.clients.HomeFeedClient +import dev.brahmkshatriya.echo.common.clients.SearchClient +import dev.brahmkshatriya.echo.common.clients.TrackClient +import dev.brahmkshatriya.echo.common.models.EchoMediaItem.Companion.toMediaItem +import dev.brahmkshatriya.echo.common.models.EchoMediaItem.Companion.toMediaItemsContainer +import dev.brahmkshatriya.echo.common.models.ExtensionMetadata +import dev.brahmkshatriya.echo.common.models.MediaItemsContainer +import dev.brahmkshatriya.echo.common.models.QuickSearchItem +import dev.brahmkshatriya.echo.common.models.StreamableAudio +import dev.brahmkshatriya.echo.common.models.StreamableAudio.Companion.toAudio +import dev.brahmkshatriya.echo.common.models.Track +import dev.brahmkshatriya.echo.common.data.offline.LocalAlbum +import dev.brahmkshatriya.echo.common.data.offline.LocalArtist +import dev.brahmkshatriya.echo.common.data.offline.LocalStream +import dev.brahmkshatriya.echo.common.data.offline.LocalTrack import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flow import java.io.IOException -class OfflineExtension(val context: Context) : SearchClient, TrackClient, HomeFeedClient { +class OfflineExtension : ExtensionClient(), SearchClient, TrackClient, HomeFeedClient { + + override fun getMetadata() = ExtensionMetadata( + name = "Offline", + version = "1.0.0", + description = "Local media library", + author = "Echo", + iconUrl = null + ) + override suspend fun quickSearch(query: String): List = listOf() override suspend fun search(query: String): Flow> = flow { @@ -109,4 +120,5 @@ class OfflineExtension(val context: Context) : SearchClient, TrackClient, HomeFe pagingSourceFactory = { OfflinePagingSource(context) } ).flow + } \ No newline at end of file diff --git a/app/src/main/java/dev/brahmkshatriya/echo/data/models/Album.kt b/app/src/main/java/dev/brahmkshatriya/echo/data/models/Album.kt deleted file mode 100644 index dc42cecc..00000000 --- a/app/src/main/java/dev/brahmkshatriya/echo/data/models/Album.kt +++ /dev/null @@ -1,31 +0,0 @@ -package dev.brahmkshatriya.echo.data.models - -import android.net.Uri - -sealed class Album { - - open class Small( - open val uri: Uri, - open val title: String - ) - - open class WithCover( - override val uri: Uri, - override val title: String, - open val cover: ImageHolder?, - open val artists: List, - ) : Small(uri, title) - - data class Full( - override val uri: Uri, - override val title: String, - override val cover: ImageHolder?, - override val artists: List, - val tracks: List, - val releaseDate: String?, - val publisher: String?, - val duration: Long?, - val description: String?, - ) : WithCover(uri, title, cover, artists) - -} diff --git a/app/src/main/java/dev/brahmkshatriya/echo/data/models/Artist.kt b/app/src/main/java/dev/brahmkshatriya/echo/data/models/Artist.kt deleted file mode 100644 index bbb849f9..00000000 --- a/app/src/main/java/dev/brahmkshatriya/echo/data/models/Artist.kt +++ /dev/null @@ -1,26 +0,0 @@ -package dev.brahmkshatriya.echo.data.models - -import android.net.Uri - -sealed class Artist { - - open class Small( - open val uri: Uri, - open val name: String - ) - - open class WithCover( - override val uri: Uri, - override val name: String, - open val cover: ImageHolder? - ) : Small(uri, name) - - data class Full( - override val uri: Uri, - override val name: String, - override val cover: ImageHolder?, - val description: String?, - val followers: Int? = null, - ) : WithCover(uri, name, cover) - -} \ No newline at end of file diff --git a/app/src/main/java/dev/brahmkshatriya/echo/data/models/EchoMediaItem.kt b/app/src/main/java/dev/brahmkshatriya/echo/data/models/EchoMediaItem.kt deleted file mode 100644 index 45202f42..00000000 --- a/app/src/main/java/dev/brahmkshatriya/echo/data/models/EchoMediaItem.kt +++ /dev/null @@ -1,34 +0,0 @@ -package dev.brahmkshatriya.echo.data.models - -sealed class EchoMediaItem { - data class TrackItem(val track: Track) : EchoMediaItem() - data class AlbumItem(val album: Album.WithCover) : EchoMediaItem() - data class ArtistItem(val artist: Artist.WithCover) : EchoMediaItem() - data class PlaylistItem(val playlist: Playlist.WithCover) : EchoMediaItem() - - companion object { - fun Track.toMediaItem() = TrackItem(this) - fun Album.WithCover.toMediaItem() = AlbumItem(this) - fun Artist.WithCover.toMediaItem() = ArtistItem(this) - fun Playlist.WithCover.toMediaItem() = PlaylistItem(this) - - fun List.toMediaItemsContainer(title: String, subtitle: String? = null) - = MediaItemsContainer.Category(title, this, subtitle) - } - - override fun equals(other: Any?): Boolean { - if(other is EchoMediaItem) { - return when(this) { - is TrackItem -> this.track.uri == (other as? TrackItem)?.track?.uri - is AlbumItem -> this.album.uri == (other as? AlbumItem)?.album?.uri - is ArtistItem -> this.artist.uri == (other as? ArtistItem)?.artist?.uri - is PlaylistItem -> this.playlist.uri == (other as? PlaylistItem)?.playlist?.uri - } - } - return false - } - - override fun hashCode(): Int { - return javaClass.hashCode() - } -} \ No newline at end of file diff --git a/app/src/main/java/dev/brahmkshatriya/echo/data/models/ImageHolder.kt b/app/src/main/java/dev/brahmkshatriya/echo/data/models/ImageHolder.kt deleted file mode 100644 index cddbb042..00000000 --- a/app/src/main/java/dev/brahmkshatriya/echo/data/models/ImageHolder.kt +++ /dev/null @@ -1,25 +0,0 @@ -package dev.brahmkshatriya.echo.data.models - -import android.graphics.Bitmap -import android.net.Uri - -sealed class ImageHolder { - data class UrlHolder(val url: String, val headers: Map) : ImageHolder() - data class UriHolder(val uri: Uri) : ImageHolder() - data class BitmapHolder(val bitmap: Bitmap) : ImageHolder() - - companion object { - fun Uri.toImageHolder(): UriHolder { - return UriHolder(this) - } - - fun String.toImageHolder(headers: Map? = null): UrlHolder { - return UrlHolder(this, headers ?: mapOf()) - } - - fun Bitmap.toImageHolder(): BitmapHolder { - return BitmapHolder(this) - } - } -} - diff --git a/app/src/main/java/dev/brahmkshatriya/echo/data/models/MediaItemsContainer.kt b/app/src/main/java/dev/brahmkshatriya/echo/data/models/MediaItemsContainer.kt deleted file mode 100644 index bb0eda31..00000000 --- a/app/src/main/java/dev/brahmkshatriya/echo/data/models/MediaItemsContainer.kt +++ /dev/null @@ -1,13 +0,0 @@ -package dev.brahmkshatriya.echo.data.models - -sealed class MediaItemsContainer { - data class Category( - val title: String, - val list: List, - val subtitle: String? = null - ) : MediaItemsContainer() - - data class TrackItem( - val track: Track, - ) : MediaItemsContainer() -} \ No newline at end of file diff --git a/app/src/main/java/dev/brahmkshatriya/echo/data/models/Playlist.kt b/app/src/main/java/dev/brahmkshatriya/echo/data/models/Playlist.kt deleted file mode 100644 index 436a8cfb..00000000 --- a/app/src/main/java/dev/brahmkshatriya/echo/data/models/Playlist.kt +++ /dev/null @@ -1,29 +0,0 @@ -package dev.brahmkshatriya.echo.data.models - -import android.net.Uri - -sealed class Playlist { - - open class Small( - open val uri: Uri, - open val title: String, - ) - - open class WithCover( - override val uri: Uri, - override val title: String, - open val cover: ImageHolder? - ) : Small(uri, title) - - data class Full( - override val uri: Uri, - override val title: String, - override val cover: ImageHolder?, - val author: User?, - val tracks: List, - val creationDate: String?, - val duration: Long?, - val description: String?, - val genres: List = listOf(), - ) : WithCover(uri, title, cover) -} \ No newline at end of file diff --git a/app/src/main/java/dev/brahmkshatriya/echo/data/models/QuickSearchItem.kt b/app/src/main/java/dev/brahmkshatriya/echo/data/models/QuickSearchItem.kt deleted file mode 100644 index 66c8e6b6..00000000 --- a/app/src/main/java/dev/brahmkshatriya/echo/data/models/QuickSearchItem.kt +++ /dev/null @@ -1,6 +0,0 @@ -package dev.brahmkshatriya.echo.data.models - -sealed class QuickSearchItem { - data class SearchQueryItem(val query: String) : QuickSearchItem() - data class SearchMediaItem(val mediaItem: EchoMediaItem) : QuickSearchItem() -} \ No newline at end of file diff --git a/app/src/main/java/dev/brahmkshatriya/echo/data/models/StreamableAudio.kt b/app/src/main/java/dev/brahmkshatriya/echo/data/models/StreamableAudio.kt deleted file mode 100644 index 590bb39a..00000000 --- a/app/src/main/java/dev/brahmkshatriya/echo/data/models/StreamableAudio.kt +++ /dev/null @@ -1,16 +0,0 @@ -package dev.brahmkshatriya.echo.data.models - -import android.net.Uri -import dev.brahmkshatriya.echo.data.models.ImageHolder.Companion.toImageHolder -import java.io.InputStream - -sealed class StreamableAudio { - data class StreamableUrl(val url: ImageHolder.UrlHolder) : StreamableAudio() - data class StreamableFile(val uri: Uri) : StreamableAudio() - data class ByteStreamAudio(val stream: InputStream) : StreamableAudio() - - companion object{ - fun String?.toAudio() = this?.let { StreamableUrl(it.toImageHolder()) } - fun Uri?.toAudio() = this?.let { StreamableFile(it) } - } -} \ No newline at end of file diff --git a/app/src/main/java/dev/brahmkshatriya/echo/data/models/Track.kt b/app/src/main/java/dev/brahmkshatriya/echo/data/models/Track.kt deleted file mode 100644 index e313a45d..00000000 --- a/app/src/main/java/dev/brahmkshatriya/echo/data/models/Track.kt +++ /dev/null @@ -1,15 +0,0 @@ -package dev.brahmkshatriya.echo.data.models - -import android.net.Uri - -data class Track( - val uri: Uri, - val title: String, - val artists: List = listOf(), - val album: Album.Small?, - val cover: ImageHolder?, - val duration: Long?, - val plays: Int?, - val releaseDate: String?, - val liked: Boolean, -) \ No newline at end of file diff --git a/app/src/main/java/dev/brahmkshatriya/echo/data/models/User.kt b/app/src/main/java/dev/brahmkshatriya/echo/data/models/User.kt deleted file mode 100644 index f669eb91..00000000 --- a/app/src/main/java/dev/brahmkshatriya/echo/data/models/User.kt +++ /dev/null @@ -1,16 +0,0 @@ -package dev.brahmkshatriya.echo.data.models - -import android.net.Uri - -sealed class User { - open class Small( - open val uri: Uri, - open val name: String - ) - - open class WithCover( - override val uri: Uri, - override val name: String, - open val cover: ImageHolder?, - ) : Small(uri, name) -} \ No newline at end of file diff --git a/app/src/main/java/dev/brahmkshatriya/echo/data/offline/LocalAlbum.kt b/app/src/main/java/dev/brahmkshatriya/echo/data/offline/LocalAlbum.kt index 28aca2af..f294b69b 100644 --- a/app/src/main/java/dev/brahmkshatriya/echo/data/offline/LocalAlbum.kt +++ b/app/src/main/java/dev/brahmkshatriya/echo/data/offline/LocalAlbum.kt @@ -1,16 +1,16 @@ -package dev.brahmkshatriya.echo.data.offline +package dev.brahmkshatriya.echo.common.data.offline import android.content.ContentUris import android.content.Context import android.net.Uri import android.provider.MediaStore -import dev.brahmkshatriya.echo.data.models.Album -import dev.brahmkshatriya.echo.data.models.Artist -import dev.brahmkshatriya.echo.data.models.ImageHolder.Companion.toImageHolder -import dev.brahmkshatriya.echo.data.offline.LocalHelper.Companion.ALBUM_AUTH -import dev.brahmkshatriya.echo.data.offline.LocalHelper.Companion.ARTIST_AUTH -import dev.brahmkshatriya.echo.data.offline.LocalHelper.Companion.URI -import dev.brahmkshatriya.echo.data.offline.LocalHelper.Companion.createCursor +import dev.brahmkshatriya.echo.common.models.Album +import dev.brahmkshatriya.echo.common.models.Artist +import dev.brahmkshatriya.echo.common.models.ImageHolder.Companion.toImageHolder +import dev.brahmkshatriya.echo.common.data.offline.LocalHelper.Companion.ALBUM_AUTH +import dev.brahmkshatriya.echo.common.data.offline.LocalHelper.Companion.ARTIST_AUTH +import dev.brahmkshatriya.echo.common.data.offline.LocalHelper.Companion.URI +import dev.brahmkshatriya.echo.common.data.offline.LocalHelper.Companion.createCursor interface LocalAlbum { diff --git a/app/src/main/java/dev/brahmkshatriya/echo/data/offline/LocalArtist.kt b/app/src/main/java/dev/brahmkshatriya/echo/data/offline/LocalArtist.kt index 46134ba5..6e43152d 100644 --- a/app/src/main/java/dev/brahmkshatriya/echo/data/offline/LocalArtist.kt +++ b/app/src/main/java/dev/brahmkshatriya/echo/data/offline/LocalArtist.kt @@ -1,12 +1,12 @@ -package dev.brahmkshatriya.echo.data.offline +package dev.brahmkshatriya.echo.common.data.offline import android.content.Context import android.net.Uri import android.provider.MediaStore -import dev.brahmkshatriya.echo.data.models.Artist -import dev.brahmkshatriya.echo.data.offline.LocalHelper.Companion.ARTIST_AUTH -import dev.brahmkshatriya.echo.data.offline.LocalHelper.Companion.URI -import dev.brahmkshatriya.echo.data.offline.LocalHelper.Companion.createCursor +import dev.brahmkshatriya.echo.common.models.Artist +import dev.brahmkshatriya.echo.common.data.offline.LocalHelper.Companion.ARTIST_AUTH +import dev.brahmkshatriya.echo.common.data.offline.LocalHelper.Companion.URI +import dev.brahmkshatriya.echo.common.data.offline.LocalHelper.Companion.createCursor interface LocalArtist { diff --git a/app/src/main/java/dev/brahmkshatriya/echo/data/offline/LocalHelper.kt b/app/src/main/java/dev/brahmkshatriya/echo/data/offline/LocalHelper.kt index 5dcef627..ee821b4e 100644 --- a/app/src/main/java/dev/brahmkshatriya/echo/data/offline/LocalHelper.kt +++ b/app/src/main/java/dev/brahmkshatriya/echo/data/offline/LocalHelper.kt @@ -1,4 +1,4 @@ -package dev.brahmkshatriya.echo.data.offline +package dev.brahmkshatriya.echo.common.data.offline import android.content.ContentResolver import android.database.Cursor diff --git a/app/src/main/java/dev/brahmkshatriya/echo/data/offline/LocalStream.kt b/app/src/main/java/dev/brahmkshatriya/echo/data/offline/LocalStream.kt index 487905ca..2dcf55d6 100644 --- a/app/src/main/java/dev/brahmkshatriya/echo/data/offline/LocalStream.kt +++ b/app/src/main/java/dev/brahmkshatriya/echo/data/offline/LocalStream.kt @@ -1,9 +1,9 @@ -package dev.brahmkshatriya.echo.data.offline +package dev.brahmkshatriya.echo.common.data.offline import android.content.Context import android.net.Uri import android.provider.MediaStore -import dev.brahmkshatriya.echo.data.models.Track +import dev.brahmkshatriya.echo.common.models.Track interface LocalStream { companion object { diff --git a/app/src/main/java/dev/brahmkshatriya/echo/data/offline/LocalTrack.kt b/app/src/main/java/dev/brahmkshatriya/echo/data/offline/LocalTrack.kt index ea0cbfad..4ecbfd90 100644 --- a/app/src/main/java/dev/brahmkshatriya/echo/data/offline/LocalTrack.kt +++ b/app/src/main/java/dev/brahmkshatriya/echo/data/offline/LocalTrack.kt @@ -1,18 +1,18 @@ -package dev.brahmkshatriya.echo.data.offline +package dev.brahmkshatriya.echo.common.data.offline import android.content.ContentUris import android.content.Context import android.net.Uri import android.provider.MediaStore -import dev.brahmkshatriya.echo.data.models.Album -import dev.brahmkshatriya.echo.data.models.Artist -import dev.brahmkshatriya.echo.data.models.ImageHolder.Companion.toImageHolder -import dev.brahmkshatriya.echo.data.models.Track -import dev.brahmkshatriya.echo.data.offline.LocalHelper.Companion.ALBUM_AUTH -import dev.brahmkshatriya.echo.data.offline.LocalHelper.Companion.ARTIST_AUTH -import dev.brahmkshatriya.echo.data.offline.LocalHelper.Companion.TRACK_AUTH -import dev.brahmkshatriya.echo.data.offline.LocalHelper.Companion.URI -import dev.brahmkshatriya.echo.data.offline.LocalHelper.Companion.createCursor +import dev.brahmkshatriya.echo.common.models.Album +import dev.brahmkshatriya.echo.common.models.Artist +import dev.brahmkshatriya.echo.common.models.ImageHolder.Companion.toImageHolder +import dev.brahmkshatriya.echo.common.models.Track +import dev.brahmkshatriya.echo.common.data.offline.LocalHelper.Companion.ALBUM_AUTH +import dev.brahmkshatriya.echo.common.data.offline.LocalHelper.Companion.ARTIST_AUTH +import dev.brahmkshatriya.echo.common.data.offline.LocalHelper.Companion.TRACK_AUTH +import dev.brahmkshatriya.echo.common.data.offline.LocalHelper.Companion.URI +import dev.brahmkshatriya.echo.common.data.offline.LocalHelper.Companion.createCursor interface LocalTrack { diff --git a/app/src/main/java/dev/brahmkshatriya/echo/di/ContextProviderForRepo.kt b/app/src/main/java/dev/brahmkshatriya/echo/di/ContextProviderForRepo.kt new file mode 100644 index 00000000..4759e733 --- /dev/null +++ b/app/src/main/java/dev/brahmkshatriya/echo/di/ContextProviderForRepo.kt @@ -0,0 +1,17 @@ +package dev.brahmkshatriya.echo.di + +import android.content.Context +import dev.brahmkshatriya.echo.common.clients.ExtensionClient +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.map +import tel.jeelpa.plugger.PluginRepo + +class ContextProviderForRepo( + private val context: Context, + private val pluginRepo: PluginRepo +) : PluginRepo { + override fun getAllPlugins(): Flow> = + pluginRepo.getAllPlugins().map { list -> + list.onEach { it.context = context } + } +} \ No newline at end of file diff --git a/app/src/main/java/dev/brahmkshatriya/echo/di/PluginModule.kt b/app/src/main/java/dev/brahmkshatriya/echo/di/PluginModule.kt index 1efc803b..04c90a1e 100644 --- a/app/src/main/java/dev/brahmkshatriya/echo/di/PluginModule.kt +++ b/app/src/main/java/dev/brahmkshatriya/echo/di/PluginModule.kt @@ -5,34 +5,71 @@ import dagger.Module import dagger.Provides import dagger.hilt.InstallIn import dagger.hilt.components.SingletonComponent -import dev.brahmkshatriya.echo.data.clients.HomeFeedClient -import dev.brahmkshatriya.echo.data.clients.SearchClient -import dev.brahmkshatriya.echo.data.clients.TrackClient -import dev.brahmkshatriya.echo.data.extensions.OfflineExtension +import dev.brahmkshatriya.echo.common.clients.ExtensionClient +import dev.brahmkshatriya.echo.common.clients.HomeFeedClient +import dev.brahmkshatriya.echo.common.clients.SearchClient +import dev.brahmkshatriya.echo.common.clients.TrackClient +import dev.brahmkshatriya.echo.data.extensions.LocalExtensionRepo +import kotlinx.coroutines.flow.first +import kotlinx.coroutines.runBlocking +import tel.jeelpa.plugger.PluginRepo +import tel.jeelpa.plugger.RepoComposer +import tel.jeelpa.plugger.models.PluginConfiguration +import tel.jeelpa.plugger.pluginloader.AndroidPluginLoader +import tel.jeelpa.plugger.pluginloader.apk.ApkPluginLoader +import tel.jeelpa.plugger.pluginloader.file.FilePluginConfig +import tel.jeelpa.plugger.pluginloader.file.FileSystemPluginLoader import javax.inject.Singleton + @Module @InstallIn(SingletonComponent::class) class PluginModule { - private var offline : OfflineExtension? = null - private fun getOfflineExtension(app: Application) = offline ?: OfflineExtension(app).also { - offline = it + @Provides + @Singleton + fun providesPluginLoader( + application: Application + ): PluginRepo { + + val loader = AndroidPluginLoader(application) + val filePluginConfig = FilePluginConfig(application.filesDir.absolutePath, ".echo") + val apkPluginConfig = PluginConfiguration("dev.brahmkshatriya.echo") + + val composer = RepoComposer( + FileSystemPluginLoader(application, filePluginConfig, loader), + ApkPluginLoader(application, apkPluginConfig, loader), + LocalExtensionRepo() + ) + + return ContextProviderForRepo(application, composer) } @Provides @Singleton - fun provideExtension(app: Application) : OfflineExtension = getOfflineExtension(app) + fun getExtensionClients(pluginLoader: PluginRepo): List { + val clients = runBlocking { pluginLoader.getAllPlugins().first() } + return clients + } @Provides @Singleton - fun provideSearchClient(app: Application) : SearchClient = getOfflineExtension(app) + fun provideExtension(pluginLoader: PluginRepo): ExtensionClient = + getExtensionClients(pluginLoader).first() @Provides @Singleton - fun provideHomeClient(app: Application) : HomeFeedClient = getOfflineExtension(app) + fun provideSearchClient(pluginLoader: PluginRepo): SearchClient = + provideExtension(pluginLoader) as SearchClient @Provides @Singleton - fun provideTrackClient(app: Application) : TrackClient = getOfflineExtension(app) + fun provideHomeClient(pluginLoader: PluginRepo): HomeFeedClient = + provideExtension(pluginLoader) as HomeFeedClient + + @Provides + @Singleton + fun provideTrackClient(pluginLoader: PluginRepo): TrackClient = + provideExtension(pluginLoader) as TrackClient + } \ No newline at end of file diff --git a/app/src/main/java/dev/brahmkshatriya/echo/player/PlaybackService.kt b/app/src/main/java/dev/brahmkshatriya/echo/player/PlaybackService.kt index cec1234a..ebb915c8 100644 --- a/app/src/main/java/dev/brahmkshatriya/echo/player/PlaybackService.kt +++ b/app/src/main/java/dev/brahmkshatriya/echo/player/PlaybackService.kt @@ -14,7 +14,7 @@ import androidx.media3.session.MediaSession import dagger.hilt.android.AndroidEntryPoint import dev.brahmkshatriya.echo.MainActivity import dev.brahmkshatriya.echo.R -import dev.brahmkshatriya.echo.data.extensions.OfflineExtension +import dev.brahmkshatriya.echo.common.clients.ExtensionClient import javax.inject.Inject @AndroidEntryPoint @@ -24,7 +24,7 @@ class PlaybackService : MediaLibraryService() { lateinit var app: Application @Inject - lateinit var extension: OfflineExtension + lateinit var extension: ExtensionClient private var mediaLibrarySession: MediaLibrarySession? = null diff --git a/app/src/main/java/dev/brahmkshatriya/echo/player/PlayerHelper.kt b/app/src/main/java/dev/brahmkshatriya/echo/player/PlayerHelper.kt index fadebf82..bc5cc3e2 100644 --- a/app/src/main/java/dev/brahmkshatriya/echo/player/PlayerHelper.kt +++ b/app/src/main/java/dev/brahmkshatriya/echo/player/PlayerHelper.kt @@ -6,9 +6,9 @@ import androidx.core.net.toUri import androidx.media3.common.MediaItem import androidx.media3.common.MediaMetadata import androidx.media3.common.util.UnstableApi -import dev.brahmkshatriya.echo.data.models.ImageHolder -import dev.brahmkshatriya.echo.data.models.StreamableAudio -import dev.brahmkshatriya.echo.data.models.Track +import dev.brahmkshatriya.echo.common.models.ImageHolder +import dev.brahmkshatriya.echo.common.models.StreamableAudio +import dev.brahmkshatriya.echo.common.models.Track import dev.brahmkshatriya.echo.player.PlayerListener.Companion.tracks import java.nio.ByteBuffer diff --git a/app/src/main/java/dev/brahmkshatriya/echo/player/PlayerListener.kt b/app/src/main/java/dev/brahmkshatriya/echo/player/PlayerListener.kt index dd458f81..7f3d0afb 100644 --- a/app/src/main/java/dev/brahmkshatriya/echo/player/PlayerListener.kt +++ b/app/src/main/java/dev/brahmkshatriya/echo/player/PlayerListener.kt @@ -8,7 +8,7 @@ import androidx.media3.common.Player import androidx.media3.common.Timeline import androidx.media3.exoplayer.ExoPlayer import androidx.media3.session.MediaController -import dev.brahmkshatriya.echo.data.models.Track +import dev.brahmkshatriya.echo.common.models.Track class PlayerListener( diff --git a/app/src/main/java/dev/brahmkshatriya/echo/player/PlayerSessionCallback.kt b/app/src/main/java/dev/brahmkshatriya/echo/player/PlayerSessionCallback.kt index 2ce40f81..11dc0565 100644 --- a/app/src/main/java/dev/brahmkshatriya/echo/player/PlayerSessionCallback.kt +++ b/app/src/main/java/dev/brahmkshatriya/echo/player/PlayerSessionCallback.kt @@ -7,10 +7,10 @@ import androidx.media3.session.MediaLibraryService import androidx.media3.session.MediaSession import androidx.paging.AsyncPagingDataDiffer import com.google.common.util.concurrent.ListenableFuture -import dev.brahmkshatriya.echo.data.clients.SearchClient -import dev.brahmkshatriya.echo.data.clients.TrackClient -import dev.brahmkshatriya.echo.data.models.EchoMediaItem -import dev.brahmkshatriya.echo.data.models.MediaItemsContainer +import dev.brahmkshatriya.echo.common.clients.SearchClient +import dev.brahmkshatriya.echo.common.clients.TrackClient +import dev.brahmkshatriya.echo.common.models.EchoMediaItem +import dev.brahmkshatriya.echo.common.models.MediaItemsContainer import dev.brahmkshatriya.echo.ui.adapters.MediaItemsContainerAdapter import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers diff --git a/app/src/main/java/dev/brahmkshatriya/echo/player/PlayerUIViewModel.kt b/app/src/main/java/dev/brahmkshatriya/echo/player/PlayerUIViewModel.kt index fe5533ba..67949b10 100644 --- a/app/src/main/java/dev/brahmkshatriya/echo/player/PlayerUIViewModel.kt +++ b/app/src/main/java/dev/brahmkshatriya/echo/player/PlayerUIViewModel.kt @@ -2,7 +2,7 @@ package dev.brahmkshatriya.echo.player import androidx.lifecycle.ViewModel import androidx.media3.session.MediaController -import dev.brahmkshatriya.echo.data.models.Track +import dev.brahmkshatriya.echo.common.models.Track import kotlinx.coroutines.flow.MutableStateFlow class PlayerUIViewModel : ViewModel() { diff --git a/app/src/main/java/dev/brahmkshatriya/echo/player/PlayerViewModel.kt b/app/src/main/java/dev/brahmkshatriya/echo/player/PlayerViewModel.kt index 0b750c91..6ed6c787 100644 --- a/app/src/main/java/dev/brahmkshatriya/echo/player/PlayerViewModel.kt +++ b/app/src/main/java/dev/brahmkshatriya/echo/player/PlayerViewModel.kt @@ -3,9 +3,9 @@ package dev.brahmkshatriya.echo.player import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import dagger.hilt.android.lifecycle.HiltViewModel -import dev.brahmkshatriya.echo.data.clients.TrackClient -import dev.brahmkshatriya.echo.data.models.StreamableAudio -import dev.brahmkshatriya.echo.data.models.Track +import dev.brahmkshatriya.echo.common.clients.TrackClient +import dev.brahmkshatriya.echo.common.models.StreamableAudio +import dev.brahmkshatriya.echo.common.models.Track import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.launch diff --git a/app/src/main/java/dev/brahmkshatriya/echo/ui/adapters/MediaItemAdapter.kt b/app/src/main/java/dev/brahmkshatriya/echo/ui/adapters/MediaItemAdapter.kt index 6304f14e..a73f55de 100644 --- a/app/src/main/java/dev/brahmkshatriya/echo/ui/adapters/MediaItemAdapter.kt +++ b/app/src/main/java/dev/brahmkshatriya/echo/ui/adapters/MediaItemAdapter.kt @@ -7,8 +7,8 @@ import androidx.paging.PagingData import androidx.paging.PagingDataAdapter import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.RecyclerView -import dev.brahmkshatriya.echo.data.models.EchoMediaItem -import dev.brahmkshatriya.echo.data.models.Track +import dev.brahmkshatriya.echo.common.models.EchoMediaItem +import dev.brahmkshatriya.echo.common.models.Track import dev.brahmkshatriya.echo.databinding.ItemMediaBinding import dev.brahmkshatriya.echo.ui.utils.loadInto diff --git a/app/src/main/java/dev/brahmkshatriya/echo/ui/adapters/MediaItemsContainerAdapter.kt b/app/src/main/java/dev/brahmkshatriya/echo/ui/adapters/MediaItemsContainerAdapter.kt index 279e062f..bfb9dd7c 100644 --- a/app/src/main/java/dev/brahmkshatriya/echo/ui/adapters/MediaItemsContainerAdapter.kt +++ b/app/src/main/java/dev/brahmkshatriya/echo/ui/adapters/MediaItemsContainerAdapter.kt @@ -12,8 +12,8 @@ import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager.HORIZONTAL import androidx.recyclerview.widget.ListUpdateCallback import androidx.recyclerview.widget.RecyclerView -import dev.brahmkshatriya.echo.data.models.MediaItemsContainer -import dev.brahmkshatriya.echo.data.models.Track +import dev.brahmkshatriya.echo.common.models.MediaItemsContainer +import dev.brahmkshatriya.echo.common.models.Track import dev.brahmkshatriya.echo.databinding.ItemCategoryBinding import dev.brahmkshatriya.echo.databinding.ItemTrackBinding import dev.brahmkshatriya.echo.player.PlayerHelper.Companion.toTimeString @@ -92,11 +92,12 @@ class MediaItemsContainerAdapter( track.cover?.loadInto(binding.imageView) - if (track.album == null) { + val album = track.album + if (album == null) { binding.album.visibility = View.GONE } else { binding.album.visibility = View.VISIBLE - binding.album.text = track.album.title + binding.album.text = album.title } if (track.artists.isEmpty()) { @@ -106,11 +107,12 @@ class MediaItemsContainerAdapter( binding.artist.text = track.artists.joinToString(" ") { it.name } } - if (track.duration == null) { + val duration = track.duration + if (duration == null) { binding.duration.visibility = View.GONE } else { binding.duration.visibility = View.VISIBLE - binding.duration.text = track.duration.toTimeString() + binding.duration.text = duration.toTimeString() } } } diff --git a/app/src/main/java/dev/brahmkshatriya/echo/ui/home/HomeFragment.kt b/app/src/main/java/dev/brahmkshatriya/echo/ui/home/HomeFragment.kt index 9eb75f6e..56108f2d 100644 --- a/app/src/main/java/dev/brahmkshatriya/echo/ui/home/HomeFragment.kt +++ b/app/src/main/java/dev/brahmkshatriya/echo/ui/home/HomeFragment.kt @@ -11,7 +11,7 @@ import androidx.recyclerview.widget.ConcatAdapter import androidx.recyclerview.widget.LinearLayoutManager import dagger.hilt.android.AndroidEntryPoint import dev.brahmkshatriya.echo.R -import dev.brahmkshatriya.echo.data.models.Track +import dev.brahmkshatriya.echo.common.models.Track import dev.brahmkshatriya.echo.databinding.FragmentRecyclerBinding import dev.brahmkshatriya.echo.ui.adapters.ClickListener import dev.brahmkshatriya.echo.ui.adapters.HeaderAdapter diff --git a/app/src/main/java/dev/brahmkshatriya/echo/ui/home/HomeViewModel.kt b/app/src/main/java/dev/brahmkshatriya/echo/ui/home/HomeViewModel.kt index ebd7792b..e9940fb1 100644 --- a/app/src/main/java/dev/brahmkshatriya/echo/ui/home/HomeViewModel.kt +++ b/app/src/main/java/dev/brahmkshatriya/echo/ui/home/HomeViewModel.kt @@ -5,8 +5,8 @@ import androidx.lifecycle.viewModelScope import androidx.paging.PagingData import androidx.paging.cachedIn import dagger.hilt.android.lifecycle.HiltViewModel -import dev.brahmkshatriya.echo.data.clients.HomeFeedClient -import dev.brahmkshatriya.echo.data.models.MediaItemsContainer +import dev.brahmkshatriya.echo.common.clients.HomeFeedClient +import dev.brahmkshatriya.echo.common.models.MediaItemsContainer import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.asStateFlow diff --git a/app/src/main/java/dev/brahmkshatriya/echo/ui/search/SearchFragment.kt b/app/src/main/java/dev/brahmkshatriya/echo/ui/search/SearchFragment.kt index 25b01fc6..0bbef80b 100644 --- a/app/src/main/java/dev/brahmkshatriya/echo/ui/search/SearchFragment.kt +++ b/app/src/main/java/dev/brahmkshatriya/echo/ui/search/SearchFragment.kt @@ -9,7 +9,7 @@ import androidx.fragment.app.activityViewModels import androidx.recyclerview.widget.ConcatAdapter import androidx.recyclerview.widget.LinearLayoutManager import dagger.hilt.android.AndroidEntryPoint -import dev.brahmkshatriya.echo.data.models.Track +import dev.brahmkshatriya.echo.common.models.Track import dev.brahmkshatriya.echo.databinding.FragmentSearchBinding import dev.brahmkshatriya.echo.ui.adapters.ClickListener import dev.brahmkshatriya.echo.ui.adapters.MediaItemsContainerAdapter diff --git a/app/src/main/java/dev/brahmkshatriya/echo/ui/search/SearchViewModel.kt b/app/src/main/java/dev/brahmkshatriya/echo/ui/search/SearchViewModel.kt index d1062ff1..dd6f3e31 100644 --- a/app/src/main/java/dev/brahmkshatriya/echo/ui/search/SearchViewModel.kt +++ b/app/src/main/java/dev/brahmkshatriya/echo/ui/search/SearchViewModel.kt @@ -4,8 +4,8 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import androidx.paging.PagingData import dagger.hilt.android.lifecycle.HiltViewModel -import dev.brahmkshatriya.echo.data.clients.SearchClient -import dev.brahmkshatriya.echo.data.models.MediaItemsContainer +import dev.brahmkshatriya.echo.common.clients.SearchClient +import dev.brahmkshatriya.echo.common.models.MediaItemsContainer import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.asStateFlow diff --git a/app/src/main/java/dev/brahmkshatriya/echo/ui/utils/ImageLoading.kt b/app/src/main/java/dev/brahmkshatriya/echo/ui/utils/ImageLoading.kt index 942738b4..ccce6ed8 100644 --- a/app/src/main/java/dev/brahmkshatriya/echo/ui/utils/ImageLoading.kt +++ b/app/src/main/java/dev/brahmkshatriya/echo/ui/utils/ImageLoading.kt @@ -3,7 +3,7 @@ package dev.brahmkshatriya.echo.ui.utils import android.widget.ImageView import com.bumptech.glide.Glide import com.bumptech.glide.load.model.GlideUrl -import dev.brahmkshatriya.echo.data.models.ImageHolder +import dev.brahmkshatriya.echo.common.models.ImageHolder fun ImageHolder.loadInto(imageView: ImageView) { if (this is ImageHolder.BitmapHolder) diff --git a/settings.gradle.kts b/settings.gradle.kts index a8b69c1f..863c8c3c 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -11,9 +11,9 @@ dependencyResolutionManagement { repositories { google() mavenCentral() + maven { url = uri("https://jitpack.io") } } } rootProject.name = "Echo" include(":app") - \ No newline at end of file