A Model-View-Presenter / Model-View-Intent library for modern Android apps
Minor release for better support with jetifier and androidx
Solves:
BackstackAccessor.isFragmentOnBackStack(Fragment()) Crash: java.lang.IllegalAccessError: Method 'boolean androidx.fragment.app.Fragment.isInBackStack()' is inaccessible to class 'androidx.core.app.BackstackAccessor'
MvpQueueingBasePresenter
: This Presenter has a method onceViewAttached(ViewAction)
that internally queues all ViewAction
if no view is attached to this presenter and executes all queued actions once a view is attached. If a view is attached, the ViewAction executes immediately. This class is useful in MVP powered apps with backstack navigation.MvpPresenter.detachView(boolean retainInstance)
is now split in two methods:
detachView()
: Was the same as detachView(retainInstance = true)
destroy()
: Was the same as detachView(retainInstance = false)
Please note that destroy()
is called when the corresponding View is also destroyed permanently. For example, if FragmentA (View) has PresenterA. Once we push a new Fragment B (with Presenter B) on top of the stack, PresenterA.detachView()
is called because View of FragmentA is destroyed temporarily.MvpPresenter.detachView(boolean retainInstance)
is deprecated now. Use detachView()
and destroy()
.MvpBasePresenter.getView()
and MvpBasePresenter.isViewAttached()
are deprecated. Use MvpBasePresenter.ifViewAttached(ViewAction)
, see #233Minor improvement in MviBasePresenter
to change the internal order how intent()
and subscribeViewState()
are constructing the observable stream #242
This means internal ViewState-BehaviorSubject is constructed first and then Intent-PublishSubjects are constructed. This ensures that every intent() which emits early like Observable.just(...)
is received by ViewState. However, this also means that you should not invoke an intent from view.render() (or whatever method your viewstate subscriber is) because MviBasePresenter might not be subscribed to the intent() yet.
So if you ever face such a use case that you have to trigger an intent from view.render() please file an issue on github's issue tracker.
aar
which caused issues with proguard.MvpActivity
and MvpViewStateActivity
Fixes #229: Adds View.isInEditMode()
check to support Android Studio's layout editor for custom ViewGroups powered MVI or MVP. This means that there is a breaking API change in constructor of ViewGroupMviDelegateImpl
, ViewGroupMvpDelegeateImpl
and ViewGroupMvpViewStateDelegateImpl
(constructor now requires 3 parameters).
Some minor javadoc improvements
New (Public API):
com.hannesdorfmann.mosby3:mvi:3.0.0
New (Internal usage only):
Changes:
com.hannesdorfmann.mosby
to com.hannesdorfmann.mosby3
(note the 3 at the end). Just update your import statements to migrate to Mosby 3.0: In Android Studio do Edit -> Find -> Replace in Path ...
and set find import com.hannesdorfmann.mosby
replace with import com.hannesdorfmann.mosby3
.MvpBasePresenter
from mvp-common
module into mvp
moduleMvpNullObjectBasePresenter
has been moved into own module: com.hannesdorfmann.mosby3:mvp-nullobject-presenter:3.0.0
MvpNullObjectBasePresenter
: getView() is has now protected visibility and uses WeakReference internallycom.hannesdorfmann.mosby3: mvp-lce:3.0.0
MvpActivity
, MvpFragment
, etc. no longer have methods like isRetainInstance()
, setRetainInstance()
and shouldInstanceBeRetained()
. This functionality is now part of the corresponding delegate such as ActivityMvpDelegate
, FragmentMvpDelegate
etc.Deprecations:
ArrayListLceViewState
and CastedArrayListLceViewState
. Use ParcelableListLceViewState
instead.Removed:
MvpViewStateViewGroupDelegateCallback
RetainingFragmentLceViewState
(deprecated in Mosby 2.0). Use RetainingLceViewState
.Thanks to all contributors!
Minor update, cleaning up some internals and updating javadocs:
core-module
: MosbyActivity
and MosbyFragment
. This means that there is no more Butterknife, Icepick and FragmentArgs integration out of the box. That is something every developer should do by it’s own. #63core-dagger1
, mvp-dagger1
and viewstate-dagger1
. So no more dagger 1 support out of the box. #63isRetainingInstance()
method into isRetainInstance()
and shouldInstanceBeRetained()
to avoid bugs.RetainingFragmentLceViewState
, use RetainingLceViewState
insteadMvpDelegateCallback
to BaseMvpDelegateCallback
and introduced ActivityMvpDelegateCallback
to implement retaining Activities with retaining presenters #64MvpViewStateDelegateCallback
to BaseMvpDelegateCallback
for retaining Activities with retaining presenter and viewstate #64RestorableViewState
and RestoreableParcelableViewState to RestorableParcelableViewState
isRetainingInstance()
into two methods: isRetainInstance()
and shouldInstanceBeRetained()
This might be the last 1.x
release containing. 2.0
will be released very soon containing some serious changes with integration of third party libraries like Butterknife, FragmentArgs and IcePick.