mirror of
https://github.com/SimpleMobileTools/Simple-Dialer.git
synced 2025-04-25 23:38:41 +02:00
show some placeholders if search finds no results
This commit is contained in:
parent
ef3b07eddd
commit
52c460dc9b
@ -150,6 +150,7 @@ class ContactsFragment(context: Context, attributeSet: AttributeSet) : MyViewPag
|
||||
}
|
||||
|
||||
override fun onSearchClosed() {
|
||||
fragment_placeholder.beVisibleIf(allContacts.isEmpty())
|
||||
(fragment_list.adapter as? ContactsAdapter)?.updateItems(allContacts)
|
||||
setupLetterFastscroller(allContacts)
|
||||
}
|
||||
@ -159,6 +160,7 @@ class ContactsFragment(context: Context, attributeSet: AttributeSet) : MyViewPag
|
||||
it.name.contains(text, true) || it.doesContainPhoneNumber(text)
|
||||
}.toMutableList() as ArrayList<SimpleContact>
|
||||
|
||||
fragment_placeholder.beVisibleIf(contacts.isEmpty())
|
||||
(fragment_list.adapter as? ContactsAdapter)?.updateItems(contacts, text)
|
||||
setupLetterFastscroller(contacts)
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ class FavoritesFragment(context: Context, attributeSet: AttributeSet) : MyViewPa
|
||||
|
||||
override fun setupFragment() {
|
||||
val placeholderResId = if (context.hasPermission(PERMISSION_READ_CONTACTS)) {
|
||||
R.string.no_items_found
|
||||
R.string.no_contacts_found
|
||||
} else {
|
||||
R.string.could_not_access_contacts
|
||||
}
|
||||
@ -113,6 +113,7 @@ class FavoritesFragment(context: Context, attributeSet: AttributeSet) : MyViewPa
|
||||
}
|
||||
|
||||
override fun onSearchClosed() {
|
||||
fragment_placeholder.beVisibleIf(allContacts.isEmpty())
|
||||
(fragment_list.adapter as? ContactsAdapter)?.updateItems(allContacts)
|
||||
setupLetterFastscroller(allContacts)
|
||||
}
|
||||
@ -122,6 +123,7 @@ class FavoritesFragment(context: Context, attributeSet: AttributeSet) : MyViewPa
|
||||
it.name.contains(text, true) || it.doesContainPhoneNumber(text)
|
||||
}.toMutableList() as ArrayList<SimpleContact>
|
||||
|
||||
fragment_placeholder.beVisibleIf(contacts.isEmpty())
|
||||
(fragment_list.adapter as? ContactsAdapter)?.updateItems(contacts, text)
|
||||
setupLetterFastscroller(contacts)
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.MyContactsContentProvider
|
||||
import com.simplemobiletools.commons.helpers.PERMISSION_READ_CALL_LOG
|
||||
import com.simplemobiletools.commons.helpers.SimpleContactsHelper
|
||||
import com.simplemobiletools.commons.helpers.mydebug
|
||||
import com.simplemobiletools.dialer.R
|
||||
import com.simplemobiletools.dialer.activities.SimpleActivity
|
||||
import com.simplemobiletools.dialer.adapters.RecentCallsAdapter
|
||||
@ -116,6 +115,7 @@ class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
|
||||
}
|
||||
|
||||
override fun onSearchClosed() {
|
||||
recents_placeholder.beVisibleIf(allRecentCalls.isEmpty())
|
||||
(recents_list.adapter as? RecentCallsAdapter)?.updateItems(allRecentCalls)
|
||||
}
|
||||
|
||||
@ -124,6 +124,7 @@ class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
|
||||
it.name.contains(text, true) || it.doesContainPhoneNumber(text)
|
||||
}.toMutableList() as ArrayList<RecentCall>
|
||||
|
||||
recents_placeholder.beVisibleIf(recentCalls.isEmpty())
|
||||
(recents_list.adapter as? RecentCallsAdapter)?.updateItems(recentCalls, text)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user