Open aoikonom opened 5 years ago
@aoikonom sorry about the really slow response here, I was out on vacation over the holidays.
So does your Activity implement android.support.v4.app.FragmentActivity
but not AppCompatActivity
?
I was able to reproduce this in a failing test, will send a PR with an update.
Fixed and released in version 2.0.1
The bug seems to have been fixed for calls made from an activity, but not when EasyPermissions.requestPermissions is called from inside a Fragment. The problem seems to lie in the code below
`
public static PermissionHelper<? extends Activity> newInstance(Activity host) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
return new LowApiPermissionsHelper<>(host);
}
if (host instanceof AppCompatActivity)
return new AppCompatActivityPermissionsHelper((AppCompatActivity) host);
else {
return new ActivityPermissionHelper(host);
}
}
@NonNull
public static PermissionHelper<Fragment> newInstance(Fragment host) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
return new LowApiPermissionsHelper<>(host);
}
return new SupportFragmentPermissionHelper(host);
}
`
When called from an activity not derived from AppCompatActivity, ActivityPermissionHelper handles the situation but in the case of a Fragment inside this activity there is no distinction.
@aoikonom thanks for pointing this out!
@aoikonom thanks for pointing this out!
Thanks for the quick response
Basic Information
Device type: Nexus 5X on emulator OS version: - EasyPermissions version: 2.0.0
Describe the problem
I am using build tools 28.0.3 for a legacy application that uses Holo themes. When rationale dialog is to be shown (the second time I request permission after the first time it was denied) I get a crash "java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity."
The problem lies with RationaleDialogFragmentCompat
Code and logs