cn.bmob.v3.listener.SaveListener Java Examples

The following examples show how to use cn.bmob.v3.listener.SaveListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LoginActivity.java    From Mobike with Apache License 2.0 6 votes vote down vote up
private void toLogin() {
    mUser = new MyUser();
    mUser.setUsername(mPhone);
    mUser.setPassword(mPhone);
    mUser.login(new SaveListener<MyUser>() {
        @Override
        public void done(MyUser myUser, BmobException e) {
            if (e == null) {
                if (myUser != null)
                    Logger.d(myUser);
                mApplication.clearUser();
                mApplication.putUser(myUser);
                Log.d(TAG, "done: login ok");
                Go2MainOrPay();
            } else {
                Log.d("bmob", "isRegister:" + e.getMessage() + "," + e.getErrorCode());
                ToastUtils.show(LoginActivity.this, "未知错误");
            }
            DismissMyDialog();
        }
    });
}
 
Example #2
Source File: MsgManager.java    From TestChat with Apache License 2.0 6 votes vote down vote up
private void uploadChatTableMessage(final GroupTableMessage groupTableMessage, SaveListener listener) {
        List<String> groupNumber = groupTableMessage.getGroupNumber();
        GroupTableMessage message;
        List<String> copy = new ArrayList<>(groupNumber);
        if (copy.contains(UserManager.getInstance().getCurrentUserObjectId())) {
                copy.remove(UserManager.getInstance().getCurrentUserObjectId());
        }
        List<BmobObject> groupTableMessageList = new ArrayList<>();
        for (int i = 0; i < copy.size(); i++) {
                message = new GroupTableMessage();
                message.setSendStatus(Constant.SEND_STATUS_SUCCESS);
                message.setReadStatus(Constant.READ_STATUS_UNREAD);
                message.setGroupDescription(groupTableMessage.getGroupDescription());
                message.setGroupId(groupTableMessage.getGroupId());
                message.setCreatedTime(groupTableMessage.getCreatedTime());
                message.setToId(copy.get(i));
                message.setGroupNumber(groupNumber);
                message.setGroupAvatar(groupTableMessage.getGroupAvatar());
                message.setGroupName(groupTableMessage.getGroupName());
                message.setGroupNick(groupTableMessage.getGroupNick());
                message.setNotification(groupTableMessage.getNotification());
                message.setCreatorId(groupTableMessage.getCreatorId());
                groupTableMessageList.add(message);
        }
        new BmobObject().insertBatch(CustomApplication.getInstance(), groupTableMessageList, listener);
}
 
Example #3
Source File: FeedbackPresenter.java    From SuperNote with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void sendFeedback(final String content, final String contact) {

    if(TextUtils.isEmpty(content)){
        ToastUtils.showShort("请至少填写反馈内容");
        return;
    }
    if(content.equals(mLastContent) && contact.equals(mLastContact)){
        ToastUtils.showShort("请不要重复提交");
        return;
    }

    Feedback feedback=getFeedback(content,contact);
    mView.showLoading();
    feedback.save(new SaveListener<String>() {
        @Override
        public void done(String s, BmobException e) {
           sendBack(e,content,contact);
        }
    });
}
 
Example #4
Source File: BikeDamageReportActivity.java    From Mobike with Apache License 2.0 6 votes vote down vote up
private void saveDatial() {
    mData.setMyUser(mMyUser);
    mData.setCarNub(mTvCarnub.getText().toString());
    mData.setDesc(mEtBikeDamage.getText().toString());
    mData.setCarPic(bmobFile);
    mData.setType(mAdapter.getType());
    mData.save(new SaveListener<String>() {
        @Override
        public void done(String s, BmobException e) {
            if (e == null) {
                ToastUtils.show(BikeDamageReportActivity.this, "提交成功");
                finish();
            } else {

                Logger.d(e);
                ToastUtils.show(BikeDamageReportActivity.this, "提交失败");
            }
            mBtQuery.setClickable(true);
            if (mDialog.isShowing())
                mDialog.dismiss();
        }
    });
}
 
