mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-14 07:05:40 -04:00
Style: add a plus icon to the "create profile" "profile"
This commit is contained in:
parent
41a3074df8
commit
89929b5e21
@ -74,11 +74,7 @@ public class ProfileAdapter extends BaseAdapter {
|
||||
public void fireProfileEdit() {
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
/*
|
||||
* Gets the item ID (crc64 hash of the profile name) for a given index
|
||||
* @param position index to get the hash for
|
||||
* @returns ID (crc64 of a profile name string) or -1 if the index is out of bounds
|
||||
*/
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
|
@ -1,5 +1,7 @@
|
||||
package net.kdt.pojavlaunch.profiles;
|
||||
|
||||
import static net.kdt.pojavlaunch.profiles.ProfileAdapter.CREATE_PROFILE_MAGIC;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
@ -22,6 +24,7 @@ public class ProfileIconCache {
|
||||
private static final Map<String, Drawable> sIconCache = new HashMap<>();
|
||||
private static Drawable sDefaultIcon;
|
||||
|
||||
|
||||
public static void initDefault(Context context) {
|
||||
if(sDefaultIcon != null) return;
|
||||
sDefaultIcon = ResourcesCompat.getDrawable(context.getResources(), R.mipmap.ic_launcher_foreground, null);
|
||||
@ -49,11 +52,21 @@ public class ProfileIconCache {
|
||||
icon = ProfileIconCache.submitIcon(resources, profileName, b64Icon.substring(BASE64_PNG_HEADER.length()));
|
||||
}else{
|
||||
Log.i("IconParser","Unsupported icon: "+b64Icon);
|
||||
icon = ProfileIconCache.pushDefaultIcon(profileName);
|
||||
if(profileName.equals(CREATE_PROFILE_MAGIC)){
|
||||
icon = ProfileIconCache.pushAddProfileIcon(ResourcesCompat.getDrawable(resources, R.drawable.ic_add, null));
|
||||
}else{
|
||||
icon = ProfileIconCache.pushDefaultIcon(profileName);
|
||||
}
|
||||
|
||||
}
|
||||
return icon;
|
||||
}
|
||||
|
||||
public static Drawable pushAddProfileIcon(Drawable drawable){
|
||||
sIconCache.put(CREATE_PROFILE_MAGIC, drawable);
|
||||
return drawable;
|
||||
}
|
||||
|
||||
public static Drawable pushDefaultIcon(String key) {
|
||||
sIconCache.put(key, sDefaultIcon);
|
||||
|
||||
|
5
app_pojavlauncher/src/main/res/drawable/ic_add.xml
Normal file
5
app_pojavlauncher/src/main/res/drawable/ic_add.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
|
||||
</vector>
|
Loading…
x
Reference in New Issue
Block a user