mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Add PageTitle class to canonicalize page names
This commit is contained in:
parent
691acbf983
commit
d241d36d66
12 changed files with 234 additions and 50 deletions
|
|
@ -47,7 +47,7 @@ public class Media implements Parcelable {
|
|||
return "";
|
||||
}
|
||||
// FIXME: Gross hack bercause my regex skills suck maybe or I am too lazy who knows
|
||||
String title = filename.replaceFirst("^File:", "");
|
||||
String title = getFilePageTitle().getDisplayText().replaceFirst("^File:", "");
|
||||
Matcher matcher = displayTitlePattern.matcher(title);
|
||||
if(matcher.matches()) {
|
||||
return matcher.group(1);
|
||||
|
|
@ -56,13 +56,8 @@ public class Media implements Parcelable {
|
|||
}
|
||||
}
|
||||
|
||||
public String getDescriptionUrl() {
|
||||
// HACK! Geez
|
||||
return CommonsApplication.HOME_URL + "File:" + Utils.urlEncode(getFilename().replace("File:", "").replace(" ", "_"));
|
||||
}
|
||||
|
||||
public String getMobileDescriptionUrl() {
|
||||
return CommonsApplication.MOBILE_HOME_URL + "File:" + Utils.urlEncode(getFilename().replace("File:", "").replace(" ", "_"));
|
||||
public PageTitle getFilePageTitle() {
|
||||
return new PageTitle("File:" + getFilename().replaceFirst("^File:", ""));
|
||||
}
|
||||
|
||||
public Uri getLocalUri() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue