Search in sources :

Example 1 with IOpenPgpSinkResultCallback

use of org.openintents.openpgp.util.OpenPgpApi.IOpenPgpSinkResultCallback in project k-9 by k9mail.

the class MessageCryptoHelper method callAsyncInlineOperation.

private void callAsyncInlineOperation(Intent intent) throws IOException {
    OpenPgpDataSource dataSource = getDataSourceForEncryptedOrInlineData();
    OpenPgpDataSink<MimeBodyPart> dataSink = getDataSinkForDecryptedInlineData();
    cancelableBackgroundOperation = openPgpApi.executeApiAsync(intent, dataSource, dataSink, new IOpenPgpSinkResultCallback<MimeBodyPart>() {

        @Override
        public void onProgress(int current, int max) {
            Timber.d("received progress status: %d / %d", current, max);
            callbackProgress(current, max);
        }

        @Override
        public void onReturn(Intent result, MimeBodyPart bodyPart) {
            cancelableBackgroundOperation = null;
            currentCryptoResult = result;
            onCryptoOperationReturned(bodyPart);
        }
    });
}
Also used : IOpenPgpSinkResultCallback(org.openintents.openpgp.util.OpenPgpApi.IOpenPgpSinkResultCallback) OpenPgpDataSource(org.openintents.openpgp.util.OpenPgpApi.OpenPgpDataSource) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent) MimeBodyPart(com.fsck.k9.mail.internet.MimeBodyPart)

Example 2 with IOpenPgpSinkResultCallback

use of org.openintents.openpgp.util.OpenPgpApi.IOpenPgpSinkResultCallback in project k-9 by k9mail.

the class MessageCryptoHelper method callAsyncDecrypt.

private void callAsyncDecrypt(Intent intent) throws IOException {
    OpenPgpDataSource dataSource = getDataSourceForEncryptedOrInlineData();
    OpenPgpDataSink<MimeBodyPart> openPgpDataSink = getDataSinkForDecryptedData();
    cancelableBackgroundOperation = openPgpApi.executeApiAsync(intent, dataSource, openPgpDataSink, new IOpenPgpSinkResultCallback<MimeBodyPart>() {

        @Override
        public void onReturn(Intent result, MimeBodyPart decryptedPart) {
            cancelableBackgroundOperation = null;
            currentCryptoResult = result;
            onCryptoOperationReturned(decryptedPart);
        }

        @Override
        public void onProgress(int current, int max) {
            Timber.d("received progress status: %d / %d", current, max);
            callbackProgress(current, max);
        }
    });
}
Also used : IOpenPgpSinkResultCallback(org.openintents.openpgp.util.OpenPgpApi.IOpenPgpSinkResultCallback) OpenPgpDataSource(org.openintents.openpgp.util.OpenPgpApi.OpenPgpDataSource) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent) MimeBodyPart(com.fsck.k9.mail.internet.MimeBodyPart)

Aggregations

PendingIntent (android.app.PendingIntent)2 Intent (android.content.Intent)2 MimeBodyPart (com.fsck.k9.mail.internet.MimeBodyPart)2 IOpenPgpSinkResultCallback (org.openintents.openpgp.util.OpenPgpApi.IOpenPgpSinkResultCallback)2 OpenPgpDataSource (org.openintents.openpgp.util.OpenPgpApi.OpenPgpDataSource)2