當前位置: 首頁>>代碼示例>>Java>>正文


Java ICallback類代碼示例

本文整理匯總了Java中com.microsoft.graph.concurrency.ICallback的典型用法代碼示例。如果您正苦於以下問題:Java ICallback類的具體用法?Java ICallback怎麽用?Java ICallback使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ICallback類屬於com.microsoft.graph.concurrency包,在下文中一共展示了ICallback類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createDraftMail

import com.microsoft.graph.concurrency.ICallback; //導入依賴的package包/類
/**
 * Creates a draft email message using the Microsoft Graph API on Office 365. The mail is sent
 * from the address of the signed in user.
 *
 * @param senderPreferredName The mail senders principal user name (email addr)
 * @param emailAddress        The recipient email address.
 * @param subject             The subject to use in the mail message.
 * @param body                The body of the message.
 * @param callback            The callback method to invoke on completion of the POST request
 */
public void createDraftMail(
        final String senderPreferredName,
        final String emailAddress,
        final String subject,
        final String body,
        ICallback<Message> callback
) {
    try {
        // create the email message
        Message message = createMessage(subject, body, emailAddress);
        mGraphServiceClient
                .getMe()
                .getMessages()
                .buildRequest()
                .post(message, callback);

    } catch (Exception ex) {
        showException(ex, "exception on send mail","Send mail failed", "The send mail method failed");
    }
}
 
開發者ID:microsoftgraph,項目名稱:android-java-connect-sample,代碼行數:31,代碼來源:GraphServiceController.java

示例2: sendDraftMessage

import com.microsoft.graph.concurrency.ICallback; //導入依賴的package包/類
/**
 * Sends a draft message to the specified recipients
 *
 * @param messageId String. The id of the message to send
 * @param callback
 */
public void sendDraftMessage(String messageId,
                             ICallback<Void> callback) {
    try {

        mGraphServiceClient
                .getMe()
                .getMessages(messageId)
                .getSend()
                .buildRequest()
                .post(callback);

    } catch (Exception ex) {
        showException(ex, "exception on send draft message ","Send draft mail failed", "The send draft mail method failed");
    }
}
 
開發者ID:microsoftgraph,項目名稱:android-java-connect-sample,代碼行數:22,代碼來源:GraphServiceController.java

示例3: getSharingLink

import com.microsoft.graph.concurrency.ICallback; //導入依賴的package包/類
/**
 * Gets the picture sharing link from OneDrive and calls the step 4 helper
 *
 * @param driveItem
 * @param bytes
 */
private void getSharingLink(DriveItem driveItem, final byte[] bytes) {
    //3. Get a sharing link to the picture uploaded to OneDrive
    mGraphServiceController.getSharingLink(driveItem.id, new ICallback<Permission>() {
        @Override
        public void success(final Permission permission) {
            Log.i("SendMailActivity", "Creating the draft message ");
            createDraftMail(permission, bytes);
        }
        @Override
        public void failure(ClientException ex) {
            Log.i("SendMailActivity", "Exception on get sharing link " + ex.getLocalizedMessage());
            showSendMailErrorUI();
        }
    });
}
 
開發者ID:microsoftgraph,項目名稱:android-java-connect-sample,代碼行數:22,代碼來源:SendMailActivity.java

示例4: addPictureToDraftMessage

import com.microsoft.graph.concurrency.ICallback; //導入依賴的package包/類
/**
 * Adds the picture bytes as attachment to the draft message and calls the step 7 helper
 *
 * @param aMessage
 * @param permission
 * @param bytes
 */
private void addPictureToDraftMessage(final Message aMessage, final Permission permission, final byte[] bytes) {
    //6. Add the profile picture to the draft mail
    mGraphServiceController.addPictureToDraftMessage(aMessage.id, bytes, permission.link.webUrl,
        new ICallback<Attachment>() {
            @Override
            public void success(final Attachment anAttachment) {
                Log.i("SendMailActivity", "Sending draft message ");
                sendDraftMessage(aMessage);
            }

            @Override
            public void failure(ClientException ex) {
                Log.i("SendMailActivity", "Exception on add picture to draft message " + ex.getLocalizedMessage());
                showSendMailErrorUI();
            }
        });
}
 
