下面列出了android.app.assist.AssistStructure.ViewNode#getAutofillId ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private void addAutofillableFields(@NonNull Map<String, AutofillId> fields,
@NonNull ViewNode node) {
String[] hints = node.getAutofillHints();
if (hints != null) {
// We're simple, we only care about the first hint
String hint = hints[0];
AutofillId id = node.getAutofillId();
if (!fields.containsKey(hint)) {
Log.v(TAG, "Setting hint '" + hint + "' on " + id);
fields.put(hint, id);
} else {
Log.v(TAG, "Ignoring hint '" + hint + "' on " + id
+ " because it was already set");
}
}
int childrenSize = node.getChildCount();
for (int i = 0; i < childrenSize; i++) {
addAutofillableFields(fields, node.getChildAt(i));
}
}
/**
* Adds any autofillable view from the {@link ViewNode} and its descendants to the map.
*/
private void addAutofillableFields(@NonNull Map<String, AutofillId> fields,
@NonNull ViewNode node) {
String[] hints = node.getAutofillHints();
if (hints != null) {
// We're simple, we only care about the first hint
String hint = hints[0].toLowerCase();
if (hint != null) {
AutofillId id = node.getAutofillId();
if (!fields.containsKey(hint)) {
Log.v(TAG, "Setting hint '" + hint + "' on " + id);
fields.put(hint, id);
} else {
Log.v(TAG, "Ignoring hint '" + hint + "' on " + id
+ " because it was already set");
}
}
}
int childrenSize = node.getChildCount();
for (int i = 0; i < childrenSize; i++) {
addAutofillableFields(fields, node.getChildAt(i));
}
}
/**
* Adds any autofillable view from the {@link ViewNode} and its descendants to the map.
*/
private void addAutofillableFields(@NonNull Map<String, AutofillId> fields,
@NonNull ViewNode node) {
String hint = getHint(node);
if (hint != null) {
AutofillId id = node.getAutofillId();
if (!fields.containsKey(hint)) {
Log.v(TAG, "Setting hint '" + hint + "' on " + id);
fields.put(hint, id);
} else {
Log.v(TAG, "Ignoring hint '" + hint + "' on " + id
+ " because it was already set");
}
}
int childrenSize = node.getChildCount();
for (int i = 0; i < childrenSize; i++) {
addAutofillableFields(fields, node.getChildAt(i));
}
}
private void addAutofillableFields(@NonNull Map<String, AutofillId> fields,
@NonNull ViewNode node) {
String[] hints = node.getAutofillHints();
if (hints != null) {
// We're simple, we only care about the first hint
String hint = hints[0];
AutofillId id = node.getAutofillId();
if (!fields.containsKey(hint)) {
Log.v(TAG, "Setting hint '" + hint + "' on " + id);
fields.put(hint, id);
} else {
Log.v(TAG, "Ignoring hint '" + hint + "' on " + id
+ " because it was already set");
}
}
int childrenSize = node.getChildCount();
for (int i = 0; i < childrenSize; i++) {
addAutofillableFields(fields, node.getChildAt(i));
}
}
/**
* Adds any autofillable view from the {@link ViewNode} and its descendants to the map.
*/
private void addAutofillableFields(@NonNull Map<String, AutofillId> fields,
@NonNull ViewNode node) {
String[] hints = node.getAutofillHints();
if (hints != null) {
// We're simple, we only care about the first hint
String hint = hints[0].toLowerCase();
if (hint != null) {
AutofillId id = node.getAutofillId();
if (!fields.containsKey(hint)) {
Log.v(TAG, "Setting hint '" + hint + "' on " + id);
fields.put(hint, id);
} else {
Log.v(TAG, "Ignoring hint '" + hint + "' on " + id
+ " because it was already set");
}
}
}
int childrenSize = node.getChildCount();
for (int i = 0; i < childrenSize; i++) {
addAutofillableFields(fields, node.getChildAt(i));
}
}
/**
* Adds any autofillable view from the {@link ViewNode} and its descendants to the map.
*/
private void addAutofillableFields(@NonNull Map<String, AutofillId> fields,
@NonNull ViewNode node) {
String hint = getHint(node);
if (hint != null) {
AutofillId id = node.getAutofillId();
if (!fields.containsKey(hint)) {
Log.v(TAG, "Setting hint '" + hint + "' on " + id);
fields.put(hint, id);
} else {
Log.v(TAG, "Ignoring hint '" + hint + "' on " + id
+ " because it was already set");
}
}
int childrenSize = node.getChildCount();
for (int i = 0; i < childrenSize; i++) {
addAutofillableFields(fields, node.getChildAt(i));
}
}