Example usage for android.view View setOnFocusChangeListener

List of usage examples for android.view View setOnFocusChangeListener

Introduction

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

Prototype

public void setOnFocusChangeListener(OnFocusChangeListener l) 

Source Link

Document

Register a callback to be invoked when focus of this view changed.

Usage

From source file:xyz.klinker.blur.launcher3.Workspace.java

public void addToCustomContentPage(View customContent, Launcher.CustomContentCallbacks callbacks,
        String description) {//w ww  . j  a va 2s  .c  om
    if (getPageIndexForScreenId(CUSTOM_CONTENT_SCREEN_ID) < 0) {
        throw new RuntimeException("Expected custom content screen to exist");
    }

    // Add the custom content to the full screen custom page
    CellLayout customScreen = getScreenWithId(CUSTOM_CONTENT_SCREEN_ID);
    int spanX = customScreen.getCountX();
    int spanY = customScreen.getCountY();
    CellLayout.LayoutParams lp = new CellLayout.LayoutParams(0, 0, spanX, spanY);
    lp.canReorder = false;
    lp.isFullscreen = true;
    if (customContent instanceof Insettable) {
        ((Insettable) customContent).setInsets(mInsets);
    }

    // Verify that the child is removed from any existing parent.
    if (customContent.getParent() instanceof ViewGroup) {
        ViewGroup parent = (ViewGroup) customContent.getParent();
        parent.removeView(customContent);
    }
    customScreen.removeAllViews();
    customContent.setFocusable(true);
    customContent.setOnKeyListener(new FullscreenKeyEventListener());
    customContent.setOnFocusChangeListener(mLauncher.mFocusHandler.getHideIndicatorOnFocusListener());
    customScreen.addViewToCellLayout(customContent, 0, 0, lp, true);
    mCustomContentDescription = description;

    mCustomContentCallbacks = callbacks;
}