Giter Site home page Giter Site logo

ezike / baking-app-kotlin Goto Github PK

View Code? Open in Web Editor NEW
458.0 11.0 83.0 3.91 MB

Android architecture sample with dynamic feature modularisation, clean architecture with MVI (Uni-directional data flow), dagger hilt, DFM Navigation, kotlin coroutines with StateFlow and Exo player.

License: Apache License 2.0

Kotlin 100.00%
dagger-hilt dagger-android dynamicfeatures android mvi-android mvvm mvi cleanarchitecture clean-architecture clean-code

baking-app-kotlin's Introduction

BakingApp

Android Build kotlin MVI coroutines Dagger

The Baking App displays a list of recipes, ingredients required to make it, and steps plus video tutorials on how to make the recipe.

This is a rewrite of the Baking App project from the Udacity Android Nanodegree Programme

Features

  • Kotlin Coroutines with Flow (State Flow)
  • Clean Architecture with MVI (Uni-directional data flow)
  • Jetpack Navigation for DFMs
  • Dynamic Feature Modules
  • Video streaming with Exoplayer
  • Dagger Hilt
  • Kotlin Gradle DSL

Prerequisite

To build this project, you require:

  • Android Studio artic fox canary 6
  • Gradle 7.0

Libraries

Screenshots


Author

Ezike Tobenna

License

This project is licensed under the Apache License 2.0 - See: http://www.apache.org/licenses/LICENSE-2.0.txt

baking-app-kotlin's People

Contributors

ezike avatar tobenna-paystack avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

baking-app-kotlin's Issues

data class *ViewState over sealed class for *ViewState

Is there any concern why using data class RecipeViewState instead of using sealed class RecipeViewState?

Equivalent to your existing code using sealed class

sealed class RecipeViewState : ViewState {
 object Loading : RecipeViewState()
 object Refreshing : RecipeViewState()
 data class LoadedRecipes(val recipes: List<RecipeModel>) : RecipeViewState()
 data class LikedRecipe(val recipe: RecipeModel) : RecipeViewState() // adding a new state for liked item
 data class Error(val error: String?, val errorEvent: ViewEvent<String>?, val isEmpty: Boolean) // Unavailable, No data or empty etc
}


// in Fragment 
// instead of:
    override fun render(state: RecipeViewState) {
        when {
            state.isDataUnavailable -> binding.renderEmptyState(state)
            state.isDataAvailableError -> binding.renderDataAvailableErrorState(state)
            state.isNoDataError -> binding.renderNoDataErrorState(state)
            state.isLoading -> binding.renderLoadingState()
            state.isRefreshing -> binding.renderRefreshState()
            else -> binding.renderSuccessState(state)
        }
    }

// modifed to:

    override fun render(state: RecipeViewState) {
        when (state) {
            is Error -> {  
                if (state.error != null) binding.renderNoDataErrorState(state)
                if (state.errorEvent != null) binding.renderDataAvailableErrorState(state)
                if (state.isEmpty) binding.renderEmptyState(state) 
            }
            Loading -> binding.renderLoadingState()
            Refreshing -> binding.renderRefreshState()
            is LikedRecipe -> binding.renderLikedState(state)
            is LoadedRecipes -> binding.renderSuccessState(state)
            // no else branch
        }
    }

Pros:

  1. No need manually override every property/member of RecipeViewState using .copy with a new state
  2. No else branch in override fun render
  3. No need configuring a lot of function/method to determine state inside RecipeViewState, e.g for current approach: val *state: RecipeViewState get() = /* this.copy(isLoading = false, etc) */

@Ezike

Issue with Gradle Build

Hi Ezike, The current version of the project is using Bintray Repository and the AGP Version is also not compatible.
I'm currently using Android Studio Dolphin Canary.

Problem in build project

Hello,
thank you for your great job. when I try to build project I got this error:

This version of the Android Support plugin for IntelliJ IDEA (or Android Studio) cannot open this project, please retry with version 4.2 or newer.

-- I use android studio 4.1 version (is there available android studio 4.2 in this time?)

Retrofit Coroutine Exception Handling

Does the current view state handle retrofit exception? E.g: 4xx or 5xx Retrofit error response/body

CMIIW, I cannot find try-catch blocks in your ViewModel, Processor, Remote & Repository to handle that

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.