From fc61208ce78e1a70dbd407bb554ff3e3edd91cea Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Mon, 27 Apr 2015 19:49:42 +0200 Subject: [PATCH] small ui niceties --- .../keychain/ui/adapter/LinkedIdsAdapter.java | 9 +++++++++ .../ui/linked/LinkedIdCreateTwitterStep2Fragment.java | 3 ++- .../keychain/ui/linked/LinkedIdViewFragment.java | 11 ++++++----- .../keychain/ui/util/SubtleAttentionSeeker.java | 8 +++++++- OpenKeychain/src/main/res/layout/linked_id_item.xml | 2 +- OpenKeychain/src/main/res/values/strings.xml | 10 +++++----- 6 files changed, 30 insertions(+), 13 deletions(-) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/LinkedIdsAdapter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/LinkedIdsAdapter.java index 480421499..9455f9489 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/LinkedIdsAdapter.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/LinkedIdsAdapter.java @@ -18,6 +18,7 @@ package org.sufficientlysecure.keychain.ui.adapter; +import android.animation.ObjectAnimator; import android.app.Activity; import android.content.Context; import android.database.Cursor; @@ -39,6 +40,7 @@ import org.sufficientlysecure.keychain.provider.KeychainContract.UserPackets; import org.sufficientlysecure.keychain.ui.linked.LinkedIdViewFragment; import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils; import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils.State; +import org.sufficientlysecure.keychain.ui.util.SubtleAttentionSeeker; import org.sufficientlysecure.keychain.util.FilterCursorWrapper; import java.io.IOException; @@ -219,6 +221,13 @@ public class LinkedIdsAdapter extends UserAttributesAdapter { vIcon.setImageResource(id.getDisplayIcon()); } + + public void seekAttention() { + ObjectAnimator anim = SubtleAttentionSeeker.tintText(vComment, 1000); + anim.setStartDelay(200); + anim.start(); + } + } } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdCreateTwitterStep2Fragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdCreateTwitterStep2Fragment.java index 295ef4aef..89d72faf3 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdCreateTwitterStep2Fragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdCreateTwitterStep2Fragment.java @@ -20,6 +20,7 @@ package org.sufficientlysecure.keychain.ui.linked; import android.content.Intent; import android.net.Uri; import android.os.Bundle; +import android.text.Html; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; @@ -81,7 +82,7 @@ public class LinkedIdCreateTwitterStep2Fragment extends LinkedIdCreateFinalFragm }); ((TextView) view.findViewById(R.id.linked_tweet_published)).setText( - getString(R.string.linked_create_twitter_2_3, mResourceHandle) + Html.fromHtml(getString(R.string.linked_create_twitter_2_3, mResourceHandle)) ); return view; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdViewFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdViewFragment.java index f618181c6..f4987d137 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdViewFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdViewFragment.java @@ -3,7 +3,6 @@ package org.sufficientlysecure.keychain.ui.linked; import java.io.IOException; import java.util.Collections; -import android.animation.ObjectAnimator; import android.content.Context; import android.content.Intent; import android.database.Cursor; @@ -26,6 +25,7 @@ import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextSwitcher; +import android.widget.TextView; import android.widget.ViewAnimator; import org.sufficientlysecure.keychain.Constants; @@ -477,10 +477,11 @@ public class LinkedIdViewFragment extends CryptoOperationFragment implements } if (result.success()) { mViewHolder.vText.setText(getString(mLinkedResource.getVerifiedText(mIsSecret))); + // hack to preserve bold text + ((TextView) mViewHolder.vText.getCurrentView()).setText( + mLinkedResource.getVerifiedText(mIsSecret)); mViewHolder.setVerifyingState(mContext, VerifyState.VERIFY_OK, mIsSecret); - ObjectAnimator anim = SubtleAttentionSeeker.tada(mViewHolder.vButtonConfirm, 0.6f, 1000); - anim.setStartDelay(800); - anim.start(); + mViewHolder.mLinkedIdHolder.seekAttention(); } else { mViewHolder.setVerifyingState(mContext, VerifyState.VERIFY_ERROR, mIsSecret); result.createNotify(getActivity()).show(); @@ -501,7 +502,7 @@ public class LinkedIdViewFragment extends CryptoOperationFragment implements mCertifyKeyId = mViewHolder.vKeySpinner.getSelectedItemId(); if (mCertifyKeyId == key.none || mCertifyKeyId == key.symmetric) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - SubtleAttentionSeeker.tint(mViewHolder.vKeySpinnerContainer, 600).start(); + SubtleAttentionSeeker.tintBackground(mViewHolder.vKeySpinnerContainer, 600).start(); } else { Notify.create(getActivity(), R.string.select_key_to_certify, Style.ERROR).show(); } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/SubtleAttentionSeeker.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/SubtleAttentionSeeker.java index bf4211899..4549e8993 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/SubtleAttentionSeeker.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/SubtleAttentionSeeker.java @@ -94,9 +94,15 @@ public class SubtleAttentionSeeker { } @TargetApi(VERSION_CODES.LOLLIPOP) - public static ObjectAnimator tint(View view, int duration) { + public static ObjectAnimator tintBackground(View view, int duration) { return ObjectAnimator.ofArgb(view, "backgroundColor", 0x00FF0000, 0x33FF0000, 0x00FF0000).setDuration(duration); } + @TargetApi(VERSION_CODES.LOLLIPOP) + public static ObjectAnimator tintText(View view, int duration) { + return ObjectAnimator.ofArgb(view, "backgroundColor", + 0x00FF7F00, 0x33FF7F00, 0x00FF7F00).setDuration(duration); + } + } diff --git a/OpenKeychain/src/main/res/layout/linked_id_item.xml b/OpenKeychain/src/main/res/layout/linked_id_item.xml index c70701962..4846bd0a4 100644 --- a/OpenKeychain/src/main/res/layout/linked_id_item.xml +++ b/OpenKeychain/src/main/res/layout/linked_id_item.xml @@ -38,7 +38,7 @@ Twitter Handle "Click either button to tweet the message!" "You can edit the Tweet before posting it, so long as the text inside the brackets is unmodified." - "Once your Tweet is published as @%s, click the Verify button to scan your timeline for it." + "Once your Tweet is published as <b>@%s</b>, click the Verify button to scan your timeline for it." "After successful verification, press the Finish button to add the Linked Identity to your keyring and finish the process." "By creating a Linked Identity of this type, you can link your key to a Github account you control." @@ -1350,10 +1350,10 @@ "Verify" Text has been copied to clipboard - "The link between this Website and key was securely verified. If you believe the Website is genuine, confirm this verification with your key." - "The link between this Github account and key was securely verified. If you believe the account is genuine, confirm this verification with your key." - "The link between this Domain Name and key was securely verified. If you believe the Domain is genuine, confirm this verification with your key." - "The link between this Twitter account and key was securely verified. If you believe the account is genuine, confirm this verification with your key." + "The link between this Website and key was securely verified. If you believe the Website is genuine, confirm this verification with your key." + "The link between this Github account and key was securely verified. If you believe the account is genuine, confirm this verification with your key." + "The link between this Domain Name and key was securely verified. If you believe the Domain is genuine, confirm this verification with your key." + "The link between this Twitter account and key was securely verified. If you believe the account is genuine, confirm this verification with your key." "The link between your Website and key was securely verified. Everything looks in order." "The link between your Github account and key was securely verified. Everything looks in order." "The link between your Domain Name and key was securely verified. Everything looks in order."