From 76daf23de0ed49aedd5308fb9860fd16b62155e9 Mon Sep 17 00:00:00 2001 From: "Robert D. Rioja (miapuffia)" Date: Sun, 23 Mar 2025 19:45:27 -0400 Subject: [PATCH 1/6] Implemented contact details everywhere --- .../org/fossify/phone/adapters/ContactsAdapter.kt | 7 +++++++ .../org/fossify/phone/adapters/RecentCallsAdapter.kt | 11 ++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/org/fossify/phone/adapters/ContactsAdapter.kt b/app/src/main/kotlin/org/fossify/phone/adapters/ContactsAdapter.kt index 37a6e1d80..644e22c58 100644 --- a/app/src/main/kotlin/org/fossify/phone/adapters/ContactsAdapter.kt +++ b/app/src/main/kotlin/org/fossify/phone/adapters/ContactsAdapter.kt @@ -363,6 +363,13 @@ class ContactsAdapter( binding.apply { root.setupViewBackground(activity) itemContactFrame.isSelected = selectedKeys.contains(contact.rawId) + + itemContactImage.apply { + setOnClickListener { + activity.startContactDetailsIntent(contact) + } + } + itemContactName.apply { setTextColor(textColor) setTextSize(TypedValue.COMPLEX_UNIT_PX, fontSize) diff --git a/app/src/main/kotlin/org/fossify/phone/adapters/RecentCallsAdapter.kt b/app/src/main/kotlin/org/fossify/phone/adapters/RecentCallsAdapter.kt index 198aa5e1a..85ab3f109 100644 --- a/app/src/main/kotlin/org/fossify/phone/adapters/RecentCallsAdapter.kt +++ b/app/src/main/kotlin/org/fossify/phone/adapters/RecentCallsAdapter.kt @@ -434,7 +434,8 @@ class RecentCallsAdapter( val currentFontSize = fontSize itemRecentsHolder.isSelected = selectedKeys.contains(call.id) - val name = findContactByCall(call)?.getNameToDisplay() ?: call.name + val matchingContact = findContactByCall(call) + val name = matchingContact?.getNameToDisplay() ?: call.name val formatPhoneNumbers = activity.config.formatPhoneNumbers var nameToShow = if (name == call.phoneNumber && formatPhoneNumbers) { SpannableString(name.formatPhoneNumber()) @@ -500,6 +501,14 @@ class RecentCallsAdapter( SimpleContactsHelper(root.context).loadContactImage(call.photoUri, itemRecentsImage, call.name) + itemRecentsImage.apply { + if (matchingContact != null) { + setOnClickListener { + activity.startContactDetailsIntent(matchingContact) + } + } + } + val drawable = when (call.type) { Calls.OUTGOING_TYPE -> outgoingCallIcon Calls.MISSED_TYPE -> incomingMissedCallIcon From 36f763ea6826bb8c38ff92c51de347198ae268a8 Mon Sep 17 00:00:00 2001 From: "Robert D. Rioja (miapuffia)" Date: Mon, 24 Mar 2025 05:48:03 -0400 Subject: [PATCH 2/6] Fixed long click and improved consistency --- .../phone/activities/DialpadActivity.kt | 16 ++++++------- .../fossify/phone/adapters/ContactsAdapter.kt | 19 ++++++++++++--- .../phone/adapters/RecentCallsAdapter.kt | 15 ++++++++++-- .../phone/dialogs/SelectContactDialog.kt | 4 ++-- .../phone/fragments/ContactsFragment.kt | 9 ++++--- .../phone/fragments/FavoritesFragment.kt | 24 +++++++++++-------- .../phone/fragments/RecentsFragment.kt | 12 ++++++++++ 7 files changed, 69 insertions(+), 30 deletions(-) diff --git a/app/src/main/kotlin/org/fossify/phone/activities/DialpadActivity.kt b/app/src/main/kotlin/org/fossify/phone/activities/DialpadActivity.kt index f89928ebc..8fdcae304 100644 --- a/app/src/main/kotlin/org/fossify/phone/activities/DialpadActivity.kt +++ b/app/src/main/kotlin/org/fossify/phone/activities/DialpadActivity.kt @@ -291,14 +291,14 @@ class DialpadActivity : SimpleActivity() { activity = this, contacts = filtered, recyclerView = binding.dialpadList, - highlightText = text - ) { - val contact = it as Contact - startCallWithConfirmationCheck(contact.getPrimaryNumber() ?: return@ContactsAdapter, contact.getNameToDisplay()) - Handler().postDelayed({ - binding.dialpadInput.setText("") - }, 1000) - }.apply { + highlightText = text, + itemClick = { + val contact = it as Contact + startCallWithConfirmationCheck(contact.getPrimaryNumber() ?: return@ContactsAdapter, contact.getNameToDisplay()) + Handler().postDelayed({ + binding.dialpadInput.setText("") + }, 1000) + }).apply { binding.dialpadList.adapter = this } diff --git a/app/src/main/kotlin/org/fossify/phone/adapters/ContactsAdapter.kt b/app/src/main/kotlin/org/fossify/phone/adapters/ContactsAdapter.kt index 644e22c58..65f00b52a 100644 --- a/app/src/main/kotlin/org/fossify/phone/adapters/ContactsAdapter.kt +++ b/app/src/main/kotlin/org/fossify/phone/adapters/ContactsAdapter.kt @@ -47,7 +47,8 @@ class ContactsAdapter( private val showDeleteButton: Boolean = true, private val enableDrag: Boolean = false, private val allowLongClick: Boolean = true, - itemClick: (Any) -> Unit + itemClick: (Any) -> Unit, + val profileIconClick: ((Any) -> Unit)? = null ) : MyRecyclerViewAdapter(activity, recyclerView, itemClick), ItemTouchHelperContract, MyRecyclerView.MyZoomListener { @@ -365,8 +366,20 @@ class ContactsAdapter( itemContactFrame.isSelected = selectedKeys.contains(contact.rawId) itemContactImage.apply { - setOnClickListener { - activity.startContactDetailsIntent(contact) + if (profileIconClick != null) { + setOnClickListener { + holder.apply { + if (!actModeCallback.isSelectable) { + profileIconClick.invoke(contact) + } else { + holder.viewClicked(contact) + } + } + } + setOnLongClickListener { + holder.viewLongClicked() + true + } } } diff --git a/app/src/main/kotlin/org/fossify/phone/adapters/RecentCallsAdapter.kt b/app/src/main/kotlin/org/fossify/phone/adapters/RecentCallsAdapter.kt index 85ab3f109..d4e557e9a 100644 --- a/app/src/main/kotlin/org/fossify/phone/adapters/RecentCallsAdapter.kt +++ b/app/src/main/kotlin/org/fossify/phone/adapters/RecentCallsAdapter.kt @@ -38,6 +38,7 @@ class RecentCallsAdapter( private val showOverflowMenu: Boolean, private val itemDelete: (List) -> Unit = {}, itemClick: (Any) -> Unit, + val profileIconClick: ((Any) -> Unit)? = null ) : MyRecyclerViewListAdapter(activity, recyclerView, RecentCallsDiffCallback(), itemClick) { private lateinit var outgoingCallIcon: Drawable @@ -502,9 +503,19 @@ class RecentCallsAdapter( SimpleContactsHelper(root.context).loadContactImage(call.photoUri, itemRecentsImage, call.name) itemRecentsImage.apply { - if (matchingContact != null) { + if (profileIconClick != null) { setOnClickListener { - activity.startContactDetailsIntent(matchingContact) + this@RecentCallViewHolder.apply { + if (!actModeCallback.isSelectable) { + profileIconClick.invoke(call) + } else { + viewClicked(call) + } + } + } + setOnLongClickListener { + viewLongClicked() + true } } } diff --git a/app/src/main/kotlin/org/fossify/phone/dialogs/SelectContactDialog.kt b/app/src/main/kotlin/org/fossify/phone/dialogs/SelectContactDialog.kt index cff53210f..e37447d58 100644 --- a/app/src/main/kotlin/org/fossify/phone/dialogs/SelectContactDialog.kt +++ b/app/src/main/kotlin/org/fossify/phone/dialogs/SelectContactDialog.kt @@ -29,10 +29,10 @@ class SelectContactDialog(val activity: SimpleActivity, val contacts: List(context, attributeSet), @@ -112,19 +113,22 @@ class FavoritesFragment(context: Context, attributeSet: AttributeSet) : MyViewPa viewType = viewType, showDeleteButton = false, enableDrag = true, - ) { contact -> - if (context.config.showCallConfirmation) { - CallConfirmationDialog(activity as SimpleActivity, (contact as Contact).getNameToDisplay()) { + itemClick = { it -> + if (context.config.showCallConfirmation) { + CallConfirmationDialog(activity as SimpleActivity, (it as Contact).getNameToDisplay()) { + activity?.apply { + initiateCall(it) { launchCallIntent(it) } + } + } + } else { activity?.apply { - initiateCall(contact) { launchCallIntent(it) } + initiateCall(it as Contact) { launchCallIntent(it) } } } - } else { - activity?.apply { - initiateCall(contact as Contact) { launchCallIntent(it) } - } - } - }.apply { + }, + profileIconClick = { + activity?.startContactDetailsIntent(it as Contact) + }).apply { binding.fragmentList.adapter = this onDragEndListener = { diff --git a/app/src/main/kotlin/org/fossify/phone/fragments/RecentsFragment.kt b/app/src/main/kotlin/org/fossify/phone/fragments/RecentsFragment.kt index ef0e4647e..f5b5b51b9 100644 --- a/app/src/main/kotlin/org/fossify/phone/fragments/RecentsFragment.kt +++ b/app/src/main/kotlin/org/fossify/phone/fragments/RecentsFragment.kt @@ -7,11 +7,13 @@ import org.fossify.commons.helpers.* import org.fossify.commons.models.contacts.Contact import org.fossify.commons.views.MyRecyclerView import org.fossify.phone.R +import org.fossify.phone.activities.MainActivity import org.fossify.phone.activities.SimpleActivity import org.fossify.phone.adapters.RecentCallsAdapter import org.fossify.phone.databinding.FragmentRecentsBinding import org.fossify.phone.extensions.config import org.fossify.phone.extensions.startCallWithConfirmationCheck +import org.fossify.phone.extensions.startContactDetailsIntent import org.fossify.phone.helpers.RecentsHelper import org.fossify.phone.interfaces.RefreshItemsListener import org.fossify.phone.models.CallLogItem @@ -146,6 +148,12 @@ class RecentsFragment( itemClick = { val recentCall = it as RecentCall activity?.startCallWithConfirmationCheck(recentCall.phoneNumber, recentCall.name) + }, + profileIconClick = { + val contact = findContactByCall(it as RecentCall) + if (contact != null) { + activity?.startContactDetailsIntent(contact) + } } ) @@ -278,4 +286,8 @@ class RecentsFragment( return callLog } + + private fun findContactByCall(recentCall: RecentCall): Contact? { + return (activity as MainActivity).cachedContacts.find { it.name == recentCall.name && it.doesHavePhoneNumber(recentCall.phoneNumber) } + } } From d79792a93558eca5b50ddc4f7a9f45294fd1940c Mon Sep 17 00:00:00 2001 From: "Robert D. Rioja (miapuffia)" Date: Mon, 24 Mar 2025 05:50:56 -0400 Subject: [PATCH 3/6] Fixed contact details in dialpad --- .../kotlin/org/fossify/phone/activities/DialpadActivity.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/kotlin/org/fossify/phone/activities/DialpadActivity.kt b/app/src/main/kotlin/org/fossify/phone/activities/DialpadActivity.kt index 8fdcae304..e3710d47d 100644 --- a/app/src/main/kotlin/org/fossify/phone/activities/DialpadActivity.kt +++ b/app/src/main/kotlin/org/fossify/phone/activities/DialpadActivity.kt @@ -298,6 +298,9 @@ class DialpadActivity : SimpleActivity() { Handler().postDelayed({ binding.dialpadInput.setText("") }, 1000) + }, + profileIconClick = { + startContactDetailsIntent(it as Contact) }).apply { binding.dialpadList.adapter = this } From 4b3101af8030985f500ee35f6d25da270688ec17 Mon Sep 17 00:00:00 2001 From: "Robert D. Rioja (miapuffia)" Date: Mon, 24 Mar 2025 12:09:17 -0400 Subject: [PATCH 4/6] Fixed animations --- .../fossify/phone/adapters/ContactsAdapter.kt | 18 ++++++++++++------ .../phone/adapters/RecentCallsAdapter.kt | 18 ++++++++++++------ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/app/src/main/kotlin/org/fossify/phone/adapters/ContactsAdapter.kt b/app/src/main/kotlin/org/fossify/phone/adapters/ContactsAdapter.kt index 65f00b52a..dad6afa43 100644 --- a/app/src/main/kotlin/org/fossify/phone/adapters/ContactsAdapter.kt +++ b/app/src/main/kotlin/org/fossify/phone/adapters/ContactsAdapter.kt @@ -364,19 +364,25 @@ class ContactsAdapter( binding.apply { root.setupViewBackground(activity) itemContactFrame.isSelected = selectedKeys.contains(contact.rawId) + (root as ViewGroup).setAddStatesFromChildren(true) + + val profileImageRippleX = (itemContactImage.left + (itemContactImage.width / 2)).toFloat() + val profileImageRippleY = (itemContactImage.top + (itemContactImage.height / 2)).toFloat() + root.background.setHotspot(profileImageRippleX, profileImageRippleY) itemContactImage.apply { if (profileIconClick != null) { setOnClickListener { - holder.apply { - if (!actModeCallback.isSelectable) { - profileIconClick.invoke(contact) - } else { - holder.viewClicked(contact) - } + root.background.setHotspot(profileImageRippleX, profileImageRippleY) + + if (!actModeCallback.isSelectable) { + profileIconClick.invoke(contact) + } else { + holder.viewClicked(contact) } } setOnLongClickListener { + root.background.setHotspot(profileImageRippleX, profileImageRippleY) holder.viewLongClicked() true } diff --git a/app/src/main/kotlin/org/fossify/phone/adapters/RecentCallsAdapter.kt b/app/src/main/kotlin/org/fossify/phone/adapters/RecentCallsAdapter.kt index d4e557e9a..3e173bb7d 100644 --- a/app/src/main/kotlin/org/fossify/phone/adapters/RecentCallsAdapter.kt +++ b/app/src/main/kotlin/org/fossify/phone/adapters/RecentCallsAdapter.kt @@ -432,6 +432,11 @@ class RecentCallsAdapter( ) { _, _ -> binding.apply { root.setupViewBackground(activity) + (root as ViewGroup).setAddStatesFromChildren(true) + + val profileImageRippleX = (itemRecentsImage.left + (itemRecentsImage.width / 2)).toFloat() + val profileImageRippleY = (itemRecentsImage.top + (itemRecentsImage.height / 2)).toFloat() + root.background.setHotspot(profileImageRippleX, profileImageRippleY) val currentFontSize = fontSize itemRecentsHolder.isSelected = selectedKeys.contains(call.id) @@ -505,15 +510,16 @@ class RecentCallsAdapter( itemRecentsImage.apply { if (profileIconClick != null) { setOnClickListener { - this@RecentCallViewHolder.apply { - if (!actModeCallback.isSelectable) { - profileIconClick.invoke(call) - } else { - viewClicked(call) - } + root.background.setHotspot(profileImageRippleX, profileImageRippleY) + + if (!actModeCallback.isSelectable) { + profileIconClick.invoke(call) + } else { + viewClicked(call) } } setOnLongClickListener { + root.background.setHotspot(profileImageRippleX, profileImageRippleY) viewLongClicked() true } From b86638cb7e0412a5387e23f4c3a310004e1f4510 Mon Sep 17 00:00:00 2001 From: "Robert D. Rioja (miapuffia)" Date: Mon, 24 Mar 2025 15:24:15 -0400 Subject: [PATCH 5/6] Improved animation --- .../org/fossify/phone/adapters/ContactsAdapter.kt | 10 ++-------- .../fossify/phone/adapters/RecentCallsAdapter.kt | 10 ++-------- .../ripple_selector_background_circle.xml | 9 +++++++++ .../res/drawable/selector_clickable_circle.xml | 15 +++++++++++++++ 4 files changed, 28 insertions(+), 16 deletions(-) create mode 100644 app/src/main/res/drawable/ripple_selector_background_circle.xml create mode 100644 app/src/main/res/drawable/selector_clickable_circle.xml diff --git a/app/src/main/kotlin/org/fossify/phone/adapters/ContactsAdapter.kt b/app/src/main/kotlin/org/fossify/phone/adapters/ContactsAdapter.kt index dad6afa43..718cda32e 100644 --- a/app/src/main/kotlin/org/fossify/phone/adapters/ContactsAdapter.kt +++ b/app/src/main/kotlin/org/fossify/phone/adapters/ContactsAdapter.kt @@ -364,17 +364,12 @@ class ContactsAdapter( binding.apply { root.setupViewBackground(activity) itemContactFrame.isSelected = selectedKeys.contains(contact.rawId) - (root as ViewGroup).setAddStatesFromChildren(true) - - val profileImageRippleX = (itemContactImage.left + (itemContactImage.width / 2)).toFloat() - val profileImageRippleY = (itemContactImage.top + (itemContactImage.height / 2)).toFloat() - root.background.setHotspot(profileImageRippleX, profileImageRippleY) itemContactImage.apply { + setBackgroundResource(R.drawable.selector_clickable_circle) + if (profileIconClick != null) { setOnClickListener { - root.background.setHotspot(profileImageRippleX, profileImageRippleY) - if (!actModeCallback.isSelectable) { profileIconClick.invoke(contact) } else { @@ -382,7 +377,6 @@ class ContactsAdapter( } } setOnLongClickListener { - root.background.setHotspot(profileImageRippleX, profileImageRippleY) holder.viewLongClicked() true } diff --git a/app/src/main/kotlin/org/fossify/phone/adapters/RecentCallsAdapter.kt b/app/src/main/kotlin/org/fossify/phone/adapters/RecentCallsAdapter.kt index 3e173bb7d..47807ead2 100644 --- a/app/src/main/kotlin/org/fossify/phone/adapters/RecentCallsAdapter.kt +++ b/app/src/main/kotlin/org/fossify/phone/adapters/RecentCallsAdapter.kt @@ -432,11 +432,6 @@ class RecentCallsAdapter( ) { _, _ -> binding.apply { root.setupViewBackground(activity) - (root as ViewGroup).setAddStatesFromChildren(true) - - val profileImageRippleX = (itemRecentsImage.left + (itemRecentsImage.width / 2)).toFloat() - val profileImageRippleY = (itemRecentsImage.top + (itemRecentsImage.height / 2)).toFloat() - root.background.setHotspot(profileImageRippleX, profileImageRippleY) val currentFontSize = fontSize itemRecentsHolder.isSelected = selectedKeys.contains(call.id) @@ -508,10 +503,10 @@ class RecentCallsAdapter( SimpleContactsHelper(root.context).loadContactImage(call.photoUri, itemRecentsImage, call.name) itemRecentsImage.apply { + setBackgroundResource(R.drawable.selector_clickable) + if (profileIconClick != null) { setOnClickListener { - root.background.setHotspot(profileImageRippleX, profileImageRippleY) - if (!actModeCallback.isSelectable) { profileIconClick.invoke(call) } else { @@ -519,7 +514,6 @@ class RecentCallsAdapter( } } setOnLongClickListener { - root.background.setHotspot(profileImageRippleX, profileImageRippleY) viewLongClicked() true } diff --git a/app/src/main/res/drawable/ripple_selector_background_circle.xml b/app/src/main/res/drawable/ripple_selector_background_circle.xml new file mode 100644 index 000000000..8168bf123 --- /dev/null +++ b/app/src/main/res/drawable/ripple_selector_background_circle.xml @@ -0,0 +1,9 @@ + + + + + + + + diff --git a/app/src/main/res/drawable/selector_clickable_circle.xml b/app/src/main/res/drawable/selector_clickable_circle.xml new file mode 100644 index 000000000..cf6243ea7 --- /dev/null +++ b/app/src/main/res/drawable/selector_clickable_circle.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + From 46f03ff1b42abfeb8a23c83b576c6ef323964cf2 Mon Sep 17 00:00:00 2001 From: "Robert D. Rioja (miapuffia)" Date: Tue, 25 Mar 2025 11:21:39 -0400 Subject: [PATCH 6/6] Fixed animation issues --- .../main/kotlin/org/fossify/phone/adapters/ContactsAdapter.kt | 4 ++-- .../kotlin/org/fossify/phone/adapters/RecentCallsAdapter.kt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/org/fossify/phone/adapters/ContactsAdapter.kt b/app/src/main/kotlin/org/fossify/phone/adapters/ContactsAdapter.kt index 718cda32e..63a18347d 100644 --- a/app/src/main/kotlin/org/fossify/phone/adapters/ContactsAdapter.kt +++ b/app/src/main/kotlin/org/fossify/phone/adapters/ContactsAdapter.kt @@ -366,9 +366,9 @@ class ContactsAdapter( itemContactFrame.isSelected = selectedKeys.contains(contact.rawId) itemContactImage.apply { - setBackgroundResource(R.drawable.selector_clickable_circle) - if (profileIconClick != null) { + setBackgroundResource(R.drawable.selector_clickable_circle) + setOnClickListener { if (!actModeCallback.isSelectable) { profileIconClick.invoke(contact) diff --git a/app/src/main/kotlin/org/fossify/phone/adapters/RecentCallsAdapter.kt b/app/src/main/kotlin/org/fossify/phone/adapters/RecentCallsAdapter.kt index 47807ead2..6952bc3cd 100644 --- a/app/src/main/kotlin/org/fossify/phone/adapters/RecentCallsAdapter.kt +++ b/app/src/main/kotlin/org/fossify/phone/adapters/RecentCallsAdapter.kt @@ -503,9 +503,9 @@ class RecentCallsAdapter( SimpleContactsHelper(root.context).loadContactImage(call.photoUri, itemRecentsImage, call.name) itemRecentsImage.apply { - setBackgroundResource(R.drawable.selector_clickable) - if (profileIconClick != null) { + setBackgroundResource(R.drawable.selector_clickable_circle) + setOnClickListener { if (!actModeCallback.isSelectable) { profileIconClick.invoke(call)