mRecycler.clear();
mRecycler.clear();
/** * Obtain a view, either by pulling an existing view from the recycler or * by getting a new one from the adapter. If we are animating, make sure * there is enough information in the view's layout parameters to animate * from the old to new positions. * * @param position Position in the spinner for the view to obtain * @return A view that has been added to the spinner */ private View makeAndAddView(int position) { View child; if (!mDataChanged) { child = mRecycler.get(position); if (child != null) { // Position the view setUpChild(child); return child; } } // Nothing found in the recycler -- ask the adapter for a view child = mAdapter.getView(position, null, this); // Position the view setUpChild(child); return child; }
/** * Obtain a view, either by pulling an existing view from the recycler or * by getting a new one from the adapter. If we are animating, make sure * there is enough information in the view's layout parameters to animate * from the old to new positions. * * @param position Position in the spinner for the view to obtain * @return A view that has been added to the spinner */ private View makeAndAddView(int position) { View child; if (!mDataChanged) { child = mRecycler.get(position); if (child != null) { // Position the view setUpChild(child); return child; } } // Nothing found in the recycler -- ask the adapter for a view child = mAdapter.getView(position, null, this); // Position the view setUpChild(child); return child; }
@Override public int getBaseline() { View child = null; if (getChildCount() > 0) { child = getChildAt(0); } else if (mAdapter != null && mAdapter.getCount() > 0) { child = makeAndAddView(0); mRecycler.put(0, child); removeAllViewsInLayout(); } if (child != null) { final int childBaseline = child.getBaseline(); return childBaseline >= 0 ? child.getTop() + childBaseline : -1; } else { return -1; } }
@Override public int getBaseline() { View child = null; if (getChildCount() > 0) { child = getChildAt(0); } else if (mAdapter != null && mAdapter.getCount() > 0) { child = makeAndAddView(0); mRecycler.put(0, child); removeAllViewsInLayout(); } if (child != null) { final int childBaseline = child.getBaseline(); return childBaseline >= 0 ? child.getTop() + childBaseline : -1; } else { return -1; } }
void recycleAllViews() { final int childCount = getChildCount(); final IcsAbsSpinner.RecycleBin recycleBin = mRecycler; final int position = mFirstPosition; // All views go in recycler for (int i = 0; i < childCount; i++) { View v = getChildAt(i); int index = position + i; recycleBin.put(index, v); } }
void recycleAllViews() { final int childCount = getChildCount(); final IcsAbsSpinner.RecycleBin recycleBin = mRecycler; final int position = mFirstPosition; // All views go in recycler for (int i = 0; i < childCount; i++) { View v = getChildAt(i); int index = position + i; recycleBin.put(index, v); } }