-
Notifications
You must be signed in to change notification settings - Fork 839
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
View without Activity #329
base: master
Are you sure you want to change the base?
View without Activity #329
Conversation
Allow mosby to support view without activity
Build failed due to api 28: "Failed to install the following Android SDK packages as some licences have not been accepted." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution! Really appreciate it.
I have a question about isViewOnActiviy()
. I left a comment in the source code file
* A android.view.View can added (in)directly to a Activity or a WindowManager, | ||
* in which case only destroy Presenter is needed, not release | ||
*/ | ||
boolean isViewOnActivity(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this intended to work? It should return false if used without activity?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I will make it more explicit
Hey @bdelville I was wondering if it make sense to keep this outside of the library? |
Allow mosby to support view without activity:
Reference ticket: #281
Alternatively, we can just remove the Exception when there is no activity and switch automatically to Window-mode for ViewGroup base DelegateCallback. But I guess if we add this feature we would like it to be enforced and managed.
So the user will need to implement "public boolean isViewOnActivity()"
It basically switch to a mod where it does not expect to save a state nor detach a view without destroying.
From a user perspective, a CustomView can be use alternatively by a Activity or a Window directly, an easy way to support that would be to implement:
public boolean isViewOnActivity() { return PresenterManager.getActivity(delegateCallback.getContext()) != null }