Merge "Add dialog present support for AutofillService." into tm-dev am: 037bcfce15
Original change: https://googleplex-android-review.googlesource.com/c/platform/development/+/18030509 Change-Id: Ie61b770c63661f37f95ac3148c39e0d8b342b0eb Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -134,8 +134,13 @@ public class InlineFillService extends AutofillService {
|
||||
response.addDataset(InlineRequestHelper.createInlineActionDataset(context, fields,
|
||||
inlineRequest.get(), R.drawable.ic_settings));
|
||||
}
|
||||
// 3. Add fill dialog
|
||||
RemoteViews dialogPresentation =
|
||||
ResponseHelper.newDatasetPresentation(packageName, "Dialog Header");
|
||||
response.setDialogHeader(dialogPresentation);
|
||||
response.setFillDialogTriggerIds(fields.valueAt(0), fields.valueAt(1));
|
||||
|
||||
// 3.Add save info
|
||||
// 4.Add save info
|
||||
Collection<AutofillId> ids = fields.values();
|
||||
AutofillId[] requiredIds = new AutofillId[ids.size()];
|
||||
ids.toArray(requiredIds);
|
||||
@@ -143,7 +148,7 @@ public class InlineFillService extends AutofillService {
|
||||
// We're simple, so we're generic
|
||||
new SaveInfo.Builder(SaveInfo.SAVE_DATA_TYPE_GENERIC, requiredIds).build());
|
||||
|
||||
// 4.Profit!
|
||||
// 5.Profit!
|
||||
return response.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -59,8 +59,10 @@ class ResponseHelper {
|
||||
// Set presentation
|
||||
final Presentations.Builder fieldPresentationsBuilder =
|
||||
new Presentations.Builder();
|
||||
// Dropdown presentation
|
||||
final RemoteViews presentation = newDatasetPresentation(packageName, displayValue);
|
||||
fieldPresentationsBuilder.setMenuPresentation(presentation);
|
||||
// Inline presentation
|
||||
if (inlineRequest.isPresent()) {
|
||||
Log.d(TAG, "Found InlineSuggestionsRequest in FillRequest: " + inlineRequest);
|
||||
final InlinePresentation inlinePresentation =
|
||||
@@ -68,6 +70,11 @@ class ResponseHelper {
|
||||
displayValue, index);
|
||||
fieldPresentationsBuilder.setInlinePresentation(inlinePresentation);
|
||||
}
|
||||
// Dialog presentation
|
||||
RemoteViews dialogPresentation =
|
||||
newDatasetPresentation(packageName, "Dialog Presentation " + (index + 1));
|
||||
fieldPresentationsBuilder.setDialogPresentation(dialogPresentation);
|
||||
|
||||
fieldBuilder.setPresentations(fieldPresentationsBuilder.build());
|
||||
dataset.setField(id, fieldBuilder.build());
|
||||
}
|
||||
@@ -92,15 +99,22 @@ class ResponseHelper {
|
||||
|
||||
Field.Builder fieldBuilder = new Field.Builder();
|
||||
fieldBuilder.setValue(AutofillValue.forText(value));
|
||||
// Dropdown presentation
|
||||
final Presentations.Builder fieldPresentationsBuilder =
|
||||
new Presentations.Builder();
|
||||
fieldPresentationsBuilder.setMenuPresentation(presentation);
|
||||
// Inline presentation
|
||||
if (inlineRequest.isPresent()) {
|
||||
final InlinePresentation inlinePresentation =
|
||||
InlineRequestHelper.createInlineDataset(context, inlineRequest.get(),
|
||||
displayValue, index);
|
||||
fieldPresentationsBuilder.setInlinePresentation(inlinePresentation);
|
||||
}
|
||||
// Dialog presentation
|
||||
RemoteViews dialogPresentation =
|
||||
newDatasetPresentation(packageName, "Dialog Presentation " + (index + 1));
|
||||
fieldPresentationsBuilder.setDialogPresentation(dialogPresentation);
|
||||
|
||||
fieldBuilder.setPresentations(fieldPresentationsBuilder.build());
|
||||
lockedDataset.setField(id, fieldBuilder.build());
|
||||
lockedDataset.setId(null).setAuthentication(authentication);
|
||||
|
||||
Reference in New Issue
Block a user