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