aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'OpenKeychain/src/main')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptModeAsymmetricFragment.java33
-rw-r--r--OpenKeychain/src/main/res/anim/fade_in.xml7
-rw-r--r--OpenKeychain/src/main/res/anim/fade_out.xml7
-rw-r--r--OpenKeychain/src/main/res/layout/encrypt_asymmetric_fragment.xml99
4 files changed, 129 insertions, 17 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptModeAsymmetricFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptModeAsymmetricFragment.java
index 258a9b3dc..9c7e494d1 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptModeAsymmetricFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptModeAsymmetricFragment.java
@@ -21,7 +21,9 @@ import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.ViewAnimator;
+import com.tokenautocomplete.TokenCompleteTextView.TokenListener;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.pgp.CanonicalizedPublicKeyRing;
@@ -33,6 +35,7 @@ import org.sufficientlysecure.keychain.provider.ProviderHelper.NotFoundException
import org.sufficientlysecure.keychain.ui.adapter.KeyAdapter.KeyItem;
import org.sufficientlysecure.keychain.ui.widget.EncryptKeyCompletionView;
import org.sufficientlysecure.keychain.ui.widget.KeySpinner;
+import org.sufficientlysecure.keychain.ui.widget.KeySpinner.OnKeyChangedListener;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Passphrase;
@@ -72,10 +75,40 @@ public class EncryptModeAsymmetricFragment extends EncryptModeFragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.encrypt_asymmetric_fragment, container, false);
+
mSignKeySpinner = (KeySpinner) view.findViewById(R.id.sign);
mEncryptKeyView = (EncryptKeyCompletionView) view.findViewById(R.id.recipient_list);
mEncryptKeyView.setThreshold(1); // Start working from first character
+ final ViewAnimator vSignatureIcon = (ViewAnimator) view.findViewById(R.id.result_signature_icon);
+ mSignKeySpinner.setOnKeyChangedListener(new OnKeyChangedListener() {
+ @Override
+ public void onKeyChanged(long masterKeyId) {
+ int child = masterKeyId != Constants.key.none ? 1 : 0;
+ if (vSignatureIcon.getDisplayedChild() != child) {
+ vSignatureIcon.setDisplayedChild(child);
+ }
+ }
+ });
+
+ final ViewAnimator vEncryptionIcon = (ViewAnimator) view.findViewById(R.id.result_encryption_icon);
+ mEncryptKeyView.setTokenListener(new TokenListener() {
+ @Override
+ public void onTokenAdded(Object o) {
+ if (vEncryptionIcon.getDisplayedChild() != 1) {
+ vEncryptionIcon.setDisplayedChild(1);
+ }
+ }
+
+ @Override
+ public void onTokenRemoved(Object o) {
+ int child = mEncryptKeyView.getObjects().isEmpty() ? 0 : 1;
+ if (vEncryptionIcon.getDisplayedChild() != child) {
+ vEncryptionIcon.setDisplayedChild(child);
+ }
+ }
+ });
+
return view;
}
diff --git a/OpenKeychain/src/main/res/anim/fade_in.xml b/OpenKeychain/src/main/res/anim/fade_in.xml
new file mode 100644
index 000000000..7c3475326
--- /dev/null
+++ b/OpenKeychain/src/main/res/anim/fade_in.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+ <alpha android:fromAlpha="0.0" android:toAlpha="1.0"
+ android:interpolator="@android:anim/bounce_interpolator"
+ android:duration="700"
+ />
+</set>
diff --git a/OpenKeychain/src/main/res/anim/fade_out.xml b/OpenKeychain/src/main/res/anim/fade_out.xml
new file mode 100644
index 000000000..9a9dbbbc8
--- /dev/null
+++ b/OpenKeychain/src/main/res/anim/fade_out.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+ <alpha android:fromAlpha="1.0" android:toAlpha="0.0"
+ android:interpolator="@android:anim/accelerate_interpolator"
+ android:duration="300"
+ />
+</set>
diff --git a/OpenKeychain/src/main/res/layout/encrypt_asymmetric_fragment.xml b/OpenKeychain/src/main/res/layout/encrypt_asymmetric_fragment.xml
index aa295050a..56647ec65 100644
--- a/OpenKeychain/src/main/res/layout/encrypt_asymmetric_fragment.xml
+++ b/OpenKeychain/src/main/res/layout/encrypt_asymmetric_fragment.xml
@@ -3,39 +3,104 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
+ android:paddingTop="4dp"
android:paddingBottom="4dp"
android:paddingRight="16dp"
android:paddingLeft="16dp">
- <org.sufficientlysecure.keychain.ui.widget.EncryptKeyCompletionView
- android:id="@+id/recipient_list"
+ <LinearLayout
android:layout_width="match_parent"
- android:minHeight="56dip"
- android:paddingLeft="8dp"
- android:paddingRight="8dp"
- android:layout_height="wrap_content" />
+ android:layout_height="wrap_content"
+ android:padding="0dp"
+ android:layout_margin="0dp">
+
+ <ViewAnimator
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:id="@+id/result_encryption_icon"
+ android:layout_gravity="center_vertical"
+ android:layout_marginRight="4dp"
+ android:layout_marginEnd="4dp"
+ android:paddingBottom="12dp"
+ android:inAnimation="@anim/fade_in"
+ android:outAnimation="@anim/fade_out">
+
+ <ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/status_lock_open_24dp" />
+
+ <ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/status_lock_closed_24dp" />
+
+ </ViewAnimator>
+
+ <org.sufficientlysecure.keychain.ui.widget.EncryptKeyCompletionView
+ android:id="@+id/recipient_list"
+ android:layout_width="match_parent"
+ android:minHeight="56dip"
+ android:paddingLeft="8dp"
+ android:paddingRight="8dp"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical" />
+
+ </LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="0dp"
- android:layout_margin="0dp"
- style="@android:style/Widget.EditText">
+ android:layout_margin="0dp">
- <TextView
- android:paddingLeft="8dp"
+ <ViewAnimator
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:text="@string/label_asymmetric_from"
- android:paddingRight="8dp"/>
+ android:id="@+id/result_signature_icon"
+ android:layout_gravity="center_vertical"
+ android:layout_marginRight="4dp"
+ android:layout_marginEnd="4dp"
+ android:inAnimation="@anim/fade_in"
+ android:outAnimation="@anim/fade_out">
- <org.sufficientlysecure.keychain.ui.widget.SignKeySpinner
- android:id="@+id/sign"
- android:minHeight="56dip"
+ <ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/status_signature_unverified_cutout_24dp"
+ />
+
+ <ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/status_signature_verified_cutout_24dp"
+ />
+
+ </ViewAnimator>
+
+ <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_gravity="center_vertical" />
+ android:padding="0dp"
+ android:layout_margin="0dp"
+ style="@android:style/Widget.EditText">
+
+ <TextView
+ android:paddingLeft="8dp"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:text="@string/label_asymmetric_from"
+ android:paddingRight="8dp"/>
+
+ <org.sufficientlysecure.keychain.ui.widget.SignKeySpinner
+ android:id="@+id/sign"
+ android:minHeight="56dip"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical" />
+
+ </LinearLayout>
</LinearLayout>
</LinearLayout> \ No newline at end of file