small ui niceties

This commit is contained in:
Vincent Breitmoser 2015-04-27 19:49:42 +02:00
parent dd1243c312
commit fc61208ce7
6 changed files with 30 additions and 13 deletions

View File

@ -18,6 +18,7 @@
package org.sufficientlysecure.keychain.ui.adapter; package org.sufficientlysecure.keychain.ui.adapter;
import android.animation.ObjectAnimator;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.database.Cursor; 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.linked.LinkedIdViewFragment;
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils; import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils.State; import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils.State;
import org.sufficientlysecure.keychain.ui.util.SubtleAttentionSeeker;
import org.sufficientlysecure.keychain.util.FilterCursorWrapper; import org.sufficientlysecure.keychain.util.FilterCursorWrapper;
import java.io.IOException; import java.io.IOException;
@ -219,6 +221,13 @@ public class LinkedIdsAdapter extends UserAttributesAdapter {
vIcon.setImageResource(id.getDisplayIcon()); vIcon.setImageResource(id.getDisplayIcon());
} }
public void seekAttention() {
ObjectAnimator anim = SubtleAttentionSeeker.tintText(vComment, 1000);
anim.setStartDelay(200);
anim.start();
}
} }
} }

View File

@ -20,6 +20,7 @@ package org.sufficientlysecure.keychain.ui.linked;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.text.Html;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
@ -81,7 +82,7 @@ public class LinkedIdCreateTwitterStep2Fragment extends LinkedIdCreateFinalFragm
}); });
((TextView) view.findViewById(R.id.linked_tweet_published)).setText( ((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; return view;

View File

@ -3,7 +3,6 @@ package org.sufficientlysecure.keychain.ui.linked;
import java.io.IOException; import java.io.IOException;
import java.util.Collections; import java.util.Collections;
import android.animation.ObjectAnimator;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.database.Cursor; import android.database.Cursor;
@ -26,6 +25,7 @@ import android.view.View.OnClickListener;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextSwitcher; import android.widget.TextSwitcher;
import android.widget.TextView;
import android.widget.ViewAnimator; import android.widget.ViewAnimator;
import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.Constants;
@ -477,10 +477,11 @@ public class LinkedIdViewFragment extends CryptoOperationFragment implements
} }
if (result.success()) { if (result.success()) {
mViewHolder.vText.setText(getString(mLinkedResource.getVerifiedText(mIsSecret))); 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); mViewHolder.setVerifyingState(mContext, VerifyState.VERIFY_OK, mIsSecret);
ObjectAnimator anim = SubtleAttentionSeeker.tada(mViewHolder.vButtonConfirm, 0.6f, 1000); mViewHolder.mLinkedIdHolder.seekAttention();
anim.setStartDelay(800);
anim.start();
} else { } else {
mViewHolder.setVerifyingState(mContext, VerifyState.VERIFY_ERROR, mIsSecret); mViewHolder.setVerifyingState(mContext, VerifyState.VERIFY_ERROR, mIsSecret);
result.createNotify(getActivity()).show(); result.createNotify(getActivity()).show();
@ -501,7 +502,7 @@ public class LinkedIdViewFragment extends CryptoOperationFragment implements
mCertifyKeyId = mViewHolder.vKeySpinner.getSelectedItemId(); mCertifyKeyId = mViewHolder.vKeySpinner.getSelectedItemId();
if (mCertifyKeyId == key.none || mCertifyKeyId == key.symmetric) { if (mCertifyKeyId == key.none || mCertifyKeyId == key.symmetric) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
SubtleAttentionSeeker.tint(mViewHolder.vKeySpinnerContainer, 600).start(); SubtleAttentionSeeker.tintBackground(mViewHolder.vKeySpinnerContainer, 600).start();
} else { } else {
Notify.create(getActivity(), R.string.select_key_to_certify, Style.ERROR).show(); Notify.create(getActivity(), R.string.select_key_to_certify, Style.ERROR).show();
} }

View File

@ -94,9 +94,15 @@ public class SubtleAttentionSeeker {
} }
@TargetApi(VERSION_CODES.LOLLIPOP) @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", return ObjectAnimator.ofArgb(view, "backgroundColor",
0x00FF0000, 0x33FF0000, 0x00FF0000).setDuration(duration); 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);
}
} }

