当前位置: 首页>>代码示例>>Java>>正文


Java SaveCallback类代码示例

本文整理汇总了Java中com.avos.avoscloud.SaveCallback的典型用法代码示例。如果您正苦于以下问题:Java SaveCallback类的具体用法?Java SaveCallback怎么用?Java SaveCallback使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SaveCallback类属于com.avos.avoscloud包,在下文中一共展示了SaveCallback类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: markAddRequestsRead

import com.avos.avoscloud.SaveCallback; //导入依赖的package包/类
/**
 * 标记消息为已读,标记完后会刷新未读消息数量
 */
public void markAddRequestsRead(List<AddRequest> addRequestList) {
    if (addRequestList != null) {
        for (AddRequest request : addRequestList) {
            request.put(AddRequest.IS_READ, true);
        }
        AVObject.saveAllInBackground(addRequestList, new SaveCallback() {
            @Override
            public void done(AVException e) {
                if (e == null) {
                    countUnreadRequests(null);
                }
            }
        });
    }
}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:19,代码来源:FriendsManager.java

示例2: agreeAddRequest

import com.avos.avoscloud.SaveCallback; //导入依赖的package包/类
public void agreeAddRequest(final AddRequest addRequest, final SaveCallback saveCallback) {
    addFriend(addRequest.getFromUser().getObjectId(), new SaveCallback() {
        @Override
        public void done(AVException e) {
            if (e != null) {
                if (e.getCode() == AVException.DUPLICATE_VALUE) {
                    addRequest.setStatus(AddRequest.STATUS_DONE);
                    addRequest.saveInBackground(saveCallback);
                } else {
                    saveCallback.done(e);
                }
            } else {
                addRequest.setStatus(AddRequest.STATUS_DONE);
                addRequest.saveInBackground(saveCallback);
            }
        }
    });
}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:19,代码来源:FriendsManager.java

示例3: updateUserInfo

import com.avos.avoscloud.SaveCallback; //导入依赖的package包/类
/**
 * 上传用户信息,首先上传头像,上传成功后赶回头像地址,然后上传其他信息
 */


private void updateUserInfo(Bitmap avatar) {

    //如果头像为空,也就是用户没有上传头像,则使用之前的头像地址
    if (avatar == null) {

    } else {
        final AVFile avatarFile = new AVFile("user_avatar.jpeg", ImageUtil.bitmap2Bytes(avatar));
        avatarFile.saveInBackground(new SaveCallback() {
            @Override
            public void done(AVException e) {
                if (e == null) {

                    Log.i("lin", "----lin---->  imgUrl" + avatarFile.getUrl());
                    _cardView = avatarFile.getUrl();

                }
            }
        });
    }
}
 
开发者ID:linsir6,项目名称:TripBuyer,代码行数:26,代码来源:AuthenticationActivity.java

示例4: updateUserInfo

import com.avos.avoscloud.SaveCallback; //导入依赖的package包/类
/**
 * 上传用户信息,首先上传头像,上传成功后赶回头像地址,然后上传其他信息
 */


private void updateUserInfo(Bitmap avatar) {

    //如果头像为空,也就是用户没有上传头像,则使用之前的头像地址
    if (avatar == null) {

    } else {
        final AVFile avatarFile = new AVFile("user_avatar.jpeg", ImageUtil.bitmap2Bytes(avatar));
        avatarFile.saveInBackground(new SaveCallback() {
            @Override
            public void done(AVException e) {
                if (e == null) {

                    Log.i("lin", "----lin---->  imgUrl" + avatarFile.getUrl());
                    imageUrl = avatarFile.getUrl();

                }
            }
        });
    }
}
 
开发者ID:linsir6,项目名称:TripBuyer,代码行数:26,代码来源:UploadAirTicketActivity.java

示例5: initAVSDK

import com.avos.avoscloud.SaveCallback; //导入依赖的package包/类
private void initAVSDK(Context context) {
    Map map = this.getAppInfo();
    if(map != null && map.get("appId") != null && map.get("appKey") != null) {
        // 初始化应用信息
        String appId = map.get("appId").toString();
        String appKey = map.get("appKey").toString();
        AVOSCloud.initialize(context, appId, appKey);
        // 启用崩溃错误统计
        AVAnalytics.enableCrashReport(context.getApplicationContext(), true);
        AVOSCloud.setLastModifyEnabled(true);
        AVOSCloud.setDebugLogEnabled(true);

        //必须要设置默认的通知回调或者订阅一个频道,否则接收不到通知
        mRNPushNotificationHelper = new RNPushNotificationHelper(this.mApplication);
        PushService.setDefaultPushCallback(context.getApplicationContext(), mRNPushNotificationHelper.getMainActivityClass());
        //this.subscribeChannel("public");

        // 保存 installation 到服务器
        AVInstallation.getCurrentInstallation().saveInBackground(new SaveCallback() {
            public void done(AVException e) {
                String installationId = AVInstallation.getCurrentInstallation().getInstallationId();
                sendRegistrationToken(installationId);
            }
        });
    }
}
 
