Fix: the new profile was not selected after creation, other

This commit is contained in:
artdeell 2022-05-23 21:02:16 +03:00
parent f89eb4a511
commit 34c1b0a77c
2 changed files with 3 additions and 2 deletions

View File

@ -195,13 +195,14 @@ public class PojavLauncherActivity extends BaseLauncherActivity
ProfileAdapter profileAdapter = new ProfileAdapter(this, true); ProfileAdapter profileAdapter = new ProfileAdapter(this, true);
ProfileEditor profileEditor = new ProfileEditor(this,(name, isNew, deleting)->{ ProfileEditor profileEditor = new ProfileEditor(this,(name, isNew, deleting)->{
LauncherProfiles.update(); LauncherProfiles.update();
profileAdapter.notifyDataSetChanged();
if(isNew) { if(isNew) {
mVersionSelector.setSelection(profileAdapter.resolveProfileIndex(name)); mVersionSelector.setSelection(profileAdapter.resolveProfileIndex(name));
} }
if(deleting) { if(deleting) {
mVersionSelector.setSelection(0); mVersionSelector.setSelection(0);
} }
profileAdapter.notifyDataSetChanged();
}); });
mVersionSelector.setOnLongClickListener((v)->profileEditor.show(LauncherPreferences.DEFAULT_PREF.getString(LauncherPreferences.PREF_KEY_CURRENT_PROFILE,""))); mVersionSelector.setOnLongClickListener((v)->profileEditor.show(LauncherPreferences.DEFAULT_PREF.getString(LauncherPreferences.PREF_KEY_CURRENT_PROFILE,"")));
mVersionSelector.setAdapter(profileAdapter); mVersionSelector.setAdapter(profileAdapter);

View File

@ -4,7 +4,7 @@ import net.kdt.pojavlaunch.*;
public class MinecraftLauncherProfiles public class MinecraftLauncherProfiles
{ {
public Map<String, MinecraftProfile> profiles; public Map<String, MinecraftProfile> profiles = new HashMap<>();
public boolean profilesWereMigrated; public boolean profilesWereMigrated;
public String clientToken; public String clientToken;
public Map<String, MinecraftAuthenticationDatabase> authenticationDatabase; public Map<String, MinecraftAuthenticationDatabase> authenticationDatabase;