mirror of
https://github.com/SimpleMobileTools/Simple-Dialer.git
synced 2025-06-05 21:49:23 +02:00
Added change column count animation
This commit is contained in:
@@ -226,7 +226,7 @@ class MainActivity : SimpleActivity() {
|
||||
val newColumnCount = it as Int
|
||||
if (currentColumnCount != newColumnCount) {
|
||||
config.contactsGridColumnCount = newColumnCount
|
||||
favorites_fragment.updateListAdapter()
|
||||
favorites_fragment?.columnCountChanged()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -234,7 +234,7 @@ class MainActivity : SimpleActivity() {
|
||||
private fun changeViewType() {
|
||||
ChangeViewTypeDialog(this) {
|
||||
refreshMenuItems()
|
||||
favorites_fragment.updateListAdapter()
|
||||
favorites_fragment?.refreshItems()
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -87,7 +87,7 @@ class FavoritesFragment(context: Context, attributeSet: AttributeSet) : MyViewPa
|
||||
}
|
||||
}
|
||||
|
||||
fun updateListAdapter() {
|
||||
private fun updateListAdapter() {
|
||||
val viewType = context.config.viewType
|
||||
setViewType(viewType)
|
||||
|
||||
@@ -135,13 +135,19 @@ class FavoritesFragment(context: Context, attributeSet: AttributeSet) : MyViewPa
|
||||
fragment_list.scheduleLayoutAnimation()
|
||||
}
|
||||
} else {
|
||||
currAdapter.updateItems(allContacts)
|
||||
currAdapter.viewType = viewType
|
||||
currAdapter.recyclerView.requestLayout()
|
||||
currAdapter.updateItems(allContacts)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun columnCountChanged() {
|
||||
(fragment_list.layoutManager as MyGridLayoutManager).spanCount = context!!.config.contactsGridColumnCount
|
||||
fragment_list?.adapter?.apply {
|
||||
notifyItemRangeChanged(0, allContacts.size)
|
||||
}
|
||||
}
|
||||
|
||||
private fun sortByCustomOrder(favorites: List<Contact>): ArrayList<Contact> {
|
||||
val favoritesOrder = activity!!.config.favoritesContactsOrder
|
||||
|
||||
|
Reference in New Issue
Block a user