diff options
14 files changed, 115 insertions, 68 deletions
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 b5611ae1..f9448a74 100644 --- a/input/autofill/AutofillFramework/Application/src/main/res/values/strings.xml +++ b/input/autofill/AutofillFramework/Application/src/main/res/values/strings.xml @@ -16,6 +16,7 @@ --> <resources> + <string name="app_name">Autofill Sample</string> <string name="settings_name">Autofill Settings</string> <string name="username_label">Username</string> <string name="password_label">Password</string> diff --git a/input/autofill/AutofillFramework/build.gradle b/input/autofill/AutofillFramework/build.gradle index b95a8604..4c2ffcb8 100644 --- a/input/autofill/AutofillFramework/build.gradle +++ b/input/autofill/AutofillFramework/build.gradle @@ -1,4 +1,24 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +buildscript { + repositories { + jcenter() + maven { + url 'https://maven.google.com' + } + } + dependencies { + classpath 'com.android.tools.build:gradle:3.0.0-alpha2' + } +} +allprojects { + repositories { + jcenter() + maven { + url 'https://maven.google.com' + } + } +} // BEGIN_EXCLUDE import com.example.android.samples.build.SampleGenPlugin diff --git a/input/autofill/AutofillFramework/gradle/wrapper/gradle-wrapper.properties b/input/autofill/AutofillFramework/gradle/wrapper/gradle-wrapper.properties index 3907cb5b..e54c9fe6 100644 --- a/input/autofill/AutofillFramework/gradle/wrapper/gradle-wrapper.properties +++ b/input/autofill/AutofillFramework/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Apr 10 15:27:10 PDT 2013 +#Tue May 30 16:12:55 PDT 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.4.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-milestone-1-all.zip diff --git a/input/autofill/AutofillFramework/kotlinApp/Application/build.gradle b/input/autofill/AutofillFramework/kotlinApp/Application/build.gradle index bd0cded2..837f2ab6 100644 --- a/input/autofill/AutofillFramework/kotlinApp/Application/build.gradle +++ b/input/autofill/AutofillFramework/kotlinApp/Application/build.gradle @@ -1,32 +1,7 @@ - -buildscript { - repositories { - jcenter() - } - ext.kotlin_version = '1.1.2-3' - dependencies { - classpath 'com.android.tools.build:gradle:2.2.0' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' -repositories { - jcenter() -} - -dependencies { - compile "com.android.support:support-v4:25.0.1" - compile "com.android.support:support-v13:25.0.1" - compile "com.android.support:cardview-v7:25.0.1" - compile "com.android.support:appcompat-v7:25.0.1" - compile 'com.google.code.gson:gson:2.7' - compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" -} - // The sample build uses multiple directories to // keep boilerplate and common code separate from // the main sample code. @@ -36,12 +11,12 @@ List<String> dirs = [ 'template'] // boilerplate code that is generated by the sample template process android { - compileSdkVersion "android-O" - buildToolsVersion "25.0.2" + compileSdkVersion 'android-O' + buildToolsVersion "26.0.0 rc2" defaultConfig { - minSdkVersion "O" - targetSdkVersion "O" + minSdkVersion 'O' + targetSdkVersion 'O' } compileOptions { @@ -61,4 +36,12 @@ android { } + dependencies { + compile "com.android.support:support-v4:26.0.0-beta1" + compile "com.android.support:support-v13:26.0.0-beta1" + compile 'com.android.support:appcompat-v7:26.0.0-beta1' + compile 'com.google.code.gson:gson:2.8.0' + compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" + } + } diff --git a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/app/CreditCardActivity.kt b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/app/CreditCardActivity.kt index 9c4121aa..d804311a 100644 --- a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/app/CreditCardActivity.kt +++ b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/app/CreditCardActivity.kt @@ -21,7 +21,12 @@ import android.os.Bundle import android.support.v7.app.AppCompatActivity import android.widget.ArrayAdapter import com.example.android.autofillframework.R -import kotlinx.android.synthetic.main.credit_card_activity.* +import kotlinx.android.synthetic.main.credit_card_activity.clear +import kotlinx.android.synthetic.main.credit_card_activity.expirationDay +import kotlinx.android.synthetic.main.credit_card_activity.expirationMonth +import kotlinx.android.synthetic.main.credit_card_activity.expirationYear +import kotlinx.android.synthetic.main.credit_card_activity.submit + class CreditCardActivity : AppCompatActivity() { @@ -44,7 +49,7 @@ class CreditCardActivity : AppCompatActivity() { yearAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item) expirationYear.adapter = yearAdapter - submit.setOnClickListener { submit() } + submit.setOnClickListener { submitCcInfo() } clear.setOnClickListener { resetFields() } } @@ -56,7 +61,7 @@ class CreditCardActivity : AppCompatActivity() { * Launches new Activity and finishes, triggering an autofill save request if the user entered * any new data. */ - private fun submit() { + private fun submitCcInfo() { val intent = WelcomeActivity.getStartActivityIntent(this) startActivity(intent) finish() diff --git a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/app/CustomVirtualView.kt b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/app/CustomVirtualView.kt index 193008b5..86dc9b25 100644 --- a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/app/CustomVirtualView.kt +++ b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/app/CustomVirtualView.kt @@ -33,7 +33,7 @@ import android.widget.EditText import android.widget.TextView import com.example.android.autofillframework.CommonUtil.bundleToString import com.example.android.autofillframework.R -import java.util.* +import java.util.Arrays /** diff --git a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/app/LoginActivity.kt b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/app/LoginActivity.kt index bf3fe874..8bdc1c33 100644 --- a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/app/LoginActivity.kt +++ b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/app/LoginActivity.kt @@ -22,7 +22,10 @@ import android.os.Bundle import android.support.v7.app.AppCompatActivity import android.widget.Toast import com.example.android.autofillframework.R -import kotlinx.android.synthetic.main.login_activity.* +import kotlinx.android.synthetic.main.login_activity.clear +import kotlinx.android.synthetic.main.login_activity.login +import kotlinx.android.synthetic.main.login_activity.passwordField +import kotlinx.android.synthetic.main.login_activity.usernameField class LoginActivity : AppCompatActivity() { 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 1f7704ea..1759de25 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 @@ -18,6 +18,9 @@ package com.example.android.autofillframework.app import android.os.Bundle import android.support.v7.app.AppCompatActivity import com.example.android.autofillframework.R +import kotlinx.android.synthetic.main.activity_main.creditCardCheckoutButton +import kotlinx.android.synthetic.main.activity_main.standardViewSignInButton +import kotlinx.android.synthetic.main.activity_main.virtualViewSignInButton /** * This is used to launch sample activities that showcase autofill. @@ -27,9 +30,9 @@ class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) - findViewById(R.id.standardViewSignInButton).setOnClickListener { standardViewSignIn() } - findViewById(R.id.virtualViewSignInButton).setOnClickListener { virtualViewSignIn() } - findViewById(R.id.creditCardCheckoutButton).setOnClickListener { creditCardCheckout() } + standardViewSignInButton.setOnClickListener { standardViewSignIn() } + virtualViewSignInButton.setOnClickListener { virtualViewSignIn() } + creditCardCheckoutButton.setOnClickListener { creditCardCheckout() } } private fun creditCardCheckout() { diff --git a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/app/VirtualLoginActivity.kt b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/app/VirtualLoginActivity.kt index 078e8e21..c6eb721f 100644 --- a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/app/VirtualLoginActivity.kt +++ b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/app/VirtualLoginActivity.kt @@ -21,7 +21,9 @@ import android.os.Bundle import android.support.v7.app.AppCompatActivity import android.widget.Toast import com.example.android.autofillframework.R -import kotlinx.android.synthetic.main.virtual_login_activity.* +import kotlinx.android.synthetic.main.virtual_login_activity.clear +import kotlinx.android.synthetic.main.virtual_login_activity.custom_view +import kotlinx.android.synthetic.main.virtual_login_activity.login class VirtualLoginActivity : AppCompatActivity() { @@ -31,8 +33,8 @@ class VirtualLoginActivity : AppCompatActivity() { setContentView(R.layout.virtual_login_activity) - findViewById(R.id.login).setOnClickListener { login() } - findViewById(R.id.clear).setOnClickListener { resetFields() } + login.setOnClickListener { submitLogin() } + clear.setOnClickListener { resetFields() } } private fun resetFields() { @@ -42,7 +44,7 @@ class VirtualLoginActivity : AppCompatActivity() { /** * Emulates a login action. */ - private fun login() { + private fun submitLogin() { val username = custom_view.usernameText.toString() val password = custom_view.passwordText.toString() val valid = isValidCredentials(username, password) diff --git a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/service/AuthActivity.kt b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/service/AuthActivity.kt index b8c3f8b1..12be45bb 100644 --- a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/service/AuthActivity.kt +++ b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/service/AuthActivity.kt @@ -50,14 +50,14 @@ class AuthActivity : Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.auth_activity) - login.setOnClickListener { login() } + login.setOnClickListener { submitLogin() } cancel.setOnClickListener { onFailure() this@AuthActivity.finish() } } - private fun login() { + private fun submitLogin() { val password = master_password.text if (password.toString() == MyPreferences.getMasterPassword(this@AuthActivity)) { onSuccess() diff --git a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/service/settings/SettingsActivity.kt b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/service/settings/SettingsActivity.kt index cfa9d82f..7179d98b 100644 --- a/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/service/settings/SettingsActivity.kt +++ b/input/autofill/AutofillFramework/kotlinApp/Application/src/main/java/com/example/android/autofillframework/service/settings/SettingsActivity.kt @@ -28,6 +28,18 @@ import android.widget.Switch import android.widget.TextView import com.example.android.autofillframework.R import com.example.android.autofillframework.service.datasource.SharedPrefsAutofillRepository +import kotlinx.android.synthetic.main.settings_activity.settings_auth_credentials_container +import kotlinx.android.synthetic.main.settings_activity.settings_auth_credentials_icon +import kotlinx.android.synthetic.main.settings_activity.settings_auth_credentials_label +import kotlinx.android.synthetic.main.settings_activity.settings_auth_datasets_container +import kotlinx.android.synthetic.main.settings_activity.settings_auth_datasets_label +import kotlinx.android.synthetic.main.settings_activity.settings_auth_datasets_switch +import kotlinx.android.synthetic.main.settings_activity.settings_auth_responses_container +import kotlinx.android.synthetic.main.settings_activity.settings_auth_responses_label +import kotlinx.android.synthetic.main.settings_activity.settings_auth_responses_switch +import kotlinx.android.synthetic.main.settings_activity.settings_clear_data_container +import kotlinx.android.synthetic.main.settings_activity.settings_clear_data_icon +import kotlinx.android.synthetic.main.settings_activity.settings_clear_data_label class SettingsActivity : AppCompatActivity() { @@ -35,28 +47,28 @@ class SettingsActivity : AppCompatActivity() { super.onCreate(savedInstanceState) setContentView(R.layout.settings_activity) - setupSettingsSwitch(R.id.settings_auth_responses_container, - R.id.settings_auth_responses_label, - R.id.settings_auth_responses_switch, + setupSettingsSwitch(settings_auth_responses_container, + settings_auth_responses_label, + settings_auth_responses_switch, MyPreferences.isResponseAuth(this), CompoundButton.OnCheckedChangeListener { compoundButton, b -> MyPreferences.setResponseAuth(this@SettingsActivity, b) }) - setupSettingsSwitch(R.id.settings_auth_datasets_container, - R.id.settings_auth_datasets_label, - R.id.settings_auth_datasets_switch, + setupSettingsSwitch(settings_auth_datasets_container, + settings_auth_datasets_label, + settings_auth_datasets_switch, MyPreferences.isDatasetAuth(this), CompoundButton.OnCheckedChangeListener { compoundButton, b -> MyPreferences.setDatasetAuth(this@SettingsActivity, b) }) - setupSettingsButton(R.id.settings_clear_data_container, - R.id.settings_clear_data_label, - R.id.settings_clear_data_icon, + setupSettingsButton(settings_clear_data_container, + settings_clear_data_label, + settings_clear_data_icon, View.OnClickListener { buildClearDataDialog().show() }) - setupSettingsButton(R.id.settings_auth_credentials_container, - R.id.settings_auth_credentials_label, - R.id.settings_auth_credentials_icon, + setupSettingsButton(settings_auth_credentials_container, + settings_auth_credentials_label, + settings_auth_credentials_icon, View.OnClickListener { MyPreferences.getMasterPassword(this@SettingsActivity)?.let { buildCurrentCredentialsDialog().show() @@ -117,22 +129,18 @@ class SettingsActivity : AppCompatActivity() { .create() } - private fun setupSettingsSwitch(containerId: Int, labelId: Int, switchId: Int, checked: Boolean, + private fun setupSettingsSwitch(container: ViewGroup, switchLabelView: TextView, switchView: Switch, checked: Boolean, checkedChangeListener: CompoundButton.OnCheckedChangeListener) { - val container = findViewById(containerId) as ViewGroup - val switchLabel = (container.findViewById<View>(labelId) as TextView).text.toString() - val switchView = container.findViewById<Switch>(switchId) + val switchLabel = switchLabelView.text.toString() switchView.contentDescription = switchLabel switchView.isChecked = checked container.setOnClickListener { switchView.performClick() } switchView.setOnCheckedChangeListener(checkedChangeListener) } - private fun setupSettingsButton(containerId: Int, labelId: Int, imageViewId: Int, + private fun setupSettingsButton(container: ViewGroup, buttonLabelView: TextView, imageView: ImageView, onClickListener: View.OnClickListener) { - val container = findViewById(containerId) as ViewGroup - val buttonLabel = (container.findViewById<View>(labelId) as TextView).text.toString() - val imageView = container.findViewById<ImageView>(imageViewId) + val buttonLabel = buttonLabelView.text.toString() imageView.contentDescription = buttonLabel container.setOnClickListener(onClickListener) } diff --git a/input/autofill/AutofillFramework/kotlinApp/build.gradle b/input/autofill/AutofillFramework/kotlinApp/build.gradle index e69de29b..c778d8c3 100644 --- a/input/autofill/AutofillFramework/kotlinApp/build.gradle +++ b/input/autofill/AutofillFramework/kotlinApp/build.gradle @@ -0,0 +1,22 @@ +buildscript { + repositories { + jcenter() + maven { + url 'https://maven.google.com' + } + } + ext.kotlin_version = '1.1.2-4' + dependencies { + classpath 'com.android.tools.build:gradle:3.0.0-alpha2' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +allprojects { + repositories { + jcenter() + maven { + url 'https://maven.google.com' + } + } +}
\ No newline at end of file diff --git a/input/autofill/AutofillFramework/kotlinApp/gradle/wrapper/gradle-wrapper.properties b/input/autofill/AutofillFramework/kotlinApp/gradle/wrapper/gradle-wrapper.properties index eaba3011..a780f86e 100644 --- a/input/autofill/AutofillFramework/kotlinApp/gradle/wrapper/gradle-wrapper.properties +++ b/input/autofill/AutofillFramework/kotlinApp/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Apr 10 15:27:10 PDT 2013 +#Tue May 30 14:00:16 PDT 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-milestone-1-all.zip diff --git a/input/autofill/AutofillFramework/template-params.xml b/input/autofill/AutofillFramework/template-params.xml index 44d36fd0..5bac84df 100644 --- a/input/autofill/AutofillFramework/template-params.xml +++ b/input/autofill/AutofillFramework/template-params.xml @@ -37,7 +37,7 @@ </strings> <!-- The basic templates have already been enabled. Uncomment more as desired. --> - <template src="base" /> + <template src="base-build" /> <metadata> <!-- Values: {DRAFT | PUBLISHED | INTERNAL | DEPRECATED | SUPERCEDED} --> |