From 953512cac99729f76443c1a2937fce15f789a526 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Sun, 29 Sep 2013 20:45:47 +0200 Subject: [PATCH] Revert some icon changes, go back to using from the index --- src/org/fdroid/fdroid/AppDetails.java | 2 +- src/org/fdroid/fdroid/DB.java | 29 +++++++++++-------- src/org/fdroid/fdroid/FDroidApp.java | 6 ++-- src/org/fdroid/fdroid/RepoXMLHandler.java | 2 ++ .../fdroid/fdroid/views/AppListAdapter.java | 2 +- 5 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/org/fdroid/fdroid/AppDetails.java b/src/org/fdroid/fdroid/AppDetails.java index 4ce75fc3e..aae1287c2 100644 --- a/src/org/fdroid/fdroid/AppDetails.java +++ b/src/org/fdroid/fdroid/AppDetails.java @@ -408,7 +408,7 @@ public class AppDetails extends ListActivity { // Set the 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... TextView tv = (TextView) findViewById(R.id.title); diff --git a/src/org/fdroid/fdroid/DB.java b/src/org/fdroid/fdroid/DB.java index cc268aacd..5b706eed7 100644 --- a/src/org/fdroid/fdroid/DB.java +++ b/src/org/fdroid/fdroid/DB.java @@ -89,7 +89,7 @@ public class DB { private static final String TABLE_APP = "fdroid_app"; private static final String CREATE_TABLE_APP = "create table " + TABLE_APP + " ( " + "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, " + "webURL text, " + "trackerURL text, " + "sourceURL text, " + "curVersion text," + "curVercode integer," @@ -104,7 +104,7 @@ public class DB { public App() { name = "Unknown"; summary = "Unknown application"; - icon = null; + icon = "noicon.png"; id = "unknown"; license = "Unknown"; category = "Uncategorized"; @@ -124,6 +124,7 @@ public class DB { compatible = false; ignoreUpdates = false; filtered = false; + iconUrl = null; } // True when all the detail fields are populated, False otherwise. @@ -206,6 +207,8 @@ public class DB { // List of apks. public List apks; + public String iconUrl; + // Get the current version - this will be one of the Apks from 'apks'. // Can return null if there are no available versions. // 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 } - private final int DBVersion = 25; + private final int DBVersion = 24; private static void createAppApk(SQLiteDatabase db) { db.execSQL(CREATE_TABLE_APP); @@ -741,7 +744,7 @@ public class DB { try { String cols[] = new String[] { "antiFeatures", "requirements", - "id", "name", "summary", "license", "category", + "id", "name", "summary", "icon", "license", "category", "curVersion", "curVercode", "added", "lastUpdated", "compatible", "ignoreUpdates" }; c = db.query(TABLE_APP, cols, null, null, null, null, null); @@ -754,19 +757,20 @@ public class DB { app.id = c.getString(2); app.name = c.getString(3); app.summary = c.getString(4); - app.license = c.getString(5); - app.category = c.getString(6); - app.curVersion = c.getString(7); - app.curVercode = c.getInt(8); - String sAdded = c.getString(9); + app.icon = c.getString(5); + app.license = c.getString(6); + app.category = c.getString(7); + app.curVersion = c.getString(8); + app.curVercode = c.getInt(9); + String sAdded = c.getString(10); app.added = (sAdded == null || sAdded.length() == 0) ? null : mDateFormat.parse(sAdded); - String sLastUpdated = c.getString(10); + String sLastUpdated = c.getString(11); app.lastUpdated = (sLastUpdated == null || sLastUpdated .length() == 0) ? null : mDateFormat .parse(sLastUpdated); - app.compatible = c.getInt(11) == 1; - app.ignoreUpdates = c.getInt(12) == 1; + app.compatible = c.getInt(12) == 1; + app.ignoreUpdates = c.getInt(13) == 1; app.hasUpdates = false; if (getinstalledinfo && systemApks.containsKey(app.id)) { @@ -1102,6 +1106,7 @@ public class DB { values.put("id", upapp.id); values.put("name", upapp.name); values.put("summary", upapp.summary); + values.put("icon", upapp.icon); values.put("description", upapp.detail_description); values.put("license", upapp.license); values.put("category", upapp.category); diff --git a/src/org/fdroid/fdroid/FDroidApp.java b/src/org/fdroid/fdroid/FDroidApp.java index 3fc7f8d00..83db7f5b7 100644 --- a/src/org/fdroid/fdroid/FDroidApp.java +++ b/src/org/fdroid/fdroid/FDroidApp.java @@ -152,8 +152,7 @@ public class FDroidApp extends Application { 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"; + app.iconUrl = repo.address + "/icons/" + app.icon; break; } } @@ -173,8 +172,7 @@ public class FDroidApp extends Application { 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"; + app.iconUrl = repo.address + "/icons/" + app.icon; break; } } diff --git a/src/org/fdroid/fdroid/RepoXMLHandler.java b/src/org/fdroid/fdroid/RepoXMLHandler.java index e9d59def0..0716da2e8 100644 --- a/src/org/fdroid/fdroid/RepoXMLHandler.java +++ b/src/org/fdroid/fdroid/RepoXMLHandler.java @@ -184,6 +184,8 @@ public class RepoXMLHandler extends DefaultHandler { } else if (curapp != null && str != null) { if (curel.equals("name")) { curapp.name = str; + } else if (curel.equals("icon")) { + curapp.icon = str; } else if (curel.equals("description")) { // This is the old-style description. We'll read it // if present, to support old repos, but in newer diff --git a/src/org/fdroid/fdroid/views/AppListAdapter.java b/src/org/fdroid/fdroid/views/AppListAdapter.java index feb78a30c..8b174793a 100644 --- a/src/org/fdroid/fdroid/views/AppListAdapter.java +++ b/src/org/fdroid/fdroid/views/AppListAdapter.java @@ -75,7 +75,7 @@ abstract public class AppListAdapter extends BaseAdapter { summary.setText(app.summary); layoutSummary(summary); - ImageLoader.getInstance().displayImage(app.icon, icon); + ImageLoader.getInstance().displayImage(app.iconUrl, icon); int visibleOnCompact = compact ? View.VISIBLE : View.GONE; int notVisibleOnCompact = compact ? View.GONE : View.VISIBLE;