aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2014-06-10 15:27:26 +0200
committerVincent Breitmoser <valodim@mugenguild.com>2014-06-10 15:27:26 +0200
commite41e6ea0deec06703c5b9c80e429aff8ab110534 (patch)
treeba1051416937083879fb4a4f8d7234b175030837 /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java
parenteac582a313c779e77b0fd67358417d512680facd (diff)
downloadopen-keychain-e41e6ea0deec06703c5b9c80e429aff8ab110534.tar.gz
open-keychain-e41e6ea0deec06703c5b9c80e429aff8ab110534.tar.bz2
open-keychain-e41e6ea0deec06703c5b9c80e429aff8ab110534.zip
import-log: more interface work
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java36
1 files changed, 19 insertions, 17 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java
index 9932e3e18..61d7e7949 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java
@@ -378,37 +378,37 @@ public class ImportKeysActivity extends ActionBarActivity implements ActionBar.O
final ImportResult result =
returnData.<ImportResult>getParcelable(KeychainIntentService.RESULT);
- // , make pessimistic assumptions
- String str = Integer.toString(result.getResult());
- int duration = 0, color = Style.RED;
+ String str = "";
+ boolean hasWarnings = result.getLog().containsWarnings();
+ int duration = 0, color = hasWarnings ? Style.ORANGE : Style.GREEN;
+ String withWarnings = hasWarnings
+ ? getResources().getString(R.string.with_warnings) : "";
switch(result.getResult()) {
case ImportResult.RESULT_OK_NEWKEYS:
- color = Style.GREEN;
- duration = SuperToast.Duration.LONG;
+ if (!hasWarnings) {
+ duration = SuperToast.Duration.LONG;
+ }
str = getResources().getQuantityString(
- R.plurals.keys_added, result.mNewKeys, result.mNewKeys);
+ R.plurals.keys_added, result.mNewKeys, result.mNewKeys, withWarnings);
break;
case ImportResult.RESULT_OK_UPDATED:
- color = Style.GREEN;
- duration = SuperToast.Duration.LONG;
+ if (!hasWarnings) {
+ duration = SuperToast.Duration.LONG;
+ }
str = getResources().getQuantityString(
- R.plurals.keys_updated, result.mNewKeys, result.mNewKeys);
+ R.plurals.keys_updated, result.mNewKeys, result.mNewKeys, withWarnings);
break;
case ImportResult.RESULT_OK_BOTHKEYS:
- color = Style.GREEN;
- duration = SuperToast.Duration.LONG;
+ if (!hasWarnings) {
+ duration = SuperToast.Duration.LONG;
+ }
str = getResources().getQuantityString(
R.plurals.keys_added_and_updated_1, result.mNewKeys, result.mNewKeys);
str += getResources().getQuantityString(
- R.plurals.keys_added_and_updated_2, result.mUpdatedKeys, result.mUpdatedKeys);
- break;
-
- case ImportResult.RESULT_OK_WITH_WARNINGS:
- str = "ok with warnings";
- color = Style.ORANGE;
+ R.plurals.keys_added_and_updated_2, result.mUpdatedKeys, result.mUpdatedKeys, withWarnings);
break;
case ImportResult.RESULT_PARTIAL_WITH_ERRORS:
@@ -435,6 +435,8 @@ public class ImportKeysActivity extends ActionBarActivity implements ActionBar.O
toast.setSwipeToDismiss(true);
toast.setButtonIcon(R.drawable.ic_action_view_as_list,
getResources().getString(R.string.view_log));
+ toast.setButtonTextColor(R.color.emphasis_dark);
+ toast.setTextColor(R.color.emphasis_dark);
toast.setOnClickWrapper(new OnClickWrapper("supercardtoast",
new SuperToast.OnClickListener() {
@Override