Skip to content

Commit 54246fd

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/2.8-release'
2 parents 887f152 + 18b0517 commit 54246fd

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

app/src/main/java/fr/free/nrw/commons/contributions/ContributionsActivity.java

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -276,17 +276,25 @@ private void setUploadCount() {
276276
.getUploadCount(sessionManager.getCurrentAccount().name)
277277
.subscribeOn(Schedulers.io())
278278
.observeOn(AndroidSchedulers.mainThread())
279-
.subscribe(
280-
uploadCount -> getSupportActionBar().setSubtitle(getResources()
281-
.getQuantityString(R.plurals.contributions_subtitle,
282-
uploadCount, uploadCount)),
279+
.subscribe(this::displayUploadCount,
283280
t -> Timber.e(t, "Fetching upload count failed")
284281
));
285282
}
286283

287-
public void betaSetUploadCount(int betaUploadCount){
284+
private void displayUploadCount(Integer uploadCount) {
285+
if (isFinishing()
286+
|| getSupportActionBar() == null
287+
|| getResources() == null) {
288+
return;
289+
}
290+
288291
getSupportActionBar().setSubtitle(getResources()
289-
.getQuantityString(R.plurals.contributions_subtitle, betaUploadCount, betaUploadCount));
292+
.getQuantityString(R.plurals.contributions_subtitle,
293+
uploadCount, uploadCount));
294+
}
295+
296+
public void betaSetUploadCount(int betaUploadCount) {
297+
displayUploadCount(betaUploadCount);
290298
}
291299

292300

app/src/main/java/fr/free/nrw/commons/upload/SingleUploadFragment.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ public boolean onOptionsItemSelected(MenuItem item) {
7474
//What happens when the 'submit' icon is tapped
7575
case R.id.menu_upload_single:
7676

77-
if (titleEdit.getText().toString().isEmpty()) {
77+
if (titleEdit.getText().toString().trim().isEmpty()) {
7878
Toast.makeText(getContext(), R.string.add_title_toast, Toast.LENGTH_LONG).show();
7979
return false;
8080
}
8181

82-
String title = titleEdit.getText().toString();
83-
String desc = descEdit.getText().toString();
82+
String title = titleEdit.getText().toString().trim();
83+
String desc = descEdit.getText().toString().trim();
8484

8585
//Save the title/desc in short-lived cache so next time this fragment is loaded, we can access these
8686
prefs.edit()

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@
284284
<string name="error_fetching_nearby_places">Error fetching nearby places.</string>
285285

286286
<string name="successful_wikidata_edit">Image successfully added to %1$s on Wikidata!</string>
287-
<string name="wikidata_edit_failure">Failed to update corresponding wiki data entity!</string>
287+
<string name="wikidata_edit_failure">Failed to update corresponding Wikidata entity!</string>
288288
<string name="menu_set_wallpaper">Set wallpaper</string>
289289
<string name="wallpaper_set_successfully">Wallpaper set successfully!</string>
290290
</resources>

0 commit comments

Comments
 (0)