開發者ID:microsoftgraph,項目名稱:android-java-connect-sample,代碼行數:25,代碼來源:SendMailActivity.java

示例5: sendDraftMessage

import com.microsoft.graph.concurrency.ICallback; //導入依賴的package包/類
/**
 * Sends the draft message
 *
 * @param aMessage
 */
private void sendDraftMessage(final Message aMessage) {
    //7. Send the draft message to the recipient
    mGraphServiceController.sendDraftMessage(aMessage.id, new ICallback<Void>() {
        @Override
        public void success(Void aVoid) {
            showSendMailSuccessUI();
        }

        @Override
        public void failure(ClientException ex) {
            Log.i("SendMailActivity", "Exception on send draft message " + ex.getLocalizedMessage());
            showSendMailErrorUI();

        }
    });

}
 
開發者ID:microsoftgraph,項目名稱:android-java-connect-sample,代碼行數:23,代碼來源:SendMailActivity.java

示例6: addPictureToDraftMessage

import com.microsoft.graph.concurrency.ICallback; //導入依賴的package包/類
/**
 * Posts a file attachment in a draft message by message Id
 *
 * @param messageId   String. The id of the draft message to add an attachment to
 * @param picture     Byte[]. The picture in bytes
 * @param sharingLink String. The sharing link to the uploaded picture
 * @param callback
 */
public void addPictureToDraftMessage(String messageId,
                                     byte[] picture,
                                     String sharingLink,
                                     ICallback<Attachment> callback) {
    try {
        byte[] attachementBytes = new byte[picture.length];

        if (picture.length > 0) {
            attachementBytes = picture;
        } else {
            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP){
                attachementBytes = getDefaultPicture();
            }
            else {
                attachementBytes = getTestPicture();
            }
        }

        FileAttachment fileAttachment = new FileAttachment();
        fileAttachment.oDataType = "#microsoft.graph.fileAttachment";
        fileAttachment.contentBytes = attachementBytes;
        //fileAttachment.contentType = "image/png";
        fileAttachment.name = "me.png";
        fileAttachment.size = attachementBytes.length;
        fileAttachment.isInline = false;
        fileAttachment.id = "blabla";
        Log.i("connect sample","attachement id " + fileAttachment.id);
        mGraphServiceClient
                .getMe()
                .getMessages(messageId)
                .getAttachments()
                .buildRequest()
                .post(fileAttachment, callback);

    } catch (Exception ex) {
        showException(ex, "exception on add picture to draft message","Draft attachment failed", "The post file attachment method failed");
    }
}
 
開發者ID:microsoftgraph,項目名稱:android-java-connect-sample,代碼行數:47,代碼來源:GraphServiceController.java

示例7: getDraftMessage

import com.microsoft.graph.concurrency.ICallback; //導入依賴的package包/類
/**
 * Gets a draft message by message id
 * @param messageId
 * @param callback
 */
public void getDraftMessage(String messageId, ICallback<Message> callback) {
    try {
        mGraphServiceClient.getMe()
                .getMessages(messageId)
                .buildRequest()
                .getMessage(callback);

    } catch (Exception ex) {
        showException(ex, "exception on get draft message ","Get draft mail failed", "The get draft mail method failed");

    }
}
 
開發者ID:microsoftgraph,項目名稱:android-java-connect-sample,代碼行數:18,代碼來源:GraphServiceController.java

示例8: uploadPictureToOneDrive

import com.microsoft.graph.concurrency.ICallback; //導入依賴的package包/類
/**
 * Uploads a user picture as byte array to the user's OneDrive root folder
 *
 * @param picture  byte[] picture byte array
 * @param callback
 */
public void uploadPictureToOneDrive(byte[] picture, ICallback<DriveItem> callback) {

    try {
        mGraphServiceClient
                .getMe()
                .getDrive()
                .getRoot()
                .getItemWithPath("me.png")
                .getContent()
                .buildRequest()
                .put(picture, callback);
    } catch (Exception ex) {
        showException(ex, "exception on upload picture to OneDrive ","Upload picture failed", "The upload picture  method failed");
    }
}
 
