Java 类com.parse.DeleteCallback 实例源码

项目:libertacao-android    文件:EventDetailActivity.java   
private void deleteEvent() {
    new AlertDialog.Builder(this)
            .setTitle(getString(R.string.delete))
            .setMessage(getString(R.string.deleteConfirm))
            .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    final ProgressDialog pd = ViewUtils.showProgressDialog(EventDetailActivity.this, getString(R.string.deletingEvent), false);
                    ParseObject eventParseObject = new ParseObject(Event.EVENT);
                    eventParseObject.setObjectId(event.getObjectId());
                    eventParseObject.deleteInBackground(new DeleteCallback() {
                        @Override
                        public void done(ParseException e) {
                            DatabaseHelper.getHelper(EventDetailActivity.this).getEventIntegerRuntimeExceptionDao().delete(event);
                            ViewUtils.hideProgressDialog(pd);
                            Toast.makeText(EventDetailActivity.this,
                                    EventDetailActivity.this.getString(R.string.eventDeletedSuccessfully),
                                    Toast.LENGTH_LONG).show();
                            finish();
                        }
                    });
                }
            })
            .setNegativeButton(android.R.string.no, null)
            .setIcon(android.R.drawable.ic_dialog_alert)
            .show();
}
项目:android-parse-module-titanium-3-5    文件:AndroidTitaniumParseModule.java   
@Kroll.method
public void deleteObject(String className, String objectId, final KrollFunction applicationCallback) {
    DeleteCallback parseCallback = new DeleteCallback() {
        public void done(ParseException e) {
            HashMap result = new HashMap();
            if (e == null) {
                result.put("success", true);
            } else {
                result.put("error", e.toString());
            }

            applicationCallback.callAsync(getKrollObject(), result);
        }
    };

    parseSingleton.DeleteDataObject(className, objectId, parseCallback);
}
项目:diet    文件:SnackList.java   
/**
 * Deletes a snack entry.
 *
 * @param position Position of the snack entry to delete
 * @param failsafe The failsafe's object id must match the snack entry at the specified position.
 * @param callback The callback to invoke after completion.
 */
public void deleteSnack(final int position, final SnackEntry failsafe, final DeleteCallback callback){
    SnackEntry toDelete = get(position);
    if(!toDelete.getObjectId().equals(failsafe.getObjectId())){
        callback.done(new ParseException(ParseException.OTHER_CAUSE, "Invalid delete"));
    } else{
        get(position).deleteInBackground(new DeleteCallback() {
            @Override
            public void done(ParseException e) {
                if(e == null){
                    snacks.remove(position);
                    notifyUpdateComplete(e);
                }
                callback.done(e);
            }
        });
    }
}
项目:SurgeTracker    文件:SurgeParseObject.java   
Task<Void> deleteAsync() {
    final Task<Void>.TaskCompletionSource tcs = Task.create();
    deleteInBackground(new DeleteCallback() {
        @Override
        public void done(ParseException e) {
            if (e == null) {
                logger.log(Level.INFO, "Deleted successfully.");
                tcs.setResult(null);
            } else {
                logger.log(Level.SEVERE, "Unable to delete Surge.", e);
                tcs.setError(e);
            }
        }
    });
    return tcs.getTask();
}
项目:ExpertAndroid    文件:WordListAdapter.java   
private void deleteWord(Word wordRef)
{
    curWordToDelete = wordRef;
    reportBack.reportTransient("Delete Button Clicked:" + wordRef.toString());
    reportBack.turnOffProgressDialog();
    wordRef.getParseObject().deleteInBackground(new DeleteCallback() {
        @Override
        public void done(ParseException e) {
            reportBack.turnOffProgressDialog();
            if (e == null) {
                deleteSuccessful(curWordToDelete);
            }
            else {
                deleteFailed(e,curWordToDelete);
            }
            curWordToDelete = null;
        }
    });
}
项目:Marketplace    文件:ActivityItemDetails.java   
private void deleteItem(ParseObject parseObject) {
    parseObject.deleteInBackground(new DeleteCallback() {
        @Override
        public void done(ParseException e) {
            if(e==null){
                Toast.makeText(ActivityItemDetails.this, "Post Deleted!!", Toast.LENGTH_LONG).show();
                deleted = true;
                onBackPressed();
            }
        }
    });

}
项目:Studddinv2_android    文件:MyListingsFragment.java   
public ViewHolder(CardView v) {
    super(v);
    this.listing_name = (TextView) v.findViewById(R.id.listing_name);
    this.delete = (ImageView) v.findViewById(R.id.listing_delete);
    this.createdAt = (TextView) v.findViewById(R.id.listing_created_at);
    this.listing_image = (ParseCircularImageView) v.findViewById(R.id.listing_image);
    this.listing_desc = (TextView) v.findViewById(R.id.listing_desc);

    delete.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            ParseObject object = mDataset.get(getPosition());
            object.deleteInBackground(new DeleteCallback() {
                @Override
                public void done(ParseException e) {
                    if (e == null) {
                        mDataset.remove(getPosition());
                        notifyItemRemoved(getPosition());
                        notifyItemRangeChanged(getPosition(), mDataset.size());
                        fetchMyListings();
                    } else
                        Toast.makeText(getActivity(), "Please connect to the Internet", Toast.LENGTH_SHORT).show();
                }
            });

        }
    });
}
项目:DemocracyLink-Android    文件:CreateEmailActivity.java   
/**
 * Once ministers are retrieved this will save them locally under the name of the province they
 * correspond to, or "Canada" if federal.
 * @param ministers
 */
private void saveMinistersLocally(final List<ParseObject> ministers) {
    ParseObject.unpinAllInBackground(mProvince, ministers, new DeleteCallback() {
        @Override
        public void done(ParseException e) {
            ParseObject.pinAllInBackground(mProvince, ministers);
        }
    });

}
项目:diet    文件:SnackDetailsActivity.java   
private void deleteEntry(){
    if(progressOverlay != null)
        progressOverlay.setVisibility(View.VISIBLE);

    SnackList.getInstance().deleteSnack(snackPosition, snackEntry, new DeleteCallback() {
        @Override
        public void done(ParseException e) {
            if(e == null){
                updateToast("Entry deleted", Toast.LENGTH_SHORT);

                // Attempt to delete entry's cached image
                if(snackEntry != null){
                    ParseFile parseFile = snackEntry.getPhoto();
                    if(parseFile != null){
                        String url = parseFile.getUrl();
                        if(url != null){
                            if(fileCache.getFile(url).delete()){
                                Log.d(TAG, "deleteEntry() successfully deleted entry's cached image");
                            } else{
                                Log.d(TAG, "deleteEntry() failed to delete entry's cached image");
                            }
                        }
                    }
                }
                finish();
            } else{
                updateToast("Unable to delete entry", Toast.LENGTH_SHORT);
            }

            if(progressOverlay != null)
                progressOverlay.setVisibility(View.GONE);
        }
    });
}
项目:Coins    文件:AccountActivity.java   
/**
 */
private void deleteAccountTransactions(List<ParseObject> parseObjects)
{
    if(parseObjects.isEmpty())
    {
        setResult(ACCOUNT_DELETED);
        finish();
        super.showProgress(false);
        return;
    }

    for (ParseObject object : parseObjects)
    {
        object.deleteInBackground(new DeleteCallback()
        {
            @Override
            public void done(ParseException e)
            {
                mItemsCounter--;
                if (mItemsCounter <= 0)
                {
                    setResult(ACCOUNT_DELETED);
                    finish();
                    showProgress(false);
                }
            }
        });
    }
}
项目:android-parse-module-titanium-3-5    文件:ParseSingleton.java   
public void DeleteDataObject(String className, String objectId, DeleteCallback callback) {
  ParseObject object = ParseObject.createWithoutData(className, objectId);
  object.deleteInBackground(callback);
}