diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml new file mode 100644 index 0000000..ae59059 --- /dev/null +++ b/.idea/deploymentTargetDropDown.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 3f96892..a771d6e 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -13,6 +13,13 @@ diff --git a/.idea/misc.xml b/.idea/misc.xml index e9e9db5..54b4442 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,3 @@ - diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 7060d22..3cce7c6 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -48,6 +48,9 @@ android { } dependencies { + implementation(project(mapOf("path" to ":feature:album:data"))) + implementation(project(mapOf("path" to ":feature:album:ui"))) + implementation(project(mapOf("path" to ":core"))) retrofit() room() hilt() diff --git a/app/src/main/java/net/deaftone/eurydice/data/repository/AlbumRepository.kt b/app/src/main/java/net/deaftone/eurydice/data/repository/AlbumRepository.kt deleted file mode 100644 index 7001b50..0000000 --- a/app/src/main/java/net/deaftone/eurydice/data/repository/AlbumRepository.kt +++ /dev/null @@ -1,3 +0,0 @@ -package net.deaftone.eurydice.data.repository - -class AlbumRepository diff --git a/app/src/main/java/net/deaftone/eurydice/di/AppModule.kt b/app/src/main/java/net/deaftone/eurydice/di/AppModule.kt index 36d09eb..6e00649 100644 --- a/app/src/main/java/net/deaftone/eurydice/di/AppModule.kt +++ b/app/src/main/java/net/deaftone/eurydice/di/AppModule.kt @@ -9,8 +9,8 @@ import dagger.hilt.InstallIn import dagger.hilt.android.qualifiers.ApplicationContext import dagger.hilt.components.SingletonComponent import javax.inject.Singleton -import net.deaftone.eurydice.data.AppDatabase -import net.deaftone.eurydice.data.service.AlbumService +import net.deaftone.core.database.AppDatabase +import net.deaftone.album.data.service.AlbumService import okhttp3.OkHttpClient import okhttp3.logging.HttpLoggingInterceptor import retrofit2.Retrofit diff --git a/app/src/main/java/net/deaftone/eurydice/ui/theme/Color.kt b/app/src/main/java/net/deaftone/eurydice/theme/Color.kt similarity index 86% rename from app/src/main/java/net/deaftone/eurydice/ui/theme/Color.kt rename to app/src/main/java/net/deaftone/eurydice/theme/Color.kt index eb06dd9..437e3d5 100644 --- a/app/src/main/java/net/deaftone/eurydice/ui/theme/Color.kt +++ b/app/src/main/java/net/deaftone/eurydice/theme/Color.kt @@ -1,4 +1,4 @@ -package net.deaftone.eurydice.ui.theme +package net.deaftone.eurydice.theme import androidx.compose.ui.graphics.Color diff --git a/app/src/main/java/net/deaftone/eurydice/ui/theme/Theme.kt b/app/src/main/java/net/deaftone/eurydice/theme/Theme.kt similarity index 87% rename from app/src/main/java/net/deaftone/eurydice/ui/theme/Theme.kt rename to app/src/main/java/net/deaftone/eurydice/theme/Theme.kt index 0db6d14..f3a6367 100644 --- a/app/src/main/java/net/deaftone/eurydice/ui/theme/Theme.kt +++ b/app/src/main/java/net/deaftone/eurydice/theme/Theme.kt @@ -1,7 +1,8 @@ -package net.deaftone.eurydice.ui.theme +package net.deaftone.eurydice.theme import android.app.Activity import android.os.Build +import androidx.annotation.RequiresApi import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.material3.MaterialTheme import androidx.compose.material3.darkColorScheme @@ -37,6 +38,8 @@ private val LightColorScheme = lightColorScheme( */ ) +@RequiresApi(Build.VERSION_CODES.CUPCAKE) + @Composable fun EurydiceTheme( darkTheme: Boolean = isSystemInDarkTheme(), @@ -55,7 +58,9 @@ fun EurydiceTheme( val view = LocalView.current if (!view.isInEditMode) { SideEffect { - (view.context as Activity).window.statusBarColor = colorScheme.primary.toArgb() + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + (view.context as Activity).window.statusBarColor = colorScheme.primary.toArgb() + } ViewCompat.getWindowInsetsController(view)?.isAppearanceLightStatusBars = darkTheme } } diff --git a/app/src/main/java/net/deaftone/eurydice/ui/theme/Type.kt b/app/src/main/java/net/deaftone/eurydice/theme/Type.kt similarity index 96% rename from app/src/main/java/net/deaftone/eurydice/ui/theme/Type.kt rename to app/src/main/java/net/deaftone/eurydice/theme/Type.kt index 1d7575f..cf8f70f 100644 --- a/app/src/main/java/net/deaftone/eurydice/ui/theme/Type.kt +++ b/app/src/main/java/net/deaftone/eurydice/theme/Type.kt @@ -1,4 +1,4 @@ -package net.deaftone.eurydice.ui.theme +package net.deaftone.eurydice.theme import androidx.compose.material3.Typography import androidx.compose.ui.text.TextStyle diff --git a/app/src/main/java/net/deaftone/eurydice/ui/MainActivity.kt b/app/src/main/java/net/deaftone/eurydice/ui/MainActivity.kt index f0ca7ab..5324485 100644 --- a/app/src/main/java/net/deaftone/eurydice/ui/MainActivity.kt +++ b/app/src/main/java/net/deaftone/eurydice/ui/MainActivity.kt @@ -27,8 +27,8 @@ import dagger.hilt.android.AndroidEntryPoint import net.deaftone.eurydice.R import net.deaftone.eurydice.ui.navigation.BottomBar import net.deaftone.eurydice.ui.navigation.MainScreenNavGraph -import net.deaftone.eurydice.ui.navigation.MainScreenRoutes -import net.deaftone.eurydice.ui.theme.EurydiceTheme +import net.deaftone.core.MainScreenRoutes +import net.deaftone.eurydice.theme.EurydiceTheme import net.deaftone.eurydice.ui.widget.TopAppBar diff --git a/app/src/main/java/net/deaftone/eurydice/ui/navigation/BottomBar.kt b/app/src/main/java/net/deaftone/eurydice/ui/navigation/BottomBar.kt index aae70d7..5591675 100644 --- a/app/src/main/java/net/deaftone/eurydice/ui/navigation/BottomBar.kt +++ b/app/src/main/java/net/deaftone/eurydice/ui/navigation/BottomBar.kt @@ -21,12 +21,12 @@ import androidx.navigation.compose.currentBackStackEntryAsState @Composable fun BottomBar(navController: NavHostController) { val screens = listOf( - BottomBarScreen.AlbumList, - BottomBarScreen.Artists, + net.deaftone.core.BottomBarScreen.AlbumList, + net.deaftone.core.BottomBarScreen.Artists, ) val hidden = listOf( - MainScreenRoutes.AlbumInfo + net.deaftone.core.MainScreenRoutes.AlbumInfo ) val navBackStackEntry by navController.currentBackStackEntryAsState() val currentDestination = navBackStackEntry?.destination @@ -51,7 +51,7 @@ fun BottomBar(navController: NavHostController) { @Composable fun RowScope.AddItem( - screen: BottomBarScreen, + screen: net.deaftone.core.BottomBarScreen, currentDestination: NavDestination?, navController: NavHostController ) { diff --git a/app/src/main/java/net/deaftone/eurydice/ui/navigation/MainScreenNavGraph.kt b/app/src/main/java/net/deaftone/eurydice/ui/navigation/MainScreenNavGraph.kt index a92aceb..033b73b 100644 --- a/app/src/main/java/net/deaftone/eurydice/ui/navigation/MainScreenNavGraph.kt +++ b/app/src/main/java/net/deaftone/eurydice/ui/navigation/MainScreenNavGraph.kt @@ -1,6 +1,5 @@ package net.deaftone.eurydice.ui.navigation -import androidx.compose.animation.AnimatedContentScope import androidx.compose.animation.AnimatedContentTransitionScope import androidx.compose.animation.ExperimentalAnimationApi import androidx.compose.runtime.Composable @@ -8,9 +7,11 @@ import androidx.compose.ui.Modifier import androidx.navigation.NavHostController import androidx.navigation.compose.NavHost import androidx.navigation.compose.composable +import net.deaftone.album.ui.albumInfo.AlbumInfoScreen +import net.deaftone.album.ui.albumList.AlbumListScreen +import net.deaftone.core.BottomBarScreen import net.deaftone.eurydice.ui.TestScreen1 -import net.deaftone.eurydice.ui.album.AlbumInfoScreen -import net.deaftone.eurydice.ui.album.AlbumListScreen + @OptIn(ExperimentalAnimationApi::class) @Composable @@ -21,8 +22,8 @@ fun MainScreenNavGraph( NavHost( modifier = modifier, navController = navController, - route = NavGraph.BOTTOM_BAR_GRAPH, - startDestination = BottomBarScreen.AlbumList.route, + route = net.deaftone.core.NavGraph.BOTTOM_BAR_GRAPH, + startDestination = net.deaftone.core.BottomBarScreen.AlbumList.route, enterTransition = { slideIntoContainer(AnimatedContentTransitionScope.SlideDirection.Right) }, exitTransition = { slideOutOfContainer(towards = AnimatedContentTransitionScope.SlideDirection.Left) }, popEnterTransition = { @@ -33,21 +34,22 @@ fun MainScreenNavGraph( } ) { - composable(route = BottomBarScreen.Artists.route) { + composable(route = net.deaftone.core.BottomBarScreen.Artists.route) { TestScreen1(onItemClick = { - navController.navigate(BottomBarScreen.Artists.route) + navController.navigate(net.deaftone.core.BottomBarScreen.Artists.route) }, name = "test") } - composable(route = BottomBarScreen.AlbumList.route) { + composable(route = net.deaftone.core.BottomBarScreen.AlbumList.route) { AlbumListScreen(onItemClick = { navController.navigate(BottomBarScreen.AlbumList.route) }, onNavigationUp = { navController.popBackStack() }, - navController = navController) + navController = navController + ) } - composable(route = MainScreenRoutes.AlbumInfo.route) { navBackStackEntry -> + composable(route = net.deaftone.core.MainScreenRoutes.AlbumInfo.route) { navBackStackEntry -> AlbumInfoScreen(onNavigationUp = { navController.popBackStack() }) diff --git a/app/src/main/res/drawable-xxxhdpi/ic_home.png b/app/src/main/res/drawable-xxxhdpi/ic_home.png deleted file mode 100644 index 8d20adc..0000000 Binary files a/app/src/main/res/drawable-xxxhdpi/ic_home.png and /dev/null differ diff --git a/build.gradle.kts b/build.gradle.kts index 51e3c81..cf39e48 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,5 +6,6 @@ buildscript { dependencies { classpath(Dependencies.hiltAgp) + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.10") } } \ No newline at end of file diff --git a/core/.gitignore b/core/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/core/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/core/build.gradle.kts b/core/build.gradle.kts new file mode 100644 index 0000000..f319408 --- /dev/null +++ b/core/build.gradle.kts @@ -0,0 +1,28 @@ +plugins { + id("com.android.library") + id("org.jetbrains.kotlin.android") + kotlin("kapt") +} + +android { + namespace = "net.deaftone.core" + compileSdk = 34 + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_18 + targetCompatibility = JavaVersion.VERSION_18 + } + kotlinOptions { + jvmTarget = "18" + } + + composeOptions { + kotlinCompilerExtensionVersion = "1.4.3" + } + +} + +dependencies { + implementation(project(mapOf("path" to ":feature:artist:data"))) + room() +} \ No newline at end of file diff --git a/core/proguard-rules.pro b/core/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/core/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/core/src/androidTest/java/net/deaftone/core/ExampleInstrumentedTest.kt b/core/src/androidTest/java/net/deaftone/core/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..44d759d --- /dev/null +++ b/core/src/androidTest/java/net/deaftone/core/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package net.deaftone.core + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("net.deaftone.core", appContext.packageName) + } +} \ No newline at end of file diff --git a/core/src/main/AndroidManifest.xml b/core/src/main/AndroidManifest.xml new file mode 100644 index 0000000..b93358b --- /dev/null +++ b/core/src/main/AndroidManifest.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/java/net/deaftone/eurydice/ui/navigation/ScreenRoute.kt b/core/src/main/java/net/deaftone/core/ScreenRoute.kt similarity index 87% rename from app/src/main/java/net/deaftone/eurydice/ui/navigation/ScreenRoute.kt rename to core/src/main/java/net/deaftone/core/ScreenRoute.kt index 15342bb..0d4d66b 100644 --- a/app/src/main/java/net/deaftone/eurydice/ui/navigation/ScreenRoute.kt +++ b/core/src/main/java/net/deaftone/core/ScreenRoute.kt @@ -1,6 +1,4 @@ -package net.deaftone.eurydice.ui.navigation - -import net.deaftone.eurydice.R +package net.deaftone.core object NavGraph { const val BOTTOM_BAR_GRAPH = "bottom_bar_graph" @@ -26,9 +24,9 @@ sealed class BottomBarScreen( ) } -sealed class MainScreenRoutes(internal open val route: String) { +sealed class MainScreenRoutes(open val route: String) { object AlbumInfo: MainScreenRoutes( - route = "album_info" + "/{${ARG_RESOURCE_ID}}", + route = "album_info" + "/{$ARG_RESOURCE_ID}", ) { fun withId(id: String): String = route.replace("{$ARG_RESOURCE_ID}", id) } diff --git a/app/src/main/java/net/deaftone/eurydice/data/AppDatabase.kt b/core/src/main/java/net/deaftone/core/database/AppDatabase.kt similarity index 84% rename from app/src/main/java/net/deaftone/eurydice/data/AppDatabase.kt rename to core/src/main/java/net/deaftone/core/database/AppDatabase.kt index 2dbf3a4..30c6744 100644 --- a/app/src/main/java/net/deaftone/eurydice/data/AppDatabase.kt +++ b/core/src/main/java/net/deaftone/core/database/AppDatabase.kt @@ -1,11 +1,12 @@ -package net.deaftone.eurydice.data +package net.deaftone.core.database import android.content.Context import androidx.room.Database import androidx.room.Room import androidx.room.RoomDatabase -import net.deaftone.eurydice.data.entities.Artist -import net.deaftone.eurydice.data.room.ArtistDao +import net.deaftone.feature.artist.data.model.Artist +import net.deaftone.feature.artist.data.room.ArtistDao + @Database( entities = [Artist::class], diff --git a/app/src/main/res/drawable-xhdpi/ic_home.png b/core/src/main/res/drawable/ic_home.png similarity index 100% rename from app/src/main/res/drawable-xhdpi/ic_home.png rename to core/src/main/res/drawable/ic_home.png diff --git a/core/src/main/res/drawable/ic_launcher_background.xml b/core/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/core/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/src/main/res/drawable/ic_launcher_foreground.xml b/core/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/core/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml new file mode 100644 index 0000000..62ea3b2 --- /dev/null +++ b/core/src/main/res/values/strings.xml @@ -0,0 +1,4 @@ + + + Eurydice + \ No newline at end of file diff --git a/core/src/test/java/net/deaftone/core/ExampleUnitTest.kt b/core/src/test/java/net/deaftone/core/ExampleUnitTest.kt new file mode 100644 index 0000000..512efc9 --- /dev/null +++ b/core/src/test/java/net/deaftone/core/ExampleUnitTest.kt @@ -0,0 +1,17 @@ +package net.deaftone.core + +import org.junit.Test + +import org.junit.Assert.* + +/** + * Example local unit test, which will execute on the development machine (host). + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +class ExampleUnitTest { + @Test + fun addition_isCorrect() { + assertEquals(4, 2 + 2) + } +} \ No newline at end of file diff --git a/feature/album/data/.gitignore b/feature/album/data/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/feature/album/data/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/feature/album/data/build.gradle.kts b/feature/album/data/build.gradle.kts new file mode 100644 index 0000000..4f7847e --- /dev/null +++ b/feature/album/data/build.gradle.kts @@ -0,0 +1,33 @@ +plugins { + id("com.android.library") + id("org.jetbrains.kotlin.android") + id("kotlin-parcelize") + kotlin("kapt") +} +android { + namespace = "net.deaftone.album.data" + compileSdk = 34 + + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_18 + targetCompatibility = JavaVersion.VERSION_18 + } + kotlinOptions { + jvmTarget = "18" + } + buildFeatures { + compose = true + } + composeOptions { + kotlinCompilerExtensionVersion = "1.4.3" + } + +} + +dependencies { + room() + moshi() + activity() + lifecycle() +} \ No newline at end of file diff --git a/feature/album/data/proguard-rules.pro b/feature/album/data/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/feature/album/data/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/feature/album/data/src/androidTest/java/net/deaftone/album/data/ExampleInstrumentedTest.kt b/feature/album/data/src/androidTest/java/net/deaftone/album/data/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..86c9875 --- /dev/null +++ b/feature/album/data/src/androidTest/java/net/deaftone/album/data/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package net.deaftone.album.data + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("net.deaftone.album.data", appContext.packageName) + } +} \ No newline at end of file diff --git a/feature/album/data/src/main/AndroidManifest.xml b/feature/album/data/src/main/AndroidManifest.xml new file mode 100644 index 0000000..9c9ba90 --- /dev/null +++ b/feature/album/data/src/main/AndroidManifest.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/java/net/deaftone/eurydice/data/entities/Album.kt b/feature/album/data/src/main/java/net/deaftone/album/data/model/Album.kt similarity index 84% rename from app/src/main/java/net/deaftone/eurydice/data/entities/Album.kt rename to feature/album/data/src/main/java/net/deaftone/album/data/model/Album.kt index 290cf43..6c33992 100644 --- a/app/src/main/java/net/deaftone/eurydice/data/entities/Album.kt +++ b/feature/album/data/src/main/java/net/deaftone/album/data/model/Album.kt @@ -1,4 +1,4 @@ -package net.deaftone.eurydice.data.entities +package net.deaftone.album.data.model import com.squareup.moshi.Json diff --git a/app/src/main/java/net/deaftone/eurydice/data/models/AlbumListResponse.kt b/feature/album/data/src/main/java/net/deaftone/album/data/model/AlbumListResponse.kt similarity index 56% rename from app/src/main/java/net/deaftone/eurydice/data/models/AlbumListResponse.kt rename to feature/album/data/src/main/java/net/deaftone/album/data/model/AlbumListResponse.kt index c68d6a1..7500f99 100644 --- a/app/src/main/java/net/deaftone/eurydice/data/models/AlbumListResponse.kt +++ b/feature/album/data/src/main/java/net/deaftone/album/data/model/AlbumListResponse.kt @@ -1,7 +1,6 @@ -package net.deaftone.eurydice.data.models +package net.deaftone.album.data.model import com.squareup.moshi.Json -import net.deaftone.eurydice.data.entities.Album data class AlbumListResponse( @Json(name = "data") diff --git a/app/src/main/java/net/deaftone/eurydice/data/models/AlbumResponse.kt b/feature/album/data/src/main/java/net/deaftone/album/data/model/AlbumResponse.kt similarity index 54% rename from app/src/main/java/net/deaftone/eurydice/data/models/AlbumResponse.kt rename to feature/album/data/src/main/java/net/deaftone/album/data/model/AlbumResponse.kt index 3048bb1..cdb326c 100644 --- a/app/src/main/java/net/deaftone/eurydice/data/models/AlbumResponse.kt +++ b/feature/album/data/src/main/java/net/deaftone/album/data/model/AlbumResponse.kt @@ -1,7 +1,6 @@ -package net.deaftone.eurydice.data.models +package net.deaftone.album.data.model import com.squareup.moshi.Json -import net.deaftone.eurydice.data.entities.Album data class AlbumResponse( @Json(name = "data") diff --git a/app/src/main/java/net/deaftone/eurydice/data/entities/Song.kt b/feature/album/data/src/main/java/net/deaftone/album/data/model/Song.kt similarity index 85% rename from app/src/main/java/net/deaftone/eurydice/data/entities/Song.kt rename to feature/album/data/src/main/java/net/deaftone/album/data/model/Song.kt index 574c722..f8934cb 100644 --- a/app/src/main/java/net/deaftone/eurydice/data/entities/Song.kt +++ b/feature/album/data/src/main/java/net/deaftone/album/data/model/Song.kt @@ -1,4 +1,4 @@ -package net.deaftone.eurydice.data.entities +package net.deaftone.album.data.model import androidx.room.ColumnInfo import androidx.room.PrimaryKey diff --git a/feature/album/data/src/main/java/net/deaftone/album/data/repository/AlbumRepository.kt b/feature/album/data/src/main/java/net/deaftone/album/data/repository/AlbumRepository.kt new file mode 100644 index 0000000..beb19ba --- /dev/null +++ b/feature/album/data/src/main/java/net/deaftone/album/data/repository/AlbumRepository.kt @@ -0,0 +1,3 @@ +package net.deaftone.album.data.repository + +class AlbumRepository diff --git a/app/src/main/java/net/deaftone/eurydice/data/room/AlbumDao.kt b/feature/album/data/src/main/java/net/deaftone/album/data/room/AlbumDao.kt similarity index 80% rename from app/src/main/java/net/deaftone/eurydice/data/room/AlbumDao.kt rename to feature/album/data/src/main/java/net/deaftone/album/data/room/AlbumDao.kt index faa48c9..e5a765e 100644 --- a/app/src/main/java/net/deaftone/eurydice/data/room/AlbumDao.kt +++ b/feature/album/data/src/main/java/net/deaftone/album/data/room/AlbumDao.kt @@ -1,11 +1,11 @@ -package net.deaftone.eurydice.data.room +package net.deaftone.album.data.room import androidx.lifecycle.LiveData import androidx.room.Dao import androidx.room.Insert import androidx.room.OnConflictStrategy import androidx.room.Query -import net.deaftone.eurydice.data.entities.Album +import net.deaftone.album.data.model.Album @Dao interface AlbumDao { diff --git a/app/src/main/java/net/deaftone/eurydice/data/service/AlbumService.kt b/feature/album/data/src/main/java/net/deaftone/album/data/service/AlbumService.kt similarity index 64% rename from app/src/main/java/net/deaftone/eurydice/data/service/AlbumService.kt rename to feature/album/data/src/main/java/net/deaftone/album/data/service/AlbumService.kt index 7ca4c39..fa2f3b2 100644 --- a/app/src/main/java/net/deaftone/eurydice/data/service/AlbumService.kt +++ b/feature/album/data/src/main/java/net/deaftone/album/data/service/AlbumService.kt @@ -1,7 +1,7 @@ -package net.deaftone.eurydice.data.service +package net.deaftone.album.data.service -import net.deaftone.eurydice.data.models.AlbumListResponse -import net.deaftone.eurydice.data.models.AlbumResponse +import net.deaftone.album.data.model.AlbumListResponse +import net.deaftone.album.data.model.AlbumResponse import retrofit2.Response import retrofit2.http.GET import retrofit2.http.Path diff --git a/feature/album/data/src/test/java/net/deaftone/album/data/ExampleUnitTest.kt b/feature/album/data/src/test/java/net/deaftone/album/data/ExampleUnitTest.kt new file mode 100644 index 0000000..475d115 --- /dev/null +++ b/feature/album/data/src/test/java/net/deaftone/album/data/ExampleUnitTest.kt @@ -0,0 +1,17 @@ +package net.deaftone.album.data + +import org.junit.Test + +import org.junit.Assert.* + +/** + * Example local unit test, which will execute on the development machine (host). + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +class ExampleUnitTest { + @Test + fun addition_isCorrect() { + assertEquals(4, 2 + 2) + } +} \ No newline at end of file diff --git a/feature/album/ui/.gitignore b/feature/album/ui/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/feature/album/ui/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/feature/album/ui/build.gradle.kts b/feature/album/ui/build.gradle.kts new file mode 100644 index 0000000..64d9a23 --- /dev/null +++ b/feature/album/ui/build.gradle.kts @@ -0,0 +1,42 @@ +plugins { + id("com.android.library") + id("org.jetbrains.kotlin.android") + id("kotlin-parcelize") + id("dagger.hilt.android.plugin") + kotlin("kapt") +} + +android { + namespace = "net.deaftone.album.ui" + compileSdk = 34 + + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_18 + targetCompatibility = JavaVersion.VERSION_18 + } + kotlinOptions { + jvmTarget = "18" + } + buildFeatures { + compose = true + } + composeOptions { + kotlinCompilerExtensionVersion = "1.4.3" + } + +} + +dependencies { + implementation(project(mapOf("path" to ":feature:album:data"))) + implementation(project(mapOf("path" to ":core"))) + retrofit() + room() + hilt() + compose() + moshi() + activity() + navigation() + glide() + lifecycle() +} \ No newline at end of file diff --git a/feature/album/ui/proguard-rules.pro b/feature/album/ui/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/feature/album/ui/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/feature/album/ui/src/androidTest/java/net/deaftone/album/ui/ExampleInstrumentedTest.kt b/feature/album/ui/src/androidTest/java/net/deaftone/album/ui/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..5116f9f --- /dev/null +++ b/feature/album/ui/src/androidTest/java/net/deaftone/album/ui/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package net.deaftone.album.ui + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("net.deaftone.album.ui", appContext.packageName) + } +} \ No newline at end of file diff --git a/feature/album/ui/src/main/AndroidManifest.xml b/feature/album/ui/src/main/AndroidManifest.xml new file mode 100644 index 0000000..9c9ba90 --- /dev/null +++ b/feature/album/ui/src/main/AndroidManifest.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/java/net/deaftone/eurydice/ui/album/AlbumInfoScreen.kt b/feature/album/ui/src/main/java/net/deaftone/album/ui/albumInfo/AlbumInfoScreen.kt similarity index 98% rename from app/src/main/java/net/deaftone/eurydice/ui/album/AlbumInfoScreen.kt rename to feature/album/ui/src/main/java/net/deaftone/album/ui/albumInfo/AlbumInfoScreen.kt index ba25ebe..ad74715 100644 --- a/app/src/main/java/net/deaftone/eurydice/ui/album/AlbumInfoScreen.kt +++ b/feature/album/ui/src/main/java/net/deaftone/album/ui/albumInfo/AlbumInfoScreen.kt @@ -1,4 +1,4 @@ -package net.deaftone.eurydice.ui.album +package net.deaftone.album.ui.albumInfo import androidx.compose.foundation.layout.* import androidx.compose.material3.CircularProgressIndicator @@ -13,7 +13,7 @@ import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.skydoves.landscapist.glide.GlideImage -import net.deaftone.eurydice.data.entities.Album +import net.deaftone.album.data.model.Album @Composable fun AlbumInfoScreen( diff --git a/app/src/main/java/net/deaftone/eurydice/ui/album/AlbumInfoViewModel.kt b/feature/album/ui/src/main/java/net/deaftone/album/ui/albumInfo/AlbumInfoViewModel.kt similarity index 83% rename from app/src/main/java/net/deaftone/eurydice/ui/album/AlbumInfoViewModel.kt rename to feature/album/ui/src/main/java/net/deaftone/album/ui/albumInfo/AlbumInfoViewModel.kt index f1a668e..76b3464 100644 --- a/app/src/main/java/net/deaftone/eurydice/ui/album/AlbumInfoViewModel.kt +++ b/feature/album/ui/src/main/java/net/deaftone/album/ui/albumInfo/AlbumInfoViewModel.kt @@ -1,4 +1,4 @@ -package net.deaftone.eurydice.ui.album +package net.deaftone.album.ui.albumInfo import androidx.lifecycle.SavedStateHandle import androidx.lifecycle.ViewModel @@ -8,9 +8,9 @@ import javax.inject.Inject import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.launch -import net.deaftone.eurydice.data.entities.Album -import net.deaftone.eurydice.data.service.AlbumService -import net.deaftone.eurydice.ui.navigation.MainScreenRoutes +import net.deaftone.album.data.model.Album +import net.deaftone.album.data.service.AlbumService +import net.deaftone.core.MainScreenRoutes @HiltViewModel class AlbumInfoViewModel @Inject constructor( @@ -28,7 +28,7 @@ class AlbumInfoViewModel @Inject constructor( } } - fun getAlbumData(id: String) { + private fun getAlbumData(id: String) { _album.value = AlbumInfoUiState.Loading viewModelScope.launch { _album.value = AlbumInfoUiState.Loaded(albumService.getAlbum(id).body()!!.album) diff --git a/app/src/main/java/net/deaftone/eurydice/ui/album/AlbumListScreen.kt b/feature/album/ui/src/main/java/net/deaftone/album/ui/albumList/AlbumListScreen.kt similarity index 96% rename from app/src/main/java/net/deaftone/eurydice/ui/album/AlbumListScreen.kt rename to feature/album/ui/src/main/java/net/deaftone/album/ui/albumList/AlbumListScreen.kt index 2df981b..3cd69a6 100644 --- a/app/src/main/java/net/deaftone/eurydice/ui/album/AlbumListScreen.kt +++ b/feature/album/ui/src/main/java/net/deaftone/album/ui/albumList/AlbumListScreen.kt @@ -1,4 +1,4 @@ -package net.deaftone.eurydice.ui.album +package net.deaftone.album.ui.albumList import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement @@ -31,8 +31,8 @@ import androidx.hilt.navigation.compose.hiltViewModel import androidx.navigation.NavHostController import androidx.navigation.compose.rememberNavController import com.skydoves.landscapist.glide.GlideImage -import net.deaftone.eurydice.data.entities.Album -import net.deaftone.eurydice.ui.navigation.MainScreenRoutes +import net.deaftone.album.data.model.Album +import net.deaftone.core.MainScreenRoutes @Composable fun AlbumListScreen( @@ -78,7 +78,7 @@ fun AlbumItem( containerColor: Color = MaterialTheme.colorScheme.background, onClick: (() -> Unit)? = null, -) { + ) { Card( colors = CardDefaults.cardColors( containerColor = containerColor diff --git a/app/src/main/java/net/deaftone/eurydice/ui/album/AlbumListViewModel.kt b/feature/album/ui/src/main/java/net/deaftone/album/ui/albumList/AlbumListViewModel.kt similarity index 88% rename from app/src/main/java/net/deaftone/eurydice/ui/album/AlbumListViewModel.kt rename to feature/album/ui/src/main/java/net/deaftone/album/ui/albumList/AlbumListViewModel.kt index 3201492..3ab4af0 100644 --- a/app/src/main/java/net/deaftone/eurydice/ui/album/AlbumListViewModel.kt +++ b/feature/album/ui/src/main/java/net/deaftone/album/ui/albumList/AlbumListViewModel.kt @@ -1,4 +1,4 @@ -package net.deaftone.eurydice.ui.album +package net.deaftone.album.ui.albumList import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope @@ -8,8 +8,8 @@ import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.launch -import net.deaftone.eurydice.data.entities.Album -import net.deaftone.eurydice.data.service.AlbumService +import net.deaftone.album.data.model.Album +import net.deaftone.album.data.service.AlbumService @HiltViewModel class AlbumViewModel @Inject constructor(private val albumService: AlbumService) : ViewModel() { @@ -23,7 +23,7 @@ class AlbumViewModel @Inject constructor(private val albumService: AlbumService) getAlbumData() } - fun getAlbumData() { + private fun getAlbumData() { _albumList.value = AlbumUiState.Loading viewModelScope.launch { try { diff --git a/feature/album/ui/src/test/java/net/deaftone/album/ui/ExampleUnitTest.kt b/feature/album/ui/src/test/java/net/deaftone/album/ui/ExampleUnitTest.kt new file mode 100644 index 0000000..2fdced0 --- /dev/null +++ b/feature/album/ui/src/test/java/net/deaftone/album/ui/ExampleUnitTest.kt @@ -0,0 +1,17 @@ +package net.deaftone.album.ui + +import org.junit.Test + +import org.junit.Assert.* + +/** + * Example local unit test, which will execute on the development machine (host). + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +class ExampleUnitTest { + @Test + fun addition_isCorrect() { + assertEquals(4, 2 + 2) + } +} \ No newline at end of file diff --git a/feature/artist/data/.gitignore b/feature/artist/data/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/feature/artist/data/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/feature/artist/data/build.gradle.kts b/feature/artist/data/build.gradle.kts new file mode 100644 index 0000000..1a3aaa0 --- /dev/null +++ b/feature/artist/data/build.gradle.kts @@ -0,0 +1,28 @@ +plugins { + id("com.android.library") + id("org.jetbrains.kotlin.android") + kotlin("kapt") +} + +android { + namespace = "net.deaftone.feature.artist.data" + compileSdk = 34 + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_18 + targetCompatibility = JavaVersion.VERSION_18 + } + kotlinOptions { + jvmTarget = "18" + } + + composeOptions { + kotlinCompilerExtensionVersion = "1.4.3" + } +} + +dependencies { + room() + activity() + lifecycle() +} \ No newline at end of file diff --git a/feature/artist/data/proguard-rules.pro b/feature/artist/data/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/feature/artist/data/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/feature/artist/data/src/androidTest/java/net/deaftone/feature/artist/data/ExampleInstrumentedTest.kt b/feature/artist/data/src/androidTest/java/net/deaftone/feature/artist/data/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..871e5dd --- /dev/null +++ b/feature/artist/data/src/androidTest/java/net/deaftone/feature/artist/data/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package net.deaftone.feature.artist.data + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("net.deaftone.feature.artist.data", appContext.packageName) + } +} \ No newline at end of file diff --git a/feature/artist/data/src/main/AndroidManifest.xml b/feature/artist/data/src/main/AndroidManifest.xml new file mode 100644 index 0000000..b93358b --- /dev/null +++ b/feature/artist/data/src/main/AndroidManifest.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/java/net/deaftone/eurydice/data/entities/Artist.kt b/feature/artist/data/src/main/java/net/deaftone/feature/artist/data/model/Artist.kt similarity index 81% rename from app/src/main/java/net/deaftone/eurydice/data/entities/Artist.kt rename to feature/artist/data/src/main/java/net/deaftone/feature/artist/data/model/Artist.kt index d38c01b..c81ec8a 100644 --- a/app/src/main/java/net/deaftone/eurydice/data/entities/Artist.kt +++ b/feature/artist/data/src/main/java/net/deaftone/feature/artist/data/model/Artist.kt @@ -1,4 +1,4 @@ -package net.deaftone.eurydice.data.entities +package net.deaftone.feature.artist.data.model import androidx.room.ColumnInfo import androidx.room.Entity diff --git a/app/src/main/java/net/deaftone/eurydice/data/room/ArtistDao.kt b/feature/artist/data/src/main/java/net/deaftone/feature/artist/data/room/ArtistDao.kt similarity index 62% rename from app/src/main/java/net/deaftone/eurydice/data/room/ArtistDao.kt rename to feature/artist/data/src/main/java/net/deaftone/feature/artist/data/room/ArtistDao.kt index 3f88c06..460d192 100644 --- a/app/src/main/java/net/deaftone/eurydice/data/room/ArtistDao.kt +++ b/feature/artist/data/src/main/java/net/deaftone/feature/artist/data/room/ArtistDao.kt @@ -1,17 +1,15 @@ -package net.deaftone.eurydice.data.room +package net.deaftone.feature.artist.data.room import androidx.lifecycle.LiveData import androidx.room.Dao import androidx.room.Insert import androidx.room.OnConflictStrategy import androidx.room.Query -import net.deaftone.eurydice.data.entities.Artist +import net.deaftone.feature.artist.data.model.Artist @Dao interface ArtistDao { @Insert(onConflict = OnConflictStrategy.REPLACE) suspend fun insertAll(repos: List) - @Query("SELECT * FROM artists") - fun getAllAlbums(): LiveData> } diff --git a/feature/artist/data/src/test/java/net/deaftone/feature/artist/data/ExampleUnitTest.kt b/feature/artist/data/src/test/java/net/deaftone/feature/artist/data/ExampleUnitTest.kt new file mode 100644 index 0000000..2b14ea2 --- /dev/null +++ b/feature/artist/data/src/test/java/net/deaftone/feature/artist/data/ExampleUnitTest.kt @@ -0,0 +1,17 @@ +package net.deaftone.feature.artist.data + +import org.junit.Test + +import org.junit.Assert.* + +/** + * Example local unit test, which will execute on the development machine (host). + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +class ExampleUnitTest { + @Test + fun addition_isCorrect() { + assertEquals(4, 2 + 2) + } +} \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 2855fce..e7f55df 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -14,4 +14,8 @@ dependencyResolutionManagement { } rootProject.name = "Eurydice" -include(":app") \ No newline at end of file +include(":app") +include(":feature:album:data") +include(":feature:album:ui") +include(":core") +include(":feature:artist:data")