/** Sets the view to show if the adapter is empty */ public void setEmptyView(View emptyView) { mEmptyView = emptyView; final T adapter = getAdapter(); final boolean empty = ((adapter == null) || adapter.isEmpty()); updateEmptyStatus(empty); }
public static <E, T extends Collection<E>> T notEmpty(final T argument, final String name) { if (argument == null) { throw new IllegalArgumentException(name + " may not be null"); } if (argument.isEmpty()) { throw new IllegalArgumentException(name + " may not be empty"); } return argument; }
public static <E, T extends Collection<E>> T notEmpty(T t, String str) { if (t == null) { throw new IllegalArgumentException(str + " may not be null"); } else if (!t.isEmpty()) { return t; } else { throw new IllegalArgumentException(str + " may not be empty"); } }
void checkFocus() { final T adapter = getAdapter(); final boolean empty = adapter == null || adapter.getCount() == 0; final boolean focusable = !empty || isInFilterMode(); super.setFocusableInTouchMode(focusable && mDesiredFocusableInTouchModeState); super.setFocusable(focusable && mDesiredFocusableState); if (mEmptyView != null) { updateEmptyStatus(adapter == null || adapter.isEmpty()); } }
@SuppressLint("NewApi") public void setEmptyView(View emptyView) { mEmptyView = emptyView; if (VERSION.SDK_INT >= 16 && emptyView != null && emptyView.getImportantForAccessibility() == IMPORTANT_FOR_ACCESSIBILITY_AUTO) { emptyView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES); } final T adapter = getAdapter(); final boolean empty = adapter == null || adapter.isEmpty(); updateEmptyStatus(empty); }
void checkFocus() { final T adapter = getAdapter(); final boolean empty = adapter == null || adapter.getCount() == 0; final boolean focusable = !empty || isInFilterMode(); // The order in which we set focusable in touch mode/focusable may matter // for the client, see View.setFocusableInTouchMode() comments for more // details super.setFocusableInTouchMode(focusable && mDesiredFocusableInTouchModeState); super.setFocusable(focusable && mDesiredFocusableState); if (mEmptyView != null) { updateEmptyStatus((adapter == null) || adapter.isEmpty()); } }
protected void assertSize(final int size, final T queue) { assertEquals("size()", size, queue.size()); assert queue.size() == size : "Expected size() " + size + ", found " + queue.size(); assert (size == 0) == queue.isEmpty() : "Expected isEmpty() " + (size == 0) + ", found " + queue.isEmpty(); }