Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project modularization, configured konsist and tests for design system components usages #79

Merged
merged 7 commits into from
Jan 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .idea/compiler.xml

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

1 change: 1 addition & 0 deletions .idea/gradle.xml

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

2 changes: 1 addition & 1 deletion .idea/misc.xml

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

13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,23 @@
- [x] Let users search for movies directly just like searching for actors.
- [x] Hilt will be replaced by removing Koin.
- [x] Restructure packages and files by introducing new source files.
- [ ] ~Replace every Spacer composable used in code with various custom AppSpacer.~
- [x] Separate the ViewModel param from Screen and UI composables to see previews for all screens.
- [x] Break composables into smaller for previewing.
- [x] Separate composables into Screen and UI to separated ViewModel usage and previewing for all screens.
- [x] Add feature for adding actors to favorites like movies.
- [x] Add bottom sheet to home screen to support navigation for various screens.
- [x] Implement paging to upcoming lazy list movies in home tab.
- [x] Setup project dependencies, resources for initial testing, write simple test.
- [ ] Write tests for app navigation for all composable destinations.
- [x] Configure spotless check, add initial link rules
- [x] Show movie detail sheet for recommended and similar movies in Movie details screen
- [x] Feature - show watch providers for movies
- [x] Migrate network operations from HttpURLConnection to Ktor
- [x] Move from kapt to ksp
- [x] Restructure project architecture, improve testability, separated classes to packages by features
- [x] Implement simple cache mechanism with LruCache
- [x] Adopted Arrow based error handling and unify UiState across all screens
- [x] Configured konsist and initial tests for design system components usages
- [x] Project modularization for design system.

## Roadmap v0.4.0
### Rename app from Compose actors -> Compose Entertainer.
Expand All @@ -23,6 +31,7 @@
- [ ] Enabled adding seasons to favorites.
- [ ] Move favorites section from home tab to new place (Restructure all screen flows).
- [ ] Collapsable TopBars, BottomBars, Scroll effects, new animations.
- [ ] Write tests for app navigation for all composable destinations.

![AppBanner](/assets/banner.png)

