@Override public void onRequestPermissionsResult( int requestCode, String[] permissions, int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); switch (requestCode) { case PERMISSIONS_REQUEST_ATTACH_FILE: if (PermissionsRequester.isPermissionGranted(grantResults)) { startFileSelection(); } else { onNoReadPermissionError(); } break; case PERMISSIONS_REQUEST_SAVE_TO_DOWNLOADS: if (PermissionsRequester.isPermissionGranted(grantResults)) { saveFileToDownloads(); } else { onNoWritePermissionError(); } break; case PERMISSIONS_REQUEST_EXPORT_CHAT: if (PermissionsRequester.isPermissionGranted(grantResults)) { showExportChatDialog(); } else { onNoWritePermissionError(); } break; case PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE: if (!PermissionsRequester.isPermissionGranted(grantResults)) { onNoWritePermissionError(); } break; } }
private void OnSaveFileToDownloadsClick() { if (PermissionsRequester.requestFileWritePermissionIfNeeded( this, PERMISSIONS_REQUEST_SAVE_TO_DOWNLOADS)) { saveFileToDownloads(); } }
private void onExportChatClick() { if (PermissionsRequester.requestFileWritePermissionIfNeeded( this, PERMISSIONS_REQUEST_EXPORT_CHAT)) { showExportChatDialog(); } }
private void onAttachButtonPressed() { if (PermissionsRequester.requestFileReadPermissionIfNeeded( this, PERMISSIONS_REQUEST_ATTACH_FILE)) { startFileSelection(); } }