Skip to content

Commit 886bcae

Browse files
authored
Merge pull request #2 from wordpress-mobile/add-checkstyle
Add Checkstyle and shared IDEA configs
2 parents 36cb089 + 155d7b5 commit 886bcae

File tree

11 files changed

+40
-40
lines changed

11 files changed

+40
-40
lines changed

libs/login/src/main/java/org/wordpress/android/login/Login2FaFragment.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ public class Login2FaFragment extends LoginBaseFormFragment<LoginListener> imple
5050

5151
public static final String TAG = "login_2fa_fragment_tag";
5252

53+
private static final Pattern TWO_STEP_AUTH_CODE = Pattern.compile("^[0-9]{6}");
54+
5355
private WPLoginInputRow m2FaInput;
5456

5557
private @StringRes int mInProgressMessageId;
@@ -201,7 +203,6 @@ private String getAuthCodeFromClipboard() {
201203
&& clipboard.getPrimaryClip().getItemAt(0).getText() != null) {
202204
String code = clipboard.getPrimaryClip().getItemAt(0).getText().toString();
203205

204-
final Pattern TWO_STEP_AUTH_CODE = Pattern.compile("^[0-9]{6}");
205206
final Matcher twoStepAuthCodeMatcher = TWO_STEP_AUTH_CODE.matcher("");
206207
twoStepAuthCodeMatcher.reset(code);
207208

@@ -214,7 +215,7 @@ private String getAuthCodeFromClipboard() {
214215
}
215216

216217
@Override
217-
public void OnEditorCommit() {
218+
public void onEditorCommit() {
218219
next();
219220
}
220221

libs/login/src/main/java/org/wordpress/android/login/LoginBaseFormFragment.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
import javax.inject.Inject;
4444

4545
public abstract class LoginBaseFormFragment<LoginListenerType> extends Fragment implements TextWatcher {
46-
4746
private static final String KEY_IN_PROGRESS = "KEY_IN_PROGRESS";
4847
private static final String KEY_LOGIN_FINISHED = "KEY_LOGIN_FINISHED";
4948

@@ -93,9 +92,9 @@ public void onCreate(Bundle savedInstanceState) {
9392

9493
protected ViewGroup createMainView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
9594
ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.login_form_screen, container, false);
96-
ViewStub form_container = ((ViewStub) rootView.findViewById(R.id.login_form_content_stub));
97-
form_container.setLayoutResource(getContentLayout());
98-
form_container.inflate();
95+
ViewStub formContainer = ((ViewStub) rootView.findViewById(R.id.login_form_content_stub));
96+
formContainer.setLayoutResource(getContentLayout());
97+
formContainer.inflate();
9998
return rootView;
10099
}
101100

libs/login/src/main/java/org/wordpress/android/login/LoginEmailFragment.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ protected void setupLabel(TextView label) {
7777
protected void setupContent(ViewGroup rootView) {
7878
mEmailInput = (WPLoginInputRow) rootView.findViewById(R.id.login_email_row);
7979
if (BuildConfig.DEBUG) {
80-
mEmailInput.getEditText().setText(BuildConfig.DEBUG_DOTCOM_LOGIN_EMAIL);
80+
mEmailInput.getEditText().setText(BuildConfig.DEBUG_WPCOM_LOGIN_EMAIL);
8181
}
8282
mEmailInput.addTextChangedListener(this);
8383
mEmailInput.setOnEditorCommitListener(this);
@@ -185,7 +185,7 @@ private boolean isValidEmail(String email) {
185185
}
186186

187187
@Override
188-
public void OnEditorCommit() {
188+
public void onEditorCommit() {
189189
next(getCleanedEmail());
190190
}
191191

libs/login/src/main/java/org/wordpress/android/login/LoginEmailPasswordFragment.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public void onActivityCreated(@Nullable Bundle savedInstanceState) {
146146
mPasswordInput.setText(mPassword);
147147
} else {
148148
if (BuildConfig.DEBUG) {
149-
mPasswordInput.getEditText().setText(BuildConfig.DEBUG_DOTCOM_LOGIN_PASSWORD);
149+
mPasswordInput.getEditText().setText(BuildConfig.DEBUG_WPCOM_LOGIN_PASSWORD);
150150
}
151151
}
152152
} else {
@@ -178,7 +178,7 @@ protected void next() {
178178
}
179179

180180
@Override
181-
public void OnEditorCommit() {
181+
public void onEditorCommit() {
182182
mPasswordInput.setError(null);
183183
next();
184184
}

libs/login/src/main/java/org/wordpress/android/login/LoginHttpAuthDialogFragment.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ public void onClick(DialogInterface dialog, int whichButton) {
8787

8888
// update the Next button when username edit box changes
8989
usernameEditText.addTextChangedListener(new TextWatcher() {
90-
@Override public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
91-
@Override public void onTextChanged(CharSequence s, int start, int before, int count) {}
90+
@Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { }
91+
@Override public void onTextChanged(CharSequence s, int start, int before, int count) { }
9292

9393
@Override
9494
public void afterTextChanged(Editable s) {

libs/login/src/main/java/org/wordpress/android/login/LoginListener.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ interface SelfSignedSSLCallback {
4949
void helpFindingSiteAddress(String username, SiteStore siteStore);
5050

5151
// Login username password callbacks
52-
void saveCredentials(@NonNull final String username, @NonNull final String password,
53-
@NonNull final String displayName, @Nullable final Uri profilePicture);
52+
void saveCredentials(@NonNull String username, @NonNull String password,
53+
@NonNull String displayName, @Nullable Uri profilePicture);
5454
void loggedInViaUsernamePassword(ArrayList<Integer> oldSitesIds);
5555
void helpUsernamePassword(String url, String username, boolean isWpcom);
5656

libs/login/src/main/java/org/wordpress/android/login/LoginSiteAddressFragment.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
import org.wordpress.android.fluxc.network.MemorizingTrustManager;
2828
import org.wordpress.android.fluxc.network.discovery.SelfHostedEndpointFinder.DiscoveryError;
2929
import org.wordpress.android.fluxc.store.AccountStore;
30-
import org.wordpress.android.fluxc.store.SiteStore;
30+
import org.wordpress.android.fluxc.store.AccountStore.OnDiscoveryResponse;
31+
import org.wordpress.android.fluxc.store.SiteStore.OnWPComSiteFetched;
3132
import org.wordpress.android.login.util.SiteUtils;
3233
import org.wordpress.android.login.widgets.WPLoginInputRow;
3334
import org.wordpress.android.login.widgets.WPLoginInputRow.OnEditorCommitListener;
@@ -56,7 +57,7 @@ public class LoginSiteAddressFragment extends LoginBaseFormFragment<LoginListene
5657
private static final String MISSING_XMLRPC_METHOD_HELPSHIFT_FAQ_ID = "11";
5758

5859
private static final String NO_SITE_HELPSHIFT_FAQ_SECTION = "10";
59-
private static final String NO_SITE_HELPSHIFT_FAQ_ID = "2"; //using the same as in INVALID URL
60+
private static final String NO_SITE_HELPSHIFT_FAQ_ID = "2"; // Using the same as in INVALID URL
6061

6162
private WPLoginInputRow mSiteAddressInput;
6263

@@ -171,7 +172,7 @@ private String getCleanedSiteAddress() {
171172
}
172173

173174
@Override
174-
public void OnEditorCommit() {
175+
public void onEditorCommit() {
175176
discover();
176177
}
177178

@@ -270,7 +271,7 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
270271

271272
@SuppressWarnings("unused")
272273
@Subscribe(threadMode = ThreadMode.MAIN)
273-
public void OnWPComSiteFetched(SiteStore.OnWPComSiteFetched event) {
274+
public void onWPComSiteFetched(OnWPComSiteFetched event) {
274275
if (mRequestedSiteAddress == null) {
275276
// bail if user canceled
276277
return;
@@ -302,7 +303,7 @@ public void OnWPComSiteFetched(SiteStore.OnWPComSiteFetched event) {
302303

303304
@SuppressWarnings("unused")
304305
@Subscribe(threadMode = ThreadMode.MAIN)
305-
public void onDiscoverySucceeded(AccountStore.OnDiscoveryResponse event) {
306+
public void onDiscoverySucceeded(OnDiscoveryResponse event) {
306307
if (mRequestedSiteAddress == null) {
307308
// bail if user canceled
308309
return;
@@ -339,7 +340,8 @@ public void onDiscoverySucceeded(AccountStore.OnDiscoveryResponse event) {
339340

340341
return;
341342
} else {
342-
AppLog.e(T.API, "onDiscoveryResponse has error: " + event.error.name() + " - " + event.error.toString());
343+
AppLog.e(T.API, "onDiscoveryResponse has error: " + event.error.name()
344+
+ " - " + event.error.toString());
343345
handleDiscoveryError(event.error, event.failedEndpoint);
344346
return;
345347
}

libs/login/src/main/java/org/wordpress/android/login/LoginUsernamePasswordFragment.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,12 @@ protected void setupContent(ViewGroup rootView) {
139139
mUsernameInput = (WPLoginInputRow) rootView.findViewById(R.id.login_username_row);
140140
mUsernameInput.setText(mInputUsername);
141141
if (BuildConfig.DEBUG) {
142-
mUsernameInput.getEditText().setText(BuildConfig.DEBUG_DOTCOM_LOGIN_USERNAME);
142+
mUsernameInput.getEditText().setText(BuildConfig.DEBUG_WPCOM_LOGIN_USERNAME);
143143
}
144144
mUsernameInput.addTextChangedListener(this);
145145
mUsernameInput.setOnEditorCommitListener(new OnEditorCommitListener() {
146146
@Override
147-
public void OnEditorCommit() {
147+
public void onEditorCommit() {
148148
showError(null);
149149
mPasswordInput.getEditText().requestFocus();
150150
}
@@ -153,7 +153,7 @@ public void OnEditorCommit() {
153153
mPasswordInput = (WPLoginInputRow) rootView.findViewById(R.id.login_password_row);
154154
mPasswordInput.setText(mInputPassword);
155155
if (BuildConfig.DEBUG) {
156-
mPasswordInput.getEditText().setText(BuildConfig.DEBUG_DOTCOM_LOGIN_PASSWORD);
156+
mPasswordInput.getEditText().setText(BuildConfig.DEBUG_WPCOM_LOGIN_PASSWORD);
157157
}
158158
mPasswordInput.addTextChangedListener(this);
159159

@@ -287,7 +287,7 @@ private String getCleanedUsername() {
287287
}
288288

289289
@Override
290-
public void OnEditorCommit() {
290+
public void onEditorCommit() {
291291
showError(null);
292292
next();
293293
}
@@ -313,7 +313,7 @@ private void showError(String errorMessage) {
313313
mPasswordInput.post(new Runnable() {
314314
@Override
315315
public void run() {
316-
Rect rect = new Rect(); //coordinates to scroll to
316+
Rect rect = new Rect(); // Coordinates to scroll to
317317
mPasswordInput.getHitRect(rect);
318318
mScrollView.requestChildRectangleOnScreen(mPasswordInput, rect, false);
319319
}
@@ -374,8 +374,8 @@ public void onAuthenticationChanged(AccountStore.OnAuthenticationChanged event)
374374
}
375375

376376
mAuthFailed = true;
377-
AppLog.e(T.API, "Login with username/pass onAuthenticationChanged has error: " + event.error.type + " - " +
378-
event.error.message);
377+
AppLog.e(T.API, "Login with username/pass onAuthenticationChanged has error: " + event.error.type
378+
+ " - " + event.error.message);
379379
AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_FAILED, event.getClass().getSimpleName(),
380380
event.error.type.toString(), event.error.message);
381381

@@ -430,8 +430,8 @@ public void onSiteChanged(SiteStore.OnSiteChanged event) {
430430
errorMessage = getString(R.string.login_error_while_adding_site, event.error.type.toString());
431431
}
432432

433-
AppLog.e(T.API, "Login with username/pass onSiteChanged has error: " + event.error.type + " - " +
434-
errorMessage);
433+
AppLog.e(T.API, "Login with username/pass onSiteChanged has error: " + event.error.type
434+
+ " - " + errorMessage);
435435

436436
if (!mAuthFailed) {
437437
// show the error if not already displayed in onAuthenticationChanged (like in username/pass error)

libs/login/src/main/java/org/wordpress/android/login/widgets/WPLoginInputRow.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@
2828
* Compound view composed of an icon and an EditText
2929
*/
3030
public class WPLoginInputRow extends RelativeLayout {
31-
3231
public interface OnEditorCommitListener {
33-
void OnEditorCommit();
32+
void onEditorCommit();
3433
}
3534

3635
private ImageView mIcon;
@@ -87,7 +86,6 @@ private void init(Context context, AttributeSet attrs) {
8786
if (a.hasValue(R.styleable.wpLoginInputRow_passwordToggleEnabled)) {
8887
mTextInputLayout.setPasswordVisibilityToggleEnabled(
8988
a.getBoolean(R.styleable.wpLoginInputRow_passwordToggleEnabled, false));
90-
9189
}
9290

9391
if (a.hasValue(R.styleable.wpLoginInputRow_passwordToggleTint)) {
@@ -156,8 +154,8 @@ protected Parcelable onSaveInstanceState() {
156154

157155
@Override
158156
protected void onRestoreInstanceState(Parcelable state) {
159-
//begin boilerplate code so parent classes can restore state
160-
if(!(state instanceof SavedState)) {
157+
// Begin boilerplate code so parent classes can restore state
158+
if (!(state instanceof SavedState)) {
161159
super.onRestoreInstanceState(state);
162160
return;
163161
}
@@ -178,12 +176,12 @@ public void setOnEditorCommitListener(final OnEditorCommitListener listener) {
178176
mEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
179177
@Override
180178
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
181-
if (actionId == EditorInfo.IME_ACTION_DONE ||
182-
actionId == EditorInfo.IME_ACTION_NEXT ||
183-
(event != null
179+
if (actionId == EditorInfo.IME_ACTION_DONE
180+
|| actionId == EditorInfo.IME_ACTION_NEXT
181+
|| (event != null
184182
&& event.getAction() == KeyEvent.ACTION_UP
185183
&& event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) {
186-
listener.OnEditorCommit();
184+
listener.onEditorCommit();
187185
}
188186

189187
// always consume the event so the focus stays in the EditText

libs/login/src/main/res/values/colors.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<color name="light_gray">@color/grey_lighten_30</color>
2121
<color name="gray">@color/grey_lighten_20</color>
2222
<color name="white">#FFFFFF</color>
23-
<color name="white_dotorg_back">#F1F1F1</color>
23+
<color name="white_self_hosted_back">#F1F1F1</color>
2424
<!-- note that black should NOT be used for text - use grey_dark instead -->
2525
<color name="black">#000000</color>
2626
<color name="default_background">@color/grey_lighten_30</color>

0 commit comments

Comments
 (0)