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

@ -27,4 +27,4 @@ public class FileUtilsTest {
boolean selfOwned = FileUtils.isSelfOwned(InstrumentationRegistry.getTargetContext(), uri); boolean selfOwned = FileUtils.isSelfOwned(InstrumentationRegistry.getTargetContext(), uri);
assertThat(selfOwned, is(false)); assertThat(selfOwned, is(false));
} }
} }

View file

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

View file

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

View file

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

View file

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

View file

@ -22,4 +22,4 @@ public class FeaturedImages {
public int getFeaturedPicturesOnWikimediaCommons() { public int getFeaturedPicturesOnWikimediaCommons() {
return featuredPicturesOnWikimediaCommons; return featuredPicturesOnWikimediaCommons;
} }
} }

View file

@ -61,4 +61,4 @@ public class FeedbackResponse {
public int getImagesEditedBySomeoneElse() { public int getImagesEditedBySomeoneElse() {
return imagesEditedBySomeoneElse; return imagesEditedBySomeoneElse;
} }
} }

View file

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

View file

@ -63,4 +63,4 @@ public class BookmarksPagerAdapter extends FragmentPagerAdapter {
BookmarkPicturesFragment fragment = (BookmarkPicturesFragment)(pages.get(0).getPage()); BookmarkPicturesFragment fragment = (BookmarkPicturesFragment)(pages.get(0).getPage());
fragment.onResume(); fragment.onResume();
} }
} }

View file

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

View file

@ -93,4 +93,4 @@ public class Category {
this.contentUri = contentUri; this.contentUri = contentUri;
} }
} }

View file

@ -26,4 +26,4 @@ public class CategoryImageController {
public List<Media> getCategoryImages(String categoryName) { public List<Media> getCategoryImages(String categoryName) {
return mediaWikiApi.getCategoryImages(categoryName); return mediaWikiApi.getCategoryImages(categoryName);
} }
} }

View file

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

View file

@ -109,4 +109,4 @@ public class GridViewAdapter extends ArrayAdapter {
author.setVisibility(View.GONE); author.setVisibility(View.GONE);
} }
} }
} }

View file

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

View file

@ -121,4 +121,4 @@ public class ThreadPoolService implements Executor {
return new ThreadPoolService(this); return new ThreadPoolService(this);
} }
} }
} }

View file

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

View file

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

View file

@ -182,4 +182,4 @@ public class DeleteTask extends AsyncTask<Void, Integer, Boolean> {
.setPriority(PRIORITY_HIGH); .setPriority(PRIORITY_HIGH);
notificationManager.notify(NOTIFICATION_DELETE, notificationBuilder.build()); notificationManager.notify(NOTIFICATION_DELETE, notificationBuilder.build());
} }
} }

View file

@ -90,4 +90,4 @@ public class ApplicationlessInjection
return instance; return instance;
} }
} }

View file

@ -173,4 +173,4 @@ public class CommonsApplicationModule {
public boolean provideIsBetaVariant() { public boolean provideIsBetaVariant() {
return BuildConfig.FLAVOR.equals("beta"); return BuildConfig.FLAVOR.equals("beta");
} }
} }

View file

@ -40,4 +40,4 @@ public abstract class CommonsDaggerAppCompatActivity extends AppCompatActivity i
activityInjector.inject(this); activityInjector.inject(this);
} }
} }

View file

@ -28,4 +28,4 @@ public abstract class CommonsDaggerBroadcastReceiver extends BroadcastReceiver {
serviceInjector.inject(this); serviceInjector.inject(this);
} }
} }

View file

@ -29,4 +29,4 @@ public abstract class CommonsDaggerContentProvider extends ContentProvider {
serviceInjector.inject(this); serviceInjector.inject(this);
} }
} }

View file

@ -29,4 +29,4 @@ public abstract class CommonsDaggerIntentService extends IntentService {
serviceInjector.inject(this); serviceInjector.inject(this);
} }
} }

View file

@ -28,4 +28,4 @@ public abstract class CommonsDaggerService extends Service {
serviceInjector.inject(this); serviceInjector.inject(this);
} }
} }

View file

@ -62,4 +62,4 @@ public abstract class CommonsDaggerSupportFragment extends Fragment implements H
throw new IllegalArgumentException(String.format("No injector was found for %s", getClass().getCanonicalName())); throw new IllegalArgumentException(String.format("No injector was found for %s", getClass().getCanonicalName()));
} }
} }

View file

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

View file

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

View file

@ -68,4 +68,4 @@ public class RecentSearch {
this.contentUri = contentUri; this.contentUri = contentUri;
} }
} }

View file

@ -42,4 +42,4 @@ public class CommonsLogSender extends LogsSender {
return builder.toString(); return builder.toString();
} }
} }

View file

@ -141,4 +141,4 @@ public class FileLoggingTree extends Timber.DebugTree implements LogLevelSettabl
LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
logger.addAppender(rollingFileAppender); logger.addAppender(rollingFileAppender);
} }
} }

View file

@ -5,4 +5,4 @@ package fr.free.nrw.commons.logging;
*/ */
public interface LogLevelSettableTree { public interface LogLevelSettableTree {
void setLogLevel(int logLevel); void setLogLevel(int logLevel);
} }

View file

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

View file

@ -180,4 +180,4 @@ public abstract class LogsSender implements ReportSender {
zos.flush(); zos.flush();
zos.close(); zos.close();
} }
} }

View file

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

View file

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

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"); Timber.d("Central auth token isn't valid. Trying to fetch a fresh token");
api.removeAllCookies(); api.removeAllCookies();
String loginResultCode = login(AccountUtil.getUserName(context), AccountUtil.getPassword(context)); String loginResultCode = login(AccountUtil.getUserName(context), AccountUtil.getPassword(context));
if(loginResultCode.equals("PASS")) { if (loginResultCode.equals("PASS")) {
return getCentralAuthToken(); return getCentralAuthToken();
} else if(loginResultCode.equals("2FA")) { } else if (loginResultCode.equals("2FA")) {
Timber.e("Cannot refresh session for 2FA enabled user. Login required"); Timber.e("Cannot refresh session for 2FA enabled user. Login required");
} else { } else {
Timber.e("Error occurred in refreshing session. Error code is %s", loginResultCode); Timber.e("Error occurred in refreshing session. Error code is %s", loginResultCode);

View file

@ -117,4 +117,4 @@ public class CustomApiResult {
return null; return null;
} }
} }
} }

View file

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

View file

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

View file

@ -45,4 +45,4 @@ public class NearbyAdapterFactory {
rendererAdapter.notifyDataSetChanged(); rendererAdapter.notifyDataSetChanged();
rendererAdapter.diffUpdate(newPlaceList); rendererAdapter.diffUpdate(newPlaceList);
} }
} }

View file

@ -164,4 +164,4 @@ public class NearbyListFragment extends DaggerFragment {
this.bundleForUpdates = bundleForUpdates; this.bundleForUpdates = bundleForUpdates;
} }
} }

View file

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

View file

@ -100,4 +100,4 @@ public class Sitelinks implements Parcelable {
return new Sitelinks(this); return new Sitelinks(this);
} }
} }
} }

View file

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

View file

@ -24,4 +24,4 @@ public enum NotificationType {
} }
return UNKNOWN; return UNKNOWN;
} }
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -67,4 +67,4 @@ public class SettingsActivity extends NavigationBaseActivity {
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }
} }
} }

View file

@ -97,4 +97,4 @@ public class CompatTextView extends AppCompatTextView {
a.recycle(); a.recycle();
} }
} }
} }

View file

@ -48,4 +48,4 @@ public class HtmlTextView extends AppCompatTextView {
return Html.fromHtml(source); return Html.fromHtml(source);
} }
} }
} }

View file

@ -92,4 +92,4 @@ public class ExistingFileAsync extends AsyncTask<Void, Void, Boolean> {
callback.onResult(Result.NO_DUPLICATE); callback.onResult(Result.NO_DUPLICATE);
} }
} }
} }

View file

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

View file

@ -256,7 +256,7 @@ public class MultipleShareActivity extends AuthenticatedActivity
public void onPositiveButtonClicked() { public void onPositiveButtonClicked() {
//If the user is willing to give us the permission //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 //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 //Dexter returned null, lets see if this ever happens
return; return;
} }
@ -490,4 +490,4 @@ public class MultipleShareActivity extends AuthenticatedActivity
} }
super.onStop(); super.onStop();
} }
} }

View file

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

View file

@ -112,7 +112,7 @@ public class UploadController {
Timber.d("Wikidata entity ID received from Share activity is %s", wikiDataEntityId); Timber.d("Wikidata entity ID received from Share activity is %s", wikiDataEntityId);
//TODO: Modify this to include coords //TODO: Modify this to include coords
Account currentAccount = sessionManager.getCurrentAccount(); Account currentAccount = sessionManager.getCurrentAccount();
if(currentAccount == null) { if (currentAccount == null) {
Timber.d("Current account is null"); Timber.d("Current account is null");
ViewUtil.showLongToast(context, context.getString(R.string.user_not_logged_in)); ViewUtil.showLongToast(context, context.getString(R.string.user_not_logged_in));
sessionManager.forceLogin(context); 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 //As the fileInputStream is null there's no point in continuing the upload process
//mwapi.upload accepts a NonNull input stream //mwapi.upload accepts a NonNull input stream
if(fileInputStream == null) { if (fileInputStream == null) {
Timber.d("File not found"); Timber.d("File not found");
return; return;
} }

View file

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

View file

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

View file

@ -44,4 +44,4 @@ public class StringSortingUtils {
double distanceBetweenStrings = new Levenshtein().distance(longer, shorter); double distanceBetweenStrings = new Levenshtein().distance(longer, shorter);
return (longerLength - distanceBetweenStrings) / (double) longerLength; return (longerLength - distanceBetweenStrings) / (double) longerLength;
} }
} }

View file

@ -15,4 +15,4 @@ public class UriDeserializer implements JsonDeserializer<Uri> {
final JsonDeserializationContext context) throws JsonParseException { final JsonDeserializationContext context) throws JsonParseException {
return Uri.parse(src.getAsString()); return Uri.parse(src.getAsString());
} }
} }

View file

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

View file

@ -128,4 +128,4 @@ public class PicOfDayAppWidget extends AppWidgetProvider {
public void onDisabled(Context context) { public void onDisabled(Context context) {
// Enter relevant functionality for when the last widget is disabled // Enter relevant functionality for when the last widget is disabled
} }
} }

View file

@ -17,4 +17,4 @@ public class WikidataEditListenerImpl extends WikidataEditListener {
wikidataP18EditListener.onWikidataEditSuccessful(); wikidataP18EditListener.onWikidataEditSuccessful();
} }
} }
} }

View file

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