Create key: upload

This commit is contained in:
Dominik Schürmann 2014-07-30 15:19:33 +02:00
parent e46d72ba27
commit 052cdfa392
2 changed files with 22 additions and 13 deletions

View file

@ -20,6 +20,7 @@ package org.sufficientlysecure.keychain.ui;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Message;
import android.os.Messenger;
@ -34,6 +35,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.provider.KeychainContract;
import org.sufficientlysecure.keychain.service.KeychainIntentService;
import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
import org.sufficientlysecure.keychain.service.OperationResultParcel;
@ -145,16 +147,16 @@ public class CreateKeyFinalFragment extends Fragment {
return;
}
result.createNotify(getActivity());
// TODO
// if (mUploadCheckbox.isChecked()) {
// uploadKey();
// } else {
getActivity().setResult(Activity.RESULT_OK);
getActivity().finish();
// }
if (mUploadCheckbox.isChecked()) {
// result will be displayed after upload
uploadKey(result);
} else {
// TODO: return result
result.createNotify(getActivity());
getActivity().setResult(Activity.RESULT_OK);
getActivity().finish();
}
}
}
};
@ -184,16 +186,17 @@ public class CreateKeyFinalFragment extends Fragment {
getActivity().startService(intent);
}
private void uploadKey() {
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);
intent.setAction(KeychainIntentService.ACTION_UPLOAD_KEYRING);
// set data uri as path to keyring
// TODO
// Uri blobUri = KeychainContract.KeyRingData.buildPublicKeyRingUri(mDataUri);
// intent.setData(blobUri);
Uri blobUri = KeychainContract.KeyRingData.buildPublicKeyRingUri(
Long.toString(editKeyResult.getRing().getMasterKeyId())
);
intent.setData(blobUri);
// fill values for this action
Bundle data = new Bundle();
@ -212,6 +215,10 @@ public class CreateKeyFinalFragment extends Fragment {
super.handleMessage(message);
if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) {
// TODO: return results
editKeyResult.createNotify(getActivity());
Notify.showNotify(getActivity(), R.string.key_send_success,
Notify.Style.INFO);

View file

@ -4,6 +4,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/notify_area" />
<FrameLayout
android:id="@+id/create_key_fragment_container"
android:layout_width="match_parent"