Example usage for android.widget TextView isEnabled

List of usage examples for android.widget TextView isEnabled

Introduction

In this page you can find the example usage for android.widget TextView isEnabled.

Prototype

@ViewDebug.ExportedProperty
public boolean isEnabled() 

Source Link

Document

Returns the enabled status for this view.

Usage

From source file:Main.java

/**
 * Returns the enabled state a {@link TextView}.
 *
 * @param textview   text view instance//from ww w  . j  av a  2  s . c  o  m
 * @return  {@code true} for enabled, {@code false} disabled
 */
public static boolean isEnabled(TextView textview) {
    return textview.isEnabled();
}

From source file:org.mozilla.gecko.tests.BaseTest.java

/**
 * Wait for <text> to be visible and also be enabled/clickable.
 *///  w  ww . ja v a  2  s  .  co  m
public boolean waitForEnabledText(String text) {
    final String testText = text;
    boolean rc = waitForCondition(new Condition() {
        @Override
        public boolean isSatisfied() {
            // Solo.getText() could be used here, except that it sometimes
            // hits an assertion when the requested text is not found.
            ArrayList<View> views = mSolo.getCurrentViews();
            for (View view : views) {
                if (view instanceof TextView) {
                    TextView tv = (TextView) view;
                    String viewText = tv.getText().toString();
                    if (tv.isEnabled() && viewText != null && viewText.matches(testText)) {
                        return true;
                    }
                }
            }
            return false;
        }
    }, MAX_WAIT_ENABLED_TEXT_MS);
    if (!rc) {
        // log out failed wait for diagnostic purposes only;
        // failures are sometimes expected/normal
        mAsserter.dumpLog("waitForEnabledText timeout on " + text);
    }
    return rc;
}