Merge branch 'purge-iconUrlLarge' into 'master'

purge all references to ICON_URL_LARGE, its unused

See merge request fdroid/fdroidclient!659
This commit is contained in:
Hans-Christoph Steiner 2018-03-23 14:02:30 +00:00
commit 5de555d0b4
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; public String[] requirements;
/** /**
* To be displayed at 48dp (x1.0) * URL to download the app's icon.
*/ */
public String iconUrl; public String iconUrl;
/**
* To be displayed at 72dp (x1.5)
*/
public String iconUrlLarge;
public static String getIconName(String packageName, int versionCode) { public static String getIconName(String packageName, int versionCode) {
return packageName + "_" + versionCode + ".png"; return packageName + "_" + versionCode + ".png";
} }
@ -327,9 +322,6 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
case Cols.ICON_URL: case Cols.ICON_URL:
iconUrl = cursor.getString(i); iconUrl = cursor.getString(i);
break; break;
case Cols.ICON_URL_LARGE:
iconUrlLarge = cursor.getString(i);
break;
case Cols.FEATURE_GRAPHIC: case Cols.FEATURE_GRAPHIC:
featureGraphic = cursor.getString(i); featureGraphic = cursor.getString(i);
break; break;
@ -909,7 +901,6 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
values.put(Cols.SUMMARY, summary); values.put(Cols.SUMMARY, summary);
values.put(Cols.ICON, icon); values.put(Cols.ICON, icon);
values.put(Cols.ICON_URL, iconUrl); values.put(Cols.ICON_URL, iconUrl);
values.put(Cols.ICON_URL_LARGE, iconUrlLarge);
values.put(Cols.DESCRIPTION, description); values.put(Cols.DESCRIPTION, description);
values.put(Cols.WHATSNEW, whatsNew); values.put(Cols.WHATSNEW, whatsNew);
values.put(Cols.LICENSE, license); 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.antiFeatures);
dest.writeStringArray(this.requirements); dest.writeStringArray(this.requirements);
dest.writeString(this.iconUrl); dest.writeString(this.iconUrl);
dest.writeString(this.iconUrlLarge);
dest.writeString(this.featureGraphic); dest.writeString(this.featureGraphic);
dest.writeString(this.promoGraphic); dest.writeString(this.promoGraphic);
dest.writeString(this.tvBanner); dest.writeString(this.tvBanner);
@ -1210,7 +1200,6 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
this.antiFeatures = in.createStringArray(); this.antiFeatures = in.createStringArray();
this.requirements = in.createStringArray(); this.requirements = in.createStringArray();
this.iconUrl = in.readString(); this.iconUrl = in.readString();
this.iconUrlLarge = in.readString();
this.featureGraphic = in.readString(); this.featureGraphic = in.readString();
this.promoGraphic = in.readString(); this.promoGraphic = in.readString();
this.tvBanner = in.readString(); this.tvBanner = in.readString();

View File

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

View File

