GithubHelp home page GithubHelp logo

nimrodda / github-commit-browser Goto Github PK

View Code? Open in Web Editor NEW
55.0 4.0 9.0 600 KB

A blog companion sample project that demonstrates saving UI state after process death on Android utilizing the community established 3rd party libraries

License: Apache License 2.0

Kotlin 97.07% Java 2.93%
android android-ui android-architecture android-development android-architecture-components android-architecture-lifecycle android-viewmodel dagger-hilt

github-commit-browser's People

Contributors

guilhe avatar nimrodda 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

Watchers

 avatar  avatar  avatar  avatar

github-commit-browser's Issues

Is it possible to use this with FragmentFactory?

Hi Nimrod,
I'm trying to add FragmentFactory to your example but I'm blocked in a circular dependency.

Usually constructor injected Fragments are like this when used with FragmentFactory

class Fragment @Inject constructor (
    private val viewModelFactory: ViewModelProvider.Factory
) : Fragment() { 
    private val viewModel: MyViewModel by viewModels { viewModelFactory }
}

The problem I have it's that now with the AssistedInjected ViewModelFactory my Fragment code should change to something like this:

class Fragment @Inject constructor (
    private val viewModelFactory: ViewModelFactory
) : Fragment() { 
    private val viewModel: MyViewModel by viewModels { viewModelFactory }
}

But here the circular dependency:
Fragment needs ViewModelFactory to be created ->
ViewModelFactory need a SavedStateRegistryOwner to be created ->
I can't create the Fragment to get one.

Do you have ideas on how this could be solved?
BTW Thank you for you article ๐Ÿ‘

Navgraph viewmodels

for viewmodels that are bound to navgraphs instead of activities or fragments, how do we create the savedstateRegistryOwner?

as below

@Binds
    abstract SavedStateRegistryOwner bindSavedStateRegistryOwner(CommitListFragment commitListFragment);

[Question] - How to dynamically set the bundle from AbstractSavedStateViewModelFactory

Hello @Nimrodda ,

I've the same DI setup as you, everything works like a charm, but I was wondering, what if we would like to dynamically put some values inside the bundle (from AbstractSavedStateViewModelFactory) to be used inside the ViewModel - let's say I want to catch something from getIntent() or getArguments() and forward it through the bundle - how would you implement it?

Thanks once again.

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.