Skip to content

Commit 47c1a6c

Browse files
committed
Fix all lint and checkstyle violations
Change-Id: I5ff1752f718b91602020147a91fe56691b09318f
1 parent aa63079 commit 47c1a6c

25 files changed

+67
-43
lines changed

auth/src/main/AndroidManifest.xml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<manifest
22
xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
34
package="com.firebase.ui.auth">
45

56
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
@@ -63,11 +64,13 @@
6364
<activity
6465
android:name="com.facebook.FacebookActivity"
6566
android:label="@string/app_name"
66-
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"/>
67+
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
68+
tools:ignore="MissingRegistered" />
6769

6870
<activity
6971
android:name="com.facebook.CustomTabActivity"
70-
android:exported="true">
72+
android:exported="true"
73+
tools:ignore="MissingRegistered">
7174
<intent-filter>
7275
<action android:name="android.intent.action.VIEW"/>
7376

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ public T setAvailableProviders(@NonNull List<IdpConfig> idpConfigs) {
451451
mProviders.add(config);
452452
}
453453

454-
if(config.getProviderId().equals(FACEBOOK_PROVIDER)) {
454+
if (config.getProviderId().equals(FACEBOOK_PROVIDER)) {
455455
try {
456456
Class c = com.facebook.FacebookCallback.class;
457457
} catch (NoClassDefFoundError e) {
@@ -461,7 +461,7 @@ public T setAvailableProviders(@NonNull List<IdpConfig> idpConfigs) {
461461
}
462462
}
463463

464-
if(config.getProviderId().equals(TWITTER_PROVIDER)) {
464+
if (config.getProviderId().equals(TWITTER_PROVIDER)) {
465465
try {
466466
Class c = com.twitter.sdk.android.core.TwitterCore.class;
467467
} catch (NoClassDefFoundError e) {

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ public void onSuccess(AuthResult result) {
158158
result.getUser()
159159
.linkWithCredential(mPrevCredential)
160160
.addOnFailureListener(new TaskFailureLogger(
161-
TAG, "Error signing in with previous credential " + idpResponse.getProviderType()))
161+
TAG, "Error signing in with previous credential " +
162+
idpResponse.getProviderType()))
162163
.addOnCompleteListener(new FinishListener(idpResponse));
163164
} else {
164165
finish(ResultCodes.OK, idpResponse.toIntent());
@@ -172,12 +173,14 @@ public void onFailure(@NonNull Exception e) {
172173
}
173174
})
174175
.addOnFailureListener(
175-
new TaskFailureLogger(TAG, "Error signing in with new credential " + idpResponse.getProviderType()));
176+
new TaskFailureLogger(TAG, "Error signing in with new credential " +
177+
idpResponse.getProviderType()));
176178
} else {
177179
currentUser
178180
.linkWithCredential(newCredential)
179181
.addOnFailureListener(
180-
new TaskFailureLogger(TAG, "Error linking with credential " + idpResponse.getProviderType()))
182+
new TaskFailureLogger(TAG, "Error linking with credential " +
183+
idpResponse.getProviderType()))
181184
.addOnCompleteListener(new FinishListener(idpResponse));
182185
}
183186
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,8 @@ public void onSuccess(AuthResult authResult) {
169169
authResult.getUser()
170170
.linkWithCredential(authCredential)
171171
.addOnFailureListener(new TaskFailureLogger(
172-
TAG, "Error signing in with credential " + authCredential.getProvider()))
172+
TAG, "Error signing in with credential " +
173+
authCredential.getProvider()))
173174
.addOnSuccessListener(new OnSuccessListener<AuthResult>() {
174175
@Override
175176
public void onSuccess(AuthResult authResult) {

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@
4343
* Host Activities should implement {@link CheckEmailListener}.
4444
*/
4545
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
46-
public class CheckEmailFragment extends FragmentBase implements View.OnClickListener, ImeHelper.DonePressedListener {
46+
public class CheckEmailFragment extends FragmentBase implements
47+
View.OnClickListener,
48+
ImeHelper.DonePressedListener {
49+
4750
/**
4851
* Interface to be implemented by Activities hosting this Fragment.
4952
*/

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,11 @@ public void onSuccess(String provider) {
271271
.show();
272272

273273
if (provider == null) {
274-
throw new IllegalStateException(
275-
"User has no providers even though we got a FirebaseAuthUserCollisionException");
274+
String msg =
275+
"User has no providers even though " +
276+
"we got a " +
277+
"FirebaseAuthUserCollisionException";
278+
throw new IllegalStateException(msg);
276279
} else if (EmailAuthProvider.PROVIDER_ID.equalsIgnoreCase(
277280
provider)) {
278281
getActivity().startActivityForResult(

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@ public void onSuccess(final IdpResponse response) {
152152
mActivityHelper.getFirebaseAuth()
153153
.signInWithCredential(credential)
154154
.addOnFailureListener(
155-
new TaskFailureLogger(TAG, "Firebase sign in with credential " + credential.getProvider() + " unsuccessful. Visit https://console.firebase.google.com to enable it."))
155+
new TaskFailureLogger(TAG, "Firebase sign in with credential "
156+
+ credential.getProvider() + " unsuccessful. " +
157+
"Visit https://console.firebase.google.com to enable it."))
156158
.addOnCompleteListener(new CredentialSignInHandler(
157159
this,
158160
mActivityHelper,

auth/src/main/java/com/firebase/ui/auth/ui/phone/BucketedTextChangeListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,4 @@ interface ContentChangeCallback {
122122
*/
123123
void whileIncomplete();
124124
}
125-
}
125+
}

auth/src/main/java/com/firebase/ui/auth/ui/phone/CompletableProgressDialog.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
import com.firebase.ui.auth.R;
2626

27-
final public class CompletableProgressDialog extends ProgressDialog {
27+
public final class CompletableProgressDialog extends ProgressDialog {
2828
private ProgressBar mProgress;
2929
private TextView mMessageView;
3030
private CharSequence mMessage;
@@ -71,4 +71,4 @@ public void setMessage(CharSequence message) {
7171
mMessage = message;
7272
}
7373
}
74-
}
74+
}

auth/src/main/java/com/firebase/ui/auth/ui/phone/CountryListAdapter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
* Array adapter used to display a list of countries with section indices.
3434
*/
3535
final class CountryListAdapter extends ArrayAdapter<CountryInfo> implements SectionIndexer {
36-
final private HashMap<String, Integer> alphaIndex = new LinkedHashMap<>();
37-
final private HashMap<String, Integer> countryPosition = new LinkedHashMap<>();
36+
private final HashMap<String, Integer> alphaIndex = new LinkedHashMap<>();
37+
private final HashMap<String, Integer> countryPosition = new LinkedHashMap<>();
3838
private String[] sections;
3939

4040
public CountryListAdapter(Context context) {
@@ -96,4 +96,4 @@ public int getPositionForCountry(String country) {
9696
final Integer position = countryPosition.get(country);
9797
return position == null ? 0 : position;
9898
}
99-
}
99+
}

auth/src/main/java/com/firebase/ui/auth/ui/phone/CountryListLoadTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
// We need to move away from ListView and AsyncTask in the future and use (say)
2929
// RecyclerView and Task/ThreadPoolExecutor .
3030
final class CountryListLoadTask extends AsyncTask<Void, Void, List<CountryInfo>> {
31-
private final static int MAX_COUNTRIES = 291;
31+
private static final int MAX_COUNTRIES = 291;
3232

3333
private final Listener listener;
3434

auth/src/main/java/com/firebase/ui/auth/ui/phone/CountryListSpinner.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,4 +182,4 @@ public static void hideKeyboard(Context context, View view) {
182182
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
183183
}
184184
}
185-
}
185+
}

auth/src/main/java/com/firebase/ui/auth/ui/phone/PhoneNumberUtils.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@
3333
import java.util.concurrent.ConcurrentHashMap;
3434

3535
final class PhoneNumberUtils {
36-
private final static int DEFAULT_COUNTRY_CODE_INT = 1;
37-
private final static String DEFAULT_COUNTRY_CODE = String.valueOf(DEFAULT_COUNTRY_CODE_INT);
38-
private final static Locale DEFAULT_LOCALE = Locale.US;
39-
private final static CountryInfo DEFAULT_COUNTRY =
36+
private static final int DEFAULT_COUNTRY_CODE_INT = 1;
37+
private static final String DEFAULT_COUNTRY_CODE = String.valueOf(DEFAULT_COUNTRY_CODE_INT);
38+
private static final Locale DEFAULT_LOCALE = Locale.US;
39+
private static final CountryInfo DEFAULT_COUNTRY =
4040
new CountryInfo(DEFAULT_LOCALE, DEFAULT_COUNTRY_CODE_INT);
4141

42-
private final static int MAX_COUNTRIES = 291;
43-
private final static int MAX_COUNTRY_CODES = 286;
42+
private static final int MAX_COUNTRIES = 291;
43+
private static final int MAX_COUNTRY_CODES = 286;
4444
private static final int MAX_LENGTH_COUNTRY_CODE = 3;
4545

4646
private static final Map<Integer, List<String>> CountryCodeToRegionCodeMap;
@@ -77,7 +77,7 @@ static String formatPhoneNumber(@NonNull String phoneNumber, @NonNull CountryInf
7777

7878
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
7979
return android.telephony.PhoneNumberUtils
80-
.formatNumberToE164(phoneNumber,countryInfo.locale.getCountry());
80+
.formatNumberToE164(phoneNumber, countryInfo.locale.getCountry());
8181
}
8282
return phoneNumber.startsWith("+")
8383
? phoneNumber
@@ -1075,7 +1075,7 @@ private static Map<Integer, List<String>> createCountryCodeToRegionCodeMap() {
10751075
return countryCodeToRegionCodeMap;
10761076
}
10771077

1078-
private synchronized static Map<String, Integer> createCountryCodeByIsoMap() {
1078+
private static synchronized Map<String, Integer> createCountryCodeByIsoMap() {
10791079
final Map<String, Integer> countryCodeByIso = new HashMap<>(MAX_COUNTRIES);
10801080
countryCodeByIso.put("AF", 93);
10811081
countryCodeByIso.put("AX", 358);

auth/src/main/java/com/firebase/ui/auth/ui/phone/SpacedEditText.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
* spaces using spannables.
3434
* This is required since Android's letter spacing is not available until API 21.
3535
*/
36-
final public class SpacedEditText extends android.support.v7.widget.AppCompatEditText {
36+
public final class SpacedEditText extends android.support.v7.widget.AppCompatEditText {
3737
private float proportion;
3838
private SpannableStringBuilder originalText;
3939

@@ -105,4 +105,4 @@ private SpannableStringBuilder getSpacedOutString(CharSequence text) {
105105
public Editable getUnspacedText() {
106106
return this.originalText;
107107
}
108-
}
108+
}

auth/src/main/java/com/firebase/ui/auth/ui/phone/SubmitConfirmationCodeFragment.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,12 @@
4040
*/
4141
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
4242
public class SubmitConfirmationCodeFragment extends FragmentBase {
43-
private static long RESEND_WAIT_MILLIS = 15000;
43+
4444
public static final String TAG = "SubmitConfirmationCodeFragment";
4545

46+
private static final long RESEND_WAIT_MILLIS = 15000;
47+
private static final String EXTRA_MILLIS_UNTIL_FINISHED = "EXTRA_MILLIS_UNTIL_FINISHED";
48+
4649
TextView mEditPhoneTextView;
4750
TextView mResendCodeTextView;
4851
TextView mCountDownTextView;
@@ -52,7 +55,7 @@ public class SubmitConfirmationCodeFragment extends FragmentBase {
5255
PhoneVerificationActivity mVerifier;
5356
TermsTextView mAgreementText;
5457
long mMillisUntilFinished;
55-
private String EXTRA_MILLIS_UNTIL_FINISHED = "EXTRA_MILLIS_UNTIL_FINISHED";
58+
5659

5760

5861
public static SubmitConfirmationCodeFragment getInstance(FlowParameters flowParameters,
@@ -97,7 +100,8 @@ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
97100
public void onStart() {
98101
super.onStart();
99102
mConfirmationCodeEditText.requestFocus();
100-
InputMethodManager imgr = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
103+
InputMethodManager imgr = (InputMethodManager) getActivity().getSystemService(
104+
Context.INPUT_METHOD_SERVICE);
101105
imgr.showSoftInput(mConfirmationCodeEditText, 0);
102106
}
103107

auth/src/main/java/com/firebase/ui/auth/ui/phone/VerifyPhoneNumberFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
143143
PhoneNumberUtils
144144
.formatPhoneNumberUsingCurrentCountry(unformattedPhone,
145145
getContext());
146-
if(formattedPhone == null) {
146+
if (formattedPhone == null) {
147147
Log.e(TAG, "Unable to normalize phone number from hint selector:"
148148
+ unformattedPhone);
149149
return;

auth/src/main/java/com/firebase/ui/auth/util/GoogleApiHelper.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020
/**
2121
* A {@link Task} based wrapper to get a connect {@link GoogleApiClient}.
2222
*/
23-
public abstract class GoogleApiHelper implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
23+
public abstract class GoogleApiHelper implements
24+
GoogleApiClient.ConnectionCallbacks,
25+
GoogleApiClient.OnConnectionFailedListener {
26+
2427
private static final AtomicInteger SAFE_ID = new AtomicInteger(10);
2528

2629
protected GoogleApiClient mClient;

auth/src/main/java/com/firebase/ui/auth/util/signincontainer/IdpSignInContainer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ public void onSuccess(final IdpResponse response) {
133133
mHelper.getFirebaseAuth()
134134
.signInWithCredential(credential)
135135
.addOnFailureListener(
136-
new TaskFailureLogger(TAG, "Failure authenticating with credential " + credential.getProvider()))
136+
new TaskFailureLogger(TAG, "Failure authenticating with credential " +
137+
credential.getProvider()))
137138
.addOnCompleteListener(new CredentialSignInHandler(
138139
getActivity(),
139140
mHelper,

auth/src/main/java/com/firebase/ui/auth/util/signincontainer/SignInDelegate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import android.support.v4.app.Fragment;
1010
import android.support.v4.app.FragmentActivity;
1111
import android.support.v4.app.FragmentManager;
12-
import android.text.TextUtils ;
12+
import android.text.TextUtils;
1313
import android.util.Log;
1414

1515
import com.firebase.ui.auth.AuthUI;

auth/src/test/java/com/firebase/ui/auth/testhelpers/AutoCompleteTask.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ public Task<TResult> addOnFailureListener(@NonNull Activity activity,
121121

122122
@NonNull
123123
@Override
124-
public <TContinuationResult> Task<TContinuationResult> continueWith(@NonNull Continuation<TResult, TContinuationResult> continuation) {
124+
public <TContinuationResult> Task<TContinuationResult> continueWith(
125+
@NonNull Continuation<TResult, TContinuationResult> continuation) {
125126
try {
126127
return Tasks.forResult(continuation.then(Tasks.forResult(mResult)));
127128
} catch (Exception e) {

auth/src/test/java/com/firebase/ui/auth/testhelpers/BaseHelperShadow.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public BaseHelperShadow() {
4040
if (sSaveSmartLock == null) {
4141
sSaveSmartLock = Mockito.mock(SaveSmartLock.class);
4242
}
43-
if(sPhoneAuthProvider == null) {
43+
if (sPhoneAuthProvider == null) {
4444
sPhoneAuthProvider = Mockito.mock(PhoneAuthProvider.class);
4545
}
4646
}

auth/src/test/java/com/firebase/ui/auth/ui/phone/CountryInfoTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,4 @@ public void testToString() throws Exception {
108108
+ " +" + usCountryInfo.countryCode;
109109
assertEquals(expected.toString(), usCountryInfo.toString());
110110
}
111-
}
111+
}

auth/src/test/java/com/firebase/ui/auth/ui/phone/PhoneNumberTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,4 @@ public void testIsCountryValid() throws Exception {
8383
PhoneTestConstants.US_COUNTRY_CODE);
8484
assertTrue(PhoneNumber.isCountryValid(validPhoneNumber));
8585
}
86-
}
86+
}

auth/src/test/java/com/firebase/ui/auth/ui/phone/SpacedEditTextTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,4 @@ private void testSpacing(String expectedSpacedText, String expectedOriginalText,
130130
}
131131
}
132132

133-
}
133+
}

library/quality/checkstyle.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ page at http://checkstyle.sourceforge.net/config.html -->
109109
<module name="MethodNameCheck">
110110
<!-- Validates identifiers for method names. -->
111111
<metadata name="altname" value="MethodName"/>
112-
<property name="format" value="^[a-z][a-zA-Z0-9]*(_[a-zA-Z0-9]+)*$"/>
112+
<property name="format" value="^(__)?+[a-z][a-zA-Z0-9]*(_[a-zA-Z0-9]+)*(__)?+$"/>
113113
<property name="severity" value="warning"/>
114114
</module>
115115

0 commit comments

Comments
 (0)