switching to the new fastscroller

This commit is contained in:
tibbi 2021-11-15 15:41:25 +01:00
parent 081c979535
commit 86a9cab458
4 changed files with 24 additions and 33 deletions

View File

@ -56,7 +56,7 @@ android {
}
dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:5e4cf928a7'
implementation 'com.github.SimpleMobileTools:Simple-Commons:7123443731'
implementation 'org.greenrobot:eventbus:3.2.0'
implementation 'com.klinkerapps:android-smsmms:5.2.6'
implementation 'com.github.tibbi:IndicatorFastScroll:c3de1d040a'

View File

@ -94,10 +94,11 @@ class MainActivity : SimpleActivity() {
(conversations_list.adapter as? ConversationsAdapter)?.updateDrafts()
updateTextColors(main_coordinator)
no_conversations_placeholder_2.setTextColor(getAdjustedPrimaryColor())
val adjustedPrimaryColor = getAdjustedPrimaryColor()
no_conversations_placeholder_2.setTextColor(adjustedPrimaryColor)
no_conversations_placeholder_2.underlineText()
conversations_fastscroller.updatePrimaryColor()
conversations_fastscroller.updateBubbleColors()
conversations_fastscroller.updateColors(adjustedPrimaryColor, adjustedPrimaryColor.getContrastColor())
checkShortcut()
}
@ -261,7 +262,7 @@ class MainActivity : SimpleActivity() {
val currAdapter = conversations_list.adapter
if (currAdapter == null) {
ConversationsAdapter(this, sortedConversations, conversations_list, conversations_fastscroller) {
ConversationsAdapter(this, sortedConversations, conversations_list) {
Intent(this, ThreadActivity::class.java).apply {
putExtra(THREAD_ID, (it as Conversation).threadId)
putExtra(THREAD_TITLE, it.title)
@ -274,11 +275,6 @@ class MainActivity : SimpleActivity() {
if (areSystemAnimationsEnabled) {
conversations_list.scheduleLayoutAnimation()
}
conversations_fastscroller.setViews(conversations_list) {
val listItem = (conversations_list.adapter as? ConversationsAdapter)?.conversations?.getOrNull(it)
conversations_fastscroller.updateBubbleText(listItem?.title ?: "")
}
} else {
try {
(currAdapter as ConversationsAdapter).updateConversations(sortedConversations)

View File

@ -9,6 +9,7 @@ import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import com.bumptech.glide.Glide
import com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
import com.simplemobiletools.commons.extensions.*
@ -16,7 +17,6 @@ import com.simplemobiletools.commons.helpers.KEY_PHONE
import com.simplemobiletools.commons.helpers.SimpleContactsHelper
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.commons.helpers.isNougatPlus
import com.simplemobiletools.commons.views.FastScroller
import com.simplemobiletools.commons.views.MyRecyclerView
import com.simplemobiletools.smsmessenger.R
import com.simplemobiletools.smsmessenger.activities.SimpleActivity
@ -26,9 +26,8 @@ import com.simplemobiletools.smsmessenger.models.Conversation
import kotlinx.android.synthetic.main.item_conversation.view.*
class ConversationsAdapter(
activity: SimpleActivity, var conversations: ArrayList<Conversation>, recyclerView: MyRecyclerView, fastScroller: FastScroller,
itemClick: (Any) -> Unit
) : MyRecyclerViewAdapter(activity, recyclerView, fastScroller, itemClick) {
activity: SimpleActivity, var conversations: ArrayList<Conversation>, recyclerView: MyRecyclerView, itemClick: (Any) -> Unit
) : MyRecyclerViewAdapter(activity, recyclerView, null, itemClick), RecyclerViewFastScroller.OnPopupTextUpdate {
private var fontSize = activity.getTextSize()
private var drafts = HashMap<Long, String?>()
@ -344,4 +343,6 @@ class ConversationsAdapter(
SimpleContactsHelper(context).loadContactImage(conversation.photoUri, conversation_image, conversation.title, placeholder)
}
}
override fun onChange(position: Int) = conversations.getOrNull(position)?.title ?: ""
}

View File

@ -38,28 +38,22 @@
android:textSize="@dimen/bigger_text_size"
android:visibility="gone" />
<com.simplemobiletools.commons.views.MyRecyclerView
android:id="@+id/conversations_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:layoutAnimation="@anim/layout_animation"
android:overScrollMode="ifContentScrolls"
android:scrollbars="none"
app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager" />
<com.simplemobiletools.commons.views.FastScroller
<com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller
android:id="@+id/conversations_fastscroller"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignTop="@+id/conversations_list"
android:layout_alignBottom="@+id/conversations_list"
android:layout_alignParentEnd="true"
android:paddingStart="@dimen/normal_margin">
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="@layout/fastscroller_handle_vertical" />
<com.simplemobiletools.commons.views.MyRecyclerView
android:id="@+id/conversations_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:layoutAnimation="@anim/layout_animation"
android:overScrollMode="ifContentScrolls"
android:scrollbars="none"
app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager" />
</com.simplemobiletools.commons.views.FastScroller>
</com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller>
</RelativeLayout>
<com.simplemobiletools.commons.views.MyFloatingActionButton