Is there a way to animate an existing open dialog/alert dialog ? I would like to mimic how Apple deals with their dialog such that when a user enters and invalid credentials, the dialog would vibrate without it having to be dismiss and show again.
The closest I got was animating the editText box with the shake animation found here: Link
val dialog = Dialog(this)
dialog.setContentView(R.layout.authentication_dialog)
val authenticator = dialog.findViewById<Button>(R.id.submit_auth_phone)
var phoneNumber = dialog.findViewById<EditText>(R.id.auth_phone)
val alertText = dialog.findViewById<TextView>(R.id.alertText)
dialog.setCancelable(false)
dialog.setCanceledOnTouchOutside(false)
dialog.show()
authenticator.setOnClickListener {
AuthAsyncTask(feTable).execute()
if (phoneNumber.text.toString().length < 8){
val shake = AnimationUtils.loadAnimation(this, R.anim.shake)
phoneNumber.startAnimation(shake)
alertText.visibility = TextView.VISIBLE
}
}
As you can see from the video, the dialog will "shake" when I click a button whereas the tutorials from everywhere is animate upon opening or dismissing their dialog