当前位置: 首页>>代码示例>>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;未经允许,请勿转载。