Sample app: update autofillkeyboard sample app to work with the new API

Test: manual verification
Bug: 146454892

Change-Id: I95eb0ec15b9cd1a73e7a0e7f35d1691744a90f72
This commit is contained in:
Feng Cao
2020-02-18 19:34:12 -08:00
parent effc469192
commit 874ce46cd3

View File

@@ -18,6 +18,7 @@ package com.example.android.autofillkeyboard;
import android.inputmethodservice.InputMethodService; import android.inputmethodservice.InputMethodService;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.support.annotation.GuardedBy; import android.support.annotation.GuardedBy;
import android.util.Log; import android.util.Log;
@@ -89,15 +90,13 @@ public class AutofillImeService extends InputMethodService {
private boolean mSuggestionViewVisible = false; private boolean mSuggestionViewVisible = false;
@Override @Override
public InlineSuggestionsRequest onCreateInlineSuggestionsRequest() { public InlineSuggestionsRequest onCreateInlineSuggestionsRequest(Bundle uiExtras) {
Log.d(TAG, "onCreateInlineSuggestionsRequest() called"); Log.d(TAG, "onCreateInlineSuggestionsRequest() called");
final ArrayList<InlinePresentationSpec> presentationSpecs = new ArrayList<>(); final ArrayList<InlinePresentationSpec> presentationSpecs = new ArrayList<>();
presentationSpecs.add(new InlinePresentationSpec.Builder(new Size(100, 100), presentationSpecs.add(new InlinePresentationSpec.Builder(new Size(100, 100),
new Size(400, 100)).setStyle( new Size(400, 100)).build());
getResources().getResourceName(R.style.YellowTheme)).build());
presentationSpecs.add(new InlinePresentationSpec.Builder(new Size(100, 100), presentationSpecs.add(new InlinePresentationSpec.Builder(new Size(100, 100),
new Size(400, 100)).setStyle( new Size(400, 100)).build());
getResources().getResourceName(R.style.GreenTheme)).build());
return new InlineSuggestionsRequest.Builder(presentationSpecs) return new InlineSuggestionsRequest.Builder(presentationSpecs)
.setMaxSuggestionCount(6) .setMaxSuggestionCount(6)