Account manager changes

- Fix account parsing gives wrong behavior.
- Use popup menu to select/remove instead of click/hold.
This commit is contained in:
khanhduytran0 2020-12-23 15:51:25 +07:00
parent 9ef0ddde27
commit 3ff44f863f
7 changed files with 117 additions and 105 deletions

View file

@ -110,7 +110,9 @@ public class PojavLauncherActivity extends BaseLauncherActivity
if (tempProfile != null) {
accountList.add(tempProfile.username);
}
accountList.addAll(Arrays.asList(new File(Tools.DIR_ACCOUNT_OLD).list()));
for (String s : new File(Tools.DIR_ACCOUNT_NEW).list()) {
accountList.add(s.substring(0, s.length() - 5));
}
ArrayAdapter<String> adapterAcc = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, accountList);
adapterAcc.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);
@ -132,7 +134,7 @@ public class PojavLauncherActivity extends BaseLauncherActivity
if (tempProfile != null && position == 0) {
PojavProfile.setCurrentProfile(PojavLauncherActivity.this, tempProfile);
} else {
PojavProfile.setCurrentProfile(PojavLauncherActivity.this, Tools.DIR_ACCOUNT_OLD + "/" + accountList.get(position + (tempProfile != null ? 1 : 0)));
PojavProfile.setCurrentProfile(PojavLauncherActivity.this, Tools.DIR_ACCOUNT_NEW + "/" + accountList.get(position + (tempProfile != null ? 1 : 0)) + ".json");
}
pickAccount();
}