Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

Commit

Permalink
Remove StringCRC64 since its now useless
Browse files Browse the repository at this point in the history
Move all ExtraCore constants into a separate class
  • Loading branch information
artdeell committed Mar 20, 2022
1 parent 19037b8 commit 05cf75e
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import net.kdt.pojavlaunch.multirt.MultiRTConfigDialog;
import net.kdt.pojavlaunch.multirt.MultiRTUtils;
import net.kdt.pojavlaunch.prefs.*;
import net.kdt.pojavlaunch.profiles.ProfileConstants;
import net.kdt.pojavlaunch.tasks.*;

import androidx.appcompat.app.AlertDialog;
Expand Down Expand Up @@ -133,7 +134,7 @@ public void launchGame(View v) {
}

public static String getVersionId(String input) {
Map<String,String> lReleaseMaps = (Map<String,String>)ExtraCore.getValue("release_table");
Map<String,String> lReleaseMaps = (Map<String,String>)ExtraCore.getValue(ProfileConstants.RELEASE_TABLE);
if(lReleaseMaps == null || lReleaseMaps.isEmpty()) return input;
switch(input) {
case "latest-release":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import net.kdt.pojavlaunch.prefs.LauncherPreferences;
import net.kdt.pojavlaunch.prefs.screens.LauncherPreferenceFragment;
import net.kdt.pojavlaunch.profiles.ProfileAdapter;
import net.kdt.pojavlaunch.profiles.ProfileConstants;
import net.kdt.pojavlaunch.profiles.ProfileEditor;
import net.kdt.pojavlaunch.profiles.ProfileIconCache;
import net.kdt.pojavlaunch.value.MinecraftAccount;
Expand Down Expand Up @@ -273,7 +274,7 @@ public static void setupBasicList(Context ctx) {

} finally {
basicVersionList = versions.toArray(new String[0]);
ExtraCore.setValue("lac_version_list",versions);
ExtraCore.setValue(ProfileConstants.VERSION_LIST,versions);
}
}
private void pickAccount() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package net.kdt.pojavlaunch.profiles;

public class ProfileConstants {
/* ExtraCore constant: a HashMap for converting values such as latest-snapshot or latest-release to actual game version names */
public static final String RELEASE_TABLE = "release_table";
/* ExtraCore constant: an ArrayList of Strings, where each String is a Minecraft version name */
public static final String VERSION_LIST= "lac_version_list";

}
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public boolean show(@NonNull String profile) {
}
javaRuntimeSpinner.setSelection(jvmIndex);
rendererSpinner.setSelection(rendererIndex);
ExtraCore.addExtraListener("lac_version_list",this);
ExtraCore.addExtraListener(ProfileConstants.VERSION_LIST,this);
profileNameView.setText(minecraftProfile.name);
Bitmap profileIcon = ProfileIconCache.getCachedIcon(profile);
if(profileIcon == null) {
Expand All @@ -124,7 +124,7 @@ public boolean show(@NonNull String profile) {
if(minecraftProfile.lastVersionId != null && !"latest-release".equals(minecraftProfile.lastVersionId) && !"latest-snapshot".equals(minecraftProfile.lastVersionId))
selectedVersionId = minecraftProfile.lastVersionId;
else if(minecraftProfile.lastVersionId != null) {
Map<String,String> releaseTable = (Map<String,String>)ExtraCore.getValue("release_table");
Map<String,String> releaseTable = (Map<String,String>)ExtraCore.getValue(ProfileConstants.RELEASE_TABLE);
if(releaseTable != null) {
switch (minecraftProfile.lastVersionId) {
case "latest-release":
Expand All @@ -141,7 +141,7 @@ else if(minecraftProfile.lastVersionId != null) {
selectedVersionId = PojavLauncherActivity.basicVersionList[0];
}
}
ArrayList<String> versions = (ArrayList<String>) ExtraCore.getValue("lac_version_list");
ArrayList<String> versions = (ArrayList<String>) ExtraCore.getValue(ProfileConstants.VERSION_LIST);
BaseLauncherActivity.updateVersionSpinner(context,versions,versionSpinner, selectedVersionId);
dialog.show();
return true;
Expand Down Expand Up @@ -180,7 +180,7 @@ public void save(DialogInterface dialog, int which) {
destroy(dialog);
}
public void destroy(@NonNull DialogInterface dialog) {
ExtraCore.removeExtraListenerFromValue("lac_version_list",this);
ExtraCore.removeExtraListenerFromValue(ProfileConstants.VERSION_LIST,this);
editingProfile = null;
selectedVersionId = null;
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import net.kdt.pojavlaunch.multirt.MultiRTUtils;
import net.kdt.pojavlaunch.multirt.RTSpinnerAdapter;
import net.kdt.pojavlaunch.prefs.*;
import net.kdt.pojavlaunch.profiles.ProfileConstants;
import net.kdt.pojavlaunch.utils.*;
import net.kdt.pojavlaunch.value.PerVersionConfig;

Expand All @@ -43,8 +44,8 @@ protected ArrayList<String> doInBackground(Void[] p1)
Log.i("ExtVL", "Syncing to external: " + url);
list = Tools.GLOBAL_GSON.fromJson(DownloadUtils.downloadString(url), JMinecraftVersionList.class);
Log.i("ExtVL","Downloaded the version list, len="+list.versions.length);
if(list.latest != null && ExtraCore.getValue("release_table") == null)
ExtraCore.setValue("release_table",list.latest);
if(list.latest != null && ExtraCore.getValue(ProfileConstants.RELEASE_TABLE) == null)
ExtraCore.setValue(ProfileConstants.RELEASE_TABLE,list.latest);
Collections.addAll(versions,list.versions);
}
mActivity.mVersionList = new JMinecraftVersionList();
Expand All @@ -64,7 +65,7 @@ protected ArrayList<String> doInBackground(Void[] p1)
protected void onPostExecute(ArrayList<String> result)
{
super.onPostExecute(result);
ExtraCore.setValue("lac_version_list",result);
ExtraCore.setValue(ProfileConstants.VERSION_LIST,result);
}

private ArrayList<String> filter(JMinecraftVersionList.Version[] list1, File[] list2) {
Expand Down

0 comments on commit 05cf75e

Please sign in to comment.