mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 11:12:15 -05:00
show status indicators in EncryptFragment
This commit is contained in:
parent
313b4ac7d3
commit
61a6346f89
@ -21,7 +21,9 @@ import android.os.Bundle;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ViewAnimator;
|
||||||
|
|
||||||
|
import com.tokenautocomplete.TokenCompleteTextView.TokenListener;
|
||||||
import org.sufficientlysecure.keychain.Constants;
|
import org.sufficientlysecure.keychain.Constants;
|
||||||
import org.sufficientlysecure.keychain.R;
|
import org.sufficientlysecure.keychain.R;
|
||||||
import org.sufficientlysecure.keychain.pgp.CanonicalizedPublicKeyRing;
|
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.adapter.KeyAdapter.KeyItem;
|
||||||
import org.sufficientlysecure.keychain.ui.widget.EncryptKeyCompletionView;
|
import org.sufficientlysecure.keychain.ui.widget.EncryptKeyCompletionView;
|
||||||
import org.sufficientlysecure.keychain.ui.widget.KeySpinner;
|
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.Log;
|
||||||
import org.sufficientlysecure.keychain.util.Passphrase;
|
import org.sufficientlysecure.keychain.util.Passphrase;
|
||||||
|
|
||||||
@ -72,10 +75,40 @@ public class EncryptModeAsymmetricFragment extends EncryptModeFragment {
|
|||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
View view = inflater.inflate(R.layout.encrypt_asymmetric_fragment, container, false);
|
View view = inflater.inflate(R.layout.encrypt_asymmetric_fragment, container, false);
|
||||||
|
|
||||||
|
|
||||||
mSignKeySpinner = (KeySpinner) view.findViewById(R.id.sign);
|
mSignKeySpinner = (KeySpinner) view.findViewById(R.id.sign);
|
||||||
mEncryptKeyView = (EncryptKeyCompletionView) view.findViewById(R.id.recipient_list);
|
mEncryptKeyView = (EncryptKeyCompletionView) view.findViewById(R.id.recipient_list);
|
||||||
mEncryptKeyView.setThreshold(1); // Start working from first character
|
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;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
7
OpenKeychain/src/main/res/anim/fade_in.xml
Normal file
7
OpenKeychain/src/main/res/anim/fade_in.xml
Normal file
@ -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>
|
7
OpenKeychain/src/main/res/anim/fade_out.xml
Normal file
7
OpenKeychain/src/main/res/anim/fade_out.xml
Normal file
@ -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>
|
@ -3,39 +3,104 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
|
android:paddingTop="4dp"
|
||||||
android:paddingBottom="4dp"
|
android:paddingBottom="4dp"
|
||||||
android:paddingRight="16dp"
|
android:paddingRight="16dp"
|
||||||
android:paddingLeft="16dp">
|
android:paddingLeft="16dp">
|
||||||
|
|
||||||
<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" />
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="0dp"
|
android:padding="0dp"
|
||||||
android:layout_margin="0dp"
|
android:layout_margin="0dp">
|
||||||
style="@android:style/Widget.EditText">
|
|
||||||
|
|
||||||
<TextView
|
<ViewAnimator
|
||||||
android:paddingLeft="8dp"
|
|
||||||
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:id="@+id/result_encryption_icon"
|
||||||
android:text="@string/label_asymmetric_from"
|
android:layout_gravity="center_vertical"
|
||||||
android:paddingRight="8dp"/>
|
android:layout_marginRight="4dp"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:paddingBottom="12dp"
|
||||||
|
android:inAnimation="@anim/fade_in"
|
||||||
|
android:outAnimation="@anim/fade_out">
|
||||||
|
|
||||||
<org.sufficientlysecure.keychain.ui.widget.SignKeySpinner
|
<ImageView
|
||||||
android:id="@+id/sign"
|
android:layout_width="wrap_content"
|
||||||
android:minHeight="56dip"
|
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:layout_width="match_parent"
|
||||||
|
android:minHeight="56dip"
|
||||||
|
android:paddingLeft="8dp"
|
||||||
|
android:paddingRight="8dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical" />
|
android:layout_gravity="center_vertical" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
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_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">
|
||||||
|
|
||||||
|
<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: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>
|
</LinearLayout>
|
Loading…
Reference in New Issue
Block a user