Use verified icon for certify action

This commit is contained in:
Dominik Schürmann 2014-07-28 12:24:40 +02:00
parent 730f820c8c
commit 23689da56d
2 changed files with 52 additions and 13 deletions

View File

@ -19,6 +19,7 @@ package org.sufficientlysecure.keychain.ui;
import android.content.Intent; import android.content.Intent;
import android.database.Cursor; import android.database.Cursor;
import android.graphics.PorterDuff;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.LoaderManager; import android.support.v4.app.LoaderManager;
@ -27,6 +28,7 @@ import android.support.v4.content.Loader;
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.ImageView;
import android.widget.ListView; import android.widget.ListView;
import com.devspark.appmsg.AppMsg; import com.devspark.appmsg.AppMsg;
@ -52,6 +54,8 @@ public class ViewKeyMainFragment extends LoaderFragment implements
private View mActionEditDivider; private View mActionEditDivider;
private View mActionEncrypt; private View mActionEncrypt;
private View mActionCertify; private View mActionCertify;
private View mActionCertifyText;
private ImageView mActionCertifyImage;
private View mActionCertifyDivider; private View mActionCertifyDivider;
private ListView mUserIds; private ListView mUserIds;
@ -76,6 +80,11 @@ public class ViewKeyMainFragment extends LoaderFragment implements
mActionEditDivider = view.findViewById(R.id.view_key_action_edit_divider); mActionEditDivider = view.findViewById(R.id.view_key_action_edit_divider);
mActionEncrypt = view.findViewById(R.id.view_key_action_encrypt); mActionEncrypt = view.findViewById(R.id.view_key_action_encrypt);
mActionCertify = view.findViewById(R.id.view_key_action_certify); mActionCertify = view.findViewById(R.id.view_key_action_certify);
mActionCertifyText = view.findViewById(R.id.view_key_action_certify_text);
mActionCertifyImage = (ImageView) view.findViewById(R.id.view_key_action_certify_image);
// make certify image gray, like action icons
mActionCertifyImage.setColorFilter(getResources().getColor(R.color.tertiary_text_light),
PorterDuff.Mode.SRC_IN);
mActionCertifyDivider = view.findViewById(R.id.view_key_action_certify_divider); mActionCertifyDivider = view.findViewById(R.id.view_key_action_certify_divider);
return root; return root;
@ -182,6 +191,7 @@ public class ViewKeyMainFragment extends LoaderFragment implements
if (data.getInt(INDEX_UNIFIED_IS_REVOKED) != 0) { if (data.getInt(INDEX_UNIFIED_IS_REVOKED) != 0) {
mActionEdit.setEnabled(false); mActionEdit.setEnabled(false);
mActionCertify.setEnabled(false); mActionCertify.setEnabled(false);
mActionCertifyText.setEnabled(false);
mActionEncrypt.setEnabled(false); mActionEncrypt.setEnabled(false);
} else { } else {
mActionEdit.setEnabled(true); mActionEdit.setEnabled(true);
@ -189,9 +199,11 @@ public class ViewKeyMainFragment extends LoaderFragment implements
Date expiryDate = new Date(data.getLong(INDEX_UNIFIED_EXPIRY) * 1000); Date expiryDate = new Date(data.getLong(INDEX_UNIFIED_EXPIRY) * 1000);
if (!data.isNull(INDEX_UNIFIED_EXPIRY) && expiryDate.before(new Date())) { if (!data.isNull(INDEX_UNIFIED_EXPIRY) && expiryDate.before(new Date())) {
mActionCertify.setEnabled(false); mActionCertify.setEnabled(false);
mActionCertifyText.setEnabled(false);
mActionEncrypt.setEnabled(false); mActionEncrypt.setEnabled(false);
} else { } else {
mActionCertify.setEnabled(true); mActionCertify.setEnabled(true);
mActionCertifyText.setEnabled(true);
mActionEncrypt.setEnabled(true); mActionEncrypt.setEnabled(true);
} }
} }
@ -252,8 +264,6 @@ public class ViewKeyMainFragment extends LoaderFragment implements
private void editKey(Uri dataUri) { private void editKey(Uri dataUri) {
Intent editIntent = new Intent(getActivity(), EditKeyActivity.class); Intent editIntent = new Intent(getActivity(), EditKeyActivity.class);
editIntent.setData(KeychainContract.KeyRingData.buildSecretKeyRingUri(dataUri)); editIntent.setData(KeychainContract.KeyRingData.buildSecretKeyRingUri(dataUri));
// editIntent.setAction(EditKeyActivity.ACTION_EDIT_KEY);
// startActivityForResult(editIntent, 0);
startActivity(editIntent); startActivity(editIntent);
} }

View File

@ -35,20 +35,49 @@
android:layout_height="1dip" android:layout_height="1dip"
android:background="?android:attr/listDivider" /> android:background="?android:attr/listDivider" />
<TextView <!--<TextView-->
<!--android:id="@+id/view_key_action_certify"-->
<!--android:paddingLeft="8dp"-->
<!--android:paddingRight="8dp"-->
<!--android:textAppearance="?android:attr/textAppearanceMedium"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="match_parent"-->
<!--android:text="@string/key_view_action_certify"-->
<!--android:minHeight="?android:attr/listPreferredItemHeight"-->
<!--android:drawableRight="@drawable/ic_action_good"-->
<!--android:drawablePadding="8dp"-->
<!--android:gravity="center_vertical"-->
<!--android:clickable="true"-->
<!--style="@style/SelectableItem" />-->
<LinearLayout
android:id="@+id/view_key_action_certify" android:id="@+id/view_key_action_certify"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="?android:attr/listPreferredItemHeight"
android:text="@string/key_view_action_certify"
android:minHeight="?android:attr/listPreferredItemHeight"
android:drawableRight="@drawable/ic_action_good"
android:drawablePadding="8dp"
android:gravity="center_vertical"
android:clickable="true" android:clickable="true"
style="@style/SelectableItem" /> android:paddingRight="4dp"
style="@style/SelectableItem"
android:orientation="horizontal">
<TextView
android:id="@+id/view_key_action_certify_text"
android:paddingLeft="8dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="0dip"
android:layout_height="match_parent"
android:text="@string/key_view_action_certify"
android:layout_weight="1"
android:gravity="center_vertical" />
<ImageView
android:id="@+id/view_key_action_certify_image"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:padding="8dp"
android:src="@drawable/status_signature_verified_cutout"
android:layout_gravity="center_vertical" />
</LinearLayout>
<TextView <TextView
style="@style/SectionHeader" style="@style/SectionHeader"