Example #5
Source File: BmobDataHelper.java    From Swface with Apache License 2.0 6 votes vote down vote up
public void addUserHasSign(final UserHasSigned userHasSigned) {
	userHasSigned.save(new SaveListener<String>() {
		@Override
		public void done(String s, BmobException e) {
			if (e == null) {
				Log.i(TAG, "userHasSigned.save: success");
				DatabaseAdapter db = new DatabaseAdapter(context);
				userHasSigned.setObjectId(s);
				db.addUser_User(userHasSigned, myHandler);
				Log.i(TAG, "addUser_User: Success!");
			} else {
				Log.e(TAG, "userHasSigned.save: failed" + e);
				Message message = new Message();
				message.arg1 = FinalUtil.DETECT_FAILED_IO_EXCEPTION;
				myHandler.sendMessage(message);
			}
		}
	});
}
 
Example #6
Source File: ReportViolationsActivity.java    From Mobike with Apache License 2.0 6 votes vote down vote up
private void saveDatial() {
    mData.setMyUser(mMyUser);
    mData.setCarNub(mTvCarnub.getText().toString());
    mData.setDesc(mEtBikeDamage.getText().toString());
    mData.setCarPic(bmobFile);
    mData.setType("举报违停");
    mData.save(new SaveListener<String>() {
        @Override
        public void done(String s, BmobException e) {
            if (e == null) {
                ToastUtils.show(ReportViolationsActivity.this, "提交成功");
                finish();
            } else {
                ToastUtils.show(ReportViolationsActivity.this, "提交失败");
            }
            if (mDialog.isShowing())
                mDialog.dismiss();
        }
    });
}
 
Example #7
Source File: FeedActivity.java    From MyHearts with Apache License 2.0 6 votes vote down vote up
/**
 * 提交数据
 */
private void submit() {
    boolean isMatchSubmit = veryParams();
    if (isMatchSubmit){
        FeedBean bean = new FeedBean();
        bean.setContent(mFeedContent);
        bean.setPhone(mFeedPhone);
        bean.setUsername(mUserName);
        bean.save(new SaveListener<String>() {
            @Override
            public void done(String s, BmobException e) {
                if (e==null){

                    Toast.makeText(FeedActivity.this,
                            getResources().getString(R.string.submit_success),
                            Toast.LENGTH_SHORT).show();
                } else {
                    Log.d(TAG, e.toString());
                }
            }
        });
    }
}
 
Example #8
Source File: FeedBackActivity.java    From LeisureRead with Apache License 2.0 6 votes vote down vote up
private void sendFeedBackText(String text) {

    FeedBackInfo mMessage = new FeedBackInfo();
    mMessage.setContent(text);
    mMessage.save(FeedBackActivity.this, new SaveListener() {

      @Override
      public void onSuccess() {
        // TODO Auto-generated method stub
        Toast.makeText(FeedBackActivity.this, "提交成功", Toast.LENGTH_SHORT).show();
        mFeedBack.setText("");
      }


      @Override
      public void onFailure(int errorCode, String errorMsg) {
        // TODO Auto-generated method stub
        Toast.makeText(FeedBackActivity.this, "提交失败", Toast.LENGTH_SHORT).show();
        LogUtil.all(errorMsg);
      }
    });
  }
 
Example #9
Source File: SkinEngine.java    From stynico with MIT License 6 votes vote down vote up
/**
    * 保存反馈信息到服务器
    * @param msg 反馈信息
    */
   private void saveFeedbackMsg(String msg)
   {
xp feedback = new xp();
feedback.setContent(msg);
feedback.save(this, new SaveListener() {

	@Override
	public void onSuccess()
	{
	}

	@Override
	public void onFailure(int code, String arg0)
	{
	}
    });
   }
 
