Remove app.icon from DB, save icon uris to memory
This commit is contained in:
parent
0c12c0248e
commit
534400c80c
@ -406,7 +406,7 @@ public class AppDetails extends ListActivity {
|
|||||||
|
|
||||||
// Set the icon...
|
// Set the icon...
|
||||||
ImageView iv = (ImageView) findViewById(R.id.icon);
|
ImageView iv = (ImageView) findViewById(R.id.icon);
|
||||||
ImageLoader.getInstance().displayImage(app.repoAddress+"/icons/"+app.icon, iv);
|
ImageLoader.getInstance().displayImage(app.icon, iv);
|
||||||
|
|
||||||
// Set the title and other header details...
|
// Set the title and other header details...
|
||||||
TextView tv = (TextView) findViewById(R.id.title);
|
TextView tv = (TextView) findViewById(R.id.title);
|
||||||
|
@ -89,7 +89,7 @@ public class DB {
|
|||||||
private static final String TABLE_APP = "fdroid_app";
|
private static final String TABLE_APP = "fdroid_app";
|
||||||
private static final String CREATE_TABLE_APP = "create table " + TABLE_APP
|
private static final String CREATE_TABLE_APP = "create table " + TABLE_APP
|
||||||
+ " ( " + "id text not null, " + "name text not null, "
|
+ " ( " + "id text not null, " + "name text not null, "
|
||||||
+ "summary text not null, " + "icon text, "
|
+ "summary text not null, "
|
||||||
+ "description text not null, " + "license text not null, "
|
+ "description text not null, " + "license text not null, "
|
||||||
+ "webURL text, " + "trackerURL text, " + "sourceURL text, "
|
+ "webURL text, " + "trackerURL text, " + "sourceURL text, "
|
||||||
+ "curVersion text," + "curVercode integer,"
|
+ "curVersion text," + "curVercode integer,"
|
||||||
@ -104,7 +104,7 @@ public class DB {
|
|||||||
public App() {
|
public App() {
|
||||||
name = "Unknown";
|
name = "Unknown";
|
||||||
summary = "Unknown application";
|
summary = "Unknown application";
|
||||||
icon = "noicon.png";
|
icon = null;
|
||||||
id = "unknown";
|
id = "unknown";
|
||||||
license = "Unknown";
|
license = "Unknown";
|
||||||
category = "Uncategorized";
|
category = "Uncategorized";
|
||||||
@ -124,7 +124,6 @@ public class DB {
|
|||||||
compatible = false;
|
compatible = false;
|
||||||
ignoreUpdates = false;
|
ignoreUpdates = false;
|
||||||
filtered = false;
|
filtered = false;
|
||||||
repoAddress = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// True when all the detail fields are populated, False otherwise.
|
// True when all the detail fields are populated, False otherwise.
|
||||||
@ -207,8 +206,6 @@ public class DB {
|
|||||||
// List of apks.
|
// List of apks.
|
||||||
public List<Apk> apks;
|
public List<Apk> apks;
|
||||||
|
|
||||||
public String repoAddress;
|
|
||||||
|
|
||||||
// Get the current version - this will be one of the Apks from 'apks'.
|
// Get the current version - this will be one of the Apks from 'apks'.
|
||||||
// Can return null if there are no available versions.
|
// Can return null if there are no available versions.
|
||||||
// This should be the 'current' version, as in the most recent stable
|
// This should be the 'current' version, as in the most recent stable
|
||||||
@ -426,7 +423,7 @@ public class DB {
|
|||||||
public String lastetag; // last etag we updated from, null forces update
|
public String lastetag; // last etag we updated from, null forces update
|
||||||
}
|
}
|
||||||
|
|
||||||
private final int DBVersion = 24;
|
private final int DBVersion = 25;
|
||||||
|
|
||||||
private static void createAppApk(SQLiteDatabase db) {
|
private static void createAppApk(SQLiteDatabase db) {
|
||||||
db.execSQL(CREATE_TABLE_APP);
|
db.execSQL(CREATE_TABLE_APP);
|
||||||
@ -756,7 +753,7 @@ public class DB {
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
String cols[] = new String[] { "antiFeatures", "requirements",
|
String cols[] = new String[] { "antiFeatures", "requirements",
|
||||||
"id", "name", "summary", "icon", "license", "category",
|
"id", "name", "summary", "license", "category",
|
||||||
"curVersion", "curVercode", "added", "lastUpdated",
|
"curVersion", "curVercode", "added", "lastUpdated",
|
||||||
"compatible", "ignoreUpdates" };
|
"compatible", "ignoreUpdates" };
|
||||||
c = db.query(TABLE_APP, cols, null, null, null, null, null);
|
c = db.query(TABLE_APP, cols, null, null, null, null, null);
|
||||||
@ -769,20 +766,19 @@ public class DB {
|
|||||||
app.id = c.getString(2);
|
app.id = c.getString(2);
|
||||||
app.name = c.getString(3);
|
app.name = c.getString(3);
|
||||||
app.summary = c.getString(4);
|
app.summary = c.getString(4);
|
||||||
app.icon = c.getString(5);
|
app.license = c.getString(5);
|
||||||
app.license = c.getString(6);
|
app.category = c.getString(6);
|
||||||
app.category = c.getString(7);
|
app.curVersion = c.getString(7);
|
||||||
app.curVersion = c.getString(8);
|
app.curVercode = c.getInt(8);
|
||||||
app.curVercode = c.getInt(9);
|
String sAdded = c.getString(9);
|
||||||
String sAdded = c.getString(10);
|
|
||||||
app.added = (sAdded == null || sAdded.length() == 0) ? null
|
app.added = (sAdded == null || sAdded.length() == 0) ? null
|
||||||
: mDateFormat.parse(sAdded);
|
: mDateFormat.parse(sAdded);
|
||||||
String sLastUpdated = c.getString(11);
|
String sLastUpdated = c.getString(10);
|
||||||
app.lastUpdated = (sLastUpdated == null || sLastUpdated
|
app.lastUpdated = (sLastUpdated == null || sLastUpdated
|
||||||
.length() == 0) ? null : mDateFormat
|
.length() == 0) ? null : mDateFormat
|
||||||
.parse(sLastUpdated);
|
.parse(sLastUpdated);
|
||||||
app.compatible = c.getInt(12) == 1;
|
app.compatible = c.getInt(11) == 1;
|
||||||
app.ignoreUpdates = c.getInt(13) == 1;
|
app.ignoreUpdates = c.getInt(12) == 1;
|
||||||
app.hasUpdates = false;
|
app.hasUpdates = false;
|
||||||
|
|
||||||
if (getinstalledinfo && systemApks.containsKey(app.id)) {
|
if (getinstalledinfo && systemApks.containsKey(app.id)) {
|
||||||
@ -1221,7 +1217,6 @@ public class DB {
|
|||||||
values.put("id", upapp.id);
|
values.put("id", upapp.id);
|
||||||
values.put("name", upapp.name);
|
values.put("name", upapp.name);
|
||||||
values.put("summary", upapp.summary);
|
values.put("summary", upapp.summary);
|
||||||
values.put("icon", upapp.icon);
|
|
||||||
values.put("description", upapp.detail_description);
|
values.put("description", upapp.detail_description);
|
||||||
values.put("license", upapp.license);
|
values.put("license", upapp.license);
|
||||||
values.put("category", upapp.category);
|
values.put("category", upapp.category);
|
||||||
|
@ -146,10 +146,18 @@ public class FDroidApp extends Application {
|
|||||||
try {
|
try {
|
||||||
DB db = DB.getDB();
|
DB db = DB.getDB();
|
||||||
apps = db.getApps(true);
|
apps = db.getApps(true);
|
||||||
for (DB.Repo repo : db.getRepos())
|
|
||||||
for (DB.App app : apps)
|
List<DB.Repo> repos = db.getRepos();
|
||||||
if (repo.id == app.apks.get(0).repo)
|
for (DB.App app : apps) {
|
||||||
app.repoAddress = repo.address;
|
for (DB.Repo repo : repos) {
|
||||||
|
DB.Apk bestApk = app.apks.get(0);
|
||||||
|
if (repo.id == bestApk.repo) {
|
||||||
|
app.icon = repo.address + "/icons/"
|
||||||
|
+ app.id + '.' + bestApk.vercode + ".png";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
DB.releaseDB();
|
DB.releaseDB();
|
||||||
@ -158,6 +166,20 @@ public class FDroidApp extends Application {
|
|||||||
try {
|
try {
|
||||||
DB db = DB.getDB();
|
DB db = DB.getDB();
|
||||||
apps = db.refreshApps(apps, invalidApps);
|
apps = db.refreshApps(apps, invalidApps);
|
||||||
|
|
||||||
|
List<DB.Repo> repos = db.getRepos();
|
||||||
|
for (DB.App app : apps) {
|
||||||
|
if (!invalidApps.contains(app.id)) continue;
|
||||||
|
for (DB.Repo repo : repos) {
|
||||||
|
DB.Apk bestApk = app.apks.get(0);
|
||||||
|
if (repo.id == bestApk.repo) {
|
||||||
|
app.icon = repo.address + "/icons/"
|
||||||
|
+ app.id + '.' + bestApk.vercode + ".png";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
invalidApps.clear();
|
invalidApps.clear();
|
||||||
} finally {
|
} finally {
|
||||||
DB.releaseDB();
|
DB.releaseDB();
|
||||||
|
@ -186,8 +186,6 @@ public class RepoXMLHandler extends DefaultHandler {
|
|||||||
curapp.id = str;
|
curapp.id = str;
|
||||||
} else if (curel.equals("name")) {
|
} else if (curel.equals("name")) {
|
||||||
curapp.name = str;
|
curapp.name = str;
|
||||||
} else if (curel.equals("icon")) {
|
|
||||||
curapp.icon = str;
|
|
||||||
} else if (curel.equals("description")) {
|
} else if (curel.equals("description")) {
|
||||||
// This is the old-style description. We'll read it
|
// This is the old-style description. We'll read it
|
||||||
// if present, to support old repos, but in newer
|
// if present, to support old repos, but in newer
|
||||||
|
@ -75,7 +75,7 @@ abstract public class AppListAdapter extends BaseAdapter {
|
|||||||
summary.setText(app.summary);
|
summary.setText(app.summary);
|
||||||
|
|
||||||
layoutSummary(summary);
|
layoutSummary(summary);
|
||||||
ImageLoader.getInstance().displayImage(app.repoAddress+"/icons/"+app.icon, icon);
|
ImageLoader.getInstance().displayImage(app.icon, icon);
|
||||||
|
|
||||||
int visibleOnCompact = compact ? View.VISIBLE : View.GONE;
|
int visibleOnCompact = compact ? View.VISIBLE : View.GONE;
|
||||||
int notVisibleOnCompact = compact ? View.GONE : View.VISIBLE;
|
int notVisibleOnCompact = compact ? View.GONE : View.VISIBLE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user