diff --git a/app/src/androidTest/java/org/fdroid/fdroid/LocalizationTest.java b/app/src/androidTest/java/org/fdroid/fdroid/LocalizationTest.java index 562b970ff..c447e463e 100644 --- a/app/src/androidTest/java/org/fdroid/fdroid/LocalizationTest.java +++ b/app/src/androidTest/java/org/fdroid/fdroid/LocalizationTest.java @@ -99,13 +99,14 @@ public class LocalizationTest { // Resources() requires DisplayMetrics, but they are only needed for drawables resources = new Resources(assets, new DisplayMetrics(), config); for (Field field : fields) { - int resId = field.getInt(int.class); - for (int quantity = 0; quantity < 22; quantity++) { - resources.getQuantityString(resId, quantity); - } - - String formats = haveFormats.get(field.getName()); + String formats = null; try { + int resId = field.getInt(int.class); + for (int quantity = 0; quantity < 22; quantity++) { + resources.getQuantityString(resId, quantity); + } + + formats = haveFormats.get(field.getName()); switch (formats) { case "d": resources.getQuantityString(resId, 1, 1); @@ -121,7 +122,7 @@ public class LocalizationTest { throw new IllegalStateException("Pattern not included in tests: " + formats); } } - } catch (IllegalFormatException e) { + } catch (IllegalFormatException | Resources.NotFoundException e) { Log.i(TAG, locale + " " + field.getName()); throw new IllegalArgumentException("Bad '" + formats + "' format in " + locale + " " + field.getName() + ": " + e.getMessage()); diff --git a/app/src/main/java/org/fdroid/fdroid/Preferences.java b/app/src/main/java/org/fdroid/fdroid/Preferences.java index fa4079a77..60d6f7964 100644 --- a/app/src/main/java/org/fdroid/fdroid/Preferences.java +++ b/app/src/main/java/org/fdroid/fdroid/Preferences.java @@ -53,6 +53,7 @@ public final class Preferences implements SharedPreferences.OnSharedPreferenceCh public static final String PREF_UNSTABLE_UPDATES = "unstableUpdates"; public static final String PREF_KEEP_INSTALL_HISTORY = "keepInstallHistory"; public static final String PREF_EXPERT = "expert"; + public static final String PREF_FORCE_OLD_INDEX = "forceOldIndex"; public static final String PREF_PRIVILEGED_INSTALLER = "privilegedInstaller"; public static final String PREF_UNINSTALL_PRIVILEGED_APP = "uninstallPrivilegedApp"; public static final String PREF_LOCAL_REPO_NAME = "localRepoName"; @@ -82,6 +83,7 @@ public final class Preferences implements SharedPreferences.OnSharedPreferenceCh public static final String DEFAULT_PROXY_HOST = "127.0.0.1"; public static final int DEFAULT_PROXY_PORT = 8118; private static final boolean DEFAULT_SHOW_NFC_DURING_SWAP = true; + private static final boolean DEFAULT_FORCE_OLD_INDEX = false; private static final boolean DEFAULT_POST_PRIVILEGED_INSTALL = false; public enum Theme { @@ -114,6 +116,10 @@ public final class Preferences implements SharedPreferences.OnSharedPreferenceCh initialized.put(key, false); } + public boolean isForceOldIndexEnabled() { + return preferences.getBoolean(PREF_FORCE_OLD_INDEX, DEFAULT_FORCE_OLD_INDEX); + } + /** * Whether to use the Privileged Installer, based on if it is installed. Only the disabled * state is stored as a preference since the enabled state is based entirely on the presence diff --git a/app/src/main/java/org/fdroid/fdroid/UpdateService.java b/app/src/main/java/org/fdroid/fdroid/UpdateService.java index 5efe407d2..db0b49e1e 100644 --- a/app/src/main/java/org/fdroid/fdroid/UpdateService.java +++ b/app/src/main/java/org/fdroid/fdroid/UpdateService.java @@ -409,7 +409,7 @@ public class UpdateService extends IntentService { try { RepoUpdater updater = new IndexV1Updater(this, repo); //TODO setProgressListeners(updater); - if (!updater.update()) { + if (Preferences.get().isForceOldIndexEnabled() || !updater.update()) { updater = new RepoUpdater(getBaseContext(), repo); setProgressListeners(updater); updater.update(); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ae17894b2..d846ca125 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -5,11 +5,9 @@ The new version is signed with a different key to the old one. To install the new version, the old one must be uninstalled first. Please do this and try again. (Note that uninstalling will erase - any internal data stored by the application) - - It seems like this package is not compatible with your device. Do you want to try - and install it anyway? + any internal data stored by the app) + App incompatible with your device, install anyway? Version by %s Delete @@ -20,6 +18,8 @@ Suggest updates to unstable versions Keep install history Store a log of all installs and uninstalls inside F-Droid + Force old index format + In case there are bugs or compatibility issues, use the XML app index Other Automatic update interval @@ -32,7 +32,7 @@ Automatically install updates Download and install update apps in the background - Update notifications + Show available updates Show a notification when updates are available Privileged Extension Use F-Droid Privileged Extension to install, update, and remove packages @@ -58,7 +58,7 @@ Version Website Source code - Email + E-mail License Incompatible @@ -77,7 +77,7 @@ Update %1$s Install %1$s Downloading %1$s - %1$s successfully installed + %1$s installed Released today Released yesterday @@ -136,7 +136,7 @@ Repository: %s Repositories - Add additional sources of applications + Add additional sources of apps Settings Search New Repository @@ -196,9 +196,9 @@ Expert mode Show extra info and enable extra settings - Search applications + Search apps - Application compatibility + App compatibility Incompatible versions Show app versions incompatible with the device Ignore root @@ -226,9 +226,9 @@ Enable HTTP Proxy Configure HTTP Proxy for all network requests Proxy Host - Configure your proxy\'s hostname (e.g. 127.0.0.1) + Your proxy\'s hostname (e.g. 127.0.0.1) Proxy Port - Configure your proxy\'s port number (e.g. 8118) + Your proxy\'s port number (e.g. 8118)