Skip to content

Commit e028658

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/master' into feedback-gamification
2 parents 35f05be + d891b8f commit e028658

File tree

77 files changed

+1866
-550
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1866
-550
lines changed

CONTRIBUTING.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,30 @@ If you're not sure where to start head on to [this wiki page](https://github.com
55

66
Here's a gist of the guidelines,
77

8-
# Make separate commits for logically separate changes
8+
1. Make separate commits for logically separate changes
99

10-
# Describe your changes well in the commit message
10+
1. Describe your changes well in the commit message
1111

12-
The first line of the commit message should be a short description of what has
12+
The first line of the commit message should be a short description of what has
1313
changed. It is also good to prefix the first line with "area: " where the "area"
1414
is a filename or identifier for the general area of the code being modified.
1515
The body should provide a meaningful commit message.
1616

17-
# Write tests for your code (if possible)
17+
1. Write Javadocs
1818

19-
# Make sure the Wiki pages don't become stale by updating them (if needed)
19+
We require contributors to include Javadocs for all new methods and classes
20+
submitted via PRs (after 1 May 2018). This is aimed at making it easier for
21+
new contributors to dive into our codebase, especially those who are new to
22+
Android development. A few things to note:
23+
24+
- This should not replace the need for code that is easily-readable in
25+
and of itself
26+
- Please make sure that your Javadocs are reasonably descriptive, not just
27+
a copy of the method name
28+
- Please do not use `@author` tags - we aim for collective code ownership,
29+
and if needed, Git allows us to see who wrote something without needing
30+
to add these tags (`git blame`)
31+
32+
1. Write tests for your code (if possible)
33+
34+
1. Make sure the Wiki pages don't become stale by updating them (if needed)

PULL_REQUEST_TEMPLATE.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
## Description
1+
## Description (required)
22

3-
Fixes #{GitHub issue number}
3+
Fixes #{GitHub issue number and title}
44

55
{Describe the changes made and why they were made.}
66

7-
## Tests performed
7+
## Tests performed (required)
88

99
Tested on {API level & name of device/emulator}, with {build variant, e.g. ProdDebug}.
1010

11-
{Please test your PR at least once before submitting.}
12-
13-
## Screenshots showing what changed
11+
## Screenshots showing what changed (optional)
1412

1513
{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)}
14+
15+
_Note: Please ensure that you have read CONTRIBUTING.md if this is your first pull request._

app/build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ dependencies {
2525
transitive=true
2626
}
2727

28+
implementation "com.github.deano2390:MaterialShowcaseView:1.2.0"
29+
2830
implementation "com.android.support:support-v4:$SUPPORT_LIB_VERSION"
2931
implementation "com.android.support:appcompat-v7:$SUPPORT_LIB_VERSION"
3032
implementation "com.android.support:design:$SUPPORT_LIB_VERSION"
@@ -49,6 +51,8 @@ dependencies {
4951
implementation 'com.jakewharton.rxbinding2:rxbinding-appcompat-v7:2.0.0'
5052
implementation 'com.jakewharton.rxbinding2:rxbinding-design:2.0.0'
5153

54+
implementation 'org.jsoup:jsoup:1.11.3'
55+
5256
implementation 'com.facebook.fresco:fresco:1.5.0'
5357
implementation 'com.facebook.stetho:stetho:1.5.0'
5458

app/src/main/AndroidManifest.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,9 @@
9292
android:label="@string/navigation_item_notification" />
9393

9494
<activity
95-
android:name=".featured.FeaturedImagesActivity"
96-
android:label="@string/title_activity_featured_images" />
95+
android:name=".category.CategoryImagesActivity"
96+
android:label="@string/title_activity_featured_images"
97+
android:parentActivityName=".contributions.ContributionsActivity" />
9798

9899
<service android:name=".upload.UploadService" />
99100

app/src/main/java/fr/free/nrw/commons/AboutActivity.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,10 @@ public boolean onCreateOptionsMenu(Menu menu) {
135135
public boolean onOptionsItemSelected(MenuItem item) {
136136
switch (item.getItemId()) {
137137
case R.id.share_app_icon:
138+
String shareText = "Upload photos to Wikimedia Commons on your phone\nDownload the Commons app: http://play.google.com/store/apps/details?id=fr.free.nrw.commons";
138139
Intent sendIntent = new Intent();
139140
sendIntent.setAction(Intent.ACTION_SEND);
140-
sendIntent.putExtra(Intent.EXTRA_TEXT, "http://play.google.com/store/apps/details?id=fr.free.nrw.commons");
141+
sendIntent.putExtra(Intent.EXTRA_TEXT, shareText);
141142
sendIntent.setType("text/plain");
142143
startActivity(Intent.createChooser(sendIntent, "Share app via..."));
143144
return true;

app/src/main/java/fr/free/nrw/commons/MediaDataExtractor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ public void fetch(String filename, LicenseList licenseList) throws IOException {
6161
}
6262

6363
try{
64-
Timber.d("Nominated for deletion: " + mediaWikiApi.pageExists("Commons:Deletion_requests/"+filename));
65-
deletionStatus = mediaWikiApi.pageExists("Commons:Deletion_requests/"+filename);
64+
deletionStatus = mediaWikiApi.pageExists("Commons:Deletion_requests/" + filename);
65+
Timber.d("Nominated for deletion: " + deletionStatus);
6666
}
6767
catch (Exception e){
6868
Timber.d(e.getMessage());

app/src/main/java/fr/free/nrw/commons/auth/LoginActivity.java

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import fr.free.nrw.commons.mwapi.MediaWikiApi;
4848
import fr.free.nrw.commons.theme.NavigationBaseActivity;
4949
import fr.free.nrw.commons.ui.widget.HtmlTextView;
50+
import fr.free.nrw.commons.utils.ViewUtil;
5051
import io.reactivex.Observable;
5152
import io.reactivex.android.schedulers.AndroidSchedulers;
5253
import io.reactivex.schedulers.Schedulers;
@@ -109,14 +110,14 @@ public void onCreate(Bundle savedInstanceState) {
109110
usernameEdit.addTextChangedListener(textWatcher);
110111
usernameEdit.setOnFocusChangeListener((v, hasFocus) -> {
111112
if (!hasFocus) {
112-
hideKeyboard(v);
113+
ViewUtil.hideKeyboard(v);
113114
}
114115
});
115116

116117
passwordEdit.addTextChangedListener(textWatcher);
117118
passwordEdit.setOnFocusChangeListener((v, hasFocus) -> {
118119
if (!hasFocus) {
119-
hideKeyboard(v);
120+
ViewUtil.hideKeyboard(v);
120121
}
121122
});
122123

@@ -144,16 +145,6 @@ void onPrivacyPolicyClicked() {
144145
Utils.handleWebUrl(this,Uri.parse("https://github.com/commons-app/apps-android-commons/wiki/Privacy-policy\\"));
145146
}
146147

147-
public void hideKeyboard(View view) {
148-
if (view != null) {
149-
InputMethodManager inputMethodManager = (InputMethodManager) this.getSystemService(Activity.INPUT_METHOD_SERVICE);
150-
if (inputMethodManager != null) {
151-
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
152-
}
153-
}
154-
}
155-
156-
157148
@Override
158149
protected void onPostCreate(Bundle savedInstanceState) {
159150
super.onPostCreate(savedInstanceState);

app/src/main/java/fr/free/nrw/commons/category/CategorizationFragment.java

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package fr.free.nrw.commons.category;
22

33

4-
import android.app.Activity;
54
import android.content.SharedPreferences;
65
import android.os.Bundle;
76
import android.support.v7.app.AlertDialog;
@@ -16,7 +15,6 @@
1615
import android.view.MenuItem;
1716
import android.view.View;
1817
import android.view.ViewGroup;
19-
import android.view.inputmethod.InputMethodManager;
2018
import android.widget.EditText;
2119
import android.widget.ProgressBar;
2220
import android.widget.TextView;
@@ -43,6 +41,7 @@
4341
import fr.free.nrw.commons.mwapi.MediaWikiApi;
4442
import fr.free.nrw.commons.upload.MwVolleyApi;
4543
import fr.free.nrw.commons.utils.StringSortingUtils;
44+
import fr.free.nrw.commons.utils.ViewUtil;
4645
import io.reactivex.Observable;
4746
import io.reactivex.android.schedulers.AndroidSchedulers;
4847
import io.reactivex.schedulers.Schedulers;
@@ -116,7 +115,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
116115

117116
categoriesFilter.setOnFocusChangeListener((v, hasFocus) -> {
118117
if (!hasFocus) {
119-
hideKeyboard(v);
118+
ViewUtil.hideKeyboard(v);
120119
}
121120
});
122121

@@ -128,16 +127,6 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
128127
return rootView;
129128
}
130129

131-
public void hideKeyboard(View view) {
132-
133-
if (view != null) {
134-
InputMethodManager inputMethodManager = (InputMethodManager) getActivity().getSystemService(Activity.INPUT_METHOD_SERVICE);
135-
if (inputMethodManager != null) {
136-
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
137-
}
138-
}
139-
}
140-
141130
@Override
142131
public void onDestroyView() {
143132
categoriesFilter.removeTextChangedListener(textWatcher);
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package fr.free.nrw.commons.category;
2+
3+
import java.util.List;
4+
5+
import javax.inject.Inject;
6+
import javax.inject.Singleton;
7+
8+
import fr.free.nrw.commons.Media;
9+
import fr.free.nrw.commons.mwapi.MediaWikiApi;
10+
11+
@Singleton
12+
public class CategoryImageController {
13+
14+
private MediaWikiApi mediaWikiApi;
15+
16+
@Inject
17+
public CategoryImageController(MediaWikiApi mediaWikiApi) {
18+
this.mediaWikiApi = mediaWikiApi;
19+
}
20+
21+
/**
22+
* Takes a category name as input and calls the API to get a list of images for that category
23+
* @param categoryName
24+
* @return
25+
*/
26+
public List<Media> getCategoryImages(String categoryName) {
27+
return mediaWikiApi.getCategoryImages(categoryName);
28+
}
29+
}

0 commit comments

Comments
 (0)