updating commons + the new fastscroller handling

This commit is contained in:
tibbi 2021-11-27 19:35:30 +01:00
parent 95fbe59ac8
commit 70a6e701dc
8 changed files with 27 additions and 35 deletions

View file

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

View file

@ -140,7 +140,7 @@ class NewConversationActivity : SimpleActivity() {
val currAdapter = contacts_list.adapter val currAdapter = contacts_list.adapter
if (currAdapter == null) { if (currAdapter == null) {
ContactsAdapter(this, contacts, contacts_list, null) { ContactsAdapter(this, contacts, contacts_list) {
hideKeyboard() hideKeyboard()
val contact = it as SimpleContact val contact = it as SimpleContact
val phoneNumbers = contact.phoneNumbers val phoneNumbers = contact.phoneNumbers

View file

@ -277,7 +277,7 @@ class ThreadActivity : SimpleActivity() {
runOnUiThread { runOnUiThread {
val currAdapter = thread_messages_list.adapter val currAdapter = thread_messages_list.adapter
if (currAdapter == null) { if (currAdapter == null) {
ThreadAdapter(this, threadItems, thread_messages_list, thread_messages_fastscroller) { ThreadAdapter(this, threadItems, thread_messages_list) {
(it as? ThreadError)?.apply { (it as? ThreadError)?.apply {
thread_type_message.setText(it.messageText) thread_type_message.setText(it.messageText)
} }

View file

@ -11,16 +11,14 @@ import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
import com.simplemobiletools.commons.extensions.getTextSize import com.simplemobiletools.commons.extensions.getTextSize
import com.simplemobiletools.commons.helpers.SimpleContactsHelper import com.simplemobiletools.commons.helpers.SimpleContactsHelper
import com.simplemobiletools.commons.models.SimpleContact import com.simplemobiletools.commons.models.SimpleContact
import com.simplemobiletools.commons.views.FastScroller
import com.simplemobiletools.commons.views.MyRecyclerView import com.simplemobiletools.commons.views.MyRecyclerView
import com.simplemobiletools.smsmessenger.R import com.simplemobiletools.smsmessenger.R
import com.simplemobiletools.smsmessenger.activities.SimpleActivity import com.simplemobiletools.smsmessenger.activities.SimpleActivity
import java.util.* import java.util.*
class ContactsAdapter( class ContactsAdapter(
activity: SimpleActivity, var contacts: ArrayList<SimpleContact>, recyclerView: MyRecyclerView, fastScroller: FastScroller?, activity: SimpleActivity, var contacts: ArrayList<SimpleContact>, recyclerView: MyRecyclerView, itemClick: (Any) -> Unit
itemClick: (Any) -> Unit ) : MyRecyclerViewAdapter(activity, recyclerView, itemClick) {
) : MyRecyclerViewAdapter(activity, recyclerView, fastScroller, itemClick) {
private var fontSize = activity.getTextSize() private var fontSize = activity.getTextSize()
override fun getActionMenuId() = 0 override fun getActionMenuId() = 0

View file

@ -27,7 +27,7 @@ import kotlinx.android.synthetic.main.item_conversation.view.*
class ConversationsAdapter( class ConversationsAdapter(
activity: SimpleActivity, var conversations: ArrayList<Conversation>, recyclerView: MyRecyclerView, itemClick: (Any) -> Unit activity: SimpleActivity, var conversations: ArrayList<Conversation>, recyclerView: MyRecyclerView, itemClick: (Any) -> Unit
) : MyRecyclerViewAdapter(activity, recyclerView, null, itemClick), RecyclerViewFastScroller.OnPopupTextUpdate { ) : MyRecyclerViewAdapter(activity, recyclerView, itemClick), RecyclerViewFastScroller.OnPopupTextUpdate {
private var fontSize = activity.getTextSize() private var fontSize = activity.getTextSize()
private var drafts = HashMap<Long, String?>() private var drafts = HashMap<Long, String?>()

View file

@ -18,7 +18,7 @@ import java.util.*
class SearchResultsAdapter( class SearchResultsAdapter(
activity: SimpleActivity, var searchResults: ArrayList<SearchResult>, recyclerView: MyRecyclerView, highlightText: String, itemClick: (Any) -> Unit activity: SimpleActivity, var searchResults: ArrayList<SearchResult>, recyclerView: MyRecyclerView, highlightText: String, itemClick: (Any) -> Unit
) : MyRecyclerViewAdapter(activity, recyclerView, null, itemClick) { ) : MyRecyclerViewAdapter(activity, recyclerView, itemClick) {
private var fontSize = activity.getTextSize() private var fontSize = activity.getTextSize()
private var textToHighlight = highlightText private var textToHighlight = highlightText

View file

@ -26,7 +26,6 @@ import com.simplemobiletools.commons.dialogs.ConfirmationDialog
import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.SimpleContactsHelper import com.simplemobiletools.commons.helpers.SimpleContactsHelper
import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.commons.views.FastScroller
import com.simplemobiletools.commons.views.MyRecyclerView import com.simplemobiletools.commons.views.MyRecyclerView
import com.simplemobiletools.smsmessenger.R import com.simplemobiletools.smsmessenger.R
import com.simplemobiletools.smsmessenger.activities.SimpleActivity import com.simplemobiletools.smsmessenger.activities.SimpleActivity
@ -45,9 +44,8 @@ import kotlinx.android.synthetic.main.item_thread_sending.view.*
import kotlinx.android.synthetic.main.item_thread_success.view.* import kotlinx.android.synthetic.main.item_thread_success.view.*
class ThreadAdapter( class ThreadAdapter(
activity: SimpleActivity, var messages: ArrayList<ThreadItem>, recyclerView: MyRecyclerView, fastScroller: FastScroller, activity: SimpleActivity, var messages: ArrayList<ThreadItem>, recyclerView: MyRecyclerView, itemClick: (Any) -> Unit
itemClick: (Any) -> Unit ) : MyRecyclerViewAdapter(activity, recyclerView, itemClick) {
) : MyRecyclerViewAdapter(activity, recyclerView, fastScroller, itemClick) {
private val roundedCornersRadius = resources.getDimension(R.dimen.normal_margin).toInt() private val roundedCornersRadius = resources.getDimension(R.dimen.normal_margin).toInt()
private var fontSize = activity.getTextSize() private var fontSize = activity.getTextSize()
@ -227,7 +225,10 @@ class ThreadAdapter(
thread_message_sender_photo.beVisible() thread_message_sender_photo.beVisible()
thread_message_body.setTextColor(textColor) thread_message_body.setTextColor(textColor)
thread_message_body.setLinkTextColor(context.getAdjustedPrimaryColor()) thread_message_body.setLinkTextColor(context.getAdjustedPrimaryColor())
SimpleContactsHelper(context).loadContactImage(message.senderPhotoUri, thread_message_sender_photo, message.senderName)
if (!activity.isFinishing && !activity.isDestroyed) {
SimpleContactsHelper(context).loadContactImage(message.senderPhotoUri, thread_message_sender_photo, message.senderName)
}
} else { } else {
thread_message_sender_photo?.beGone() thread_message_sender_photo?.beGone()
val background = context.getAdjustedPrimaryColor() val background = context.getAdjustedPrimaryColor()

View file

@ -81,32 +81,25 @@
android:importantForAccessibility="no" /> android:importantForAccessibility="no" />
</RelativeLayout> </RelativeLayout>
<com.simplemobiletools.commons.views.MyRecyclerView <com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller
android:id="@+id/thread_messages_list" android:id="@+id/thread_messages_fastscroller"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:layout_above="@+id/message_divider" android:layout_above="@+id/message_divider"
android:layout_below="@+id/thread_add_contacts" android:layout_below="@+id/thread_add_contacts"
android:clipToPadding="false" app:supportSwipeToRefresh="true">
android:overScrollMode="ifContentScrolls"
android:paddingTop="@dimen/activity_margin"
android:paddingBottom="@dimen/activity_margin"
android:scrollbars="none"
app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager"
app:stackFromEnd="true" />
<com.simplemobiletools.commons.views.FastScroller <com.simplemobiletools.commons.views.MyRecyclerView
android:id="@+id/thread_messages_fastscroller" android:id="@+id/thread_messages_list"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_alignTop="@+id/thread_messages_list" android:clipToPadding="false"
android:layout_alignBottom="@+id/thread_messages_list" android:overScrollMode="ifContentScrolls"
android:layout_alignParentEnd="true" android:scrollbars="none"
android:paddingStart="@dimen/normal_margin"> app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager"
app:stackFromEnd="true" />
<include layout="@layout/fastscroller_handle_vertical" /> </com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller>
</com.simplemobiletools.commons.views.FastScroller>
<View <View
android:id="@+id/message_divider" android:id="@+id/message_divider"