mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-17 08:35:37 -04:00
Fixations
This commit is contained in:
parent
8685b4969c
commit
68b10bcc89
@ -116,11 +116,10 @@ public abstract class BaseLauncherActivity extends BaseActivity {
|
|||||||
if (verJsonFile.exists()) {
|
if (verJsonFile.exists()) {
|
||||||
mTask.onPostExecute(null);
|
mTask.onPostExecute(null);
|
||||||
} else {
|
} else {
|
||||||
new AlertDialog.Builder(this)
|
Tools.dialogOnUiThread(this,
|
||||||
.setTitle(R.string.global_error)
|
getString(R.string.global_error),
|
||||||
.setMessage(R.string.mcl_launch_error_localmode)
|
getString(R.string.mcl_launch_error_localmode)
|
||||||
.setPositiveButton(android.R.string.ok, null)
|
);
|
||||||
.show();
|
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
mTask.execute(getVersionId(prof.lastVersionId));
|
mTask.execute(getVersionId(prof.lastVersionId));
|
||||||
@ -131,16 +130,11 @@ public abstract class BaseLauncherActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getVersionId(String input) {
|
public static String getVersionId(String input) {
|
||||||
Map<String,String> lReleaseMaps = (Map<String,String>)ExtraCore.getValue(ExtraConstants.RELEASE_TABLE);
|
Map<String,String> releaseTable = (Map<String,String>)ExtraCore.getValue(ExtraConstants.RELEASE_TABLE);
|
||||||
if(lReleaseMaps == null || lReleaseMaps.isEmpty()) return input;
|
if(releaseTable == null || releaseTable.isEmpty()) return input;
|
||||||
switch(input) {
|
if("latest-release".equals(input)) return releaseTable.get("release");
|
||||||
case "latest-release":
|
if("latest-snapshot".equals(input)) return releaseTable.get("snapshot");
|
||||||
return lReleaseMaps.get("release");
|
return input;
|
||||||
case "latest-snapshot":
|
|
||||||
return lReleaseMaps.get("snapshot");
|
|
||||||
default:
|
|
||||||
return input;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -192,7 +192,7 @@ public class PojavLauncherActivity extends BaseLauncherActivity
|
|||||||
setupBasicList(this);
|
setupBasicList(this);
|
||||||
|
|
||||||
//mAvailableVersions;
|
//mAvailableVersions;
|
||||||
ProfileAdapter profileAdapter = new ProfileAdapter(this);
|
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();
|
||||||
if(isNew) {
|
if(isNew) {
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
package net.kdt.pojavlaunch.profiles;
|
package net.kdt.pojavlaunch.profiles;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.database.DataSetObserver;
|
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
|
||||||
import android.util.Base64;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@ -28,23 +24,23 @@ import java.util.Map;
|
|||||||
public class ProfileAdapter extends BaseAdapter {
|
public class ProfileAdapter extends BaseAdapter {
|
||||||
Map<String, MinecraftProfile> profiles;
|
Map<String, MinecraftProfile> profiles;
|
||||||
public static final String CREATE_PROFILE_MAGIC = "___extra____profile-create";
|
public static final String CREATE_PROFILE_MAGIC = "___extra____profile-create";
|
||||||
static final MinecraftProfile DUMMY = new MinecraftProfile();
|
final MinecraftProfile dummy = new MinecraftProfile();
|
||||||
static MinecraftProfile CREATE_PROFILE;
|
private MinecraftProfile createProfile;
|
||||||
List<String> profileList;
|
List<String> profileList;
|
||||||
public ProfileAdapter(Context context) {
|
public ProfileAdapter(Context context, boolean enableCreateButton) {
|
||||||
ProfileIconCache.initDefault(context);
|
ProfileIconCache.initDefault(context);
|
||||||
LauncherProfiles.update();
|
LauncherProfiles.update();
|
||||||
profiles = new HashMap<>(LauncherProfiles.mainProfileJson.profiles);
|
profiles = new HashMap<>(LauncherProfiles.mainProfileJson.profiles);
|
||||||
if(CREATE_PROFILE == null) {
|
if(enableCreateButton) {
|
||||||
CREATE_PROFILE = new MinecraftProfile();
|
createProfile = new MinecraftProfile();
|
||||||
CREATE_PROFILE.name = "Create new profile";
|
createProfile.name = "Create new profile";
|
||||||
CREATE_PROFILE.lastVersionId = "";
|
createProfile.lastVersionId = "";
|
||||||
}
|
}
|
||||||
profileList = new ArrayList<>(Arrays.asList(profiles.keySet().toArray(new String[0])));
|
profileList = new ArrayList<>(Arrays.asList(profiles.keySet().toArray(new String[0])));
|
||||||
profileList.add(ProfileAdapter.CREATE_PROFILE_MAGIC);
|
if(enableCreateButton) {
|
||||||
profiles.put(CREATE_PROFILE_MAGIC, CREATE_PROFILE);
|
profileList.add(ProfileAdapter.CREATE_PROFILE_MAGIC);
|
||||||
|
profiles.put(CREATE_PROFILE_MAGIC, createProfile);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Gets how much profiles are loaded in the adapter right now
|
* Gets how much profiles are loaded in the adapter right now
|
||||||
@ -91,7 +87,7 @@ public class ProfileAdapter extends BaseAdapter {
|
|||||||
profiles = new HashMap<>(LauncherProfiles.mainProfileJson.profiles);
|
profiles = new HashMap<>(LauncherProfiles.mainProfileJson.profiles);
|
||||||
profileList = new ArrayList<>(Arrays.asList(profiles.keySet().toArray(new String[0])));
|
profileList = new ArrayList<>(Arrays.asList(profiles.keySet().toArray(new String[0])));
|
||||||
profileList.add(ProfileAdapter.CREATE_PROFILE_MAGIC);
|
profileList.add(ProfileAdapter.CREATE_PROFILE_MAGIC);
|
||||||
profiles.put(CREATE_PROFILE_MAGIC, CREATE_PROFILE);
|
profiles.put(CREATE_PROFILE_MAGIC, createProfile);
|
||||||
super.notifyDataSetChanged();
|
super.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,7 +100,7 @@ public class ProfileAdapter extends BaseAdapter {
|
|||||||
}
|
}
|
||||||
public void setViewProfile(View v, String nm) {
|
public void setViewProfile(View v, String nm) {
|
||||||
MinecraftProfile minecraftProfile = profiles.get(nm);
|
MinecraftProfile minecraftProfile = profiles.get(nm);
|
||||||
if(minecraftProfile == null) minecraftProfile = DUMMY;
|
if(minecraftProfile == null) minecraftProfile = dummy;
|
||||||
Bitmap cachedIcon = ProfileIconCache.getCachedIcon(nm);
|
Bitmap cachedIcon = ProfileIconCache.getCachedIcon(nm);
|
||||||
ImageView iconView = v.findViewById(R.id.vprof_icon_view);
|
ImageView iconView = v.findViewById(R.id.vprof_icon_view);
|
||||||
if(cachedIcon == null) {
|
if(cachedIcon == null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user