return values for create key

This commit is contained in:
Dominik Schürmann 2014-07-30 14:57:59 +02:00
parent cdee62b79d
commit 70bfb5c586
3 changed files with 22 additions and 8 deletions

View File

@ -24,7 +24,6 @@ import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Message; import android.os.Message;
import android.os.Messenger; import android.os.Messenger;
import android.os.Parcelable;
import android.os.RemoteException; import android.os.RemoteException;
import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.Constants;
@ -53,7 +52,6 @@ import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralMsgIdException;
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings; import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
import org.sufficientlysecure.keychain.provider.KeychainDatabase; import org.sufficientlysecure.keychain.provider.KeychainDatabase;
import org.sufficientlysecure.keychain.provider.ProviderHelper; import org.sufficientlysecure.keychain.provider.ProviderHelper;
import org.sufficientlysecure.keychain.service.OperationResultParcel.OperationLog;
import org.sufficientlysecure.keychain.service.OperationResults.EditKeyResult; import org.sufficientlysecure.keychain.service.OperationResults.EditKeyResult;
import org.sufficientlysecure.keychain.service.OperationResults.ImportKeyResult; import org.sufficientlysecure.keychain.service.OperationResults.ImportKeyResult;
import org.sufficientlysecure.keychain.util.InputData; import org.sufficientlysecure.keychain.util.InputData;
@ -172,7 +170,7 @@ public class KeychainIntentService extends IntentService
// export // export
public static final String RESULT_EXPORT = "exported"; public static final String RESULT_EXPORT = "exported";
public static final String RESULT = "result"; public static final String RESULT_IMPORT = "result";
Messenger mMessenger; Messenger mMessenger;
@ -394,7 +392,7 @@ public class KeychainIntentService extends IntentService
ImportKeyResult result = pgpImportExport.importKeyRings(entries); ImportKeyResult result = pgpImportExport.importKeyRings(entries);
Bundle resultData = new Bundle(); Bundle resultData = new Bundle();
resultData.putParcelable(RESULT, result); resultData.putParcelable(RESULT_IMPORT, result);
sendMessageToHandler(KeychainIntentServiceHandler.MESSAGE_OKAY, resultData); sendMessageToHandler(KeychainIntentServiceHandler.MESSAGE_OKAY, resultData);
} catch (Exception e) { } catch (Exception e) {

View File

@ -36,6 +36,8 @@ import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.service.KeychainIntentService; import org.sufficientlysecure.keychain.service.KeychainIntentService;
import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler; import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
import org.sufficientlysecure.keychain.service.OperationResultParcel;
import org.sufficientlysecure.keychain.service.OperationResults;
import org.sufficientlysecure.keychain.service.SaveKeyringParcel; import org.sufficientlysecure.keychain.service.SaveKeyringParcel;
import org.sufficientlysecure.keychain.util.Notify; import org.sufficientlysecure.keychain.util.Notify;
@ -131,15 +133,29 @@ public class CreateKeyFinalFragment extends Fragment {
// handle messages by standard KeychainIntentServiceHandler first // handle messages by standard KeychainIntentServiceHandler first
super.handleMessage(message); super.handleMessage(message);
if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) {
// get returned data bundle
Bundle returnData = message.getData();
if (returnData == null) {
return;
}
final OperationResults.EditKeyResult result =
returnData.getParcelable(OperationResultParcel.EXTRA_RESULT);
if (result == null) {
return;
}
result.createNotify(getActivity());
// TODO // TODO
// if (mUploadCheckbox.isChecked()) { // if (mUploadCheckbox.isChecked()) {
// uploadKey(); // uploadKey();
// } else { // } else {
if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) {
getActivity().setResult(Activity.RESULT_OK); getActivity().setResult(Activity.RESULT_OK);
getActivity().finish(); getActivity().finish();
}
// } // }
}
} }
}; };

View File

@ -428,7 +428,7 @@ public class ImportKeysActivity extends ActionBarActivity {
return; return;
} }
final ImportKeyResult result = final ImportKeyResult result =
returnData.getParcelable(KeychainIntentService.RESULT); returnData.getParcelable(KeychainIntentService.RESULT_IMPORT);
if (result == null) { if (result == null) {
return; return;
} }