开发者ID:zzzkk2009,项目名称:react-native-leancloud-sdk,代码行数:27,代码来源:AvOsCloudPackage.java

示例6: onClick

import com.avos.avoscloud.SaveCallback; //导入依赖的package包/类
@Override
public void onClick(View arg0) {
	// TODO Auto-generated method stub
    SaveCallback saveCallback=new SaveCallback() {
      @Override
      public void done(AVException e) {
        if (e == null) {
          mHandler.obtainMessage(1).sendToTarget();
        } else {
          mHandler.obtainMessage(2).sendToTarget();
        }
      }
    };
    String advice = submitEditText.getText().toString();
    AVService.createAdvice(getUserId(), advice, saveCallback);
}
 
开发者ID:yoxin,项目名称:pet,代码行数:17,代码来源:AboutAppActivity.java

示例7: onCreate

import com.avos.avoscloud.SaveCallback; //导入依赖的package包/类
@Override
    public void onCreate() {
        super.onCreate();
//        AVOSCloud.useAVCloudUS();//
        CrashReport.initCrashReport(getApplicationContext(), "900020615", false);
//        CrashReport.testJavaCrash();
        AVOSCloud.initialize(this, "6vNrCi5ou4rw5sb0fx8b0J4w-gzGzoHsz", "zfuBYXx8X235VVi6O7acOM8G");
        AVInstallation.getCurrentInstallation().saveInBackground(new SaveCallback() {
            public void done(AVException e) {
                if (e == null) {
                    // 保存成功
                    String installationId = AVInstallation.getCurrentInstallation().getInstallationId();
                    // 关联  installationId 到用户表等操作……
                } else {
                    // 保存失败,输出错误信息
                }
            }
        });
        PushService.setDefaultPushCallback(this, UpdateActivity.class);
    }
 
开发者ID:JianxunRao,项目名称:FangYanShuo,代码行数:21,代码来源:MyApplication.java

示例8: addFriend

import com.avos.avoscloud.SaveCallback; //导入依赖的package包/类
private void addFriend(String friendId) {
//        String friendId = avObject.getObjectId();

        AVObject object = new AVObject(Constants.TABLE_NAME_FRIEND);
        object.put(Constants.KEY_FRIEND_ID, friendId);
        object.put(Constants.KEY_USER_ID, userId);
        object.saveInBackground(new SaveCallback() {
            @Override
            public void done(AVException e) {
                if (e == null) {
                    Log.d(TAG, "save success!");
                    ToastUtil.showToastShort(FriendActivity.this, "add friend success!");
                    closeAddDialog();
                    // refresh list
                    queryFriends();
                }
            }
        });
    }
 
开发者ID:quekx,项目名称:MyShare,代码行数:20,代码来源:FriendActivity.java

示例9: doSignUp

import com.avos.avoscloud.SaveCallback; //导入依赖的package包/类
private void doSignUp(String username, String password, String nickname) {
    AVObject userObject = new AVObject(Constants.TABLE_NAME_USER);
    userObject.put(Constants.KEY_USERNAME, username);
    userObject.put(Constants.KEY_PASSWORD, password);
    userObject.put(Constants.KEY_NICKNAME, nickname);
    userObject.saveInBackground(new SaveCallback() {
        @Override
        public void done(AVException e) {
            if (e == null) {
                onSignUpSuccess();
            } else {
                ToastUtil.showToastShort(SignUpActivity.this, "sign up failed!");
                onSignUpFailed();
            }
            btnSignUp.setEnabled(true);
        }
    });
}
 
开发者ID:quekx,项目名称:MyShare,代码行数:19,代码来源:SignUpActivity.java

示例10: createOrUpdateShot

import com.avos.avoscloud.SaveCallback; //导入依赖的package包/类
public static void createOrUpdateShot(final String title,final String  githubUrl,final String  description, final String image_uri, final SaveCallback saveCallback) {


        String name = System.currentTimeMillis()+"";
        if (image_uri != null) {
            Uri uri=Uri.parse(image_uri);
            byte[] data = ImageUtils.readFile(mContext,uri);
            final AVFile file = new AVFile(name, data);
            file.saveInBackground(new SaveCallback() {
                @Override
                public void done(AVException e) {
                    if (e != null) {
                        Log.d("wds",e.toString());
                        saveCallback.done(e);
                    } else {
                        String image_url = file.getUrl();
                        saveShot(title,githubUrl,description, image_url, saveCallback);
                    }
                }
            });
        } else {
            saveShot(title,githubUrl,description, "", saveCallback);
        }
    }
 
