diff options
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SettingsKeyserverFragment.java | 8 | ||||
-rw-r--r-- | OpenKeychain/src/main/res/values/strings.xml | 3 |
2 files changed, 8 insertions, 3 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SettingsKeyserverFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SettingsKeyserverFragment.java index 6578d06af..2ae64d90b 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SettingsKeyserverFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SettingsKeyserverFragment.java @@ -45,7 +45,6 @@ import org.sufficientlysecure.keychain.ui.util.recyclerview.ItemTouchHelperViewH import org.sufficientlysecure.keychain.ui.util.recyclerview.ItemTouchHelperDragCallback; import org.sufficientlysecure.keychain.ui.util.Notify; import org.sufficientlysecure.keychain.ui.util.recyclerview.RecyclerItemClickListener; -import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.util.Preferences; import java.util.ArrayList; @@ -146,7 +145,7 @@ public class SettingsKeyserverFragment extends Fragment implements RecyclerItemC if (deleted) { Notify.create(getActivity(), getActivity().getString( - R.string.keyserver_deleted, mKeyservers.get(position)), + R.string.keyserver_preference_deleted, mKeyservers.get(position)), Notify.Style.OK) .show(); deleteKeyserver(position); @@ -222,6 +221,11 @@ public class SettingsKeyserverFragment extends Fragment implements RecyclerItemC } private void deleteKeyserver(int position) { + if (mKeyservers.size() == 1) { + Notify.create(getActivity(), R.string.keyserver_preference_cannot_delete_last, + Notify.Style.ERROR).show(); + return; + } mKeyservers.remove(position); // we use this mAdapter.notifyItemRemoved(position); diff --git a/OpenKeychain/src/main/res/values/strings.xml b/OpenKeychain/src/main/res/values/strings.xml index 619c67ee3..c216cd869 100644 --- a/OpenKeychain/src/main/res/values/strings.xml +++ b/OpenKeychain/src/main/res/values/strings.xml @@ -685,7 +685,8 @@ <string name="add_keyserver_without_verification">"Keyserver added without verification."</string> <string name="add_keyserver_invalid_url">"Invalid URL!"</string> <string name="add_keyserver_connection_failed">"Failed to connect to keyserver. Please check the URL and your internet connection."</string> - <string name="keyserver_deleted">"%s deleted"</string> + <string name="keyserver_preference_deleted">"%s deleted"</string> + <string name="keyserver_preference_cannot_delete_last">"Cannot delete last keyserver. At least one is required!"</string> <!-- Navigation Drawer --> <string name="nav_keys">"Keys"</string> |