This repository was archived by the owner on Oct 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
This repository was archived by the owner on Oct 3, 2024. It is now read-only.
Can we use this lib on a method that has param? #169
Copy link
Copy link
Closed
Description
I've tried this
@AfterPermissionGranted(1001)
private void download(String url) {
String[] perms = {Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE};
if (EasyPermissions.hasPermissions((Context) mView, perms)) {
ProgressDialog progressDialog = new ProgressDialog((Context) mView);
progressDialog.setMax(100);
progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progressDialog.setCancelable(false);
String apkPath = AppConstants.FILE_DOWNLOAD_PATH + "/" + System.currentTimeMillis() + ".apk";
DownloadUtil downloadUtil = new DownloadUtil(url, apkPath, new ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
if (done) {
if (progressDialog.isShowing()) {
progressDialog.dismiss();
}
ApkUtil.installApk((Context) mView, apkPath);
}
progressDialog.setProgress((int) ((bytesRead * 100) / contentLength));
}
@Override
public void onFailed() {
if (progressDialog.isShowing()) {
progressDialog.dismiss();
}
ToastUtil.makeShort((Context) mView, ((Context) mView).getString(R.string.network_error_tips));
}
@Override
public void onStart() {
if (!progressDialog.isShowing()) {
progressDialog.show();
}
}
});
downloadUtil.start();
} else {
EasyPermissions.requestPermissions((MainActivity) mView, "我们需要外部存储用于下载更新", 1001, perms);
}
it will request permission,but didn't excute this method again when permission granted.Can I use @AfterPermissionGranter on a method that with param?
Metadata
Metadata
Assignees
Labels
No labels