Revert some icon changes, go back to using <icon> from the index

This commit is contained in:
Daniel Martí 2013-09-29 20:45:47 +02:00
parent 5aa2710362
commit 953512cac9
5 changed files with 23 additions and 18 deletions

View File

@ -408,7 +408,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.icon, iv); ImageLoader.getInstance().displayImage(app.iconUrl, 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);

View File

@ -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, " + "summary text not null, " + "icon text, "
+ "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 = null; icon = "noicon.png";
id = "unknown"; id = "unknown";
license = "Unknown"; license = "Unknown";
category = "Uncategorized"; category = "Uncategorized";
@ -124,6 +124,7 @@ public class DB {
compatible = false; compatible = false;
ignoreUpdates = false; ignoreUpdates = false;
filtered = false; filtered = false;
iconUrl = null;
} }
// True when all the detail fields are populated, False otherwise. // True when all the detail fields are populated, False otherwise.
@ -206,6 +207,8 @@ public class DB {
// List of apks. // List of apks.
public List<Apk> apks; public List<Apk> apks;
public String iconUrl;
// 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
@ -423,7 +426,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 = 25; private final int DBVersion = 24;
private static void createAppApk(SQLiteDatabase db) { private static void createAppApk(SQLiteDatabase db) {
db.execSQL(CREATE_TABLE_APP); db.execSQL(CREATE_TABLE_APP);
@ -741,7 +744,7 @@ public class DB {
try { try {
String cols[] = new String[] { "antiFeatures", "requirements", String cols[] = new String[] { "antiFeatures", "requirements",
"id", "name", "summary", "license", "category", "id", "name", "summary", "icon", "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);
@ -754,19 +757,20 @@ 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.license = c.getString(5); app.icon = c.getString(5);
app.category = c.getString(6); app.license = c.getString(6);
app.curVersion = c.getString(7); app.category = c.getString(7);
app.curVercode = c.getInt(8); app.curVersion = c.getString(8);
String sAdded = c.getString(9); app.curVercode = c.getInt(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(10); String sLastUpdated = c.getString(11);
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(11) == 1; app.compatible = c.getInt(12) == 1;
app.ignoreUpdates = c.getInt(12) == 1; app.ignoreUpdates = c.getInt(13) == 1;
app.hasUpdates = false; app.hasUpdates = false;
if (getinstalledinfo && systemApks.containsKey(app.id)) { if (getinstalledinfo && systemApks.containsKey(app.id)) {
@ -1102,6 +1106,7 @@ 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);

View File

@ -152,8 +152,7 @@ public class FDroidApp extends Application {
for (DB.Repo repo : repos) { for (DB.Repo repo : repos) {
DB.Apk bestApk = app.apks.get(0); DB.Apk bestApk = app.apks.get(0);
if (repo.id == bestApk.repo) { if (repo.id == bestApk.repo) {
app.icon = repo.address + "/icons/" app.iconUrl = repo.address + "/icons/" + app.icon;
+ app.id + '.' + bestApk.vercode + ".png";
break; break;
} }
} }
@ -173,8 +172,7 @@ public class FDroidApp extends Application {
for (DB.Repo repo : repos) { for (DB.Repo repo : repos) {
DB.Apk bestApk = app.apks.get(0); DB.Apk bestApk = app.apks.get(0);
if (repo.id == bestApk.repo) { if (repo.id == bestApk.repo) {
app.icon = repo.address + "/icons/" app.iconUrl = repo.address + "/icons/" + app.icon;
+ app.id + '.' + bestApk.vercode + ".png";
break; break;
} }
} }

View File

@ -184,6 +184,8 @@ public class RepoXMLHandler extends DefaultHandler {
} else if (curapp != null && str != null) { } else if (curapp != null && str != null) {
if (curel.equals("name")) { 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

View File

@ -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.icon, icon); ImageLoader.getInstance().displayImage(app.iconUrl, 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;