예제 #1
0
 public void save(View view) {
   if (pictureFile != null) {
     service.asyncUpload(
         pictureFile,
         new FileCreationResponseCallback() {
           @Override
           public void onCompletion(FileCreationResponse response) {
             if (response.was(200, 201)) {
               String pictureKey = response.fileKey();
               task.add("picture", pictureKey);
               service.asyncUpdate(updatedTask(), GO_TO_TASK_VIEW);
             }
           }
         });
   } else {
     service.asyncUpdate(updatedTask(), GO_TO_TASK_VIEW);
   }
 }
예제 #2
0
 private void setPicture() {
   String pictureKey = task.getString(TaskAdapter.PICTURE);
   if (pictureKey != null) {
     service.asyncLoadFile(
         pictureKey,
         new FileLoadCallback(pictureKey) {
           @Override
           public void onCompletion(CMFile file) {
             byte[] pictureBytes = file.fileContents();
             Bitmap asBitmap = BitmapFactory.decodeByteArray(pictureBytes, 0, pictureBytes.length);
             setImage(asBitmap);
           }
         });
   }
 }
예제 #3
0
  public void delete(View view) {
    service.asyncDeleteObject(
        task,
        new CMResponseCallback() {
          @Override
          public void onCompletion(CMResponse response) {
            goToTaskView();
          }

          @Override
          public void onFailure(Throwable error, String message) {
            Log.e(TAG, "Failed deleting detail task");
          }
        });
  }