mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Merge "commons" into the project root directory
This commit is contained in:
parent
d42db0612e
commit
b4231bbfdc
324 changed files with 22 additions and 23 deletions
46
app/src/main/java/fr/free/nrw/commons/License.java
Normal file
46
app/src/main/java/fr/free/nrw/commons/License.java
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
package fr.free.nrw.commons;
|
||||
|
||||
public class License {
|
||||
String key;
|
||||
String template;
|
||||
String url;
|
||||
String name;
|
||||
|
||||
public License(String key, String template, String url, String name) {
|
||||
if (key == null) {
|
||||
throw new RuntimeException("License.key must not be null");
|
||||
}
|
||||
if (template == null) {
|
||||
throw new RuntimeException("License.template must not be null");
|
||||
}
|
||||
this.key = key;
|
||||
this.template = template;
|
||||
this.url = url;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public String getTemplate() {
|
||||
return template;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
if (name == null) {
|
||||
// hack
|
||||
return getKey();
|
||||
} else {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
public String getUrl(String language) {
|
||||
if (url == null) {
|
||||
return null;
|
||||
} else {
|
||||
return url.replace("$lang", language);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue