Example usage for android.view View addFocusables

List of usage examples for android.view View addFocusables

Introduction

In this page you can find the example usage for android.view View addFocusables.

Prototype

public void addFocusables(ArrayList<View> views, @FocusDirection int direction) 

Source Link

Document

Add any focusable views that are descendants of this view (possibly including this view if it is focusable itself) to views.

Usage

From source file:com.aviary.android.feather.sdk.widget.AviaryWorkspace.java

@Override
public void addFocusables(ArrayList<View> views, int direction, int focusableMode) {

    if (isEnabled()) {
        View child = getChildAt(mCurrentScreen);
        if (null != child) {
            child.addFocusables(views, direction);
        }/*w ww .  j  av  a 2 s. co  m*/

        if (direction == View.FOCUS_LEFT) {
            if (mCurrentScreen > 0) {
                child = getChildAt(mCurrentScreen - 1);
                if (null != child) {
                    child.addFocusables(views, direction);
                }
            }
        } else if (direction == View.FOCUS_RIGHT) {
            if (mCurrentScreen < mItemCount - 1) {
                child = getChildAt(mCurrentScreen + 1);
                if (null != child) {
                    child.addFocusables(views, direction);
                }
            }
        }
    }
}