Example #10
Source File: LoginActivity.java    From VSigner with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 响应登录按钮
 * @param v
 */
public void btn_login_onclick(View v) {
	showProgressDialog(getString(R.string.request_server));
	User user = new User();
	user.setUsername(mUsernameTextView.getText().toString());
	user.setPassword(mPasswordEditText.getText().toString());
	user.login(mContext, new SaveListener() {
		@Override
		public void onSuccess() { // 登录成功
			hideProgressDialog();
			Intent intent = new Intent(mContext, MainActivity.class);
			startActivity(intent);
			finish();
		}
		
		@Override
		public void onFailure(int code, String msg) {
			hideProgressDialog();
			TipsDialog dialogTips = new TipsDialog(mContext, getString(R.string.login_error_tips) + ": " + msg, getString(R.string.ok));
			dialogTips.show();
		}
	});
}
 
Example #11
Source File: DepositRefundIssueActivity.java    From Mobike with Apache License 2.0 6 votes vote down vote up
private void uploadData() {
    MyUser myUser= MyApplication.getInstance().getUser();
    DepositRefundData mRefundData=new DepositRefundData();
    mRefundData.setMyUser(myUser);
    mRefundData.setOrderNub(mEtOrder.getText().toString());
    mRefundData.setOrderPic(bmobFile);
    mRefundData.setPaytype(currentpaytype+"");
    mRefundData.save(new SaveListener<String>() {
        @Override
        public void done(String s, BmobException e) {
            if (e == null) {
                ToastUtils.show(DepositRefundIssueActivity.this, "提交成功,客服会尽快处理,请勿重复提交");
                DepositRefundIssueActivity.this.finish();
            } else {
                ToastUtils.show(DepositRefundIssueActivity.this, "提交失败");
            }
            DismissDialog();
        }
    });
}
 
Example #12
Source File: BmobCourseDataSource.java    From ZfsoftCampusAssit with Apache License 2.0 6 votes vote down vote up
@Override
public void saveTimetableCourses(List<Course> courses) {
    if (!courses.isEmpty() && mContext != null) {
        new BmobObject().insertBatch(mContext, new ArrayList<BmobObject>(courses), new SaveListener() {
            @Override
            public void onSuccess() {
                Log.d(tag,"bmob batch timetable courses saved successful.");
            }

            @Override
            public void onFailure(int i, String s) {
                Log.e(tag,"bmob batch timetable courses failure.");
            }
        });
    } else {
        Log.e(tag,"bmob batch insert cannot null");
    }
}
 
Example #13
Source File: Main4Activity.java    From styT with Apache License 2.0 6 votes vote down vote up
private void saveFeedbackMsg(String msg) {
    TelephonyManager telephonyManager = (TelephonyManager) this.getSystemService(TELEPHONY_SERVICE);
    String imei = "" + telephonyManager.getDeviceId();
    //String last6chars = imei.remove(0,imei.length-6);
    int n = 4;
    final String b = imei.substring(imei.length() - n, imei.length());
    //final int count = Integer.parseInt(b) + 36;
    xp feedback = new xp();
    feedback.setContent(b + "; " + msg);
    feedback.save(new SaveListener<String>() {
        @Override
        public void done(String objectId, BmobException e) {
            if (e == null) {

            } else {
            }
        }
    });
}
 
Example #14
Source File: BmobCourseDataSource.java    From ZfsoftCampusAssit with Apache License 2.0 6 votes vote down vote up
@Override
public void saveTimetableCourse(Course course) {
    if (course != null && mContext != null) {
        course.save(mContext, new SaveListener() {
            @Override
            public void onSuccess() {
                Log.d(tag,"bmob timetable course saved successful.");
            }

            @Override
            public void onFailure(int i, String s) {
                Log.e(tag,"bmob timetable course saved failure.");
            }
        });
    } else {
        Log.e(tag,"bmob insert cannot null");
    }
}
 
Example #15
Source File: HelpsCommentActivity.java    From styT with Apache License 2.0 6 votes vote down vote up
/**
 * 使用bmob进行消息推送
 *
 * @param myUser
 */
private void bmobpush(MyUser myUser, String comment) {
    String installationId = helps.getUser().getObjectId();
    BmobPushManager bmobPushManager = new BmobPushManager();
    BmobQuery<MyUserInstallation> query = new BmobQuery<MyUserInstallation>();
    query.addWhereEqualTo("uid", installationId);
    bmobPushManager.setQuery(query);
    bmobPushManager.pushMessage(myUser.getUsername() + "评论了你");

    NotifyMsg notifyMsg = new NotifyMsg();
    notifyMsg.setHelps(helps);
    notifyMsg.setUser(helps.getUser());
    notifyMsg.setAuthor(myUser);
    notifyMsg.setStatus(false);
    notifyMsg.setMessage(comment);
    notifyMsg.save(new SaveListener<String>() {
        @Override
        public void done(String s, BmobException e) {

        }
    });
}
 
Example #16
Source File: ChatListPresenter.java    From NewFastFrame with Apache License 2.0 6 votes vote down vote up
public void sendChatBean(String content) {
    ChatBean chatBean = new ChatBean();
    chatBean.setUid(UserManager.getInstance().getCurrentUserObjectId());
    chatBean.setContent(content);
    chatBean.save(new SaveListener<String>() {
        @Override
        public void done(String s, BmobException e) {
            iView.hideLoading();
            if (e == null) {
                RxBusManager.getInstance().post(chatBean);
            } else {
                ToastUtils.showShortToast("上传信息失败" + e.toString());
            }
        }
    });
}
 
Example #17
Source File: HelpsCommentActivity.java    From styT with Apache License 2.0 6 votes vote down vote up
/**
 * 发表评论
 *
 * @param comment
 * @param myUser
 */
private void push(final String comment, final MyUser myUser) {
    Comment comment1 = new Comment();
    comment1.setUser(myUser);
    comment1.setHelps(helps);
    comment1.setComment(comment);
    comment1.save(new SaveListener<String>() {

        @Override
        public void done(String s, BmobException e) {
            if (e == null) {
                if (!myUser.getObjectId().equals(helps.getUser().getObjectId())) {
                    bmobpush(myUser, comment);
                }
                ToastUtil.show(HelpsCommentActivity.this, "评论成功", Toast.LENGTH_SHORT);
                isFirst = false;
                query();
                // Log.e(TAG, "====评论成功====");
            } else {
                ToastUtil.show(HelpsCommentActivity.this, "评论失败,请检查网络连接后重试", Toast.LENGTH_SHORT);
            }
        }
    });
}
 
Example #18
Source File: SkinEngine.java    From styT with Apache License 2.0 6 votes vote down vote up
/**
 * 保存反馈信息到服务器
 *
 * @param msg 反馈信息
 */
private void saveFeedbackMsg(String msg) {
    xp feedback = new xp();
    feedback.setContent(msg);
    feedback.save(new SaveListener<String>() {

        @Override
        public void done(String objectId, BmobException e) {
            if (e == null) {

            } else {

            }
        }
    });
}
 
Example #19
Source File: PublishActivity.java    From styT with Apache License 2.0 6 votes vote down vote up
private void savePulish(String content, PhontoFiles files) {
    MyUser user = BmobUser.getCurrentUser(MyUser.class);
    BILIBILI helps = new BILIBILI();
    helps.setUser(user);
    helps.setContent(content);
    helps.setState(0);
    helps.setLikeNum(1);
    helps.setPhontofile(files);
    helps.save(new SaveListener<String>() {
        @Override
        public void done(String objectId, BmobException e) {
            if (e == null) {
                finish();
                mProgressDialog.dismiss();
            } else {
                mProgressDialog.dismiss();
            }
        }
    });
}
 
