Scrollable inline suggestions

Increase the number of suggestions for scrolling in
the sample autofill service.

Add scrollable container for the suggestions in the
keyboard suggestion view.

Test: manual

Change-Id: I4f8a2fe191f4b7e5a70b5370a7bd55a2e9dddc9a
This commit is contained in:
Svet Ganov
2020-01-27 19:21:32 -08:00
parent af2bd94be7
commit 6b5b977f1e
3 changed files with 10 additions and 7 deletions

View File

@@ -22,10 +22,14 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/KeyboardArea"> style="@style/KeyboardArea">
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout <LinearLayout
android:id="@+id/suggestion_view" android:id="@+id/suggestion_view"
style="@style/KeyboardRow.Header"> style="@style/KeyboardRow.Header">
</LinearLayout> </LinearLayout>
</HorizontalScrollView>
<LinearLayout style="@style/KeyboardRow"> <LinearLayout style="@style/KeyboardRow">
<TextView <TextView

View File

@@ -16,7 +16,6 @@
package com.example.android.autofillkeyboard; package com.example.android.autofillkeyboard;
import android.content.res.Resources;
import android.inputmethodservice.InputMethodService; import android.inputmethodservice.InputMethodService;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Handler; import android.os.Handler;
@@ -101,7 +100,7 @@ public class AutofillImeService extends InputMethodService {
getResources().getResourceName(R.style.GreenTheme)).build()); getResources().getResourceName(R.style.GreenTheme)).build());
return new InlineSuggestionsRequest.Builder(presentationSpecs) return new InlineSuggestionsRequest.Builder(presentationSpecs)
.setMaxSuggestionCount(2) .setMaxSuggestionCount(6)
.build(); .build();
} }

View File

@@ -62,7 +62,7 @@ public class InlineFillService extends AutofillService {
/** /**
* Number of datasets sent on each request - we're simple, that value is hardcoded in our DNA! * Number of datasets sent on each request - we're simple, that value is hardcoded in our DNA!
*/ */
static final int NUMBER_DATASETS = 4; static final int NUMBER_DATASETS = 6;
@Override @Override
public void onFillRequest(FillRequest request, CancellationSignal cancellationSignal, public void onFillRequest(FillRequest request, CancellationSignal cancellationSignal,