Java Code Examples for android.view.autofill.AutofillValue#isList()

The following examples show how to use android.view.autofill.AutofillValue#isList() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RadioGroup.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
public void autofill(AutofillValue value) {
    if (!isEnabled()) return;

    if (!value.isList()) {
        Log.w(LOG_TAG, value + " could not be autofilled into " + this);
        return;
    }

    final int index = value.getListValue();
    final View child = getChildAt(index);
    if (child == null) {
        Log.w(VIEW_LOG_TAG, "RadioGroup.autoFill(): no child with index " + index);
        return;
    }

    check(child.getId());
}
 
Example 2
Source File: NestedConstraintRadioGroup.java    From NestedRadioButton with Apache License 2.0 6 votes vote down vote up
@TargetApi(Build.VERSION_CODES.O)
@Override
public void autofill(AutofillValue value) {
    if (!isEnabled()) return;

    if (!value.isList()) {
        Log.w(LOG_TAG, value + " could not be autofilled into " + this);
        return;
    }

    final int index = value.getListValue();
    final View child = getChildAt(index);
    if (child == null) {
        Log.w(VIEW_LOG_TAG, "RadioGroup.autoFill(): no child with index " + index);
        return;
    }

    nestedRadioGroupManager.check(child.getId());
}
 
Example 3
Source File: NestedRelativeRadioGroup.java    From NestedRadioButton with Apache License 2.0 6 votes vote down vote up
@TargetApi(Build.VERSION_CODES.O)
@Override
public void autofill(AutofillValue value) {
    if (!isEnabled()) return;

    if (!value.isList()) {
        Log.w(LOG_TAG, value + " could not be autofilled into " + this);
        return;
    }

    final int index = value.getListValue();
    final View child = getChildAt(index);
    if (child == null) {
        Log.w(VIEW_LOG_TAG, "RadioGroup.autoFill(): no child with index " + index);
        return;
    }

    nestedRadioGroupManager.check(child.getId());
}
 
Example 4
Source File: NestedLinearRadioGroup.java    From NestedRadioButton with Apache License 2.0 6 votes vote down vote up
@TargetApi(Build.VERSION_CODES.O)
@Override
public void autofill(AutofillValue value) {
    if (!isEnabled()) return;

    if (!value.isList()) {
        Log.w(LOG_TAG, value + " could not be autofilled into " + this);
        return;
    }

    final int index = value.getListValue();
    final View child = getChildAt(index);
    if (child == null) {
        Log.w(VIEW_LOG_TAG, "RadioGroup.autoFill(): no child with index " + index);
        return;
    }

    nestedRadioGroupManager.check(child.getId());
}
 
Example 5
Source File: NestedFrameRadioGroup.java    From NestedRadioButton with Apache License 2.0 6 votes vote down vote up
@TargetApi(Build.VERSION_CODES.O)
@Override
public void autofill(AutofillValue value) {
    if (!isEnabled()) return;

    if (!value.isList()) {
        Log.w(LOG_TAG, value + " could not be autofilled into " + this);
        return;
    }

    final int index = value.getListValue();
    final View child = getChildAt(index);
    if (child == null) {
        Log.w(VIEW_LOG_TAG, "RadioGroup.autoFill(): no child with index " + index);
        return;
    }

    nestedRadioGroupManager.check(child.getId());
}
 
Example 6
Source File: ClientAutofillDataBuilder.java    From input-samples with Apache License 2.0 5 votes vote down vote up
private void parseAutofillFields(AssistStructure.ViewNode viewNode,
        DatasetWithFilledAutofillFields datasetWithFilledAutofillFields, int partition) {
    String[] hints = viewNode.getAutofillHints();
    if (hints == null || hints.length == 0) {
        return;
    }
    AutofillValue autofillValue = viewNode.getAutofillValue();
    String textValue = null;
    Long dateValue = null;
    Boolean toggleValue = null;
    CharSequence[] autofillOptions = null;
    Integer listIndex = null;
    if (autofillValue != null) {
        if (autofillValue.isText()) {
            // Using toString of AutofillValue.getTextValue in order to save it to
            // SharedPreferences.
            textValue = autofillValue.getTextValue().toString();
        } else if (autofillValue.isDate()) {
            dateValue = autofillValue.getDateValue();
        } else if (autofillValue.isList()) {
            autofillOptions = viewNode.getAutofillOptions();
            listIndex = autofillValue.getListValue();
        } else if (autofillValue.isToggle()) {
            toggleValue = autofillValue.getToggleValue();
        }
    }
    appendViewMetadata(datasetWithFilledAutofillFields,
            hints, partition, textValue, dateValue, toggleValue,
            autofillOptions, listIndex);
}
 
