Android Open Source - location-sharing-android Request Adapter






From Project

Back to project page location-sharing-android.

License

The source code is released under:

MIT License

If you think the Android project location-sharing-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 lv.lu.locationsharing.listview.adapter;
//w ww  . ja v  a 2s . c  om
import java.util.List;

import lv.lu.locationsharing.R;
import lv.lu.locationsharing.model.Friend;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class RequestAdapter extends BaseAdapter {
  private static final String TAG = RequestAdapter.class.getSimpleName();
  private List<Friend> mRequestList;
  private LayoutInflater mInflater;
  private Context c;

  public RequestAdapter(Context c) {
    mInflater = LayoutInflater.from(c);
    this.c = c;
  }

  public void setData(List<Friend> list) {
    mRequestList = list;
    Log.v(TAG, "End setting data");

  }

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

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

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

  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder;

    if (convertView == null) {
      convertView = mInflater
          .inflate(R.layout.listview_request_row, null);

      holder = new ViewHolder();

      holder.mName = (TextView) convertView
          .findViewById(R.id.listview_friend_name);
      holder.mEmail = (TextView) convertView
          .findViewById(R.id.listview_friend_email);
      convertView.setTag(holder);
    } else {
      holder = (ViewHolder) convertView.getTag();
    }

    Friend friend = mRequestList.get(position);

    holder.mName.setText(friend.getName());
    holder.mEmail.setText(friend.getEmail());
    

    return convertView;
  }

  static class ViewHolder {
    TextView mName;
    TextView mEmail;
  }
}




Java Source Code List

lv.lu.locationsharing.Fragment1.java
lv.lu.locationsharing.Fragment2.java
lv.lu.locationsharing.Fragment3.java
lv.lu.locationsharing.Fragment4.java
lv.lu.locationsharing.Fragment5.java
lv.lu.locationsharing.LocationBroadcastReceiver.java
lv.lu.locationsharing.LoginActivity.java
lv.lu.locationsharing.MainActivity.java
lv.lu.locationsharing.MenuListAdapter.java
lv.lu.locationsharing.SignUpActivity.java
lv.lu.locationsharing.application.LocationApplication.java
lv.lu.locationsharing.config.Config.java
lv.lu.locationsharing.listview.adapter.RequestAdapter.java
lv.lu.locationsharing.model.AuthenticationStatus.java
lv.lu.locationsharing.model.Friend.java
lv.lu.locationsharing.model.GetFriends.java
lv.lu.locationsharing.model.InviteFriends.java
lv.lu.locationsharing.model.LocationPostStatus.java
lv.lu.locationsharing.model.Registration.java
lv.lu.locationsharing.requests.authentication.AuthenticationRequest.java
lv.lu.locationsharing.requests.authentication.AuthenticationStatusRequest.java
lv.lu.locationsharing.requests.friends.ConfirmFriendRequest.java
lv.lu.locationsharing.requests.friends.GetFriendsRequest.java
lv.lu.locationsharing.requests.friends.InviteFriendsRequest.java
lv.lu.locationsharing.requests.friends.PostLogout.java
lv.lu.locationsharing.requests.location.PostLocationUpdate.java
lv.lu.locationsharing.requests.registration.RegistrationRequest.java
lv.lu.locationsharing.utils.Constants.java
lv.lu.locationsharing.utils.Installation.java
lv.lu.locationsharing.utils.Url.java
lv.lu.locationsharing.utils.Utils.java