android.view.ViewStructure#setAutofillId ( )源码实例Demo

下面列出了android.view.ViewStructure#setAutofillId ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: input-samples   文件: CustomVirtualView.java
@Override
public void onProvideAutofillVirtualStructure(ViewStructure structure, int flags) {
    // Build a ViewStructure that will get passed to the AutofillService by the framework
    // when it is time to find autofill suggestions.
    structure.setClassName(getClass().getName());
    int childrenSize = mVirtualViews.size();
    if (DEBUG) {
        Log.d(TAG, "onProvideAutofillVirtualStructure(): flags = " + flags + ", items = "
                + childrenSize + ", extras: " + bundleToString(structure.getExtras()));
    }
    int index = structure.addChildCount(childrenSize);
    // Traverse through the view hierarchy, including virtual child views. For each view, we
    // need to set the relevant autofill metadata and add it to the ViewStructure.
    for (int i = 0; i < childrenSize; i++) {
        Item item = mVirtualViews.valueAt(i);
        if (DEBUG) {
            Log.d(TAG, "Adding new child at index " + index + ": " + item);
        }
        ViewStructure child = structure.newChild(index);
        child.setAutofillId(structure.getAutofillId(), item.id);
        child.setAutofillHints(item.hints);
        child.setAutofillType(item.type);
        child.setAutofillValue(item.getAutofillValue());
        child.setDataIsSensitive(!item.sanitized);
        child.setFocused(item.focused);
        child.setVisibility(View.VISIBLE);
        child.setDimens(item.line.mBounds.left, item.line.mBounds.top, 0, 0,
                item.line.mBounds.width(), item.line.mBounds.height());
        child.setId(item.id, getContext().getPackageName(), null, item.idEntry);
        child.setClassName(item.getClassName());
        child.setDimens(item.line.mBounds.left, item.line.mBounds.top, 0, 0,
                item.line.mBounds.width(), item.line.mBounds.height());
        index++;
    }
}
 
源代码2 项目: android_9.0.0_r45   文件: TimePicker.java
@Override
public void dispatchProvideAutofillStructure(ViewStructure structure, int flags) {
    // This view is self-sufficient for autofill, so it needs to call
    // onProvideAutoFillStructure() to fill itself, but it does not need to call
    // dispatchProvideAutoFillStructure() to fill its children.
    structure.setAutofillId(getAutofillId());
    onProvideAutofillStructure(structure, flags);
}
 
源代码3 项目: android_9.0.0_r45   文件: DatePicker.java
@Override
public void dispatchProvideAutofillStructure(ViewStructure structure, int flags) {
    // This view is self-sufficient for autofill, so it needs to call
    // onProvideAutoFillStructure() to fill itself, but it does not need to call
    // dispatchProvideAutoFillStructure() to fill its children.
    structure.setAutofillId(getAutofillId());
    onProvideAutofillStructure(structure, flags);
}
 
@Override
public void onProvideAutofillVirtualStructure(ViewStructure structure, int flags) {
    // Build a ViewStructure that will get passed to the AutofillService by the framework
    // when it is time to find autofill suggestions.
    structure.setClassName(getClass().getName());
    int childrenSize = mVirtualViews.size();
    if (DEBUG) {
        Log.d(TAG, "onProvideAutofillVirtualStructure(): flags = " + flags + ", items = "
                + childrenSize + ", extras: " + bundleToString(structure.getExtras()));
    }
    int index = structure.addChildCount(childrenSize);
    // Traverse through the view hierarchy, including virtual child views. For each view, we
    // need to set the relevant autofill metadata and add it to the ViewStructure.
    for (int i = 0; i < childrenSize; i++) {
        Item item = mVirtualViews.valueAt(i);
        if (DEBUG) {
            Log.d(TAG, "Adding new child at index " + index + ": " + item);
        }
        ViewStructure child = structure.newChild(index);
        child.setAutofillId(structure.getAutofillId(), item.id);
        child.setAutofillHints(item.hints);
        child.setAutofillType(item.type);
        child.setAutofillValue(item.getAutofillValue());
        child.setDataIsSensitive(!item.sanitized);
        child.setFocused(item.focused);
        child.setVisibility(View.VISIBLE);
        child.setDimens(item.line.mBounds.left, item.line.mBounds.top, 0, 0,
                item.line.mBounds.width(), item.line.mBounds.height());
        child.setId(item.id, getContext().getPackageName(), null, item.idEntry);
        child.setClassName(item.getClassName());
        child.setDimens(item.line.mBounds.left, item.line.mBounds.top, 0, 0,
                item.line.mBounds.width(), item.line.mBounds.height());
        index++;
    }
}
 
源代码5 项目: DateTimePicker   文件: TimePicker.java
@TargetApi(Build.VERSION_CODES.O)
@Override
public void dispatchProvideAutofillStructure(ViewStructure structure, int flags) {
    // This view is self-sufficient for autofill, so it needs to call
    // onProvideAutoFillStructure() to fill itself, but it does not need to call
    // dispatchProvideAutoFillStructure() to fill its children.
    structure.setAutofillId(getAutofillId());
    onProvideAutofillStructure(structure, flags);
}