From 5f94f25663b901b6aaa6b156d5d71f29ca396042 Mon Sep 17 00:00:00 2001 From: artdeell Date: Sun, 20 Mar 2022 20:32:49 +0300 Subject: [PATCH] Redesign control flows a bit --- .../kdt/pojavlaunch/BaseLauncherActivity.java | 14 +++++++------- .../pojavlaunch/PojavLauncherActivity.java | 19 ++++++++++--------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/BaseLauncherActivity.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/BaseLauncherActivity.java index 943c3b7c4..daecc188d 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/BaseLauncherActivity.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/BaseLauncherActivity.java @@ -115,12 +115,12 @@ public abstract class BaseLauncherActivity extends BaseActivity { versionId + "/" + versionId + ".json"); if (verJsonFile.exists()) { mTask.onPostExecute(null); - } else { - Tools.dialogOnUiThread(this, - getString(R.string.global_error), - getString(R.string.mcl_launch_error_localmode) - ); + return; } + Tools.dialogOnUiThread(this, + getString(R.string.global_error), + getString(R.string.mcl_launch_error_localmode) + ); }else { mTask.execute(getVersionId(prof.lastVersionId)); } @@ -158,9 +158,9 @@ public abstract class BaseLauncherActivity extends BaseActivity { adapter.setDropDownViewResource(android.R.layout.simple_list_item_single_choice); mVersionSelector.setAdapter(adapter); mVersionSelector.setSelection(RefreshVersionListTask.selectAt(value, defaultSelection)); - } else { - mVersionSelector.setSelection(RefreshVersionListTask.selectAt(PojavLauncherActivity.basicVersionList, defaultSelection)); + return; } + mVersionSelector.setSelection(RefreshVersionListTask.selectAt(PojavLauncherActivity.basicVersionList, defaultSelection)); } @Override protected void onResume(){ diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/PojavLauncherActivity.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/PojavLauncherActivity.java index 1f59c41cb..9fc055870 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/PojavLauncherActivity.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/PojavLauncherActivity.java @@ -214,17 +214,18 @@ public class PojavLauncherActivity extends BaseLauncherActivity if(profileName.equals(ProfileAdapter.CREATE_PROFILE_MAGIC)) { profileEditor.show(profileName); mVersionSelector.setSelection(0); - }else { - mProfile.selectedProfile = p1.getItemAtPosition(p3).toString(); - PojavProfile.setCurrentProfile(PojavLauncherActivity.this, mProfile); - if (PojavProfile.isFileType(PojavLauncherActivity.this)) { - try { - PojavProfile.setCurrentProfile(PojavLauncherActivity.this, mProfile.save()); - } catch (IOException e) { - Tools.showError(PojavLauncherActivity.this, e); - } + return; + } + mProfile.selectedProfile = p1.getItemAtPosition(p3).toString(); + PojavProfile.setCurrentProfile(PojavLauncherActivity.this, mProfile); + if (PojavProfile.isFileType(PojavLauncherActivity.this)) { + try { + PojavProfile.setCurrentProfile(PojavLauncherActivity.this, mProfile.save()); + } catch (IOException e) { + Tools.showError(PojavLauncherActivity.this, e); } } + } @Override public void onNothingSelected(AdapterView p1)