@SuppressWarnings("ConstantConditions")
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
&& ContextCompat.checkSelfPermission(
getActivity(), Manifest.permission.READ_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED) {
return new MaterialDialog.Builder(getActivity())
.title(R.string.md_error_label)
.content(R.string.md_storage_perm_error)
.positiveText(android.R.string.ok)
.build();
}
if (getArguments() == null || !getArguments().containsKey("builder")) {
throw new IllegalStateException("You must create a FileChooserDialog using the Builder.");
}
if (!getArguments().containsKey("current_path")) {
getArguments().putString("current_path", getBuilder().initialPath);
}
parentFolder = new File(getArguments().getString("current_path"));
checkIfCanGoUp();
parentContents = listFiles(getBuilder().mimeType, getBuilder().extensions);
return new MaterialDialog.Builder(getActivity())
.title(parentFolder.getAbsolutePath())
.typeface(getBuilder().mediumFont, getBuilder().regularFont)
.items(getContentsArray())
.itemsCallback(this)
.onNegative(
new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(MaterialDialog dialog, DialogAction which) {
dialog.dismiss();
}
})
.autoDismiss(false)
.negativeText(getBuilder().cancelButton)
.build();
}
FileChooserDialog.java 文件源码
java
阅读 25
收藏 0
点赞 0
评论 0
项目:material-dialogs
作者:
评论列表
文章目录