// Path: app/src/main/java/link/standen/michael/fatesheets/model/Skill.java
// public class Skill implements Serializable, Comparable<Skill> {
// 
// 	private Integer value;
// 	private String description;
// 
// 	public Skill(Integer value){
// 		this(value, "");
// 	}
// 
// 	public Skill(Integer value, String description){
// 		this.value = value;
// 		this.description = description;
// 	}
// 
// 	public Integer getValue() {
// 		return value;
// 	}
// 
// 	public void setValue(Integer value) {
// 		this.value = value;
// 	}
// 
// 	public String getDescription() {
// 		return description;
// 	}
// 
// 	public void setDescription(String description) {
// 		this.description = description;
// 	}
// 
// 	@Override
// 	public int compareTo(@NonNull Skill other) {
// 		if (this.getValue().equals(other.getValue())){
// 			return this.getDescription().compareTo(other.getDescription());
// 		}
// 		return this.getValue().compareTo(other.getValue());
// 	}
// }
// 
// Path: app/src/main/java/link/standen/michael/fatesheets/util/SkillsHelper.java
// public final class SkillsHelper extends JsonFileHelper {
// 
// 	private static final String SKILLS_STORAGE = "SKILLS_LIST";
// 
// 	private SkillsHelper(){}
// 
// 	/**
// 	 * Saves skills to local storage.
// 	 * @return True if the write operation was successful, false otherwise.
// 	 */
// 	public static boolean saveSkills(Context context, List<String> skills) {
// 		return saveJsonToFile(context, new Gson().toJson(skills), SKILLS_STORAGE);
// 	}
// 
// 	/**
// 	 * Gets the saved skills list.
// 	 * If no skills list has been saved, gets the default skill list.
// 	 */
// 	@SuppressWarnings("unchecked")
// 	@Nullable
// 	public static List<String> getSkills(Context context) {
// 		String json = getJsonFromFile(context, SKILLS_STORAGE);
// 
// 		if (json == null) {
// 			return getDefaultSkills(context);
// 		}
// 
// 		return new Gson().fromJson(json, List.class);
// 	}
// 
// 	/**
// 	 * Gets the default skill list.
// 	 */
// 	public static List<String> getDefaultSkills(Context context){
// 		return Arrays.asList(context.getResources().getStringArray(R.array.core_skills));
// 	}
// 
// }


import android.content.Context;
import android.support.annotation.LayoutRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.TextView;
import java.util.List;
import link.standen.michael.fatesheets.R;
import link.standen.michael.fatesheets.model.Skill;
import link.standen.michael.fatesheets.util.SkillsHelper;
package link.standen.michael.fatesheets.adapter;




/**
 * Manages a list of character skills.
 */
public class SkillArrayAdapter extends ArrayAdapter<Skill> {

	private static final String TAG = SkillArrayAdapter.class.getName();

	private final Context context;
	private final int resourceId;
	private final List<Skill> items;

	private static List<String> skills;

	public SkillArrayAdapter(@NonNull Context context, @LayoutRes int resourceId, @NonNull List<Skill> items) {
		super(context, resourceId, items);

		this.context = context;
		this.resourceId = resourceId;
		this.items = items;

		// Refresh skills list
		skills = SkillsHelper.getSkills(context);
	}

	public Skill getItem(int index){
		return items.get(index);
	}

	@NonNull
	@Override
	public View getView(final int position, @Nullable View convertView, @NonNull ViewGroup parent) {
		View view = convertView;
		if (view == null){
			LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			view = inflater.inflate(resourceId, null);
		}

		view.findViewById(R.id.delete).setOnClickListener(new View.OnClickListener() {
			@Override
// Path: app/src/main/java/link/standen/michael/fatesheets/model/Skill.java
// public class Skill implements Serializable, Comparable<Skill> {
// 
// 	private Integer value;
// 	private String description;
// 
// 	public Skill(Integer value){
// 		this(value, "");
// 	}
// 
// 	public Skill(Integer value, String description){
// 		this.value = value;
// 		this.description = description;
// 	}
// 
// 	public Integer getValue() {
// 		return value;
// 	}
// 
// 	public void setValue(Integer value) {
// 		this.value = value;
// 	}
// 
// 	public String getDescription() {
// 		return description;
// 	}
// 
// 	public void setDescription(String description) {
// 		this.description = description;
// 	}
// 
// 	@Override
// 	public int compareTo(@NonNull Skill other) {
// 		if (this.getValue().equals(other.getValue())){
// 			return this.getDescription().compareTo(other.getDescription());
// 		}
// 		return this.getValue().compareTo(other.getValue());
// 	}
// }
// 
// Path: app/src/main/java/link/standen/michael/fatesheets/util/SkillsHelper.java
// public final class SkillsHelper extends JsonFileHelper {
// 
// 	private static final String SKILLS_STORAGE = "SKILLS_LIST";
// 
// 	private SkillsHelper(){}
// 
// 	/**
// 	 * Saves skills to local storage.
// 	 * @return True if the write operation was successful, false otherwise.
// 	 */
// 	public static boolean saveSkills(Context context, List<String> skills) {
// 		return saveJsonToFile(context, new Gson().toJson(skills), SKILLS_STORAGE);
// 	}
// 
// 	/**
// 	 * Gets the saved skills list.
// 	 * If no skills list has been saved, gets the default skill list.
// 	 */
// 	@SuppressWarnings("unchecked")
// 	@Nullable
// 	public static List<String> getSkills(Context context) {
// 		String json = getJsonFromFile(context, SKILLS_STORAGE);
// 
// 		if (json == null) {
// 			return getDefaultSkills(context);
// 		}
// 
// 		return new Gson().fromJson(json, List.class);
// 	}
// 
// 	/**
// 	 * Gets the default skill list.
// 	 */
// 	public static List<String> getDefaultSkills(Context context){
// 		return Arrays.asList(context.getResources().getStringArray(R.array.core_skills));
// 	}
// 
// }


// Path: app/src/main/java/link/standen/michael/fatesheets/adapter/SkillArrayAdapter.java
import android.content.Context;
import android.support.annotation.LayoutRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.TextView;
import java.util.List;
import link.standen.michael.fatesheets.R;
import link.standen.michael.fatesheets.model.Skill;
import link.standen.michael.fatesheets.util.SkillsHelper;

package link.standen.michael.fatesheets.adapter;




/**
 * Manages a list of character skills.
 */
public class SkillArrayAdapter extends ArrayAdapter<Skill> {

	private static final String TAG = SkillArrayAdapter.class.getName();

	private final Context context;
	private final int resourceId;
	private final List<Skill> items;

	private static List<String> skills;

	public SkillArrayAdapter(@NonNull Context context, @LayoutRes int resourceId, @NonNull List<Skill> items) {
		super(context, resourceId, items);

		this.context = context;
		this.resourceId = resourceId;
		this.items = items;

		// Refresh skills list
		skills = SkillsHelper.getSkills(context);
	}

	public Skill getItem(int index){
		return items.get(index);
	}

	@NonNull
	@Override
	public View getView(final int position, @Nullable View convertView, @NonNull ViewGroup parent) {
		View view = convertView;
		if (view == null){
			LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			view = inflater.inflate(resourceId, null);
		}

		view.findViewById(R.id.delete).setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {