more (subtle) ui work
This commit is contained in:
@@ -3,13 +3,18 @@ package org.sufficientlysecure.keychain.ui.linked;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import android.animation.Animator;
|
||||||
|
import android.animation.Animator.AnimatorListener;
|
||||||
|
import android.animation.ObjectAnimator;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
@@ -53,6 +58,7 @@ 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.Notify;
|
import org.sufficientlysecure.keychain.ui.util.Notify;
|
||||||
import org.sufficientlysecure.keychain.ui.util.Notify.Style;
|
import org.sufficientlysecure.keychain.ui.util.Notify.Style;
|
||||||
|
import org.sufficientlysecure.keychain.ui.util.SubtleAttentionSeeker;
|
||||||
import org.sufficientlysecure.keychain.ui.widget.CertListWidget;
|
import org.sufficientlysecure.keychain.ui.widget.CertListWidget;
|
||||||
import org.sufficientlysecure.keychain.ui.widget.CertifyKeySpinner;
|
import org.sufficientlysecure.keychain.ui.widget.CertifyKeySpinner;
|
||||||
import org.sufficientlysecure.keychain.util.Log;
|
import org.sufficientlysecure.keychain.util.Log;
|
||||||
@@ -241,6 +247,7 @@ public class LinkedIdViewFragment extends Fragment implements
|
|||||||
private final View vButtonView;
|
private final View vButtonView;
|
||||||
private final ViewAnimator vVerifyingContainer;
|
private final ViewAnimator vVerifyingContainer;
|
||||||
private final ViewAnimator vItemCertified;
|
private final ViewAnimator vItemCertified;
|
||||||
|
private final View vKeySpinnerContainer;
|
||||||
LinkedIdsAdapter.ViewHolder mLinkedIdHolder;
|
LinkedIdsAdapter.ViewHolder mLinkedIdHolder;
|
||||||
|
|
||||||
private ViewAnimator vButtonSwitcher;
|
private ViewAnimator vButtonSwitcher;
|
||||||
@@ -257,6 +264,7 @@ public class LinkedIdViewFragment extends Fragment implements
|
|||||||
ViewHolder(View root) {
|
ViewHolder(View root) {
|
||||||
vLinkedCerts = (CertListWidget) root.findViewById(R.id.linked_id_certs);
|
vLinkedCerts = (CertListWidget) root.findViewById(R.id.linked_id_certs);
|
||||||
vKeySpinner = (CertifyKeySpinner) root.findViewById(R.id.cert_key_spinner);
|
vKeySpinner = (CertifyKeySpinner) root.findViewById(R.id.cert_key_spinner);
|
||||||
|
vKeySpinnerContainer = root.findViewById(R.id.cert_key_spincontainer);
|
||||||
vButtonSwitcher = (ViewAnimator) root.findViewById(R.id.button_animator);
|
vButtonSwitcher = (ViewAnimator) root.findViewById(R.id.button_animator);
|
||||||
|
|
||||||
mLinkedIdHolder = new LinkedIdsAdapter.ViewHolder(root);
|
mLinkedIdHolder = new LinkedIdsAdapter.ViewHolder(root);
|
||||||
@@ -283,17 +291,17 @@ public class LinkedIdViewFragment extends Fragment implements
|
|||||||
case VERIFYING:
|
case VERIFYING:
|
||||||
vProgress.setDisplayedChild(0);
|
vProgress.setDisplayedChild(0);
|
||||||
vText.setText(context.getString(R.string.linked_text_verifying));
|
vText.setText(context.getString(R.string.linked_text_verifying));
|
||||||
vKeySpinner.setVisibility(View.GONE);
|
vKeySpinnerContainer.setVisibility(View.GONE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VERIFY_OK:
|
case VERIFY_OK:
|
||||||
vProgress.setDisplayedChild(1);
|
vProgress.setDisplayedChild(1);
|
||||||
if (!isSecret) {
|
if (!isSecret) {
|
||||||
showButton(2);
|
showButton(2);
|
||||||
vKeySpinner.setVisibility(View.VISIBLE);
|
vKeySpinnerContainer.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
showButton(1);
|
showButton(1);
|
||||||
vKeySpinner.setVisibility(View.GONE);
|
vKeySpinnerContainer.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -301,13 +309,13 @@ public class LinkedIdViewFragment extends Fragment implements
|
|||||||
showButton(1);
|
showButton(1);
|
||||||
vProgress.setDisplayedChild(2);
|
vProgress.setDisplayedChild(2);
|
||||||
vText.setText(context.getString(R.string.linked_text_error));
|
vText.setText(context.getString(R.string.linked_text_error));
|
||||||
vKeySpinner.setVisibility(View.GONE);
|
vKeySpinnerContainer.setVisibility(View.GONE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CERTIFYING:
|
case CERTIFYING:
|
||||||
vProgress.setDisplayedChild(0);
|
vProgress.setDisplayedChild(0);
|
||||||
vText.setText(context.getString(R.string.linked_text_confirming));
|
vText.setText(context.getString(R.string.linked_text_confirming));
|
||||||
vKeySpinner.setVisibility(View.GONE);
|
vKeySpinnerContainer.setVisibility(View.GONE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -364,7 +372,7 @@ public class LinkedIdViewFragment extends Fragment implements
|
|||||||
mVerificationState = false;
|
mVerificationState = false;
|
||||||
|
|
||||||
mViewHolder.showButton(0);
|
mViewHolder.showButton(0);
|
||||||
mViewHolder.vKeySpinner.setVisibility(View.GONE);
|
mViewHolder.vKeySpinnerContainer.setVisibility(View.GONE);
|
||||||
mViewHolder.showVerifyingContainer(mContext, false, mIsSecret);
|
mViewHolder.showVerifyingContainer(mContext, false, mIsSecret);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -450,7 +458,7 @@ public class LinkedIdViewFragment extends Fragment implements
|
|||||||
|
|
||||||
setShowVerifying(true);
|
setShowVerifying(true);
|
||||||
|
|
||||||
mViewHolder.vKeySpinner.setVisibility(View.GONE);
|
mViewHolder.vKeySpinnerContainer.setVisibility(View.GONE);
|
||||||
mViewHolder.setVerifyingState(mContext, VerifyState.VERIFYING, mIsSecret);
|
mViewHolder.setVerifyingState(mContext, VerifyState.VERIFYING, mIsSecret);
|
||||||
|
|
||||||
mInProgress = new AsyncTask<Void,Void,LinkedVerifyResult>() {
|
mInProgress = new AsyncTask<Void,Void,LinkedVerifyResult>() {
|
||||||
@@ -478,7 +486,9 @@ public class LinkedIdViewFragment extends Fragment implements
|
|||||||
if (result.success()) {
|
if (result.success()) {
|
||||||
mViewHolder.vText.setText(getString(mLinkedResource.getVerifiedText(mIsSecret)));
|
mViewHolder.vText.setText(getString(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);
|
||||||
|
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();
|
||||||
@@ -498,6 +508,9 @@ public class LinkedIdViewFragment extends Fragment implements
|
|||||||
// get the user's passphrase for this key (if required)
|
// get the user's passphrase for this key (if required)
|
||||||
long certifyKeyId = mViewHolder.vKeySpinner.getSelectedItemId();
|
long certifyKeyId = mViewHolder.vKeySpinner.getSelectedItemId();
|
||||||
if (certifyKeyId == key.none || certifyKeyId == key.symmetric) {
|
if (certifyKeyId == key.none || certifyKeyId == key.symmetric) {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
SubtleAttentionSeeker.tint(mViewHolder.vKeySpinnerContainer, 600).start();
|
||||||
|
}
|
||||||
Notify.create(getActivity(), R.string.select_key_to_certify, Style.ERROR).show();
|
Notify.create(getActivity(), R.string.select_key_to_certify, Style.ERROR).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,13 +17,19 @@
|
|||||||
|
|
||||||
package org.sufficientlysecure.keychain.ui.util;
|
package org.sufficientlysecure.keychain.ui.util;
|
||||||
|
|
||||||
|
import android.animation.AnimatorInflater;
|
||||||
|
import android.animation.ArgbEvaluator;
|
||||||
import android.animation.Keyframe;
|
import android.animation.Keyframe;
|
||||||
import android.animation.ObjectAnimator;
|
import android.animation.ObjectAnimator;
|
||||||
import android.animation.PropertyValuesHolder;
|
import android.animation.PropertyValuesHolder;
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
|
import android.content.Context;
|
||||||
import android.os.Build.VERSION_CODES;
|
import android.os.Build.VERSION_CODES;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
|
import org.sufficientlysecure.keychain.R;
|
||||||
|
|
||||||
|
|
||||||
@TargetApi(VERSION_CODES.ICE_CREAM_SANDWICH)
|
@TargetApi(VERSION_CODES.ICE_CREAM_SANDWICH)
|
||||||
/** Simple animation helper for subtle attention seeker stuff.
|
/** Simple animation helper for subtle attention seeker stuff.
|
||||||
*
|
*
|
||||||
@@ -36,6 +42,10 @@ public class SubtleAttentionSeeker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static ObjectAnimator tada(View view, float shakeFactor) {
|
public static ObjectAnimator tada(View view, float shakeFactor) {
|
||||||
|
return tada(view, shakeFactor, 1400);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ObjectAnimator tada(View view, float shakeFactor, int duration) {
|
||||||
|
|
||||||
PropertyValuesHolder pvhScaleX = PropertyValuesHolder.ofKeyframe(View.SCALE_X,
|
PropertyValuesHolder pvhScaleX = PropertyValuesHolder.ofKeyframe(View.SCALE_X,
|
||||||
Keyframe.ofFloat(0f, 1f),
|
Keyframe.ofFloat(0f, 1f),
|
||||||
@@ -80,7 +90,13 @@ public class SubtleAttentionSeeker {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return ObjectAnimator.ofPropertyValuesHolder(view, pvhScaleX, pvhScaleY, pvhRotate).
|
return ObjectAnimator.ofPropertyValuesHolder(view, pvhScaleX, pvhScaleY, pvhRotate).
|
||||||
setDuration(1400);
|
setDuration(duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TargetApi(VERSION_CODES.LOLLIPOP)
|
||||||
|
public static ObjectAnimator tint(View view, int duration) {
|
||||||
|
return ObjectAnimator.ofArgb(view, "backgroundColor",
|
||||||
|
0x00FF0000, 0x33FF0000, 0x00FF0000).setDuration(duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,17 +60,18 @@
|
|||||||
android:layout_marginBottom="4dp"
|
android:layout_marginBottom="4dp"
|
||||||
android:inAnimation="@anim/fade_in_quick"
|
android:inAnimation="@anim/fade_in_quick"
|
||||||
android:outAnimation="@anim/fade_out_quick"
|
android:outAnimation="@anim/fade_out_quick"
|
||||||
|
android:measureAllChildren="false"
|
||||||
android:layout_weight="1">
|
android:layout_weight="1">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||||
|
|
||||||
</TextSwitcher>
|
</TextSwitcher>
|
||||||
|
|
||||||
@@ -110,32 +111,28 @@
|
|||||||
|
|
||||||
</ViewAnimator>
|
</ViewAnimator>
|
||||||
|
|
||||||
<org.sufficientlysecure.keychain.ui.widget.CertifyKeySpinner
|
<FrameLayout
|
||||||
android:layout_marginLeft="14dp"
|
|
||||||
android:layout_marginRight="14dp"
|
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/cert_key_spinner"
|
android:id="@+id/cert_key_spincontainer"
|
||||||
android:visibility="gone">
|
android:visibility="gone"
|
||||||
</org.sufficientlysecure.keychain.ui.widget.CertifyKeySpinner>
|
>
|
||||||
|
|
||||||
|
<org.sufficientlysecure.keychain.ui.widget.CertifyKeySpinner
|
||||||
|
android:layout_marginLeft="14dp"
|
||||||
|
android:layout_marginRight="14dp"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/cert_key_spinner">
|
||||||
|
</org.sufficientlysecure.keychain.ui.widget.CertifyKeySpinner>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal"
|
||||||
|
android:gravity="right|end">
|
||||||
<ImageView
|
|
||||||
android:id="@+id/back_button"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:src="@drawable/ic_chevron_left_grey_24dp"
|
|
||||||
android:visibility="gone"
|
|
||||||
style="?android:attr/borderlessButtonStyle" />
|
|
||||||
|
|
||||||
<Space
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1" />
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/button_view"
|
android:id="@+id/button_view"
|
||||||
|
|||||||
@@ -1327,14 +1327,14 @@
|
|||||||
|
|
||||||
<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 Website has been fetched and verified."</string>
|
<string name="linked_verified_https">"The link between this Website and key was securely verified. If you believe the Website is genuine, you may confirm this Identity with your key."</string>
|
||||||
<string name="linked_verified_github">"The Gist has been fetched and verified."</string>
|
<string name="linked_verified_github">"The link between this Github account and key was securely verified. If you believe the account is genuine, you may confirm this Identity with your key."</string>
|
||||||
<string name="linked_verified_dns">"The DNS record has been fetched and verified."</string>
|
<string name="linked_verified_dns">"The link between this Domain Name and key was securely verified. If you believe the Domain is genuine, you may confirm this Identity with your key."</string>
|
||||||
<string name="linked_verified_twitter">"The Tweet has been fetched and verified."</string>
|
<string name="linked_verified_twitter">"The link between this Twitter account and key was securely verified. If you believe the account is genuine, you may confirm this Identity with your key."</string>
|
||||||
<string name="linked_verified_secret_https">"Your Website has been fetched and 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">"Your Gist has been fetched and 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">"Your DNS record has been fetched and 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_twitter">"Your Tweet has been fetched and verified. Everything looks in order."</string>
|
<string name="linked_verified_secret_twitter">"The link between this Twitter account and key was securely verified. Everything looks in order."</string>
|
||||||
|
|
||||||
<plurals name="linked_id_expand">
|
<plurals name="linked_id_expand">
|
||||||
<item quantity="one">"There is one more unknown identity type"</item>
|
<item quantity="one">"There is one more unknown identity type"</item>
|
||||||
|
|||||||
Reference in New Issue
Block a user