Example usage for android.widget AbsListView getChoiceMode

List of usage examples for android.widget AbsListView getChoiceMode

Introduction

In this page you can find the example usage for android.widget AbsListView getChoiceMode.

Prototype

public int getChoiceMode() 

Source Link

Usage

From source file:uk.org.downiesoft.slideshow.ThumbnailAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ImageView imageView;/*w w w. j av  a2s  . co  m*/
    if (convertView == null) {
        imageView = (ImageView) mLayoutInflater.inflate(R.layout.gridview_item, parent, false);
        imageView.setLayoutParams(mLayoutParams);
    } else {
        imageView = (ImageView) convertView;
        // hack to reset selection state of re-used views after action mode ended
        AbsListView list = (AbsListView) parent;
        if (list != null && list.getChoiceMode() == ListView.CHOICE_MODE_NONE) {
            imageView.setActivated(false);
        }

    }
    if (mThumbBitmaps.size() > position && mThumbBitmaps.get(position) != null) {
        Bitmap bmp = mThumbBitmaps.get(position);
        imageView.setImageBitmap(bmp);
        if (bmp.getWidth() >= mThumbSize || bmp.getHeight() >= mThumbSize) {
            imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
        } else {
            imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
        }
    } else {
        imageView.setImageResource(R.drawable.ic_launcher);
    }
    return imageView;
}