mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-06-05 21:59:27 +02:00
show a different placeholder at empty favorites
This commit is contained in:
@ -12,6 +12,10 @@ class ContactsFragment(context: Context, attributeSet: AttributeSet) : MyViewPag
|
||||
}
|
||||
}
|
||||
|
||||
override fun placeholderClicked() {
|
||||
activity!!.showFilterDialog()
|
||||
}
|
||||
|
||||
override fun refreshItems() {
|
||||
initContacts()
|
||||
}
|
||||
|
@ -6,12 +6,20 @@ import com.simplemobiletools.contacts.dialogs.AddFavoritesDialog
|
||||
|
||||
class FavoritesFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerFragment(context, attributeSet) {
|
||||
override fun fabClicked() {
|
||||
AddFavoritesDialog(activity!!) {
|
||||
initContacts()
|
||||
}
|
||||
showAddFavoritesDialog()
|
||||
}
|
||||
|
||||
override fun placeholderClicked() {
|
||||
showAddFavoritesDialog()
|
||||
}
|
||||
|
||||
override fun refreshItems() {
|
||||
initContacts()
|
||||
}
|
||||
|
||||
private fun showAddFavoritesDialog() {
|
||||
AddFavoritesDialog(activity!!) {
|
||||
initContacts()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,11 +36,16 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
|
||||
}
|
||||
|
||||
fragment_placeholder_2.setOnClickListener {
|
||||
activity.showFilterDialog()
|
||||
placeholderClicked()
|
||||
}
|
||||
|
||||
fragment_placeholder_2.paintFlags = fragment_placeholder_2.paintFlags or Paint.UNDERLINE_TEXT_FLAG
|
||||
updateViewStuff()
|
||||
|
||||
if (this is FavoritesFragment) {
|
||||
fragment_placeholder.text = activity.getString(R.string.no_favorites)
|
||||
fragment_placeholder_2.text = activity.getString(R.string.add_favorites)
|
||||
}
|
||||
}
|
||||
|
||||
initContacts()
|
||||
@ -153,4 +158,6 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
|
||||
}
|
||||
|
||||
abstract fun fabClicked()
|
||||
|
||||
abstract fun placeholderClicked()
|
||||
}
|
||||
|
Reference in New Issue
Block a user