Skip to content
This repository has been archived by the owner on Sep 17, 2019. It is now read-only.

Commit

Permalink
Autofill sample updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
Douglas Sigelbaum committed Jan 22, 2018
1 parent 818a579 commit 16625cf
Show file tree
Hide file tree
Showing 96 changed files with 5,661 additions and 2,386 deletions.
2 changes: 1 addition & 1 deletion Application/Application.iml
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/check-manifest" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes-jar" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaPrecompile" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/prebuild" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ public void onClick(View v) {
findViewById(R.id.clearButton).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getSystemService(AutofillManager.class).cancel();
AutofillManager afm = getSystemService(AutofillManager.class);
if (afm != null) {
afm.cancel();
}
resetFields();
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ public void onClick(View v) {
findViewById(R.id.clearButton).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getSystemService(AutofillManager.class).cancel();
AutofillManager afm = getSystemService(AutofillManager.class);
if (afm != null) {
afm.cancel();
}
resetFields();
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ public void onClick(View v) {
findViewById(R.id.clear).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getSystemService(AutofillManager.class).cancel();
AutofillManager afm = getSystemService(AutofillManager.class);
if (afm != null) {
afm.cancel();
}
resetFields();
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ public void onClick(View v) {
mClearButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AutofillManager afm = getSystemService(AutofillManager.class);
if (afm != null) {
afm.cancel();
}
resetFields();
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.autofill.AutofillManager;
import android.widget.EditText;
import android.widget.Toast;

Expand Down Expand Up @@ -47,6 +48,10 @@ public void onClick(View v) {
findViewById(R.id.clear).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AutofillManager afm = getSystemService(AutofillManager.class);
if (afm != null) {
afm.cancel();
}
resetFields();
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ public void onClick(View v) {
findViewById(R.id.clearButton).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getSystemService(AutofillManager.class).cancel();
AutofillManager afm = getSystemService(AutofillManager.class);
if (afm != null) {
afm.cancel();
}
resetFields();
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ public void onClick(View v) {
findViewById(R.id.clearButton).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getSystemService(AutofillManager.class).cancel();
AutofillManager afm = getSystemService(AutofillManager.class);
if (afm != null) {
afm.cancel();
}
resetFields();
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package com.example.android.autofill.app.edgecases;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
Expand Down Expand Up @@ -48,19 +47,14 @@ public class MultiplePartitionsActivity extends AppCompatActivity {

private ScrollableCustomVirtualView mCustomVirtualView;
private AutofillManager mAutofillManager;

private CustomVirtualView.Partition mCredentialsPartition;
private CustomVirtualView.Partition mCcPartition;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

setContentView(R.layout.multiple_partitions_activity);

mCustomVirtualView = findViewById(R.id.custom_view);


mCredentialsPartition =
mCustomVirtualView.addPartition(getString(R.string.partition_credentials));
mCredentialsPartition.addLine("username", View.AUTOFILL_TYPE_TEXT,
Expand All @@ -69,7 +63,6 @@ protected void onCreate(Bundle savedInstanceState) {
mCredentialsPartition.addLine("password", View.AUTOFILL_TYPE_TEXT,
getString(R.string.password_label),
" ", true, View.AUTOFILL_HINT_PASSWORD);

int ccExpirationType = View.AUTOFILL_TYPE_DATE;
// TODO: add a checkbox to switch between text / date instead
Intent intent = getIntent();
Expand All @@ -83,7 +76,6 @@ protected void onCreate(Bundle savedInstanceState) {
Toast.makeText(getApplicationContext(), typeMessage, Toast.LENGTH_LONG).show();
}
}

mCcPartition = mCustomVirtualView.addPartition(getString(R.string.partition_credit_card));
mCcPartition.addLine("ccNumber", View.AUTOFILL_TYPE_TEXT,
getString(R.string.credit_card_number_label),
Expand All @@ -103,7 +95,7 @@ protected void onCreate(Bundle savedInstanceState) {
mCcPartition.addLine("ccSecurityCode", View.AUTOFILL_TYPE_TEXT,
getString(R.string.credit_card_security_code_label),
" ", true, View.AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE);

mAutofillManager = getSystemService(AutofillManager.class);
findViewById(R.id.clear).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Expand All @@ -112,7 +104,6 @@ public void onClick(View view) {
mAutofillManager.cancel();
}
});
mAutofillManager = getSystemService(AutofillManager.class);
}

private void resetFields() {
Expand Down
4 changes: 3 additions & 1 deletion Application/src/main/res/layout/fragment_edge_cases.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
app:labelText="@string/navigation_button_anti_pattern_credit_card_label"
app:destinationActivityName="com.example.android.autofill.app.edgecases.CreditCardAntiPatternActivity"/>

<!--TODO finish multistep impl and show this item-->
<com.example.android.autofill.app.view.widget.NavigationItem
android:id="@+id/multistepSignInButton"
android:layout_width="match_parent"
Expand All @@ -77,6 +78,7 @@
app:labelText="@string/navigation_button_multistep_signin_label"
app:destinationActivityName="com.example.android.autofill.app.edgecases.MultipleStepsSignInActivity"/>

<!--TODO finish multistep impl and show this item-->
<com.example.android.autofill.app.view.widget.NavigationItem
android:id="@+id/multistepCreditCardButton"
android:layout_width="match_parent"
Expand All @@ -87,4 +89,4 @@
app:labelText="@string/navigation_button_multistep_cc_label"
app:destinationActivityName="com.example.android.autofill.app.edgecases.MultipleStepsCreditCardActivity"/>
</LinearLayout>
</ScrollView>
</ScrollView>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
-->
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down
2 changes: 1 addition & 1 deletion NOTICE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

This sample uses the following software:

Copyright 2017 The Android Open Source Project
Copyright 2018 The Android Open Source Project

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ Pre-requisites
--------------

- Android SDK 26
- Android Build Tools v26.0.1
- Android Build Tools v26.0.2
- Android Support Repository

Screenshots
Expand Down
1 change: 0 additions & 1 deletion _config.yml

This file was deleted.

39 changes: 31 additions & 8 deletions afservice/afservice.iml
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/check-manifest" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes-jar" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaPrecompile" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/prebuild" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
Expand All @@ -107,28 +107,51 @@
<orderEntry type="jdk" jdkName="Android API 26 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="com.android.support:support-media-compat-26.1.0" level="project" />
<orderEntry type="library" name="com.android.support:support-compat-26.1.0" level="project" />
<orderEntry type="library" name="com.android.support:recyclerview-v7-26.1.0" level="project" />
<orderEntry type="library" scope="TEST" name="junit:junit:4.12@jar" level="project" />
<orderEntry type="library" name="org.codehaus.mojo:animal-sniffer-annotations:1.14@jar" level="project" />
<orderEntry type="library" name="android.arch.lifecycle:common:1.0.0@jar" level="project" />
<orderEntry type="library" name="android.arch.core:common:1.0.0@jar" level="project" />
<orderEntry type="library" scope="TEST" name="com.android.support.test.espresso:espresso-core-3.0.1" level="project" />
<orderEntry type="library" scope="TEST" name="com.android.support.test.espresso:espresso-contrib-3.0.1" level="project" />
<orderEntry type="library" name="com.android.support:support-fragment-26.1.0" level="project" />
<orderEntry type="library" scope="TEST" name="javax.inject:javax.inject:1@jar" level="project" />
<orderEntry type="library" scope="TEST" name="com.squareup:javawriter:2.1.1@jar" level="project" />
<orderEntry type="library" name="com.android.support:support-vector-drawable-26.1.0" level="project" />
<orderEntry type="library" name="com.android.support:support-v4-26.1.0" level="project" />
<orderEntry type="library" name="com.google.code.gson:gson:2.8.1@jar" level="project" />
<orderEntry type="library" name="android.arch.lifecycle:runtime-1.0.0" level="project" />
<orderEntry type="library" name="com.android.support:appcompat-v7-26.1.0" level="project" />
<orderEntry type="library" name="com.google.code.findbugs:jsr305:1.3.9@jar" level="project" />
<orderEntry type="library" name="com.android.support:animated-vector-drawable-26.1.0" level="project" />
<orderEntry type="library" name="com.android.support:support-annotations:26.1.0@jar" level="project" />
<orderEntry type="library" name="android.arch.persistence.room:runtime-1.0.0" level="project" />
<orderEntry type="library" name="com.google.errorprone:error_prone_annotations:2.0.18@jar" level="project" />
<orderEntry type="library" name="android.arch.persistence:db-1.0.0" level="project" />
<orderEntry type="library" scope="TEST" name="com.android.support.test.espresso.idling:idling-concurrent-3.0.1" level="project" />
<orderEntry type="library" name="com.android.support.constraint:constraint-layout-solver:1.0.2@jar" level="project" />
<orderEntry type="library" name="com.android.support:support-core-utils-26.1.0" level="project" />
<orderEntry type="library" name="com.android.support:design-26.1.0" level="project" />
<orderEntry type="library" name="com.android.support.constraint:constraint-layout-1.0.2" level="project" />
<orderEntry type="library" name="com.android.support:transition-26.1.0" level="project" />
<orderEntry type="library" name="com.android.support:support-core-ui-26.1.0" level="project" />
<orderEntry type="library" name="com.squareup.okio:okio:1.13.0@jar" level="project" />
<orderEntry type="library" scope="TEST" name="com.android.support.test:runner-1.0.1" level="project" />
<orderEntry type="library" scope="TEST" name="com.android.support.test:rules-1.0.1" level="project" />
<orderEntry type="library" name="com.squareup.retrofit2:retrofit:2.3.0@jar" level="project" />
<orderEntry type="library" scope="TEST" name="com.android.support.test.espresso:espresso-intents-3.0.1" level="project" />
<orderEntry type="library" name="com.google.code.findbugs:jsr305:2.0.1@jar" level="project" />
<orderEntry type="library" name="com.android.support.test.espresso:espresso-idling-resource-3.0.1" level="project" />
<orderEntry type="library" scope="TEST" name="org.hamcrest:hamcrest-core:1.3@jar" level="project" />
<orderEntry type="library" name="com.android.support:support-compat-26.1.0" level="project" />
<orderEntry type="library" name="com.squareup.okhttp3:okhttp:3.8.0@jar" level="project" />
<orderEntry type="library" name="android.arch.core:common:1.0.0@jar" level="project" />
<orderEntry type="library" name="android.arch.persistence:db-framework-1.0.0" level="project" />
<orderEntry type="library" scope="TEST" name="org.hamcrest:hamcrest-library:1.3@jar" level="project" />
<orderEntry type="library" scope="TEST" name="org.hamcrest:hamcrest-integration:1.3@jar" level="project" />
<orderEntry type="library" name="com.android.support:support-v4-26.1.0" level="project" />
<orderEntry type="library" scope="TEST" name="net.sf.kxml:kxml2:2.3.0@jar" level="project" />
<orderEntry type="library" name="com.android.support:animated-vector-drawable-26.1.0" level="project" />
<orderEntry type="library" scope="TEST" name="com.google.android.apps.common.testing.accessibility.framework:accessibility-test-framework:2.0@jar" level="project" />
<orderEntry type="library" name="android.arch.persistence.room:common:1.0.0@jar" level="project" />
<orderEntry type="library" name="com.android.support:design-26.1.0" level="project" />
<orderEntry type="library" name="com.android.support:transition-26.1.0" level="project" />
<orderEntry type="library" name="com.google.j2objc:j2objc-annotations:1.1@jar" level="project" />
<orderEntry type="library" name="com.google.guava:guava:22.0-android@jar" level="project" />
<orderEntry type="library" name="android.arch.core:runtime-1.0.0" level="project" />
</component>
</module>
22 changes: 17 additions & 5 deletions afservice/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 26
compileSdkVersion 27

defaultConfig {
minSdkVersion 26
targetSdkVersion 26
targetSdkVersion 27
versionCode 1
versionName "1.0"

Expand All @@ -18,7 +18,7 @@ android {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
Expand All @@ -30,10 +30,22 @@ android {
}

dependencies {
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation "android.arch.persistence.room:runtime:1.0.0"
annotationProcessor 'android.arch.persistence.room:compiler:1.0.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:design:27.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.1'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation group: 'com.google.guava', name: 'guava', version: '22.0-android'
implementation "com.android.support.test.espresso:espresso-idling-resource:3.0.1"
implementation "com.google.code.findbugs:jsr305:2.0.1"

androidTestImplementation "junit:junit:4.12"
androidTestImplementation ("com.android.support.test.espresso:espresso-core:3.0.1")
androidTestImplementation "com.android.support.test.espresso:espresso-contrib:3.0.1"
androidTestImplementation "com.android.support.test.espresso:espresso-intents:3.0.1"
androidTestImplementation "com.android.support.test.espresso.idling:idling-concurrent:3.0.1"

}
3 changes: 3 additions & 0 deletions afservice/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-keep class com.google.common.base.Preconditions { *; }
-keep class android.arch.** { *; }
-keep com.example.android.autofill.service.** { *; }
Loading

0 comments on commit 16625cf

Please sign in to comment.