-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split :feature:home module to api and impl
- Loading branch information
Showing
39 changed files
with
330 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
plugins { | ||
id "moop.android.library" | ||
id "moop.android.compose" | ||
id "moop.android.hilt" | ||
} | ||
|
||
android { | ||
namespace "soup.movie.feature.home" | ||
} | ||
|
||
dependencies { | ||
implementation projects.core.kotlin | ||
implementation projects.core.designsystem | ||
implementation projects.data.model | ||
|
||
implementation libs.kotlin.stdlib | ||
|
||
implementation libs.androidx.hilt.navigation.compose | ||
implementation libs.compose.foundation | ||
} |
File renamed without changes.
78 changes: 78 additions & 0 deletions
78
feature/home/api/src/main/java/soup/movie/feature/home/HomeComposableFactory.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
* Copyright 2024 SOUP | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package soup.movie.feature.home | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.platform.LocalContext | ||
import dagger.hilt.EntryPoint | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.android.EntryPointAccessors | ||
import dagger.hilt.components.SingletonComponent | ||
import soup.movie.core.designsystem.windowsizeclass.WindowWidthSizeClass | ||
import soup.movie.model.MovieModel | ||
|
||
interface HomeComposableFactory { | ||
|
||
@Composable | ||
fun HomeNavGraph( | ||
widthSizeClass: WindowWidthSizeClass, | ||
onSearchClick: () -> Unit, | ||
onMovieItemClick: (MovieModel) -> Unit, | ||
) | ||
|
||
@Composable | ||
fun MovieList( | ||
movies: List<MovieModel>, | ||
onItemClick: (MovieModel) -> Unit, | ||
onLongItemClick: (MovieModel) -> Unit, | ||
modifier: Modifier = Modifier, | ||
) | ||
|
||
@Composable | ||
fun NoMovieItems( | ||
modifier: Modifier = Modifier, | ||
) | ||
|
||
@Composable | ||
fun MovieAgeTag( | ||
age: Int, | ||
modifier: Modifier = Modifier, | ||
) | ||
|
||
@Composable | ||
fun MovieDDayTag( | ||
text: String, | ||
modifier: Modifier = Modifier, | ||
) | ||
} | ||
|
||
@Composable | ||
fun rememberHomeComposableFactory(): HomeComposableFactory { | ||
val context = LocalContext.current | ||
return remember(context) { | ||
EntryPointAccessors | ||
.fromApplication(context, HomeComposableFactoryEntryPoint::class.java) | ||
.homeComposableFactory() | ||
} | ||
} | ||
|
||
@EntryPoint | ||
@InstallIn(SingletonComponent::class) | ||
interface HomeComposableFactoryEntryPoint { | ||
fun homeComposableFactory(): HomeComposableFactory | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<manifest /> |
87 changes: 87 additions & 0 deletions
87
feature/home/impl/src/main/java/soup/movie/feature/home/impl/HomeComposableFactoryImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/* | ||
* Copyright 2024 SOUP | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package soup.movie.feature.home.impl | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.hilt.navigation.compose.hiltViewModel | ||
import soup.movie.core.designsystem.windowsizeclass.WindowWidthSizeClass | ||
import soup.movie.feature.home.HomeComposableFactory | ||
import soup.movie.model.MovieModel | ||
import javax.inject.Inject | ||
|
||
class HomeComposableFactoryImpl @Inject constructor() : HomeComposableFactory { | ||
|
||
@Composable | ||
override fun HomeNavGraph( | ||
widthSizeClass: WindowWidthSizeClass, | ||
onSearchClick: () -> Unit, | ||
onMovieItemClick: (MovieModel) -> Unit, | ||
) { | ||
HomeNavGraph( | ||
widthSizeClass = widthSizeClass, | ||
viewModel = hiltViewModel(), | ||
onSearchClick = onSearchClick, | ||
onMovieItemClick = onMovieItemClick, | ||
) | ||
} | ||
|
||
@Composable | ||
override fun MovieList( | ||
movies: List<MovieModel>, | ||
onItemClick: (MovieModel) -> Unit, | ||
onLongItemClick: (MovieModel) -> Unit, | ||
modifier: Modifier, | ||
) { | ||
MovieList( | ||
movies = movies, | ||
onItemClick = onItemClick, | ||
onLongItemClick = onLongItemClick, | ||
modifier = modifier, | ||
) | ||
} | ||
|
||
@Composable | ||
override fun NoMovieItems( | ||
modifier: Modifier, | ||
) { | ||
soup.movie.feature.home.impl.tab.NoMovieItems( | ||
modifier = modifier, | ||
) | ||
} | ||
|
||
@Composable | ||
override fun MovieAgeTag( | ||
age: Int, | ||
modifier: Modifier, | ||
) { | ||
soup.movie.feature.home.impl.favorite.MovieAgeTag( | ||
age = age, | ||
modifier = modifier, | ||
) | ||
} | ||
|
||
@Composable | ||
override fun MovieDDayTag( | ||
text: String, | ||
modifier: Modifier, | ||
) { | ||
soup.movie.feature.home.impl.favorite.MovieDDayTag( | ||
text = text, | ||
modifier = modifier, | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.