diff options
author | Daniel Haß <daniel.hass@stzedn.de> | 2014-02-27 22:15:50 +0100 |
---|---|---|
committer | Daniel Haß <daniel.hass@stzedn.de> | 2014-02-27 22:15:50 +0100 |
commit | 7e229d4247a4416150574669269b5f0409fc3ce9 (patch) | |
tree | cf42e582202cfd1a5ee9a8504f66cfb835d66388 | |
parent | c60ec7a8a7b80364d2cc92aeb60e0da5522e9e48 (diff) | |
download | open-keychain-7e229d4247a4416150574669269b5f0409fc3ce9.tar.gz open-keychain-7e229d4247a4416150574669269b5f0409fc3ce9.tar.bz2 open-keychain-7e229d4247a4416150574669269b5f0409fc3ce9.zip |
Added different notifys for different exceptions
-rw-r--r-- | OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java index a11a78dd6..1118f0264 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java @@ -33,6 +33,7 @@ import org.sufficientlysecure.keychain.ui.adapter.ImportKeysListEntry; import org.sufficientlysecure.keychain.ui.adapter.ImportKeysListLoader; import org.sufficientlysecure.keychain.ui.adapter.ImportKeysListServerLoader; import org.sufficientlysecure.keychain.util.InputData; +import org.sufficientlysecure.keychain.util.KeyServer; import org.sufficientlysecure.keychain.util.Log; import android.app.Activity; @@ -43,7 +44,8 @@ import android.support.v4.app.LoaderManager; import android.support.v4.content.Loader; import android.view.View; import android.widget.ListView; -import android.widget.Toast; + +import com.devspark.appmsg.AppMsg; public class ImportKeysListFragment extends ListFragment implements LoaderManager.LoaderCallbacks<AsyncTaskResultWrapper<ArrayList<ImportKeysListEntry>>> { @@ -223,14 +225,23 @@ public class ImportKeysListFragment extends ListFragment implements case LOADER_ID_SERVER_QUERY: - if(data.getError() == null){ - Toast.makeText( + Exception error = data.getError(); + + if(error == null){ + AppMsg.makeText( getActivity(), getResources().getQuantityString(R.plurals.keys_found, mAdapter.getCount(), mAdapter.getCount()), - Toast.LENGTH_SHORT + AppMsg.STYLE_INFO ).show(); - } else { - Toast.makeText(getActivity(), "Server connection timed out!", Toast.LENGTH_SHORT).show(); + } else if(error instanceof KeyServer.InsufficientQuery){ + AppMsg.makeText(getActivity(), R.string.error_keyserver_insufficient_query, + AppMsg.STYLE_ALERT).show(); + }else if(error instanceof KeyServer.QueryException){ + AppMsg.makeText(getActivity(), R.string.error_keyserver_query, + AppMsg.STYLE_ALERT).show(); + }else if(error instanceof KeyServer.TooManyResponses){ + AppMsg.makeText(getActivity(), R.string.error_keyserver_too_many_responses, + AppMsg.STYLE_ALERT).show(); } break; |