<commit_before>package com.tinapaproject.tinapa.fragments;


import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.Context;
import android.content.DialogInterface;
import android.database.Cursor;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.CursorAdapter;
import android.widget.EditText;
import android.widget.SimpleCursorAdapter;
import android.widget.Spinner;
import android.widget.SpinnerAdapter;
import android.widget.Switch;

import com.tinapaproject.tinapa.R;
import com.tinapaproject.tinapa.database.key.DexKeyValues;
import com.tinapaproject.tinapa.database.key.OwnedKeyValues;
import com.tinapaproject.tinapa.database.provider.TinapaContentProvider;

public class OwnedAddDialogFragment extends DialogFragment {

    private OwnedAddFragmentListener mListener;

    private EditText mNicknameEditText;
    private Spinner mSpeciesSpinner;
    private Switch mShinnySwitch;
    private Spinner mAbilitySpinner;
    private Spinner mMove1Spinner;
    private Spinner mMove2Spinner;
    private Spinner mMove3Spinner;
    private Spinner mMove4Spinner;
    private EditText mLevelEditText;
    private EditText mIvHpEditText;
    private EditText mIvAttEditText;
    private EditText mIvDefEditText;
    private EditText mIvSAttEditText;
    private EditText mIvSDefEditText;
    private EditText mIvSpdEditText;
    private EditText mEvHpEditText;
    private EditText mEvAttEditText;
    private EditText mEvDefEditText;
    private EditText mEvSAttEditText;
    private EditText mEvSDefEditText;
    private EditText mEvSpdEditText;
    private EditText mNotesText;
    private Button mSaveButton;

    private static final String ARG_POKEMON_ID = "ARG_POKEMON_ID";

    public static final String TAG = "OwnedAddDialogFragment";

    public static OwnedAddDialogFragment newInstance() {
        return new OwnedAddDialogFragment();
    }

    public static OwnedAddDialogFragment newInstance(String id) {
        OwnedAddDialogFragment fragment = new OwnedAddDialogFragment();

        Bundle args = new Bundle();
        args.putString(ARG_POKEMON_ID, id);

        fragment.setArguments(args);

        return fragment;
    }

