hide big contact photo on pressing Back, if it is open

This commit is contained in:
tibbi 2020-04-29 13:01:00 +02:00
parent 96ec75e545
commit 58924763a0

View file

@ -73,6 +73,14 @@ class ViewContactActivity : ContactActivity() {
}
}
override fun onBackPressed() {
if (contact_photo_big.isVisible()) {
hideBigContactPhoto()
} else {
super.onBackPressed()
}
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.menu_view_contact, menu)
menu.apply {
@ -177,7 +185,7 @@ class ViewContactActivity : ContactActivity() {
}
contact_photo_big.setOnClickListener {
contact_photo_big.animate().alpha(0f).withEndAction { it.beGone() }.start()
hideBigContactPhoto()
}
}
@ -615,6 +623,10 @@ class ViewContactActivity : ContactActivity() {
private fun getStarDrawable(on: Boolean) = resources.getDrawable(if (on) R.drawable.ic_star_on_vector else R.drawable.ic_star_off_vector)
private fun hideBigContactPhoto() {
contact_photo_big.animate().alpha(0f).withEndAction { contact_photo_big.beGone() }.start()
}
private fun View.copyOnLongClick(value: String) {
setOnLongClickListener {
copyToClipboard(value)