Skip to content
This repository was archived by the owner on Oct 3, 2024. It is now read-only.

Commit d1efe77

Browse files
authored
Merge pull request #61 from phcannesson/fix/fragment-callback
Fixed android.app.Fragment callbacks from rationale dialog
2 parents f5ab8ce + 02e71e9 commit d1efe77

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

easypermissions/src/main/java/pub/devrel/easypermissions/RationaleDialogClickListener.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,14 @@ class RationaleDialogClickListener implements Dialog.OnClickListener {
3333
RationaleDialogConfig config,
3434
EasyPermissions.PermissionCallbacks callbacks) {
3535

36-
mHost = dialogFragment.getActivity();
36+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
37+
mHost = dialogFragment.getParentFragment() != null ?
38+
dialogFragment.getParentFragment() :
39+
dialogFragment.getActivity();
40+
} else {
41+
mHost = dialogFragment.getActivity();
42+
}
43+
3744
mConfig = config;
3845
mCallbacks = callbacks;
3946
}

0 commit comments

Comments
 (0)