From 638f9d61f741d5d0a2432e4c1ee587759f4cb66f Mon Sep 17 00:00:00 2001 From: Andrii Chubko Date: Tue, 17 Aug 2021 15:42:34 +0300 Subject: [PATCH 1/2] Add back ability to view full contact picture Revert "hiding the fake top big image" This reverts commit a996a40f --- .../pro/activities/ViewContactActivity.kt | 33 +++++++++++++++++++ .../main/res/layout/activity_view_contact.xml | 12 +++++++ 2 files changed, 45 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/ViewContactActivity.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/ViewContactActivity.kt index b73e5db7..c6579bcc 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/ViewContactActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/ViewContactActivity.kt @@ -10,6 +10,10 @@ import android.provider.ContactsContract import android.view.View import android.view.WindowManager import android.widget.RelativeLayout +import com.bumptech.glide.Glide +import com.bumptech.glide.load.resource.bitmap.FitCenter +import com.bumptech.glide.load.resource.bitmap.RoundedCorners +import com.bumptech.glide.request.RequestOptions import com.simplemobiletools.commons.dialogs.CallConfirmationDialog import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.dialogs.SelectAlarmSoundDialog @@ -75,6 +79,14 @@ class ViewContactActivity : ContactActivity() { } } + override fun onBackPressed() { + if (contact_photo_big.alpha == 1f) { + hideBigContactPhoto() + } else { + super.onBackPressed() + } + } + private fun setupMenu() { (contact_appbar.layoutParams as RelativeLayout.LayoutParams).topMargin = statusBarHeight contact_toolbar.menu.apply { @@ -170,6 +182,23 @@ class ViewContactActivity : ContactActivity() { contact_photo_bottom_shadow.beGone() } else { updateContactPhoto(contact!!.photoUri, contact_photo, contact_photo_bottom_shadow, contact!!.photo) + val options = RequestOptions() + .transform(FitCenter(), RoundedCorners(resources.getDimension(R.dimen.normal_margin).toInt())) + + Glide.with(this) + .load(contact!!.photo ?: currentContactPhotoPath) + .apply(options) + .into(contact_photo_big) + + contact_photo.setOnClickListener { + contact_photo_big.alpha = 0f + contact_photo_big.beVisible() + contact_photo_big.animate().alpha(1f).start() + } + + contact_photo_big.setOnClickListener { + hideBigContactPhoto() + } } val textColor = config.textColor @@ -721,6 +750,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) diff --git a/app/src/main/res/layout/activity_view_contact.xml b/app/src/main/res/layout/activity_view_contact.xml index f6ca310f..98a12bf2 100644 --- a/app/src/main/res/layout/activity_view_contact.xml +++ b/app/src/main/res/layout/activity_view_contact.xml @@ -388,6 +388,18 @@ + + Date: Tue, 17 Aug 2021 15:04:03 +0200 Subject: [PATCH 2/2] removing an old copypaste error --- app/src/main/res/layout/activity_view_contact.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/res/layout/activity_view_contact.xml b/app/src/main/res/layout/activity_view_contact.xml index 98a12bf2..88e644d1 100644 --- a/app/src/main/res/layout/activity_view_contact.xml +++ b/app/src/main/res/layout/activity_view_contact.xml @@ -397,7 +397,6 @@ android:clickable="true" android:padding="@dimen/activity_margin" android:scaleType="fitCenter" - android:src="@drawable/img_write_storage" android:visibility="gone" />