Fixes #171 Fix Lint errors/warnings: global, coding style: add missing spaces (#1955)

* Inserted missing spaces between `if` and `(` to improve code style, in line with GSG 4.6.2
This commit is contained in:
Paul Oranje 2018-11-04 15:37:28 +01:00 committed by Adam Jones
parent 0cf2299e49
commit 7b7d17a33b
69 changed files with 126 additions and 126 deletions

View file

@ -33,7 +33,7 @@ public class WelcomeActivity extends BaseActivity {
moreInformation = this.getString(R.string.welcome_help_button_text);
if(getIntent() != null) {
if (getIntent() != null) {
Bundle bundle = getIntent().getExtras();
if (bundle != null) {
isQuiz = bundle.getBoolean("isQuiz");
@ -54,7 +54,7 @@ public class WelcomeActivity extends BaseActivity {
*/
@Override
public void onDestroy() {
if(isQuiz){
if (isQuiz){
Intent i = new Intent(WelcomeActivity.this, QuizActivity.class);
startActivity(i);
}

View file

@ -60,15 +60,15 @@ public class WelcomePagerAdapter extends PagerAdapter {
this.container=container;
LayoutInflater inflater = LayoutInflater.from(container.getContext());
ViewGroup layout = (ViewGroup) inflater.inflate(PAGE_LAYOUTS[position], container, false);
if( BuildConfig.FLAVOR == "beta"){
if (BuildConfig.FLAVOR == "beta") {
TextView textView = layout.findViewById(R.id.welcomeYesButton);
if( textView.getVisibility() != View.VISIBLE){
if (textView.getVisibility() != View.VISIBLE) {
textView.setVisibility(View.VISIBLE);
}
ViewHolder holder = new ViewHolder(layout);
layout.setTag(holder);
if(position == PAGE_FINAL){
if (position == PAGE_FINAL){
TextView moreInfo = layout.findViewById(R.id.welcomeInfo);
moreInfo.setText(Html.fromHtml(WelcomeActivity.moreInformation));
ViewHolder holder1 = new ViewHolder(layout);

View file

@ -185,7 +185,7 @@ public class AchievementsActivity extends NavigationBaseActivity {
* which then calls parseJson when results are fetched
*/
private void setAchievements() {
if(checkAccount()) {
if (checkAccount()) {
compositeDisposable.add(mediaWikiApi
.getAchievements(Objects.requireNonNull(sessionManager.getCurrentAccount()).name)
.subscribeOn(Schedulers.io())
@ -218,7 +218,7 @@ public class AchievementsActivity extends NavigationBaseActivity {
* used to the count of images uploaded by user
*/
private void setUploadCount(Achievements achievements) {
if(checkAccount()) {
if (checkAccount()) {
compositeDisposable.add(mediaWikiApi
.getUploadCount(Objects.requireNonNull(sessionManager.getCurrentAccount()).name)
.subscribeOn(Schedulers.io())
@ -387,7 +387,7 @@ public class AchievementsActivity extends NavigationBaseActivity {
*/
private boolean checkAccount(){
Account currentAccount = sessionManager.getCurrentAccount();
if(currentAccount == null) {
if (currentAccount == null) {
Timber.d("Current account is null");
ViewUtil.showLongToast(this, getResources().getString(R.string.user_not_logged_in));
sessionManager.forceLogin(this);

View file

@ -19,7 +19,7 @@ public class BitmapUtils {
*/
public static BitmapDrawable writeOnDrawable(Bitmap bm, String text, Context context){
Bitmap.Config config = bm.getConfig();
if(config == null){
if (config == null){
config = Bitmap.Config.ARGB_8888;
}
Bitmap bitmap = Bitmap.createBitmap(bm.getWidth(),bm.getHeight(),config);

View file

@ -139,7 +139,7 @@ public class LoginActivity extends AccountAuthenticatorActivity {
.setNegativeButton(R.string.no, (dialog, which) -> dialog.cancel())
.show());
if(BuildConfig.FLAVOR.equals("beta")){
if (BuildConfig.FLAVOR.equals("beta")){
loginCredentials.setText(getString(R.string.login_credential));
} else {
loginCredentials.setVisibility(View.GONE);
@ -381,10 +381,10 @@ public class LoginActivity extends AccountAuthenticatorActivity {
super.onRestoreInstanceState(savedInstanceState);
loginCurrentlyInProgress = savedInstanceState.getBoolean(LOGING_IN, false);
errorMessageShown = savedInstanceState.getBoolean(ERROR_MESSAGE_SHOWN, false);
if(loginCurrentlyInProgress){
if (loginCurrentlyInProgress){
performLogin();
}
if(errorMessageShown){
if (errorMessageShown){
resultantError = savedInstanceState.getString(RESULTANT_ERROR);
handleOtherResults(resultantError);
}
@ -399,7 +399,7 @@ public class LoginActivity extends AccountAuthenticatorActivity {
public void showMessageAndCancelDialog(@StringRes int resId) {
showMessage(resId, R.color.secondaryDarkColor);
if(progressDialog != null){
if (progressDialog != null){
progressDialog.cancel();
}
}

View file

@ -105,7 +105,7 @@ public class BookmarkPicturesFragment extends DaggerFragment {
*/
@SuppressLint("CheckResult")
private void initList() {
if(!NetworkUtils.isInternetConnectionEstablished(getContext())) {
if (!NetworkUtils.isInternetConnectionEstablished(getContext())) {
handleNoInternet();
return;
}
@ -179,7 +179,7 @@ public class BookmarkPicturesFragment extends DaggerFragment {
* @param collection List of new Media to be displayed
*/
private void handleSuccess(List<Media> collection) {
if(collection == null) {
if (collection == null) {
initErrorView();
return;
}
@ -188,7 +188,7 @@ public class BookmarkPicturesFragment extends DaggerFragment {
return;
}
if(gridAdapter == null) {
if (gridAdapter == null) {
setAdapter(collection);
} else {
if (gridAdapter.containsAll(collection)) {

View file

@ -101,7 +101,7 @@ public class CategoryImagesListFragment extends DaggerFragment {
*/
@SuppressLint("CheckResult")
private void initList() {
if(!NetworkUtils.isInternetConnectionEstablished(getContext())) {
if (!NetworkUtils.isInternetConnectionEstablished(getContext())) {
handleNoInternet();
return;
}
@ -208,7 +208,7 @@ public class CategoryImagesListFragment extends DaggerFragment {
*/
@SuppressLint("CheckResult")
private void fetchMoreImages() {
if(!NetworkUtils.isInternetConnectionEstablished(getContext())) {
if (!NetworkUtils.isInternetConnectionEstablished(getContext())) {
handleNoInternet();
return;
}
@ -227,13 +227,13 @@ public class CategoryImagesListFragment extends DaggerFragment {
* @param collection List of new Media to be displayed
*/
private void handleSuccess(List<Media> collection) {
if(collection == null || collection.isEmpty()) {
if (collection == null || collection.isEmpty()) {
initErrorView();
hasMoreImages = false;
return;
}
if(gridAdapter == null) {
if (gridAdapter == null) {
setAdapter(collection);
} else {
if (gridAdapter.containsAll(collection)) {

View file

@ -73,7 +73,7 @@ public class SubCategoryListFragment extends CommonsDaggerSupportFragment {
categoryName = getArguments().getString("categoryName");
isParentCategory = getArguments().getBoolean("isParentCategory");
initSubCategoryList();
if(getActivity().getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT){
if (getActivity().getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT){
categoriesRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
}
else{
@ -91,7 +91,7 @@ public class SubCategoryListFragment extends CommonsDaggerSupportFragment {
*/
public void initSubCategoryList() {
categoriesNotFoundView.setVisibility(GONE);
if(!NetworkUtils.isInternetConnectionEstablished(getContext())) {
if (!NetworkUtils.isInternetConnectionEstablished(getContext())) {
handleNoInternet();
return;
}
@ -118,7 +118,7 @@ public class SubCategoryListFragment extends CommonsDaggerSupportFragment {
* @param subCategoryList
*/
private void handleSuccess(List<String> subCategoryList) {
if(subCategoryList == null || subCategoryList.isEmpty()) {
if (subCategoryList == null || subCategoryList.isEmpty()) {
initEmptyView();
}
else {

View file

@ -147,12 +147,12 @@ public class ContributionsActivity
setTitle(getString(R.string.title_activity_contributions));
if(checkAccount()) {
if (checkAccount()) {
new QuizChecker(this,
sessionManager.getCurrentAccount().name,
mediaWikiApi);
}
if(!BuildConfig.FLAVOR.equalsIgnoreCase("beta")){
if (!BuildConfig.FLAVOR.equalsIgnoreCase("beta")){
setUploadCount();
}
@ -256,7 +256,7 @@ public class ContributionsActivity
((CursorAdapter) contributionsList.getAdapter()).swapCursor(cursor);
}
if(contributionsList.getAdapter().getCount()>0){
if (contributionsList.getAdapter().getCount()>0){
contributionsList.changeEmptyScreen(false);
}
contributionsList.clearSyncMessage();

View file

@ -93,7 +93,7 @@ public class ContributionsListFragment extends CommonsDaggerSupportFragment {
public void setAdapter(ListAdapter adapter) {
this.contributionsList.setAdapter(adapter);
if(BuildConfig.FLAVOR.equalsIgnoreCase("beta")){
if (BuildConfig.FLAVOR.equalsIgnoreCase("beta")){
((ContributionsActivity) getActivity()).betaSetUploadCount(adapter.getCount());
}
}

View file

@ -95,7 +95,7 @@ public class SearchCategoryFragment extends CommonsDaggerSupportFragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_browse_image, container, false);
ButterKnife.bind(this, rootView);
if(getActivity().getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT){
if (getActivity().getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT){
categoriesRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
}
else{
@ -124,7 +124,7 @@ public class SearchCategoryFragment extends CommonsDaggerSupportFragment {
public void updateCategoryList(String query) {
this.query = query;
categoriesNotFoundView.setVisibility(GONE);
if(!NetworkUtils.isInternetConnectionEstablished(getContext())) {
if (!NetworkUtils.isInternetConnectionEstablished(getContext())) {
handleNoInternet();
return;
}
@ -173,7 +173,7 @@ public class SearchCategoryFragment extends CommonsDaggerSupportFragment {
*/
private void handleSuccess(List<String> mediaList) {
queryList = mediaList;
if(mediaList == null || mediaList.isEmpty()) {
if (mediaList == null || mediaList.isEmpty()) {
initErrorView();
}
else {

View file

@ -97,7 +97,7 @@ public class SearchImageFragment extends CommonsDaggerSupportFragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_browse_image, container, false);
ButterKnife.bind(this, rootView);
if(getActivity().getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT){
if (getActivity().getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT){
imagesRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
}
else{
@ -125,10 +125,10 @@ public class SearchImageFragment extends CommonsDaggerSupportFragment {
*/
public void updateImageList(String query) {
this.query = query;
if(imagesNotFoundView != null) {
if (imagesNotFoundView != null) {
imagesNotFoundView.setVisibility(GONE);
}
if(!NetworkUtils.isInternetConnectionEstablished(getContext())) {
if (!NetworkUtils.isInternetConnectionEstablished(getContext())) {
handleNoInternet();
return;
}
@ -182,7 +182,7 @@ public class SearchImageFragment extends CommonsDaggerSupportFragment {
*/
private void handleSuccess(List<Media> mediaList) {
queryList = mediaList;
if(mediaList == null || mediaList.isEmpty()) {
if (mediaList == null || mediaList.isEmpty()) {
initErrorView();
}
else {

View file

@ -16,7 +16,7 @@ public final class LogUtils {
* @return
*/
public static String getLogDirectory(boolean isBeta) {
if(isBeta) {
if (isBeta) {
return Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) + "/logs/beta";
} else {
return Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) + "/logs/prod";

View file

@ -253,7 +253,7 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment {
@Override
protected Boolean doInBackground(Void... voids) {
// Local files have no filename yet
if(media.getFilename() == null) {
if (media.getFilename() == null) {
return Boolean.FALSE;
}
try {
@ -325,7 +325,7 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment {
}
rebuildCatList();
if(media.getCreator() == null || media.getCreator().equals("")) {
if (media.getCreator() == null || media.getCreator().equals("")) {
authorLayout.setVisibility(GONE);
} else {
author.setText(media.getCreator());
@ -339,7 +339,7 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment {
if (!TextUtils.isEmpty(licenseLink(media))) {
openWebBrowser(licenseLink(media));
} else {
if(isCategoryImage) {
if (isCategoryImage) {
Timber.d("Unable to fetch license URL for %s", media.getLicense());
} else {
Toast toast = Toast.makeText(getContext(), getString(R.string.null_url), Toast.LENGTH_SHORT);
@ -414,14 +414,14 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment {
@OnClick(R.id.seeMore)
public void onSeeMoreClicked(){
if(nominatedForDeletion.getVisibility()== VISIBLE) {
if (nominatedForDeletion.getVisibility()== VISIBLE) {
openWebBrowser(media.getFilePageTitle().getMobileUri().toString());
}
}
private void enableDeleteButton(boolean visibility) {
delete.setEnabled(visibility);
if(visibility) {
if (visibility) {
delete.setTextColor(getResources().getColor(R.color.primaryTextColor));
} else {
delete.setTextColor(getResources().getColor(R.color.deleteButtonLight));

View file

@ -99,7 +99,7 @@ public class MediaDetailPagerFragment extends CommonsDaggerSupportFragment imple
pager.setAdapter(adapter);
pager.setCurrentItem(pageNumber, false);
if(getActivity() == null) {
if (getActivity() == null) {
Timber.d("Returning as activity is destroyed!");
return;
}
@ -133,7 +133,7 @@ public class MediaDetailPagerFragment extends CommonsDaggerSupportFragment imple
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if(getActivity() == null) {
if (getActivity() == null) {
Timber.d("Returning as activity is destroyed!");
return true;
}
@ -156,7 +156,7 @@ public class MediaDetailPagerFragment extends CommonsDaggerSupportFragment imple
viewIntent.setAction(ACTION_VIEW);
viewIntent.setData(m.getFilePageTitle().getMobileUri());
//check if web browser available
if(viewIntent.resolveActivity(getActivity().getPackageManager()) != null){
if (viewIntent.resolveActivity(getActivity().getPackageManager()) != null){
startActivity(viewIntent);
} else {
Toast toast = Toast.makeText(getContext(), getString(R.string.no_web_browser), LENGTH_SHORT);
@ -193,7 +193,7 @@ public class MediaDetailPagerFragment extends CommonsDaggerSupportFragment imple
* @param media
*/
private void setWallpaper(Media media) {
if(media.getImageUrl() == null || media.getImageUrl().isEmpty()) {
if (media.getImageUrl() == null || media.getImageUrl().isEmpty()) {
Timber.d("Media URL not present");
return;
}
@ -255,7 +255,7 @@ public class MediaDetailPagerFragment extends CommonsDaggerSupportFragment imple
inflater.inflate(R.menu.fragment_image_detail, menu);
if (pager != null) {
MediaDetailProvider provider = (MediaDetailProvider) getActivity();
if(provider == null) {
if (provider == null) {
return;
}
@ -326,7 +326,7 @@ public class MediaDetailPagerFragment extends CommonsDaggerSupportFragment imple
@Override
public void onPageScrolled(int i, float v, int i2) {
if(getActivity() == null) {
if (getActivity() == null) {
Timber.d("Returning as activity is destroyed!");
return;
}
@ -381,7 +381,7 @@ public class MediaDetailPagerFragment extends CommonsDaggerSupportFragment imple
public Fragment getItem(int i) {
if (i == 0) {
// See bug https://code.google.com/p/android/issues/detail?id=27526
if(getActivity() == null) {
if (getActivity() == null) {
Timber.d("Skipping getItem. Returning as activity is destroyed!");
return null;
}
@ -392,7 +392,7 @@ public class MediaDetailPagerFragment extends CommonsDaggerSupportFragment imple
@Override
public int getCount() {
if(getActivity() == null) {
if (getActivity() == null) {
Timber.d("Skipping getCount. Returning as activity is destroyed!");
return 0;
}

View file

@ -244,9 +244,9 @@ public class ApacheHttpClientMediaWikiApi implements MediaWikiApi {
Timber.d("Central auth token isn't valid. Trying to fetch a fresh token");
api.removeAllCookies();
String loginResultCode = login(AccountUtil.getUserName(context), AccountUtil.getPassword(context));
if(loginResultCode.equals("PASS")) {
if (loginResultCode.equals("PASS")) {
return getCentralAuthToken();
} else if(loginResultCode.equals("2FA")) {
} else if (loginResultCode.equals("2FA")) {
Timber.e("Cannot refresh session for 2FA enabled user. Login required");
} else {
Timber.e("Error occurred in refreshing session. Error code is %s", loginResultCode);

View file

@ -58,7 +58,7 @@ public class CustomMwApi {
}
public String getAuthCookie() {
if(authCookie == null){
if (authCookie == null){
authCookie = "";
List<Cookie> cookies = client.getCookieStore().getCookies();
for(Cookie cookie: cookies) {
@ -102,14 +102,14 @@ public class CustomMwApi {
}
public String getUserID() throws IOException {
if(this.userID == null || this.userID.equals("0")) {
if (this.userID == null || this.userID.equals("0")) {
this.validateLogin();
}
return userID;
}
public String getUserName() throws IOException {
if(this.userID == null || this.userID.equals("0")) {
if (this.userID == null || this.userID.equals("0")) {
this.validateLogin();
}
return userName;
@ -122,7 +122,7 @@ public class CustomMwApi {
String token = tokenData.getString("/api/login/@token");
CustomApiResult confirmData = this.action("login").param("lgname", username).param("lgpassword", password).param("lgtoken", token).post();
String finalResult = confirmData.getString("/api/login/@result");
if(finalResult.equals("Success")) {
if (finalResult.equals("Success")) {
isLoggedIn = true;
}
return finalResult;
@ -149,7 +149,7 @@ public class CustomMwApi {
.data("comment", comment)
.data("filename", filename)
.sendProgressListener(uploadProgressListener);
if(length != -1) {
if (length != -1) {
builder.file("file", filename, file, length);
} else {
builder.file("file", filename, file);

View file

@ -196,10 +196,10 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
// Handle item selection
switch (item.getItemId()) {
case R.id.action_display_list:
if(bottomSheetBehavior.getState()==BottomSheetBehavior.STATE_COLLAPSED || bottomSheetBehavior.getState()==BottomSheetBehavior.STATE_HIDDEN){
if (bottomSheetBehavior.getState()==BottomSheetBehavior.STATE_COLLAPSED || bottomSheetBehavior.getState()==BottomSheetBehavior.STATE_HIDDEN){
bottomSheetBehaviorForDetails.setState(BottomSheetBehavior.STATE_HIDDEN);
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
}else if(bottomSheetBehavior.getState()==BottomSheetBehavior.STATE_EXPANDED){
}else if (bottomSheetBehavior.getState()==BottomSheetBehavior.STATE_EXPANDED){
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
}
@ -356,7 +356,7 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
super.onPause();
// this means that this activity will not be recreated now, user is leaving it
// or the activity is otherwise finishing
if(isFinishing()) {
if (isFinishing()) {
// we will not need this fragment anymore, this may also be a good place to signal
// to the retained fragment object to perform its own cleanup.
removeMapFragment();

View file

@ -281,7 +281,7 @@ public class NearbyMapFragment extends DaggerFragment {
// Make camera to follow user on location change
CameraPosition position ;
if(ViewUtil.isPortrait(getActivity())){
if (ViewUtil.isPortrait(getActivity())){
position = new CameraPosition.Builder()
.target(isBottomListSheetExpanded ?
new LatLng(curMapBoxLatLng.getLatitude()- CAMERA_TARGET_SHIFT_FACTOR_PORTRAIT,
@ -315,7 +315,7 @@ public class NearbyMapFragment extends DaggerFragment {
if (mapboxMap != null && curLatLng != null) {
if (isBottomListSheetExpanded) {
// Make camera to follow user on location change
if(ViewUtil.isPortrait(getActivity())) {
if (ViewUtil.isPortrait(getActivity())) {
position = new CameraPosition.Builder()
.target(new LatLng(curLatLng.getLatitude() - CAMERA_TARGET_SHIFT_FACTOR_PORTRAIT,
curLatLng.getLongitude())) // Sets the new camera target above
@ -416,7 +416,7 @@ public class NearbyMapFragment extends DaggerFragment {
mapView.getMapAsync(mapboxMap -> {
CameraPosition position;
if(ViewUtil.isPortrait(getActivity())){
if (ViewUtil.isPortrait(getActivity())){
position = new CameraPosition.Builder()
.target(isBottomListSheetExpanded ?
new LatLng(curLatLng.getLatitude()- CAMERA_TARGET_SHIFT_FACTOR_PORTRAIT,

View file

@ -85,7 +85,7 @@ public class NotificationActivity extends NavigationBaseActivity {
private void addNotifications() {
Timber.d("Add notifications");
if(mNotificationWorkerFragment == null){
if (mNotificationWorkerFragment == null){
Observable.fromCallable(() -> {
progressBar.setVisibility(View.VISIBLE);
return controller.getNotifications();
@ -115,7 +115,7 @@ public class NotificationActivity extends NavigationBaseActivity {
}
private void setAdapter(List<Notification> notificationList) {
if(notificationList == null || notificationList.isEmpty()) {
if (notificationList == null || notificationList.isEmpty()) {
ViewUtil.showSnackbar(relativeLayout, R.string.no_notifications);
return;
}

View file

@ -193,7 +193,7 @@ public class NotificationUtils {
private static String getNotificationIconUrl(Node document) {
String format = "%s%s";
Node iconUrl = getNode(getModel(document), "iconUrl");
if(iconUrl == null) {
if (iconUrl == null) {
return null;
} else {
String url = iconUrl.getTextContent();

View file

@ -51,7 +51,7 @@ public class QuizActivity extends AppCompatActivity {
*/
@OnClick(R.id.next_button)
public void setNextQuestion(){
if( questionIndex <= quiz.size() && (positiveAnswer.isChecked() || negativeAnswer.isChecked())) {
if ( questionIndex <= quiz.size() && (positiveAnswer.isChecked() || negativeAnswer.isChecked())) {
evaluateScore();
} else if ( !positiveAnswer.isChecked() && !negativeAnswer.isChecked()){
AlertDialog.Builder alert = new AlertDialog.Builder(this);
@ -107,11 +107,11 @@ public class QuizActivity extends AppCompatActivity {
* to evaluate score and check whether answer is correct or wrong
*/
public void evaluateScore() {
if((quiz.get(questionIndex).isAnswer() && positiveAnswer.isChecked()) ||
if ((quiz.get(questionIndex).isAnswer() && positiveAnswer.isChecked()) ||
(!quiz.get(questionIndex).isAnswer() && negativeAnswer.isChecked()) ){
customAlert(getResources().getString(R.string.correct),quiz.get(questionIndex).getAnswerMessage() );
score++;
} else{
} else {
customAlert(getResources().getString(R.string.wrong), quiz.get(questionIndex).getAnswerMessage());
}
}
@ -127,12 +127,12 @@ public class QuizActivity extends AppCompatActivity {
alert.setMessage(Message);
alert.setPositiveButton(R.string.continue_message, (dialog, which) -> {
questionIndex++;
if(questionIndex == quiz.size()){
if (questionIndex == quiz.size()) {
Intent i = new Intent(QuizActivity.this, QuizResultActivity.class);
dialog.dismiss();
i.putExtra("QuizResult",score);
startActivity(i);
}else {
} else {
displayQuestion();
}
});

View file

@ -73,7 +73,7 @@ public class QuizChecker {
*/
private void setTotalUploadCount(int uploadCount) {
totalUploadCount = uploadCount - countPref.getInt(UPLOAD_SHARED_PREFERENCE,0);
if( totalUploadCount < 0){
if ( totalUploadCount < 0){
totalUploadCount = 0;
countPref.edit().putInt(UPLOAD_SHARED_PREFERENCE,0).apply();
}
@ -104,7 +104,7 @@ public class QuizChecker {
*/
private void setRevertParameter(int revertCountFetched) {
revertCount = revertCountFetched - revertPref.getInt(REVERT_SHARED_PREFERENCE,0);
if(revertCount < 0){
if (revertCount < 0){
revertCount = 0;
revertPref.edit().putInt(REVERT_SHARED_PREFERENCE, 0).apply();
}
@ -116,7 +116,7 @@ public class QuizChecker {
* to check whether the criterion to call quiz is satisfied
*/
private void calculateRevertParameter() {
if( revertCount < 0 || totalUploadCount < 0){
if ( revertCount < 0 || totalUploadCount < 0){
revertPref.edit().putInt(REVERT_SHARED_PREFERENCE, 0).apply();
countPref.edit().putInt(UPLOAD_SHARED_PREFERENCE,0).apply();
return;

View file

@ -57,7 +57,7 @@ public class QuizResultActivity extends AppCompatActivity {
ButterKnife.bind(this);
setSupportActionBar(toolbar);
if( getIntent() != null) {
if ( getIntent() != null) {
Bundle extras = getIntent().getExtras();
int score = extras.getInt("QuizResult");
setScore(score);

View file

@ -58,7 +58,7 @@ public class RadioGroupHelper {
*/
View.OnClickListener onClickListener = v -> {
for (CompoundButton rb : radioButtons) {
if(rb != v) rb.setChecked(false);
if (rb != v) rb.setChecked(false);
}
};
}

View file

@ -166,7 +166,7 @@ public class FileUtils {
returnPath = uri.getPath();
}
if(returnPath == null) {
if (returnPath == null) {
//fetching path may fail depending on the source URI and all hope is lost
//so we will create and use a copy of the file, which seems to work
String copyPath = null;

View file

@ -256,7 +256,7 @@ public class MultipleShareActivity extends AuthenticatedActivity
public void onPositiveButtonClicked() {
//If the user is willing to give us the permission
//But had somehow previously choose never ask again, we take him to app settings to manually enable permission
if(null== permissionDeniedResponse){
if (null== permissionDeniedResponse){
//Dexter returned null, lets see if this ever happens
return;
}

View file

@ -662,7 +662,7 @@ public class ShareActivity
public boolean onKeyDown(int keyCode, KeyEvent event) {
switch (keyCode) {
case KeyEvent.KEYCODE_BACK:
if(isZoom) {
if (isZoom) {
onZoomOutFabClicked();
return true;
}

View file

@ -112,7 +112,7 @@ public class UploadController {
Timber.d("Wikidata entity ID received from Share activity is %s", wikiDataEntityId);
//TODO: Modify this to include coords
Account currentAccount = sessionManager.getCurrentAccount();
if(currentAccount == null) {
if (currentAccount == null) {
Timber.d("Current account is null");
ViewUtil.showLongToast(context, context.getString(R.string.user_not_logged_in));
sessionManager.forceLogin(context);

View file

@ -230,7 +230,7 @@ public class UploadService extends HandlerService<Contribution> {
//As the fileInputStream is null there's no point in continuing the upload process
//mwapi.upload accepts a NonNull input stream
if(fileInputStream == null) {
if (fileInputStream == null) {
Timber.d("File not found");
return;
}

View file

@ -62,7 +62,7 @@ public class UrlLicense {
urlLicense.put("zh","https://commons.wikimedia.org/wiki/Commons:Licensing/zh");
}
public String getLicenseUrl ( String language){
if(urlLicense.containsKey(language)) {
if (urlLicense.containsKey(language)) {
return urlLicense.get(language);
} else {
return urlLicense.get("en");

View file

@ -66,7 +66,7 @@ public class FileUtils {
*/
public static boolean checkIfDirectoryExists(String pathToCheck) {
File director = new File(pathToCheck);
if(director.exists() && director.isDirectory()) {
if (director.exists() && director.isDirectory()) {
return true;
} else {
return false;

View file

@ -15,7 +15,7 @@ public class ViewUtil {
public static final String SHOWCASE_VIEW_ID_3 = "SHOWCASE_VIEW_ID_3";
public static void showSnackbar(View view, int messageResourceId) {
if(view.getContext() == null) {
if (view.getContext() == null) {
return;
}
@ -32,7 +32,7 @@ public class ViewUtil {
public static boolean isPortrait(Context context) {
Display orientation = ((Activity)context).getWindowManager().getDefaultDisplay();
if(orientation.getWidth() < orientation.getHeight()){
if (orientation.getWidth() < orientation.getHeight()){
return true;
} else {
return false;

View file

@ -48,12 +48,12 @@ public class WikidataEditService {
* @param fileName
*/
public void createClaimWithLogging(String wikidataEntityId, String fileName) {
if(wikidataEntityId == null) {
if (wikidataEntityId == null) {
Timber.d("Skipping creation of claim as Wikidata entity ID is null");
return;
}
if(fileName == null) {
if (fileName == null) {
Timber.d("Skipping creation of claim as fileName entity ID is null");
return;
}