diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2014-07-30 17:47:17 +0200 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2014-07-30 17:47:17 +0200 |
commit | 65488cbf05b0c90ac84d9b1895c68455217e3f1b (patch) | |
tree | 94b5cf389d41936d6811d1e9cc3d7038bf65c4c5 | |
parent | fcc535a57381009b173bbe455e67e6825be6b684 (diff) | |
download | open-keychain-65488cbf05b0c90ac84d9b1895c68455217e3f1b.tar.gz open-keychain-65488cbf05b0c90ac84d9b1895c68455217e3f1b.tar.bz2 open-keychain-65488cbf05b0c90ac84d9b1895c68455217e3f1b.zip |
Create key: work on upload
8 files changed, 242 insertions, 192 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/OperationResults.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/OperationResults.java index 6fb0db0e5..a05b77ea5 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/OperationResults.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/OperationResults.java @@ -168,11 +168,13 @@ public abstract class OperationResults { public static class EditKeyResult extends OperationResultParcel { private transient UncachedKeyRing mRing; + public final long mRingMasterKeyId; public EditKeyResult(int result, OperationLog log, UncachedKeyRing ring) { super(result, log); mRing = ring; + mRingMasterKeyId = ring.getMasterKeyId(); } public UncachedKeyRing getRing() { @@ -181,6 +183,13 @@ public abstract class OperationResults { public EditKeyResult(Parcel source) { super(source); + mRingMasterKeyId = source.readLong(); + } + + @Override + public void writeToParcel(Parcel dest, int flags) { + super.writeToParcel(dest, flags); + dest.writeLong(mRingMasterKeyId); } public static Creator<EditKeyResult> CREATOR = new Creator<EditKeyResult>() { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyKeyActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyKeyActivity.java index 5e20b24b5..3c69fb071 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyKeyActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyKeyActivity.java @@ -136,6 +136,8 @@ public class CertifyKeyActivity extends ActionBarActivity implements if (mPubKeyId != 0) { if (mMasterKeyId == 0) { mSelectKeyFragment.setError(getString(R.string.select_key_to_certify)); + Notify.showNotify(CertifyKeyActivity.this, getString(R.string.select_key_to_certify), + Notify.Style.ERROR); } else { initiateSigning(); } @@ -256,7 +258,7 @@ public class CertifyKeyActivity extends ActionBarActivity implements // Bail out if there is not at least one user id selected ArrayList<String> userIds = mUserIdsAdapter.getSelectedUserIds(); if (userIds.isEmpty()) { - Notify.showNotify(CertifyKeyActivity.this, "No Notify.Style IDs to sign selected!", + Notify.showNotify(CertifyKeyActivity.this, "No identities selected!", Notify.Style.ERROR); return; } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyFinalFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyFinalFragment.java index 7bccb8995..c083539da 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyFinalFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyFinalFragment.java @@ -20,8 +20,11 @@ package org.sufficientlysecure.keychain.ui; import android.app.Activity; import android.app.ProgressDialog; import android.content.Intent; +import android.database.ContentObserver; import android.net.Uri; import android.os.Bundle; +import android.os.Handler; +import android.os.Looper; import android.os.Message; import android.os.Messenger; import android.support.v4.app.Fragment; @@ -35,6 +38,7 @@ import android.widget.TextView; import org.spongycastle.bcpg.sig.KeyFlags; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; +import org.sufficientlysecure.keychain.helper.Preferences; import org.sufficientlysecure.keychain.provider.KeychainContract; import org.sufficientlysecure.keychain.service.KeychainIntentService; import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler; @@ -188,22 +192,22 @@ public class CreateKeyFinalFragment extends Fragment { private void uploadKey(final OperationResults.EditKeyResult editKeyResult) { // Send all information needed to service to upload key in other thread - Intent intent = new Intent(getActivity(), KeychainIntentService.class); + final Intent intent = new Intent(getActivity(), KeychainIntentService.class); intent.setAction(KeychainIntentService.ACTION_UPLOAD_KEYRING); // set data uri as path to keyring Uri blobUri = KeychainContract.KeyRingData.buildPublicKeyRingUri( - Long.toString(editKeyResult.getRing().getMasterKeyId()) + Long.toString(editKeyResult.mRingMasterKeyId) ); intent.setData(blobUri); // fill values for this action Bundle data = new Bundle(); - Spinner keyServer = (Spinner) getActivity().findViewById(R.id.upload_key_keyserver); - String server = (String) keyServer.getSelectedItem(); - data.putString(KeychainIntentService.UPLOAD_KEY_SERVER, server); + // upload to favorite keyserver + String keyserver = Preferences.getPreferences(getActivity()).getKeyServers()[0]; + data.putString(KeychainIntentService.UPLOAD_KEY_SERVER, keyserver); intent.putExtra(KeychainIntentService.EXTRA_DATA, data); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyInputFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyInputFragment.java index 30a48e63e..a1fdc09cc 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyInputFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyInputFragment.java @@ -147,7 +147,6 @@ public class CreateKeyInputFragment extends Fragment { mCreateKeyActivity = (CreateKeyActivity) getActivity(); } - private void createKeyCheck() { if (isEditTextNotEmpty(getActivity(), mNameEdit) && isEditTextNotEmpty(getActivity(), mEmailEdit) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java index cb59afa93..5f340019f 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java @@ -354,9 +354,8 @@ public class ImportKeysActivity extends ActionBarActivity { ImportKeysServerFragment f = (ImportKeysServerFragment) getActiveFragment(mViewPager, TAB_KEYSERVER); - // TODO: Currently it simply uses keyserver nr 0 - String keyserver = Preferences.getPreferences(ImportKeysActivity.this) - .getKeyServers()[0]; + // ask favorite keyserver + String keyserver = Preferences.getPreferences(ImportKeysActivity.this).getKeyServers()[0]; // set fields of ImportKeysServerFragment f.setQueryAndKeyserver(query, keyserver); diff --git a/OpenKeychain/src/main/res/layout/certify_key_activity.xml b/OpenKeychain/src/main/res/layout/certify_key_activity.xml index d9c1b806b..11bc70331 100644 --- a/OpenKeychain/src/main/res/layout/certify_key_activity.xml +++ b/OpenKeychain/src/main/res/layout/certify_key_activity.xml @@ -1,183 +1,191 @@ <?xml version="1.0" encoding="UTF-8"?> -<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="wrap_content" +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_width="match_parent" android:layout_height="match_parent"> - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingLeft="16dp" - android:paddingRight="16dp" - android:orientation="vertical"> + <include layout="@layout/notify_area" /> - <TextView - style="@style/SectionHeader" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginBottom="4dp" - android:layout_marginTop="14dp" - android:text="@string/section_certification_key" /> + <ScrollView xmlns:tools="http://schemas.android.com/tools" + android:layout_width="wrap_content" + android:layout_height="match_parent"> - <fragment - android:id="@+id/sign_key_select_key_fragment" - android:name="org.sufficientlysecure.keychain.ui.SelectSecretKeyLayoutFragment" + <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginBottom="4dp" - android:layout_marginTop="4dp" - tools:layout="@layout/select_secret_key_layout_fragment" /> - - <TextView - style="@style/SectionHeader" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginBottom="4dp" - android:layout_marginTop="14dp" - android:text="@string/section_key_to_certify" /> + android:paddingLeft="16dp" + android:paddingRight="16dp" + android:orientation="vertical"> - <TableLayout - android:layout_width="wrap_content" - android:layout_height="0dp" - android:layout_weight="1" - android:layout_marginLeft="8dp" - android:shrinkColumns="1"> - - <TableRow - android:layout_width="fill_parent" - android:layout_height="fill_parent"> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:paddingRight="10dip" - android:text="@string/label_key_id" /> + <TextView + style="@style/SectionHeader" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginBottom="4dp" + android:layout_marginTop="14dp" + android:text="@string/section_certification_key" /> + + <fragment + android:id="@+id/sign_key_select_key_fragment" + android:name="org.sufficientlysecure.keychain.ui.SelectSecretKeyLayoutFragment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="4dp" + android:layout_marginTop="4dp" + tools:layout="@layout/select_secret_key_layout_fragment" /> - <TextView - android:id="@+id/key_id" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:paddingRight="5dip" - android:text="" - android:typeface="monospace" /> - </TableRow> + <TextView + style="@style/SectionHeader" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginBottom="4dp" + android:layout_marginTop="14dp" + android:text="@string/section_key_to_certify" /> - <TableRow - android:layout_width="fill_parent" - android:layout_height="fill_parent"> + <TableLayout + android:layout_width="wrap_content" + android:layout_height="0dp" + android:layout_weight="1" + android:layout_marginLeft="8dp" + android:shrinkColumns="1"> + + <TableRow + android:layout_width="fill_parent" + android:layout_height="fill_parent"> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:paddingRight="10dip" + android:text="@string/label_key_id" /> + + <TextView + android:id="@+id/key_id" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:paddingRight="5dip" + android:text="" + android:typeface="monospace" /> + </TableRow> + + <TableRow + android:layout_width="fill_parent" + android:layout_height="fill_parent"> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:paddingRight="10dip" + android:text="@string/label_main_user_id" /> + + <TextView + android:id="@+id/main_user_id" + android:layout_width="match_parent" + android:layout_height="wrap_content" /> + + </TableRow> + + <TableRow + android:layout_width="fill_parent" + android:layout_height="fill_parent"> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:paddingRight="10dip" + android:text="@string/label_fingerprint" /> + + <TextView + android:id="@+id/view_key_fingerprint" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:typeface="monospace" /> + + </TableRow> + + </TableLayout> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:paddingRight="10dip" - android:text="@string/label_main_user_id" /> + <TextView + style="@style/SectionHeader" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="14dp" + android:text="@string/section_uids_to_certify" /> - <TextView - android:id="@+id/main_user_id" - android:layout_width="match_parent" - android:layout_height="wrap_content" /> + <org.sufficientlysecure.keychain.ui.widget.FixedListView + android:id="@+id/view_key_user_ids" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:descendantFocusability="blocksDescendants" /> - </TableRow> + <TextView + style="@style/SectionHeader" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginBottom="4dp" + android:layout_marginTop="14dp" + android:text="@string/section_upload_key" /> + + <CheckBox + android:id="@+id/sign_key_upload_checkbox" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="4dp" + android:layout_marginTop="4dp" + android:checked="false" + android:text="@string/label_send_key" /> + + <Spinner + android:id="@+id/upload_key_keyserver" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="4dp" + android:layout_marginTop="4dp" + android:enabled="false" /> - <TableRow - android:layout_width="fill_parent" - android:layout_height="fill_parent"> + <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/certify_key_certify_button" + android:layout_width="match_parent" + android:layout_height="?android:attr/listPreferredItemHeight" + android:clickable="true" + android:paddingRight="4dp" + android:layout_marginBottom="8dp" + style="@style/SelectableItem" + android:orientation="horizontal"> <TextView + 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/certify_key_action_certify_image" android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:paddingRight="10dip" - android:text="@string/label_fingerprint" /> + android:layout_height="match_parent" + android:padding="8dp" + android:src="@drawable/status_signature_verified_cutout" + android:layout_gravity="center_vertical" /> - <TextView - android:id="@+id/view_key_fingerprint" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:typeface="monospace" /> - - </TableRow> - - </TableLayout> - - <TextView - style="@style/SectionHeader" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginTop="14dp" - android:text="@string/section_uids_to_certify" /> - - <org.sufficientlysecure.keychain.ui.widget.FixedListView - android:id="@+id/view_key_user_ids" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:descendantFocusability="blocksDescendants" /> - - <TextView - style="@style/SectionHeader" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginBottom="4dp" - android:layout_marginTop="14dp" - android:text="@string/section_upload_key" /> - - <CheckBox - android:id="@+id/sign_key_upload_checkbox" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginBottom="4dp" - android:layout_marginTop="4dp" - android:checked="false" - android:text="@string/label_send_key" /> - - <Spinner - android:id="@+id/upload_key_keyserver" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginBottom="4dp" - android:layout_marginTop="4dp" - android:enabled="false" /> - - <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/certify_key_certify_button" - android:layout_width="match_parent" - android:layout_height="?android:attr/listPreferredItemHeight" - android:clickable="true" - android:paddingRight="4dp" - android:layout_marginBottom="8dp" - style="@style/SelectableItem" - android:orientation="horizontal"> - - <TextView - 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" /> + </LinearLayout> - <ImageView - android:id="@+id/certify_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> + </ScrollView> - </LinearLayout> - -</ScrollView>
\ No newline at end of file +</LinearLayout> diff --git a/OpenKeychain/src/main/res/layout/create_key_input_fragment.xml b/OpenKeychain/src/main/res/layout/create_key_input_fragment.xml index ccc2f2bdd..30ccc05ab 100644 --- a/OpenKeychain/src/main/res/layout/create_key_input_fragment.xml +++ b/OpenKeychain/src/main/res/layout/create_key_input_fragment.xml @@ -74,28 +74,56 @@ android:layout_marginLeft="16dp" android:layout_marginRight="16dp" android:background="?android:attr/listDivider" - android:layout_alignTop="@+id/create_key_button" + android:layout_alignTop="@+id/create_key_buttons" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" /> - <TextView - android:id="@+id/create_key_button" - android:paddingLeft="8dp" - android:paddingRight="8dp" - android:layout_marginLeft="16dp" - android:layout_marginRight="16dp" - android:textAppearance="?android:attr/textAppearanceMedium" + <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="@string/first_time_create_key" - android:minHeight="?android:attr/listPreferredItemHeight" - android:drawableRight="@drawable/ic_action_new_account" - android:drawablePadding="8dp" - android:gravity="center_vertical" - android:clickable="true" - style="@style/SelectableItem" + android:orientation="horizontal" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" - android:layout_alignParentStart="true" /> + android:layout_alignParentStart="true" + android:layout_marginLeft="16dp" + android:layout_marginRight="16dp" + android:id="@+id/create_key_buttons"> + <TextView + android:id="@+id/create_key_back_button" + android:paddingLeft="8dp" + android:paddingRight="8dp" + android:textAppearance="?android:attr/textAppearanceMedium" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="" + android:minHeight="?android:attr/listPreferredItemHeight" + android:gravity="center_vertical" + android:layout_gravity="center_vertical" /> + + <View + android:layout_width="1dp" + android:layout_height="match_parent" + android:layout_marginTop="8dp" + android:layout_marginBottom="8dp" + android:background="?android:attr/listDivider" /> + + <TextView + android:id="@+id/create_key_button" + android:paddingLeft="8dp" + android:paddingRight="8dp" + android:textAppearance="?android:attr/textAppearanceMedium" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/title_create_key" + android:minHeight="?android:attr/listPreferredItemHeight" + android:drawableRight="@drawable/ic_action_new_account" + android:drawablePadding="8dp" + android:gravity="center_vertical" + android:clickable="true" + style="@style/SelectableItem" + android:layout_gravity="center_vertical" /> + </LinearLayout> </RelativeLayout>
\ No newline at end of file diff --git a/OpenKeychain/src/main/res/layout/first_time_activity.xml b/OpenKeychain/src/main/res/layout/first_time_activity.xml index e1a67a077..fad1a3b26 100644 --- a/OpenKeychain/src/main/res/layout/first_time_activity.xml +++ b/OpenKeychain/src/main/res/layout/first_time_activity.xml @@ -24,16 +24,16 @@ android:orientation="horizontal"> <TextView - android:id="@+id/first_time_create_key" + android:id="@+id/first_time_import_key" android:paddingLeft="8dp" android:paddingRight="8dp" android:textAppearance="?android:attr/textAppearanceMedium" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" - android:text="@string/first_time_create_key" + android:text="@string/first_time_import_key" android:minHeight="?android:attr/listPreferredItemHeight" - android:drawableRight="@drawable/ic_action_new_account" + android:drawableRight="@drawable/ic_action_download" android:drawablePadding="8dp" android:gravity="center_vertical" android:clickable="true" @@ -47,20 +47,21 @@ android:background="?android:attr/listDivider" /> <TextView - android:id="@+id/first_time_import_key" + android:id="@+id/first_time_create_key" android:paddingLeft="8dp" android:paddingRight="8dp" android:textAppearance="?android:attr/textAppearanceMedium" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" - android:text="@string/first_time_import_key" + android:text="@string/first_time_create_key" android:minHeight="?android:attr/listPreferredItemHeight" - android:drawableRight="@drawable/ic_action_download" + android:drawableRight="@drawable/ic_action_new_account" android:drawablePadding="8dp" android:gravity="center_vertical" android:clickable="true" style="@style/SelectableItem" /> + </LinearLayout> <View |