mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-13 14:51:51 -04:00
Display a warning about storage on the first launch
This commit is contained in:
parent
7aadde90c7
commit
28fa92f1cb
@ -17,7 +17,9 @@ import android.graphics.drawable.ColorDrawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.Html;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.text.style.StyleSpan;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
@ -347,13 +349,27 @@ public class PojavLoginActivity extends BaseActivity
|
||||
mLockSelectJRE.wait();
|
||||
}
|
||||
}
|
||||
if(Build.VERSION.SDK_INT > 28) runOnUiThread(this::showStorageDialog);
|
||||
LauncherPreferences.loadPreferences(getApplicationContext());
|
||||
}
|
||||
catch(Throwable e){
|
||||
Tools.showError(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void showStorageDialog() {
|
||||
if(!firstLaunchPrefs.getBoolean("storageDialogShown",false)) {
|
||||
AlertDialog.Builder bldr = new AlertDialog.Builder(this);
|
||||
bldr.setTitle(R.string.storage_warning_title);
|
||||
Spanned sp = Html.fromHtml(getString(R.string.storage_warning_text,BuildConfig.APPLICATION_ID));
|
||||
bldr.setMessage(sp);
|
||||
bldr.setCancelable(false);
|
||||
bldr.setPositiveButton(android.R.string.ok, (dialog, which)->{
|
||||
firstLaunchPrefs.edit().putBoolean("storageDialogShown",true).apply();
|
||||
dialog.dismiss();
|
||||
});
|
||||
bldr.show();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
@ -241,4 +241,6 @@
|
||||
<string name="pvc_gameDirectory">Game directory</string>
|
||||
<string name="pvc_jvmArgs">JVM arguments</string>
|
||||
<string name="pvc_title">Per-version settings</string>
|
||||
<string name="storage_warning_title">Storage changes</string>
|
||||
<string name="storage_warning_text"> <![CDATA[Due to Google\'s new scoped storage enforcements added in Android 10 and higher, we are required to move the game directory into an app-private folder.<br /> The new folder for Pojav files is <b>Android/data/%s/files/</b> (also accessible using a storage provider in your file explorer).<br /> If you need to copy your game files, please copy everything from the original folder at <b>games/PojavLauncher</b> manually.]]></string>
|
||||
</resources>
|
||||
|
Loading…
x
Reference in New Issue
Block a user