Java Code Examples for android.widget.EditText#startAnimation()
The following examples show how to use
android.widget.EditText#startAnimation() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ContactSelectActivity.java From weMessage with GNU Affero General Public License v3.0 | 6 votes |
private void invalidateField(final EditText editText){ ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), getResources().getColor(R.color.colorHeader), getResources().getColor(R.color.brightRed)); colorAnimation.setDuration(200); colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { editText.setTextColor((int) animation.getAnimatedValue()); } }); Animation invalidShake = AnimationUtils.loadAnimation(this, R.anim.invalid_shake); invalidShake.setInterpolator(new CycleInterpolator(7F)); colorAnimation.start(); editText.startAnimation(invalidShake); }
Example 2
Source File: ContactSelectActivity.java From weMessage with GNU Affero General Public License v3.0 | 6 votes |
private void invalidateField(final EditText editText){ ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), getResources().getColor(R.color.colorHeader), getResources().getColor(R.color.invalidRed)); colorAnimation.setDuration(200); colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { editText.getBackground().setColorFilter((int) animation.getAnimatedValue(), PorterDuff.Mode.SRC_ATOP); editText.setTextColor((int) animation.getAnimatedValue()); } }); Animation invalidShake = AnimationUtils.loadAnimation(getActivity(), R.anim.invalid_shake); invalidShake.setInterpolator(new CycleInterpolator(7F)); colorAnimation.start(); editText.startAnimation(invalidShake); }
Example 3
Source File: SetNumberActivity.java From weMessage with GNU Affero General Public License v3.0 | 6 votes |
private void invalidateField(final EditText editText){ ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), getResources().getColor(R.color.colorHeader), getResources().getColor(R.color.invalidRed)); colorAnimation.setDuration(200); colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { editText.getBackground().setColorFilter((int) animation.getAnimatedValue(), PorterDuff.Mode.SRC_ATOP); editText.setTextColor((int) animation.getAnimatedValue()); } }); Animation invalidShake = AnimationUtils.loadAnimation(this, R.anim.invalid_shake); invalidShake.setInterpolator(new CycleInterpolator(7F)); colorAnimation.start(); editText.startAnimation(invalidShake); }
Example 4
Source File: LaunchFragment.java From weMessage with GNU Affero General Public License v3.0 | 6 votes |
private void invalidateField(final EditText editText){ ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), getResources().getColor(R.color.colorHeader), getResources().getColor(R.color.invalidRed)); colorAnimation.setDuration(200); colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { editText.getBackground().setColorFilter((int) animation.getAnimatedValue(), PorterDuff.Mode.SRC_ATOP); editText.setTextColor((int) animation.getAnimatedValue()); } }); Animation invalidShake = AnimationUtils.loadAnimation(getActivity(), R.anim.invalid_shake); invalidShake.setInterpolator(new CycleInterpolator(7F)); colorAnimation.start(); editText.startAnimation(invalidShake); }
Example 5
Source File: CreateChatFragment.java From weMessage with GNU Affero General Public License v3.0 | 6 votes |
private void invalidateField(final EditText editText){ ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), getResources().getColor(R.color.colorHeader), getResources().getColor(R.color.brightRed)); colorAnimation.setDuration(200); colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { editText.setTextColor((int) animation.getAnimatedValue()); } }); Animation invalidShake = AnimationUtils.loadAnimation(getActivity(), R.anim.invalid_shake); invalidShake.setInterpolator(new CycleInterpolator(7F)); colorAnimation.start(); editText.startAnimation(invalidShake); }
Example 6
Source File: CreditCardEntry.java From CreditCardEntry with MIT License | 6 votes |
@Override public void onBadInput(final EditText field) { if (animateOnError) { 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() { if (textColor != null) { field.setTextColor(textColor); } } }, 1000); }
Example 7
Source File: EditTextShakeHelper.java From JianDan_OkHttpWithVolley with Apache License 2.0 | 5 votes |
public void shake(EditText... editTexts) { for (EditText editText : editTexts) { editText.startAnimation(shakeAnimation); } shakeVibrator.vibrate(new long[]{0, 500}, -1); }
Example 8
Source File: PickActivity.java From Cheerleader with Apache License 2.0 | 5 votes |
/** * Check if the edit text is valid or not. * * @param editText field to check. * @return true if the edit text isn't empty */ private boolean checkField(EditText editText) { boolean valid = true; if (TextUtils.isEmpty(editText.getText())) { editText.startAnimation(mWiggle); editText.requestFocus(); valid = false; } return valid; }
Example 9
Source File: EditTextShakeHelper.java From JianDan with Apache License 2.0 | 5 votes |
public void shake(EditText... editTexts) { for (EditText editText : editTexts) { editText.startAnimation(shakeAnimation); } shakeVibrator.vibrate(new long[]{0, 500}, -1); }
Example 10
Source File: EditTextShakeHelper.java From JianDanRxJava with Apache License 2.0 | 5 votes |
public void shake(EditText... editTexts) { for (EditText editText : editTexts) { editText.startAnimation(shakeAnimation); } shakeVibrator.vibrate(new long[]{0, 500}, -1); }
Example 11
Source File: EditTextShakeHelper.java From JianDan_OkHttp with Apache License 2.0 | 5 votes |
public void shake(EditText... editTexts) { for (EditText editText : editTexts) { editText.startAnimation(shakeAnimation); } shakeVibrator.vibrate(new long[]{0, 500}, -1); }
Example 12
Source File: FirstRunActivity.java From BuildmLearn-Toolkit-Android with BSD 3-Clause "New" or "Revised" License | 4 votes |
/** * {@inheritDoc} */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); Fabric.with(this, new Crashlytics()); if (prefs.getBoolean(FIRST_RUN, false)) { startActivity(new Intent(getApplicationContext(), HomeActivity.class)); finish(); } setContentView(R.layout.activity_first_run); findViewById(R.id.focus_thief).clearFocus(); Animation anim_bounceinup=AnimationUtils.loadAnimation(getBaseContext(),R.anim.bounceinup); name = (EditText) findViewById(R.id.first_name); name.startAnimation(anim_bounceinup); name.setOnKeyListener(new View.OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_DOWN) { switch (keyCode) { case KeyEvent.KEYCODE_DPAD_CENTER: case KeyEvent.KEYCODE_ENTER: if (name.getText().toString().equals("")) { name.setError(getApplicationContext().getResources().getString(R.string.enter_name)); return false; } else if(!Character.isLetterOrDigit(name.getText().toString().charAt(0))) { name.setError(getApplicationContext().getResources().getString(R.string.valid_msg)); return false; } SharedPreferences.Editor editor = prefs.edit(); editor.putString(getString(R.string.key_user_name), name.getText().toString()); editor.putBoolean(FIRST_RUN, true); editor.apply(); Intent intent = new Intent(getApplicationContext(), TutorialActivity.class); intent.putExtra(Constants.START_ACTIVITY, true); startActivity(intent); finish(); return true; default: break; } } return false; } }); }