Giter VIP home page Giter VIP logo

Comments (16)

passsy avatar passsy commented on August 21, 2024

interesting how you removed OperatorSemaphore 👍

from nucleus.

Trikke avatar Trikke commented on August 21, 2024

Going to try this out, looks very promising!

from nucleus.

cavarzan avatar cavarzan commented on August 21, 2024

@konmik, without getView(), how can I call the view without using the restartable methods?
I was doing something like this:
Observable.just(null).compose(deliver()).subscribe(o -> { getView().doStuff(); });

Thnks =)

from nucleus.

konmik avatar konmik commented on August 21, 2024

Hi, you can do the same but now after deliver you will get the View and data bundled into Delivery object.

from nucleus.

cavarzan avatar cavarzan commented on August 21, 2024

OK, since deliver() was removed, is the deliverFirst() that have the same behavior?
Ins`t that too verbose? Because after subscription I need to get the Delivery and create two more Action2 to call the view object.

from nucleus.

cavarzan avatar cavarzan commented on August 21, 2024

By example: This is the after and the before.

If I change the deliver() to deliverFirst() can produce NullPointer
captura de tela 2015-08-29 as 13 35 30
captura de tela 2015-08-29 as 13 36 04

from nucleus.

konmik avatar konmik commented on August 21, 2024

This is how it looks like now:

    add(db
        .updatable(
            Label.TABLE,
            () -> db.query(Label.SELECT_ALL_SQL, Label.fromCursor))
        .compose(this.<SolidList<Label>>deliverLatestCache())
        .subscribe(this.<SolidList<Label>>split(InputView::onLabels)));

from nucleus.

cavarzan avatar cavarzan commented on August 21, 2024

GOT IT!

Thanks again @konmik

captura de tela 2015-08-29 as 13 52 46

from nucleus.

cnnranderson avatar cnnranderson commented on August 21, 2024

Everything has been going great, and I honestly love how much better things feel in the 2.0 beta release. I have run into one problematic situation though, and was wondering if anyone else had a problem like mine.

Currently, I have an app with a NavigationView widget, and a TabLayout with child fragments inside of the container fragment. The child fragments all have their own presenter, along with the parent fragment having it's own presenter.

My problem is, whenever I have a configuration change (read: rotation) when that fragment with tabs and child fragments is in view (or have been shown/loaded once), the app will crash due to some error thrown by Nucleus.

The lines it hits are here:

public void onRestoreInstanceState(Bundle presenterState) {
    if (presenter != null)
        throw new IllegalArgumentException("onRestoreInstanceState() should be called before onResume()");
    this.bundle = presenterState;
}

Which is found in the PresenterLifeCycleDelegate class (82-86). I'm not quite sure why it's hitting this, from what I've tested (it's been hard to narrow down specifically what is wrong, but I think it has to do with Child Fragments). If more information is needed, I'll gladly test anything you request and let you know my findings.

from nucleus.

konmik avatar konmik commented on August 21, 2024

Hi, @cnnranderson!

Are you re-attaching the same fragment a second time or you're re-creating them? Or you just create them once and let the fragment manager to manage them?

I've just tried Nucleus with a child fragment and it works fine!
(I never tried child fragments before, but they work! :)

If you need a help, please create a simplest possible example that can reproduce your problem. I normally help during one-two days.

from nucleus.

konmik avatar konmik commented on August 21, 2024

BTW, I'm going to release Nucleus 2.0 as soon as your issue will be resolved. It (Nucleus 2.0) is pretty stable now.

from nucleus.

cnnranderson avatar cnnranderson commented on August 21, 2024

Oh, thanks for the quick response! I will try and throw together a basic app/repo demonstrating the problem (hopefully I can reproduce it along the way -- or better yet, not reproduce it and figure out where I went wrong!).

I am using a fragment pager adapter to create new instances of the fragments. Here is a snippet of the parent fragment class and the pager adapter, if it's relevant at all:

Parent: https://gist.github.com/cnnranderson/5770141012f80407468f
Adapter: https://gist.github.com/cnnranderson/c865e1da4ad380e4f7d2

Also just out of curiosity, does the parent Activity need to be of type NucleusAppCompatActivity<>?

from nucleus.

konmik avatar konmik commented on August 21, 2024

You inherit from Nucleus view classes if you need a presenter.

from nucleus.

cnnranderson avatar cnnranderson commented on August 21, 2024

Apologies for the delay. Got a little pre-occupied the past two weeks with other projects.

I've discovered the reason for the configuration problems lied in when I was injecting my fragments/presenters. Didn't realize I had been injecting in the onAttached method, which it should have been in onCreate.

I would like to ask, if you ever get a chance, to review for leaks using leakcanary. I'm not sure if it's on my end, if I'm not using restartable's correctly, or if it's the way the presenters work. I keep getting fragment instance leaks from their respective presenters.

from nucleus.

konmik avatar konmik commented on August 21, 2024

Hi, I tested for leaks thoroughly. I normally use MAT memory analyzer during development a lot.

I'm not sure if LeakCanary will work properly here - we're doing some background jobs that it can consider to be leaks.

from nucleus.

cnnranderson avatar cnnranderson commented on August 21, 2024

Ah okay, that must be it then. Thanks for the heads up.

from nucleus.

Related Issues (20)

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.