mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-02-21 12:28:50 +00:00
Fix some external storage permission issues
This commit is contained in:
parent
e140481f14
commit
b2bb0d4f72
@ -1,5 +1,6 @@
|
|||||||
package com.topjohnwu.magisk;
|
package com.topjohnwu.magisk;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -17,6 +18,7 @@ import com.topjohnwu.magisk.components.Fragment;
|
|||||||
import com.topjohnwu.magisk.container.Module;
|
import com.topjohnwu.magisk.container.Module;
|
||||||
import com.topjohnwu.magisk.utils.Logger;
|
import com.topjohnwu.magisk.utils.Logger;
|
||||||
import com.topjohnwu.magisk.utils.Topic;
|
import com.topjohnwu.magisk.utils.Topic;
|
||||||
|
import com.topjohnwu.magisk.utils.Utils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -36,9 +38,11 @@ public class ModulesFragment extends Fragment implements Topic.Subscriber {
|
|||||||
@BindView(R.id.empty_rv) TextView emptyRv;
|
@BindView(R.id.empty_rv) TextView emptyRv;
|
||||||
@OnClick(R.id.fab)
|
@OnClick(R.id.fab)
|
||||||
public void selectFile() {
|
public void selectFile() {
|
||||||
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
|
Utils.runWithPermission(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE, () -> {
|
||||||
intent.setType("application/zip");
|
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
|
||||||
startActivityForResult(intent, FETCH_ZIP_CODE);
|
intent.setType("application/zip");
|
||||||
|
startActivityForResult(intent, FETCH_ZIP_CODE);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Module> listModules = new ArrayList<>();
|
private List<Module> listModules = new ArrayList<>();
|
||||||
|
@ -45,7 +45,6 @@ public class ProcessRepoZip extends ParallelTask<Void, Object, Boolean> {
|
|||||||
super(context);
|
super(context);
|
||||||
mLink = link;
|
mLink = link;
|
||||||
mFile = new File(Environment.getExternalStorageDirectory() + "/MagiskManager", filename);
|
mFile = new File(Environment.getExternalStorageDirectory() + "/MagiskManager", filename);
|
||||||
mFile.getParentFile().mkdirs();
|
|
||||||
mInstall = install;
|
mInstall = install;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,6 +79,7 @@ public class ProcessRepoZip extends ParallelTask<Void, Object, Boolean> {
|
|||||||
@Override
|
@Override
|
||||||
protected void onPreExecute() {
|
protected void onPreExecute() {
|
||||||
Activity activity = getActivity();
|
Activity activity = getActivity();
|
||||||
|
mFile.getParentFile().mkdirs();
|
||||||
progressDialog = ProgressDialog.show(activity, activity.getString(R.string.zip_download_title), activity.getString(R.string.zip_download_msg, 0));
|
progressDialog = ProgressDialog.show(activity, activity.getString(R.string.zip_download_title), activity.getString(R.string.zip_download_msg, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user