예제 #1
0
 public void saveContactInfo(View view) {
   Contact c = new Contact();
   c.faceImgPath = faceView.faceImgFileName;
   CharSequence nickName = ((TextView) findViewById(R.id.userNickName)).getText();
   CharSequence account = ((TextView) findViewById(R.id.userAccount)).getText();
   if (faceView.getTag() == null || !faceView.getTag().equals("ok")) {
     //            tip(".请上传头像");
     ImageLoaderUtil.saveBitmapToFile(
         this,
         faceView.faceImgFileName,
         BitmapFactory.decodeResource(getResources(), R.drawable.default_head));
     faceView.setTag("ok");
   }
   if (nickName == null || nickName.toString().trim().length() < 1) {
     tip("昵称不能为空");
     return;
   }
   if (account == null || account.toString().trim().length() < 1) {
     tip("账号不能为空");
     return;
   }
   ContactsDbManager manager = ContactsDbManager.getInstance(this);
   if (manager.existAccount(account.toString())) {
     tip("账号已存在");
     return;
   }
   c.nickName = nickName.toString();
   c.account = account.toString();
   manager.add(c);
   ActivityHelper.contactChanged();
   tip("添加联系人成功");
   finish();
 }
예제 #2
0
 @Override
 public void onLoadFinish(Bitmap img) {
   ImageLoaderUtil.saveBitmapToFile(this, faceView.faceImgFileName, img);
   faceView.setTag("ok");
 }