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(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_contact); faceView = (UploadImgView) findViewById(R.id.faceImg); faceView.parentActivity = this; faceView.faceImgFileName = "" + System.currentTimeMillis() + ".jpg"; faceView.uploadListener = this; ActivityHelper.initHeadInf(this); }
public void submit(View v) { if (inputCurPwd.getText() == null && "".equals(inputCurPwd.getText().toString())) { Toast.makeText(this, "请输入当前密码", Toast.LENGTH_SHORT).show(); } else if (inputNewPwd.getText() == null && "".equals(inputNewPwd.getText().toString())) { Toast.makeText(this, "请输入新密码", Toast.LENGTH_SHORT).show(); } else if (!inputNewPwd.getText().toString().equals(inputRepPwd.getText().toString())) { Toast.makeText(this, "密码不一致", Toast.LENGTH_SHORT).show(); } else { laodView.setVisibility(View.VISIBLE); cpwdClient.callWs( ActivityHelper.getMyAccount(this).optString("account"), inputCurPwd.getText().toString(), inputNewPwd.getText().toString()); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_change_pwd); inputCurPwd = (EditText) findViewById(R.id.inputCurPwd); inputNewPwd = (EditText) findViewById(R.id.inputNewPwd); inputRepPwd = (EditText) findViewById(R.id.inputConfirmPwd); swShowPwd = (SwitchView) findViewById(R.id.switchShowPwd); laodView = findViewById(R.id.loadingLayoutInclude); cpwdClient = WebServiceHelper.createChangePwdClient( this, new WsCallBack() { @Override public void whenResponse(JSONObject json, Object... position) { Toast.makeText(ChangePwdActivity.this, "修改成功", Toast.LENGTH_SHORT).show(); finish(); } @Override public void whenError() { laodView.setVisibility(View.GONE); } @Override public void whenFail(JSONObject json) { laodView.setVisibility(View.GONE); } }); swShowPwd.setOnStateChangedListener( new SwitchView.OnStateChangedListenersss() { @Override public void onChanged(boolean switchOn) { int type = switchOn ? InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD : InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD; inputCurPwd.setInputType(type); inputNewPwd.setInputType(type); inputRepPwd.setInputType(type); } }); ActivityHelper.initHeadInf(this); }