diff options
18 files changed, 506 insertions, 21 deletions
diff --git a/input/autofill/AutofillFramework/Application/build.gradle b/input/autofill/AutofillFramework/Application/build.gradle index 4a818508..4d556bdc 100644 --- a/input/autofill/AutofillFramework/Application/build.gradle +++ b/input/autofill/AutofillFramework/Application/build.gradle @@ -5,6 +5,7 @@ dependencies { compile "com.android.support:support-v13:26.0.0-beta1" compile "com.android.support:cardview-v7:26.0.0-beta1" compile "com.android.support:appcompat-v7:26.0.0-beta1" + compile 'com.android.support:design:26.0.0-beta1' compile 'com.android.support.constraint:constraint-layout:1.0.2' compile group: 'com.google.code.gson', name: 'gson', version: '2.8.1' } diff --git a/input/autofill/AutofillFramework/Application/src/main/AndroidManifest.xml b/input/autofill/AutofillFramework/Application/src/main/AndroidManifest.xml index 21d33639..f63fb53a 100644 --- a/input/autofill/AutofillFramework/Application/src/main/AndroidManifest.xml +++ b/input/autofill/AutofillFramework/Application/src/main/AndroidManifest.xml @@ -1,5 +1,4 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- +<?xml version="1.0" encoding="UTF-8"?><!-- Copyright 2017 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); @@ -36,21 +35,20 @@ </activity> <activity android:name=".app.StandardSignInActivity" - android:taskAffinity=".StandardSignInActivity"> - </activity> + android:taskAffinity=".StandardSignInActivity" /> <activity android:name=".app.StandardAutoCompleteSignInActivity" android:taskAffinity=".StandardAutoCompleteSignInActivity" /> <activity android:name=".app.VirtualSignInActivity" - android:taskAffinity=".VirtualSignInActivity"> - - </activity> + android:taskAffinity=".VirtualSignInActivity" /> <activity android:name=".app.WelcomeActivity" /> <activity android:name=".app.CreditCardActivity" - android:taskAffinity=".CreditCardActivity"> - </activity> + android:taskAffinity=".CreditCardActivity" /> + <activity + android:name=".app.EmailComposeActivity" + android:taskAffinity=".EmailComposeActivity" /> <!-- Including launcher icon for Autofill Settings to convenience. Not necessary for a real service. @@ -73,8 +71,8 @@ --> <service android:name=".multidatasetservice.MyAutofillService" - android:permission="android.permission.BIND_AUTOFILL" - android:label="Multi-Dataset Autofill Service"> + android:label="Multi-Dataset Autofill Service" + android:permission="android.permission.BIND_AUTOFILL"> <meta-data android:name="android.autofill" android:resource="@xml/multidataset_service" /> diff --git a/input/autofill/AutofillFramework/Application/src/main/java/com/example/android/autofillframework/app/EmailComposeActivity.java b/input/autofill/AutofillFramework/Application/src/main/java/com/example/android/autofillframework/app/EmailComposeActivity.java new file mode 100644 index 00000000..957d7aad --- /dev/null +++ b/input/autofill/AutofillFramework/Application/src/main/java/com/example/android/autofillframework/app/EmailComposeActivity.java @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.example.android.autofillframework.app; + +import android.content.Context; +import android.content.Intent; +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.support.v7.app.AppCompatActivity; +import android.view.View; + +import com.example.android.autofillframework.R; + +public class EmailComposeActivity extends AppCompatActivity { + + public static Intent getStartActivityIntent(Context context) { + Intent intent = new Intent(context, EmailComposeActivity.class); + return intent; + } + + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.email_compose_activity); + findViewById(R.id.sendButton).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + startActivity(WelcomeActivity.getStartActivityIntent(EmailComposeActivity.this)); + finish(); + } + }); + } +} diff --git a/input/autofill/AutofillFramework/Application/src/main/java/com/example/android/autofillframework/app/MainActivity.java b/input/autofill/AutofillFramework/Application/src/main/java/com/example/android/autofillframework/app/MainActivity.java index 16f1bf7c..e8819f14 100644 --- a/input/autofill/AutofillFramework/Application/src/main/java/com/example/android/autofillframework/app/MainActivity.java +++ b/input/autofill/AutofillFramework/Application/src/main/java/com/example/android/autofillframework/app/MainActivity.java @@ -35,6 +35,7 @@ public class MainActivity extends AppCompatActivity { NavigationItem loginCustomVirtual = findViewById(R.id.virtualViewSignInButton); NavigationItem creditCardSpinners = findViewById(R.id.creditCardCheckoutButton); NavigationItem loginAutoComplete = findViewById(R.id.standardLoginWithAutoCompleteButton); + NavigationItem emailCompose = findViewById(R.id.emailComposeButton); loginEditTexts.setNavigationButtonClickListener(new View.OnClickListener() { @Override @@ -60,5 +61,11 @@ public class MainActivity extends AppCompatActivity { startActivity(StandardAutoCompleteSignInActivity.getStartActivityIntent(MainActivity.this)); } }); + emailCompose.setNavigationButtonClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + startActivity(EmailComposeActivity.getStartActivityIntent(MainActivity.this)); + } + }); } }
\ No newline at end of file diff --git a/input/autofill/AutofillFramework/Application/src/main/res/drawable/ic_email_black_24dp.xml b/input/autofill/AutofillFramework/Application/src/main/res/drawable/ic_email_black_24dp.xml new file mode 100644 index 00000000..174c1272 --- /dev/null +++ b/input/autofill/AutofillFramework/Application/src/main/res/drawable/ic_email_black_24dp.xml @@ -0,0 +1,24 @@ +<!-- + * Copyright (C) 2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +--> +<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="M20,4L4,4c-1.1,0 -1.99,0.9 -1.99,2L2,18c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2zM20,8l-8,5 -8,-5L4,6l8,5 8,-5v2z"/> +</vector> diff --git a/input/autofill/AutofillFramework/Application/src/main/res/drawable/ic_send_white_24dp.xml b/input/autofill/AutofillFramework/Application/src/main/res/drawable/ic_send_white_24dp.xml new file mode 100644 index 00000000..f614267a --- /dev/null +++ b/input/autofill/AutofillFramework/Application/src/main/res/drawable/ic_send_white_24dp.xml @@ -0,0 +1,24 @@ +<!-- + * Copyright (C) 2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +--> +<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="#FFFFFFFF" + android:pathData="M2.01,21L23,12 2.01,3 2,10l15,2 -15,2z"/> +</vector> diff --git a/input/autofill/AutofillFramework/Application/src/main/res/layout/activity_main.xml b/input/autofill/AutofillFramework/Application/src/main/res/layout/activity_main.xml index 2043dd1d..b85f6c58 100644 --- a/input/autofill/AutofillFramework/Application/src/main/res/layout/activity_main.xml +++ b/input/autofill/AutofillFramework/Application/src/main/res/layout/activity_main.xml @@ -63,5 +63,14 @@ app:itemLogo="@drawable/ic_spinners_logo_24dp" app:imageColor="@android:color/holo_orange_dark"/> + <com.example.android.autofillframework.app.NavigationItem + android:id="@+id/emailComposeButton" + android:layout_width="match_parent" + android:layout_height="wrap_content" + app:infoText="@string/email_compose_info" + app:labelText="@string/navigation_button_email_compose_label" + app:itemLogo="@drawable/ic_email_black_24dp" + app:imageColor="@android:color/holo_purple"/> + </LinearLayout> </ScrollView>
\ No newline at end of file diff --git a/input/autofill/AutofillFramework/Application/src/main/res/layout/email_compose_activity.xml b/input/autofill/AutofillFramework/Application/src/main/res/layout/email_compose_activity.xml new file mode 100644 index 00000000..0b7519f6 --- /dev/null +++ b/input/autofill/AutofillFramework/Application/src/main/res/layout/email_compose_activity.xml @@ -0,0 +1,123 @@ +<?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"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * 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" + xmlns:app="http://schemas.android.com/apk/res-auto" + 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"> + + + <TextView + android:id="@+id/email_compose_header" + style="@style/TextAppearance.AppCompat.Large" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginTop="@dimen/spacing_normal" + android:gravity="center" + android:text="@string/navigation_button_email_compose_label" + app:layout_constraintEnd_toStartOf="@+id/imageButton" + app:layout_constraintHorizontal_bias="0.5" + app:layout_constraintHorizontal_chainStyle="spread" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <com.example.android.autofillframework.app.InfoButton + android:id="@+id/imageButton" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:background="@drawable/ic_info_black_24dp" + app:dialogText="@string/email_compose_info" + app:layout_constraintBottom_toBottomOf="@+id/email_compose_header" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.5" + app:layout_constraintStart_toEndOf="@+id/email_compose_header" + app:layout_constraintTop_toTopOf="@+id/email_compose_header" /> + + <TextView + android:id="@+id/toLabel" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginBottom="@dimen/spacing_normal" + android:layout_marginEnd="@dimen/spacing_normal" + android:layout_marginStart="@dimen/spacing_normal" + android:layout_marginTop="@dimen/spacing_normal" + android:text="@string/to_label" + app:layout_constraintBottom_toBottomOf="@+id/toText" + app:layout_constraintEnd_toStartOf="@+id/toText" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="@+id/toText" /> + + <EditText + android:id="@+id/toText" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginEnd="@dimen/spacing_normal" + android:layout_marginTop="@dimen/spacing_normal" + android:inputType="textEmailAddress" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="@+id/bodyText" + app:layout_constraintTop_toBottomOf="@+id/email_compose_header" /> + + <TextView + android:id="@+id/bodyLabel" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginEnd="@dimen/spacing_normal" + android:layout_marginStart="@dimen/spacing_normal" + android:text="@string/body_label" + app:layout_constraintEnd_toStartOf="@+id/bodyText" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="@+id/placeholder" + app:layout_constraintBottom_toBottomOf="@+id/placeholder"/> + + <EditText + android:id="@+id/bodyText" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginEnd="@dimen/spacing_normal" + android:layout_marginStart="@dimen/spacing_normal" + android:layout_marginTop="@dimen/spacing_normal" + android:inputType="textMultiLine" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toEndOf="@+id/bodyLabel" + app:layout_constraintTop_toBottomOf="@+id/toText" /> + + <View + android:id="@+id/placeholder" + android:layout_width="match_parent" + android:layout_height="36sp" + app:layout_constraintTop_toTopOf="@+id/bodyText" + app:layout_constraintStart_toStartOf="parent" + android:layout_marginStart="8dp" /> + + <android.support.design.widget.FloatingActionButton + android:id="@+id/sendButton" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginBottom="8dp" + android:layout_marginEnd="8dp" + android:backgroundTint="@android:color/holo_purple" + android:src="@drawable/ic_send_white_24dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" /> + +</android.support.constraint.ConstraintLayout>
\ No newline at end of file diff --git a/input/autofill/AutofillFramework/Application/src/main/res/values/strings.xml b/input/autofill/AutofillFramework/Application/src/main/res/values/strings.xml index 55d96c4c..86ecdb05 100644 --- a/input/autofill/AutofillFramework/Application/src/main/res/values/strings.xml +++ b/input/autofill/AutofillFramework/Application/src/main/res/values/strings.xml @@ -22,9 +22,10 @@ <string name="navigation_button_spinners_credit_card_label">Sample Credit Card Check Out Using Spinners</string> <string name="navigation_button_edittext_login_label">Sample Login Using EditTexts</string> <string name="navigation_button_autocomplete_login_label">Sample Login Using AutoCompleteTextViews</string> + <string name="navigation_button_email_compose_label">Sample Email Compose Using EditTexts</string> <string name="username_label">Username</string> <string name="password_label">Password</string> - <string name="welcome_text">You have successfully signed in!</string> + <string name="welcome_text">Success!</string> <string name="standard_view_sign_in">Sign in using standard views</string> <string name="standard_view_autocomplete_sign_in">Sign in using standard views that trigger AutoComplete dialogs when focused</string> @@ -51,6 +52,8 @@ <string name="settings_auth_change_credentials_title">Change credentials</string> <string name="clear_label">Clear</string> <string name="login_label">Login</string> + <string name="to_label">To</string> + <string name="body_label">Body</string> <string name="autofill_master_login_label">Autofill Master Login</string> <string name="submit_label">Submit</string> <string name="edittext_login_info">This is a sample login page that uses standard EditTexts @@ -73,6 +76,14 @@ In that case, you need to tell the Autofill framework which values in the adapter map to which indices. </string> + <string name="email_compose_info"> + This is a sample email compose page that uses EditTexts to compose the email. Since none of + the fields on the page are important to autofill, it is necessary to set the + android:importantForAutofill XML property appropriately for each View. You can either set it + to "no" on all non-autofillable Views, or set "noExcludeDescendants" + on the root View if all Views in the hierarchy should not be autofilled. In this case, we + did the latter. + </string> <plurals name="welcome_page_countdown"> <item quantity="one">Automatically return to main page in %d second.</item> <item quantity="other">Automatically return to main page in %d seconds.</item> diff --git a/input/autofill/AutofillFramework/kotlinApp/Application/build.gradle b/input/autofill/AutofillFramework/kotlinApp/Application/build.gradle index 236b718a..2207e4e3 100644 --- a/input/autofill/AutofillFramework/kotlinApp/Application/build.gradle +++ b/input/autofill/AutofillFramework/kotlinApp/Application/build.gradle @@ -7,6 +7,7 @@ dependencies { compile "com.android.support:support-v13:26.0.0-beta1" compile 'com.android.support:appcompat-v7:26.0.0-beta1' compile 'com.android.support:cardview-v7:26.0.0-beta1' + compile 'com.android.support:design:26.0.0-beta1' compile 'com.android.support.constraint:constraint-layout:1.0.2' compile 'com.google.code.gson:gson:2.8.1' compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" diff --git a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/AndroidManifest.xml b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/AndroidManifest.xml index 21d33639..4d796e4f 100644 --- a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/AndroidManifest.xml +++ b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/AndroidManifest.xml @@ -1,5 +1,4 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- +<?xml version="1.0" encoding="UTF-8"?><!-- Copyright 2017 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); @@ -36,8 +35,7 @@ </activity> <activity android:name=".app.StandardSignInActivity" - android:taskAffinity=".StandardSignInActivity"> - </activity> + android:taskAffinity=".StandardSignInActivity" /> <activity android:name=".app.StandardAutoCompleteSignInActivity" android:taskAffinity=".StandardAutoCompleteSignInActivity" /> @@ -49,8 +47,10 @@ <activity android:name=".app.WelcomeActivity" /> <activity android:name=".app.CreditCardActivity" - android:taskAffinity=".CreditCardActivity"> - </activity> + android:taskAffinity=".CreditCardActivity" /> + <activity + android:name=".app.EmailComposeActivity" + android:taskAffinity=".EmailComposeActivity" /> <!-- Including launcher icon for Autofill Settings to convenience. Not necessary for a real service. @@ -73,8 +73,8 @@ --> <service android:name=".multidatasetservice.MyAutofillService" - android:permission="android.permission.BIND_AUTOFILL" - android:label="Multi-Dataset Autofill Service"> + android:label="Multi-Dataset Autofill Service" + android:permission="android.permission.BIND_AUTOFILL"> <meta-data android:name="android.autofill" android:resource="@xml/multidataset_service" /> diff --git a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/app/EmailComposeActivity.kt b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/app/EmailComposeActivity.kt new file mode 100644 index 00000000..7b23b611 --- /dev/null +++ b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/app/EmailComposeActivity.kt @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.example.android.autofillframework.app + +import android.content.Context +import android.content.Intent +import android.os.Bundle +import android.support.v7.app.AppCompatActivity +import com.example.android.autofillframework.R +import kotlinx.android.synthetic.main.email_compose_activity.sendButton + +class EmailComposeActivity : AppCompatActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.email_compose_activity) + sendButton.setOnClickListener { + startActivity(WelcomeActivity.getStartActivityIntent(this@EmailComposeActivity)) + finish() + } + } + + companion object { + + fun getStartActivityIntent(context: Context): Intent { + val intent = Intent(context, EmailComposeActivity::class.java) + return intent + } + } +} diff --git a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/app/MainActivity.kt b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/app/MainActivity.kt index 3ab4f389..d251369d 100644 --- a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/app/MainActivity.kt +++ b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/app/MainActivity.kt @@ -20,6 +20,7 @@ import android.support.v7.app.AppCompatActivity import android.view.View import com.example.android.autofillframework.R import kotlinx.android.synthetic.main.activity_main.creditCardCheckoutButton +import kotlinx.android.synthetic.main.activity_main.emailComposeButton import kotlinx.android.synthetic.main.activity_main.standardLoginWithAutoCompleteButton import kotlinx.android.synthetic.main.activity_main.standardViewSignInButton import kotlinx.android.synthetic.main.activity_main.virtualViewSignInButton @@ -36,6 +37,7 @@ class MainActivity : AppCompatActivity() { virtualViewSignInButton.setNavigationButtonClickListener(View.OnClickListener { virtualViewSignIn() }) creditCardCheckoutButton.setNavigationButtonClickListener(View.OnClickListener { creditCardCheckout() }) standardLoginWithAutoCompleteButton.setNavigationButtonClickListener(View.OnClickListener { standardAutoCompleteSignIn() }) + emailComposeButton.setNavigationButtonClickListener(View.OnClickListener { emailCompose() }) } private fun creditCardCheckout() { @@ -57,4 +59,9 @@ class MainActivity : AppCompatActivity() { val intent = VirtualSignInActivity.getStartActivityIntent(this) startActivity(intent) } + + private fun emailCompose() { + val intent = EmailComposeActivity.getStartActivityIntent(this) + startActivity(intent) + } }
\ No newline at end of file diff --git a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/drawable/ic_email_black_24dp.xml b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/drawable/ic_email_black_24dp.xml new file mode 100644 index 00000000..174c1272 --- /dev/null +++ b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/drawable/ic_email_black_24dp.xml @@ -0,0 +1,24 @@ +<!-- + * Copyright (C) 2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +--> +<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="M20,4L4,4c-1.1,0 -1.99,0.9 -1.99,2L2,18c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2zM20,8l-8,5 -8,-5L4,6l8,5 8,-5v2z"/> +</vector> diff --git a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/drawable/ic_send_white_24dp.xml b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/drawable/ic_send_white_24dp.xml new file mode 100644 index 00000000..f614267a --- /dev/null +++ b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/drawable/ic_send_white_24dp.xml @@ -0,0 +1,24 @@ +<!-- + * Copyright (C) 2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +--> +<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="#FFFFFFFF" + android:pathData="M2.01,21L23,12 2.01,3 2,10l15,2 -15,2z"/> +</vector> diff --git a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/layout/activity_main.xml b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/layout/activity_main.xml index 2043dd1d..b85f6c58 100644 --- a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/layout/activity_main.xml +++ b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/layout/activity_main.xml @@ -63,5 +63,14 @@ app:itemLogo="@drawable/ic_spinners_logo_24dp" app:imageColor="@android:color/holo_orange_dark"/> + <com.example.android.autofillframework.app.NavigationItem + android:id="@+id/emailComposeButton" + android:layout_width="match_parent" + android:layout_height="wrap_content" + app:infoText="@string/email_compose_info" + app:labelText="@string/navigation_button_email_compose_label" + app:itemLogo="@drawable/ic_email_black_24dp" + app:imageColor="@android:color/holo_purple"/> + </LinearLayout> </ScrollView>
\ No newline at end of file diff --git a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/layout/email_compose_activity.xml b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/layout/email_compose_activity.xml new file mode 100644 index 00000000..0b7519f6 --- /dev/null +++ b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/res/layout/email_compose_activity.xml @@ -0,0 +1,123 @@ +<?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"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * 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" + xmlns:app="http://schemas.android.com/apk/res-auto" + 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"> + + + <TextView + android:id="@+id/email_compose_header" + style="@style/TextAppearance.AppCompat.Large" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginTop="@dimen/spacing_normal" + android:gravity="center" + android:text="@string/navigation_button_email_compose_label" + app:layout_constraintEnd_toStartOf="@+id/imageButton" + app:layout_constraintHorizontal_bias="0.5" + app:layout_constraintHorizontal_chainStyle="spread" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <com.example.android.autofillframework.app.InfoButton + android:id="@+id/imageButton" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:background="@drawable/ic_info_black_24dp" + app:dialogText="@string/email_compose_info" + app:layout_constraintBottom_toBottomOf="@+id/email_compose_header" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.5" + app:layout_constraintStart_toEndOf="@+id/email_compose_header" + app:layout_constraintTop_toTopOf="@+id/email_compose_header" /> + + <TextView + android:id="@+id/toLabel" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginBottom="@dimen/spacing_normal" + android:layout_marginEnd="@dimen/spacing_normal" + android:layout_marginStart="@dimen/spacing_normal" + android:layout_marginTop="@dimen/spacing_normal" + android:text="@string/to_label" + app:layout_constraintBottom_toBottomOf="@+id/toText" + app:layout_constraintEnd_toStartOf="@+id/toText" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="@+id/toText" /> + + <EditText + android:id="@+id/toText" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginEnd="@dimen/spacing_normal" + android:layout_marginTop="@dimen/spacing_normal" + android:inputType="textEmailAddress" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="@+id/bodyText" + app:layout_constraintTop_toBottomOf="@+id/email_compose_header" /> + + <TextView + android:id="@+id/bodyLabel" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginEnd="@dimen/spacing_normal" + android:layout_marginStart="@dimen/spacing_normal" + android:text="@string/body_label" + app:layout_constraintEnd_toStartOf="@+id/bodyText" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="@+id/placeholder" + app:layout_constraintBottom_toBottomOf="@+id/placeholder"/> + + <EditText + android:id="@+id/bodyText" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginEnd="@dimen/spacing_normal" + android:layout_marginStart="@dimen/spacing_normal" + android:layout_marginTop="@dimen/spacing_normal" + android:inputType="textMultiLine" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toEndOf="@+id/bodyLabel" + app:layout_constraintTop_toBottomOf="@+id/toText" /> + + <View + android:id="@+id/placeholder" + android:layout_width="match_parent" + android:layout_height="36sp" + app:layout_constraintTop_toTopOf="@+id/bodyText" + app:layout_constraintStart_toStartOf="parent" + android:layout_marginStart="8dp" /> + + <android.support.design.widget.FloatingActionButton + android:id="@+id/sendButton" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginBottom="8dp" + android:layout_marginEnd="8dp" + android:backgroundTint="@android:color/holo_purple" + android:src="@drawable/ic_send_white_24dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" /> + +</android.support.constraint.ConstraintLayout>
\ 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 55d96c4c..86ecdb05 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 @@ -22,9 +22,10 @@ <string name="navigation_button_spinners_credit_card_label">Sample Credit Card Check Out Using Spinners</string> <string name="navigation_button_edittext_login_label">Sample Login Using EditTexts</string> <string name="navigation_button_autocomplete_login_label">Sample Login Using AutoCompleteTextViews</string> + <string name="navigation_button_email_compose_label">Sample Email Compose Using EditTexts</string> <string name="username_label">Username</string> <string name="password_label">Password</string> - <string name="welcome_text">You have successfully signed in!</string> + <string name="welcome_text">Success!</string> <string name="standard_view_sign_in">Sign in using standard views</string> <string name="standard_view_autocomplete_sign_in">Sign in using standard views that trigger AutoComplete dialogs when focused</string> @@ -51,6 +52,8 @@ <string name="settings_auth_change_credentials_title">Change credentials</string> <string name="clear_label">Clear</string> <string name="login_label">Login</string> + <string name="to_label">To</string> + <string name="body_label">Body</string> <string name="autofill_master_login_label">Autofill Master Login</string> <string name="submit_label">Submit</string> <string name="edittext_login_info">This is a sample login page that uses standard EditTexts @@ -73,6 +76,14 @@ In that case, you need to tell the Autofill framework which values in the adapter map to which indices. </string> + <string name="email_compose_info"> + This is a sample email compose page that uses EditTexts to compose the email. Since none of + the fields on the page are important to autofill, it is necessary to set the + android:importantForAutofill XML property appropriately for each View. You can either set it + to "no" on all non-autofillable Views, or set "noExcludeDescendants" + on the root View if all Views in the hierarchy should not be autofilled. In this case, we + did the latter. + </string> <plurals name="welcome_page_countdown"> <item quantity="one">Automatically return to main page in %d second.</item> <item quantity="other">Automatically return to main page in %d seconds.</item> |