Android Open Source - pick-share Filter Adapter






From Project

Back to project page pick-share.

License

The source code is released under:

Apache License

If you think the Android project pick-share 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.mathilde.customcam.adapter;
/*  w ww. j a  v a  2s.  c  o m*/
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.mathilde.customcam.R;

import java.util.HashMap;
import java.util.List;

/**
 * Created by mathilde on 02/08/14.
 */
public class FilterAdapter extends BaseAdapter{
    public static final String TAG = "FilterAdapter";

    private LayoutInflater mInflater;
    private HashMap<Integer, String> mList;
    private Context mContext;

    public FilterAdapter(Context context, HashMap<Integer, String> list){
        mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        mList = list;
        mContext = context;
    }

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

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

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

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

        if (convertView == null) {
            // Inflate the view since it does not exist
            convertView = mInflater.inflate(R.layout.item_filter, parent, false);

            // Create and save off the holder in the tag so we get quick access to inner fields
            // This must be done for performance reasons
            holder = new Holder();
            holder.textView = (TextView) convertView.findViewById(R.id.text_filter);
            holder.imageView = (ImageView) convertView.findViewById(R.id.image_filter);
            convertView.setTag(holder);
        } else {
            holder = (Holder) convertView.getTag();
        }

        // Populate the text
        holder.textView.setText(getItem(position).toString());
        holder.imageView.setImageDrawable(mContext.getResources().getDrawable(R.drawable.small_circle_red));
        // Set the color
        return convertView;
    }

    /** View holder for the views we need access to */
    private static class Holder {
        public TextView textView;
        public ImageView imageView;
    }

}




Java Source Code List

com.example.mathilde.customcam.ApplicationTest.java
com.mathilde.customcam.MainActivity.java
com.mathilde.customcam.NavigationDrawerFragment.java
com.mathilde.customcam.adapter.FilterAdapter.java
com.mathilde.customcam.camera.CameraActivity.java
com.mathilde.customcam.camera.CameraPreview.java
com.mathilde.customcam.camera.GridLines.java
com.mathilde.customcam.camera.SaveFile.java
com.mathilde.customcam.custom_pick.CustomMatrixFragment.java
com.mathilde.customcam.custom_pick.CustomPickActivity.java
com.mathilde.customcam.custom_pick.CustomPickFragment.java
com.mathilde.customcam.image.Utils.java
com.mathilde.customcam.widget.StartPointSeekBar.java
com.meetme.android.horizontallistview.HorizontalListView.java