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

Add android.app.Fragment support #31

Closed
hotchemi opened this issue Sep 13, 2015 · 5 comments
Closed

Add android.app.Fragment support #31

hotchemi opened this issue Sep 13, 2015 · 5 comments
Assignees
Milestone

Comments

@hotchemi
Copy link
Member

Picasso or Retrofit's implementation are very useful for us I guess.

@hotchemi hotchemi self-assigned this Sep 13, 2015
@hotchemi hotchemi added this to the 2.0.0 milestone Sep 13, 2015
@mannodermaus
Copy link
Contributor

The support is already integrated into 2.0.0; I'll do a quick write-ups of how the optional dependency works!

@hotchemi
Copy link
Member Author

@aurae
Actually I wanna re-consider the api interface.
In my think, resolving the problem by checking support v13 existence may causes the problem.
I mean, some app use android.appFragment and support.v4.Fragment at the same time.
So, my suggestion is like below.

@RuntimePermissions(appfragment = true) // naming is quite bad...
public class MainFragment extends android.app.Fragment {
}

or

@RuntimePermissions(v4ragment = false)
public class MainFragment extends android.app.Fragment {
}

if the user can choose whether using native Fragment or not, it would be a good api.
How do you think about of it?

@mannodermaus
Copy link
Contributor

I think that it would be an even better API if the user didn't have to deal with PermissionsDispatcher's configuration when it comes to fragments.

Here is how it works in the new Kotlin architecture:

  • PermissionsDispatcher is supported on API levels 4+, since it depends on support-v4 because of its ActivityCompat usage
  • Because of that, the library supports Activity and support.v4.Fragment out of the box, without any extra dependencies
  • Now, if someone used native Fragments in their app with PermissionsDispatcher, they may get the following error on compilation: permissions.dispatcher.processor.exception.SupportV13MissingException: PermissionsDispatcher for annotated class 'MyNativeFragment' can't be generated, because the support-v13 dependency is missing on your project
  • To resolve this, the user just needs to drop in a dependency on support-v13 alongside PermissionsDispatcher, and their native fragments will become supported as well! This doesn't mean that support.v4.Fragment isn't supported anymore, it is simply another functionality on top of that, so they could technically use both types of Fragment at the same time

I don't think it's necessary to have the user deal with which configuration PermissionsDispatcher should use. What issue have you encountered with the optional dependency?

@hotchemi
Copy link
Member Author

Oh sorry, I've not seen your PR well, please just a minute.

@mannodermaus
Copy link
Contributor

It's all good. Take your time!

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

No branches or pull requests

2 participants