Fix issue with floating media bar after permissions request (#1134)
This commit is contained in:
parent
5135daad2c
commit
f1b9f7e9fe
|
@ -818,17 +818,30 @@ public final class ComposeActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onMediaPick() {
|
private void onMediaPick() {
|
||||||
addMediaBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
|
addMediaBehavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() {
|
||||||
|
@Override
|
||||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE)
|
public void onStateChanged(@NonNull View bottomSheet, int newState) {
|
||||||
|
//Wait until bottom sheet is not collapsed and show next screen after
|
||||||
|
if (newState==BottomSheetBehavior.STATE_COLLAPSED){
|
||||||
|
addMediaBehavior.setBottomSheetCallback(null);
|
||||||
|
if (ContextCompat.checkSelfPermission(ComposeActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE)
|
||||||
!= PackageManager.PERMISSION_GRANTED) {
|
!= PackageManager.PERMISSION_GRANTED) {
|
||||||
ActivityCompat.requestPermissions(this,
|
ActivityCompat.requestPermissions(ComposeActivity.this,
|
||||||
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
|
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
|
||||||
PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE);
|
PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE);
|
||||||
} else {
|
} else {
|
||||||
initiateMediaPicking();
|
initiateMediaPicking();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSlide(@NonNull View bottomSheet, float slideOffset) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
addMediaBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onVisibilityChanged(@NonNull Status.Visibility visibility) {
|
public void onVisibilityChanged(@NonNull Status.Visibility visibility) {
|
||||||
|
|
Loading…
Reference in New Issue