當前位置: 首頁>>代碼示例>>Java>>正文


Java ListAdapter.isEnabled方法代碼示例

本文整理匯總了Java中android.widget.ListAdapter.isEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java ListAdapter.isEnabled方法的具體用法?Java ListAdapter.isEnabled怎麽用?Java ListAdapter.isEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.ListAdapter的用法示例。


在下文中一共展示了ListAdapter.isEnabled方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: isEnabled

import android.widget.ListAdapter; //導入方法依賴的package包/類
/**
 * Returns true if the item at the specified position is
 * not a separator.
 *
 * @param position Position of the item whose data we want
 */
@Override
public boolean isEnabled(int position)
{
	for (ListAdapter piece : pieces)
	{
		int size = piece.getCount();

		if (position < size)
		{
			return (piece.isEnabled(position));
		}

		position -= size;
	}

	return (false);
}
 
開發者ID:ultrasonic,項目名稱:ultrasonic,代碼行數:24,代碼來源:MergeAdapter.java

示例2: addTouchables

import android.widget.ListAdapter; //導入方法依賴的package包/類
/**
 * {@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);
    }
}
 
開發者ID:Shmilyz,項目名稱:Swap,代碼行數:22,代碼來源:PLA_AbsListView.java

示例3: addTouchables

import android.widget.ListAdapter; //導入方法依賴的package包/類
/**
 * {@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);
	}
}
 
開發者ID:junchenChow,項目名稱:exciting-app,代碼行數:22,代碼來源:AbsHListView.java

示例4: dispatchPopulateAccessibilityEvent

import android.widget.ListAdapter; //導入方法依賴的package包/類
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
    boolean populated = super.dispatchPopulateAccessibilityEvent(event);
    if (!populated) {
        int itemCount = 0;
        int currentItemIndex = getSelectedItemPosition();
        ListAdapter adapter = getAdapter();
        if (adapter != null) {
            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;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:26,代碼來源:PLA_ListView.java

示例5: isEnabled

import android.widget.ListAdapter; //導入方法依賴的package包/類
/**
 * 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;
    }
}
 
開發者ID:treasure-lau,項目名稱:CSipSimple,代碼行數:13,代碼來源:IcsSpinner.java

示例6: lookForSelectablePosition

import android.widget.ListAdapter; //導入方法依賴的package包/類
protected int lookForSelectablePosition(int position, boolean lookDown) {
    ListAdapter adapter = this.mAdapter;
    if (adapter == null || isInTouchMode()) {
        return -1;
    }
    int count = adapter.getCount();
    if (!this.mAreAllItemsSelectable) {
        if (lookDown) {
            position = Math.max(0, position);
            while (position < count && !adapter.isEnabled(position)) {
                position++;
            }
        } else {
            position = Math.min(position, count - 1);
            while (position >= 0 && !adapter.isEnabled(position)) {
                position--;
            }
        }
        if (position < 0 || position >= count) {
            return -1;
        }
        return position;
    } else if (position < 0 || position >= count) {
        return -1;
    } else {
        return position;
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:29,代碼來源:HListView.java

示例7: onFocusChanged

import android.widget.ListAdapter; //導入方法依賴的package包/類
protected void onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect) {
    super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);
    ListAdapter adapter = this.mAdapter;
    int closetChildIndex = -1;
    int closestChildLeft = 0;
    if (!(adapter == null || !gainFocus || previouslyFocusedRect == null)) {
        previouslyFocusedRect.offset(getScrollX(), getScrollY());
        if (adapter.getCount() < getChildCount() + this.mFirstPosition) {
            this.mLayoutMode = 0;
            layoutChildren();
        }
        Rect otherRect = this.mTempRect;
        int minDistance = Integer.MAX_VALUE;
        int childCount = getChildCount();
        int firstPosition = this.mFirstPosition;
        for (int i = 0; i < childCount; i++) {
            if (adapter.isEnabled(firstPosition + i)) {
                View other = getChildAt(i);
                other.getDrawingRect(otherRect);
                offsetDescendantRectToMyCoords(other, otherRect);
                int distance = AbsHListView.getDistance(previouslyFocusedRect, otherRect, direction);
                if (distance < minDistance) {
                    minDistance = distance;
                    closetChildIndex = i;
                    closestChildLeft = other.getLeft();
                }
            }
        }
    }
    if (closetChildIndex >= 0) {
        setSelectionFromLeft(this.mFirstPosition + closetChildIndex, closestChildLeft);
    } else {
        requestLayout();
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:36,代碼來源:HListView.java

示例8: lookForSelectablePosition

import android.widget.ListAdapter; //導入方法依賴的package包/類
/**
 * Find a position that can be selected (i.e., is not a separator).
 * 
 * @param position
 *            The starting position to look at.
 * @param lookDown
 *            Whether to look down for other positions.
 * @return The next selectable position starting at position and then
 *         searching either up or down. Returns {@link #INVALID_POSITION} if
 *         nothing can be found.
 */
@Override
protected int lookForSelectablePosition(int position, boolean lookDown) {
	final ListAdapter adapter = mAdapter;
	if (adapter == null || isInTouchMode()) {
		return INVALID_POSITION;
	}

	final int count = adapter.getCount();
	if (!mAreAllItemsSelectable) {
		if (lookDown) {
			position = Math.max(0, position);
			while (position < count && !adapter.isEnabled(position)) {
				position++;
			}
		} else {
			position = Math.min(position, count - 1);
			while (position >= 0 && !adapter.isEnabled(position)) {
				position--;
			}
		}

		if (position < 0 || position >= count) {
			return INVALID_POSITION;
		}
		return position;
	} else {
		if (position < 0 || position >= count) {
			return INVALID_POSITION;
		}
		return position;
	}
}
 
