Giter VIP home page Giter VIP logo

eli-fox / lego-catalog Goto Github PK

View Code? Open in Web Editor NEW
767.0 767.0 189.0 6.17 MB

A LEGO® Catalog app illustrating current Android Architecture state using Android development best practices.

Home Page: https://medium.com/@eli.fox/android-architecture-starring-kotlin-coroutines-jetpack-mvvm-room-paging-retrofit-and-dagger-7749b2bae5f7?sk=9c5a7af2fbf5d4a04e72322bfb245489

License: Apache License 2.0

Kotlin 100.00%

lego-catalog's People

Contributors

eli-fox avatar ilyalisovoy 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lego-catalog's Issues

How to handle retry request?

with this pattern, it is really easy to use, but i have a problem to retry call API when got error, because we already have livedata in repository and calling api in datasource, how we can get retry request with this pattern?

how to test LegoThemeViewModel and LegoThemeRepository

I am following your tutorial and I have implemented only LegoTheme part with only parsing data from remote functionality (Room is not implemented)

I would like to test my LegoThemeViewModel and LegoThemeRepository classes logic

How can i run the test on these classes, Please can you help me

Refresh Cache when Activity onCreate() called

When I click on Back button, Activity get destroyed ( but instance of app still exist as I can access it from recent apps). What I expect is a call to refresh cache method when I start the app again, but it never get called.

But when I destroy instance of app by clearing from recent app and start the app, refresh cache method get called.

Isn't it better to refresh cache when Activity create again?

Result class refactoring

Great project, thanks for sharing!

I have some minor improve suggestion - Result class is currently implemented in Java style and not getting benefits of the Kotlin compiler.

Having Result class implemented as

sealed class Result<out T> {
    class loading<T> : Result<T>()
    data class error<T>(val message: String) : Result<T>()
    data class success<T>(val data: T) : Result<T>()
}

you can avoid excess nullability checks(!!) and possible exceptions in places like


            if (responseStatus.status == SUCCESS) {
                saveCallResult(responseStatus.data!!)
            } else if (responseStatus.status == ERROR) {
                emit(Result.error<T>(responseStatus.message!!))
                emitSource(source)
            }

and have it in more Kotlin way

            if (responseStatus is Result.success) {
                saveCallResult(responseStatus.data)
            } else if (responseStatus is Result.error) {
                emit(Result.error<T>(responseStatus.message))
                emitSource(source)
            }

Hope you find it useful :)

Use Flow in room

Hi!

Is it possible to substitute livedata on room Dao to use flow and suspend fun?
If yes, can you do it in a separate branch or update this example?
Thanks a lot and nice job

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.