Android Open Source - rpg-droid Adapters






From Project

Back to project page rpg-droid.

License

The source code is released under:

Apache License

If you think the Android project rpg-droid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/**
 * Created by jon on 8/06/14.//from w ww . ja va2  s. c om
 *
 */

package com.thing.rpg_droid.pathfinder;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.TextView;

import com.thing.rpg_droid.res.R;

import java.util.ArrayList;

public class Adapters
{


    private static class SpellViewHolder
    {
        public TextView nameView;
    }

    public static class SpellListAdapter extends ArrayAdapter
    {
        private ArrayList<Spell> mSpells;

        public SpellListAdapter(Context pContext)
        {
            super(pContext, 0);
            mSpells = new ArrayList<Spell>();
        }

        public SpellListAdapter(Context pContext, ArrayList<Spell> pSpells)
        {
            super(pContext, 0);
            mSpells = pSpells;
        }

        public int getSpellCount()
        {
            return mSpells.size();
        }

        public Spell getSpell(int i)
        {
            return mSpells.get(i);
        }

        public void putSpell(Spell pSpell)
        {
            mSpells.add(pSpell);
        }

        public void removeSpell(int i)
        {
            mSpells.remove(i);
        }

        public void clearSpells()
        {
            mSpells.clear();
        }

        @Override
        public View getView(int pPosition, View pConvertView, ViewGroup pParent)
        {
            ViewGroup lView = (ViewGroup)pConvertView;

            final Spell lItem = mSpells.get(pPosition);

            if (lView == null)
            {
                lView = (ViewGroup)LayoutInflater.from(this.getContext()).inflate(R.layout.pathfinder_view_ability, null);
                final SpellViewHolder lHolder = new SpellViewHolder();
                lHolder.nameView = (TextView)lView.findViewById(R.id.spell_name);
                lView.setTag(lHolder);
            }

            ((SpellViewHolder)lView.getTag()).nameView.setText(lItem.getName());

            //((AbilityViewHolder)lView.getTag()).value.setTag(lItem);//for updates

            return lView;
        }
    }
}




Java Source Code List

com.thing.rpg_droid.Utils.DieRoller.java
com.thing.rpg_droid.Utils.DieType.java
com.thing.rpg_droid.app.Activity_CharacterList.java
com.thing.rpg_droid.app.Activity_Charsheet.java
com.thing.rpg_droid.app.CharSheet_PageInfo.java
com.thing.rpg_droid.app.Fragment_CharacterList.java
com.thing.rpg_droid.app.ICharacter.java
com.thing.rpg_droid.app.PagerAdapter_Charsheet.java
com.thing.rpg_droid.app.ViewBinder.java
com.thing.rpg_droid.app.View_CharacterSheet_Field.java
com.thing.rpg_droid.app.dummy.DummyContent.java
com.thing.rpg_droid.pathfinder.Ability.java
com.thing.rpg_droid.pathfinder.Adapters.java
com.thing.rpg_droid.pathfinder.Appearance.java
com.thing.rpg_droid.pathfinder.ArmorClass.java
com.thing.rpg_droid.pathfinder.BodySlot.java
com.thing.rpg_droid.pathfinder.Character.java
com.thing.rpg_droid.pathfinder.Fragment_Basic.java
com.thing.rpg_droid.pathfinder.Fragment_Gear.java
com.thing.rpg_droid.pathfinder.Fragment_Skills.java
com.thing.rpg_droid.pathfinder.Fragment_Spells_Abilities.java
com.thing.rpg_droid.pathfinder.Fragment_Status.java
com.thing.rpg_droid.pathfinder.IInventoryLocation.java
com.thing.rpg_droid.pathfinder.Initiative.java
com.thing.rpg_droid.pathfinder.SavingThrow.java
com.thing.rpg_droid.pathfinder.SizeModifier.java
com.thing.rpg_droid.pathfinder.Skill.java
com.thing.rpg_droid.pathfinder.Spell.java
com.thing.rpg_droid.pathfinder.Status.java