use layout animations only if they arent disabled by the system

This commit is contained in:
tibbi 2021-11-17 09:54:44 +01:00
parent 8d9c000a08
commit 8707684013
4 changed files with 21 additions and 5 deletions

View File

@ -139,7 +139,10 @@ class GroupContactsActivity : SimpleActivity(), RemoveFromGroupListener, Refresh
group_contacts_list.adapter = this group_contacts_list.adapter = this
} }
if (areSystemAnimationsEnabled) {
group_contacts_list.scheduleLayoutAnimation() group_contacts_list.scheduleLayoutAnimation()
}
group_contacts_fastscroller.setScrollToY(0) group_contacts_fastscroller.setScrollToY(0)
group_contacts_fastscroller.setViews(group_contacts_list) { group_contacts_fastscroller.setViews(group_contacts_list) {
val item = (group_contacts_list.adapter as ContactsAdapter).contactItems.getOrNull(it) val item = (group_contacts_list.adapter as ContactsAdapter).contactItems.getOrNull(it)

View File

@ -201,7 +201,10 @@ class SelectContactActivity : SimpleActivity() {
select_contact_list.adapter = this select_contact_list.adapter = this
} }
if (areSystemAnimationsEnabled) {
select_contact_list.scheduleLayoutAnimation() select_contact_list.scheduleLayoutAnimation()
}
select_contact_fastscroller.setViews(select_contact_list) { select_contact_fastscroller.setViews(select_contact_list) {
select_contact_fastscroller.updateBubbleText(contacts[it].getBubbleText()) select_contact_fastscroller.updateBubbleText(contacts[it].getBubbleText())
} }

View File

@ -1,6 +1,7 @@
package com.simplemobiletools.contacts.pro.dialogs package com.simplemobiletools.contacts.pro.dialogs
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import com.simplemobiletools.commons.extensions.areSystemAnimationsEnabled
import com.simplemobiletools.commons.extensions.setupDialogStuff import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.contacts.pro.R import com.simplemobiletools.contacts.pro.R
@ -42,7 +43,10 @@ class SelectContactsDialog(val activity: SimpleActivity, initialContacts: ArrayL
select_contact_list.adapter = SelectContactsAdapter(activity, allContacts, initiallySelectedContacts, allowSelectMultiple, select_contact_list.adapter = SelectContactsAdapter(activity, allContacts, initiallySelectedContacts, allowSelectMultiple,
select_contact_list, select_contact_fastscroller, contactClickCallback) select_contact_list, select_contact_fastscroller, contactClickCallback)
if (context.areSystemAnimationsEnabled) {
select_contact_list.scheduleLayoutAnimation() select_contact_list.scheduleLayoutAnimation()
}
select_contact_fastscroller.setViews(select_contact_list) { select_contact_fastscroller.setViews(select_contact_list) {
select_contact_fastscroller.updateBubbleText(allContacts[it].getBubbleText()) select_contact_fastscroller.updateBubbleText(allContacts[it].getBubbleText())
} }

View File

@ -178,7 +178,10 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
fragment_list.adapter = this fragment_list.adapter = this
} }
if (context.areSystemAnimationsEnabled) {
fragment_list.scheduleLayoutAnimation() fragment_list.scheduleLayoutAnimation()
}
fragment_fastscroller.setScrollToY(0) fragment_fastscroller.setScrollToY(0)
fragment_fastscroller.setViews(fragment_list) { fragment_fastscroller.setViews(fragment_list) {
val item = (fragment_list.adapter as GroupsAdapter).groups.getOrNull(it) val item = (fragment_list.adapter as GroupsAdapter).groups.getOrNull(it)
@ -211,7 +214,10 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
}.apply { }.apply {
fragment_list.adapter = this fragment_list.adapter = this
} }
if (context.areSystemAnimationsEnabled) {
fragment_list.scheduleLayoutAnimation() fragment_list.scheduleLayoutAnimation()
}
} else { } else {
(currAdapter as ContactsAdapter).apply { (currAdapter as ContactsAdapter).apply {
startNameWithSurname = config.startNameWithSurname startNameWithSurname = config.startNameWithSurname