mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 11:12:15 -05:00
Reorder advanced key view
This commit is contained in:
parent
f2a9a41840
commit
582caaba97
@ -124,16 +124,16 @@ public class ViewKeyAdvActivity extends BaseActivity implements
|
|||||||
mTabsAdapter = new PagerTabStripAdapter(this);
|
mTabsAdapter = new PagerTabStripAdapter(this);
|
||||||
mViewPager.setAdapter(mTabsAdapter);
|
mViewPager.setAdapter(mTabsAdapter);
|
||||||
|
|
||||||
Bundle mainBundle = new Bundle();
|
|
||||||
mainBundle.putParcelable(ViewKeyAdvMainFragment.ARG_DATA_URI, dataUri);
|
|
||||||
mTabsAdapter.addTab(ViewKeyAdvMainFragment.class,
|
|
||||||
mainBundle, getString(R.string.key_view_tab_main));
|
|
||||||
|
|
||||||
Bundle shareBundle = new Bundle();
|
Bundle shareBundle = new Bundle();
|
||||||
shareBundle.putParcelable(ViewKeyAdvMainFragment.ARG_DATA_URI, dataUri);
|
shareBundle.putParcelable(ViewKeyAdvUserIdsFragment.ARG_DATA_URI, dataUri);
|
||||||
mTabsAdapter.addTab(ViewKeyAdvShareFragment.class,
|
mTabsAdapter.addTab(ViewKeyAdvShareFragment.class,
|
||||||
shareBundle, getString(R.string.key_view_tab_share));
|
shareBundle, getString(R.string.key_view_tab_share));
|
||||||
|
|
||||||
|
Bundle userIdsBundle = new Bundle();
|
||||||
|
userIdsBundle.putParcelable(ViewKeyAdvUserIdsFragment.ARG_DATA_URI, dataUri);
|
||||||
|
mTabsAdapter.addTab(ViewKeyAdvUserIdsFragment.class,
|
||||||
|
userIdsBundle, getString(R.string.section_user_ids));
|
||||||
|
|
||||||
Bundle keysBundle = new Bundle();
|
Bundle keysBundle = new Bundle();
|
||||||
keysBundle.putParcelable(ViewKeyAdvSubkeysFragment.ARG_DATA_URI, dataUri);
|
keysBundle.putParcelable(ViewKeyAdvSubkeysFragment.ARG_DATA_URI, dataUri);
|
||||||
mTabsAdapter.addTab(ViewKeyAdvSubkeysFragment.class,
|
mTabsAdapter.addTab(ViewKeyAdvSubkeysFragment.class,
|
||||||
|
@ -18,9 +18,7 @@
|
|||||||
|
|
||||||
package org.sufficientlysecure.keychain.ui;
|
package org.sufficientlysecure.keychain.ui;
|
||||||
|
|
||||||
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;
|
||||||
@ -30,31 +28,22 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
|
|
||||||
import org.sufficientlysecure.keychain.Constants;
|
import org.sufficientlysecure.keychain.Constants;
|
||||||
import org.sufficientlysecure.keychain.R;
|
import org.sufficientlysecure.keychain.R;
|
||||||
import org.sufficientlysecure.keychain.compatibility.DialogFragmentWorkaround;
|
import org.sufficientlysecure.keychain.compatibility.DialogFragmentWorkaround;
|
||||||
import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;
|
|
||||||
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
||||||
import org.sufficientlysecure.keychain.provider.KeychainContract.UserPackets;
|
import org.sufficientlysecure.keychain.provider.KeychainContract.UserPackets;
|
||||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
|
||||||
import org.sufficientlysecure.keychain.ui.adapter.UserIdsAdapter;
|
import org.sufficientlysecure.keychain.ui.adapter.UserIdsAdapter;
|
||||||
import org.sufficientlysecure.keychain.ui.dialog.UserIdInfoDialogFragment;
|
import org.sufficientlysecure.keychain.ui.dialog.UserIdInfoDialogFragment;
|
||||||
import org.sufficientlysecure.keychain.util.Log;
|
import org.sufficientlysecure.keychain.util.Log;
|
||||||
|
|
||||||
import java.util.Date;
|
public class ViewKeyAdvUserIdsFragment extends LoaderFragment implements
|
||||||
|
|
||||||
public class ViewKeyAdvMainFragment extends LoaderFragment implements
|
|
||||||
LoaderManager.LoaderCallbacks<Cursor> {
|
LoaderManager.LoaderCallbacks<Cursor> {
|
||||||
|
|
||||||
public static final String ARG_DATA_URI = "uri";
|
public static final String ARG_DATA_URI = "uri";
|
||||||
|
|
||||||
private View mActionCertify;
|
|
||||||
private View mActionCertifyText;
|
|
||||||
private ImageView mActionCertifyImage;
|
|
||||||
|
|
||||||
private ListView mUserIds;
|
private ListView mUserIds;
|
||||||
|
|
||||||
private static final int LOADER_ID_UNIFIED = 0;
|
private static final int LOADER_ID_UNIFIED = 0;
|
||||||
@ -70,12 +59,6 @@ public class ViewKeyAdvMainFragment extends LoaderFragment implements
|
|||||||
View view = inflater.inflate(R.layout.view_key_adv_main_fragment, getContainer());
|
View view = inflater.inflate(R.layout.view_key_adv_main_fragment, getContainer());
|
||||||
|
|
||||||
mUserIds = (ListView) view.findViewById(R.id.view_key_user_ids);
|
mUserIds = (ListView) view.findViewById(R.id.view_key_user_ids);
|
||||||
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);
|
|
||||||
|
|
||||||
mUserIds.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
mUserIds.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -120,12 +103,6 @@ public class ViewKeyAdvMainFragment extends LoaderFragment implements
|
|||||||
|
|
||||||
Log.i(Constants.TAG, "mDataUri: " + mDataUri.toString());
|
Log.i(Constants.TAG, "mDataUri: " + mDataUri.toString());
|
||||||
|
|
||||||
mActionCertify.setOnClickListener(new View.OnClickListener() {
|
|
||||||
public void onClick(View view) {
|
|
||||||
certify(mDataUri);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mUserIdsAdapter = new UserIdsAdapter(getActivity(), null, 0);
|
mUserIdsAdapter = new UserIdsAdapter(getActivity(), null, 0);
|
||||||
mUserIds.setAdapter(mUserIdsAdapter);
|
mUserIds.setAdapter(mUserIdsAdapter);
|
||||||
|
|
||||||
@ -178,21 +155,6 @@ public class ViewKeyAdvMainFragment extends LoaderFragment implements
|
|||||||
case LOADER_ID_UNIFIED: {
|
case LOADER_ID_UNIFIED: {
|
||||||
if (data.moveToFirst()) {
|
if (data.moveToFirst()) {
|
||||||
|
|
||||||
// If this key is revoked, it cannot be used for anything!
|
|
||||||
if (data.getInt(INDEX_UNIFIED_IS_REVOKED) != 0) {
|
|
||||||
mActionCertify.setEnabled(false);
|
|
||||||
mActionCertifyText.setEnabled(false);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
Date expiryDate = new Date(data.getLong(INDEX_UNIFIED_EXPIRY) * 1000);
|
|
||||||
if (!data.isNull(INDEX_UNIFIED_EXPIRY) && expiryDate.before(new Date())) {
|
|
||||||
mActionCertify.setEnabled(false);
|
|
||||||
mActionCertifyText.setEnabled(false);
|
|
||||||
} else {
|
|
||||||
mActionCertify.setEnabled(true);
|
|
||||||
mActionCertifyText.setEnabled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -219,18 +181,4 @@ public class ViewKeyAdvMainFragment extends LoaderFragment implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void certify(Uri dataUri) {
|
|
||||||
long keyId = 0;
|
|
||||||
try {
|
|
||||||
keyId = new ProviderHelper(getActivity())
|
|
||||||
.getCachedPublicKeyRing(dataUri)
|
|
||||||
.extractOrGetMasterKeyId();
|
|
||||||
} catch (PgpKeyNotFoundException e) {
|
|
||||||
Log.e(Constants.TAG, "key not found!", e);
|
|
||||||
}
|
|
||||||
Intent certifyIntent = new Intent(getActivity(), CertifyKeyActivity.class);
|
|
||||||
certifyIntent.putExtra(CertifyKeyActivity.EXTRA_KEY_IDS, new long[]{keyId});
|
|
||||||
startActivityForResult(certifyIntent, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -7,15 +7,6 @@
|
|||||||
android:descendantFocusability="beforeDescendants"
|
android:descendantFocusability="beforeDescendants"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/SectionHeader"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:layout_marginLeft="16dp"
|
|
||||||
android:layout_marginRight="16dp"
|
|
||||||
android:text="@string/section_certs" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -28,49 +28,6 @@
|
|||||||
android:layout_marginBottom="4dp"
|
android:layout_marginBottom="4dp"
|
||||||
android:layout_weight="1" />
|
android:layout_weight="1" />
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/SectionHeader"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_marginTop="14dp"
|
|
||||||
android:text="@string/section_actions"
|
|
||||||
android:layout_weight="1" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/view_key_action_certify"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="?android:attr/listPreferredItemHeight"
|
|
||||||
android:clickable="true"
|
|
||||||
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_24px"
|
|
||||||
android:layout_gravity="center_vertical" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:id="@+id/view_key_action_certify_divider"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="1dip"
|
|
||||||
android:background="?android:attr/listDivider" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
Loading…
Reference in New Issue
Block a user