Skip to content

Commit

Permalink
Migrate to core:data
Browse files Browse the repository at this point in the history
  • Loading branch information
112RG committed Oct 21, 2023
1 parent 9e78d9b commit 8a190a1
Show file tree
Hide file tree
Showing 49 changed files with 120 additions and 501 deletions.
4 changes: 1 addition & 3 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@ android {
}

dependencies {
implementation(project(mapOf("path" to ":feature:album:data")))
implementation(project(mapOf("path" to ":feature:album:ui")))
implementation(project(mapOf("path" to ":core")))
implementation(project(mapOf("path" to ":core:data")))
retrofit()
room()
hilt()
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/net/deaftone/eurydice/di/AppModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import net.deaftone.data.AppDatabase
import net.deaftone.data.service.album.AlbumService
import javax.inject.Singleton
import net.deaftone.core.database.AppDatabase
import net.deaftone.album.data.service.AlbumService
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Retrofit
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/net/deaftone/eurydice/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ import androidx.navigation.NavHostController
import androidx.navigation.compose.currentBackStackEntryAsState
import androidx.navigation.compose.rememberNavController
import dagger.hilt.android.AndroidEntryPoint
import net.deaftone.data.MainScreenRoutes
import net.deaftone.eurydice.R
import net.deaftone.eurydice.ui.navigation.BottomBar
import net.deaftone.eurydice.ui.navigation.MainScreenNavGraph
import net.deaftone.core.MainScreenRoutes
import net.deaftone.eurydice.theme.EurydiceTheme
import net.deaftone.eurydice.ui.widget.TopAppBar

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,18 @@ import androidx.navigation.NavDestination.Companion.hierarchy
import androidx.navigation.NavGraph.Companion.findStartDestination
import androidx.navigation.NavHostController
import androidx.navigation.compose.currentBackStackEntryAsState
import net.deaftone.data.BottomBarScreen
import net.deaftone.data.MainScreenRoutes

@Composable
fun BottomBar(navController: NavHostController) {
val screens = listOf(
net.deaftone.core.BottomBarScreen.AlbumList,
net.deaftone.core.BottomBarScreen.Artists,
BottomBarScreen.AlbumList,
BottomBarScreen.Artists,
)

val hidden = listOf(
net.deaftone.core.MainScreenRoutes.AlbumInfo
MainScreenRoutes.AlbumInfo
)
val navBackStackEntry by navController.currentBackStackEntryAsState()
val currentDestination = navBackStackEntry?.destination
Expand All @@ -51,7 +53,7 @@ fun BottomBar(navController: NavHostController) {

@Composable
fun RowScope.AddItem(
screen: net.deaftone.core.BottomBarScreen,
screen: BottomBarScreen,
currentDestination: NavDestination?,
navController: NavHostController
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ 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.data.BottomBarScreen
import net.deaftone.data.MainScreenRoutes
import net.deaftone.data.NavGraph
import net.deaftone.eurydice.ui.TestScreen1


Expand All @@ -22,8 +24,8 @@ fun MainScreenNavGraph(
NavHost(
modifier = modifier,
navController = navController,
route = net.deaftone.core.NavGraph.BOTTOM_BAR_GRAPH,
startDestination = net.deaftone.core.BottomBarScreen.AlbumList.route,
route = NavGraph.BOTTOM_BAR_GRAPH,
startDestination = BottomBarScreen.AlbumList.route,
enterTransition = { slideIntoContainer(AnimatedContentTransitionScope.SlideDirection.Right) },
exitTransition = { slideOutOfContainer(towards = AnimatedContentTransitionScope.SlideDirection.Left) },
popEnterTransition = {
Expand All @@ -34,12 +36,12 @@ fun MainScreenNavGraph(
}

) {
composable(route = net.deaftone.core.BottomBarScreen.Artists.route) {
composable(route = BottomBarScreen.Artists.route) {
TestScreen1(onItemClick = {
navController.navigate(net.deaftone.core.BottomBarScreen.Artists.route)
navController.navigate(BottomBarScreen.Artists.route)
}, name = "test")
}
composable(route = net.deaftone.core.BottomBarScreen.AlbumList.route) {
composable(route = BottomBarScreen.AlbumList.route) {
AlbumListScreen(onItemClick = {
navController.navigate(BottomBarScreen.AlbumList.route)
}, onNavigationUp = {
Expand All @@ -49,7 +51,7 @@ fun MainScreenNavGraph(
)
}

composable(route = net.deaftone.core.MainScreenRoutes.AlbumInfo.route) { navBackStackEntry ->
composable(route = MainScreenRoutes.AlbumInfo.route) { navBackStackEntry ->
AlbumInfoScreen(onNavigationUp = {
navController.popBackStack()
})
Expand Down
28 changes: 0 additions & 28 deletions core/build.gradle.kts

This file was deleted.

File renamed without changes.
39 changes: 39 additions & 0 deletions core/data/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
plugins {
id("com.android.library")
id("org.jetbrains.kotlin.android")
kotlin("kapt")
}

android {
namespace = "net.deaftone.data"
compileSdk = 34

defaultConfig {
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_18
targetCompatibility = JavaVersion.VERSION_18
}
kotlinOptions {
jvmTarget = "18"
}
}

dependencies {
room()
moshi()
lifecycle()
activity()
}
Empty file added core/data/consumer-rules.pro
Empty file.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.deaftone.core
package net.deaftone.data

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
Expand All @@ -19,6 +19,6 @@ class ExampleInstrumentedTest {
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("net.deaftone.core", appContext.packageName)
assertEquals("net.deaftone.data.test", appContext.packageName)
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">


</manifest>
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package net.deaftone.core.database
package net.deaftone.data

import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import net.deaftone.feature.artist.data.model.Artist
import net.deaftone.feature.artist.data.room.ArtistDao


import net.deaftone.data.model.artist.Artist
import net.deaftone.data.room.ArtistDao
@Database(
entities = [Artist::class],
version = 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.deaftone.core
package net.deaftone.data

object NavGraph {
const val BOTTOM_BAR_GRAPH = "bottom_bar_graph"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package net.deaftone.album.data.model
package net.deaftone.data.model.album

import com.squareup.moshi.Json
import net.deaftone.data.model.song.Song

data class Album(
@Json(name = "id")val id: String,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.deaftone.album.data.model
package net.deaftone.data.model.album

import com.squareup.moshi.Json

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.deaftone.album.data.model
package net.deaftone.data.model.album

import com.squareup.moshi.Json

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.deaftone.feature.artist.data.model
package net.deaftone.data.model.artist

import androidx.room.ColumnInfo
import androidx.room.Entity
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.deaftone.album.data.model
package net.deaftone.data.model.song

import androidx.room.ColumnInfo
import androidx.room.PrimaryKey
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package net.deaftone.data.repository.album

class AlbumRepository
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package net.deaftone.album.data.room
package net.deaftone.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.album.data.model.Album
import net.deaftone.data.model.album.Album

@Dao
interface AlbumDao {
Expand Down
13 changes: 13 additions & 0 deletions core/data/src/main/java/net/deaftone/data/room/ArtistDao.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package net.deaftone.data.room

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import net.deaftone.data.model.artist.Artist

@Dao
interface ArtistDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insertAll(repos: List<net.deaftone.data.model.artist.Artist>)

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package net.deaftone.album.data.service
package net.deaftone.data.service.album

import net.deaftone.album.data.model.AlbumListResponse
import net.deaftone.album.data.model.AlbumResponse
import net.deaftone.data.model.album.AlbumListResponse
import net.deaftone.data.model.album.AlbumResponse
import retrofit2.Response
import retrofit2.http.GET
import retrofit2.http.Path
Expand Down
File renamed without changes
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Eurydice</string>
<string name="app_name">Eurydice\n</string>
</resources>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.deaftone.core
package net.deaftone.data

import org.junit.Test

Expand Down
6 changes: 0 additions & 6 deletions core/src/main/AndroidManifest.xml

This file was deleted.

Loading

0 comments on commit 8a190a1

Please sign in to comment.