Skip to content

To keep my fork up to date #2

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 10 commits into from
Nov 5, 2018
16 changes: 10 additions & 6 deletions ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,28 @@

Summarize your issue in one sentence (what goes wrong, what did you expect to happen)

_Before creating an issue, please search the existing issues to see if a similar one has already been created. You can search issues by specific labels (e.g. `label:nearby `) or just by typing keywords into the search filter._
_Before creating an issue, please search the existing issues to see if a similar one has already been created. You can search issues by specific labels (e.g. `label:nearby`) or just by typing keywords into the search filter._

**Steps to reproduce:**

How can we reproduce the issue?
What did you expect the app to do, and what did you see instead?

**Add System logs:**
**System logs:**

```
Add logcat files here (if possible).

Need help? See https://github.com/commons-app/apps-android-commons/wiki/Getting-app-logs-from-Android-Studio
```

**Device and Android version:**

What make and model device (e.g., Samsung J7) did you encounter this on? What Android
version (e.g., Android 4.0 Ice Cream Sandwich or Android 6.0 Marshmallow) are you running? Is it
the stock version from the manufacturer or a custom ROM ?
What make and model device (e.g., Samsung J7) did you encounter this on?
What Android version (e.g., Android 4.0 Ice Cream Sandwich or Android 6.0 Marshmallow) are you running?
Is it the stock version from the manufacturer or a custom ROM ?

**Commons app version:**
**Commons app version:**

You can find this information by going to the navigation drawer in the app and tapping 'About'. If you are building from our codebase instead of downloading the app, please also mention the branch and build variant (e.g. master and prodDebug).

Expand Down
20 changes: 9 additions & 11 deletions PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
## Title (required)
**Description (required)**

Fixes #{GitHub issue number and title (Please do not forget adding title) }
Fixes #{GitHub issue number} {Github issue title}

## Description (required)
What changes did you make and why?

Fixes #{GitHub issue number and title}
**Tests performed (required)**

{Describe the changes made and why they were made.}
Tested {build variant, e.g. ProdDebug} on {name of device or emulator} with API level {API level}.

## Tests performed (required)
**Screenshots showing what changed (optional - for UI changes)**

Tested on {API level & name of device/emulator}, with {build variant, e.g. ProdDebug}.
Need help? See https://support.google.com/android/answer/9075928

## Screenshots showing what changed (optional)

{Only for user interface changes, otherwise remove this section. See [how to take a screenshot](https://android.stackexchange.com/questions/1759/how-to-take-a-screenshot-with-an-android-device)}
---

_Note: Please ensure that you have read CONTRIBUTING.md if this is your first pull request._
_Note: Please ensure that you have read CONTRIBUTING.md if this is your first pull request._
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Wikimedia Commons Android app [![Build status](https://api.travis-ci.org/commons-app/apps-android-commons.svg)](https://travis-ci.org/commons-app/apps-android-commons)
# Wikimedia Commons Android app [![Build status](https://api.travis-ci.org/commons-app/apps-android-commons.svg?branch=master)](https://travis-ci.org/commons-app/apps-android-commons)

The Wikimedia Commons Android app allows users to upload pictures from their Android phone/tablet to Wikimedia Commons. Download the app [here][1], or view our [website][2].

Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ android {
buildConfigField "String", "MODIFICATION_AUTHORITY", "\"fr.free.nrw.commons.modifications.contentprovider\""
buildConfigField "String", "CATEGORY_AUTHORITY", "\"fr.free.nrw.commons.categories.contentprovider\""
buildConfigField "String", "RECENT_SEARCH_AUTHORITY", "\"fr.free.nrw.commons.explore.recentsearches.contentprovider\""
buildConfigField "String", "BOOKMARK_AUTHORITY", "\"fr.free.nrw.commons.beta.bookmarks.contentprovider\""
buildConfigField "String", "BOOKMARK_LOCATIONS_AUTHORITY", "\"fr.free.nrw.commons.beta.bookmarks.locations.contentprovider\""
buildConfigField "String", "BOOKMARK_AUTHORITY", "\"fr.free.nrw.commons.bookmarks.contentprovider\""
buildConfigField "String", "BOOKMARK_LOCATIONS_AUTHORITY", "\"fr.free.nrw.commons.bookmarks.locations.contentprovider\""

dimension 'tier'
}
Expand Down
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));
}
}
}
22 changes: 7 additions & 15 deletions app/src/main/java/fr/free/nrw/commons/AboutActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,22 +155,14 @@ public void launchTranslate(View view) {
builder.setView(spinner);
builder.setTitle(R.string.about_translate_title)
.setMessage(R.string.about_translate_message)
.setPositiveButton(R.string.about_translate_proceed, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String languageSelected = spinner.getSelectedItem().toString();
TokensTranslations tokensTranslations = new TokensTranslations();
tokensTranslations.initailize();
String token = tokensTranslations.getTranslationToken(languageSelected);
Utils.handleWebUrl(AboutActivity.this,Uri.parse("https://translatewiki.net/w/i.php?title=Special:Translate&language="+token+"&group=commons-android-strings&filter=%21translated&action=translate ?"));
}
.setPositiveButton(R.string.about_translate_proceed, (dialog, which) -> {
String languageSelected = spinner.getSelectedItem().toString();
TokensTranslations tokensTranslations = new TokensTranslations();
tokensTranslations.initailize();
String token = tokensTranslations.getTranslationToken(languageSelected);
Utils.handleWebUrl(AboutActivity.this,Uri.parse("https://translatewiki.net/w/i.php?title=Special:Translate&language="+token+"&group=commons-android-strings&filter=%21translated&action=translate ?"));
});
builder.setNegativeButton(R.string.about_translate_cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
finish();
}
});
builder.setNegativeButton(R.string.about_translate_cancel, (dialog, which) -> finish());
builder.create().show();

}
Expand Down
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){
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"){
TextView textView = (TextView) layout.findViewById(R.id.welcomeYesButton);
if( textView.getVisibility() != View.VISIBLE){
if (BuildConfig.FLAVOR == "beta") {
TextView textView = layout.findViewById(R.id.welcomeYesButton);
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);
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 @@ -338,9 +338,9 @@ public void showAlert(Bitmap screenshot){
AlertDialog.Builder alertadd = new AlertDialog.Builder(AchievementsActivity.this);
LayoutInflater factory = LayoutInflater.from(AchievementsActivity.this);
final View view = factory.inflate(R.layout.image_alert_layout, null);
ImageView screenShotImage = (ImageView) view.findViewById(R.id.alert_image);
ImageView screenShotImage = view.findViewById(R.id.alert_image);
screenShotImage.setImageBitmap(screenshot);
TextView shareMessage = (TextView) view.findViewById(R.id.alert_text);
TextView shareMessage = view.findViewById(R.id.alert_text);
shareMessage.setText(R.string.achievements_share_message);
alertadd.setView(view);
alertadd.setPositiveButton(R.string.about_translate_proceed, (dialog, which) -> shareScreen(screenshot));
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){
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;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ protected void showBlockStatus()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.filter(result -> result)
.subscribe(result -> {
ViewUtil.showSnackbar(findViewById(android.R.id.content), R.string.block_notification);
}
.subscribe(result -> ViewUtil.showSnackbar(findViewById(android.R.id.content), R.string.block_notification)
);
}
}
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")){
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){
performLogin();
}
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){
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){
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 @@ -15,10 +15,10 @@ class ContributionViewHolder {
final ProgressBar progressView;

ContributionViewHolder(View parent) {
imageView = (MediaWikiImageView) parent.findViewById(R.id.contributionImage);
titleView = (TextView)parent.findViewById(R.id.contributionTitle);
stateView = (TextView)parent.findViewById(R.id.contributionState);
seqNumView = (TextView)parent.findViewById(R.id.contributionSequenceNumber);
progressView = (ProgressBar)parent.findViewById(R.id.contributionProgress);
imageView = parent.findViewById(R.id.contributionImage);
titleView = parent.findViewById(R.id.contributionTitle);
stateView = parent.findViewById(R.id.contributionState);
seqNumView = parent.findViewById(R.id.contributionSequenceNumber);
progressView = parent.findViewById(R.id.contributionProgress);
}
}
Loading