Skip to content
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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

bdelville
Copy link

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 }

Allow mosby to support view without activity
@bdelville
Copy link
Author

Build failed due to api 28:

"Failed to install the following Android SDK packages as some licences have not been accepted."

Copy link
Owner

@sockeqwe sockeqwe left a 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();
Copy link
Owner

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?

Copy link
Author

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

@sockeqwe
Copy link
Owner

Hey @bdelville
thanks for this PR I'm not sure though if that is the right API.

I was wondering if it make sense to keep this outside of the library?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants