Show 1 Award instead of 1 Awards. Version 3.0.3.

This commit is contained in:
Alex Ning 2020-04-19 13:16:23 +08:00
parent 499f507f88
commit 0f8395221d
3 changed files with 13 additions and 4 deletions

View File

@ -6,8 +6,8 @@ android {
applicationId "ml.docilealligator.infinityforreddit" applicationId "ml.docilealligator.infinityforreddit"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 29 targetSdkVersion 29
versionCode 32 versionCode 33
versionName "3.0.2" versionName "3.0.3"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }
buildTypes { buildTypes {

View File

@ -457,8 +457,12 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
if (nAwards > 0) { if (nAwards > 0) {
((PostViewHolder) holder).awardsTextView.setVisibility(View.VISIBLE); ((PostViewHolder) holder).awardsTextView.setVisibility(View.VISIBLE);
if (nAwards == 1) {
((PostViewHolder) holder).awardsTextView.setText(mActivity.getString(R.string.one_award));
} else {
((PostViewHolder) holder).awardsTextView.setText(mActivity.getString(R.string.n_awards, nAwards)); ((PostViewHolder) holder).awardsTextView.setText(mActivity.getString(R.string.n_awards, nAwards));
} }
}
switch (voteType) { switch (voteType) {
case 1: case 1:
@ -1014,7 +1018,11 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
if (nAwards > 0) { if (nAwards > 0) {
((PostCompactViewHolder) holder).awardsTextView.setVisibility(View.VISIBLE); ((PostCompactViewHolder) holder).awardsTextView.setVisibility(View.VISIBLE);
((PostCompactViewHolder) holder).awardsTextView.setText(mActivity.getString(R.string.n_awards, post.getnAwards())); if (nAwards == 1) {
((PostCompactViewHolder) holder).awardsTextView.setText(mActivity.getString(R.string.one_award));
} else {
((PostCompactViewHolder) holder).awardsTextView.setText(mActivity.getString(R.string.n_awards, nAwards));
}
} }
switch (voteType) { switch (voteType) {

View File

@ -694,5 +694,6 @@
<string name="delete_multi_reddit">Delete Multireddit</string> <string name="delete_multi_reddit">Delete Multireddit</string>
<string name="n_awards">%1$d Awards</string> <string name="n_awards">%1$d Awards</string>
<string name="one_award">1 Award</string>
</resources> </resources>