Fix #2156: Add plural support for share_license_summary string (#2161)

This commit is contained in:
Zhao Gang 2018-12-19 01:29:11 +08:00 committed by Adam Jones
parent 1d80cbaac9
commit db38174eb4
6 changed files with 12 additions and 8 deletions

View file

@ -252,13 +252,14 @@ public class UploadActivity extends AuthenticatedActivity implements UploadView,
@SuppressLint("StringFormatInvalid")
@Override
public void updateLicenseSummary(String selectedLicense) {
public void updateLicenseSummary(String selectedLicense, int imageCount) {
String licenseHyperLink = "<a href='" + Utils.licenseUrlFor(selectedLicense)+"'>" +
getString(Utils.licenseNameFor(selectedLicense)) + "</a><br>";
licenseSummary.setMovementMethod(LinkMovementMethod.getInstance());
licenseSummary.setText(
Html.fromHtml(
getString(R.string.share_license_summary, licenseHyperLink)));
getResources().getQuantityString(R.plurals.share_license_summary,
imageCount, licenseHyperLink)));
}
@Override

View file

@ -112,7 +112,7 @@ public class UploadPresenter {
*/
void selectLicense(String licenseName) {
uploadModel.setSelectedLicense(licenseName);
view.updateLicenseSummary(uploadModel.getSelectedLicense());
view.updateLicenseSummary(uploadModel.getSelectedLicense(), uploadModel.getCount());
}
//region Wizard step management
@ -357,7 +357,7 @@ public class UploadPresenter {
private void updateLicenses() {
String selectedLicense = uploadModel.getSelectedLicense();
view.updateLicenses(uploadModel.getLicenses(), selectedLicense);
view.updateLicenseSummary(selectedLicense);
view.updateLicenseSummary(selectedLicense, uploadModel.getCount());
}
/**

View file

@ -60,7 +60,7 @@ public interface UploadView {
void updateLicenses(List<String> licenses, String selectedLicense);
void updateLicenseSummary(String selectedLicense);
void updateLicenseSummary(String selectedLicense, int imageCount);
void updateTopCardContent();