/** * If the wrapped SpinnerAdapter is also a ListAdapter, delegate this call. Otherwise, * return true. */ public boolean isEnabled(int position) { final ListAdapter adapter = mListAdapter; return adapter == null || adapter.isEnabled(position); }
@Override public boolean isEnabled(int position) { if (mAdapter != null) { // the cell is enabled if at least one item is enabled boolean enabled = false; for (int i = 0; i < mItemsPerRow; ++i) { int p = position * mItemsPerRow + i; if (p < mAdapter.getCount()) { enabled |= mAdapter.isEnabled(p); } } return enabled; } return true; }
public boolean isEnabled(int position) { // Header (negative positions will throw an ArrayIndexOutOfBoundsException) int numHeaders = getHeadersCount(); if (position < numHeaders) { return mHeaderViewInfos.get(position).isSelectable; } // Adapter final int adjPosition = position - numHeaders; int adapterCount = 0; if (mAdapter != null) { adapterCount = mAdapter.getCount(); if (adjPosition < adapterCount) { return mAdapter.isEnabled(adjPosition); } } // Footer (off-limits positions will throw an ArrayIndexOutOfBoundsException) return mFooterViewInfos.get(adjPosition - adapterCount).isSelectable; }
@Override public boolean isEnabled(int position) { // Header (negative positions will throw an IndexOutOfBoundsException) int numHeadersAndPlaceholders = getHeadersCount() * mNumColumns; if (position < numHeadersAndPlaceholders) { return position % mNumColumns == 0 && mHeaderViewInfos.get(position / mNumColumns).isSelectable; } // Adapter final int adjPosition = position - numHeadersAndPlaceholders; int adapterCount = 0; if (mAdapter != null) { adapterCount = getAdapterAndPlaceHolderCount(); if (adjPosition < adapterCount) { return adjPosition < mAdapter.getCount() && mAdapter.isEnabled(adjPosition); } } // Footer (off-limits positions will throw an IndexOutOfBoundsException) final int footerPosition = adjPosition - adapterCount; return footerPosition % mNumColumns == 0 && mFooterViewInfos.get(footerPosition / mNumColumns).isSelectable; }
@Override public boolean isEnabled(int position) { // Header (negative positions will throw an IndexOutOfBoundsException) int numHeadersAndPlaceholders = getHeadersCount() * mNumColumns; if (position < numHeadersAndPlaceholders) { return position % mNumColumns == 0 && mHeaderViewInfos.get(position / mNumColumns).isSelectable; } // Adapter final int adjPosition = position - numHeadersAndPlaceholders; int adapterCount = 0; if (mAdapter != null) { adapterCount = getAdapterAndPlaceHolderCount(); if (adjPosition < adapterCount) { return adjPosition < mAdapter.getCount() && mAdapter.isEnabled(adjPosition); } } // Footer (off-limits positions will throw an IndexOutOfBoundsException) final int footerPosition = adjPosition - adapterCount; return footerPosition % mNumColumns == 0 && mFooterViewInfos.get(footerPosition / mNumColumns).isSelectable; }
/** * {@inheritDoc} */ @Override public void addTouchables(ArrayList<View> views) { final int count = getChildCount(); final int firstPosition = mFirstPosition; final ListAdapter adapter = mAdapter; if (adapter == null) { return; } for (int i = 0; i < count; i++) { final View child = getChildAt(i); if (adapter.isEnabled(firstPosition + i)) { views.add(child); } child.addTouchables(views); } }
@Override public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) { boolean populated = super.dispatchPopulateAccessibilityEvent(event); // If the item count is less than 15 then subtract disabled items from the count and // position. Otherwise ignore disabled items. if (!populated) { int itemCount = 0; int currentItemIndex = getSelectedItemPosition(); ListAdapter adapter = getAdapter(); if (adapter != null) { final int count = adapter.getCount(); if (count < 15) { for (int i = 0; i < count; i++) { if (adapter.isEnabled(i)) { itemCount++; } else if (i <= currentItemIndex) { currentItemIndex--; } } } else { itemCount = count; } } event.setItemCount(itemCount); event.setCurrentItemIndex(currentItemIndex); } return populated; }
private boolean performPinnedItemClick() { if (mPinnedSection == null) return false; OnItemClickListener listener = getOnItemClickListener(); if (listener != null && getAdapter().isEnabled(mPinnedSection.position)) { View view = mPinnedSection.view; playSoundEffect(SoundEffectConstants.CLICK); if (view != null) { view.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED); } listener.onItemClick(this, view, mPinnedSection.position, mPinnedSection.id); return true; } return false; }
(bottom < listBottom && !(drawOverscrollFooter && i == count - 1))) { if ((areAllItemsSelectable || (adapter.isEnabled(first + i) && (i == count - 1 || adapter.isEnabled(first + i + 1))))) { bounds.top = bottom; bounds.bottom = bottom + dividerHeight; (adapter.isEnabled(first + i) && (i == count - 1 || adapter.isEnabled(first + i + 1))))) { bounds.top = top - dividerHeight; bounds.bottom = top;
@Override public boolean isEnabled(int position) { return mAdapter.isEnabled(position); }
if (!adapter.isEnabled(firstPosition + i)) { continue;
if (!mDataChanged) { if ((mTouchMode != TOUCH_MODE_FLING) && (motionPosition >= 0) && (getAdapter().isEnabled(motionPosition))) { if (!mDataChanged && mAdapter.isEnabled(motionPosition)) { mTouchMode = TOUCH_MODE_TAP; layoutChildren(); } else if (!mDataChanged && mAdapter.isEnabled(motionPosition)) { post(performClick);
private void updateItems() { LinearLayout layout = getLinearLayout(); layout.removeAllViews(); int adapterCount = mAdapter.getCount(); for (int i = 0; i < adapterCount; i += 1) { View view = mAdapter.getView(i, null, layout); layout.addView(view); if (mAdapter.isEnabled(i)) view.setOnClickListener(mClickListener); } }
return originalAdapter.isEnabled(position);
/** * If the wrapped SpinnerAdapter is also a ListAdapter, delegate this call. * Otherwise, return true. */ public boolean isEnabled(int position) { final ListAdapter adapter = mListAdapter; if (adapter != null) { return adapter.isEnabled(position); } else { return true; } }
/** * If the wrapped SpinnerAdapter is also a ListAdapter, delegate this call. * Otherwise, return true. */ public boolean isEnabled(int position) { final ListAdapter adapter = mListAdapter; if (adapter != null) { return adapter.isEnabled(position); } else { return true; } }
@Override public boolean isEnabled(int position) { return mAdapter.isEnabled(position); }
public boolean isEnabled(int position) { // Adapter final int adjPosition = position; int adapterCount = 0; if (mAdapter != null) { adapterCount = mAdapter.getCount(); if (adjPosition < adapterCount) { return mAdapter.isEnabled(adjPosition); } } // Footer (off-limits positions will throw an IndexOutOfBoundsException) return mFooterViewInfos.get(adjPosition - adapterCount).isSelectable; }