Java Code Examples for android.view.autofill.AutofillValue#isToggle()
The following examples show how to use
android.view.autofill.AutofillValue#isToggle() .
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: ClientAutofillDataBuilder.java From input-samples with Apache License 2.0 | 5 votes |
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 2
Source File: Util.java From input-samples with Apache License 2.0 | 5 votes |
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 3
Source File: Util.java From input-samples with Apache License 2.0 | 5 votes |
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 4
Source File: CompoundButton.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
@Override public void autofill(AutofillValue value) { if (!isEnabled()) return; if (!value.isToggle()) { Log.w(LOG_TAG, value + " could not be autofilled into " + this); return; } setChecked(value.getToggleValue()); }
Example 5
Source File: ClientAutofillDataBuilder.java From android-AutofillFramework with Apache License 2.0 | 5 votes |
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 6
Source File: Util.java From android-AutofillFramework with Apache License 2.0 | 5 votes |
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 7
Source File: Util.java From android-AutofillFramework with Apache License 2.0 | 5 votes |
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(); }