Skip to content

Commit 2eb8050

Browse files
SUPERCILEXsamtstern
authored andcommitted
Add full support for Android O and update deps (#850)
1 parent 5d5440d commit 2eb8050

27 files changed

+130
-88
lines changed

app/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ dependencies {
4242
compile "com.google.firebase:firebase-database:$firebaseVersion"
4343
compile "com.google.firebase:firebase-storage:$firebaseVersion"
4444

45-
compile('com.facebook.android:facebook-android-sdk:4.23.0')
45+
compile('com.facebook.android:facebook-android-sdk:4.25.0')
4646
compile("com.twitter.sdk.android:twitter-core:3.0.0@aar") { transitive = true }
4747

4848
// The following dependencies are not required to use the Firebase UI library.
4949
// They are used to make some aspects of the demo app implementation simpler for
5050
// demonstrative purposes, and you may find them useful in your own apps; YMMV.
51-
compile 'pub.devrel:easypermissions:0.4.2'
52-
compile 'com.jakewharton:butterknife:8.5.1'
53-
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
51+
compile 'pub.devrel:easypermissions:0.4.3'
52+
compile 'com.jakewharton:butterknife:8.7.0'
53+
annotationProcessor 'com.jakewharton:butterknife-compiler:8.7.0'
5454
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5'
5555
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
5656
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'

auth/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ dependencies {
5050
compile "com.google.firebase:firebase-auth:$firebaseVersion"
5151
compile "com.google.android.gms:play-services-auth:$firebaseVersion"
5252

53-
provided 'com.facebook.android:facebook-android-sdk:4.23.0'
53+
provided 'com.facebook.android:facebook-android-sdk:4.25.0'
5454
provided("com.twitter.sdk.android:twitter-core:3.0.0@aar") { transitive = true }
5555

5656
// The following libraries are needed to prevent incompatibilities with the facebook
@@ -61,7 +61,7 @@ dependencies {
6161
//noinspection GradleDynamicVersion
6262
testCompile 'org.mockito:mockito-core:2.8.+'
6363
testCompile 'org.robolectric:robolectric:3.4'
64-
testCompile 'com.facebook.android:facebook-android-sdk:4.23.0'
64+
testCompile 'com.facebook.android:facebook-android-sdk:4.25.0'
6565
}
6666

6767
javadoc.exclude([

auth/src/main/java/com/firebase/ui/auth/AuthUI.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
import com.google.firebase.auth.PhoneAuthProvider;
4848
import com.google.firebase.auth.TwitterAuthProvider;
4949

50+
import java.lang.annotation.Retention;
51+
import java.lang.annotation.RetentionPolicy;
5052
import java.util.ArrayList;
5153
import java.util.Arrays;
5254
import java.util.Collections;
@@ -73,6 +75,7 @@ public class AuthUI {
7375
FacebookAuthProvider.PROVIDER_ID, FACEBOOK_PROVIDER,
7476
TwitterAuthProvider.PROVIDER_ID, TWITTER_PROVIDER
7577
})
78+
@Retention(RetentionPolicy.SOURCE)
7679
public @interface SupportedProvider {}
7780

7881
/**

auth/src/main/java/com/firebase/ui/auth/ui/accountlink/WelcomeBackPasswordPrompt.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ protected void onCreate(Bundle savedInstanceState) {
8888
mIdpResponse = IdpResponse.fromResultIntent(getIntent());
8989
mEmail = mIdpResponse.getEmail();
9090

91-
mPasswordLayout = (TextInputLayout) findViewById(R.id.password_layout);
92-
mPasswordField = (EditText) findViewById(R.id.password);
91+
mPasswordLayout = findViewById(R.id.password_layout);
92+
mPasswordField = findViewById(R.id.password);
9393

9494
ImeHelper.setImeOnDoneListener(mPasswordField, this);
9595

@@ -103,7 +103,7 @@ protected void onCreate(Bundle savedInstanceState) {
103103
emailStart + mEmail.length(),
104104
Spannable.SPAN_INCLUSIVE_INCLUSIVE);
105105

106-
TextView bodyTextView = ((TextView) findViewById(R.id.welcome_back_password_body));
106+
TextView bodyTextView = findViewById(R.id.welcome_back_password_body);
107107
bodyTextView.setText(spannableStringBuilder);
108108

109109
// Click listeners

auth/src/main/java/com/firebase/ui/auth/ui/email/CheckEmailFragment.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package com.firebase.ui.auth.ui.email;
22

3+
import android.annotation.SuppressLint;
34
import android.app.PendingIntent;
45
import android.content.Intent;
56
import android.content.IntentSender;
67
import android.net.Uri;
8+
import android.os.Build;
79
import android.os.Bundle;
810
import android.support.annotation.NonNull;
911
import android.support.annotation.Nullable;
@@ -94,6 +96,7 @@ public static CheckEmailFragment newInstance(@NonNull FlowParameters flowParamet
9496
return fragment;
9597
}
9698

99+
@SuppressLint("NewApi") // TODO remove once lint understands Build.VERSION_CODES.O
97100
@Nullable
98101
@Override
99102
public View onCreateView(LayoutInflater inflater,
@@ -102,14 +105,18 @@ public View onCreateView(LayoutInflater inflater,
102105
View v = inflater.inflate(R.layout.fui_check_email_layout, container, false);
103106

104107
// Email field and validator
105-
mEmailLayout = (TextInputLayout) v.findViewById(R.id.email_layout);
106-
mEmailEditText = (EditText) v.findViewById(R.id.email);
108+
mEmailLayout = v.findViewById(R.id.email_layout);
109+
mEmailEditText = v.findViewById(R.id.email);
107110
mEmailFieldValidator = new EmailFieldValidator(mEmailLayout);
108111
mEmailLayout.setOnClickListener(this);
109112
mEmailEditText.setOnClickListener(this);
110113

111114
ImeHelper.setImeOnDoneListener(mEmailEditText, this);
112115

116+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && getFlowParams().enableHints) {
117+
mEmailEditText.setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_NO);
118+
}
119+
113120
// "Next" button
114121
v.findViewById(R.id.button_next).setOnClickListener(this);
115122

auth/src/main/java/com/firebase/ui/auth/ui/email/RecoverPasswordActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ protected void onCreate(Bundle savedInstanceState) {
5656

5757
mEmailFieldValidator =
5858
new EmailFieldValidator((TextInputLayout) findViewById(R.id.email_layout));
59-
mEmailEditText = (EditText) findViewById(R.id.email);
59+
mEmailEditText = findViewById(R.id.email);
6060

6161
String email = getIntent().getStringExtra(ExtraConstants.EXTRA_EMAIL);
6262
if (email != null) {

auth/src/main/java/com/firebase/ui/auth/ui/email/RecoveryEmailSentDialog.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public void onDismiss(DialogInterface anInterface) {
4343
.show();
4444
}
4545

46-
public void finish(int resultCode, Intent resultIntent) {
46+
private void finish(int resultCode, Intent resultIntent) {
4747
getActivity().setResult(resultCode, resultIntent);
4848
getActivity().finish();
4949
}

auth/src/main/java/com/firebase/ui/auth/ui/email/RegisterEmailActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public void onNewUser(User user) {
115115
// New user, direct them to create an account with email/password
116116
// if account creation is enabled in SignInIntentBuilder
117117

118-
TextInputLayout emailLayout = (TextInputLayout) findViewById(R.id.email_layout);
118+
TextInputLayout emailLayout = findViewById(R.id.email_layout);
119119

120120
if (getFlowParams().allowNewEmailAccounts) {
121121
RegisterEmailFragment fragment = RegisterEmailFragment.newInstance(

auth/src/main/java/com/firebase/ui/auth/ui/email/RegisterEmailFragment.java

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.firebase.ui.auth.ui.email;
22

3+
import android.annotation.SuppressLint;
4+
import android.os.Build;
35
import android.os.Bundle;
46
import android.support.annotation.NonNull;
57
import android.support.annotation.Nullable;
@@ -88,6 +90,7 @@ public void onCreate(@Nullable Bundle savedInstanceState) {
8890
}
8991
}
9092

93+
@SuppressLint("NewApi") // TODO remove once lint understands Build.VERSION_CODES.O
9194
@Nullable
9295
@Override
9396
public View onCreateView(LayoutInflater inflater,
@@ -96,12 +99,12 @@ public View onCreateView(LayoutInflater inflater,
9699

97100
View v = inflater.inflate(R.layout.fui_register_email_layout, container, false);
98101

99-
mEmailEditText = (EditText) v.findViewById(R.id.email);
100-
mNameEditText = (EditText) v.findViewById(R.id.name);
101-
mPasswordEditText = (EditText) v.findViewById(R.id.password);
102-
mAgreementText = (TextView) v.findViewById(R.id.create_account_text);
103-
mEmailInput = (TextInputLayout) v.findViewById(R.id.email_layout);
104-
mPasswordInput = (TextInputLayout) v.findViewById(R.id.password_layout);
102+
mEmailEditText = v.findViewById(R.id.email);
103+
mNameEditText = v.findViewById(R.id.name);
104+
mPasswordEditText = v.findViewById(R.id.password);
105+
mAgreementText = v.findViewById(R.id.create_account_text);
106+
mEmailInput = v.findViewById(R.id.email_layout);
107+
mPasswordInput = v.findViewById(R.id.password_layout);
105108

106109
mPasswordFieldValidator = new PasswordFieldValidator(
107110
mPasswordInput,
@@ -117,6 +120,10 @@ public View onCreateView(LayoutInflater inflater,
117120
mPasswordEditText.setOnFocusChangeListener(this);
118121
v.findViewById(R.id.button_create).setOnClickListener(this);
119122

123+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && getFlowParams().enableCredentials) {
124+
mEmailEditText.setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_NO);
125+
}
126+
120127
if (savedInstanceState != null) {
121128
return v;
122129
}

auth/src/main/java/com/firebase/ui/auth/ui/idp/AuthMethodPickerActivity.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,14 @@ protected void onCreate(Bundle savedInstanceState) {
8383
if (logoId == AuthUI.NO_LOGO) {
8484
findViewById(R.id.logo).setVisibility(View.GONE);
8585

86-
ConstraintLayout layout = (ConstraintLayout) findViewById(R.id.root);
86+
ConstraintLayout layout = findViewById(R.id.root);
8787
ConstraintSet constraints = new ConstraintSet();
8888
constraints.clone(layout);
8989
constraints.setHorizontalBias(R.id.container, 0.5f);
9090
constraints.setVerticalBias(R.id.container, 0.5f);
9191
constraints.applyTo(layout);
9292
} else {
93-
ImageView logo = (ImageView) findViewById(R.id.logo);
93+
ImageView logo = findViewById(R.id.logo);
9494
logo.setImageResource(logoId);
9595
}
9696
}
@@ -121,7 +121,7 @@ private void populateIdpList(List<IdpConfig> providers) {
121121
}
122122
}
123123

124-
ViewGroup btnHolder = (ViewGroup) findViewById(R.id.btn_holder);
124+
ViewGroup btnHolder = findViewById(R.id.btn_holder);
125125
for (final Provider provider : mProviders) {
126126
View loginButton = getLayoutInflater()
127127
.inflate(provider.getButtonLayout(), btnHolder, false);

0 commit comments

Comments
 (0)