android.widget.ListAdapter.isEnabled()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(198)

本文整理了Java中android.widget.ListAdapter.isEnabled()方法的一些代码示例,展示了ListAdapter.isEnabled()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ListAdapter.isEnabled()方法的具体详情如下:
包路径:android.widget.ListAdapter
类名称:ListAdapter
方法名:isEnabled

ListAdapter.isEnabled介绍

暂无

代码示例

代码示例来源:origin: rey5137/material

/**
 * 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);
}

代码示例来源:origin: chentao0707/SimplifyReader

@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;
}

代码示例来源:origin: chentao0707/SimplifyReader

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;
}

代码示例来源:origin: chentao0707/SimplifyReader

if (lookDown) {
  position = Math.max(0, position);
  while (position < count && !adapter.isEnabled(position)) {
    position++;
  while (position >= 0 && !adapter.isEnabled(position)) {
    position--;

代码示例来源:origin: ksoichiro/Android-ObservableScrollView

@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;
}

代码示例来源:origin: liaohuqiu/android-GridViewWithHeaderAndFooter

@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;
}

代码示例来源:origin: rey5137/material

if (lookDown) {
  position = Math.max(0, position);
  while (position < count && !adapter.isEnabled(position)) {
    position++;
  while (position >= 0 && !adapter.isEnabled(position)) {
    position--;

代码示例来源:origin: chentao0707/SimplifyReader

/**
 * {@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);
  }
}

代码示例来源:origin: chentao0707/SimplifyReader

@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;
}

代码示例来源:origin: beworker/pinned-section-listview

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;
}

代码示例来源:origin: chentao0707/SimplifyReader

(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;

代码示例来源:origin: UweTrottmann/SeriesGuide

@Override
public boolean isEnabled(int position) {
  return mAdapter.isEnabled(position);
}

代码示例来源:origin: chentao0707/SimplifyReader

if (!adapter.isEnabled(firstPosition + i)) {
  continue;

代码示例来源:origin: chentao0707/SimplifyReader

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);

代码示例来源:origin: Neamar/KISS

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);
  }
}

代码示例来源:origin: stackoverflow.com

return originalAdapter.isEnabled(position);

代码示例来源:origin: com.actionbarsherlock/actionbarsherlock

/**
 * 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;
  }
}

代码示例来源:origin: com.willowtreeapps/oak-demos

/**
 * 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;
  }
}

代码示例来源:origin: vanilla-music/vanilla

@Override
public boolean isEnabled(int position) {
  return mAdapter.isEnabled(position);
}

代码示例来源:origin: fire3/sailorcast

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;
}

相关文章