mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-14 07:05:40 -04:00
Support scoped storage by using internal data folder on Android 10+
This commit is contained in:
parent
a477a58b4e
commit
f566efdc7a
@ -202,13 +202,19 @@ public class CustomControlsActivity extends BaseActivity
|
||||
}
|
||||
|
||||
public static void load(final ControlLayout layout) {
|
||||
/*ControlJsonSelector sel = new ControlJsonSelector(layout.getContext(), R.string.global_load);
|
||||
sel.setFinishCallback((f)->{
|
||||
loadControl(f.getAbsolutePath(),layout);
|
||||
});
|
||||
sel.show();*/
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(layout.getContext());
|
||||
builder.setTitle(R.string.global_load);
|
||||
builder.setPositiveButton(android.R.string.cancel, null);
|
||||
|
||||
final AlertDialog dialog = builder.create();
|
||||
FileListView flv = new FileListView(dialog, "json");
|
||||
flv.listFileAt(Tools.CTRLMAP_PATH);
|
||||
if(Build.VERSION.SDK_INT < 29)flv.listFileAt(Tools.CTRLMAP_PATH);
|
||||
else flv.lockPathAt(Tools.CTRLMAP_PATH);
|
||||
flv.setFileSelectedListener(new FileSelectedListener(){
|
||||
|
||||
@Override
|
||||
|
@ -123,7 +123,7 @@ public class PojavLoginActivity extends BaseActivity
|
||||
if(!isStarting) {
|
||||
//try { Thread.sleep(2000); } catch (InterruptedException e) { }
|
||||
runOnUiThread(() -> progress.setVisibility(View.VISIBLE));
|
||||
while (Build.VERSION.SDK_INT >= 23 && !isStorageAllowed()) {
|
||||
while (Build.VERSION.SDK_INT >= 23 && Build.VERSION.SDK_INT < 29 && !isStorageAllowed()) { //Do not ask for storage at all on Android 10+
|
||||
try {
|
||||
revokeCount++;
|
||||
if (revokeCount >= 3) {
|
||||
|
@ -50,24 +50,24 @@ public final class Tools {
|
||||
// New since 3.3.1
|
||||
public static String DIR_ACCOUNT_NEW;
|
||||
public static String DIR_ACCOUNT_OLD;
|
||||
public static final String DIR_GAME_HOME = Environment.getExternalStorageDirectory().getAbsolutePath() + "/games/PojavLauncher";
|
||||
public static final String DIR_GAME_NEW = DIR_GAME_HOME + "/.minecraft";
|
||||
public static final String DIR_GAME_OLD = Environment.getExternalStorageDirectory().getAbsolutePath() + "/games/.minecraft";
|
||||
public static String DIR_GAME_HOME = Environment.getExternalStorageDirectory().getAbsolutePath() + "/games/PojavLauncher";
|
||||
public static String DIR_GAME_NEW;
|
||||
public static String DIR_GAME_OLD = Environment.getExternalStorageDirectory().getAbsolutePath() + "/games/.minecraft";
|
||||
|
||||
// New since 3.0.0
|
||||
public static String DIR_HOME_JRE;
|
||||
public static String DIRNAME_HOME_JRE = "lib";
|
||||
|
||||
// New since 2.4.2
|
||||
public static final String DIR_HOME_VERSION = DIR_GAME_NEW + "/versions";
|
||||
public static final String DIR_HOME_LIBRARY = DIR_GAME_NEW + "/libraries";
|
||||
public static String DIR_HOME_VERSION;
|
||||
public static String DIR_HOME_LIBRARY;
|
||||
|
||||
public static final String DIR_HOME_CRASH = DIR_GAME_NEW + "/crash-reports";
|
||||
public static String DIR_HOME_CRASH;
|
||||
|
||||
public static final String ASSETS_PATH = DIR_GAME_NEW + "/assets";
|
||||
public static final String OBSOLETE_RESOURCES_PATH= DIR_GAME_NEW + "/resources";
|
||||
public static final String CTRLMAP_PATH = DIR_GAME_HOME + "/controlmap";
|
||||
public static final String CTRLDEF_FILE = DIR_GAME_HOME + "/controlmap/default.json";
|
||||
public static String ASSETS_PATH;
|
||||
public static String OBSOLETE_RESOURCES_PATH;
|
||||
public static String CTRLMAP_PATH;
|
||||
public static String CTRLDEF_FILE;
|
||||
|
||||
public static final String LIBNAME_OPTIFINE = "optifine:OptiFine";
|
||||
|
||||
@ -79,7 +79,19 @@ public final class Tools {
|
||||
public static void initContextConstants(Context ctx){
|
||||
DIR_DATA = ctx.getFilesDir().getParent();
|
||||
MULTIRT_HOME = DIR_DATA+"/runtimes";
|
||||
|
||||
if(Build.VERSION.SDK_INT >= 29) {
|
||||
DIR_GAME_HOME = ctx.getFilesDir().getAbsolutePath();
|
||||
}else{
|
||||
DIR_GAME_HOME = Environment.getExternalStorageDirectory().getAbsolutePath();
|
||||
}
|
||||
DIR_GAME_NEW = DIR_GAME_HOME + "/.minecraft";
|
||||
DIR_HOME_VERSION = DIR_GAME_NEW + "/versions";
|
||||
DIR_HOME_LIBRARY = DIR_GAME_NEW + "/libraries";
|
||||
DIR_HOME_CRASH = DIR_GAME_NEW + "/crash-reports";
|
||||
ASSETS_PATH = DIR_GAME_NEW + "/assets";
|
||||
OBSOLETE_RESOURCES_PATH= DIR_GAME_NEW + "/resources";
|
||||
CTRLMAP_PATH = DIR_GAME_HOME + "/controlmap";
|
||||
CTRLDEF_FILE = DIR_GAME_HOME + "/controlmap/default.json";
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user