allow clicking on Create New Contact at select contact screen
This commit is contained in:
parent
21cd58f0bb
commit
ba7e7e4ba0
|
@ -104,7 +104,7 @@ class GroupContactsActivity : SimpleActivity(), RemoveFromGroupListener, Refresh
|
|||
val currAdapter = group_contacts_list.adapter
|
||||
if (currAdapter == null) {
|
||||
ContactsAdapter(this, contacts, this, LOCATION_GROUP_CONTACTS, this, group_contacts_list, group_contacts_fastscroller) {
|
||||
contactClicked(it as Contact)
|
||||
contactClicked(it as Contact, false)
|
||||
}.apply {
|
||||
group_contacts_list.adapter = this
|
||||
}
|
||||
|
@ -123,8 +123,8 @@ class GroupContactsActivity : SimpleActivity(), RemoveFromGroupListener, Refresh
|
|||
refreshContacts()
|
||||
}
|
||||
|
||||
override fun contactClicked(contact: Contact) {
|
||||
handleGenericContactClick(contact)
|
||||
override fun contactClicked(contact: Contact?, isCreateNewContact: Boolean) {
|
||||
handleGenericContactClick(contact!!)
|
||||
}
|
||||
|
||||
override fun removeFromGroup(contacts: ArrayList<Contact>) {
|
||||
|
|
|
@ -129,7 +129,7 @@ class InsertOrEditContactActivity : SimpleActivity(), RefreshContactsListener {
|
|||
}
|
||||
}
|
||||
|
||||
override fun contactClicked(contact: Contact) {
|
||||
override fun contactClicked(contact: Contact?, isCreateNewContact: Boolean) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -560,8 +560,8 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
|||
}
|
||||
}
|
||||
|
||||
override fun contactClicked(contact: Contact) {
|
||||
handleGenericContactClick(contact)
|
||||
override fun contactClicked(contact: Contact?, isCreateNewContact: Boolean) {
|
||||
handleGenericContactClick(contact!!)
|
||||
}
|
||||
|
||||
private fun getAllFragments() = arrayListOf(contacts_fragment, favorites_fragment, groups_fragment)
|
||||
|
|
|
@ -16,6 +16,4 @@ class ContactsFragment(context: Context, attributeSet: AttributeSet) : MyViewPag
|
|||
override fun placeholderClicked() {
|
||||
(activity as? MainActivity)?.showFilterDialog()
|
||||
}
|
||||
|
||||
override fun viewSetup() {}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,4 @@ class FavoritesFragment(context: Context, attributeSet: AttributeSet) : MyViewPa
|
|||
(activity as? MainActivity)?.refreshContacts(FAVORITES_TAB_MASK)
|
||||
}
|
||||
}
|
||||
|
||||
override fun viewSetup() {}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,4 @@ class GroupsFragment(context: Context, attributeSet: AttributeSet) : MyViewPager
|
|||
(activity as? MainActivity)?.refreshContacts(GROUPS_TAB_MASK)
|
||||
}
|
||||
}
|
||||
|
||||
override fun viewSetup() {}
|
||||
}
|
||||
|
|
|
@ -2,22 +2,9 @@ package com.simplemobiletools.contacts.pro.fragments
|
|||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor
|
||||
import com.simplemobiletools.commons.extensions.getColoredDrawableWithColor
|
||||
import com.simplemobiletools.contacts.pro.R
|
||||
import com.simplemobiletools.contacts.pro.extensions.config
|
||||
import kotlinx.android.synthetic.main.fragment_insert_or_edit_contacts.view.*
|
||||
|
||||
class InsertOrEditContactsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerFragment(context, attributeSet) {
|
||||
override fun fabClicked() {}
|
||||
|
||||
override fun placeholderClicked() {}
|
||||
|
||||
override fun viewSetup() {
|
||||
select_contact_label.setTextColor(context.getAdjustedPrimaryColor())
|
||||
new_contact_tmb.setImageDrawable(resources.getColoredDrawableWithColor(R.drawable.ic_new_contact_vector, context.config.textColor))
|
||||
new_contact_holder.setOnClickListener {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,11 @@ import com.simplemobiletools.contacts.pro.helpers.*
|
|||
import com.simplemobiletools.contacts.pro.interfaces.RefreshContactsListener
|
||||
import com.simplemobiletools.contacts.pro.models.Contact
|
||||
import com.simplemobiletools.contacts.pro.models.Group
|
||||
import kotlinx.android.synthetic.main.fragment_insert_or_edit_contacts.view.*
|
||||
import kotlinx.android.synthetic.main.fragment_layout.view.*
|
||||
import kotlinx.android.synthetic.main.fragment_layout.view.fragment_fastscroller
|
||||
import kotlinx.android.synthetic.main.fragment_layout.view.fragment_list
|
||||
import kotlinx.android.synthetic.main.fragment_layout.view.fragment_wrapper
|
||||
|
||||
abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet) : CoordinatorLayout(context, attributeSet) {
|
||||
protected var activity: SimpleActivity? = null
|
||||
|
@ -188,7 +192,7 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
|
|||
forceListRedraw = false
|
||||
val location = if (this is FavoritesFragment) LOCATION_FAVORITES_TAB else LOCATION_CONTACTS_TAB
|
||||
ContactsAdapter(activity as SimpleActivity, contacts, activity as RefreshContactsListener, location, null, fragment_list, fragment_fastscroller) {
|
||||
(activity as RefreshContactsListener).contactClicked(it as Contact)
|
||||
(activity as RefreshContactsListener).contactClicked(it as Contact, false)
|
||||
}.apply {
|
||||
fragment_list.adapter = this
|
||||
}
|
||||
|
@ -299,7 +303,11 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
|
|||
fragment_fastscroller.updateBubbleColors()
|
||||
fragment_fastscroller.allowBubbleDisplay = config.showInfoBubble
|
||||
fragment_placeholder_2?.setTextColor(context.getAdjustedPrimaryColor())
|
||||
viewSetup()
|
||||
select_contact_label?.setTextColor(context.getAdjustedPrimaryColor())
|
||||
new_contact_tmb?.setImageDrawable(resources.getColoredDrawableWithColor(R.drawable.ic_new_contact_vector, context.config.textColor))
|
||||
new_contact_holder?.setOnClickListener {
|
||||
(activity as RefreshContactsListener).contactClicked(null, true)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupViewVisibility(hasItemsToShow: Boolean) {
|
||||
|
@ -311,6 +319,4 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
|
|||
abstract fun fabClicked()
|
||||
|
||||
abstract fun placeholderClicked()
|
||||
|
||||
abstract fun viewSetup()
|
||||
}
|
||||
|
|
|
@ -5,5 +5,5 @@ import com.simplemobiletools.contacts.pro.models.Contact
|
|||
interface RefreshContactsListener {
|
||||
fun refreshContacts(refreshTabsMask: Int)
|
||||
|
||||
fun contactClicked(contact: Contact)
|
||||
fun contactClicked(contact: Contact?, isCreateNewContact: Boolean)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue