1
0

Parse and store the "added" and "lastupdated" for Apps and "added" for Apks

This bumps the database version to 14 in order to store these extra
strings.
Este cometimento está contido em:
Kevin Everets 2012-07-16 14:28:28 -04:00
ascendente 653a51bb97
cometimento d6015fe77c
2 ficheiros modificados com 27 adições e 1 eliminações

Ver ficheiro

@ -79,6 +79,8 @@ public class DB {
requirements = null; requirements = null;
hasUpdates = false; hasUpdates = false;
updated = false; updated = false;
added = "";
lastUpdated = "";
apks = new Vector<Apk>(); apks = new Vector<Apk>();
} }
@ -98,6 +100,8 @@ public class DB {
public int installedVerCode; public int installedVerCode;
public String marketVersion; public String marketVersion;
public int marketVercode; public int marketVercode;
public String added;
public String lastUpdated;
// List of anti-features (as defined in the metadata // List of anti-features (as defined in the metadata
// documentation) or null if there aren't any. // documentation) or null if there aren't any.
@ -166,6 +170,7 @@ public class DB {
updated = false; updated = false;
size = 0; size = 0;
apkSource = null; apkSource = null;
added = "";
} }
public String id; public String id;
@ -176,6 +181,7 @@ public class DB {
public String hash; public String hash;
public String hashType; public String hashType;
public int minSdkVersion; // 0 if unknown public int minSdkVersion; // 0 if unknown
public String added;
public CommaSeparatedList permissions; // null if empty or unknown public CommaSeparatedList permissions; // null if empty or unknown
public CommaSeparatedList features; // null if empty or unknown public CommaSeparatedList features; // null if empty or unknown
@ -338,7 +344,12 @@ public class DB {
"update " + TABLE_APK + " set hashType = 'MD5'" }, "update " + TABLE_APK + " set hashType = 'MD5'" },
// Version 13... // Version 13...
{ "alter table " + TABLE_APP + " add category string" } }; { "alter table " + TABLE_APP + " add category string" },
// Version 14...
{ "alter table " + TABLE_APK + " add added string",
"alter table " + TABLE_APP + " add added string",
"alter table " + TABLE_APP + " add lastUpdated string"} };
private class DBHelper extends SQLiteOpenHelper { private class DBHelper extends SQLiteOpenHelper {
@ -550,6 +561,10 @@ public class DB {
.getColumnIndex("marketVersion")); .getColumnIndex("marketVersion"));
app.marketVercode = c.getInt(c app.marketVercode = c.getInt(c
.getColumnIndex("marketVercode")); .getColumnIndex("marketVercode"));
app.added = c.getString(c
.getColumnIndex("added"));
app.lastUpdated = c.getString(c
.getColumnIndex("lastUpdated"));
app.hasUpdates = false; app.hasUpdates = false;
c2 = db.rawQuery("select * from " + TABLE_APK c2 = db.rawQuery("select * from " + TABLE_APK
@ -577,6 +592,8 @@ public class DB {
.getColumnIndex("apkSource")); .getColumnIndex("apkSource"));
apk.minSdkVersion = c2.getInt(c2 apk.minSdkVersion = c2.getInt(c2
.getColumnIndex("minSdkVersion")); .getColumnIndex("minSdkVersion"));
apk.added = c2.getString(c2
.getColumnIndex("added"));
apk.permissions = CommaSeparatedList.make(c2 apk.permissions = CommaSeparatedList.make(c2
.getString(c2.getColumnIndex("permissions"))); .getString(c2.getColumnIndex("permissions")));
apk.features = CommaSeparatedList.make(c2.getString(c2 apk.features = CommaSeparatedList.make(c2.getString(c2
@ -843,6 +860,8 @@ public class DB {
values.put("trackerURL", upapp.trackerURL); values.put("trackerURL", upapp.trackerURL);
values.put("sourceURL", upapp.sourceURL); values.put("sourceURL", upapp.sourceURL);
values.put("donateURL", upapp.donateURL); values.put("donateURL", upapp.donateURL);
values.put("added", upapp.added);
values.put("lastUpdated", upapp.lastUpdated);
values.put("marketVersion", upapp.marketVersion); values.put("marketVersion", upapp.marketVersion);
values.put("marketVercode", upapp.marketVercode); values.put("marketVercode", upapp.marketVercode);
values.put("antiFeatures", CommaSeparatedList.str(upapp.antiFeatures)); values.put("antiFeatures", CommaSeparatedList.str(upapp.antiFeatures));
@ -875,6 +894,7 @@ public class DB {
values.put("apkName", upapk.apkName); values.put("apkName", upapk.apkName);
values.put("apkSource", upapk.apkSource); values.put("apkSource", upapk.apkSource);
values.put("minSdkVersion", upapk.minSdkVersion); values.put("minSdkVersion", upapk.minSdkVersion);
values.put("added", upapk.added);
values.put("permissions", CommaSeparatedList.str(upapk.permissions)); values.put("permissions", CommaSeparatedList.str(upapk.permissions));
values.put("features", CommaSeparatedList.str(upapk.features)); values.put("features", CommaSeparatedList.str(upapk.features));
if (oldapk != null) { if (oldapk != null) {

Ver ficheiro

@ -140,6 +140,8 @@ public class RepoXMLHandler extends DefaultHandler {
} catch (NumberFormatException ex) { } catch (NumberFormatException ex) {
curapk.minSdkVersion = 0; curapk.minSdkVersion = 0;
} }
} else if (curel.equals("added")) {
curapk.added = str;
} else if (curel.equals("permissions")) { } else if (curel.equals("permissions")) {
curapk.permissions = DB.CommaSeparatedList.make(str); curapk.permissions = DB.CommaSeparatedList.make(str);
} else if (curel.equals("features")) { } else if (curel.equals("features")) {
@ -169,6 +171,10 @@ public class RepoXMLHandler extends DefaultHandler {
curapp.webURL = str; curapp.webURL = str;
} else if (curel.equals("tracker")) { } else if (curel.equals("tracker")) {
curapp.trackerURL = str; curapp.trackerURL = str;
} else if (curel.equals("added")) {
curapp.added = str;
} else if (curel.equals("lastupdated")) {
curapp.lastUpdated = str;
} else if (curel.equals("marketversion")) { } else if (curel.equals("marketversion")) {
curapp.marketVersion = str; curapp.marketVersion = str;
} else if (curel.equals("marketvercode")) { } else if (curel.equals("marketvercode")) {