mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-28 05:13:53 +01:00
Fix resource not found exception with null checks (#1628)
This commit is contained in:
parent
2e9af3c33a
commit
1dc0a7c257
1 changed files with 14 additions and 6 deletions
|
|
@ -275,17 +275,25 @@ public class ContributionsActivity
|
||||||
.getUploadCount(sessionManager.getCurrentAccount().name)
|
.getUploadCount(sessionManager.getCurrentAccount().name)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(
|
.subscribe(this::displayUploadCount,
|
||||||
uploadCount -> getSupportActionBar().setSubtitle(getResources()
|
|
||||||
.getQuantityString(R.plurals.contributions_subtitle,
|
|
||||||
uploadCount, uploadCount)),
|
|
||||||
t -> Timber.e(t, "Fetching upload count failed")
|
t -> Timber.e(t, "Fetching upload count failed")
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void betaSetUploadCount(int betaUploadCount){
|
private void displayUploadCount(Integer uploadCount) {
|
||||||
|
if (isFinishing()
|
||||||
|
|| getSupportActionBar() == null
|
||||||
|
|| getResources() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
getSupportActionBar().setSubtitle(getResources()
|
getSupportActionBar().setSubtitle(getResources()
|
||||||
.getQuantityString(R.plurals.contributions_subtitle, betaUploadCount, betaUploadCount));
|
.getQuantityString(R.plurals.contributions_subtitle,
|
||||||
|
uploadCount, uploadCount));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void betaSetUploadCount(int betaUploadCount) {
|
||||||
|
displayUploadCount(betaUploadCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue