adding animations to recyclerviews

This commit is contained in:
tibbi 2021-03-02 19:52:56 +01:00
parent 1701329496
commit 1b871331a2
12 changed files with 23 additions and 15 deletions

View File

@ -57,7 +57,7 @@ android {
}
dependencies {
implementation 'com.simplemobiletools:commons:5.34.2'
implementation 'com.simplemobiletools:commons:5.34.3'
implementation 'joda-time:joda-time:2.10.3'
implementation 'com.googlecode.ez-vcard:ez-vcard:0.10.5'
implementation 'com.github.tibbi:IndicatorFastScroll:c3de1d040a'

View File

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

View File

@ -294,7 +294,7 @@ class InsertOrEditContactActivity : SimpleActivity(), RefreshContactsListener {
}
}
fun getTabsMask(): Int {
private fun getTabsMask(): Int {
var mask = TAB_CONTACTS
if (config.showTabs and TAB_FAVORITES != 0) {
mask += TAB_FAVORITES

View File

@ -126,15 +126,15 @@ class SelectContactActivity : SimpleActivity() {
val shouldNormalize = text.normalizeString() == text
val filtered = contactsIgnoringSearch.filter {
getProperText(it.getNameToDisplay(), shouldNormalize).contains(text, true) ||
getProperText(it.nickname, shouldNormalize).contains(text, true) ||
it.doesContainPhoneNumber(text, false) ||
it.emails.any { it.value.contains(text, true) } ||
it.addresses.any { getProperText(it.value, shouldNormalize).contains(text, true) } ||
it.IMs.any { it.value.contains(text, true) } ||
getProperText(it.notes, shouldNormalize).contains(text, true) ||
getProperText(it.organization.company, shouldNormalize).contains(text, true) ||
getProperText(it.organization.jobPosition, shouldNormalize).contains(text, true) ||
it.websites.any { it.contains(text, true) }
getProperText(it.nickname, shouldNormalize).contains(text, true) ||
it.doesContainPhoneNumber(text, false) ||
it.emails.any { it.value.contains(text, true) } ||
it.addresses.any { getProperText(it.value, shouldNormalize).contains(text, true) } ||
it.IMs.any { it.value.contains(text, true) } ||
getProperText(it.notes, shouldNormalize).contains(text, true) ||
getProperText(it.organization.company, shouldNormalize).contains(text, true) ||
getProperText(it.organization.jobPosition, shouldNormalize).contains(text, true) ||
it.websites.any { it.contains(text, true) }
} as ArrayList
filtered.sortBy {
@ -201,6 +201,7 @@ class SelectContactActivity : SimpleActivity() {
select_contact_list.adapter = this
}
select_contact_list.scheduleLayoutAnimation()
select_contact_fastscroller.setViews(select_contact_list) {
select_contact_fastscroller.updateBubbleText(contacts[it].getBubbleText())
}

View File

@ -36,7 +36,7 @@ import java.util.*
class ContactsAdapter(activity: SimpleActivity, var contactItems: ArrayList<Contact>, private val refreshListener: RefreshContactsListener?,
private val location: Int, private val removeListener: RemoveFromGroupListener?, recyclerView: MyRecyclerView,
fastScroller: FastScroller?, highlightText: String = "", itemClick: (Any) -> Unit) :
MyRecyclerViewAdapter(activity, recyclerView, fastScroller, itemClick) {
MyRecyclerViewAdapter(activity, recyclerView, fastScroller, itemClick) {
private val NEW_GROUP_ID = -1
private var config = activity.config

View File

@ -42,6 +42,7 @@ class SelectContactsDialog(val activity: SimpleActivity, initialContacts: ArrayL
select_contact_list.adapter = SelectContactsAdapter(activity, allContacts, initiallySelectedContacts, allowSelectMultiple,
select_contact_list, select_contact_fastscroller, contactClickCallback)
select_contact_list.scheduleLayoutAnimation()
select_contact_fastscroller.setViews(select_contact_list) {
select_contact_fastscroller.updateBubbleText(allContacts[it].getBubbleText())
}

View File

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

View File

@ -43,6 +43,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:layoutAnimation="@anim/layout_animation"
android:scrollbars="none"
app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager" />
@ -51,7 +52,6 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:paddingStart="@dimen/normal_margin">
<include layout="@layout/fastscroller_handle_vertical" />

View File

@ -38,6 +38,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:layoutAnimation="@anim/layout_animation"
android:scrollbars="none"
app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager" />

View File

@ -40,6 +40,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:layoutAnimation="@anim/layout_animation"
android:scrollbars="none"
app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager" />

View File

@ -40,6 +40,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:layoutAnimation="@anim/layout_animation"
android:scrollbars="none"
app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager" />

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/select_contact_holder"
android:layout_width="match_parent"
@ -11,6 +10,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:layoutAnimation="@anim/layout_animation"
android:scrollbars="none"
app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager" />