本文整理汇总了Java中cn.bmob.v3.listener.QueryListener类的典型用法代码示例。如果您正苦于以下问题:Java QueryListener类的具体用法?Java QueryListener怎么用?Java QueryListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
QueryListener类属于cn.bmob.v3.listener包,在下文中一共展示了QueryListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onResume
import cn.bmob.v3.listener.QueryListener; //导入依赖的package包/类
@Override
protected void onResume() {
super.onResume();
bmobQuery.getObject(mUser.getObjectId(), new QueryListener<User>() {
@Override
public void done(User user, BmobException e) {
if (e == null) {
String phoneNumber = (String) BmobUser.getObjectByKey("mobilePhoneNumber");
String email = (String) BmobUser.getObjectByKey("email");
if (phoneNumber != null) {
mPhoneNumberTextView.setText(phoneNumber);
}
if (email != null) {
mEmailTextView.setText(email);
}
}
}
});
}
示例2: userLoginByPhone
import cn.bmob.v3.listener.QueryListener; //导入依赖的package包/类
@Override public void userLoginByPhone(final String phone) {
if (!KyPattern.checkPhoneNumber(phone)) {
toastUtil.show("请输入正确的手机号码");
return;
}
final Intent intent = new Intent(this, RequestSMSCodeActivity.class);
intent.putExtra("phone", phone);
BmobSMS.requestSMSCode(phone, "生活服务超市模板", new QueryListener<Integer>() {
@Override public void done(Integer smsId, BmobException ex) {
if (ex != null) {
toastUtil.show("出现未知错误,请重启该应用");
KLog.d(ex.getErrorCode() + ":" + ex.getMessage());
return;
}
startActivityForResult(intent, KySet.USER_REQUEST_PHONE_SIGNUP_OR_LOGIN);
}
});
}
示例3: requestCode
import cn.bmob.v3.listener.QueryListener; //导入依赖的package包/类
public void requestCode() {
String number = _emailText.getText().toString();
if (!TextUtils.isEmpty(number)) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String sendTime = format.format(new Date());
BmobSMS.requestSMSCode(number, "注册模板", new QueryListener<Integer>() {
@Override
public void done(Integer smsId, BmobException ex) {
if (ex == null) {//验证码发送成功
toast("验证码发送成功,短信id:" + smsId);//用于查询本次短信发送详情
} else {
toast("errorCode = " + ex.getErrorCode() + ",errorMsg = " + ex.getLocalizedMessage());
}
}
});
} else {
toast("请输入手机号码");
}
}
示例4: requestCode
import cn.bmob.v3.listener.QueryListener; //导入依赖的package包/类
private void requestCode() {
phone = etPhone.getText().toString();
if (TextUtils.isEmpty(phone)) {
etPhone.setError("手机号码不能为空");
return;
}
if (!isPhoneNum(phone)) {
etPhone.setError("手机号码格式不正确");
return;
}
MyCounter counter = new MyCounter(60000, 1000);
counter.start();
BmobSMS.requestSMSCode(phone, "辰言", new QueryListener<Integer>() {
@Override
public void done(Integer integer, BmobException e) {
if (e == null) {
showToast("验证码发送成功!");
} else {
if (e.getErrorCode() == 10010) {
showToast("您请求验证码过去频繁,请于1小时候重试");
} else {
showToast("验证码发送失败" + e.getErrorCode() + e.getMessage());
}
}
}
});
}
示例5: queryPost
import cn.bmob.v3.listener.QueryListener; //导入依赖的package包/类
public void queryPost(String objectId, final RequestListener<Post> listener) {
if (!checkNet(listener)) return;
BmobQuery<Post> query = new BmobQuery<>();
query.getObject(objectId, new QueryListener<Post>() {
@Override
public void done(Post post, BmobException e) {
if (e == null) {
listener.success(post);
} else {
listener.error(ErrMsgFactory.errMSG(e.getErrorCode()));
}
}
});
}
示例6: onOptionsItemSelected
import cn.bmob.v3.listener.QueryListener; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
switch (id) {
case R.id.action_edit:
//判断是否为创建者
queryFamilyInfo = new BmobQuery<>();
queryFamilyInfo.include("familyCreator");
queryFamilyInfo.getObject(mCurrentUser.getFamily().getObjectId(), new QueryListener<Family>() {
@Override
public void done(Family family, BmobException e) {
if (e == null) {
String currentFamilyCreatorId = family.getFamilyCreator().getObjectId();
if (currentFamilyCreatorId.equals(mCurrentUser.getObjectId())) {
startActivity(new Intent(MyFamilyActivity.this, EditFamilyActivity.class));
} else {
ToastUtils.showToast(MyFamilyActivity.this, "抱歉,你不是创建者,无法进行编辑!");
}
}else {
ToastUtils.showToast(MyFamilyActivity.this, "isCreator :"+e.getMessage());
}
}
});
break;
}
return super.onOptionsItemSelected(item);
}
示例7: initData
import cn.bmob.v3.listener.QueryListener; //导入依赖的package包/类
@Override
public void initData() {
dialog.showDialog();
mCurrentUser = BmobUser.getCurrentUser(User.class);
familyQuery = new BmobQuery<>();
familyQuery.getObject(mCurrentUser.getFamily().getObjectId(), new QueryListener<Family>() {
@Override
public void done(Family family, BmobException e) {
if (e == null) {
familyName = family.getFamilyName();
if (!TextUtils.isEmpty(familyName)) {
mEdtFamilyName.setText(familyName);
BmobFile familyIconFile = family.getFamilyIcon();
if (familyIconFile!=null) {
Picasso.with(EditFamilyActivity.this).load(familyIconFile.getFileUrl()).into(mFamilyPhoto);
}else {
mFamilyPhoto.setImageResource(R.drawable.ic_default);
}
dialog.dismissDialog();
} else {
dialog.dismissDialog();
}
} else {
dialog.dismissDialog();
ToastUtils.showToast(EditFamilyActivity.this, "GetFamilyInfo : " + e.getMessage());
}
}
});
}
示例8: updateUI
import cn.bmob.v3.listener.QueryListener; //导入依赖的package包/类
private void updateUI() {
/*若是保存有数据,EditText就直接显示数据*/
mBmobQuery.getObject(mUser.getObjectId(), new QueryListener<User>() {
@Override
public void done(User user, BmobException e) {
if (e == null) {
String firstName = (String) BmobUser.getObjectByKey("mFirstContractName");
String firstPhone = (String) BmobUser.getObjectByKey("mFirstContractPhone");
String secondName = (String) BmobUser.getObjectByKey("mSecondContractName");
String secondPhone = (String) BmobUser.getObjectByKey("mSecondContractPhone");
String thirdName = (String) BmobUser.getObjectByKey("mThirdContractName");
String thirdPhone = (String) BmobUser.getObjectByKey("mThirdContractPhone");
if(null != firstName){
mFirstContractNameEditText.setText(firstName);
}
if(null != secondName){
mSecondContractNameEditText.setText(secondName);
}
if (null != thirdName){
mThirdContractNameEditText.setText(thirdName);
}
if (null != firstPhone){
mFirstContractPhoneEditText.setText(firstPhone);
}
if (null != secondPhone){
mSecondContractPhoneEditText.setText(secondPhone);
}
if (null != thirdPhone){
mThirdContractPhoneEditText.setText(thirdPhone);
}
}
}
});
}
示例9: onCreate
import cn.bmob.v3.listener.QueryListener; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_bind_on_account);
mUser = BmobUser.getCurrentUser(User.class);
bmobQuery = new BmobQuery<>();
mBindEmailEditText = (EditText) findViewById(R.id.bind_email_edit_text);
mBindPhoneEditText = (EditText) findViewById(R.id.bind_phone_edit_text);
mBindEmailCardView = (CardView) findViewById(R.id.bind_email_card_view);
mBindPhoneCardView = (CardView) findViewById(R.id.bind_phone_card_view);
mBindEmailButton = (Button) findViewById(R.id.bind_email_button);
mBindPhoneButton = (Button) findViewById(R.id.bind_phone_button);
mBindEmailCardView.setOnClickListener(this);
mBindPhoneCardView.setOnClickListener(this);
mBindEmailButton.setOnClickListener(this);
mBindPhoneButton.setOnClickListener(this);
bmobQuery.getObject(mUser.getObjectId(), new QueryListener<User>() {
@Override
public void done(User user, BmobException e) {
if (e == null) {
String phoneNumber = (String) BmobUser.getObjectByKey("mobilePhoneNumber");
String email = (String) BmobUser.getObjectByKey("email");
if (phoneNumber != null) {
mBindPhoneEditText.setText(phoneNumber);
}
if (email != null) {
mBindEmailEditText.setText(email);
}
}
}
});
}
示例10: getNearbyAddress
import cn.bmob.v3.listener.QueryListener; //导入依赖的package包/类
public static String getNearbyAddress(Nearby mNearby) {
final String[] address = new String[1];
BmobQuery<Nearby> query = new BmobQuery<>();
query.getObject(mNearby.getObjectId(), new QueryListener<Nearby>() {
@Override
public void done(Nearby nearby, BmobException e) {
if (null == e){
address[0] = nearby.getAddress();
}
}
});
return address[0];
}
示例11: initRecyclerOrderData
import cn.bmob.v3.listener.QueryListener; //导入依赖的package包/类
private void initRecyclerOrderData(List<CommodityOrder> commodityOrders) {
//用于从服务器请求得到的商品信息
commodities = new ArrayList<>();
//用于提交到服务器中的订单中的商品信息
commodityOrderSubmitList = new ArrayList<>();
for (final CommodityOrder commodityOrder : commodityOrders) {
BmobQuery<Commodity> bmobQuery = new BmobQuery<>();
bmobQuery.getObject(commodityOrder.getObjectId(), new QueryListener<Commodity>() {
@Override public void done(Commodity commodity, BmobException e) {
if (e != null) {
KLog.d("有异常:" + e.getMessage());
return;
}
if (commodity.getCount() <= 0 && currentStatus == KySet.CART_REQUEST_SUBMIT_ORDER) {
return;
}
KLog.d("读取成功,objectId:" + commodity.getObjectId() + "," + commodity.getName());
commodity.setCount(commodityOrder.getCount());
commodities.add(commodity);
commodityOrderSubmitList.add(commodityOrder);
recyclerAdapter.reloadData(commodities);
countTotalPrices();
}
});
}
}
示例12: processClick
import cn.bmob.v3.listener.QueryListener; //导入依赖的package包/类
@Override
public void processClick(View v) {
switch (v.getId()) {
case R.id.btn_getSmsCode:
telNumString = mEdtNum.getText().toString();
isTel = verifyTel(telNumString);
if (!TextUtils.isEmpty(telNumString) && isTel) {
loadSMS();
BmobSMS.requestSMSCode(telNumString, BmobConfig.SMSTEMPLATE, new QueryListener<Integer>() {
@Override
public void done(Integer smsCode, BmobException e) {
if (e == null) {
ToastUtils.showToast(RegisterOrResetActivity.this, "验证码发送完毕");
} else {
ToastUtils.showToast(RegisterOrResetActivity.this, "验证码发送失败:"+e.getMessage());
}
}
});
} else {
ToastUtils.showToast(this, "请正确输入手机号");
}
break;
case R.id.btn:
telNumString = mEdtNum.getText().toString();
smsCodeString = mEdtSmsCode.getText().toString();
passwordString = mEdtPassword.getText().toString();
rePassWordString = mEdtRePassword.getText().toString();
isTel = verifyTel(telNumString); //判断是否为正确的手机号
isTruePassword = verifyTwoPassword(passwordString, rePassWordString);//进行两次输入的密码校验
if (sign == 0) {
registerUser();
} else if (sign == 1) {
resetPassword();
}
break;
}
}
示例13: initUserInfo
import cn.bmob.v3.listener.QueryListener; //导入依赖的package包/类
private void initUserInfo(final String objectId) {
query = new BmobQuery<>();
query.include("family");
query.getObject(objectId, new QueryListener<User>() {
@Override
public void done(User user, BmobException e) {
if (e == null) {
dialog.dismissDialog();
BmobFile userPhotoFile = user.getUserPhoto();
String nickString = user.getNick();
int ageInt = user.getAge();
String phoneString = user.getMobilePhoneNumber();
String familyNameString = user.getFamily().getFamilyName();
int typeInt = user.getType();
if (userPhotoFile != null) {
Picasso.with(UserInfoActivity.this).load(userPhotoFile.getFileUrl()).into(mCivUserPhoto);
} else {
mCivUserPhoto.setImageResource(R.drawable.ic_default);
}
if (!TextUtils.isEmpty(nickString)) {
mTvNick.setText("昵 称:" + nickString);
}
if (ageInt <= 0) {
mTvAge.setText("年 龄:" + "请更新个人信息");
} else {
mTvAge.setText("年 龄:" + ageInt);
}
if (!TextUtils.isEmpty(phoneString)) {
mTvPhone.setText("手机号码:" + phoneString);
} else {
mTvPhone.setText("手机号码:" + "null");
}
if (!TextUtils.isEmpty(familyNameString)) {
mTvFamily.setText("家庭信息:" + familyNameString);
} else {
mTvFamily.setText("家庭信息:暂未加入家庭");
}
if (typeInt == 0) {
mTvType.setText("关 系: 子女");
} else if (typeInt == 1) {
mTvType.setText("关 系: 父母");
}
} else {
dialog.dismissDialog();
ToastUtils.showToast(UserInfoActivity.this, "" + e.getMessage());
}
}
});
}
示例14: getServerTime
import cn.bmob.v3.listener.QueryListener; //导入依赖的package包/类
/**
* 获取服务器时间
*/
public static void getServerTime(QueryListener<Long> queryListener){
Bmob.getServerTime(queryListener);
}
示例15: updateUI
import cn.bmob.v3.listener.QueryListener; //导入依赖的package包/类
private void updateUI() {
mSwipeRefreshLayout.setRefreshing(true);
/*若是保存有数据,EditText就直接显示数据*/
bmobQuery.getObject(mUser.getObjectId(), new QueryListener<User>() {
@Override
public void done(User user, BmobException e) {
if (e == null) {
String name = (String) BmobUser.getObjectByKey("name");
Integer age = (Integer) BmobUser.getObjectByKey("age");
String address = (String) BmobUser.getObjectByKey("address");
String phoneNumber = (String) BmobUser.getObjectByKey("mobilePhoneNumber");
String email = (String) BmobUser.getObjectByKey("email");
String gender = (String) BmobUser.getObjectByKey("gender");
if (name != null) {
mUsernameEditText.setText(name);
}
if (age != null) {
mAgeEditText.setText(String.valueOf(age));
}
if (address != null) {
mAddressTextView.setText(address);
}
if (phoneNumber != null){
mPhoneNumberTextView.setText(phoneNumber);
}
if (email != null){
mEmailTextView.setText(email);
}
if (gender != null){
if (gender.equals("男")){
mMaleGenderRadioButton.setChecked(true);
mFemaleGenderRadioButton.setChecked(false);
}else{
mFemaleGenderRadioButton.setChecked(true);
mMaleGenderRadioButton.setChecked(false);
}
}
}
}
});
mSwipeRefreshLayout.setRefreshing(false);
}