Comments (16)
interesting how you removed OperatorSemaphore
👍
from nucleus.
Going to try this out, looks very promising!
from nucleus.
@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.
Hi, you can do the same but now after deliver
you will get the View and data bundled into Delivery
object.
from nucleus.
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.
By example: This is the after and the before.
If I change the deliver()
to deliverFirst()
can produce NullPointer
from nucleus.
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.
GOT IT!
Thanks again @konmik
from nucleus.
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.
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.
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.
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.
You inherit from Nucleus view classes if you need a presenter.
from nucleus.
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.
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.
Ah okay, that must be it then. Thanks for the heads up.
from nucleus.
Related Issues (20)
- Best practice for normal case. (get support.) HOT 3
- Wondering about multiple Presenter endpoint calls (Question) HOT 2
- How to get onComplete using restartable methods? HOT 1
- How could i force restartableFirst.onError with mockito? HOT 1
- RxJava latest version not used. HOT 1
- Console error saving file HOT 1
- Activity method called every time HOT 2
- (Question) Don't keep activieties option HOT 1
- Confusion about restartables and the Activity lifecycle HOT 3
- Does Nucleus support native Fragments? HOT 2
- Throwing VerifyError in < API 21 HOT 1
- Question regarding getView() and reference the View in the presenter. HOT 11
- Nucleus with Dagger 2 HOT 3
- NucleusActionBarActivity with support library 26 HOT 13
- Help with injecting Presenter when using AndroidInjector HOT 3
- Calling setPresenter in OnCreate HOT 2
- clear the delivery cache
- Crashes when starting a new activity using kotlin
- upgrade a new version for androidx, please
- getView() deprecated
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nucleus.