    public OwnedAddDialogFragment() {
        // Required empty public constructor
    }

    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        if (activity instanceof OwnedAddFragmentListener) {
            mListener = (OwnedAddFragmentListener) activity;
        }
    }

    @Override
    public void onDetach() {
        super.onDetach();
        mListener = null;
    }

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setView(fillView(getActivity().getLayoutInflater(), null, savedInstanceState));
        builder.setCancelable(false);
        this.setCancelable(false);
        builder.setPositiveButton(R.string.save, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                int level = TextUtils.isEmpty(mLevelEditText.getText().toString()) ? 50 : Integer.parseInt(mLevelEditText.getText().toString());
                String nickname = mNicknameEditText.getText().toString();
                String speciesId = String.valueOf(mSpeciesSpinner.getSelectedItemId());
                boolean shinny = mShinnySwitch.isChecked();
                String abilityId = String.valueOf(mAbilitySpinner.getSelectedItemId());
                String natureId = /* TODO */ "0";
                String genderId = /* TODO */ "0";
                String move1Id = String.valueOf(mMove1Spinner.getSelectedItemId());
                String move2Id = String.valueOf(mMove2Spinner.getSelectedItemId());
                String move3Id = String.valueOf(mMove3Spinner.getSelectedItemId());
                String move4Id = String.valueOf(mMove4Spinner.getSelectedItemId());
                int ivHp = TextUtils.isEmpty(mIvHpEditText.getText().toString()) ? 0 : Integer.parseInt(mIvHpEditText.getText().toString());
                int ivAtt = TextUtils.isEmpty(mIvAttEditText.getText().toString()) ? 0 : Integer.parseInt(mIvAttEditText.getText().toString());
                int ivDef = TextUtils.isEmpty(mIvDefEditText.getText().toString()) ? 0 : Integer.parseInt(mIvDefEditText.getText().toString());
                int ivSAtt = TextUtils.isEmpty(mIvSAttEditText.getText().toString()) ? 0 : Integer.parseInt(mIvSAttEditText.getText().toString());
                int ivSDef = TextUtils.isEmpty(mIvSDefEditText.getText().toString()) ? 0 : Integer.parseInt(mIvSDefEditText.getText().toString());
                int ivSpd = TextUtils.isEmpty(mIvSpdEditText.getText().toString()) ? 0 : Integer.parseInt(mIvSpdEditText.getText().toString());
                int evHp = TextUtils.isEmpty(mEvHpEditText.getText().toString()) ? 0 : Integer.parseInt(mEvHpEditText.getText().toString());
                int evAtt = TextUtils.isEmpty(mEvAttEditText.getText().toString()) ? 0 : Integer.parseInt(mEvAttEditText.getText().toString());
                int evDef = TextUtils.isEmpty(mEvDefEditText.getText().toString()) ? 0 : Integer.parseInt(mEvDefEditText.getText().toString());
                int evSAtt = TextUtils.isEmpty(mEvSAttEditText.getText().toString()) ? 0 : Integer.parseInt(mEvSAttEditText.getText().toString());
                int evSDef = TextUtils.isEmpty(mEvSDefEditText.getText().toString()) ? 0 : Integer.parseInt(mEvSDefEditText.getText().toString());
                int evSpd = TextUtils.isEmpty(mEvSpdEditText.getText().toString()) ? 0 : Integer.parseInt(mEvSpdEditText.getText().toString());
                String notes = mNotesText.getText().toString();
                String planId /* TODO */ = "";
                mListener.onPositiveClicked(level, nickname, shinny, speciesId, abilityId, natureId, genderId, move1Id, move2Id, move3Id, move4Id, ivHp, ivAtt, ivDef, ivSAtt, ivSDef, ivSpd, evHp, evAtt, evDef, evSAtt, evSDef, evSpd, notes, planId);
            }
        });
        builder.setNegativeButton(R.string.cancel, null);
        return builder.create();
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        if (!getShowsDialog()) {
            return fillView(inflater, container, savedInstanceState);
        } else {
            return super.onCreateView(inflater, container, savedInstanceState);
        }
    }

    private View fillView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_owned_add_dialog, container, false);
        mNicknameEditText = (EditText) view.findViewById(R.id.owned_add_nickname);
        mShinnySwitch = (Switch) view.findViewById(R.id.owned_add_shinny_switch);
        mSpeciesSpinner = (Spinner) view.findViewById(R.id.owned_add_species_spinner);
        mAbilitySpinner = (Spinner) view.findViewById(R.id.owned_add_ability_spinner);
        mMove1Spinner = (Spinner) view.findViewById(R.id.owned_add_move1_spinner);
        mMove2Spinner = (Spinner) view.findViewById(R.id.owned_add_move2_spinner);
        mMove3Spinner = (Spinner) view.findViewById(R.id.owned_add_move3_spinner);
        mMove4Spinner = (Spinner) view.findViewById(R.id.owned_add_move4_spinner);
        mLevelEditText = (EditText) view.findViewById(R.id.owned_add_level_edit_text);
        mIvHpEditText = (EditText) view.findViewById(R.id.owned_add_iv_hp_edit_text);
        mIvAttEditText = (EditText) view.findViewById(R.id.owned_add_iv_att_edit_text);
        mIvDefEditText = (EditText) view.findViewById(R.id.owned_add_iv_def_edit_text);
        mIvSAttEditText = (EditText) view.findViewById(R.id.owned_add_iv_satt_edit_text);
        mIvSDefEditText = (EditText) view.findViewById(R.id.owned_add_iv_sdef_edit_text);
        mIvSpdEditText = (EditText) view.findViewById(R.id.owned_add_iv_spd_edit_text);
        mEvHpEditText = (EditText) view.findViewById(R.id.owned_add_ev_hp_edit_text);
        mEvAttEditText = (EditText) view.findViewById(R.id.owned_add_ev_att_edit_text);
        mEvDefEditText = (EditText) view.findViewById(R.id.owned_add_ev_def_edit_text);
        mEvSAttEditText = (EditText) view.findViewById(R.id.owned_add_ev_satt_edit_text);
        mEvSDefEditText = (EditText) view.findViewById(R.id.owned_add_ev_sdef_edit_text);
        mEvSpdEditText = (EditText) view.findViewById(R.id.owned_add_ev_spd_edit_text);
        mNotesText = (EditText) view.findViewById(R.id.owned_add_notes);

        mSaveButton = (Button) view.findViewById(R.id.owned_saved_button);

        mShinnySwitch.setChecked(false);

        String ownedPokemonId = "";
        if (getArguments() != null) {
            ownedPokemonId = getArguments().getString(ARG_POKEMON_ID);
        }
        int speciesId = -1;
        int abilityId = -1;
        int move1Id = -1;
        int move2Id = -1;
        int move3Id = -1;
        int move4Id = -1;
        if (!TextUtils.isEmpty(ownedPokemonId)) {
            Cursor ownedCursor = getActivity().getContentResolver().query(TinapaContentProvider.OWNED_POKEMON_URI, null, "owned_pokemons.id = " + ownedPokemonId, null, null);
            if (ownedCursor.moveToFirst()) {
                speciesId = ownedCursor.getInt(ownedCursor.getColumnIndex(OwnedKeyValues.POKEMON_ID));
                abilityId = ownedCursor.getInt(ownedCursor.getColumnIndex(OwnedKeyValues.ABILITY_ID));

                move1Id = ownedCursor.getInt(ownedCursor.getColumnIndex(OwnedKeyValues.MOVE1_ID));
                move2Id = ownedCursor.getInt(ownedCursor.getColumnIndex(OwnedKeyValues.MOVE2_ID));
                move3Id = ownedCursor.getInt(ownedCursor.getColumnIndex(OwnedKeyValues.MOVE3_ID));
                move4Id = ownedCursor.getInt(ownedCursor.getColumnIndex(OwnedKeyValues.MOVE4_ID));

                mNicknameEditText.setText(ownedCursor.getString(ownedCursor.getColumnIndex(OwnedKeyValues.NICKNAME)));
                mLevelEditText.setText(ownedCursor.getString(ownedCursor.getColumnIndex(OwnedKeyValues.LEVEL)));

                mEvHpEditText.setText(ownedCursor.getString(ownedCursor.getColumnIndex(OwnedKeyValues.EV_HP)));
                mEvAttEditText.setText(ownedCursor.getString(ownedCursor.getColumnIndex(OwnedKeyValues.EV_ATT)));
                mEvDefEditText.setText(ownedCursor.getString(ownedCursor.getColumnIndex(OwnedKeyValues.EV_DEF)));
                mEvSAttEditText.setText(ownedCursor.getString(ownedCursor.getColumnIndex(OwnedKeyValues.EV_SATT)));
                mEvSDefEditText.setText(ownedCursor.getString(ownedCursor.getColumnIndex(OwnedKeyValues.EV_SDEF)));
                mEvSpdEditText.setText(ownedCursor.getString(ownedCursor.getColumnIndex(OwnedKeyValues.EV_SPD)));

                mIvHpEditText.setText(ownedCursor.getString(ownedCursor.getColumnIndex(OwnedKeyValues.IV_HP)));
                mIvAttEditText.setText(ownedCursor.getString(ownedCursor.getColumnIndex(OwnedKeyValues.IV_ATT)));
                mIvDefEditText.setText(ownedCursor.getString(ownedCursor.getColumnIndex(OwnedKeyValues.IV_DEF)));
                mIvSAttEditText.setText(ownedCursor.getString(ownedCursor.getColumnIndex(OwnedKeyValues.IV_SATT)));
                mIvSDefEditText.setText(ownedCursor.getString(ownedCursor.getColumnIndex(OwnedKeyValues.IV_SDEF)));
                mIvSpdEditText.setText(ownedCursor.getString(ownedCursor.getColumnIndex(OwnedKeyValues.IV_SPD)));

                mNotesText.setText(ownedCursor.getString(ownedCursor.getColumnIndex(OwnedKeyValues.NOTE)));
            }
        }

        Cursor speciesCursor = getActivity().getContentResolver().query(TinapaContentProvider.POKEDEX_ALL_SHORT_URI, null, null, null, null);
        String[] from = {DexKeyValues.name};
        int[] to = {R.id.simple_cell_name};
        CursorAdapter mSpeciesCursorAdapter = new SimpleCursorAdapter(getActivity(), R.layout.cell_simple_name, speciesCursor, from, to, 0);
        mSpeciesSpinner.setAdapter(mSpeciesCursorAdapter);
        if (speciesId >= 0) {<commit_msg>Now saving whether it is shinny or not.<commit_after>package com.tinapaproject.tinapa.fragments;


import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.Context;
import android.content.DialogInterface;
import android.database.Cursor;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.CursorAdapter;
import android.widget.EditText;
import android.widget.SimpleCursorAdapter;
import android.widget.Spinner;
import android.widget.SpinnerAdapter;
import android.widget.Switch;

import com.tinapaproject.tinapa.R;
import com.tinapaproject.tinapa.database.key.DexKeyValues;
import com.tinapaproject.tinapa.database.key.OwnedKeyValues;
import com.tinapaproject.tinapa.database.provider.TinapaContentProvider;

public class OwnedAddDialogFragment extends DialogFragment {

    private OwnedAddFragmentListener mListener;

    private EditText mNicknameEditText;
    private Spinner mSpeciesSpinner;
    private Switch mShinnySwitch;
    private Spinner mAbilitySpinner;
    private Spinner mMove1Spinner;
    private Spinner mMove2Spinner;
    private Spinner mMove3Spinner;
    private Spinner mMove4Spinner;
    private EditText mLevelEditText;
    private EditText mIvHpEditText;
    private EditText mIvAttEditText;
    private EditText mIvDefEditText;
    private EditText mIvSAttEditText;
    private EditText mIvSDefEditText;
    private EditText mIvSpdEditText;
    private EditText mEvHpEditText;
    private EditText mEvAttEditText;
    private EditText mEvDefEditText;
    private EditText mEvSAttEditText;
    private EditText mEvSDefEditText;
    private EditText mEvSpdEditText;
    private EditText mNotesText;
    private Button mSaveButton;

    private static final String ARG_POKEMON_ID = "ARG_POKEMON_ID";

    public static final String TAG = "OwnedAddDialogFragment";

    public static OwnedAddDialogFragment newInstance() {
        return new OwnedAddDialogFragment();
    }

    public static OwnedAddDialogFragment newInstance(String id) {
        OwnedAddDialogFragment fragment = new OwnedAddDialogFragment();

        Bundle args = new Bundle();
        args.putString(ARG_POKEMON_ID, id);

        fragment.setArguments(args);

        return fragment;
    }

    public OwnedAddDialogFragment() {
        // Required empty public constructor
    }

    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        if (activity instanceof OwnedAddFragmentListener) {
            mListener = (OwnedAddFragmentListener) activity;
        }
    }

    @Override
    public void onDetach() {
        super.onDetach();
        mListener = null;
    }

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setView(fillView(getActivity().getLayoutInflater(), null, savedInstanceState));
        builder.setCancelable(false);
        this.setCancelable(false);
        builder.setPositiveButton(R.string.save, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                int level = TextUtils.isEmpty(mLevelEditText.getText().toString()) ? 50 : Integer.parseInt(mLevelEditText.getText().toString());
                String nickname = mNicknameEditText.getText().toString();
                String speciesId = String.valueOf(mSpeciesSpinner.getSelectedItemId());
                boolean shinny = mShinnySwitch.isChecked();
                String abilityId = String.valueOf(mAbilitySpinner.getSelectedItemId());
                String natureId = /* TODO */ "0";
                String genderId = /* TODO */ "0";
                String move1Id = String.valueOf(mMove1Spinner.getSelectedItemId());
                String move2Id = String.valueOf(mMove2Spinner.getSelectedItemId());
                String move3Id = String.valueOf(mMove3Spinner.getSelectedItemId());
                String move4Id = String.valueOf(mMove4Spinner.getSelectedItemId());
                int ivHp = TextUtils.isEmpty(mIvHpEditText.getText().toString()) ? 0 : Integer.parseInt(mIvHpEditText.getText().toString());
                int ivAtt = TextUtils.isEmpty(mIvAttEditText.getText().toString()) ? 0 : Integer.parseInt(mIvAttEditText.getText().toString());
                int ivDef = TextUtils.isEmpty(mIvDefEditText.getText().toString()) ? 0 : Integer.parseInt(mIvDefEditText.getText().toString());
                int ivSAtt = TextUtils.isEmpty(mIvSAttEditText.getText().toString()) ? 0 : Integer.parseInt(mIvSAttEditText.getText().toString());
                int ivSDef = TextUtils.isEmpty(mIvSDefEditText.getText().toString()) ? 0 : Integer.parseInt(mIvSDefEditText.getText().toString());
                int ivSpd = TextUtils.isEmpty(mIvSpdEditText.getText().toString()) ? 0 : Integer.parseInt(mIvSpdEditText.getText().toString());
                int evHp = TextUtils.isEmpty(mEvHpEditText.getText().toString()) ? 0 : Integer.parseInt(mEvHpEditText.getText().toString());
                int evAtt = TextUtils.isEmpty(mEvAttEditText.getText().toString()) ? 0 : Integer.parseInt(mEvAttEditText.getText().toString());
                int evDef = TextUtils.isEmpty(mEvDefEditText.getText().toString()) ? 0 : Integer.parseInt(mEvDefEditText.getText().toString());
                int evSAtt = TextUtils.isEmpty(mEvSAttEditText.getText().toString()) ? 0 : Integer.parseInt(mEvSAttEditText.getText().toString());
                int evSDef = TextUtils.isEmpty(mEvSDefEditText.getText().toString()) ? 0 : Integer.parseInt(mEvSDefEditText.getText().toString());
                int evSpd = TextUtils.isEmpty(mEvSpdEditText.getText().toString()) ? 0 : Integer.parseInt(mEvSpdEditText.getText().toString());
                String notes = mNotesText.getText().toString();
                String planId /* TODO */ = "";
                mListener.onPositiveClicked(level, nickname, shinny, speciesId, abilityId, natureId, genderId, move1Id, move2Id, move3Id, move4Id, ivHp, ivAtt, ivDef, ivSAtt, ivSDef, ivSpd, evHp, evAtt, evDef, evSAtt, evSDef, evSpd, notes, planId);
            }
        });
        builder.setNegativeButton(R.string.cancel, null);
        return builder.create();
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        if (!getShowsDialog()) {
            return fillView(inflater, container, savedInstanceState);
        } else {
            return super.onCreateView(inflater, container, savedInstanceState);
        }
    }

    private View fillView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_owned_add_dialog, container, false);
        mNicknameEditText = (EditText) view.findViewById(R.id.owned_add_nickname);
        mShinnySwitch = (Switch) view.findViewById(R.id.owned_add_shinny_switch);
        mSpeciesSpinner = (Spinner) view.findViewById(R.id.owned_add_species_spinner);
        mAbilitySpinner = (Spinner) view.findViewById(R.id.owned_add_ability_spinner);
        mMove1Spinner = (Spinner) view.findViewById(R.id.owned_add_move1_spinner);
        mMove2Spinner = (Spinner) view.findViewById(R.id.owned_add_move2_spinner);
        mMove3Spinner = (Spinner) view.findViewById(R.id.owned_add_move3_spinner);
        mMove4Spinner = (Spinner) view.findViewById(R.id.owned_add_move4_spinner);
        mLevelEditText = (EditText) view.findViewById(R.id.owned_add_level_edit_text);
        mIvHpEditText = (EditText) view.findViewById(R.id.owned_add_iv_hp_edit_text);
        mIvAttEditText = (EditText) view.findViewById(R.id.owned_add_iv_att_edit_text);
        mIvDefEditText = (EditText) view.findViewById(R.id.owned_add_iv_def_edit_text);
        mIvSAttEditText = (EditText) view.findViewById(R.id.owned_add_iv_satt_edit_text);
        mIvSDefEditText = (EditText) view.findViewById(R.id.owned_add_iv_sdef_edit_text);
        mIvSpdEditText = (EditText) view.findViewById(R.id.owned_add_iv_spd_edit_text);
        mEvHpEditText = (EditText) view.findViewById(R.id.owned_add_ev_hp_edit_text);
        mEvAttEditText = (EditText) view.findViewById(R.id.owned_add_ev_att_edit_text);
        mEvDefEditText = (EditText) view.findViewById(R.id.owned_add_ev_def_edit_text);
        mEvSAttEditText = (EditText) view.findViewById(R.id.owned_add_ev_satt_edit_text);
        mEvSDefEditText = (EditText) view.findViewById(R.id.owned_add_ev_sdef_edit_text);
        mEvSpdEditText = (EditText) view.findViewById(R.id.owned_add_ev_spd_edit_text);
        mNotesText = (EditText) view.findViewById(R.id.owned_add_notes);

        mSaveButton = (Button) view.findViewById(R.id.owned_saved_button);

        mShinnySwitch.setChecked(false);

        String ownedPokemonId = "";
        if (getArguments() != null) {
            ownedPokemonId = getArguments().getString(ARG_POKEMON_ID);
        }
        int speciesId = -1;
        int abilityId = -1;
        int move1Id = -1;
        int move2Id = -1;
        int move3Id = -1;
        int move4Id = -1;
        if (!TextUtils.isEmpty(ownedPokemonId)) {
            Cursor ownedCursor = getActivity().getContentResolver().query(TinapaContentProvider.OWNED_POKEMON_URI, null, "owned_pokemons.id = " + ownedPokemonId, null, null);
            if (ownedCursor.moveToFirst()) {
                speciesId = ownedCursor.getInt(ownedCursor.getColumnIndex(OwnedKeyValues.POKEMON_ID));
                abilityId = ownedCursor.getInt(ownedCursor.getColumnIndex(OwnedKeyValues.ABILITY_ID));

                move1Id = ownedCursor.getInt(ownedCursor.getColumnIndex(OwnedKeyValues.MOVE1_ID));
                move2Id = ownedCursor.getInt(ownedCursor.getColumnIndex(OwnedKeyValues.MOVE2_ID));
                move3Id = ownedCursor.getInt(ownedCursor.getColumnIndex(OwnedKeyValues.MOVE3_ID));
                move4Id = ownedCursor.getInt(ownedCursor.getColumnIndex(OwnedKeyValues.MOVE4_ID));

                mNicknameEditText.setText(ownedCursor.getString(ownedCursor.getColumnIndex(OwnedKeyValues.NICKNAME)));
                mLevelEditText.setText(ownedCursor.getString(ownedCursor.getColumnIndex(OwnedKeyValues.LEVEL)));

                mShinnySwitch.setChecked(ownedCursor.getInt(ownedCursor.getColumnIndex(OwnedKeyValues.SHINNY)) != 0);

                mEvHpEditText.setText(ownedCursor.getString(ownedCursor.getColumnIndex(OwnedKeyValues.EV_HP)));
                mEvAttEditText.setText(ownedCursor.getString(ownedCursor.getColumnIndex(OwnedKeyValues.EV_ATT)));
                mEvDefEditText.setText(ownedCursor.getString(ownedCursor.getColumnIndex(OwnedKeyValues.EV_DEF)));
                mEvSAttEditText.setText(ownedCursor.getString(ownedCursor.getColumnIndex(OwnedKeyValues.EV_SATT)));
                mEvSDefEditText.setText(ownedCursor.getString(ownedCursor.getColumnIndex(OwnedKeyValues.EV_SDEF)));
                mEvSpdEditText.setText(ownedCursor.getString(ownedCursor.getColumnIndex(OwnedKeyValues.EV_SPD)));

                mIvHpEditText.setText(ownedCursor.getString(ownedCursor.getColumnIndex(OwnedKeyValues.IV_HP)));
                mIvAttEditText.setText(ownedCursor.getString(ownedCursor.getColumnIndex(OwnedKeyValues.IV_ATT)));
                mIvDefEditText.setText(ownedCursor.getString(ownedCursor.getColumnIndex(OwnedKeyValues.IV_DEF)));
                mIvSAttEditText.setText(ownedCursor.getString(ownedCursor.getColumnIndex(OwnedKeyValues.IV_SATT)));
                mIvSDefEditText.setText(ownedCursor.getString(ownedCursor.getColumnIndex(OwnedKeyValues.IV_SDEF)));
                mIvSpdEditText.setText(ownedCursor.getString(ownedCursor.getColumnIndex(OwnedKeyValues.IV_SPD)));

                mNotesText.setText(ownedCursor.getString(ownedCursor.getColumnIndex(OwnedKeyValues.NOTE)));
            }
        }

        Cursor speciesCursor = getActivity().getContentResolver().query(TinapaContentProvider.POKEDEX_ALL_SHORT_URI, null, null, null, null);
        String[] from = {DexKeyValues.name};
        int[] to = {R.id.simple_cell_name};
        CursorAdapter mSpeciesCursorAdapter = new SimpleCursorAdapter(getActivity(), R.layout.cell_simple_name, speciesCursor, from, to, 0);
        mSpeciesSpinner.setAdapter(mSpeciesCursorAdapter);
        if (speciesId >= 0) {
{'fraction_non_alphanumeric': 0.10033871289101415, 'fraction_numerical': 0.004821677625024905, 'mean_word_length': 3.637959711698392, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5455368', 'n_tokens_mistral': 7630, 'n_tokens_neox': 7335, 'n_words': 1099}