Skip to content

Commit b0e4e50

Browse files
authored
Merge pull request #85 from RajashekarRaju/shreyas/update-readme-v0.4.0
Update README.md for v0.4.0 roadmap and revised sections
2 parents 45b8e89 + 53827ec commit b0e4e50

File tree

1 file changed

+13
-281
lines changed

1 file changed

+13
-281
lines changed

README.md

Lines changed: 13 additions & 281 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,25 @@
11
# Compose Actors :dancer:
22

3-
## Roadmap v0.3.0
4-
5-
- [x] Let users search for movies directly just like searching for actors.
6-
- [x] Hilt will be replaced by removing Koin.
7-
- [x] Restructure packages and files by introducing new source files.
8-
- [x] Separate the ViewModel param from Screen and UI composables to see previews for all screens.
9-
- [x] Break composables into smaller for previewing.
10-
- [x] Separate composables into Screen and UI to separated ViewModel usage and previewing for all screens.
11-
- [x] Add feature for adding actors to favorites like movies.
12-
- [x] Add bottom sheet to home screen to support navigation for various screens.
13-
- [x] Implement paging to upcoming lazy list movies in home tab.
14-
- [x] Setup project dependencies, resources for initial testing, write simple test.
15-
- [x] Configure spotless check, add initial link rules
16-
- [x] Show movie detail sheet for recommended and similar movies in Movie details screen
17-
- [x] Feature - show watch providers for movies
18-
- [x] Migrate network operations from HttpURLConnection to Ktor
19-
- [x] Move from kapt to ksp
20-
- [x] Restructure project architecture, improve testability, separated classes to packages by features
21-
- [x] Implement simple cache mechanism with LruCache
22-
- [x] Adopted Arrow based error handling and unify UiState across all screens
23-
- [x] Configured konsist and initial tests for design system components usages
24-
- [x] Project modularization for design system.
25-
26-
## Roadmap v0.4.0
27-
### Rename app from Compose actors -> Compose Entertainer.
3+
![AppBanner](/assets/banner.png)
4+
5+
## Download the APK
6+
Access the latest APK for Compose Actors from the link below.
7+
8+
[![Get APK](https://img.shields.io/badge/Get%20APK-maroon?style=for-the-badge&logo=android&logoColor=white)](https://github.com/RajashekarRaju/compose-actors/releases/download/v0.3.0/app-release-v0.3.0.apk)
9+
10+
## Current Roadmap v0.4.0
2811

12+
- [ ] Move material design components and dependencies to separate design-system module
13+
- [ ] Extend Konsist tests for all design system component usages.
14+
- [ ] Introduce common preview annotations for composables.
2915
- [ ] Add new feature seasons or series information to app.
3016
- [ ] Include seasons in home tabs navigation.
31-
- [ ] Enabled adding seasons to favorites.
17+
- [ ] Allow adding seasons to favorites.
3218
- [ ] Move favorites section from home tab to new place (Restructure all screen flows).
3319
- [ ] Collapsable TopBars, BottomBars, Scroll effects, new animations.
3420
- [ ] Write tests for app navigation for all composable destinations.
3521

36-
![AppBanner](/assets/banner.png)
37-
38-
### New release - v0.2.0
39-
40-
- [x] Add DI with Koin.
41-
- [x] Modal bottom sheets & Bottom sheets.
42-
- [x] Migrate to compose insets from accompanist.
43-
- [x] Add new movie details screen, made changes to actors details screen.
44-
- [x] Improved search functionality, added voice search, handled keyboard changes.
45-
- [x] New feature to add Movie to favorites.
46-
- [x] Add new database repository layer for favorites.
47-
- [x] Add tabs in Home screen with actors/movies/favorites categories.
48-
49-
## V2 Previews
22+
## V3 Previews
5023

5124
### Home Tabs
5225

@@ -109,216 +82,14 @@ key for data to show up in directory `/utils/ApiKey.kt`.
10982

11083
## :mag: Search Animation
11184

112-
```kotlin
113-
// Simple progressive circle looking animation
114-
val animateCircle = remember { Animatable(0f) }.apply {
115-
AnimateShapeInfinitely(this)
116-
}
117-
@Composable
118-
fun AnimateShapeInfinitely(
119-
// shape which will be animated infinitely.
120-
animateShape: Animatable<Float, AnimationVector1D>,
121-
// final float state to be animated.
122-
targetValue: Float = 1f,
123-
// duration took for animating once.
124-
durationMillis: Int = 1000
125-
) {
126-
LaunchedEffect(animateShape) {
127-
animateShape.animateTo(
128-
targetValue = targetValue,
129-
animationSpec = infiniteRepeatable(
130-
animation = tween(durationMillis, LinearEasing),
131-
repeatMode = RepeatMode.Restart
132-
)
133-
)
134-
}
135-
}
136-
```
137-
138-
Although I couldn't fully achieve the desired result as I imagined, I've settled for this current
139-
state for now.
140-
14185
<img src="assets/search_anim.gif" alt="Offline Dark" />
14286

143-
Calling the function once will draw a circle, in my example I have drawn it thrice with differnt colors, radius and scales.
144-
145-
```kotlin
146-
DrawCircleOnCanvas(
147-
scale = scaleInfiniteTransition(targetValue = 2f, durationMillis = 600),
148-
color = circleColor,
149-
radiusRatio = 4f
150-
)
151-
```
152-
153-
I have kept all initial states of 3 circles to 0f to make end result much smoother.<br>
154-
Random or uneven gaps between initial/target/durationMillis will make end animation look more abrupt and aggressively pushing it's bounds.
155-
156-
```kotlin
157-
@Composable
158-
private fun scaleInfiniteTransition(
159-
initialValue: Float = 0f,
160-
targetValue: Float,
161-
durationMillis: Int,
162-
): Float {
163-
val infiniteTransition = rememberInfiniteTransition()
164-
val scale: Float by infiniteTransition.animateFloat(
165-
initialValue = initialValue,
166-
targetValue = targetValue,
167-
animationSpec = infiniteRepeatable(
168-
animation = tween(durationMillis, easing = LinearEasing),
169-
repeatMode = RepeatMode.Reverse
170-
)
171-
)
172-
return scale
173-
}
174-
```
175-
176-
```kotlin
177-
@Composable
178-
fun DrawCircleOnCanvas(
179-
scale: Float,
180-
color: Color,
181-
radiusRatio: Float
182-
) {
183-
Canvas(
184-
modifier = Modifier
185-
.fillMaxSize()
186-
.graphicsLayer {
187-
scaleX = scale
188-
scaleY = scale
189-
}
190-
) {
191-
val canvasWidth = size.width
192-
val canvasHeight = size.height
193-
drawCircle(
194-
color = color,
195-
center = Offset(
196-
x = canvasWidth / 2,
197-
y = canvasHeight / 2
198-
),
199-
radius = size.minDimension / radiusRatio,
200-
)
201-
}
202-
}
203-
```
204-
20587
## :mobile_phone_off: No TMDB_API_KEY provided state
20688

20789
| Dark | Light |
20890
| :--: | :---: |
20991
| <img src="assets/offline_dark.gif" alt="Offline Dark" width="200" /> | <img src="assets/offline_light.gif" alt="Offline Light" width="200" /> |
21092

211-
Show a Snackbar message with `SnackbarHostState`.
212-
213-
```kotlin
214-
if (!isOnline) {
215-
LaunchedEffect(scope) {
216-
scope.launch {
217-
scaffoldState.snackbarHostState.showSnackbar(
218-
message = context.getString(R.string.offline_snackbar_message),
219-
duration = SnackbarDuration.Indefinite
220-
)
221-
}
222-
}
223-
}
224-
```
225-
226-
### ViewModels
227-
228-
All screens have their own ViewModels for managing the ui state.
229-
230-
```kotlin
231-
class HomeViewModel(
232-
application: Application,
233-
private val repository: AppRepository
234-
) : AndroidViewModel(application) {
235-
236-
// Holds the state for values in HomeViewState
237-
var uiState by mutableStateOf(HomeViewState())
238-
private set
239-
240-
init {
241-
// Update the values in uiState from all data sources.
242-
viewModelScope.launch {
243-
uiState = HomeViewState(isFetchingActors = true)
244-
val popularActorsList = repository.getPopularActorsData()
245-
val trendingActorsList = repository.getTrendingActorsData()
246-
uiState = HomeViewState(
247-
popularActorList = popularActorsList,
248-
trendingActorList = trendingActorsList,
249-
isFetchingActors = false
250-
)
251-
}
252-
}
253-
}
254-
```
255-
256-
Model for UI state of the screen.
257-
258-
```kotlin
259-
data class HomeViewState(
260-
var popularActorList: List<Actor> = emptyList(),
261-
var trendingActorList: List<Actor> = emptyList(),
262-
val isFetchingActors: Boolean = false,
263-
)
264-
```
265-
266-
ViewModel used in a screen-level composable.
267-
268-
```kotlin
269-
@Composable
270-
fun HomeScreen(
271-
viewModel: HomeViewModel
272-
) {
273-
val uiState = viewModel.uiState
274-
Box {
275-
ScreenContent(uiState.popularActorList)
276-
}
277-
}
278-
```
279-
280-
### Repository
281-
282-
All ViewModels have access to repository which has single instance.
283-
284-
```kotlin
285-
class AppRepository {
286-
287-
private val networkDataSource by lazy { NetworkDataSource() }
288-
289-
suspend fun getPopularActorsData(): List<Actor> {
290-
val listData: List<Actor>
291-
withContext(Dispatchers.IO) {
292-
listData = networkDataSource.getPopularActors()
293-
}
294-
return listData
295-
}
296-
}
297-
```
298-
299-
Instantiated repository will be passed to all ViewModels.
300-
301-
```kotlin
302-
val repository = (application as ComposeActorsApp).repository
303-
304-
NavHost(
305-
navController = navController,
306-
startDestination = startDestination
307-
) {
308-
composable(
309-
"Destination Route"
310-
) {
311-
HomeScreen(
312-
viewModel = viewModel(
313-
factory = HomeViewModel.provideFactory(
314-
application, repository
315-
)
316-
)
317-
)
318-
}
319-
}
320-
```
321-
32293
## :hammer: Structure
32394
<!--
32495
| :file_folder: data | :file_folder: navigation | :file_folder: repository | :file_folder: root |
@@ -372,45 +143,6 @@ root
372143
└── Application.kt
373144
```
374145

375-
## :cyclone: Image loading with Coil
376-
377-
Reusable composable used in all screens to load image from an Url.
378-
379-
```kotlin
380-
@Composable
381-
fun LoadNetworkImage(
382-
imageUrl: String,
383-
contentDescription: String,
384-
modifier: Modifier,
385-
shape: Shape
386-
) {
387-
Image(
388-
painter = rememberImagePainter(
389-
data = imageUrl,
390-
builder = {
391-
placeholder(R.drawable.animated_progress)
392-
error(R.drawable.ic_image_not_available)
393-
}),
394-
contentDescription = contentDescription,
395-
contentScale = ContentScale.Crop,
396-
modifier = modifier
397-
.clip(shape)
398-
.background(color = MaterialTheme.colors.surface)
399-
)
400-
}
401-
```
402-
403-
Then we will just call the composable anywhere in app screens.
404-
405-
```kotlin
406-
LoadNetworkImage(
407-
imageUrl = "https://image_url",
408-
contentDescription = stringResource(R.string.cd_movie_poster),
409-
modifier = Modifier.size(100.dp, 150.dp),
410-
shape = MaterialTheme.shapes.medium,
411-
)
412-
```
413-
414146
## :art: App Theme
415147

416148
### :rainbow: Material Design 2.

0 commit comments

Comments
 (0)