Android Open Source - cloud-app Left Adapter






From Project

Back to project page cloud-app.

License

The source code is released under:

MIT License

If you think the Android project cloud-app 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 org.bq.adapter;
/*  w w  w.  j  a  v a  2 s.  co m*/
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import org.bq.yun.R;

import java.util.List;

/**
 * Created by bq on 2015/1/4.
 */
public class LeftAdapter extends BaseAdapter {
    private List<String> items;
    private LayoutInflater inflater;
    private Context context;

    public LeftAdapter(Context context, List<String> items) {
        this.context = context;
        this.inflater = LayoutInflater.from(context);
        this.items = items;
    }

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

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

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

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        String item = items.get(position);
        ViewHolder viewHolder;
        if (convertView == null) {
            convertView = inflater.inflate(R.layout.left_list, null);
            viewHolder = new ViewHolder();
            viewHolder.tv = (TextView) convertView.findViewById(R.id.left_list_tv);

        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }
        viewHolder.tv.setText(item);
        return convertView;
    }

    private static class ViewHolder {
        public TextView tv;
    }
}




Java Source Code List

org.bq.adapter.LeftAdapter.java
org.bq.fragement.FirstFragment.java
org.bq.fragement.SecondFragment.java
org.bq.layout.MyDrawerLayout.java
org.bq.yun.ApplicationTest.java
org.bq.yun.MainActivity.java