Java Code Examples for android.view.ViewStructure#setAutofillId()

The following examples show how to use android.view.ViewStructure#setAutofillId() . 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: CustomVirtualView.java    From input-samples with Apache License 2.0 5 votes vote down vote up
@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++;
    }
}
 
Example 2
Source File: TimePicker.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 3
Source File: DatePicker.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 4
Source File: CustomVirtualView.java    From android-AutofillFramework with Apache License 2.0 5 votes vote down vote up
@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++;
    }
}
 
Example 5
Source File: TimePicker.java    From DateTimePicker with Apache License 2.0 5 votes vote down vote up
@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);
}