From 9ba87d4d21a58f49e1ea208e1bac8584a6e0a515 Mon Sep 17 00:00:00 2001 From: Mariotaku Lee Date: Tue, 6 Dec 2016 11:19:14 +0800 Subject: [PATCH] code cleanup --- .../twidere/adapter/MessageEntriesAdapter.kt | 38 ++++--------------- .../twidere/extension/AccountExtensions.kt | 2 +- 2 files changed, 9 insertions(+), 31 deletions(-) diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/adapter/MessageEntriesAdapter.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/adapter/MessageEntriesAdapter.kt index 238211031..1d07f7ba2 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/adapter/MessageEntriesAdapter.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/adapter/MessageEntriesAdapter.kt @@ -24,10 +24,7 @@ import android.content.SharedPreferences.OnSharedPreferenceChangeListener import android.database.Cursor import android.support.v7.widget.RecyclerView.ViewHolder import android.view.LayoutInflater -import android.view.View -import android.view.View.OnClickListener import android.view.ViewGroup -import org.mariotaku.twidere.Constants import org.mariotaku.twidere.R import org.mariotaku.twidere.adapter.iface.IContentCardAdapter import org.mariotaku.twidere.adapter.iface.ILoadMoreSupportAdapter @@ -41,7 +38,8 @@ import org.mariotaku.twidere.util.Utils import org.mariotaku.twidere.view.holder.LoadIndicatorViewHolder import org.mariotaku.twidere.view.holder.MessageEntryViewHolder -class MessageEntriesAdapter(context: Context) : LoadMoreSupportAdapter(context), Constants, IContentCardAdapter, OnClickListener, OnReadStateChangeListener { +class MessageEntriesAdapter(context: Context) : LoadMoreSupportAdapter(context), + IContentCardAdapter, OnReadStateChangeListener { private val inflater: LayoutInflater override val textSize: Float @@ -54,7 +52,7 @@ class MessageEntriesAdapter(context: Context) : LoadMoreSupportAdapter? = null + private var positionPairs: Array? = null init { inflater = LayoutInflater.from(context) @@ -73,24 +71,6 @@ class MessageEntriesAdapter(context: Context) : LoadMoreSupportAdapter { @@ -162,7 +142,7 @@ class MessageEntriesAdapter(context: Context) : LoadMoreSupportAdapter pair.value - } - return true + val match = positionPairs.find { key == it.key } ?: return true + return messageId > match.value } fun setShowAccountsColor(showAccountsColor: Boolean) { @@ -209,7 +187,7 @@ class MessageEntriesAdapter(context: Context) : LoadMoreSupportAdapter