FileDocCategorySizeDatePackage
ListOfInternalSelectionViews.javaAPI DocAndroid 5.1 API5485Thu Mar 12 22:22:12 GMT 2015android.widget.focus

ListOfInternalSelectionViews

public class ListOfInternalSelectionViews extends android.app.Activity
A list of {@link InternalSelectionView}s paramatarized by the number of items, how many rows in each item, and how tall each item is.

Fields Summary
private android.widget.ListView
mListView
public static final String
BUNDLE_PARAM_NUM_ITEMS
public static final String
BUNDLE_PARAM_NUM_ROWS_PER_ITEM
public static final String
BUNDLE_PARAM_ITEM_SCREEN_HEIGHT_FACTOR
private int
mScreenHeight
private int
mNumItems
private int
mNumRowsPerItem
private double
mItemScreenSizeFactor
Constructors Summary
Methods Summary
public static android.os.BundlegetBundleFor(int numItems, int numRowsPerItem, double itemScreenHeightFactor)
Initialize a bundle suitable for sending as the params of the intent that launches this activity.

param
numItems The number of items in the list.
param
numRowsPerItem The number of rows per item.
param
itemScreenHeightFactor see {@link #getScreenHeight()}
return
the intialized bundle.

        Bundle bundle = new Bundle();
        bundle.putInt(BUNDLE_PARAM_NUM_ITEMS, numItems);
        bundle.putInt(BUNDLE_PARAM_NUM_ROWS_PER_ITEM, numRowsPerItem);
        bundle.putDouble(BUNDLE_PARAM_ITEM_SCREEN_HEIGHT_FACTOR, itemScreenHeightFactor);
        return bundle;
    
public doublegetItemScreenSizeFactor()
Each item is screen height * this factor tall.

        return mItemScreenSizeFactor;
    
public java.lang.StringgetLabelForPosition(int position)

param
position The position
return
The label (closest thing to a value) for the item at position

        return "position " + position;
    
public android.widget.ListViewgetListView()


       
        return mListView;
    
public intgetNumItems()

return
The number of items in the list.

        return mNumItems;
    
public intgetNumRowsPerItem()

return
The number of rows per item.

        return mNumRowsPerItem;
    
public intgetScreenHeight()
Get the screen height.

        return mScreenHeight;
    
public android.util.InternalSelectionViewgetSelectedView()
Get the currently selected view.

        return (InternalSelectionView) getListView().getSelectedView();
    
private voidinitFromBundle(android.os.Bundle icicle)


        int numItems = icicle.getInt(BUNDLE_PARAM_NUM_ITEMS, -1);
        if (numItems != -1) {
            mNumItems = numItems;
        }
        int numRowsPerItem = icicle.getInt(BUNDLE_PARAM_NUM_ROWS_PER_ITEM, -1);
        if (numRowsPerItem != -1) {
            mNumRowsPerItem = numRowsPerItem;
        }
        double screenHeightFactor = icicle.getDouble(BUNDLE_PARAM_ITEM_SCREEN_HEIGHT_FACTOR, -1.0);
        if (screenHeightFactor > 0) {
            mItemScreenSizeFactor = screenHeightFactor;
        }
    
protected voidonCreate(android.os.Bundle icicle)

        super.onCreate(icicle);

        Point size = new Point();
        getWindowManager().getDefaultDisplay().getSize(size);
        mScreenHeight = size.y;

        Bundle extras = getIntent().getExtras();
        if (extras != null) {
            initFromBundle(extras);
        }

        mListView = new ListView(this);
        mListView.setLayoutParams(new ViewGroup.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT));
        mListView.setDrawSelectorOnTop(false);
        mListView.setAdapter(new MyAdapter());
        mListView.setItemsCanFocus(true);
        setContentView(mListView);