Example 7
Source File: Util.java    From input-samples with Apache License 2.0 5 votes vote down vote up
private static String getAutofillValueAndTypeAsString(AutofillValue value) {
    if (value == null) return "null";

    StringBuilder builder = new StringBuilder(value.toString()).append('(');
    if (value.isText()) {
        builder.append("isText");
    } else if (value.isDate()) {
        builder.append("isDate");
    } else if (value.isToggle()) {
        builder.append("isToggle");
    } else if (value.isList()) {
        builder.append("isList");
    }
    return builder.append(')').toString();
}
 
Example 8
Source File: Util.java    From input-samples with Apache License 2.0 5 votes vote down vote up
private static String getAutofillValueAndTypeAsString(AutofillValue value) {
    if (value == null) return "null";

    StringBuilder builder = new StringBuilder(value.toString()).append('(');
    if (value.isText()) {
        builder.append("isText");
    } else if (value.isDate()) {
        builder.append("isDate");
    } else if (value.isToggle()) {
        builder.append("isToggle");
    } else if (value.isList()) {
        builder.append("isList");
    }
    return builder.append(')').toString();
}
 
Example 9
Source File: AbsSpinner.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public void autofill(AutofillValue value) {
    if (!isEnabled()) return;

    if (!value.isList()) {
        Log.w(LOG_TAG, value + " could not be autofilled into " + this);
        return;
    }

    setSelection(value.getListValue());
}
 
Example 10
Source File: ClientAutofillDataBuilder.java    From android-AutofillFramework with Apache License 2.0 5 votes vote down vote up
private void parseAutofillFields(AssistStructure.ViewNode viewNode,
        DatasetWithFilledAutofillFields datasetWithFilledAutofillFields, int partition) {
    String[] hints = viewNode.getAutofillHints();
    if (hints == null || hints.length == 0) {
        return;
    }
    AutofillValue autofillValue = viewNode.getAutofillValue();
    String textValue = null;
    Long dateValue = null;
    Boolean toggleValue = null;
    CharSequence[] autofillOptions = null;
    Integer listIndex = null;
    if (autofillValue != null) {
        if (autofillValue.isText()) {
            // Using toString of AutofillValue.getTextValue in order to save it to
            // SharedPreferences.
            textValue = autofillValue.getTextValue().toString();
        } else if (autofillValue.isDate()) {
            dateValue = autofillValue.getDateValue();
        } else if (autofillValue.isList()) {
            autofillOptions = viewNode.getAutofillOptions();
            listIndex = autofillValue.getListValue();
        } else if (autofillValue.isToggle()) {
            toggleValue = autofillValue.getToggleValue();
        }
    }
    appendViewMetadata(datasetWithFilledAutofillFields,
            hints, partition, textValue, dateValue, toggleValue,
            autofillOptions, listIndex);
}
 
Example 11
Source File: Util.java    From android-AutofillFramework with Apache License 2.0 5 votes vote down vote up
private static String getAutofillValueAndTypeAsString(AutofillValue value) {
    if (value == null) return "null";

    StringBuilder builder = new StringBuilder(value.toString()).append('(');
    if (value.isText()) {
        builder.append("isText");
    } else if (value.isDate()) {
        builder.append("isDate");
    } else if (value.isToggle()) {
        builder.append("isToggle");
    } else if (value.isList()) {
        builder.append("isList");
    }
    return builder.append(')').toString();
}
 
Example 12
Source File: Util.java    From android-AutofillFramework with Apache License 2.0 5 votes vote down vote up
private static String getAutofillValueAndTypeAsString(AutofillValue value) {
    if (value == null) return "null";

    StringBuilder builder = new StringBuilder(value.toString()).append('(');
    if (value.isText()) {
        builder.append("isText");
    } else if (value.isDate()) {
        builder.append("isDate");
    } else if (value.isToggle()) {
        builder.append("isToggle");
    } else if (value.isList()) {
        builder.append("isList");
    }
    return builder.append(')').toString();
}