開發者ID:junchenChow,項目名稱:exciting-app,代碼行數:44,代碼來源:HListView.java

示例9: onInitializeAccessibilityNodeInfo

import android.widget.ListAdapter; //導入方法依賴的package包/類
@Override
public void onInitializeAccessibilityNodeInfo(View host,
		AccessibilityNodeInfoCompat info) {
	super.onInitializeAccessibilityNodeInfo(host, info);

	final int position = getPositionForView(host);
	final ListAdapter adapter = getAdapter();

	if ((position == INVALID_POSITION) || (adapter == null)) {
		return;
	}

	if (!isEnabled() || !adapter.isEnabled(position)) {
		return;
	}

	if (position == getSelectedItemPosition()) {
		info.setSelected(true);
		info.addAction(AccessibilityNodeInfoCompat.ACTION_CLEAR_SELECTION);
	} else {
		info.addAction(AccessibilityNodeInfoCompat.ACTION_SELECT);
	}

	if (isClickable()) {
		info.addAction(AccessibilityNodeInfoCompat.ACTION_CLICK);
		info.setClickable(true);
	}

	if (isLongClickable()) {
		info.addAction(AccessibilityNodeInfoCompat.ACTION_LONG_CLICK);
		info.setLongClickable(true);
	}

}
 
開發者ID:junchenChow,項目名稱:exciting-app,代碼行數:35,代碼來源:AbsHListView.java

示例10: dispatchPopulateAccessibilityEvent

import android.widget.ListAdapter; //導入方法依賴的package包/類
@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;
}
 
開發者ID:Shmilyz,項目名稱:Swap,代碼行數:33,代碼來源:PLA_ListView.java

示例11: lookForSelectablePosition

import android.widget.ListAdapter; //導入方法依賴的package包/類
int lookForSelectablePosition(int position, boolean lookDown) {
    ListAdapter adapter = this.mAdapter;
    if (adapter == null || isInTouchMode()) {
        return -1;
    }
    int count = adapter.getCount();
    if (!this.mAreAllItemsSelectable) {
        if (lookDown) {
            position = Math.max(0, position);
            while (position < count && !adapter.isEnabled(position)) {
                position++;
            }
        } else {
            position = Math.min(position, count - 1);
            while (position >= 0 && !adapter.isEnabled(position)) {
                position--;
            }
        }
        if (position < 0 || position >= count) {
            return -1;
        }
        return position;
    } else if (position < 0 || position >= count) {
        return -1;
    } else {
        return position;
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:29,代碼來源:PLA_ListView.java

示例12: onFocusChanged

import android.widget.ListAdapter; //導入方法依賴的package包/類
protected void onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect) {
    super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);
    int closetChildIndex = -1;
    if (gainFocus && previouslyFocusedRect != null) {
        previouslyFocusedRect.offset(getScrollX(), getScrollY());
        ListAdapter adapter = this.mAdapter;
        if (adapter.getCount() < getChildCount() + this.mFirstPosition) {
            this.mLayoutMode = 0;
            layoutChildren();
        }
        Rect otherRect = this.mTempRect;
        int minDistance = ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_UNLIMITED;
        int childCount = getChildCount();
        int firstPosition = this.mFirstPosition;
        for (int i = 0; i < childCount; i++) {
            if (adapter.isEnabled(firstPosition + i)) {
                View other = getChildAt(i);
                other.getDrawingRect(otherRect);
                offsetDescendantRectToMyCoords(other, otherRect);
                int distance = PLA_AbsListView.getDistance(previouslyFocusedRect, otherRect,
                        direction);
                if (distance < minDistance) {
                    minDistance = distance;
                    closetChildIndex = i;
                }
            }
        }
    }
    if (closetChildIndex >= 0) {
        setSelection(this.mFirstPosition + closetChildIndex);
    } else {
        requestLayout();
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:35,代碼來源:PLA_ListView.java

示例13: addTouchables

import android.widget.ListAdapter; //導入方法依賴的package包/類
public void addTouchables(ArrayList<View> views) {
    int count = getChildCount();
    int firstPosition = this.mFirstPosition;
    ListAdapter adapter = this.mAdapter;
    if (adapter != null) {
        for (int i = 0; i < count; i++) {
            View child = getChildAt(i);
            if (adapter.isEnabled(firstPosition + i)) {
                views.add(child);
            }
            child.addTouchables(views);
        }
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:15,代碼來源:PLA_AbsListView.java

示例14: lookForSelectablePosition

import android.widget.ListAdapter; //導入方法依賴的package包/類
private int lookForSelectablePosition(int position, boolean lookDown) {
    ListAdapter adapter = this.mAdapter;
    if (adapter == null || isInTouchMode()) {
        return -1;
    }
    int count = adapter.getCount();
    if (!adapter.areAllItemsEnabled()) {
        if (lookDown) {
            position = Math.max(0, position);
            while (position < count && !adapter.isEnabled(position)) {
                position++;
            }
        } else {
            position = Math.min(position, count - 1);
            while (position >= 0 && !adapter.isEnabled(position)) {
                position--;
            }
        }
        if (position < 0 || position >= count) {
            return -1;
        }
        return position;
    } else if (position < 0 || position >= count) {
        return -1;
    } else {
        return position;
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:29,代碼來源:HorizontalListViewPosition.java

示例15: isEnabled

import android.widget.ListAdapter; //導入方法依賴的package包/類
public boolean isEnabled(int position) {
    ListAdapter adapter = this.mListAdapter;
    if (adapter != null) {
        return adapter.isEnabled(position);
    }
    return true;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:8,代碼來源:AppCompatSpinner.java


注:本文中的android.widget.ListAdapter.isEnabled方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。