当前位置: 首页>>代码示例>>Java>>正文


Java View.AUTOFILL_TYPE_LIST属性代码示例

本文整理汇总了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";
}
 
开发者ID:googlesamples,项目名称:android-AutofillFramework,代码行数:15,代码来源:Util.java

示例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";
}
 
开发者ID:googlesamples,项目名称:android-AutofillFramework,代码行数:15,代码来源:Util.java

示例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;
}
 
开发者ID:googlesamples,项目名称:android-AutofillFramework,代码行数:66,代码来源:FilledAutofillFieldCollection.java


注:本文中的android.view.View.AUTOFILL_TYPE_LIST属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。