Example #1
0
 /** 登录联网操作 */
 private void beginLogin() {
   // showDialog(DIALOG_PROGRESS);
   EditText password_edit = (EditText) findViewById(R.id.password_edit);
   Editable password = password_edit.getText();
   final String password_string = String.valueOf(password);
   if (remPwd_checkBox.isChecked()) shellRW.putStringValue("password", password_string);
   // 判断手机号长度是否正确
   EditText phone_name_Text = (EditText) findViewById(R.id.phoneNum_edit);
   Editable editText = phone_name_Text.getText();
   // fqc edit 7/3/2010 判断密码长度 必须在6~16之间
   EditText password_text = (EditText) findViewById(R.id.password_edit);
   int passwordLength = password_text.getText().toString().length();
   if (editText.toString().equals("")) {
     Toast.makeText(this, "用户名不能为空!", Toast.LENGTH_LONG).show();
   } else if (passwordLength < 6 || passwordLength > 16) {
     password_edit.startAnimation(shake);
     Toast.makeText(this, "密码必须为6~16位!", Toast.LENGTH_LONG).show();
   } else { //
     //			if(auto_login_checkBox.isChecked()){
     //				isAutoLogin = "******";
     //			}else{
     //				isAutoLogin = "******";
     //			}
     regToLogin(String.valueOf(phoneNum_edit.getText()), password_string, isAutoLogin);
   }
 }
  /**
   * 开始震动
   *
   * @param editTexts
   */
  public void shake(EditText... editTexts) {
    for (EditText editText : editTexts) {
      editText.startAnimation(shakeAnimation);
    }

    shakeVibrator.vibrate(new long[] {0, 500}, -1);
  }
Example #3
0
 @Override
 public void onClick(View v) {
   // TODO Auto-generated method stub
   Animation animation = new TranslateAnimation(0, 0, 0, -120);
   animation.setDuration(1000);
   animation.setFillAfter(true);
   buttonTest.startAnimation(animation);
   Animation imgview = new AlphaAnimation(0, 1);
   imgview.setDuration(2000);
   email.setVisibility(View.VISIBLE);
   email.startAnimation(imgview);
   pass.setVisibility(View.VISIBLE);
   pass.startAnimation(imgview);
   btn.setVisibility(View.VISIBLE);
   btn.startAnimation(imgview);
   buttonTest.setEnabled(false);
 }
