Android Open Source - CallLog Hotline Adapter






From Project

Back to project page CallLog.

License

The source code is released under:

GNU General Public License

If you think the Android project CallLog 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.kaosh.calllog;
/*  w ww  . j  a  v 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 HotlineAdapter extends BaseAdapter {
  private int mResource;
  private static LayoutInflater mInflater = null;
  private Context mContext;
  private ArrayList<HotlineObj> mData;

  public HotlineAdapter(Context context,
      ArrayList<HotlineObj> data, int resource) {

    mData = data;
    mResource = resource;
    mContext = context;

    mInflater = (LayoutInflater) mContext
        .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  }

  public int getCount() {
    return mData.size();
  }

  public Object getItem(int position) {
    return mData.get(position);
  }

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

  public View getView(int position, View convertView, ViewGroup parent) {
    View view = convertView;
    if (convertView == null) {
      view = mInflater.inflate(mResource, null);
      HotlineItemCache cache = new HotlineItemCache();
      cache.mNumber = (TextView) view.findViewById(R.id.number);
      cache.mRate = (TextView) view.findViewById(R.id.rate);
      view.setTag(cache);
    }

    final HotlineItemCache cache = (HotlineItemCache)view.getTag();
    
    String number = mData.get(position).mNumber;
    String rate = String.valueOf(mData.get(position).mRate);
    
    number = PhoneUtils.getNameByNumber(number, mContext);
    
    cache.mNumber.setText(number);
    cache.mRate.setText(rate);
    
    return view;
  }
  
  final static class HotlineItemCache {
    public TextView mNumber;
    public TextView mRate;
  }
  
}




Java Source Code List

com.kaosh.calllog.CallLogActivity.java
com.kaosh.calllog.CallLogWidget.java
com.kaosh.calllog.DatabaseOpenHelper.java
com.kaosh.calllog.HotlineAdapter.java
com.kaosh.calllog.HotlineObj.java
com.kaosh.calllog.HotlineSettingActivity.java
com.kaosh.calllog.Hotline.java
com.kaosh.calllog.NPAdapter.java
com.kaosh.calllog.NPObj.java
com.kaosh.calllog.NPSettingActivity.java
com.kaosh.calllog.NP.java
com.kaosh.calllog.PhoneLog.java
com.kaosh.calllog.PhoneUtils.java
com.kaosh.calllog.RateSettingActivity.java
com.kaosh.calllog.SMSLog.java
com.kaosh.calllog.Utils.java