Gets a view from the pool and prepares it
V v = null;
boolean isNewView = false;
if (mPool.isEmpty()) {
v = mViewCreator.createView(mContext);
isNewView = true;
} else {
// Try and find a preferred view
Iterator<V> iter = mPool.iterator();
while (iter.hasNext()) {
V vpv = iter.next();
if (mViewCreator.hasPreferredData(vpv, preferredData)) {
v = vpv;
iter.remove();
break;
}
}
// Otherwise, just grab the first view
if (v == null) {
v = mPool.pop();
}
}
mViewCreator.prepareViewToLeavePool(v, prepareData, isNewView);
return v;