Flexible name check for game identification
This commit is contained in:
parent
40e8210a7e
commit
c8600bb6cf
|
@ -21,8 +21,8 @@
|
|||
|
||||
<ImageView
|
||||
android:id="@+id/item_icon"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:layout_marginLeft="6dp"
|
||||
|
|
|
@ -118,13 +118,17 @@ public class XMLParser extends AsyncTask<String, Integer, String> {
|
|||
protected String doInBackground(String... params) {
|
||||
String filename = game_name = params[0];
|
||||
if (isNetworkAvailable() && mPrefs.getBoolean(Config.pref_gamedetails, false)) {
|
||||
if (params[0].contains("[")) {
|
||||
filename = params[0].substring(0, params[0].lastIndexOf("["));
|
||||
} else {
|
||||
filename = params[0].substring(0, params[0].lastIndexOf("."));
|
||||
if (filename.startsWith("[")) {
|
||||
filename = filename.substring(filename.indexOf("]") + 1, filename.length());
|
||||
}
|
||||
filename = filename.replaceAll("[^\\p{L}\\p{Nd}]", " ");
|
||||
filename = filename.replace(" ", "+");
|
||||
if (filename.contains("[")) {
|
||||
filename = filename.substring(0, filename.indexOf("["));
|
||||
} else {
|
||||
filename = filename.substring(0, filename.lastIndexOf("."));
|
||||
}
|
||||
filename = filename.replace("_", " ").replace(":", " ");
|
||||
filename = filename.replaceAll("[^\\p{Alpha}\\p{Digit}]+"," ");
|
||||
filename = filename.replace(" ", " ").replace(" ", "+");
|
||||
if (filename.endsWith("+")) {
|
||||
filename = filename.substring(0, filename.length() - 1);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue