Esempio n. 1
0
 public void saveData(AVUser mAvUser) {
   mAvUser.put("selectSubjectName", selectSubjectName);
   mAvUser.put("selectSubjectId", selectSubjectId);
   mAvUser.saveInBackground(
       new SaveCallback() {
         @Override
         public void done(AVException arg0) {
           // TODO Auto-generated method stub
           if (arg0 == null) {
             ShareTools.getInstance()
                 .saveInitMemory(LoginInitMemory.this, selectSubjectId, selectSubjectName);
             Intent intent = new Intent();
             intent.setClass(LoginInitMemory.this, MainHomeActivity.class);
             Bundle mBundle = new Bundle();
             mBundle.putString("subject_id", selectSubjectId);
             mBundle.putString("subject_name", selectSubjectName);
             intent.putExtras(mBundle);
             startActivity(intent);
             overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_right);
             LoginInitMemory.this.finish();
           } else {
             Toast.makeText(
                     LoginInitMemory.this, "初始化失败,请重试" + arg0.getMessage(), Toast.LENGTH_SHORT)
                 .show();
           }
         }
       });
 }
Esempio n. 2
0
 private void saveToCloud() {
   try {
     JSONArray array = new JSONArray();
     for (WrapGroup group : groups) {
       JSONObject object = new JSONObject();
       object.put("groupid", group.getGroupid());
       object.put("title", group.getGroup().getTitle());
       object.put("imageurl", group.getGroup().getImageurl());
       object.put("url", group.getGroup().getUrl());
       array.put(object);
     }
     AVUser user = AVUser.getCurrentUser();
     user.put("groups", array);
     user.saveInBackground(
         new SaveCallback() {
           @Override
           public void done(AVException e) {
             if (e == null) {
               showSnackBar("云端同步完成");
             }
           }
         });
   } catch (JSONException e) {
     e.printStackTrace();
     KLog.e(e);
   }
 }
Esempio n. 3
0
  public static void saveAvatar(String path) throws IOException, AVException {
    AVUser user = AVUser.getCurrentUser();
    final AVFile file = AVFile.withAbsoluteLocalPath(user.getUsername(), path);
    file.save();
    user.put(User.AVATAR, file);

    user.save();
    user.fetch();
  }
Esempio n. 4
0
 public static void updateUserInfo() {
   AVUser user = AVUser.getCurrentUser();
   if (user != null) {
     AVInstallation installation = AVInstallation.getCurrentInstallation();
     if (installation != null) {
       user.put(User.INSTALLATION, installation);
       user.saveInBackground();
     }
   }
 }