Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ public void isNotSelfOwned() throws Exception {
boolean selfOwned = FileUtils.isSelfOwned(InstrumentationRegistry.getTargetContext(), uri);
assertThat(selfOwned, is(false));
}
}
}
4 changes: 2 additions & 2 deletions app/src/main/java/fr/free/nrw/commons/WelcomeActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void onCreate(Bundle savedInstanceState) {

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");
Expand All @@ -54,7 +54,7 @@ public void onCreate(Bundle savedInstanceState) {
*/
@Override
public void onDestroy() {
if(isQuiz){
if (isQuiz){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (isQuiz){
if (isQuiz) {

Intent i = new Intent(WelcomeActivity.this, QuizActivity.class);
startActivity(i);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ public Object instantiateItem(ViewGroup container, int position) {
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){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ void shareScreen(Bitmap bitmap) {
* 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())
Expand Down Expand Up @@ -218,7 +218,7 @@ private void onError() {
* 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())
Expand Down Expand Up @@ -387,7 +387,7 @@ private void launchAlert(String title, String message){
*/
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (config == null){
if (config == null) {

config = Bitmap.Config.ARGB_8888;
}
Bitmap bitmap = Bitmap.createBitmap(bm.getWidth(),bm.getHeight(),config);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ public int getQualityImages() {
public int getFeaturedPicturesOnWikimediaCommons() {
return featuredPicturesOnWikimediaCommons;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ public String getUser() {
public int getImagesEditedBySomeoneElse() {
return imagesEditedBySomeoneElse;
}
}
}
8 changes: 4 additions & 4 deletions app/src/main/java/fr/free/nrw/commons/auth/LoginActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public void onCreate(Bundle savedInstanceState) {
.setNegativeButton(R.string.no, (dialog, which) -> dialog.cancel())
.show());

if(BuildConfig.FLAVOR.equals("beta")){
if (BuildConfig.FLAVOR.equals("beta")){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (BuildConfig.FLAVOR.equals("beta")){
if (BuildConfig.FLAVOR.equals("beta")) {

loginCredentials.setText(getString(R.string.login_credential));
} else {
loginCredentials.setVisibility(View.GONE);
Expand Down Expand Up @@ -381,10 +381,10 @@ protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
loginCurrentlyInProgress = savedInstanceState.getBoolean(LOGING_IN, false);
errorMessageShown = savedInstanceState.getBoolean(ERROR_MESSAGE_SHOWN, false);
if(loginCurrentlyInProgress){
if (loginCurrentlyInProgress){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (loginCurrentlyInProgress){
if (loginCurrentlyInProgress) {

performLogin();
}
if(errorMessageShown){
if (errorMessageShown){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (errorMessageShown){
if (errorMessageShown) {

resultantError = savedInstanceState.getString(RESULTANT_ERROR);
handleOtherResults(resultantError);
}
Expand All @@ -399,7 +399,7 @@ public void askUserForTwoFactorAuth() {

public void showMessageAndCancelDialog(@StringRes int resId) {
showMessage(resId, R.color.secondaryDarkColor);
if(progressDialog != null){
if (progressDialog != null){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (progressDialog != null){
if (progressDialog != null) {

progressDialog.cancel();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ public void requestPictureListUpdate() {
BookmarkPicturesFragment fragment = (BookmarkPicturesFragment)(pages.get(0).getPage());
fragment.onResume();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void onResume() {
*/
@SuppressLint("CheckResult")
private void initList() {
if(!NetworkUtils.isInternetConnectionEstablished(getContext())) {
if (!NetworkUtils.isInternetConnectionEstablished(getContext())) {
handleNoInternet();
return;
}
Expand Down Expand Up @@ -179,7 +179,7 @@ private void initEmptyBookmarkListView() {
* @param collection List of new Media to be displayed
*/
private void handleSuccess(List<Media> collection) {
if(collection == null) {
if (collection == null) {
initErrorView();
return;
}
Expand All @@ -188,7 +188,7 @@ private void handleSuccess(List<Media> collection) {
return;
}

if(gridAdapter == null) {
if (gridAdapter == null) {
setAdapter(collection);
} else {
if (gridAdapter.containsAll(collection)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ public void setContentUri(Uri contentUri) {
this.contentUri = contentUri;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ public CategoryImageController(MediaWikiApi mediaWikiApi) {
public List<Media> getCategoryImages(String categoryName) {
return mediaWikiApi.getCategoryImages(categoryName);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ private void resetQueryContinueValues(String keyword) {
*/
@SuppressLint("CheckResult")
private void initList() {
if(!NetworkUtils.isInternetConnectionEstablished(getContext())) {
if (!NetworkUtils.isInternetConnectionEstablished(getContext())) {
handleNoInternet();
return;
}
Expand Down Expand Up @@ -208,7 +208,7 @@ public void fetchMoreImagesViewPager(){
*/
@SuppressLint("CheckResult")
private void fetchMoreImages() {
if(!NetworkUtils.isInternetConnectionEstablished(getContext())) {
if (!NetworkUtils.isInternetConnectionEstablished(getContext())) {
handleNoInternet();
return;
}
Expand All @@ -227,13 +227,13 @@ private void fetchMoreImages() {
* @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)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,4 @@ private void setAuthorView(Media item, TextView author) {
author.setVisibility(View.GONE);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle sav
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){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (getActivity().getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT){
if (getActivity().getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {

categoriesRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
}
else{
Expand All @@ -91,7 +91,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle sav
*/
public void initSubCategoryList() {
categoriesNotFoundView.setVisibility(GONE);
if(!NetworkUtils.isInternetConnectionEstablished(getContext())) {
if (!NetworkUtils.isInternetConnectionEstablished(getContext())) {
handleNoInternet();
return;
}
Expand All @@ -118,7 +118,7 @@ public void initSubCategoryList() {
* @param subCategoryList
*/
private void handleSuccess(List<String> subCategoryList) {
if(subCategoryList == null || subCategoryList.isEmpty()) {
if (subCategoryList == null || subCategoryList.isEmpty()) {
initEmptyView();
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,4 @@ public ThreadPoolService build() {
return new ThreadPoolService(this);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,12 @@ protected void onCreate(Bundle savedInstanceState) {
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")){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!BuildConfig.FLAVOR.equalsIgnoreCase("beta")){
if (!BuildConfig.FLAVOR.equalsIgnoreCase("beta")) {

setUploadCount();
}

Expand Down Expand Up @@ -256,7 +256,7 @@ public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) {
((CursorAdapter) contributionsList.getAdapter()).swapCursor(cursor);
}

if(contributionsList.getAdapter().getCount()>0){
if (contributionsList.getAdapter().getCount()>0){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (contributionsList.getAdapter().getCount()>0){
if (contributionsList.getAdapter().getCount() > 0) {

contributionsList.changeEmptyScreen(false);
}
contributionsList.clearSyncMessage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public ListAdapter getAdapter() {
public void setAdapter(ListAdapter adapter) {
this.contributionsList.setAdapter(adapter);

if(BuildConfig.FLAVOR.equalsIgnoreCase("beta")){
if (BuildConfig.FLAVOR.equalsIgnoreCase("beta")){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (BuildConfig.FLAVOR.equalsIgnoreCase("beta")){
if (BuildConfig.FLAVOR.equalsIgnoreCase("beta")) {

((ContributionsActivity) getActivity()).betaSetUploadCount(adapter.getCount());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,4 @@ protected void onPostExecute(Boolean result) {
.setPriority(PRIORITY_HIGH);
notificationManager.notify(NOTIFICATION_DELETE, notificationBuilder.build());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,4 @@ public static ApplicationlessInjection getInstance(Context applicationContext) {
return instance;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,4 @@ public WikidataEditListener provideWikidataEditListener() {
public boolean provideIsBetaVariant() {
return BuildConfig.FLAVOR.equals("beta");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ private void inject() {
activityInjector.inject(this);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ private void inject(Context context) {
serviceInjector.inject(this);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ private void inject() {
serviceInjector.inject(this);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ private void inject() {
serviceInjector.inject(this);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ private void inject() {
serviceInjector.inject(this);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ private HasSupportFragmentInjector findHasFragmentInjector() {
throw new IllegalArgumentException(String.format("No injector was found for %s", getClass().getCanonicalName()));
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ private void saveQuery(String query) {
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){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (getActivity().getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT){
if (getActivity().getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {

categoriesRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
}
else{
Expand Down Expand Up @@ -124,7 +124,7 @@ public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
public void updateCategoryList(String query) {
this.query = query;
categoriesNotFoundView.setVisibility(GONE);
if(!NetworkUtils.isInternetConnectionEstablished(getContext())) {
if (!NetworkUtils.isInternetConnectionEstablished(getContext())) {
handleNoInternet();
return;
}
Expand Down Expand Up @@ -173,7 +173,7 @@ private void handlePaginationSuccess(List<String> mediaList) {
*/
private void handleSuccess(List<String> mediaList) {
queryList = mediaList;
if(mediaList == null || mediaList.isEmpty()) {
if (mediaList == null || mediaList.isEmpty()) {
initErrorView();
}
else {
Expand Down
Loading