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
|
val newColumnCount = it as Int
|
||||||
if (currentColumnCount != newColumnCount) {
|
if (currentColumnCount != newColumnCount) {
|
||||||
config.contactsGridColumnCount = newColumnCount
|
config.contactsGridColumnCount = newColumnCount
|
||||||
favorites_fragment.updateListAdapter()
|
favorites_fragment?.columnCountChanged()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -234,7 +234,7 @@ class MainActivity : SimpleActivity() {
|
|||||||
private fun changeViewType() {
|
private fun changeViewType() {
|
||||||
ChangeViewTypeDialog(this) {
|
ChangeViewTypeDialog(this) {
|
||||||
refreshMenuItems()
|
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
|
val viewType = context.config.viewType
|
||||||
setViewType(viewType)
|
setViewType(viewType)
|
||||||
|
|
||||||
@@ -135,13 +135,19 @@ class FavoritesFragment(context: Context, attributeSet: AttributeSet) : MyViewPa
|
|||||||
fragment_list.scheduleLayoutAnimation()
|
fragment_list.scheduleLayoutAnimation()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
currAdapter.updateItems(allContacts)
|
|
||||||
currAdapter.viewType = viewType
|
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> {
|
private fun sortByCustomOrder(favorites: List<Contact>): ArrayList<Contact> {
|
||||||
val favoritesOrder = activity!!.config.favoritesContactsOrder
|
val favoritesOrder = activity!!.config.favoritesContactsOrder
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user