Skip to content

Commit

Permalink
Convert to multi module
Browse files Browse the repository at this point in the history
  • Loading branch information
112RG committed Oct 19, 2023
1 parent d323a37 commit 30b8676
Show file tree
Hide file tree
Showing 58 changed files with 708 additions and 66 deletions.
17 changes: 17 additions & 0 deletions .idea/deploymentTargetDropDown.xml

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

7 changes: 7 additions & 0 deletions .idea/gradle.xml

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

1 change: 0 additions & 1 deletion .idea/misc.xml

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

3 changes: 3 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

This file was deleted.

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 @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.deaftone.eurydice.ui.theme
package net.deaftone.eurydice.theme

import androidx.compose.ui.graphics.Color

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -37,6 +38,8 @@ private val LightColorScheme = lightColorScheme(
*/
)

@RequiresApi(Build.VERSION_CODES.CUPCAKE)

@Composable
fun EurydiceTheme(
darkTheme: Boolean = isSystemInDarkTheme(),
Expand All @@ -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
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/net/deaftone/eurydice/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -51,7 +51,7 @@ fun BottomBar(navController: NavHostController) {

@Composable
fun RowScope.AddItem(
screen: BottomBarScreen,
screen: net.deaftone.core.BottomBarScreen,
currentDestination: NavDestination?,
navController: NavHostController
) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
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
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
Expand All @@ -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 = {
Expand All @@ -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()
})
Expand Down
Binary file removed app/src/main/res/drawable-xxxhdpi/ic_home.png
Binary file not shown.
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ buildscript {

dependencies {
classpath(Dependencies.hiltAgp)
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.10")
}
}
1 change: 1 addition & 0 deletions core/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
28 changes: 28 additions & 0 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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()
}
21 changes: 21 additions & 0 deletions core/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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)
}
}
6 changes: 6 additions & 0 deletions core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?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,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"
Expand All @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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],
Expand Down
File renamed without changes
Loading

0 comments on commit 30b8676

Please sign in to comment.