Android Open Source - VoxPopuli-Android Voted Player Adapter






From Project

Back to project page VoxPopuli-Android.

License

The source code is released under:

GNU General Public License

If you think the Android project VoxPopuli-Android 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 fr.kyriog.android.voxpopuli.adapter;
/*www .  j  av  a  2  s.c  o m*/
import java.util.List;

import android.app.Activity;
import android.graphics.Paint;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import fr.kyriog.android.voxpopuli.R;
import fr.kyriog.android.voxpopuli.entity.Player;

public class VotedPlayerAdapter extends PlayerAdapter {
  public VotedPlayerAdapter(Activity activity, List<Player> players) {
    super(activity, players);
  }

  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    convertView = super.getView(position, convertView, parent);
    Player player = getItem(position);

    TextView username = (TextView) convertView.findViewById(R.id.game_waiting_player_username);

    if(player.hasVoted()) {
      LinearLayout layout = (LinearLayout) convertView.findViewById(R.id.game_waiting_player);
      layout.setBackgroundResource(R.drawable.gray_rounded_background);
      if(player.isDead())
        username.setPaintFlags(Paint.STRIKE_THRU_TEXT_FLAG);
    } else if(player.isDead()) {
      ImageView avatar = (ImageView) convertView.findViewById(R.id.game_waiting_player_image);
      avatar.setAlpha((float) 0.3);
      username.setAlpha((float) 0.3);
    }

    return convertView;
  }
}




Java Source Code List

fr.kyriog.android.voxpopuli.GameActivity.java
fr.kyriog.android.voxpopuli.HomeActivity.java
fr.kyriog.android.voxpopuli.LoginActivity.java
fr.kyriog.android.voxpopuli.adapter.HomeAdapter.java
fr.kyriog.android.voxpopuli.adapter.PlayerAdapter.java
fr.kyriog.android.voxpopuli.adapter.ResultPlayerAdapter.java
fr.kyriog.android.voxpopuli.adapter.VotedPlayerAdapter.java
fr.kyriog.android.voxpopuli.entity.Game.java
fr.kyriog.android.voxpopuli.entity.Player.java
fr.kyriog.android.voxpopuli.entity.Question.java
fr.kyriog.android.voxpopuli.handler.AvatarHandler.java
fr.kyriog.android.voxpopuli.handler.GameHandler.java
fr.kyriog.android.voxpopuli.handler.HomeHandler.java
fr.kyriog.android.voxpopuli.socketio.BaseCallback.java
fr.kyriog.android.voxpopuli.socketio.GameCallback.java
fr.kyriog.android.voxpopuli.socketio.HomeCallback.java
fr.kyriog.android.voxpopuli.thread.AvatarDownloader.java