Android Open Source - SpareDeck Deck Select Adapter






From Project

Back to project page SpareDeck.

License

The source code is released under:

MIT License

If you think the Android project SpareDeck 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

package com.hacsoft.sparedeck;
/*from   w w w.  j av a 2  s .  com*/
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;


public class DeckSelectAdapter extends BaseAdapter
{
    private final Context m_context;


    public DeckSelectAdapter( Context context, int textViewResourceId )
    {
        this.m_context = context;
    }

    @Override
    public int getCount()
    {
        return SpareDeck.decks.size();
    }

    @Override
    public Object getItem( int position )
    {
        return SpareDeck.decks.get( position );
    }

    @Override
    public long getItemId( int position )
    {
        return SpareDeck.decks.get( position ).getDeckIconRes();
    }

    @Override
    public View getView( int position, View convertView, ViewGroup parent )
    {
        if ( convertView == null ) {
            convertView = new ImageView( this.m_context );
        }

        ( (ImageView) ( convertView ) ).setImageResource( SpareDeck.decks.get( position ).getDeckIconRes() );
        ( (ImageView) ( convertView ) ).setLayoutParams( new GridView.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT ) );
        ( (ImageView) ( convertView ) ).setScaleType( ImageView.ScaleType.FIT_CENTER );
        // ((ImageView)(convertView)).setBackgroundResource(
        // mGalleryItemBackground );

        return convertView;
    }

}




Java Source Code List

com.hacsoft.sparedeck.About.java
com.hacsoft.sparedeck.Card.java
com.hacsoft.sparedeck.DeckSelectAdapter.java
com.hacsoft.sparedeck.DeckViewer.java
com.hacsoft.sparedeck.Deck.java
com.hacsoft.sparedeck.ShowConfig.java
com.hacsoft.sparedeck.SpareDeck.java
com.hacsoft.sparedeck.decks.Card.java
com.hacsoft.sparedeck.decks.Deck.java
com.hacsoft.sparedeck.decks.IcarusDeck.java
com.hacsoft.sparedeck.decks.N3dsDeck.java
com.hacsoft.sparedeck.decks.VitaDeck.java
com.hacsoft.sparedeck.pokedex.CodeGridView.java
com.hacsoft.sparedeck.pokedex.PokedexActivity.java
com.robobunny.SeekBarPreference.java