开发者ID:OldDriver007,项目名称:OldDriver-master,代码行数:25,代码来源:AVService.java

示例11: saveShot

import com.avos.avoscloud.SaveCallback; //导入依赖的package包/类
public static void saveShot(final String title,final String githubUrl,final String description,final String image_url, final SaveCallback saveCallback) {
        final Shot shot = new Shot();
        String avatar=AVUser.getCurrentUser().getString(UserDAO.AVATAR_URL);
        String username=AVUser.getCurrentUser().getUsername();
        String userId=AVUser.getCurrentUser().getObjectId();
        shot.setUserID(userId);
        shot.setUserAvatar(avatar);
        shot.setUserName(username);
        shot.setTitle(title);
        shot.setGitHubUrl(githubUrl);
        shot.setDescription(description);
        shot.setImageURL(image_url);
//        Map<String, Object> datas = new HashMap<String, Object>();
//        datas.put(App.DETAIL_ID, shot.getObjectId());
//        shot.setData(datas);
        // 异步保存
        shot.saveInBackground(saveCallback);
       // AVStatus.sendStatusToFollowersInBackgroud(shot, saveCallback);

    }
 
开发者ID:OldDriver007,项目名称:OldDriver-master,代码行数:21,代码来源:AVService.java

示例12: join

import com.avos.avoscloud.SaveCallback; //导入依赖的package包/类
@Click(R.id.id_btn_join)
void join() {


    AVUser user = AVUser.getCurrentUser();
    final AVObject object = new AVObject("user_join");
    object.put("user", user);
    object.put("idea", mIdea);
    object.saveInBackground(new SaveCallback() {
        @Override
        public void done(AVException e) {
            if (e == null) {
                showToast("保存成功");
                mIdea.increment("joinNum");
                mIdea.saveInBackground();
            }
        }
    });
}
 
开发者ID:AndroidCreativeDesign,项目名称:AndroidSharingPlatform,代码行数:20,代码来源:IdeaDetailActivity.java

示例13: agreeAddRequest

import com.avos.avoscloud.SaveCallback; //导入依赖的package包/类
public static void agreeAddRequest(final AddRequest addRequest, final SaveCallback saveCallback) {
	UserService.addFriend(addRequest.getFromUser().getObjectId(), new SaveCallback() {
		@Override
		public void done(AVException e) {
			if (e != null) {
				if (e.getCode() == AVException.DUPLICATE_VALUE) {
					addRequest.setStatus(AddRequest.STATUS_DONE);
					addRequest.saveInBackground(saveCallback);
				} else {
					saveCallback.done(e);
				}
			} else {
				addRequest.setStatus(AddRequest.STATUS_DONE);
				addRequest.saveInBackground(saveCallback);
			}
		}
	});
}
 
开发者ID:lanixzcj,项目名称:LoveTalkClient,代码行数:19,代码来源:AddRequestService.java

示例14: updateUserLocation

import com.avos.avoscloud.SaveCallback; //导入依赖的package包/类
public static void updateUserLocation() {
	PreferenceMap preferenceMap = PreferenceMap.getCurUserPrefDao(DemoApplication.context);
	AVGeoPoint lastLocation = preferenceMap.getLocation();
	if (lastLocation != null) {
		final AVUser user = AVUser.getCurrentUser();
		final AVGeoPoint location = user.getAVGeoPoint("location");
		if (location == null || !Utils.doubleEqual(location.getLatitude(), lastLocation.getLatitude())
				|| !Utils.doubleEqual(location.getLongitude(), lastLocation.getLongitude())) {
			user.put("location", lastLocation);
			user.saveInBackground(new SaveCallback() {
				@Override
				public void done(AVException e) {
					if (e != null) {
						e.printStackTrace();
					} else {
						Log.v("lan", "lastLocation save " + user.getAVGeoPoint("location"));
					}
				}
			});
		}
	}
}
 
开发者ID:lanixzcj,项目名称:LoveTalkClient,代码行数:23,代码来源:ChatUtils.java

示例15: addFriend

import com.avos.avoscloud.SaveCallback; //导入依赖的package包/类
public static void addFriend(String friendId, final SaveCallback saveCallback) {
    AVUser user = HiTalkHelper.getInstance().getCurrentUser();
    user.followInBackground(friendId, new FollowCallback() {
        @Override
        public void done(AVObject object, AVException e) {
            if (saveCallback != null) {
                saveCallback.done(e);
            }
        }
    });
}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:12,代码来源:FriendsManager.java


注:本文中的com.avos.avoscloud.SaveCallback类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。