diff --git a/res/values/strings.xml b/res/values/strings.xml index fcf48814a..1093ddcd3 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -77,6 +77,7 @@ This repo already exists! This repo is already setup, this will add new key information. This repo is already setup, confirm that you want to re-enable it. + The incoming repo is already setup and enabled! You must first delete this repo before you can add one with a different key! The list of used repositories has diff --git a/src/org/fdroid/fdroid/ManageRepo.java b/src/org/fdroid/fdroid/ManageRepo.java index 8555d90d8..ae2047705 100644 --- a/src/org/fdroid/fdroid/ManageRepo.java +++ b/src/org/fdroid/fdroid/ManageRepo.java @@ -48,6 +48,7 @@ import android.widget.EditText; import android.widget.ListView; import android.widget.SimpleAdapter; import android.widget.TextView; +import android.widget.Toast; import org.fdroid.fdroid.DB.Repo; import org.fdroid.fdroid.compat.ActionBarCompat; @@ -307,10 +308,16 @@ public class ManageRepo extends ListActivity { addButton.setText(R.string.add_key); positiveAction = PositiveAction.ADD_NEW; } else if (newFingerprint == null || newFingerprint.equals(repo.fingerprint)) { - // this entry already exists, offer to enable it - overwriteMessage.setText(R.string.repo_exists_enable); - addButton.setText(R.string.enable); - positiveAction = PositiveAction.ENABLE; + // this entry already exists and is not enabled, offer to enable it + if (repo.inuse) { + alrt.dismiss(); + Toast.makeText(this, R.string.repo_exists_and_enabled, Toast.LENGTH_LONG).show(); + return; + } else { + overwriteMessage.setText(R.string.repo_exists_enable); + addButton.setText(R.string.enable); + positiveAction = PositiveAction.ENABLE; + } } else { // same address with different fingerprint, this could be // malicious, so force the user to manually delete the repo