GithubHelp home page GithubHelp logo

czyrux / mvploadersample Goto Github PK

View Code? Open in Web Editor NEW
141.0 141.0 24.0 62 KB

Sample project to showcase how to use Android Loaders with MVP to preserve Presenter across orientation changes

Java 100.00%

mvploadersample's People

Contributors

czyrux 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

mvploadersample's Issues

Possible null Presenter reference

In the BasePresenterActivity you call the initLoader() on the onCreate() method.

When the onLoadFinished of that given loader is called you set the presenter field with the loaded presenter.

However, you reference the presenter on the onStart() method but is there any guarantee that the onLoadFinished callback has been executed prior to the onStart() method (i.e. do we know for sure that we have a presenter by the time onStart() executes)? Thanks!

Edit: On the documentation of the Loader, startLoading states that

This function will normally be called for you automatically by LoaderManager when the associated fragment/activity is being started.

I didn't assume that the state of "being started" corresponded to the onStart() method or equivalent thus my question. And as it is documented it seems that may not always happen. Closing the issue. Thanks!

BasePresenterFragment calls onPresenterPrepared before attaching the view.

In onLoadFinished() of the BasePresenterFragment you call:

onPresenterPrepared(presenter); before presenter.onViewAttached(getPresenterView());

I would think this might potentially cause an issue if you call the presenter in the onPresenterPrepared method of the fragment before the view is attached.

How to recieve cursor

Hello All !

I just started MVP in android.
I want to create adapter from cursor so How to get cursor from onLoadFinished(Loader

loader, P presenter) ?

Thanks,
Kaushlendra.

Attempt to invoke interface method 'PresenterFactory.create()' on a null object reference`

Hey,

I ve implemented your simple in to an app, when launching the app I am getting this error :


Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'presenter.BasePresenter presenter.loader.PresenterFactory.create()' on a null object reference`
at presenter.loader.PresenterLoader.onForceLoad(PresenterLoader.java:39)
at android.support.v4.content.Loader.forceLoad(Loader.java:329)

in this line in particular
mPresenter = mPresenterFactory.create();

I am using dagger 2 to inject the presenter factory inside the presenter

Add Javadoc

Add Javadoc in order to clarify methods in Base Activity and Fragment

Loader gets reset after returning from "child" Activity

Steps to reproduce:

having an Activity with Presenter-Loader. Loader behaves correctly on orientation change. But:
having the Activity in Portrait, calling/starting another Activity that is forced to landscape and the returning back from this activity lets the Loadermanager reset the loader and the Presenter does not survive.

Has anybody else experienced that issue?

isplayer Issue

Hello Guys,

I need help,
I have use isplayer.js file is when maximize isplayer cant work on print-screen disable functionality
how to disable in full screen mode printscreen key using javascript.

Regards,
Vikash Das

onStart in BasePresenterFragment

In BasePresenterFragment you do:

 @Override
    public void onStop() {
        presenter.onViewDetached();
        super.onStop();
        Log.i(TAG, "onPause-" + tag());
    }

But what about attaching the view back in onStart() method?
I think it should be like that:

 @Override
    public void onStop() {
    if(presenter != null){        
        presenter.onViewDetached();
    }
        super.onStop();
        Log.i(TAG, "onStop-" + tag());
    }
    @Override
    public void onStart() {
        super.onStart();
        if(presenter != null){
             presenter.onViewAttached(getPresenterView());
       }
        Log.i(TAG, "onStart-" + tag());
    }

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.