aboutsummaryrefslogtreecommitdiff
path: root/input/autofill/AutofillFramework/kotlinApp/Application
diff options
context:
space:
mode:
authorDouglas Sigelbaum <sigelbaum@google.com>2017-06-14 14:35:49 -0700
committerDouglas Sigelbaum <sigelbaum@google.com>2017-06-22 10:54:38 -0700
commitdd108ebb984500ab79aff58710c6936def8b0af9 (patch)
treef46ce8fc3bd7bb69e9801175d3f27e729a38cd2d /input/autofill/AutofillFramework/kotlinApp/Application
parentbb55ff972cb9708b875bebcbd3ceef4f283c2ae6 (diff)
downloadandroid-dd108ebb984500ab79aff58710c6936def8b0af9.tar.gz
Autofill sample: added icons, fixed an auth bug, added more comments.
* Added icons for autofill popups. * Fixed RTE in the service due to autofill being enabled on the autofill login page. * Added more comments to other unrelated functions. * Added helper functions for ensuring only supported hints are supported. * Added string resources. * Changed some method/variable names to match newish class names. Bug: 38182790 Test: manual Change-Id: I1874c7be12ee1b50f5cc94542561d00820ba1874
Diffstat (limited to 'input/autofill/AutofillFramework/kotlinApp/Application')
-rw-r--r--input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/AuthActivity.kt2
-rw-r--r--input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/AutofillFieldMetadata.kt2
-rw-r--r--input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/AutofillHelper.kt20
-rw-r--r--input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/MyAutofillService.kt15
-rw-r--r--input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/StructureParser.kt3
-rw-r--r--input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/datasource/AutofillRepository.kt4
-rw-r--r--input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/datasource/SharedPrefsAutofillRepository.kt11
-rw-r--r--input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/model/FilledAutofillField.kt14
-rw-r--r--input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/model/FilledAutofillFieldCollection.kt19
-rw-r--r--input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/drawable/ic_lock_black_24dp.xml9
-rw-r--r--input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/layout/login_activity.xml4
-rw-r--r--input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/layout/multidataset_service_auth_activity.xml34
-rw-r--r--input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/layout/multidataset_service_list_item.xml36
-rw-r--r--input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/layout/virtual_login_activity.xml14
-rw-r--r--input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/values/strings.xml5
15 files changed, 117 insertions, 75 deletions
diff --git a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/AuthActivity.kt b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/AuthActivity.kt
index 4c1b5b72..eea17992 100644
--- a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/AuthActivity.kt
+++ b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/AuthActivity.kt
@@ -92,7 +92,7 @@ class AuthActivity : AppCompatActivity() {
val autofillFields = parser.autofillFields
mReplyIntent = Intent()
val clientFormDataMap = SharedPrefsAutofillRepository
- .getClientFormData(this, autofillFields.focusedAutofillHints, autofillFields.allAutofillHints)
+ .getFilledAutofillFieldCollection(this, autofillFields.focusedAutofillHints, autofillFields.allAutofillHints)
if (forResponse) {
AutofillHelper.newResponse(this, false, autofillFields, clientFormDataMap)?.let(this::setResponseIntent)
} else {
diff --git a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/AutofillFieldMetadata.kt b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/AutofillFieldMetadata.kt
index 47539dfd..f894a18b 100644
--- a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/AutofillFieldMetadata.kt
+++ b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/AutofillFieldMetadata.kt
@@ -28,7 +28,7 @@ class AutofillFieldMetadata(view: ViewNode) {
var saveType = 0
private set
- val autofillHints: Array<String> = view.autofillHints
+ val autofillHints: Array<String> = view.autofillHints.filter(AutofillHelper::isValidHint).toTypedArray()
val autofillId: AutofillId = view.autofillId
val autofillType: Int = view.autofillType
val autofillOptions: Array<CharSequence>? = view.autofillOptions
diff --git a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/AutofillHelper.kt b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/AutofillHelper.kt
index e8b5fb1e..027d0f31 100644
--- a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/AutofillHelper.kt
+++ b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/AutofillHelper.kt
@@ -19,6 +19,7 @@ import android.content.Context
import android.service.autofill.Dataset
import android.service.autofill.FillResponse
import android.service.autofill.SaveInfo
+import android.support.annotation.DrawableRes
import android.util.Log
import android.view.View
import android.widget.RemoteViews
@@ -52,14 +53,21 @@ object AutofillHelper {
* client View.
*/
fun newDataset(context: Context, autofillFieldMetadata: AutofillFieldMetadataCollection,
- filledAutofillFieldCollection: FilledAutofillFieldCollection, datasetAuth: Boolean): Dataset? {
+ filledAutofillFieldCollection: FilledAutofillFieldCollection,
+ datasetAuth: Boolean): Dataset? {
filledAutofillFieldCollection.datasetName?.let { datasetName ->
- val datasetBuilder = Dataset.Builder(newRemoteViews(context.packageName, datasetName))
- val setValueAtLeastOnce = filledAutofillFieldCollection.applyToFields(autofillFieldMetadata, datasetBuilder)
+ val datasetBuilder: Dataset.Builder
if (datasetAuth) {
+ datasetBuilder = Dataset.Builder(newRemoteViews(context.packageName, datasetName,
+ R.drawable.ic_lock_black_24dp))
val sender = AuthActivity.getAuthIntentSenderForDataset(context, datasetName)
datasetBuilder.setAuthentication(sender)
+ } else {
+ datasetBuilder = Dataset.Builder(newRemoteViews(context.packageName, datasetName,
+ R.drawable.ic_person_black_24dp))
}
+ val setValueAtLeastOnce = filledAutofillFieldCollection
+ .applyToFields(autofillFieldMetadata, datasetBuilder)
if (setValueAtLeastOnce) {
return datasetBuilder.build()
}
@@ -67,9 +75,11 @@ object AutofillHelper {
return null
}
- fun newRemoteViews(packageName: String, remoteViewsText: String): RemoteViews {
+ fun newRemoteViews(packageName: String, remoteViewsText: String,
+ @DrawableRes drawableId: Int): RemoteViews {
val presentation = RemoteViews(packageName, R.layout.multidataset_service_list_item)
- presentation.setTextViewText(R.id.text1, remoteViewsText)
+ presentation.setTextViewText(R.id.text, remoteViewsText)
+ presentation.setImageViewResource(R.id.icon, drawableId)
return presentation
}
diff --git a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/MyAutofillService.kt b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/MyAutofillService.kt
index fa069241..ce2ce0d7 100644
--- a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/MyAutofillService.kt
+++ b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/MyAutofillService.kt
@@ -36,14 +36,6 @@ class MyAutofillService : AutofillService() {
val structure = request.getFillContexts().get(request.getFillContexts().size - 1).structure
val data = request.clientState
Log.d(TAG, "onFillRequest(): data=" + bundleToString(data))
-
- // Temporary hack for disabling autofill for components in this autofill service.
- // i.e. we don't want to autofill components in AuthActivity.
- if (structure.activityComponent.toShortString()
- .contains("com.example.android.autofillframework.service")) {
- callback.onSuccess(null)
- return
- }
cancellationSignal.setOnCancelListener { Log.w(TAG, "Cancel autofill not implemented in this sample.") }
// Parse AutoFill data in Activity
val parser = StructureParser(structure)
@@ -58,13 +50,13 @@ class MyAutofillService : AutofillService() {
// to generate Response.
val sender = AuthActivity.getAuthIntentSenderForResponse(this)
val presentation = AutofillHelper
- .newRemoteViews(packageName, getString(R.string.autofill_sign_in_prompt))
+ .newRemoteViews(packageName, getString(R.string.autofill_sign_in_prompt), R.drawable.ic_lock_black_24dp)
responseBuilder
.setAuthentication(autofillFields.autofillIds.toTypedArray(), sender, presentation)
callback.onSuccess(responseBuilder.build())
} else {
val datasetAuth = MyPreferences.isDatasetAuth(this)
- val clientFormDataMap = SharedPrefsAutofillRepository.getClientFormData(this,
+ val clientFormDataMap = SharedPrefsAutofillRepository.getFilledAutofillFieldCollection(this,
autofillFields.focusedAutofillHints, autofillFields.allAutofillHints)
val response = AutofillHelper.newResponse(this, datasetAuth, autofillFields, clientFormDataMap)
callback.onSuccess(response)
@@ -78,7 +70,8 @@ class MyAutofillService : AutofillService() {
Log.d(TAG, "onSaveRequest(): data=" + bundleToString(data))
val parser = StructureParser(structure)
parser.parseForSave()
- SharedPrefsAutofillRepository.saveClientFormData(this, parser.filledAutofillFieldCollection)
+ SharedPrefsAutofillRepository.saveFilledAutofillFieldCollection(this,
+ parser.filledAutofillFieldCollection)
}
override fun onConnected() {
diff --git a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/StructureParser.kt b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/StructureParser.kt
index 31b59c8a..d1bbc9c1 100644
--- a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/StructureParser.kt
+++ b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/StructureParser.kt
@@ -61,8 +61,7 @@ internal class StructureParser(private val mStructure: AssistStructure) {
if (forFill) {
autofillFields.add(AutofillFieldMetadata(viewNode))
} else {
- filledAutofillFieldCollection.setAutofillValuesForHints(viewNode.autofillHints,
- FilledAutofillField(viewNode))
+ filledAutofillFieldCollection.add(FilledAutofillField(viewNode))
}
}
}
diff --git a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/datasource/AutofillRepository.kt b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/datasource/AutofillRepository.kt
index 510d759f..00a7d8df 100644
--- a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/datasource/AutofillRepository.kt
+++ b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/datasource/AutofillRepository.kt
@@ -25,13 +25,13 @@ interface AutofillRepository {
* Gets saved FilledAutofillFieldCollection that contains some objects that can autofill fields with these
* `autofillHints`.
*/
- fun getClientFormData(context: Context, focusedAutofillHints: List<String>,
+ fun getFilledAutofillFieldCollection(context: Context, focusedAutofillHints: List<String>,
allAutofillHints: List<String>): HashMap<String, FilledAutofillFieldCollection>?
/**
* Saves LoginCredential under this datasetName.
*/
- fun saveClientFormData(context: Context, filledAutofillFieldCollection: FilledAutofillFieldCollection)
+ fun saveFilledAutofillFieldCollection(context: Context, filledAutofillFieldCollection: FilledAutofillFieldCollection)
/**
* Clears all data.
diff --git a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/datasource/SharedPrefsAutofillRepository.kt b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/datasource/SharedPrefsAutofillRepository.kt
index e2171708..98119152 100644
--- a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/datasource/SharedPrefsAutofillRepository.kt
+++ b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/datasource/SharedPrefsAutofillRepository.kt
@@ -20,6 +20,7 @@ import android.content.SharedPreferences
import android.util.ArraySet
import com.example.android.autofillframework.multidatasetservice.model.FilledAutofillFieldCollection
import com.google.gson.Gson
+import com.google.gson.GsonBuilder
import com.google.gson.reflect.TypeToken
@@ -37,14 +38,15 @@ object SharedPrefsAutofillRepository : AutofillRepository {
return context.applicationContext.getSharedPreferences(SHARED_PREF_KEY, Context.MODE_PRIVATE)
}
- override fun getClientFormData(context: Context, focusedAutofillHints: List<String>,
+ override fun getFilledAutofillFieldCollection(context: Context, focusedAutofillHints: List<String>,
allAutofillHints: List<String>): HashMap<String, FilledAutofillFieldCollection>? {
var hasDataForFocusedAutofillHints = false
val clientFormDataMap = HashMap<String, FilledAutofillFieldCollection>()
val clientFormDataStringSet = getAllAutofillDataStringSet(context)
for (clientFormDataString in clientFormDataStringSet) {
val type = object : TypeToken<FilledAutofillFieldCollection>() {}.type
- Gson().fromJson<FilledAutofillFieldCollection>(clientFormDataString, type)?.let { clientFormData ->
+ val gson: Gson = GsonBuilder().excludeFieldsWithoutExposeAnnotation().setPrettyPrinting().create()
+ gson.fromJson<FilledAutofillFieldCollection>(clientFormDataString, type)?.let { clientFormData ->
if (clientFormData.helpsWithHints(focusedAutofillHints)) {
// Saved data has data relevant to at least 1 of the hints associated with the
// View in focus.
@@ -66,11 +68,12 @@ object SharedPrefsAutofillRepository : AutofillRepository {
}
}
- override fun saveClientFormData(context: Context, filledAutofillFieldCollection: FilledAutofillFieldCollection) {
+ override fun saveFilledAutofillFieldCollection(context: Context, filledAutofillFieldCollection: FilledAutofillFieldCollection) {
val datasetName = "dataset-" + getDatasetNumber(context)
filledAutofillFieldCollection.datasetName = datasetName
val allAutofillData = getAllAutofillDataStringSet(context)
- allAutofillData.add(Gson().toJson(filledAutofillFieldCollection).toString())
+ val gson: Gson = GsonBuilder().excludeFieldsWithoutExposeAnnotation().setPrettyPrinting().create()
+ allAutofillData.add(gson.toJson(filledAutofillFieldCollection).toString())
saveAllAutofillDataStringSet(context, allAutofillData)
incrementDatasetNumber(context)
}
diff --git a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/model/FilledAutofillField.kt b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/model/FilledAutofillField.kt
index fd2e1769..64617ccf 100644
--- a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/model/FilledAutofillField.kt
+++ b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/model/FilledAutofillField.kt
@@ -17,22 +17,32 @@ package com.example.android.autofillframework.multidatasetservice.model
import android.app.assist.AssistStructure
import android.view.autofill.AutofillValue
+import com.example.android.autofillframework.multidatasetservice.AutofillHelper
+import com.google.gson.annotations.Expose
/**
* JSON serializable data class containing the same data as an [AutofillValue].
*/
class FilledAutofillField(viewNode: AssistStructure.ViewNode) {
- var textValue: CharSequence? = null
+ @Expose
+ var textValue: String? = null
+
+ @Expose
var dateValue: Long? = null
+
+ @Expose
var toggleValue: Boolean? = null
+ val autofillHints: Array<String> =
+ viewNode.autofillHints.filter(AutofillHelper::isValidHint).toTypedArray()
+
init {
viewNode.autofillValue?.let { autofillValue ->
if (autofillValue.isList) {
val index = autofillValue.listValue
viewNode.autofillOptions?.let { autofillOptions ->
if (autofillOptions.size > index) {
- textValue = autofillOptions[index]
+ textValue = autofillOptions[index].toString()
}
}
} else if (autofillValue.isDate) {
diff --git a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/model/FilledAutofillFieldCollection.kt b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/model/FilledAutofillFieldCollection.kt
index 03e13ef5..032e1251 100644
--- a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/model/FilledAutofillFieldCollection.kt
+++ b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/multidatasetservice/model/FilledAutofillFieldCollection.kt
@@ -23,6 +23,7 @@ import android.view.autofill.AutofillValue
import com.example.android.autofillframework.CommonUtil.TAG
import com.example.android.autofillframework.multidatasetservice.AutofillFieldMetadataCollection
import com.example.android.autofillframework.multidatasetservice.AutofillHelper
+import com.google.gson.annotations.Expose
import java.util.HashMap
@@ -30,21 +31,24 @@ import java.util.HashMap
* FilledAutofillFieldCollection is the model that represents all of the form data on a client app's page, plus the
* dataset name associated with it.
*/
-class FilledAutofillFieldCollection constructor(var datasetName: String? = null,
- private val hintMap: HashMap<String, FilledAutofillField> = HashMap<String, FilledAutofillField>()) {
+class FilledAutofillFieldCollection constructor(@Expose var datasetName: String? = null,
+ @Expose private val hintMap: HashMap<String, FilledAutofillField> = HashMap<String, FilledAutofillField>()) {
/**
* Sets values for a list of autofillHints.
*/
- fun setAutofillValuesForHints(autofillHints: Array<String>, autofillField: FilledAutofillField) {
- autofillHints.filter(AutofillHelper::isValidHint).forEach { autofillHint ->
+ fun add(autofillField: FilledAutofillField) {
+ autofillField.autofillHints.forEach { autofillHint ->
hintMap[autofillHint] = autofillField
}
}
/**
* Populates a [Dataset.Builder] with appropriate values for each [AutofillId]
- * in a `AutofillFieldMetadataCollection`.
+ * in a `AutofillFieldMetadataCollection`. In other words, it builds an Autofill dataset
+ * by applying saved values (from this `FilledAutofillFieldCollection`) to Views specified
+ * in a `AutofillFieldMetadataCollection`, which represents the current page the user is
+ * on.
*/
fun applyToFields(autofillFieldMetadataCollection: AutofillFieldMetadataCollection,
datasetBuilder: Dataset.Builder): Boolean {
@@ -88,8 +92,9 @@ class FilledAutofillFieldCollection constructor(var datasetName: String? = null,
}
/**
- * Returns whether this model contains autofill data that is relevant to any of the
- * autofillHints that are passed in.
+ * @param autofillHints List of autofill hints, usually associated with a View or set of Views.
+ * @return whether any of the filled fields on the page have at least 1 autofillHint that is
+ * in the provided autofillHints.
*/
fun helpsWithHints(autofillHints: List<String>): Boolean {
for (autofillHint in autofillHints) {
diff --git a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/drawable/ic_lock_black_24dp.xml b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/drawable/ic_lock_black_24dp.xml
new file mode 100644
index 00000000..67a7c73a
--- /dev/null
+++ b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/drawable/ic_lock_black_24dp.xml
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M18,8h-1L17,6c0,-2.76 -2.24,-5 -5,-5S7,3.24 7,6v2L6,8c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L20,10c0,-1.1 -0.9,-2 -2,-2zM12,17c-1.1,0 -2,-0.9 -2,-2s0.9,-2 2,-2 2,0.9 2,2 -0.9,2 -2,2zM15.1,8L8.9,8L8.9,6c0,-1.71 1.39,-3.1 3.1,-3.1 1.71,0 3.1,1.39 3.1,3.1v2z"/>
+</vector>
diff --git a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/layout/login_activity.xml b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/layout/login_activity.xml
index 6382fe75..f9f5657d 100644
--- a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/layout/login_activity.xml
+++ b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/layout/login_activity.xml
@@ -79,13 +79,13 @@
android:id="@+id/clear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="Clear" />
+ android:text="@string/clear_label" />
<Button
android:id="@+id/login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="Login" />
+ android:text="@string/login_label" />
</LinearLayout>
</LinearLayout> \ No newline at end of file
diff --git a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/layout/multidataset_service_auth_activity.xml b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/layout/multidataset_service_auth_activity.xml
index 0890af86..029db191 100644
--- a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/layout/multidataset_service_auth_activity.xml
+++ b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/layout/multidataset_service_auth_activity.xml
@@ -1,5 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
+<?xml version="1.0" encoding="utf-8"?><!--
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,30 +14,29 @@
* limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:id="@+id/authLayout"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical"
- android:paddingBottom="@dimen/activity_vertical_margin"
- android:paddingLeft="@dimen/activity_horizontal_margin"
- android:paddingRight="@dimen/activity_horizontal_margin"
- android:paddingTop="@dimen/activity_vertical_margin"
- tools:context=".multidatasetservice.AuthActivity">
+ xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/authLayout"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:importantForAutofill="noExcludeDescendants"
+ android:orientation="vertical"
+ android:paddingBottom="@dimen/activity_vertical_margin"
+ android:paddingLeft="@dimen/activity_horizontal_margin"
+ android:paddingRight="@dimen/activity_horizontal_margin"
+ android:paddingTop="@dimen/activity_vertical_margin"
+ tools:context=".multidatasetservice.AuthActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
- android:text="Master password">
- </TextView>
+ android:text="@string/master_password_label" />
<EditText
android:id="@+id/master_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:inputType="textPassword">
- </EditText>
+ android:inputType="textPassword" />
<LinearLayout
android:layout_width="match_parent"
@@ -50,13 +48,13 @@
android:id="@+id/cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="Cancel" />
+ android:text="@string/cancel" />
<Button
android:id="@+id/login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="Login" />
+ android:text="@string/login_label" />
</LinearLayout>
</LinearLayout> \ No newline at end of file
diff --git a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/layout/multidataset_service_list_item.xml b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/layout/multidataset_service_list_item.xml
index d01bc37d..fe51953e 100644
--- a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/layout/multidataset_service_list_item.xml
+++ b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/layout/multidataset_service_list_item.xml
@@ -1,5 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
+<?xml version="1.0" encoding="utf-8"?><!--
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +13,26 @@
* See the License for the specific language governing permissions and
* limitations under the License.
-->
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/text1"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:background="#ffffffff"
- android:gravity="center_vertical"
- android:minHeight="?android:attr/listPreferredItemHeightSmall"
- android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
- android:paddingStart="?android:attr/listPreferredItemPaddingStart"
- android:textAppearance="?android:attr/textAppearanceListItemSmall" />
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="horizontal">
+
+ <TextView
+ android:id="@+id/text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:background="#ffffffff"
+ android:gravity="center_vertical"
+ android:minHeight="?android:attr/listPreferredItemHeightSmall"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:textAppearance="?android:attr/textAppearanceListItemSmall" />
+
+ <ImageView
+ android:id="@+id/icon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:src="@drawable/ic_person_black_24dp"/>
+</LinearLayout> \ No newline at end of file
diff --git a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/layout/virtual_login_activity.xml b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/layout/virtual_login_activity.xml
index 59f56e1d..28600084 100644
--- a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/layout/virtual_login_activity.xml
+++ b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/layout/virtual_login_activity.xml
@@ -15,10 +15,10 @@
* limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical"
- android:weightSum="100">
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:weightSum="100">
<com.example.android.autofillframework.app.CustomVirtualView
android:id="@+id/custom_view"
@@ -37,12 +37,12 @@
android:id="@+id/clear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="Clear" />
+ android:text="@string/clear_label" />
<Button
android:id="@+id/login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="Login" />
+ android:text="@string/login_label" />
</LinearLayout>
-</LinearLayout>
+</LinearLayout> \ No newline at end of file
diff --git a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/values/strings.xml b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/values/strings.xml
index ffb8495a..2072d7bd 100644
--- a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/values/strings.xml
+++ b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/values/strings.xml
@@ -47,6 +47,9 @@
<string name="settings_auth_enter_current_password">Enter current password</string>
<string name="settings_auth_enter_new_password">Enter new password</string>
<string name="settings_auth_change_credentials_title">Change credentials</string>
+ <string name="clear_label">Clear</string>
+ <string name="login_label">Login</string>
+ <string name="master_password_label">Master Password</string>
<string-array name="month_array">
<item>Jan</item>
<item>Feb</item>
@@ -111,4 +114,4 @@
<item>user-2</item>
</string-array>
-</resources>
+</resources> \ No newline at end of file