本文整理汇总了Java中android.view.View.AUTOFILL_TYPE_LIST属性的典型用法代码示例。如果您正苦于以下问题:Java View.AUTOFILL_TYPE_LIST属性的具体用法?Java View.AUTOFILL_TYPE_LIST怎么用?Java View.AUTOFILL_TYPE_LIST使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.view.View
的用法示例。
在下文中一共展示了View.AUTOFILL_TYPE_LIST属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTypeAsString
public static String getTypeAsString(int type) {
switch (type) {
case View.AUTOFILL_TYPE_TEXT:
return "TYPE_TEXT";
case View.AUTOFILL_TYPE_LIST:
return "TYPE_LIST";
case View.AUTOFILL_TYPE_NONE:
return "TYPE_NONE";
case View.AUTOFILL_TYPE_TOGGLE:
return "TYPE_TOGGLE";
case View.AUTOFILL_TYPE_DATE:
return "TYPE_DATE";
}
return "UNKNOWN_TYPE";
}
示例2: getAutofillTypeAsString
public static String getAutofillTypeAsString(int type) {
switch (type) {
case View.AUTOFILL_TYPE_TEXT:
return "TYPE_TEXT";
case View.AUTOFILL_TYPE_LIST:
return "TYPE_LIST";
case View.AUTOFILL_TYPE_NONE:
return "TYPE_NONE";
case View.AUTOFILL_TYPE_TOGGLE:
return "TYPE_TOGGLE";
case View.AUTOFILL_TYPE_DATE:
return "TYPE_DATE";
}
return "UNKNOWN_TYPE";
}
示例3: applyToFields
/**
* Populates a {@link Dataset.Builder} with appropriate values for each {@link AutofillId}
* in a {@code AutofillFieldMetadataCollection}.
* <p>
* In other words, it constructs an autofill
* {@link Dataset.Builder} by applying saved values (from this {@code FilledAutofillFieldCollection})
* to Views specified in a {@code AutofillFieldMetadataCollection}, which represents the current
* page the user is on.
*/
public boolean applyToFields(AutofillFieldMetadataCollection autofillFieldMetadataCollection,
Dataset.Builder datasetBuilder) {
boolean setValueAtLeastOnce = false;
List<String> allHints = autofillFieldMetadataCollection.getAllHints();
for (int hintIndex = 0; hintIndex < allHints.size(); hintIndex++) {
String hint = allHints.get(hintIndex);
List<AutofillFieldMetadata> fillableAutofillFields =
autofillFieldMetadataCollection.getFieldsForHint(hint);
if (fillableAutofillFields == null) {
continue;
}
for (int autofillFieldIndex = 0; autofillFieldIndex < fillableAutofillFields.size(); autofillFieldIndex++) {
FilledAutofillField filledAutofillField = mHintMap.get(hint);
if (filledAutofillField == null) {
continue;
}
AutofillFieldMetadata autofillFieldMetadata = fillableAutofillFields.get(autofillFieldIndex);
AutofillId autofillId = autofillFieldMetadata.getId();
int autofillType = autofillFieldMetadata.getAutofillType();
switch (autofillType) {
case View.AUTOFILL_TYPE_LIST:
int listValue = autofillFieldMetadata.getAutofillOptionIndex(filledAutofillField.getTextValue());
if (listValue != -1) {
datasetBuilder.setValue(autofillId, AutofillValue.forList(listValue));
setValueAtLeastOnce = true;
}
break;
case View.AUTOFILL_TYPE_DATE:
Long dateValue = filledAutofillField.getDateValue();
if (dateValue != null) {
datasetBuilder.setValue(autofillId, AutofillValue.forDate(dateValue));
setValueAtLeastOnce = true;
}
break;
case View.AUTOFILL_TYPE_TEXT:
String textValue = filledAutofillField.getTextValue();
if (textValue != null) {
datasetBuilder.setValue(autofillId, AutofillValue.forText(textValue));
setValueAtLeastOnce = true;
}
break;
case View.AUTOFILL_TYPE_TOGGLE:
Boolean toggleValue = filledAutofillField.getToggleValue();
if (toggleValue != null) {
datasetBuilder.setValue(autofillId, AutofillValue.forToggle(toggleValue));
setValueAtLeastOnce = true;
}
break;
case View.AUTOFILL_TYPE_NONE:
default:
logw("Invalid autofill type - %d", autofillType);
break;
}
}
}
return setValueAtLeastOnce;
}