Example #4
0
 public void handleMessage(Message msg) {
   switch (msg.what) {
     case 1:
       progressDialog.dismiss();
       Toast.makeText(getBaseContext(), message, Toast.LENGTH_LONG).show();
       regToLogin(phonenum, password, "0", packageName);
       break;
     case 2:
       progressDialog.dismiss();
       Toast.makeText(getBaseContext(), message, Toast.LENGTH_LONG).show();
       break;
     case 3:
       progressDialog.dismiss();
       Toast.makeText(getBaseContext(), message, Toast.LENGTH_LONG).show();
       break;
     case 4:
       Toast.makeText(getBaseContext(), message, Toast.LENGTH_LONG).show();
       break;
     case 5:
       progressDialog.dismiss();
       Toast.makeText(getBaseContext(), message, Toast.LENGTH_LONG).show();
       break;
     case 6:
       progressDialog.dismiss();
       Toast.makeText(getBaseContext(), message, Toast.LENGTH_LONG).show();
       break;
     case 7:
       progressDialog.dismiss();
       password_edit.startAnimation(shake);
       Toast.makeText(getBaseContext(), message, Toast.LENGTH_LONG).show();
       break;
     case 8:
       progressDialog.dismiss();
       Toast.makeText(getBaseContext(), "网络异常!", Toast.LENGTH_LONG).show();
       break;
     case 9:
       progressDialog.dismiss();
       Toast.makeText(getBaseContext(), message, Toast.LENGTH_LONG).show();
       break;
     case 10:
       progressDialog.dismiss();
       MobclickAgent.onEvent(UserLogin.this, "dengluchenggong"); // BY贺思明
       // 登陆成功
       Toast.makeText(getBaseContext(), message, Toast.LENGTH_LONG).show();
       if (b == true) {
         Intent intent = new Intent(SUCCESS);
         sendBroadcast(intent);
         PublicConst.islogin = true;
         UserLogin.this.setResult(RESULT_OK);
         UserLogin.this.finish();
       }
       break;
     case 20: // 微博获取昵称后登陆
       progressDialog.dismiss();
       sinaweibologin();
       break;
   }
 }
 private boolean isTopicValid() {
   if (title == null || body == null) {
     return false;
   }
   Animation animation = AnimationUtils.loadAnimation(this, R.anim.shake);
   if (TextUtils.isEmpty(title.getText().toString())) {
     title.startAnimation(animation);
     return false;
   }
   if (TextUtils.isEmpty(body.getText().toString())) {
     body.startAnimation(animation);
     return false;
   }
   if ((Node) nodeSelector.getSelectedItem() == null) {
     nodeSelector.startAnimation(animation);
     return false;
   }
   return true;
 }
 public void queryAddress(View v) {
   // 1. 得到输入的号码
   String number = et_address_number.getText().toString();
   if (number.trim().equals("")) { // 如果没有输入就抖动
     // 显示抖动动画
     Animation animation = AnimationUtils.loadAnimation(this, R.anim.shake);
     et_address_number.startAnimation(animation);
   } else {
     // 2. 查询数据库得到对应的归属地
     String address = new AddressDao(this).getAddress(number);
     // 3. 显示归属地
     tv_address_result.setText(address);
   }
 }
  @Override
  public void onBadInput(final EditText field) {
    Animation shake = AnimationUtils.loadAnimation(context, R.anim.shake);
    field.startAnimation(shake);
    field.setTextColor(Color.RED);

    final Handler handler = new Handler();
    handler.postDelayed(
        new Runnable() {
          @Override
          public void run() {
            field.setTextColor(textColor);
          }
        },
        1000);
  }
 /**
  * 点击“查询”时执行的监听方法
  *
  * @param view
  */
 public void query(View view) {
   // 查询前,需要将号码前后的空格清空掉
   String number = et_number_query.getText().toString().trim();
   // 判断要查询的号码是否为空
   if (TextUtils.isEmpty(number)) {
     Toast.makeText(this, "号码不能为空", 1).show();
     // 使用动画工具来加载一个动画资源一个动画资源
     Animation shake = AnimationUtils.loadAnimation(this, R.anim.shake);
     // 当号码输入框中没有输入号码而点击“查询”时播放一个动画,用来提示用户输入号码后才可以执行查询操作。
     et_number_query.startAnimation(shake);
     return;
   } else { // 号码不为空时要返回归属地信息
     // 返回查询到的归属地信息
     String address = NumberAddressDao.getAddress(number);
     // 将归属地信息显示在屏幕上
     tv_number_address.setText(address);
   }
 }