Expand Down
2 changes: 2 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ android {
dependencies {
implementation(platform(libs.androidx.compose.bom))
implementation(platform(libs.kotlin.bom))
implementation(project(":design-system"))

implementation(libs.androidx.core.core.ktx)
implementation(libs.androidx.appcompat)
Expand Down Expand Up @@ -132,6 +133,7 @@ dependencies {

testImplementation(libs.androidx.compose.ui.ui.test.junit4)
testImplementation(libs.io.mockk)
testImplementation(libs.konsist)

androidTestImplementation(libs.androidx.test.ext.junit.ktx)
androidTestImplementation(libs.androidx.compose.ui.ui.test.junit4)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package com.developersbreach.composeactors.core.database.dao

import androidx.lifecycle.LiveData
import androidx.room.*
import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.developersbreach.composeactors.core.database.entity.FavoriteMoviesEntity

@Dao
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package com.developersbreach.composeactors.core.database.dao

import androidx.lifecycle.LiveData
import androidx.room.*
import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.developersbreach.composeactors.core.database.entity.FavoritePersonsEntity

@Dao
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
package com.developersbreach.composeactors.ui.animations

import androidx.compose.animation.core.*
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.AnimationVector1D
import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.RepeatMode
import androidx.compose.animation.core.infiniteRepeatable
import androidx.compose.animation.core.tween
import androidx.compose.foundation.Canvas
import androidx.compose.material.MaterialTheme
import androidx.compose.runtime.Composable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
package com.developersbreach.composeactors.ui.animations

import androidx.compose.animation.core.*
import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.RepeatMode
import androidx.compose.animation.core.animateFloat
import androidx.compose.animation.core.infiniteRepeatable
import androidx.compose.animation.core.rememberInfiniteTransition
import androidx.compose.animation.core.tween
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.MaterialTheme
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
package com.developersbreach.composeactors.ui.animations

import androidx.compose.animation.core.*
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.AnimationVector1D
import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.RepeatMode
import androidx.compose.animation.core.repeatable
import androidx.compose.animation.core.tween
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.MaterialTheme
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
package com.developersbreach.composeactors.ui.animations

import androidx.compose.animation.core.*
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.AnimationVector1D
import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.RepeatMode
import androidx.compose.animation.core.repeatable
import androidx.compose.animation.core.tween
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.size
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ package com.developersbreach.composeactors.ui.components

import android.content.Context
import androidx.compose.foundation.layout.padding
import androidx.compose.material.*
import androidx.compose.material.MaterialTheme
import androidx.compose.material.ScaffoldState
import androidx.compose.material.SnackbarDuration
import androidx.compose.material.Text
import androidx.compose.material.ripple.RippleAlpha
import androidx.compose.material.ripple.RippleTheme
import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -75,19 +78,6 @@ fun ApiKeyMissingShowSnackbar(
}
}

@Composable
fun AppDivider(
verticalPadding: Dp,
thickness: Dp = 1.dp
) {
Divider(
color = MaterialTheme.colors.onBackground.copy(alpha = 0.1f),
thickness = thickness,
startIndent = 0.dp,
modifier = Modifier.padding(vertical = verticalPadding)
)
}

/**
* @param title commonly used text in all screens to show title or header for category.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ package com.developersbreach.composeactors.ui.components

import android.graphics.Rect
import android.view.ViewTreeObserver
import androidx.compose.runtime.*
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.State
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.platform.LocalView

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ import androidx.compose.animation.animateColorAsState
import androidx.compose.animation.core.Spring
import androidx.compose.animation.core.spring
import androidx.compose.material.MaterialTheme
import androidx.compose.runtime.*
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.Stable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.compositeOver
import androidx.compose.ui.graphics.luminance
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ package com.developersbreach.composeactors.ui.screens.actorDetails.composables

import androidx.compose.foundation.Image
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.lazy.items
import androidx.compose.material.MaterialTheme
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.developersbreach.composeactors.data.person.model.FavoritePerson
import com.developersbreach.composeactors.data.movie.model.Movie
import com.developersbreach.composeactors.ui.components.AppDivider
import com.developersbreach.composeactors.ui.components.TabItem
import com.developersbreach.composeactors.ui.components.TabsContainer
import com.developersbreach.composeactors.ui.screens.favorites.tabs.FavoritePersonsTabContent
import com.developersbreach.composeactors.ui.screens.favorites.tabs.FavoriteMoviesTabContent
import com.developersbreach.composeactors.ui.theme.ComposeActorsTheme
import com.developersbreach.designsystem.components.CaDivider

@OptIn(ExperimentalFoundationApi::class)
@Composable
Expand Down Expand Up @@ -60,7 +60,11 @@ fun FavoritesScreenUI(
.padding(paddingValues = paddingValues)
) {
TabsContainer(tabs = favoriteTabs, pagerState = favoritesPagerState)
AppDivider(thickness = 1.dp, verticalPadding = 0.dp)
CaDivider(
thickness = 1.dp,
modifier = Modifier.padding(vertical = 0.dp),
colorAlpha = 0.1f
)
HorizontalPager(
state = favoritesPagerState,
modifier = Modifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import com.developersbreach.composeactors.data.datasource.fake.fakePersonsList
import com.developersbreach.composeactors.data.datasource.fake.fakeMovieDetail
import com.developersbreach.composeactors.data.datasource.fake.fakeMovieList
import com.developersbreach.composeactors.ui.components.ApiKeyMissingShowSnackbar
import com.developersbreach.composeactors.ui.components.AppDivider
import com.developersbreach.composeactors.ui.components.IfOfflineShowSnackbar
import com.developersbreach.composeactors.ui.components.TabItem
import com.developersbreach.composeactors.ui.components.TabsContainer
Expand All @@ -39,6 +38,7 @@ import com.developersbreach.composeactors.ui.screens.home.tabs.TvShowsTabContent
import com.developersbreach.composeactors.ui.screens.modalSheets.OptionsModalSheetContent
import com.developersbreach.composeactors.ui.screens.search.SearchType
import com.developersbreach.composeactors.ui.theme.ComposeActorsTheme
import com.developersbreach.designsystem.components.CaDivider
import kotlinx.coroutines.flow.flow

@Composable
Expand Down Expand Up @@ -149,7 +149,11 @@ private fun HomeScreenUI(
Modifier.fillMaxSize()
) {
TabsContainer(tabs = homeTabs, pagerState = homePagerState)
AppDivider(thickness = 1.dp, verticalPadding = 0.dp)
CaDivider(
thickness = 1.dp,
modifier = Modifier.padding(vertical = 0.dp),
colorAlpha = 0.1f
)
Spacer(modifier = Modifier.padding(vertical = 8.dp))
HorizontalPager(
state = homePagerState,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ package com.developersbreach.composeactors.ui.screens.home

import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.material.Icon
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import com.developersbreach.composeactors.R
import com.developersbreach.composeactors.data.person.model.Person
import com.developersbreach.composeactors.ui.components.AppDivider
import com.developersbreach.composeactors.ui.components.CategoryTitle
import com.developersbreach.composeactors.ui.components.LoadNetworkImage
import com.developersbreach.composeactors.ui.components.ShowProgressIndicator
import com.developersbreach.composeactors.ui.screens.actorDetails.ActorDetailsScreen
import com.developersbreach.composeactors.ui.screens.home.HomeData
import com.developersbreach.designsystem.components.CaDivider


@Composable
Expand All @@ -58,7 +58,10 @@ fun PersonsTabContent(
navigateToSelectedPerson = navigateToSelectedPerson,
personsListState = popularPersonsListState
)
AppDivider(verticalPadding = 32.dp)
CaDivider(
modifier = Modifier.padding(vertical = 32.dp),
colorAlpha = 1f
)
CategoryTitle(stringResource(R.string.category_actors_trending))
Spacer(modifier = Modifier.padding(vertical = 8.dp))
PersonsList(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package com.developersbreach.composeactors.ui.screens.modalSheets

import androidx.compose.animation.core.AnimationSpec
import androidx.compose.material.*
import androidx.compose.material.ExperimentalMaterialApi
import androidx.compose.material.ModalBottomSheetState
import androidx.compose.material.ModalBottomSheetValue
import androidx.compose.material.SwipeableDefaults
import androidx.compose.material.rememberModalBottomSheetState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.rememberCoroutineScope
import kotlinx.coroutines.Job
Expand Down
Loading
Loading