purge all references to ICON_URL_LARGE, its unused

This was only partially hooked up and often not even populated.
It was added in 4895e2d790ec3b91fa4271a24e1ea0ae69d362f4, but things have
changed a lot now.  We should be moving towards preferring the drawable XML
vector icons, which will scale nicely for all DPIs.
This commit is contained in:
Hans-Christoph Steiner 2018-03-20 16:37:53 +01:00
parent 57b2032e30
commit cc540301d1
6 changed files with 5 additions and 68 deletions

View File

@ -203,15 +203,10 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
public String[] requirements;
/**
* To be displayed at 48dp (x1.0)
* URL to download the app's icon.
*/
public String iconUrl;
/**
* To be displayed at 72dp (x1.5)
*/
public String iconUrlLarge;
public static String getIconName(String packageName, int versionCode) {
return packageName + "_" + versionCode + ".png";
}
@ -327,9 +322,6 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
case Cols.ICON_URL:
iconUrl = cursor.getString(i);
break;
case Cols.ICON_URL_LARGE:
iconUrlLarge = cursor.getString(i);
break;
case Cols.FEATURE_GRAPHIC:
featureGraphic = cursor.getString(i);
break;
@ -909,7 +901,6 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
values.put(Cols.SUMMARY, summary);
values.put(Cols.ICON, icon);
values.put(Cols.ICON_URL, iconUrl);
values.put(Cols.ICON_URL_LARGE, iconUrlLarge);
values.put(Cols.DESCRIPTION, description);
values.put(Cols.WHATSNEW, whatsNew);
values.put(Cols.LICENSE, license);
@ -1158,7 +1149,6 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
dest.writeStringArray(this.antiFeatures);
dest.writeStringArray(this.requirements);
dest.writeString(this.iconUrl);
dest.writeString(this.iconUrlLarge);
dest.writeString(this.featureGraphic);
dest.writeString(this.promoGraphic);
dest.writeString(this.tvBanner);
@ -1210,7 +1200,6 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
this.antiFeatures = in.createStringArray();
this.requirements = in.createStringArray();
this.iconUrl = in.readString();
this.iconUrlLarge = in.readString();
this.featureGraphic = in.readString();
this.promoGraphic = in.readString();
this.tvBanner = in.readString();

View File

@ -1194,15 +1194,12 @@ public class AppProvider extends FDroidProvider {
final String appTable = getTableName();
final String apkTable = getApkTableName();
final String iconsDir = Utils.getIconsDir(getContext(), 1.0);
final String iconsDirLarge = Utils.getIconsDir(getContext(), 1.5);
String repoVersion = Integer.toString(Repo.VERSION_DENSITY_SPECIFIC_ICONS);
Utils.debugLog(TAG, "Updating icon paths for apps belonging to repos with version >= " + repoVersion);
Utils.debugLog(TAG, "Using icons dir '" + iconsDir + "'");
Utils.debugLog(TAG, "Using large icons dir '" + iconsDirLarge + "'");
String query = getIconUpdateQuery(appTable, apkTable);
final String[] params = {
repoVersion, iconsDir, Utils.FALLBACK_ICONS_DIR,
repoVersion, iconsDirLarge, Utils.FALLBACK_ICONS_DIR,
};
db().execSQL(query, params);
}
@ -1242,8 +1239,7 @@ public class AppProvider extends FDroidProvider {
apk + "." + ApkTable.Cols.VERSION_CODE + " = " + app + "." + Cols.SUGGESTED_VERSION_CODE;
return "UPDATE " + app + " SET "
+ Cols.ICON_URL + " = ( " + iconUrlQuery + " ), "
+ Cols.ICON_URL_LARGE + " = ( " + iconUrlQuery + " )";
+ Cols.ICON_URL + " = ( " + iconUrlQuery + " )";
}
}

View File

