Example usage for android.view View onCheckIsTextEditor

List of usage examples for android.view View onCheckIsTextEditor

Introduction

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

Prototype

public boolean onCheckIsTextEditor() 

Source Link

Document

Check whether the called view is a text editor, in which case it would make sense to automatically display a soft input window for it.

Usage

From source file:com.xander.panel.PanelController.java

/**
 *  view ??//from  w ww  .  j av  a 2  s .  c o  m
 *
 * @param v
 * @return
 */
static boolean canTextInput(View v) {
    if (v.onCheckIsTextEditor()) {
        return true;
    }
    if (!(v instanceof ViewGroup)) {
        return false;
    }

    ViewGroup vg = (ViewGroup) v;
    int i = vg.getChildCount();
    while (i > 0) {
        i--;
        v = vg.getChildAt(i);
        if (canTextInput(v)) {
            return true;
        }
    }
    return false;
}

From source file:android.support.v7.app.AlertController.java

static boolean canTextInput(View v) {
    if (v.onCheckIsTextEditor()) {
        return true;
    }//from  www.  ja  va 2 s  .c  o  m

    if (!(v instanceof ViewGroup)) {
        return false;
    }

    ViewGroup vg = (ViewGroup) v;
    int i = vg.getChildCount();
    while (i > 0) {
        i--;
        v = vg.getChildAt(i);
        if (canTextInput(v)) {
            return true;
        }
    }

    return false;
}