removing the old fastscroller from the Contacts and Favorites tab

This commit is contained in:
tibbi 2020-02-05 14:52:53 +01:00
parent 9dcf8eace5
commit 7df23a98dd
5 changed files with 63 additions and 14 deletions

View File

@ -31,7 +31,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) :
fastScroller: FastScroller?, highlightText: String = "", itemClick: (Any) -> Unit) :
MyRecyclerViewAdapter(activity, recyclerView, fastScroller, itemClick) {
private val NEW_GROUP_ID = -1

View File

@ -79,8 +79,8 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
}
fun primaryColorChanged() {
fragment_fastscroller.updatePrimaryColor()
fragment_fastscroller.updateBubblePrimaryColor()
fragment_fastscroller?.updatePrimaryColor()
fragment_fastscroller?.updateBubblePrimaryColor()
(fragment_list.adapter as? ContactsAdapter)?.apply {
adjustedPrimaryColor = context.getAdjustedPrimaryColor()
}
@ -197,17 +197,11 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
else -> LOCATION_CONTACTS_TAB
}
ContactsAdapter(activity as SimpleActivity, contacts, activity as RefreshContactsListener, location, null, fragment_list, fragment_fastscroller) {
ContactsAdapter(activity as SimpleActivity, contacts, activity as RefreshContactsListener, location, null, fragment_list, null) {
(activity as RefreshContactsListener).contactClicked(it as Contact)
}.apply {
fragment_list.adapter = this
}
fragment_fastscroller.setScrollToY(0)
fragment_fastscroller.setViews(fragment_list) {
val item = (fragment_list.adapter as ContactsAdapter).contactItems.getOrNull(it)
fragment_fastscroller.updateBubbleText(item?.getBubbleText() ?: "")
}
} else {
(currAdapter as ContactsAdapter).apply {
startNameWithSurname = config.startNameWithSurname
@ -318,8 +312,8 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
private fun updateViewStuff() {
context.updateTextColors(fragment_wrapper.parent as ViewGroup)
fragment_fastscroller.updateBubbleColors()
fragment_fastscroller.allowBubbleDisplay = config.showInfoBubble
fragment_fastscroller?.updateBubbleColors()
fragment_fastscroller?.allowBubbleDisplay = config.showInfoBubble
fragment_placeholder_2?.setTextColor(context.getAdjustedPrimaryColor())
}

View File

@ -5,6 +5,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/fragment_layout"/>
<include layout="@layout/fragment_letters_layout"/>
</com.simplemobiletools.contacts.pro.fragments.ContactsFragment>

View File

@ -5,6 +5,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/fragment_layout"/>
<include layout="@layout/fragment_letters_layout"/>
</com.simplemobiletools.contacts.pro.fragments.FavoritesFragment>

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<merge
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<RelativeLayout
android:id="@+id/fragment_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/fragment_placeholder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/activity_margin"
android:gravity="center"
android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin"
android:text="@string/no_contacts_found"
android:textSize="@dimen/bigger_text_size"
android:visibility="gone"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/fragment_placeholder_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/fragment_placeholder"
android:layout_centerHorizontal="true"
android:background="?attr/selectableItemBackground"
android:gravity="center"
android:padding="@dimen/activity_margin"
android:text="@string/change_filter"
android:textSize="@dimen/bigger_text_size"
android:visibility="gone"/>
<com.simplemobiletools.commons.views.MyRecyclerView
android:id="@+id/fragment_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:scrollbars="none"
app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager"/>
</RelativeLayout>
<com.simplemobiletools.commons.views.MyFloatingActionButton
android:id="@+id/fragment_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/activity_margin"
android:src="@drawable/ic_plus_vector"/>
</merge>