Example #20
Source File: PublishActivity.java    From styT with Apache License 2.0 6 votes vote down vote up
private void saveText(String content) {
    MyUser user = BmobUser.getCurrentUser(MyUser.class);
    BILIBILI helps = new BILIBILI();
    helps.setUser(user);
    helps.setContent(content);
    helps.setState(0);
    helps.setLikeNum(1);
    helps.save(new SaveListener<String>() {
        @Override
        public void done(String objectId, BmobException e) {
            if (e == null) {
                finish();
                mProgressDialog.dismiss();
                //Log.i("bmob", "保存成功");
            } else {
                mProgressDialog.dismiss();
                //Log.i("bmob", "保存失败:" + e.getMessage());
            }
        }
    });
}
 
Example #21
Source File: LocalLoginDataSource.java    From ZfsoftCampusAssit with Apache License 2.0 6 votes vote down vote up
@Override
public void signIn(final User user, final GetLoginDataCallback callback) {
    user.login(context, new SaveListener() {
        @Override
        public void onSuccess() {
            Log.d(tag, user.getUsername() + " signIn successfully");
            callback.onGetLoginData(user);
        }

        @Override
        public void onFailure(int i, String s) {
            Log.e(tag, user.getUsername() + " signIn error " + s);
            callback.onGetLoginError(s);
        }
    });
}
 
Example #22
Source File: MeFeedbackAty.java    From myapplication with Apache License 2.0 5 votes vote down vote up
private void uploadFeedbackDatas(String feedbackStr) {
    AppUser appUser = BmobUser.getCurrentUser(AppUser.class);
    Feedback feedback = new Feedback();

    if (appUser != null) {
        feedback.setUserId(appUser.getObjectId());
        feedback.setFeebackUserName(appUser.getUsername());
        feedback.setFeedbackUserEmail(appUser.getEmail());
        feedback.setFeedbackContent(feedbackStr);
        feedback.save(new SaveListener<String>() {
            @Override
            public void done(String s, BmobException e) {
                if (e == null) {
                    Toast.makeText(MeFeedbackAty.this, "数据上传成功, 感谢你的建议!",
                            Toast.LENGTH_SHORT).show();
                    MeFeedbackAty.this.finish();
                } else {
                    Toast.makeText(MeFeedbackAty.this, "上传数据失败, 请稍后再试!",
                            Toast.LENGTH_SHORT).show();
                }
            }
        });
    } else {
        Toast.makeText(MeFeedbackAty.this, "上传数据失败, 请稍后再试!",
                Toast.LENGTH_SHORT).show();
    }
}
 
Example #23
Source File: AddressOptionPresenter.java    From BitkyShop with MIT License 5 votes vote down vote up
/**
 * 插入指定的Item
 *
 * @param createdAddress 待插入的Item
 */
public void insertUserAddress(final ReceiveAddress createdAddress) {
  createdAddress.save(new SaveListener<String>() {
    @Override public void done(String s, BmobException e) {
      if (e != null) {
        activity.showMessage(e.getMessage(), null);
        return;
      }
      KLog.d("insertUserAddress:" + s);
      activity.showMessage("新建收货地址成功", null);
      getCurrentUserAddress(createdAddress.getUserObjectId());
    }
  });
}
 
Example #24
Source File: RidingOtherIssueActivity.java    From Mobike with Apache License 2.0 5 votes vote down vote up
private void toQuery() {
    if (mCarnub.getText().toString()=="扫描二维码或者手动输入") {
        ToastUtils.show(RidingOtherIssueActivity.this, "请输入单车编号");
        return;
    }
    if (TextUtils.isEmpty(mEtReportUnlock.getText().toString())) {
        ToastUtils.show(RidingOtherIssueActivity.this, "请输入描述信息");
        return;
    }
    mDialog.show();
    mData.setMyUser(mMyUser);
    mData.setCarNub(mCarnub.getText().toString());
    mData.setDesc(mEtReportUnlock.getText().toString());
    mData.save(new SaveListener<String>() {
        @Override
        public void done(String s, BmobException e) {
            if (e == null) {
                ToastUtils.show(RidingOtherIssueActivity.this, "提交成功");
                finish();
            } else {
                ToastUtils.show(RidingOtherIssueActivity.this, "提交失败");
            }
            if (mDialog.isShowing())
                mDialog.dismiss();
        }
    });


}
 
