From f5dc1ddc96b72b7db02ae67f6de911f99beba7a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Thu, 9 May 2013 11:42:20 +0200 Subject: [PATCH] Alert before trying to downgrade --- res/values/strings.xml | 1 + src/org/fdroid/fdroid/AppDetails.java | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index d14d63846..0fae56971 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -5,6 +5,7 @@ No applications were found matching \'%s\' 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) Android says this package is not compatible with your device. Do you want to try and install it anyway? + You are trying to downgrade this application. Doing so might get it to malfunction and even lose your data. Do you want to try and downgrade it anyway? Version %d versions available %d version available diff --git a/src/org/fdroid/fdroid/AppDetails.java b/src/org/fdroid/fdroid/AppDetails.java index 2b0882beb..b5e301171 100644 --- a/src/org/fdroid/fdroid/AppDetails.java +++ b/src/org/fdroid/fdroid/AppDetails.java @@ -475,7 +475,26 @@ public class AppDetails extends ListActivity { curapk = app.apks.get(position - l.getHeaderViewsCount()); if (app.installedVerCode == curapk.vercode) removeApk(app.id); - else + else if (app.installedVerCode > curapk.vercode) { + AlertDialog.Builder ask_alrt = new AlertDialog.Builder(this); + ask_alrt.setMessage(getString(R.string.installDowngrade)); + ask_alrt.setPositiveButton(getString(R.string.yes), + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, + int whichButton) { + install(); + } + }); + ask_alrt.setNegativeButton(getString(R.string.no), + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, + int whichButton) { + return; + } + }); + AlertDialog alert = ask_alrt.create(); + alert.show(); + } else install(); }