Back to project page android-friend-smash-v2.
The source code is released under:
Copyright (c) 2014, Facebook, Inc. All rights reserved. You are hereby granted a non-exclusive, worldwide, royalty-free license to use, copy, modify, and distribute this software in source code or bi...
If you think the Android project android-friend-smash-v2 listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.facebook.android.friendsmash; //from w ww.j a v a2 s . c o m import java.util.List; import com.facebook.model.GraphUser; import com.facebook.widget.ProfilePictureView; import android.content.Context; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.TextView; public class RequestUserArrayAdapter extends ArrayAdapter<GraphUser> { private final Context context; private final List<GraphUser> users; public RequestUserArrayAdapter(Context context, List<GraphUser> users) { super(context, R.layout.request_list_item_view, users); this.context = context; this.users = users; } @Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View listItemView = inflater.inflate(R.layout.request_list_item_view, parent, false); ProfilePictureView profilePicView = (ProfilePictureView) listItemView.findViewById(R.id.requestListItemProfilePic); TextView nameView = (TextView) listItemView.findViewById(R.id.requestListItemName); final ImageView checkBox = (ImageView) listItemView.findViewById(R.id.requestListItemCheckbox); GraphUser currentUser = users.get(position); profilePicView.setProfileId(currentUser.getId()); profilePicView.setCropped(true); nameView.setText(currentUser.getFirstName()); checkBox.setOnTouchListener(new View.OnTouchListener() { boolean checked = false; @Override public boolean onTouch(View v, MotionEvent event) { // toggle image if (checked) { checked = false; checkBox.setImageResource(R.drawable.checkbox_cold); } else { checked = true; checkBox.setImageResource(R.drawable.checkbox_hot); } return false; } }); return listItemView; } }