開發者ID:microsoftgraph,項目名稱:android-java-connect-sample,代碼行數:22,代碼來源:GraphServiceController.java

示例9: getSharingLink

import com.microsoft.graph.concurrency.ICallback; //導入依賴的package包/類
public void getSharingLink(String id, ICallback<Permission> callback) {

        try {

            mGraphServiceClient
                    .getMe()
                    .getDrive()
                    .getItems(id)
                    .getCreateLink("organization", "view")
                    .buildRequest()
                    .post(callback);
        } catch (Exception ex) {
            showException(ex, "exception on get OneDrive sharing link ","Get sharing link failed", "The get sharing link method failed");
        }
    }
 
開發者ID:microsoftgraph,項目名稱:android-java-connect-sample,代碼行數:16,代碼來源:GraphServiceController.java

示例10: loginSilentBlocking

import com.microsoft.graph.concurrency.ICallback; //導入依賴的package包/類
/**
 * Login silently while blocking for the call to return
 *
 * @return the result of the login attempt
 * @throws ClientException The exception if there was an issue during the login attempt
 */
private Void loginSilentBlocking() throws ClientException {
    final SimpleWaiter waiter = new SimpleWaiter();
    final AtomicReference<Void> returnValue = new AtomicReference<>();
    final AtomicReference<ClientException> exceptionValue = new AtomicReference<>();

    loginSilent(new ICallback<Void>() {
        @Override
        public void success(final Void aVoid) {
            returnValue.set(aVoid);
            waiter.signal();
        }

        @Override
        public void failure(final ClientException ex) {
            exceptionValue.set(ex);
            waiter.signal();
        }
    });

    waiter.waitForSignal();

    //noinspection ThrowableResultOfMethodCallIgnored
    if (exceptionValue.get() != null) {
        throw exceptionValue.get();
    }

    return returnValue.get();
}
 
開發者ID:microsoftgraph,項目名稱:msgraph-sdk-android-msa-auth-for-android-adapter,代碼行數:35,代碼來源:MSAAuthAndroidAdapter.java

示例11: request

import com.microsoft.graph.concurrency.ICallback; //導入依賴的package包/類
@Override
public abstract void request(ICallback<Result> callback);
 
開發者ID:microsoftgraph,項目名稱:android-java-snippets-sample,代碼行數:3,代碼來源:MessageSnippets.java

示例12: logout

import com.microsoft.graph.concurrency.ICallback; //導入依賴的package包/類
/**
 * Logs out the user
 *
 * @param callback The callback when the logout is complete or an error occurs
 */
void logout(final ICallback<Void> callback);
 
開發者ID:microsoftgraph,項目名稱:msgraph-sdk-android-msa-auth-for-android-adapter,代碼行數:7,代碼來源:IAuthenticationAdapter.java

示例13: login

import com.microsoft.graph.concurrency.ICallback; //導入依賴的package包/類
/**
 * Login a user by popping UI
 *
 * @param activity The current activity
 * @param callback The callback when the login is complete or an error occurs
 */
void login(final Activity activity, final ICallback<Void> callback);
 
開發者ID:microsoftgraph,項目名稱:msgraph-sdk-android-msa-auth-for-android-adapter,代碼行數:8,代碼來源:IAuthenticationAdapter.java

示例14: loginSilent

import com.microsoft.graph.concurrency.ICallback; //導入依賴的package包/類
/**
 * Login a user with no ui
 *
 * @param callback The callback when the login is complete or an error occurs
 */
void loginSilent(final ICallback<Void> callback);
 
開發者ID:microsoftgraph,項目名稱:msgraph-sdk-android-msa-auth-for-android-adapter,代碼行數:7,代碼來源:IAuthenticationAdapter.java

示例15: request

import com.microsoft.graph.concurrency.ICallback; //導入依賴的package包/類
public abstract void request(ICallback<Result> callback); 
開發者ID:microsoftgraph,項目名稱:android-java-snippets-sample,代碼行數:2,代碼來源:AbstractSnippet.java


注:本文中的com.microsoft.graph.concurrency.ICallback類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。