Example #25
Source File: NotifyUtils.java    From Conquer with Apache License 2.0 5 votes vote down vote up
/**
 * 保存卡片到云
 * @param context
 * @param card
 */
private static void saveCard(Context context, Card card) {
	card.save(context, new SaveListener() {
		@Override
		public void onSuccess() {
			L.i("Card保存成功");
		}

		@Override
		public void onFailure(int arg0, String arg1) {
			L.i("Card保存失败" + arg0 + arg1);
		}
	});
}
 
Example #26
Source File: TestActivity.java    From Mobike with Apache License 2.0 5 votes vote down vote up
private void insert3() {
    RideSummary r = new RideSummary();
    r.setMyUser(mUser);
    r.setKaluli("123.5");
    r.setRide("123.5");
    r.setSave("345");
    r.save(new SaveListener<String>() {
        @Override
        public void done(String s, BmobException e) {
            Logger.d(s, e);
        }
    });
}
 
Example #27
Source File: CrashHandler.java    From SprintNBA with Apache License 2.0 5 votes vote down vote up
/**
 * 上传crash信息至服务器
 *
 * @param msg
 */
private void uploadCrashMessage(String msg) {
    AppCrashMessage message = new AppCrashMessage();
    message.setMessage(msg);
    message.save(new SaveListener<String>() {
        @Override
        public void done(String s, BmobException e) {
            if (e == null) {
                LogUtils.i("成功上传崩溃信息");
            } else {
                LogUtils.i("上传崩溃信息失败");
            }
        }
    });
}
 
Example #28
Source File: TestActivity.java    From Mobike with Apache License 2.0 5 votes vote down vote up
private void insert() {
    RideSummary r = new RideSummary();
    //  r.setPhone("182****2002");
    r.setKaluli("123.5");
    r.setRide("123.5");
    r.setSave("345");
    r.save(new SaveListener<String>() {
        @Override
        public void done(String s, BmobException e) {
            Logger.d(s, e);
        }
    });
}
 
Example #29
Source File: TestActivity.java    From Mobike with Apache License 2.0 5 votes vote down vote up
private void insertMessage2() {
    MyMessage r = new MyMessage();
    r.setClickUrl("https://prg.lp-game.com/cdnweb/sunplay050201/?uid=1909139792283648233927&from=singlemessage");
    r.setDecrdescription("一起和阳光玩游戏");
    r.setImgUrl("http://pic.qiantucdn.com/58pic/18/42/77/55825cab52849_1024.jpg");
    r.setTime("2017-05-09 00:00");
    r.save(new SaveListener<String>() {
        @Override
        public void done(String s, BmobException e) {
            Logger.d(s, e);
        }
    });
}
 
Example #30
Source File: TestActivity.java    From Mobike with Apache License 2.0 5 votes vote down vote up
private void insertMessage1() {
    MyMessage r = new MyMessage();
    r.setClickUrl("https://activity.huaruntong.cn/mobike0518/?uid=1909139792283648233927&from=singlemessage");
    r.setDecrdescription("骑客大赛,等你来战");
    r.setImgUrl("http://icon.qiantucdn.com/revision/images/resource.jpg");
    r.setTime("2017-05-30 00:00");
    r.save(new SaveListener<String>() {
        @Override
        public void done(String s, BmobException e) {
            Logger.d(s, e);
        }
    });
}