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


Java ZendeskCallback類代碼示例

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


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

示例1: buildCallback

import com.zendesk.service.ZendeskCallback; //導入依賴的package包/類
private ZendeskCallback<CreateRequest> buildCallback() {
    // Build the optional callback to handle success/error
  return new ZendeskCallback<CreateRequest>() {
      @Override
      public void onSuccess(CreateRequest createRequest) {
          progressDialog.dismiss();
          Log.d(TAG, "onSuccess: Ticket created!");
          Toast.makeText(getApplicationContext(), "Success! Ticket created!", Toast.LENGTH_SHORT).show();
      }

      @Override
      public void onError(ErrorResponse errorResponse) {
          progressDialog.dismiss();
          Log.d(TAG, "onError: " + errorResponse.getReason());
          Toast.makeText(getApplicationContext(), "Error! " + errorResponse.getReason(), Toast.LENGTH_SHORT).show();
      }
  };
}
 
開發者ID:zendesk,項目名稱:android_sdk_demo_apps,代碼行數:19,代碼來源:CustomFieldsActivity.java

示例2: onCreate

import com.zendesk.service.ZendeskCallback; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Uninteresting method of findViewById calls
    captureViews();

    submitButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            // Show friendly ProgressDialog with indeterminate progress spinner, non-cancelable.
            progressDialog = ProgressDialog.show(CustomFieldsActivity.this, "Sending Request", "Aligning 1s and 0s...", true, false);

            // Get an instance of the RequestProvider from the ZendeskConfig
            RequestProvider provider = ZendeskConfig.INSTANCE.provider().requestProvider();

            // Build your CreateRequest object, which includes the custom field data
            CreateRequest request = buildCreateRequest();

            // Optionally, create a ZendeskCallback. This can be null.
            ZendeskCallback<CreateRequest> callback = buildCallback();

            // Call the provider method
            provider.createRequest(request, callback);
        }
    });
}
 
開發者ID:zendesk,項目名稱:android_sdk_demo_apps,代碼行數:29,代碼來源:CustomFieldsActivity.java

示例3: onActivityResult

import com.zendesk.service.ZendeskCallback; //導入依賴的package包/類
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    belvedere.getFilesFromActivityOnResult(requestCode, resultCode, data, new BelvedereCallback<List<BelvedereResult>>() {
        @Override
        public void success(List<BelvedereResult> belvedereResults) {

            if (belvedereResults != null && belvedereResults.size() > 0) {
                progressDialog("Uploading your attachments...").show();
            } else {
                return;
            }

            for (int i = 0, limit = belvedereResults.size(); i < limit; i++) {

                BelvedereResult file = belvedereResults.get(i);

                uploadProvider.uploadAttachment(
                        file.getFile().getName(),
                        file.getFile(),
                        getMimeType(getApplicationContext(), file.getUri()),
                        new ZendeskCallback<UploadResponse>() {
                            @Override
                            public void onSuccess(UploadResponse uploadResponse) {
                                if (uploadResponse != null && uploadResponse.getAttachment() != null) {
                                    attachmentsUploaded.add(uploadResponse.getToken());
                                    Log.d(LOG_TAG, String.format("onSuccess: Image successfully uploaded: %s",
                                            uploadResponse.getAttachment().getContentUrl()));
                                }
                                // Make sure to keep track of how many requests are in progress
                                uploadRequestsInProgress--;

                                checkUploadRequestsInProgress();
                            }

                            @Override
                            public void onError(ErrorResponse errorResponse) {
                                // Make sure to keep track of how many requests are in progress
                                uploadRequestsInProgress--;

                                checkUploadRequestsInProgress();
                            }
                        });

                uploadRequestsInProgress++;
            }
        }
    });
}
 
開發者ID:zendesk,項目名稱:android_sdk_demo_apps,代碼行數:51,代碼來源:UploadAttachmentActivity.java


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