Android Open Source - Briscola Player Adapter






From Project

Back to project page Briscola.

License

The source code is released under:

GNU General Public License

If you think the Android project Briscola 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.gmail.craptik.briscola;
/*w  w w. jav  a2 s . c  om*/
import java.util.ArrayList;

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

public class PlayerAdapter extends BaseAdapter
{

  private Context       context;
  private ArrayList<Player>   players;
  private boolean       showScore;

  public PlayerAdapter(Context context, ArrayList<Player> players, boolean showScore)
  {
    this.context = context;
    this.players = players;
    this.showScore = showScore;
  }

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

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

  @Override
  public long getItemId(int position)
  {
    return 0;
  }

  @Override
  public View getView(int position, View view, ViewGroup parent)
  {
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        View rowView = inflater.inflate(R.layout.row_player, parent, false);

        TextView nameView   = (TextView) rowView.findViewById(R.id.row_player_name);
        TextView pointsView = (TextView) rowView.findViewById(R.id.row_player_points);

        nameView.setText(players.get(position).getName());

        if (showScore)
        {
          pointsView.setText(String.valueOf(players.get(position).getTotalScore()));
        }

        return rowView;
  }
}




Java Source Code List

com.gmail.craptik.briscola.ActionAdapter.java
com.gmail.craptik.briscola.ActionItem.java
com.gmail.craptik.briscola.CallCardCupsSelectActivity.java
com.gmail.craptik.briscola.CallCardFeathersSelectActivity.java
com.gmail.craptik.briscola.CallCardSuitSelectActivity.java
com.gmail.craptik.briscola.CallCardSunsSelectActivity.java
com.gmail.craptik.briscola.CallCardSwordsSelectActivity.java
com.gmail.craptik.briscola.CalleeSelectActivity.java
com.gmail.craptik.briscola.CallerBidSelectActivity.java
com.gmail.craptik.briscola.Card.java
com.gmail.craptik.briscola.ECardNumber.java
com.gmail.craptik.briscola.ECardSuit.java
com.gmail.craptik.briscola.EGameProgress.java
com.gmail.craptik.briscola.FirstNemesisSelectActivity.java
com.gmail.craptik.briscola.GameData.java
com.gmail.craptik.briscola.IDatabase.java
com.gmail.craptik.briscola.MainActivity.java
com.gmail.craptik.briscola.NewGameActivity.java
com.gmail.craptik.briscola.PlayerAdapter.java
com.gmail.craptik.briscola.Player.java
com.gmail.craptik.briscola.PlayersSelectActivity.java
com.gmail.craptik.briscola.SQLGameDatabase.java
com.gmail.craptik.briscola.ScoreSelectActivity.java
com.gmail.craptik.briscola.TestDatabase.java