mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-09 12:43:36 -04:00
refactor[Tools]: Refactor better demo/local dialog
Should also fix demo message being missing in some cases (particularly in the open directory button when both a demo and ms acc is logged on)
This commit is contained in:
parent
9e877dfb12
commit
dcdcdff363
@ -1461,22 +1461,29 @@ public final class Tools {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static void hasNoOnlineProfileDialog(Activity activity){
|
||||
if (hasOnlineProfile()){
|
||||
} else dialogOnUiThread(activity, activity.getString(R.string.no_minecraft_account_found), activity.getString(R.string.feature_requires_java_account));
|
||||
|
||||
public static void hasNoOnlineProfileDialog(Activity activity, @Nullable Runnable run, @Nullable String customTitle, @Nullable String customMessage){
|
||||
if (hasOnlineProfile() && !Tools.isDemoProfile(activity)){
|
||||
if (run != null) { // Demo profile handling should be using customTitle and customMessage
|
||||
run.run();
|
||||
}
|
||||
} else { // If there is no online profile, show a dialog
|
||||
customTitle = customTitle == null ? activity.getString(R.string.no_minecraft_account_found) : customTitle;
|
||||
customMessage = customMessage == null ? activity.getString(R.string.feature_requires_java_account) : customMessage;
|
||||
dialogOnUiThread(activity, customTitle, customMessage);
|
||||
}
|
||||
}
|
||||
public static void hasNoOnlineProfileDialog(Activity activity, String customTitle, String customMessage){
|
||||
if (hasOnlineProfile()){
|
||||
} else dialogOnUiThread(activity, customTitle, customMessage);
|
||||
|
||||
// Some boilerplate to reduce boilerplate elsewhere
|
||||
public static void hasNoOnlineProfileDialog(Activity activity){
|
||||
hasNoOnlineProfileDialog(activity, null, null, null);
|
||||
}
|
||||
public static void hasNoOnlineProfileDialog(Activity activity, Runnable run){
|
||||
if (hasOnlineProfile()){
|
||||
run.run();
|
||||
} else dialogOnUiThread(activity, activity.getString(R.string.no_minecraft_account_found), activity.getString(R.string.feature_requires_java_account));
|
||||
hasNoOnlineProfileDialog(activity, run, null, null);
|
||||
}
|
||||
public static void hasNoOnlineProfileDialog(Activity activity, Runnable run, String customTitle, String customMessage){
|
||||
if (hasOnlineProfile()){
|
||||
run.run();
|
||||
} else dialogOnUiThread(activity, customTitle, customMessage);
|
||||
public static void hasNoOnlineProfileDialog(Activity activity, String customTitle, String customMessage){
|
||||
hasNoOnlineProfileDialog(activity, null, customTitle, customMessage);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user