aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSvet Ganov <svetoslavganov@google.com>2017-05-09 23:25:04 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-05-09 23:25:04 +0000
commit9fdd32e6758bcca54518b82a6876e7cd6934cd90 (patch)
tree9fd7a19f03725c1e64aee0354db1464caace4857
parent6dc25a7294804507d1d1191f11dbc11fa4023b45 (diff)
parentf664e1fad87d06f1ad738549db049011c84ca787 (diff)
downloadexperimental-9fdd32e6758bcca54518b82a6876e7cd6934cd90.tar.gz
am: f664e1fad8 Change-Id: Id08b8acb464584da153f6a2bbc2187f66f4dcf72
-rw-r--r--FillService/res/layout/pathology.xml33
-rw-r--r--FillService/src/foo/bar/fill/FillService.java27
2 files changed, 47 insertions, 13 deletions
diff --git a/FillService/res/layout/pathology.xml b/FillService/res/layout/pathology.xml
new file mode 100644
index 0000000..6ec9bfd
--- /dev/null
+++ b/FillService/res/layout/pathology.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@android:id/content"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="?android:attr/selectableItemBackground">
+ <ImageButton
+ android:id="@android:id/icon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerVertical="true"
+ android:layout_alignParentEnd="true"
+ android:background="@null"
+ android:src="@drawable/ic_launcher"/>
+ <TextView
+ android:id="@android:id/text1"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentTop="true"
+ android:layout_alignParentStart="true"
+ android:layout_toStartOf="@android:id/icon"
+ android:text="Click to collect 100 bucks"/>
+
+ <TextView
+ android:id="@android:id/text2"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_below="@android:id/text1"
+ android:layout_alignParentStart="true"
+ android:layout_toStartOf="@android:id/icon"
+ android:text="Click"/>
+</RelativeLayout> \ No newline at end of file
diff --git a/FillService/src/foo/bar/fill/FillService.java b/FillService/src/foo/bar/fill/FillService.java
index 7666ed8..c253e7c 100644
--- a/FillService/src/foo/bar/fill/FillService.java
+++ b/FillService/src/foo/bar/fill/FillService.java
@@ -43,7 +43,7 @@ import java.util.function.Predicate;
import foo.bar.fill.R;
public class FillService extends AutofillService {
- static final boolean TEST_RESPONSE_AUTH = true;
+ static final boolean TEST_RESPONSE_AUTH = false;
public static final String RESPONSE_ID = "RESPONSE_ID";
@@ -74,7 +74,7 @@ public class FillService extends AutofillService {
public void onFillRequest(@NonNull FillRequest request,
@NonNull CancellationSignal cancellationSignal,
@NonNull FillCallback callback) {
- AssistStructure structure = request.getStructure();
+ AssistStructure structure = request.getFillContexts().get(0).getStructure();
ViewNode username = findUsername(structure);
ViewNode password = findPassword(structure);
@@ -89,20 +89,21 @@ public class FillService extends AutofillService {
PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_CANCEL_CURRENT)
.getIntentSender();
- RemoteViews presentation = new RemoteViews(getPackageName(), R.layout.list_item);
+ RemoteViews presentation = new RemoteViews(getPackageName(), R.layout.pathology);
- presentation.setTextViewText(R.id.text1, "First");
- Intent firstIntent = new Intent(this, FirstActivity.class);
- presentation.setOnClickPendingIntent(R.id.text1, PendingIntent.getActivity(
- this, 0, firstIntent, PendingIntent.FLAG_CANCEL_CURRENT));
+// presentation.setTextViewText(R.id.text1, "First");
+// Intent firstIntent = new Intent(this, FirstActivity.class);
+// presentation.setOnClickPendingIntent(R.id.text1, PendingIntent.getActivity(
+// this, 0, firstIntent, PendingIntent.FLAG_CANCEL_CURRENT));
- presentation.setTextViewText(R.id.text2, "Second");
- Intent secondIntent = new Intent(this, SecondActivity.class);
- presentation.setOnClickPendingIntent(R.id.text2, PendingIntent.getActivity(
- this, 0, secondIntent, PendingIntent.FLAG_CANCEL_CURRENT));
+// presentation.setTextViewText(R.id.text2, "Second");
+// Intent secondIntent = new Intent(this, SecondActivity.class);
+// presentation.setOnClickPendingIntent(R.id.text2, PendingIntent.getActivity(
+// this, 0, secondIntent, PendingIntent.FLAG_CANCEL_CURRENT));
response = new FillResponse.Builder()
- .setAuthentication(sender, presentation)
+ .setAuthentication(new AutofillId[]{username.getAutofillId(),
+ password.getAutofillId()}, sender, presentation)
.build();
} else {
Intent intent = new Intent(this, AuthActivity.class);
@@ -124,7 +125,7 @@ public class FillService extends AutofillService {
presentation4.setTextViewText(R.id.text1, DATASET4_NAME);
RemoteViews presentation5 = new RemoteViews(getPackageName(), R.layout.list_item);
- presentation5.setTextViewText(R.id.text1, DATASET5_NAME);
+ presentation5.setTextViewText(R.id.text1, /*DATASET5_NAME*/ "Auth needed");
response = new FillResponse.Builder()
.addDataset(new Dataset.Builder(presentation1)