@ -150,7 +150,6 @@ public class DBHelper extends SQLiteOpenHelper {
+ AppMetadataTable.Cols.LAST_UPDATED + " string,"
+ AppMetadataTable.Cols.IS_COMPATIBLE + " int not null,"
+ AppMetadataTable.Cols.ICON_URL + " text, "
+ AppMetadataTable.Cols.ICON_URL_LARGE + " text, "
+ AppMetadataTable.Cols.FEATURE_GRAPHIC + " string,"
+ AppMetadataTable.Cols.PROMO_GRAPHIC + " string,"
+ AppMetadataTable.Cols.TV_BANNER + " string,"
@ -296,8 +295,6 @@ public class DBHelper extends SQLiteOpenHelper {
populateRepoNames(db, oldVersion);
addIsSwapToRepo(db, oldVersion);
addChangelogToApp(db, oldVersion);
addIconUrlLargeToApp(db, oldVersion);
updateIconUrlLarge(db, oldVersion);
addCredentialsToRepo(db, oldVersion);
addAuthorToApp(db, oldVersion);
useMaxValueInMaxSdkVersion(db, oldVersion);
@ -1015,48 +1012,6 @@ public class DBHelper extends SQLiteOpenHelper {
db.execSQL("alter table " + AppMetadataTable.NAME + " add column " + AppMetadataTable.Cols.CHANGELOG + " text");
}
private void addIconUrlLargeToApp(SQLiteDatabase db, int oldVersion) {
if (oldVersion >= 49 || columnExists(db, AppMetadataTable.NAME, AppMetadataTable.Cols.ICON_URL_LARGE)) {
return;
}
Utils.debugLog(TAG, "Adding " + AppMetadataTable.Cols.ICON_URL_LARGE + " columns to " + AppMetadataTable.NAME);
db.execSQL("alter table " + AppMetadataTable.NAME + " add column " + AppMetadataTable.Cols.ICON_URL_LARGE + " text");
}
private void updateIconUrlLarge(SQLiteDatabase db, int oldVersion) {
if (oldVersion >= 50) {
return;
}
Utils.debugLog(TAG, "Recalculating app icon URLs so that the newly added large icons will get updated.");
String query = "UPDATE fdroid_app "
+ "SET iconUrl = ("
+ " SELECT (fdroid_repo.address || CASE WHEN fdroid_repo.version >= ? THEN ? ELSE ? END || fdroid_app.icon) "
+ " FROM fdroid_apk "
+ " JOIN fdroid_repo ON (fdroid_repo._id = fdroid_apk.repo) "
+ " WHERE fdroid_app.id = fdroid_apk.id AND fdroid_apk.vercode = fdroid_app.suggestedVercode "
+ "), iconUrlLarge = ("
+ " SELECT (fdroid_repo.address || CASE WHEN fdroid_repo.version >= ? THEN ? ELSE ? END || fdroid_app.icon) "
+ " FROM fdroid_apk "
+ " JOIN fdroid_repo ON (fdroid_repo._id = fdroid_apk.repo) "
+ " WHERE fdroid_app.id = fdroid_apk.id AND fdroid_apk.vercode = fdroid_app.suggestedVercode"
+ ")";
String iconsDir = Utils.getIconsDir(context, 1.0);
String iconsDirLarge = Utils.getIconsDir(context, 1.5);
String repoVersion = Integer.toString(Repo.VERSION_DENSITY_SPECIFIC_ICONS);
Utils.debugLog(TAG, "Using icons dir '" + iconsDir + "'");
Utils.debugLog(TAG, "Using large icons dir '" + iconsDirLarge + "'");
String[] args = {
repoVersion, iconsDir, Utils.FALLBACK_ICONS_DIR,
repoVersion, iconsDirLarge, Utils.FALLBACK_ICONS_DIR,
};
db.rawQuery(query, args);
clearRepoEtags(db);
}
private void addAuthorToApp(SQLiteDatabase db, int oldVersion) {
if (oldVersion >= 53) {
return;

View File

@ -190,7 +190,6 @@ public interface Schema {
String ANTI_FEATURES = "antiFeatures";
String REQUIREMENTS = "requirements";
String ICON_URL = "iconUrl";
String ICON_URL_LARGE = "iconUrlLarge";
String FEATURE_GRAPHIC = "featureGraphic";
String PROMO_GRAPHIC = "promoGraphic";
String TV_BANNER = "tvBanner";
@ -236,7 +235,7 @@ public interface Schema {
WHATSNEW, LICENSE, AUTHOR_NAME, AUTHOR_EMAIL, WEBSITE, ISSUE_TRACKER, SOURCE_CODE,
VIDEO, CHANGELOG, DONATE, BITCOIN, LITECOIN, FLATTR_ID, LIBERAPAY_ID,
UPSTREAM_VERSION_NAME, UPSTREAM_VERSION_CODE, ADDED, LAST_UPDATED,
ANTI_FEATURES, REQUIREMENTS, ICON_URL, ICON_URL_LARGE,
ANTI_FEATURES, REQUIREMENTS, ICON_URL,
FEATURE_GRAPHIC, PROMO_GRAPHIC, TV_BANNER, PHONE_SCREENSHOTS,
SEVEN_INCH_SCREENSHOTS, TEN_INCH_SCREENSHOTS, TV_SCREENSHOTS, WEAR_SCREENSHOTS,
PREFERRED_SIGNER, SUGGESTED_VERSION_CODE, IS_APK,
@ -252,7 +251,7 @@ public interface Schema {
WHATSNEW, LICENSE, AUTHOR_NAME, AUTHOR_EMAIL, WEBSITE, ISSUE_TRACKER, SOURCE_CODE,
VIDEO, CHANGELOG, DONATE, BITCOIN, LITECOIN, FLATTR_ID, LIBERAPAY_ID,
UPSTREAM_VERSION_NAME, UPSTREAM_VERSION_CODE, ADDED, LAST_UPDATED,
ANTI_FEATURES, REQUIREMENTS, ICON_URL, ICON_URL_LARGE,
ANTI_FEATURES, REQUIREMENTS, ICON_URL,
FEATURE_GRAPHIC, PROMO_GRAPHIC, TV_BANNER, PHONE_SCREENSHOTS,
SEVEN_INCH_SCREENSHOTS, TEN_INCH_SCREENSHOTS, TV_SCREENSHOTS, WEAR_SCREENSHOTS,
PREFERRED_SIGNER, SUGGESTED_VERSION_CODE, IS_APK, SuggestedApk.VERSION_NAME,

View File

@ -87,8 +87,7 @@ public class InstallConfirmActivity extends FragmentActivity implements OnCancel
TabHost tabHost = (TabHost) findViewById(android.R.id.tabhost);
appName.setText(app.name);
ImageLoader.getInstance().displayImage(app.iconUrlLarge, appIcon,
displayImageOptions);
ImageLoader.getInstance().displayImage(app.iconUrl, appIcon, displayImageOptions);
tabHost.setup();
ViewPager viewPager = (ViewPager) findViewById(R.id.pager);

View File

@ -271,7 +271,6 @@ public class IndexV1UpdaterTest extends FDroidProviderTest {
"flattrID",
"icon",
"iconUrl",
"iconUrlLarge",
"issueTracker",
"lastUpdated",
"liberapayID",