View File

@ -38,7 +38,7 @@
<TextView <TextView
android:id="@+id/linked_id_comment" android:id="@+id/linked_id_comment"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/tertiary_text_light" android:textColor="@color/tertiary_text_light"
tools:text="comment" tools:text="comment"

View File

@ -1326,7 +1326,7 @@
<string name="linked_create_twitter_handle">Twitter Handle</string> <string name="linked_create_twitter_handle">Twitter Handle</string>
<string name="linked_create_twitter_2_1">"Click either button to tweet the message!"</string> <string name="linked_create_twitter_2_1">"Click either button to tweet the message!"</string>
<string name="linked_create_twitter_2_2">"You can edit the Tweet before posting it, so long as the text inside the brackets is unmodified."</string> <string name="linked_create_twitter_2_2">"You can edit the Tweet before posting it, so long as the text inside the brackets is unmodified."</string>
<string name="linked_create_twitter_2_3">"Once your Tweet is published as <b>@%s</b>, click the Verify button to scan your timeline for it."</string> <string name="linked_create_twitter_2_3">"Once your Tweet is published as &lt;b&gt;@%s&lt;/b&gt;, click the Verify button to scan your timeline for it."</string>
<string name="linked_create_twitter_2_4">"After successful verification, press the Finish button to add the Linked Identity to your keyring and finish the process."</string> <string name="linked_create_twitter_2_4">"After successful verification, press the Finish button to add the Linked Identity to your keyring and finish the process."</string>
<string name="linked_create_github_1_1">"By creating a Linked Identity of this type, you can link your key to a Github account you control."</string> <string name="linked_create_github_1_1">"By creating a Linked Identity of this type, you can link your key to a Github account you control."</string>
@ -1350,10 +1350,10 @@
<string name="linked_create_verify">"Verify"</string> <string name="linked_create_verify">"Verify"</string>
<string name="linked_text_clipboard">Text has been copied to clipboard</string> <string name="linked_text_clipboard">Text has been copied to clipboard</string>
<string name="linked_verified_https">"The link between this Website and key was securely verified. If you believe the Website is genuine, confirm this verification with your key."</string> <string name="linked_verified_https">"The link between this Website and key was securely verified. <b>If you believe the Website is genuine</b>, confirm this verification with your key."</string>
<string name="linked_verified_github">"The link between this Github account and key was securely verified. If you believe the account is genuine, confirm this verification with your key."</string> <string name="linked_verified_github">"The link between this Github account and key was securely verified. <b>If you believe the account is genuine</b>, confirm this verification with your key."</string>
<string name="linked_verified_dns">"The link between this Domain Name and key was securely verified. If you believe the Domain is genuine, confirm this verification with your key."</string> <string name="linked_verified_dns">"The link between this Domain Name and key was securely verified. <b>If you believe the Domain is genuine</b>, confirm this verification with your key."</string>
<string name="linked_verified_twitter">"The link between this Twitter account and key was securely verified. If you believe the account is genuine, confirm this verification with your key."</string> <string name="linked_verified_twitter">"The link between this Twitter account and key was securely verified. <b>If you believe the account is genuine</b>, confirm this verification with your key."</string>
<string name="linked_verified_secret_https">"The link between your Website and key was securely verified. Everything looks in order."</string> <string name="linked_verified_secret_https">"The link between your Website and key was securely verified. Everything looks in order."</string>
<string name="linked_verified_secret_github">"The link between your Github account and key was securely verified. Everything looks in order."</string> <string name="linked_verified_secret_github">"The link between your Github account and key was securely verified. Everything looks in order."</string>
<string name="linked_verified_secret_dns">"The link between your Domain Name and key was securely verified. Everything looks in order."</string> <string name="linked_verified_secret_dns">"The link between your Domain Name and key was securely verified. Everything looks in order."</string>