ItemInfo infoForAnyChild(View child) { ViewParent parent; while ((parent = child.getParent()) != this) { if (parent == null || !(parent instanceof View)) { return null; } child = (View) parent; } return infoForChild(child); }
View child = getChildAt(i); if (child.getVisibility() == VISIBLE) { ItemInfo ii = infoForChild(child); if (ii != null && ii.position == currentItem) { if (child.requestFocus(direction, previouslyFocusedRect)) {
/** * We only want the current page that is being shown to be touchable. */ @Override public void addTouchables(@NonNull ArrayList<View> views) { // Note that we don't call super.addTouchables(). // This is okay because a Pager is itself not touchable. for (int i = 0; i < getChildCount(); i++) { final View child = getChildAt(i); if (child.getVisibility() == VISIBLE) { ItemInfo ii = infoForChild(child); if (ii != null && ii.position == currentItem) { child.addTouchables(views); } } } }
if ((ii = infoForChild(child)) != null) { final int loff = (int) (childWidth * ii.offset); final int childLeft = paddingLeft + loff;
final View child = getChildAt(i); if (child.getVisibility() == VISIBLE) { ItemInfo ii = infoForChild(child); if (ii != null && ii.position == currentItem) { child.addFocusables(views, direction, focusableMode);
/** * Check if child needs focus. * * @param focusDirection focusDirection */ private void checkFocus(int focusDirection) { if (hasFocus()) { View currentFocused = findFocus(); ItemInfo ii = currentFocused != null ? infoForAnyChild(currentFocused) : null; if (ii == null || ii.position != currentItem) { for (int i = 0; i < getChildCount(); i++) { View child = getChildAt(i); ii = infoForChild(child); if (ii != null && ii.position == currentItem) { if (child.requestFocus(focusDirection)) { break; } } } } } }
if (lp.widthFactor == 0.f) { final ItemInfo ii = infoForChild(child); if (ii != null) { lp.widthFactor = ii.widthFactor;