Example #9
0
 public void query(View view) {
   String number = etQuery.getText().toString().trim();
   if (!TextUtils.isEmpty(number)) {
     String address = AddressDao.getAddress(number);
     tvResult.setText(address);
   } else {
     Animation shake = AnimationUtils.loadAnimation(this, R.anim.shake);
     /* shake.setInterpolator(new Interpolator() {  //也可以添加自定义的插补器
         @Override
         public float getInterpolation(float input) {
             float output = 0;
             output = (float) Math.sin(2*Math.PI*input);
             return output;
         }
     });*/
     etQuery.startAnimation(shake);
     vibrate();
   }
 }
  protected void doQuery() {

    String number = mEtNum.getText().toString().trim();

    // 非空校验
    if (TextUtils.isEmpty(number)) {
      Toast.makeText(this, "号码不能为空", Toast.LENGTH_SHORT).show();
      Animation shake = AnimationUtils.loadAnimation(NumberAddressQueryActivity.this, R.anim.shake);
      mEtNum.startAnimation(shake);
      return;
    }

    String address = AddressDao.findAddress(this, number);

    if (address == null) {
      Toast.makeText(this, "未知", Toast.LENGTH_SHORT).show();
      return;
    } else {
      mTvAddress.setText("归属地:" + address);
    }
  }
 @Override
 public void onClick(View v) {
   // TODO Auto-generated method stub
   switch (v.getId()) {
     case R.id.back:
       finish();
       break;
     case R.id.search_btn:
       Animation shake = AnimationUtils.loadAnimation(SearchGroupActivity.this, R.anim.shake);
       String search_str = edit_input.getEditableText().toString();
       if (TextUtils.isEmpty(search_str)) {
         edit_input.setText("");
         edit_input.startAnimation(shake);
         UIUtilities.showToast(this, "搜索内容不能为空");
         return;
       }
       Intent i = new Intent(this, SearchGroupResultActivity.class);
       i.putExtra("keyword", search_str);
       startActivity(i);
       break;
   }
 }
Example #12
0
	@Override
	public void onClick(View v) {
//		userPhone = userPhoneEt.getText().toString();
		password = passwordEt.getText().toString();
		String password2 = password2Et.getText().toString();
		verifyCode = codeEt.getText().toString();
		
		Animation shake = AnimationUtils.loadAnimation(this, R.anim.shake);
		
		if(userPhone.equals("")) {
			userPhoneEt.startAnimation(shake);
			ToastHelper.showToastInBottom(this, R.string.username_empty_toast);
			return;
		}
		
		if(!isMobileNO(userPhone)) {
			ToastHelper.showToastInBottom(this, R.string.username_error);
			userPhoneEt.startAnimation(shake);
			return;
		}
		
		if(password.equals("")) {
			ToastHelper.showToastInBottom(this, R.string.password_empty_toast);
			passwordEt.startAnimation(shake);
			return;
		}
		
		if(password.length() < passwordMinLenth) {
			String toast = getResources().getString(R.string.password_no_length);
			ToastHelper.showToastInBottom(this, String.format(toast, passwordMinLenth));
			passwordEt.startAnimation(shake);
			return;
		}
		
		if(password2.equals("")) {
			ToastHelper.showToastInBottom(this, R.string.password_empty_toast);
			password2Et.startAnimation(shake);
			return;
		}
		
		if(password2.length() < passwordMinLenth) {
			String toast = getResources().getString(R.string.password_no_length);
			ToastHelper.showToastInBottom(this, String.format(toast, passwordMinLenth));
			password2Et.startAnimation(shake);
			return;
		}
		
		if(!password.equals(password2)) {
			ToastHelper.showToastInBottom(this, R.string.password_no_equasl);
			passwordEt.startAnimation(shake);
			password2Et.startAnimation(shake);
			return;
		}
		
		if(verifyCode.equals("")) {
			ToastHelper.showToastInBottom(this, R.string.verify_empty_toast);
			codeEt.startAnimation(shake);
			return;
		}
		
		if(verifyCode.length() < 6) {
			ToastHelper.showToastInBottom(this, R.string.verify_no_length);
			codeEt.startAnimation(shake);
			return;
		}
		
		int gender = 1;
		if(genderRg.getCheckedRadioButtonId() == R.id.female) {
			gender = 2;
		}
		
		if(!proCb.isChecked()) {
			ToastHelper.showToastInBottom(this, R.string.user_protocol_toast);
			return;
		}
		
		setIndeterminateBarVisibility(true);
		requestRegister(Method.POST, NetInterface.METHOD_REGISTER, 
				getRegisterRequestParams(userPhone, password, gender, verifyCode), this, this);		
	}