mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
Merge pull request #107 from domdomegg/patch-2
Fix crash on viewing unknown licenses + add viewing creative commons 4.0 licenses
This commit is contained in:
commit
6ae48c08c8
2 changed files with 9 additions and 4 deletions
|
|
@ -114,6 +114,8 @@
|
|||
<string name="license_name_cc_by_sa_3_0_pl">CC BY-SA 3.0 (Poland)</string>
|
||||
<string name="license_name_cc_by_sa_3_0_ro">CC BY-SA 3.0 (Romania)</string>
|
||||
<string name="license_name_cc_by_3_0">CC BY 3.0</string>
|
||||
<string name="license_name_cc_by_sa_4_0">CC BY-SA 4.0</string>
|
||||
<string name="license_name_cc_by_4_0">CC BY 4.0</string>
|
||||
<string name="license_name_cc_zero">CC Zero</string>
|
||||
<string name="license_name_own_pd">own-pd</string>
|
||||
<string name="license_name_cc_by_sa_2_5">CC BY-SA 2.5</string>
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public class LicenseList {
|
|||
}
|
||||
|
||||
public String nameIdForTemplate(String template) {
|
||||
// hack :D
|
||||
// hack :D (converts dashes and periods to underscores)
|
||||
// cc-by-sa-3.0 -> cc_by_sa_3_0
|
||||
return "license_name_" + template.toLowerCase().replace("-", "_").replace(".", "_");
|
||||
}
|
||||
|
|
@ -68,8 +68,11 @@ public class LicenseList {
|
|||
Log.d("Commons", "LicenseList.nameForTemplate: stringId: " + stringId);
|
||||
int nameId = stringIdByName(stringId);
|
||||
Log.d("Commons", "LicenseList.nameForTemplate: nameId: " + nameId);
|
||||
String name = res.getString(nameId);
|
||||
Log.d("Commons", "LicenseList.nameForTemplate: name: " + name);
|
||||
return name;
|
||||
if(nameId != 0) {
|
||||
String name = res.getString(nameId);
|
||||
Log.d("Commons", "LicenseList.nameForTemplate: name: " + name);
|
||||
return name;
|
||||
}
|
||||
return template;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue