mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-10 05:01:29 -04:00
qol[mcAccountSpinner]: Make pickaccount() workaround more explicit to the user
This commit is contained in:
parent
8b6fef135e
commit
791afe14c9
@ -48,6 +48,7 @@ import java.io.IOException;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import fr.spse.extended_view.ExtendedTextView;
|
import fr.spse.extended_view.ExtendedTextView;
|
||||||
|
|
||||||
@ -301,14 +302,23 @@ public class mcAccountSpinner extends AppCompatSpinner implements AdapterView.On
|
|||||||
PojavProfile.setCurrentProfile(getContext(), mAccountList.get(position));
|
PojavProfile.setCurrentProfile(getContext(), mAccountList.get(position));
|
||||||
selectedAccount = PojavProfile.getCurrentProfileContent(getContext(), mAccountList.get(position));
|
selectedAccount = PojavProfile.getCurrentProfileContent(getContext(), mAccountList.get(position));
|
||||||
|
|
||||||
|
|
||||||
// WORKAROUND
|
// WORKAROUND
|
||||||
// Account file corrupted due to previous versions having improper encoding
|
// Account file corrupted due to previous versions having improper encoding
|
||||||
if (selectedAccount == null){
|
if (selectedAccount == null){
|
||||||
removeCurrentAccount();
|
Context ctx = Objects.requireNonNull(getContext());
|
||||||
pickAccount(-1);
|
|
||||||
setSelection(0);
|
new AlertDialog.Builder(ctx)
|
||||||
return;
|
.setCancelable(false)
|
||||||
|
.setTitle(R.string.account_corrupted)
|
||||||
|
.setMessage(R.string.login_again)
|
||||||
|
.setPositiveButton(R.string.delete_account_and_login, (dialog, which) -> {
|
||||||
|
removeCurrentAccount();
|
||||||
|
pickAccount(-1);
|
||||||
|
setSelection(0);
|
||||||
|
})
|
||||||
|
.show();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
setSelection(position);
|
setSelection(position);
|
||||||
}else {
|
}else {
|
||||||
|
@ -450,4 +450,7 @@
|
|||||||
<string name="change_account">Please change accounts to use this function</string>
|
<string name="change_account">Please change accounts to use this function</string>
|
||||||
<string name="no_minecraft_account_found">No Minecraft Account Found</string>
|
<string name="no_minecraft_account_found">No Minecraft Account Found</string>
|
||||||
<string name="feature_requires_java_account">This feature requires a Microsoft account that owns Minecraft Java Edition.</string>
|
<string name="feature_requires_java_account">This feature requires a Microsoft account that owns Minecraft Java Edition.</string>
|
||||||
|
<string name="delete_account_and_login">Delete account and log in</string>
|
||||||
|
<string name="login_again">Please log in again</string>
|
||||||
|
<string name="account_corrupted">Selected account is corrupted</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user