@ -150,7 +150,6 @@ public class DBHelper extends SQLiteOpenHelper {
+ AppMetadataTable.Cols.LAST_UPDATED + " string," + AppMetadataTable.Cols.LAST_UPDATED + " string,"
+ AppMetadataTable.Cols.IS_COMPATIBLE + " int not null," + AppMetadataTable.Cols.IS_COMPATIBLE + " int not null,"
+ AppMetadataTable.Cols.ICON_URL + " text, " + AppMetadataTable.Cols.ICON_URL + " text, "
+ AppMetadataTable.Cols.ICON_URL_LARGE + " text, "
+ AppMetadataTable.Cols.FEATURE_GRAPHIC + " string," + AppMetadataTable.Cols.FEATURE_GRAPHIC + " string,"
+ AppMetadataTable.Cols.PROMO_GRAPHIC + " string," + AppMetadataTable.Cols.PROMO_GRAPHIC + " string,"
+ AppMetadataTable.Cols.TV_BANNER + " string," + AppMetadataTable.Cols.TV_BANNER + " string,"
@ -296,8 +295,6 @@ public class DBHelper extends SQLiteOpenHelper {
populateRepoNames(db, oldVersion); populateRepoNames(db, oldVersion);
addIsSwapToRepo(db, oldVersion); addIsSwapToRepo(db, oldVersion);
addChangelogToApp(db, oldVersion); addChangelogToApp(db, oldVersion);
addIconUrlLargeToApp(db, oldVersion);
updateIconUrlLarge(db, oldVersion);
addCredentialsToRepo(db, oldVersion); addCredentialsToRepo(db, oldVersion);
addAuthorToApp(db, oldVersion); addAuthorToApp(db, oldVersion);
useMaxValueInMaxSdkVersion(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"); 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) { private void addAuthorToApp(SQLiteDatabase db, int oldVersion) {
if (oldVersion >= 53) { if (oldVersion >= 53) {
return; return;

View File

@ -190,7 +190,6 @@ public interface Schema {
String ANTI_FEATURES = "antiFeatures"; String ANTI_FEATURES = "antiFeatures";
String REQUIREMENTS = "requirements"; String REQUIREMENTS = "requirements";
String ICON_URL = "iconUrl"; String ICON_URL = "iconUrl";
String ICON_URL_LARGE = "iconUrlLarge";
String FEATURE_GRAPHIC = "featureGraphic"; String FEATURE_GRAPHIC = "featureGraphic";
String PROMO_GRAPHIC = "promoGraphic"; String PROMO_GRAPHIC = "promoGraphic";
String TV_BANNER = "tvBanner"; String TV_BANNER = "tvBanner";
@ -236,7 +235,7 @@ public interface Schema {
WHATSNEW, LICENSE, AUTHOR_NAME, AUTHOR_EMAIL, WEBSITE, ISSUE_TRACKER, SOURCE_CODE, WHATSNEW, LICENSE, AUTHOR_NAME, AUTHOR_EMAIL, WEBSITE, ISSUE_TRACKER, SOURCE_CODE,
VIDEO, CHANGELOG, DONATE, BITCOIN, LITECOIN, FLATTR_ID, LIBERAPAY_ID, VIDEO, CHANGELOG, DONATE, BITCOIN, LITECOIN, FLATTR_ID, LIBERAPAY_ID,
UPSTREAM_VERSION_NAME, UPSTREAM_VERSION_CODE, ADDED, LAST_UPDATED, 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, FEATURE_GRAPHIC, PROMO_GRAPHIC, TV_BANNER, PHONE_SCREENSHOTS,
SEVEN_INCH_SCREENSHOTS, TEN_INCH_SCREENSHOTS, TV_SCREENSHOTS, WEAR_SCREENSHOTS, SEVEN_INCH_SCREENSHOTS, TEN_INCH_SCREENSHOTS, TV_SCREENSHOTS, WEAR_SCREENSHOTS,
PREFERRED_SIGNER, SUGGESTED_VERSION_CODE, IS_APK, 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, WHATSNEW, LICENSE, AUTHOR_NAME, AUTHOR_EMAIL, WEBSITE, ISSUE_TRACKER, SOURCE_CODE,
VIDEO, CHANGELOG, DONATE, BITCOIN, LITECOIN, FLATTR_ID, LIBERAPAY_ID, VIDEO, CHANGELOG, DONATE, BITCOIN, LITECOIN, FLATTR_ID, LIBERAPAY_ID,
UPSTREAM_VERSION_NAME, UPSTREAM_VERSION_CODE, ADDED, LAST_UPDATED, 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, FEATURE_GRAPHIC, PROMO_GRAPHIC, TV_BANNER, PHONE_SCREENSHOTS,
SEVEN_INCH_SCREENSHOTS, TEN_INCH_SCREENSHOTS, TV_SCREENSHOTS, WEAR_SCREENSHOTS, SEVEN_INCH_SCREENSHOTS, TEN_INCH_SCREENSHOTS, TV_SCREENSHOTS, WEAR_SCREENSHOTS,
PREFERRED_SIGNER, SUGGESTED_VERSION_CODE, IS_APK, SuggestedApk.VERSION_NAME, 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); TabHost tabHost = (TabHost) findViewById(android.R.id.tabhost);
appName.setText(app.name); appName.setText(app.name);
ImageLoader.getInstance().displayImage(app.iconUrlLarge, appIcon, ImageLoader.getInstance().displayImage(app.iconUrl, appIcon, displayImageOptions);
displayImageOptions);
tabHost.setup(); tabHost.setup();
ViewPager viewPager = (ViewPager) findViewById(R.id.pager); ViewPager viewPager = (ViewPager) findViewById(R.id.pager);

View File

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