Android Open Source - qingzhou Frequent Adapter






From Project

Back to project page qingzhou.

License

The source code is released under:

GNU General Public License

If you think the Android project qingzhou 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

/* 
 *  Copyright 2012 Loong H/*from ww w  . j  a  v  a2 s.  c  o m*/
 * 
 *  Qingzhou is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Qingzhou is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.loongsoft.qingzhou;

import java.util.ArrayList;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageButton;
import android.widget.TextView;

public class FrequentAdapter extends BaseAdapter {
    
    private Activity mActivity;
    private static LayoutInflater inflater=null;
    
    private ArrayList<FrequentThing> mThings;

    
    public FrequentAdapter(Activity a, ArrayList<FrequentThing> things) {
      mActivity = a;
      mThings=things;
        inflater = (LayoutInflater)mActivity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }

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

    public Object getItem(int position) {
        return position;
    }

    public long getItemId(int position) {
        return position;
    }
    
    public View getView(int position, View convertView, ViewGroup parent) {   
      FrequentItemViewHolder viewHolder = null;
        
        if (convertView == null ) {
          convertView = inflater.inflate(R.layout.frequent_list_row, null);
          viewHolder = new FrequentItemViewHolder();
          viewHolder.text = (TextView)convertView.findViewById(R.id.frequent_text);
          convertView.setTag(viewHolder);
        }
        
        viewHolder = (FrequentItemViewHolder)convertView.getTag();
        viewHolder.text.setText(mThings.get(position).getName() + " x " + 
              mThings.get(position).getCount());
        
        return convertView;
    }
    
    public class FrequentItemViewHolder {
      public TextView text = null;
    }
}




Java Source Code List

com.loongsoft.qingzhou.ADayActivity.java
com.loongsoft.qingzhou.ADayAdapter.java
com.loongsoft.qingzhou.DaysActivity.java
com.loongsoft.qingzhou.DaysAdapter.java
com.loongsoft.qingzhou.FrequentActivity.java
com.loongsoft.qingzhou.FrequentAdapter.java
com.loongsoft.qingzhou.FrequentThing.java
com.loongsoft.qingzhou.MetaData.java
com.loongsoft.qingzhou.QingzhouPreference.java
com.loongsoft.qingzhou.QingzhouProviderMetaData.java
com.loongsoft.qingzhou.QingzhouProvider.java
com.loongsoft.qingzhou.ReminderReciever.java
com.loongsoft.qingzhou.ResetPasswordPreference.java
com.loongsoft.qingzhou.SplashActivity.java
com.loongsoft.qingzhou.Test.java
com.loongsoft.qingzhou.ThingManager.java
com.loongsoft.qingzhou.Thing.java
com.loongsoft.qingzhou.TimePreference.java
com.loongsoft.qingzhou.Utils.java
com.loongsoft.qingzhou.WelcomeActivity.java