refactored adapter interface
This commit is contained in:
parent
fe1b5ae3c7
commit
5d4c600392
|
@ -40,7 +40,6 @@ import org.mariotaku.twidere.util.ThemeUtils;
|
|||
import org.mariotaku.twidere.util.TwidereLinkify;
|
||||
import org.mariotaku.twidere.util.Utils;
|
||||
import org.mariotaku.twidere.view.CardMediaContainer;
|
||||
import org.mariotaku.twidere.view.ShapedImageView;
|
||||
import org.mariotaku.twidere.view.holder.IncomingMessageViewHolder;
|
||||
import org.mariotaku.twidere.view.holder.MessageViewHolder;
|
||||
|
||||
|
@ -53,15 +52,11 @@ public class MessageConversationAdapter extends BaseRecyclerViewAdapter<ViewHold
|
|||
private static final int ITEM_VIEW_TYPE_MESSAGE_INCOMING = 2;
|
||||
private final int mOutgoingMessageColor;
|
||||
private final int mIncomingMessageColor;
|
||||
private final boolean mDisplayProfileImage;
|
||||
|
||||
@ShapedImageView.ShapeStyle
|
||||
private final int mProfileImageStyle;
|
||||
private final int mMediaPreviewStyle;
|
||||
|
||||
private final LayoutInflater mInflater;
|
||||
private final MediaLoadingHandler mMediaLoadingHandler;
|
||||
private final int mTextSize;
|
||||
|
||||
private Cursor mCursor;
|
||||
private ParcelableDirectMessageCursorIndices mIndices;
|
||||
|
@ -72,9 +67,6 @@ public class MessageConversationAdapter extends BaseRecyclerViewAdapter<ViewHold
|
|||
super(context);
|
||||
mInflater = LayoutInflater.from(context);
|
||||
mLinkify = new TwidereLinkify(new DirectMessageOnLinkClickHandler(context, null, preferences));
|
||||
mTextSize = preferences.getInt(KEY_TEXT_SIZE, context.getResources().getInteger(R.integer.default_text_size));
|
||||
mDisplayProfileImage = preferences.getBoolean(KEY_DISPLAY_PROFILE_IMAGE, true);
|
||||
mProfileImageStyle = Utils.getProfileImageStyle(preferences.getString(KEY_PROFILE_IMAGE_STYLE, null));
|
||||
mMediaPreviewStyle = Utils.getMediaPreviewStyle(preferences.getString(KEY_MEDIA_PREVIEW_STYLE, null));
|
||||
mMediaLoadingHandler = new MediaLoadingHandler(R.id.media_preview_progress);
|
||||
mIncomingMessageColor = ThemeUtils.getUserAccentColor(context);
|
||||
|
@ -154,16 +146,6 @@ public class MessageConversationAdapter extends BaseRecyclerViewAdapter<ViewHold
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getProfileImageStyle() {
|
||||
return mProfileImageStyle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getProfileImageEnabled() {
|
||||
return mDisplayProfileImage;
|
||||
}
|
||||
|
||||
public ParcelableDirectMessage getDirectMessage(final int position) {
|
||||
final Cursor c = mCursor;
|
||||
if (c == null || c.isClosed()) return null;
|
||||
|
@ -192,10 +174,6 @@ public class MessageConversationAdapter extends BaseRecyclerViewAdapter<ViewHold
|
|||
return mEventListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTextSize() {
|
||||
return mTextSize;
|
||||
}
|
||||
|
||||
static class EventListener implements CardMediaContainer.OnMediaClickListener {
|
||||
|
||||
|
|
|
@ -100,7 +100,6 @@ import org.mariotaku.sqliteqb.library.Selectable;
|
|||
import org.mariotaku.twidere.BuildConfig;
|
||||
import org.mariotaku.twidere.Constants;
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.adapter.iface.IBaseAdapter;
|
||||
import org.mariotaku.twidere.annotation.CustomTabType;
|
||||
import org.mariotaku.twidere.extension.model.AccountDetailsExtensionsKt;
|
||||
import org.mariotaku.twidere.graphic.PaddingDrawable;
|
||||
|
@ -320,16 +319,6 @@ public final class Utils implements Constants {
|
|||
return true;
|
||||
}
|
||||
|
||||
public static void configBaseAdapter(final Context context, final IBaseAdapter adapter) {
|
||||
if (context == null) return;
|
||||
final SharedPreferences pref = context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
adapter.setProfileImageDisplayed(pref.getBoolean(KEY_DISPLAY_PROFILE_IMAGE, true));
|
||||
adapter.setDisplayNameFirst(pref.getBoolean(KEY_NAME_FIRST, true));
|
||||
adapter.setLinkHighlightOption(pref.getString(KEY_LINK_HIGHLIGHT_OPTION, VALUE_LINK_HIGHLIGHT_OPTION_NONE));
|
||||
adapter.setTextSize(pref.getInt(KEY_TEXT_SIZE, getDefaultTextSize(context)));
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public static int[] getAccountColors(@Nullable final AccountDetails[] accounts) {
|
||||
if (accounts == null) return null;
|
||||
final int[] colors = new int[accounts.length];
|
||||
|
|
|
@ -68,7 +68,7 @@ public class GroupViewHolder extends ViewHolder implements View.OnClickListener,
|
|||
}
|
||||
|
||||
public void displayGroup(ParcelableGroup group) {
|
||||
final Context context = adapter.getContext();
|
||||
final Context context = itemView.getContext();
|
||||
final MediaLoaderWrapper loader = adapter.getMediaLoader();
|
||||
final BidiFormatter formatter = adapter.getBidiFormatter();
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ public class UserListViewHolder extends ViewHolder implements View.OnClickListen
|
|||
|
||||
public void displayUserList(ParcelableUserList userList) {
|
||||
|
||||
final Context context = adapter.getContext();
|
||||
final Context context = itemView.getContext();
|
||||
final MediaLoaderWrapper loader = adapter.getMediaLoader();
|
||||
final UserColorNameManager manager = adapter.getUserColorNameManager();
|
||||
|
||||
|
|
|
@ -93,7 +93,6 @@ class AccountSelectorActivity : BaseActivity(), OnClickListener, OnItemClickList
|
|||
adapter = AccountDetailsAdapter(this).apply {
|
||||
setSwitchEnabled(!isSingleSelection)
|
||||
setSortEnabled(false)
|
||||
isProfileImageDisplayed = preferences.getBoolean(KEY_DISPLAY_PROFILE_IMAGE, true)
|
||||
val am = AccountManager.get(context)
|
||||
val allAccountDetails = AccountUtils.getAllAccountDetails(am, AccountUtils.getAccounts(am), false)
|
||||
val extraKeys = keysWhiteList
|
||||
|
|
|
@ -1403,17 +1403,14 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
|
|||
}
|
||||
|
||||
internal class AccountIconsAdapter(private val activity: ComposeActivity) : BaseRecyclerViewAdapter<AccountIconViewHolder>(activity) {
|
||||
private val mInflater: LayoutInflater
|
||||
private val selection: MutableMap<UserKey, Boolean>
|
||||
val isNameFirst: Boolean
|
||||
private val inflater: LayoutInflater = activity.layoutInflater
|
||||
private val selection: MutableMap<UserKey, Boolean> = HashMap()
|
||||
val isNameFirst: Boolean = preferences[nameFirstKey]
|
||||
|
||||
private var accounts: Array<AccountDetails>? = null
|
||||
|
||||
init {
|
||||
setHasStableIds(true)
|
||||
mInflater = activity.layoutInflater
|
||||
selection = HashMap<UserKey, Boolean>()
|
||||
isNameFirst = preferences[nameFirstKey]
|
||||
}
|
||||
|
||||
val imageLoader: MediaLoaderWrapper
|
||||
|
@ -1449,7 +1446,7 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
|
|||
get() = selectedAccountKeys.isEmpty()
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AccountIconViewHolder {
|
||||
val view = mInflater.inflate(R.layout.adapter_item_compose_account, parent, false)
|
||||
val view = inflater.inflate(R.layout.adapter_item_compose_account, parent, false)
|
||||
return AccountIconViewHolder(this, view)
|
||||
}
|
||||
|
||||
|
|
|
@ -24,30 +24,14 @@ import android.view.View
|
|||
import android.view.ViewGroup
|
||||
import android.widget.CompoundButton
|
||||
import org.mariotaku.twidere.R
|
||||
import org.mariotaku.twidere.adapter.iface.IBaseAdapter
|
||||
import org.mariotaku.twidere.model.AccountDetails
|
||||
import org.mariotaku.twidere.model.UserKey
|
||||
import org.mariotaku.twidere.model.util.AccountUtils
|
||||
import org.mariotaku.twidere.util.MediaLoaderWrapper
|
||||
import org.mariotaku.twidere.util.dagger.GeneralComponentHelper
|
||||
import org.mariotaku.twidere.view.holder.AccountViewHolder
|
||||
import javax.inject.Inject
|
||||
|
||||
class AccountDetailsAdapter(context: Context) : ArrayAdapter<AccountDetails>(context, R.layout.list_item_account), IBaseAdapter {
|
||||
class AccountDetailsAdapter(context: Context) : BaseArrayAdapter<AccountDetails>(context, R.layout.list_item_account) {
|
||||
|
||||
@Inject
|
||||
lateinit override var mediaLoader: MediaLoaderWrapper
|
||||
|
||||
override val linkHighlightOption: Int
|
||||
get() = 0
|
||||
|
||||
override var textSize: Float = 0f
|
||||
|
||||
override var isDisplayNameFirst: Boolean = true
|
||||
|
||||
override var isShowAccountColor: Boolean = true
|
||||
|
||||
override var isProfileImageDisplayed: Boolean = false
|
||||
private var sortEnabled: Boolean = false
|
||||
private var switchEnabled: Boolean = false
|
||||
var accountToggleListener: ((Int, Boolean) -> Unit)? = null
|
||||
|
@ -72,7 +56,7 @@ class AccountDetailsAdapter(context: Context) : ArrayAdapter<AccountDetails>(con
|
|||
holder.name.text = details.user.name
|
||||
holder.screenName.text = String.format("@%s", details.user.screen_name)
|
||||
holder.setAccountColor(details.color)
|
||||
if (isProfileImageDisplayed) {
|
||||
if (profileImageEnabled) {
|
||||
mediaLoader.displayProfileImage(holder.profileImage, details.user)
|
||||
} else {
|
||||
mediaLoader.cancelDisplayTask(holder.profileImage)
|
||||
|
@ -87,11 +71,6 @@ class AccountDetailsAdapter(context: Context) : ArrayAdapter<AccountDetails>(con
|
|||
return view
|
||||
}
|
||||
|
||||
override fun setLinkHighlightOption(option: String) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
override fun hasStableIds(): Boolean {
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -20,60 +20,52 @@
|
|||
package org.mariotaku.twidere.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.content.SharedPreferences.OnSharedPreferenceChangeListener
|
||||
import org.mariotaku.twidere.Constants
|
||||
import org.mariotaku.twidere.TwidereConstants.*
|
||||
import org.mariotaku.twidere.adapter.iface.IBaseAdapter
|
||||
import android.support.v4.text.BidiFormatter
|
||||
import org.mariotaku.kpreferences.get
|
||||
import org.mariotaku.twidere.adapter.iface.IContentAdapter
|
||||
import org.mariotaku.twidere.constant.*
|
||||
import org.mariotaku.twidere.util.*
|
||||
import org.mariotaku.twidere.util.dagger.GeneralComponentHelper
|
||||
import javax.inject.Inject
|
||||
|
||||
open class BaseArrayAdapter<T> @JvmOverloads constructor(context: Context, layoutRes: Int, collection: Collection<T>? = null) : ArrayAdapter<T>(context, layoutRes, collection), Constants, IBaseAdapter, OnSharedPreferenceChangeListener {
|
||||
|
||||
open class BaseArrayAdapter<T>(
|
||||
context: Context,
|
||||
layoutRes: Int,
|
||||
collection: Collection<T>? = null
|
||||
) : ArrayAdapter<T>(context, layoutRes, collection), IContentAdapter {
|
||||
val linkify: TwidereLinkify
|
||||
|
||||
@Inject
|
||||
lateinit var userColorNameManager: UserColorNameManager
|
||||
override lateinit var userColorNameManager: UserColorNameManager
|
||||
@Inject
|
||||
lateinit override var mediaLoader: MediaLoaderWrapper
|
||||
override lateinit var mediaLoader: MediaLoaderWrapper
|
||||
@Inject
|
||||
override lateinit var bidiFormatter: BidiFormatter
|
||||
@Inject
|
||||
override lateinit var twitterWrapper: AsyncTwitterWrapper
|
||||
@Inject
|
||||
lateinit var multiSelectManager: MultiSelectManager
|
||||
@Inject
|
||||
lateinit var preferences: SharedPreferencesWrapper
|
||||
|
||||
private val nicknamePrefs: SharedPreferences
|
||||
private val colorPrefs: SharedPreferences
|
||||
|
||||
override var textSize: Float = 0f
|
||||
override var linkHighlightOption: Int = 0
|
||||
|
||||
override var isProfileImageDisplayed: Boolean = false
|
||||
override var isDisplayNameFirst: Boolean = false
|
||||
override var isShowAccountColor: Boolean = false
|
||||
override val profileImageStyle: Int
|
||||
override val textSize: Float
|
||||
override val profileImageEnabled: Boolean
|
||||
override val isShowAbsoluteTime: Boolean
|
||||
val nameFirst: Boolean
|
||||
|
||||
init {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
GeneralComponentHelper.build(context).inject(this as BaseArrayAdapter<Any>)
|
||||
linkify = TwidereLinkify(OnLinkClickHandler(context, multiSelectManager, preferences))
|
||||
nicknamePrefs = context.getSharedPreferences(USER_NICKNAME_PREFERENCES_NAME, Context.MODE_PRIVATE)
|
||||
colorPrefs = context.getSharedPreferences(USER_COLOR_PREFERENCES_NAME, Context.MODE_PRIVATE)
|
||||
nicknamePrefs.registerOnSharedPreferenceChangeListener(this)
|
||||
colorPrefs.registerOnSharedPreferenceChangeListener(this)
|
||||
profileImageStyle = preferences[profileImageStyleKey]
|
||||
textSize = preferences[textSizeKey].toFloat()
|
||||
profileImageEnabled = preferences[displayProfileImageKey]
|
||||
isShowAbsoluteTime = preferences[showAbsoluteTimeKey]
|
||||
nameFirst = preferences[nameFirstKey]
|
||||
}
|
||||
|
||||
override fun onSharedPreferenceChanged(preferences: SharedPreferences, key: String) {
|
||||
when (key) {
|
||||
KEY_DISPLAY_PROFILE_IMAGE, KEY_MEDIA_PREVIEW_STYLE, KEY_DISPLAY_SENSITIVE_CONTENTS -> {
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
}
|
||||
override fun getItemCount(): Int = count
|
||||
|
||||
override fun setLinkHighlightOption(option: String) {
|
||||
val optionInt = Utils.getLinkHighlightingStyleInt(option)
|
||||
linkify.setHighlightOption(optionInt)
|
||||
if (optionInt == linkHighlightOption) return
|
||||
linkHighlightOption = optionInt
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,6 +22,12 @@ package org.mariotaku.twidere.adapter
|
|||
import android.content.Context
|
||||
import android.support.v4.text.BidiFormatter
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import org.mariotaku.kpreferences.get
|
||||
import org.mariotaku.twidere.adapter.iface.IContentAdapter
|
||||
import org.mariotaku.twidere.constant.displayProfileImageKey
|
||||
import org.mariotaku.twidere.constant.profileImageStyleKey
|
||||
import org.mariotaku.twidere.constant.showAbsoluteTimeKey
|
||||
import org.mariotaku.twidere.constant.textSizeKey
|
||||
import org.mariotaku.twidere.util.*
|
||||
import org.mariotaku.twidere.util.dagger.GeneralComponentHelper
|
||||
import javax.inject.Inject
|
||||
|
@ -31,25 +37,34 @@ import javax.inject.Inject
|
|||
*/
|
||||
abstract class BaseRecyclerViewAdapter<VH : RecyclerView.ViewHolder>(
|
||||
val context: Context
|
||||
) : RecyclerView.Adapter<VH>() {
|
||||
) : RecyclerView.Adapter<VH>(), IContentAdapter {
|
||||
@Inject
|
||||
lateinit var twitterWrapper: AsyncTwitterWrapper
|
||||
override final lateinit var twitterWrapper: AsyncTwitterWrapper
|
||||
@Inject
|
||||
lateinit var readStateManager: ReadStateManager
|
||||
override final lateinit var mediaLoader: MediaLoaderWrapper
|
||||
@Inject
|
||||
lateinit var mediaLoader: MediaLoaderWrapper
|
||||
@Inject
|
||||
lateinit var multiSelectManager: MultiSelectManager
|
||||
@Inject
|
||||
lateinit var userColorNameManager: UserColorNameManager
|
||||
override final lateinit var userColorNameManager: UserColorNameManager
|
||||
@Inject
|
||||
lateinit var preferences: SharedPreferencesWrapper
|
||||
@Inject
|
||||
lateinit var bidiFormatter: BidiFormatter
|
||||
lateinit var readStateManager: ReadStateManager
|
||||
@Inject
|
||||
lateinit var multiSelectManager: MultiSelectManager
|
||||
@Inject
|
||||
override final lateinit var bidiFormatter: BidiFormatter
|
||||
|
||||
override final val profileImageStyle: Int
|
||||
override final val textSize: Float
|
||||
override final val profileImageEnabled: Boolean
|
||||
override final val isShowAbsoluteTime: Boolean
|
||||
|
||||
init {
|
||||
//noinspection unchecked
|
||||
GeneralComponentHelper.build(context).inject(this as BaseRecyclerViewAdapter<RecyclerView.ViewHolder>)
|
||||
profileImageStyle = preferences[profileImageStyleKey]
|
||||
textSize = preferences[textSizeKey].toFloat()
|
||||
profileImageEnabled = preferences[displayProfileImageKey]
|
||||
isShowAbsoluteTime = preferences[showAbsoluteTimeKey]
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,9 +4,10 @@ import android.content.Context
|
|||
import android.support.v4.text.BidiFormatter
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import org.mariotaku.twidere.R
|
||||
import org.mariotaku.twidere.TwidereConstants
|
||||
import org.mariotaku.twidere.adapter.iface.*
|
||||
import org.mariotaku.twidere.adapter.iface.ILoadMoreSupportAdapter.IndicatorPosition
|
||||
import org.mariotaku.twidere.adapter.iface.IGapSupportedAdapter
|
||||
import org.mariotaku.twidere.adapter.iface.IStatusesAdapter
|
||||
import org.mariotaku.twidere.adapter.iface.IUserListsAdapter
|
||||
import org.mariotaku.twidere.adapter.iface.IUsersAdapter
|
||||
import org.mariotaku.twidere.constant.SharedPreferenceConstants
|
||||
import org.mariotaku.twidere.model.*
|
||||
import org.mariotaku.twidere.model.util.getActivityStatus
|
||||
|
@ -19,13 +20,13 @@ import javax.inject.Inject
|
|||
* Created by mariotaku on 16/1/22.
|
||||
*/
|
||||
class DummyItemAdapter @JvmOverloads constructor(
|
||||
override val context: Context,
|
||||
val context: Context,
|
||||
override val twidereLinkify: TwidereLinkify = TwidereLinkify(null),
|
||||
private val adapter: RecyclerView.Adapter<out RecyclerView.ViewHolder>? = null
|
||||
) : IStatusesAdapter<Any>, IUsersAdapter<Any>, IUserListsAdapter<Any>, SharedPreferenceConstants {
|
||||
) : IStatusesAdapter<Any>, IUsersAdapter<Any>, IUserListsAdapter<Any> {
|
||||
|
||||
private val preferences: SharedPreferencesWrapper
|
||||
override val mediaLoadingHandler: MediaLoadingHandler
|
||||
@Inject
|
||||
lateinit var preferences: SharedPreferencesWrapper
|
||||
@Inject
|
||||
override lateinit var mediaLoader: MediaLoaderWrapper
|
||||
@Inject
|
||||
|
@ -34,6 +35,7 @@ class DummyItemAdapter @JvmOverloads constructor(
|
|||
override lateinit var userColorNameManager: UserColorNameManager
|
||||
@Inject
|
||||
override lateinit var bidiFormatter: BidiFormatter
|
||||
override val mediaLoadingHandler: MediaLoadingHandler = MediaLoadingHandler(R.id.media_preview_progress)
|
||||
|
||||
override var profileImageStyle: Int = 0
|
||||
override var mediaPreviewStyle: Int = 0
|
||||
|
@ -57,8 +59,6 @@ class DummyItemAdapter @JvmOverloads constructor(
|
|||
|
||||
init {
|
||||
GeneralComponentHelper.build(context).inject(this)
|
||||
preferences = SharedPreferencesWrapper.getInstance(context, TwidereConstants.SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE)
|
||||
mediaLoadingHandler = MediaLoadingHandler(R.id.media_preview_progress)
|
||||
updateOptions()
|
||||
}
|
||||
|
||||
|
@ -71,20 +71,6 @@ class DummyItemAdapter @JvmOverloads constructor(
|
|||
return 0
|
||||
}
|
||||
|
||||
override var loadMoreIndicatorPosition: Long
|
||||
@IndicatorPosition
|
||||
get() = ILoadMoreSupportAdapter.NONE
|
||||
set(@IndicatorPosition position) {
|
||||
|
||||
}
|
||||
|
||||
override var loadMoreSupportedPosition: Long
|
||||
@IndicatorPosition
|
||||
get() = ILoadMoreSupportAdapter.NONE
|
||||
set(@IndicatorPosition supported) {
|
||||
|
||||
}
|
||||
|
||||
override fun getStatus(position: Int): ParcelableStatus? {
|
||||
if (adapter is ParcelableStatusesAdapter) {
|
||||
return adapter.getStatus(position)
|
||||
|
|
|
@ -25,48 +25,39 @@ import android.database.Cursor
|
|||
import android.support.v7.widget.RecyclerView.ViewHolder
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import org.mariotaku.kpreferences.get
|
||||
import org.mariotaku.twidere.R
|
||||
import org.mariotaku.twidere.adapter.iface.IContentCardAdapter
|
||||
import org.mariotaku.twidere.adapter.iface.IContentAdapter
|
||||
import org.mariotaku.twidere.adapter.iface.ILoadMoreSupportAdapter
|
||||
import org.mariotaku.twidere.annotation.CustomTabType
|
||||
import org.mariotaku.twidere.constant.SharedPreferenceConstants
|
||||
import org.mariotaku.twidere.constant.mediaPreviewStyleKey
|
||||
import org.mariotaku.twidere.model.StringLongPair
|
||||
import org.mariotaku.twidere.model.UserKey
|
||||
import org.mariotaku.twidere.provider.TwidereDataStore.DirectMessages.ConversationEntries
|
||||
import org.mariotaku.twidere.util.ReadStateManager.OnReadStateChangeListener
|
||||
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<ViewHolder>(context),
|
||||
IContentCardAdapter, OnReadStateChangeListener {
|
||||
IContentAdapter, OnReadStateChangeListener {
|
||||
|
||||
private val inflater: LayoutInflater
|
||||
override val textSize: Float
|
||||
override val profileImageStyle: Int
|
||||
private val mMediaPreviewStyle: Int
|
||||
override val profileImageEnabled: Boolean
|
||||
override val isShowAbsoluteTime: Boolean
|
||||
private val inflater: LayoutInflater = LayoutInflater.from(context)
|
||||
private val mediaPreviewStyle: Int
|
||||
|
||||
private val mReadStateChangeListener: OnSharedPreferenceChangeListener
|
||||
private var mShowAccountsColor: Boolean = false
|
||||
private var mCursor: Cursor? = null
|
||||
private val readStateChangeListener: OnSharedPreferenceChangeListener
|
||||
private var showAccountsColor: Boolean = false
|
||||
private var cursor: Cursor? = null
|
||||
var listener: MessageEntriesAdapterListener? = null
|
||||
private var positionPairs: Array<StringLongPair>? = null
|
||||
|
||||
init {
|
||||
inflater = LayoutInflater.from(context)
|
||||
profileImageStyle = Utils.getProfileImageStyle(preferences.getString(SharedPreferenceConstants.KEY_PROFILE_IMAGE_STYLE, null))
|
||||
mMediaPreviewStyle = Utils.getMediaPreviewStyle(preferences.getString(SharedPreferenceConstants.KEY_MEDIA_PREVIEW_STYLE, null))
|
||||
profileImageEnabled = preferences.getBoolean(SharedPreferenceConstants.KEY_DISPLAY_PROFILE_IMAGE, true)
|
||||
textSize = preferences.getInt(SharedPreferenceConstants.KEY_TEXT_SIZE, context.resources.getInteger(R.integer.default_text_size)).toFloat()
|
||||
isShowAbsoluteTime = preferences.getBoolean(SharedPreferenceConstants.KEY_SHOW_ABSOLUTE_TIME, false)
|
||||
mReadStateChangeListener = OnSharedPreferenceChangeListener { sharedPreferences, key -> updateReadState() }
|
||||
mediaPreviewStyle = preferences[mediaPreviewStyleKey]
|
||||
readStateChangeListener = OnSharedPreferenceChangeListener { sharedPreferences, key -> updateReadState() }
|
||||
}
|
||||
|
||||
|
||||
fun getEntry(position: Int): DirectMessageEntry? {
|
||||
val c = mCursor
|
||||
val c = cursor
|
||||
if (c == null || c.isClosed || !c.moveToPosition(position)) return null
|
||||
return DirectMessageEntry(c)
|
||||
}
|
||||
|
@ -88,7 +79,7 @@ class MessageEntriesAdapter(context: Context) : LoadMoreSupportAdapter<ViewHolde
|
|||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
when (holder.itemViewType) {
|
||||
ITEM_VIEW_TYPE_MESSAGE -> {
|
||||
val c = mCursor
|
||||
val c = cursor
|
||||
c!!.moveToPosition(position)
|
||||
(holder as MessageEntryViewHolder).displayMessage(c, isUnread(c))
|
||||
}
|
||||
|
@ -131,11 +122,11 @@ class MessageEntriesAdapter(context: Context) : LoadMoreSupportAdapter<ViewHolde
|
|||
}
|
||||
|
||||
fun setCursor(cursor: Cursor?) {
|
||||
mCursor = cursor
|
||||
readStateManager.unregisterOnSharedPreferenceChangeListener(mReadStateChangeListener)
|
||||
this.cursor = cursor
|
||||
readStateManager.unregisterOnSharedPreferenceChangeListener(readStateChangeListener)
|
||||
if (cursor != null) {
|
||||
updateReadState()
|
||||
readStateManager.registerOnSharedPreferenceChangeListener(mReadStateChangeListener)
|
||||
readStateManager.registerOnSharedPreferenceChangeListener(readStateChangeListener)
|
||||
}
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
@ -148,7 +139,7 @@ class MessageEntriesAdapter(context: Context) : LoadMoreSupportAdapter<ViewHolde
|
|||
|
||||
private val messagesCount: Int
|
||||
get() {
|
||||
val c = mCursor
|
||||
val c = cursor
|
||||
if (c == null || c.isClosed) return 0
|
||||
return c.count
|
||||
}
|
||||
|
@ -164,13 +155,13 @@ class MessageEntriesAdapter(context: Context) : LoadMoreSupportAdapter<ViewHolde
|
|||
}
|
||||
|
||||
fun setShowAccountsColor(showAccountsColor: Boolean) {
|
||||
if (mShowAccountsColor == showAccountsColor) return
|
||||
mShowAccountsColor = showAccountsColor
|
||||
if (this.showAccountsColor == showAccountsColor) return
|
||||
this.showAccountsColor = showAccountsColor
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
fun shouldShowAccountsColor(): Boolean {
|
||||
return mShowAccountsColor
|
||||
return showAccountsColor
|
||||
}
|
||||
|
||||
interface MessageEntriesAdapterListener {
|
||||
|
|
|
@ -55,8 +55,7 @@ import java.util.*
|
|||
* Created by mariotaku on 15/1/3.
|
||||
*/
|
||||
class ParcelableActivitiesAdapter(
|
||||
context: Context,
|
||||
private val byFriends: Boolean
|
||||
context: Context
|
||||
) : LoadMoreSupportAdapter<RecyclerView.ViewHolder>(context), IActivitiesAdapter<List<ParcelableActivity>> {
|
||||
|
||||
private val inflater: LayoutInflater
|
||||
|
@ -181,24 +180,12 @@ class ParcelableActivitiesAdapter(
|
|||
override val gapClickListener: IGapSupportedAdapter.GapClickListener?
|
||||
get() = eventListener
|
||||
|
||||
override val profileImageStyle: Int
|
||||
get() = statusAdapterDelegate.profileImageStyle
|
||||
|
||||
override val mediaPreviewStyle: Int
|
||||
get() = statusAdapterDelegate.mediaPreviewStyle
|
||||
|
||||
override val textSize: Float
|
||||
get() = statusAdapterDelegate.textSize
|
||||
|
||||
val isNameFirst: Boolean
|
||||
get() = statusAdapterDelegate.nameFirst
|
||||
|
||||
override val profileImageEnabled: Boolean
|
||||
get() = statusAdapterDelegate.profileImageEnabled
|
||||
|
||||
override val isShowAbsoluteTime: Boolean
|
||||
get() = statusAdapterDelegate.isShowAbsoluteTime
|
||||
|
||||
override val useStarsForLikes: Boolean
|
||||
get() = statusAdapterDelegate.useStarsForLikes
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.mariotaku.twidere.R
|
|||
import org.mariotaku.twidere.adapter.iface.IGroupsAdapter
|
||||
import org.mariotaku.twidere.adapter.iface.ILoadMoreSupportAdapter
|
||||
import org.mariotaku.twidere.adapter.iface.ILoadMoreSupportAdapter.Companion.ITEM_VIEW_TYPE_LOAD_INDICATOR
|
||||
import org.mariotaku.twidere.constant.*
|
||||
import org.mariotaku.twidere.constant.nameFirstKey
|
||||
import org.mariotaku.twidere.model.ParcelableGroup
|
||||
import org.mariotaku.twidere.view.holder.GroupViewHolder
|
||||
import org.mariotaku.twidere.view.holder.LoadIndicatorViewHolder
|
||||
|
@ -38,10 +38,6 @@ import org.mariotaku.twidere.view.holder.LoadIndicatorViewHolder
|
|||
class ParcelableGroupsAdapter(context: Context) : LoadMoreSupportAdapter<RecyclerView.ViewHolder>(context), Constants, IGroupsAdapter<List<ParcelableGroup>> {
|
||||
override val showAccountsColor: Boolean
|
||||
get() = false
|
||||
override val profileImageStyle: Int
|
||||
override val textSize: Float
|
||||
override val profileImageEnabled: Boolean
|
||||
override val isShowAbsoluteTime: Boolean
|
||||
override val nameFirst: Boolean
|
||||
override var groupAdapterListener: IGroupsAdapter.GroupAdapterListener? = null
|
||||
|
||||
|
@ -53,11 +49,7 @@ class ParcelableGroupsAdapter(context: Context) : LoadMoreSupportAdapter<Recycle
|
|||
init {
|
||||
mEventListener = EventListener(this)
|
||||
inflater = LayoutInflater.from(context)
|
||||
textSize = preferences[textSizeKey].toFloat()
|
||||
profileImageStyle = preferences[profileImageStyleKey]
|
||||
profileImageEnabled = preferences[displayProfileImageKey]
|
||||
nameFirst = preferences[nameFirstKey]
|
||||
isShowAbsoluteTime = preferences[showAbsoluteTimeKey]
|
||||
}
|
||||
|
||||
fun getData(): List<ParcelableGroup>? {
|
||||
|
|
|
@ -25,6 +25,7 @@ import android.support.v4.widget.Space
|
|||
import android.support.v7.widget.RecyclerView
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import org.mariotaku.kpreferences.get
|
||||
import org.mariotaku.ktextension.findPositionByItemId
|
||||
import org.mariotaku.ktextension.rangeOfSize
|
||||
import org.mariotaku.ktextension.safeMoveToPosition
|
||||
|
@ -36,7 +37,12 @@ import org.mariotaku.twidere.adapter.iface.IItemCountsAdapter
|
|||
import org.mariotaku.twidere.adapter.iface.ILoadMoreSupportAdapter
|
||||
import org.mariotaku.twidere.adapter.iface.ILoadMoreSupportAdapter.Companion.ITEM_VIEW_TYPE_LOAD_INDICATOR
|
||||
import org.mariotaku.twidere.adapter.iface.IStatusesAdapter
|
||||
import org.mariotaku.twidere.constant.SharedPreferenceConstants.*
|
||||
import org.mariotaku.twidere.constant.SharedPreferenceConstants.KEY_DISPLAY_SENSITIVE_CONTENTS
|
||||
import org.mariotaku.twidere.constant.SharedPreferenceConstants.KEY_LINK_HIGHLIGHT_OPTION
|
||||
import org.mariotaku.twidere.constant.hideCardActionsKey
|
||||
import org.mariotaku.twidere.constant.iWantMyStarsBackKey
|
||||
import org.mariotaku.twidere.constant.mediaPreviewStyleKey
|
||||
import org.mariotaku.twidere.constant.nameFirstKey
|
||||
import org.mariotaku.twidere.model.ObjectId
|
||||
import org.mariotaku.twidere.model.ParcelableStatus
|
||||
import org.mariotaku.twidere.model.ParcelableStatusCursorIndices
|
||||
|
@ -46,7 +52,6 @@ import org.mariotaku.twidere.util.StatusAdapterLinkClickHandler
|
|||
import org.mariotaku.twidere.util.TwidereLinkify
|
||||
import org.mariotaku.twidere.util.Utils
|
||||
import org.mariotaku.twidere.view.CardMediaContainer
|
||||
import org.mariotaku.twidere.view.ShapedImageView
|
||||
import org.mariotaku.twidere.view.holder.EmptyViewHolder
|
||||
import org.mariotaku.twidere.view.holder.GapViewHolder
|
||||
import org.mariotaku.twidere.view.holder.LoadIndicatorViewHolder
|
||||
|
@ -61,24 +66,19 @@ abstract class ParcelableStatusesAdapter(
|
|||
) : LoadMoreSupportAdapter<RecyclerView.ViewHolder>(context), IStatusesAdapter<List<ParcelableStatus>>,
|
||||
IItemCountsAdapter {
|
||||
|
||||
protected val inflater: LayoutInflater
|
||||
protected val inflater: LayoutInflater = LayoutInflater.from(context)
|
||||
|
||||
override final val mediaLoadingHandler: MediaLoadingHandler
|
||||
final override val twidereLinkify: TwidereLinkify
|
||||
final override val textSize: Float
|
||||
@ShapedImageView.ShapeStyle final
|
||||
override val profileImageStyle: Int
|
||||
@CardMediaContainer.PreviewStyle final
|
||||
override val mediaPreviewStyle: Int
|
||||
@TwidereLinkify.HighlightStyle final
|
||||
override val linkHighlightingStyle: Int
|
||||
final override val nameFirst: Boolean
|
||||
@CardMediaContainer.PreviewStyle
|
||||
final override val mediaPreviewStyle: Int = preferences[mediaPreviewStyleKey]
|
||||
final override val nameFirst: Boolean = preferences[nameFirstKey]
|
||||
final override val useStarsForLikes: Boolean = preferences[iWantMyStarsBackKey]
|
||||
@TwidereLinkify.HighlightStyle
|
||||
final override val linkHighlightingStyle: Int
|
||||
final override val mediaPreviewEnabled: Boolean
|
||||
final override val profileImageEnabled: Boolean
|
||||
final override val sensitiveContentEnabled: Boolean
|
||||
final override val useStarsForLikes: Boolean
|
||||
final override val isShowAbsoluteTime: Boolean
|
||||
private val showCardActions: Boolean
|
||||
private val showCardActions: Boolean = !preferences[hideCardActionsKey]
|
||||
|
||||
private val gapLoadingIds: MutableSet<ObjectId> = HashSet()
|
||||
|
||||
|
@ -120,19 +120,10 @@ abstract class ParcelableStatusesAdapter(
|
|||
protected abstract val progressViewIds: IntArray
|
||||
|
||||
init {
|
||||
inflater = LayoutInflater.from(context)
|
||||
mediaLoadingHandler = MediaLoadingHandler(*progressViewIds)
|
||||
textSize = preferences.getInt(KEY_TEXT_SIZE, context.resources.getInteger(R.integer.default_text_size)).toFloat()
|
||||
profileImageStyle = Utils.getProfileImageStyle(preferences.getString(KEY_PROFILE_IMAGE_STYLE, null))
|
||||
mediaPreviewStyle = Utils.getMediaPreviewStyle(preferences.getString(KEY_MEDIA_PREVIEW_STYLE, null))
|
||||
linkHighlightingStyle = Utils.getLinkHighlightingStyleInt(preferences.getString(KEY_LINK_HIGHLIGHT_OPTION, null))
|
||||
nameFirst = preferences.getBoolean(KEY_NAME_FIRST, true)
|
||||
profileImageEnabled = preferences.getBoolean(KEY_DISPLAY_PROFILE_IMAGE, true)
|
||||
mediaPreviewEnabled = Utils.isMediaPreviewEnabled(context, preferences)
|
||||
sensitiveContentEnabled = preferences.getBoolean(KEY_DISPLAY_SENSITIVE_CONTENTS, false)
|
||||
showCardActions = !preferences.getBoolean(KEY_HIDE_CARD_ACTIONS, false)
|
||||
useStarsForLikes = preferences.getBoolean(KEY_I_WANT_MY_STARS_BACK)
|
||||
isShowAbsoluteTime = preferences.getBoolean(KEY_SHOW_ABSOLUTE_TIME, false)
|
||||
val handler = StatusAdapterLinkClickHandler<List<ParcelableStatus>>(context, preferences)
|
||||
twidereLinkify = TwidereLinkify(handler)
|
||||
handler.setAdapter(this)
|
||||
|
|
|
@ -24,39 +24,30 @@ import android.support.v7.widget.RecyclerView
|
|||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
|
||||
import org.mariotaku.twidere.Constants
|
||||
import org.mariotaku.kpreferences.get
|
||||
import org.mariotaku.twidere.R
|
||||
import org.mariotaku.twidere.adapter.iface.ILoadMoreSupportAdapter
|
||||
import org.mariotaku.twidere.adapter.iface.ILoadMoreSupportAdapter.Companion.ITEM_VIEW_TYPE_LOAD_INDICATOR
|
||||
import org.mariotaku.twidere.adapter.iface.IUserListsAdapter
|
||||
import org.mariotaku.twidere.constant.SharedPreferenceConstants
|
||||
import org.mariotaku.twidere.constant.nameFirstKey
|
||||
import org.mariotaku.twidere.model.ParcelableUserList
|
||||
import org.mariotaku.twidere.util.Utils
|
||||
import org.mariotaku.twidere.view.holder.LoadIndicatorViewHolder
|
||||
import org.mariotaku.twidere.view.holder.UserListViewHolder
|
||||
|
||||
class ParcelableUserListsAdapter(context: Context) : LoadMoreSupportAdapter<RecyclerView.ViewHolder>(context), Constants, IUserListsAdapter<List<ParcelableUserList>> {
|
||||
class ParcelableUserListsAdapter(
|
||||
context: Context
|
||||
) : LoadMoreSupportAdapter<RecyclerView.ViewHolder>(context), IUserListsAdapter<List<ParcelableUserList>> {
|
||||
override val showAccountsColor: Boolean
|
||||
get() = false
|
||||
override val profileImageStyle: Int
|
||||
override val textSize: Float
|
||||
override val profileImageEnabled: Boolean
|
||||
override val isShowAbsoluteTime: Boolean
|
||||
override val nameFirst: Boolean
|
||||
override var userListClickListener: IUserListsAdapter.UserListClickListener? = null
|
||||
|
||||
private val inflater: LayoutInflater
|
||||
private val inflater: LayoutInflater = LayoutInflater.from(context)
|
||||
private var data: List<ParcelableUserList>? = null
|
||||
|
||||
|
||||
init {
|
||||
inflater = LayoutInflater.from(context)
|
||||
textSize = preferences.getInt(SharedPreferenceConstants.KEY_TEXT_SIZE, context.resources.getInteger(R.integer.default_text_size)).toFloat()
|
||||
profileImageStyle = Utils.getProfileImageStyle(preferences.getString(SharedPreferenceConstants.KEY_PROFILE_IMAGE_STYLE, null))
|
||||
profileImageEnabled = preferences.getBoolean(SharedPreferenceConstants.KEY_DISPLAY_PROFILE_IMAGE, true)
|
||||
nameFirst = preferences.getBoolean(SharedPreferenceConstants.KEY_NAME_FIRST, true)
|
||||
isShowAbsoluteTime = preferences.getBoolean(SharedPreferenceConstants.KEY_SHOW_ABSOLUTE_TIME, false)
|
||||
nameFirst = preferences[nameFirstKey]
|
||||
}
|
||||
|
||||
fun getData(): List<ParcelableUserList>? {
|
||||
|
|
|
@ -23,16 +23,11 @@ import android.content.Context
|
|||
import android.support.v7.widget.RecyclerView
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import org.mariotaku.kpreferences.get
|
||||
import org.mariotaku.twidere.Constants
|
||||
import org.mariotaku.twidere.R
|
||||
import org.mariotaku.twidere.adapter.iface.ILoadMoreSupportAdapter
|
||||
import org.mariotaku.twidere.adapter.iface.ILoadMoreSupportAdapter.Companion.ITEM_VIEW_TYPE_LOAD_INDICATOR
|
||||
import org.mariotaku.twidere.adapter.iface.IUsersAdapter
|
||||
import org.mariotaku.twidere.constant.displayProfileImageKey
|
||||
import org.mariotaku.twidere.constant.profileImageStyleKey
|
||||
import org.mariotaku.twidere.constant.showAbsoluteTimeKey
|
||||
import org.mariotaku.twidere.constant.textSizeKey
|
||||
import org.mariotaku.twidere.model.ParcelableUser
|
||||
import org.mariotaku.twidere.model.UserKey
|
||||
import org.mariotaku.twidere.view.holder.LoadIndicatorViewHolder
|
||||
|
@ -43,10 +38,6 @@ class ParcelableUsersAdapter(context: Context) : LoadMoreSupportAdapter<Recycler
|
|||
private var data: List<ParcelableUser>? = null
|
||||
|
||||
override val showAccountsColor: Boolean = false
|
||||
override val profileImageStyle: Int
|
||||
override val textSize: Float
|
||||
override val profileImageEnabled: Boolean
|
||||
override val isShowAbsoluteTime: Boolean
|
||||
override var userClickListener: IUsersAdapter.UserClickListener? = null
|
||||
override var requestClickListener: IUsersAdapter.RequestClickListener? = null
|
||||
override var friendshipClickListener: IUsersAdapter.FriendshipClickListener? = null
|
||||
|
@ -54,10 +45,6 @@ class ParcelableUsersAdapter(context: Context) : LoadMoreSupportAdapter<Recycler
|
|||
|
||||
init {
|
||||
inflater = LayoutInflater.from(context)
|
||||
textSize = preferences[textSizeKey].toFloat()
|
||||
profileImageStyle = preferences[profileImageStyleKey]
|
||||
profileImageEnabled = preferences[displayProfileImageKey]
|
||||
isShowAbsoluteTime = preferences[showAbsoluteTimeKey]
|
||||
}
|
||||
|
||||
fun getData(): List<ParcelableUser>? {
|
||||
|
|
|
@ -23,18 +23,12 @@ import android.content.Context
|
|||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import org.mariotaku.twidere.R
|
||||
import org.mariotaku.twidere.adapter.iface.IBaseAdapter
|
||||
import org.mariotaku.twidere.model.ParcelableUserList
|
||||
import org.mariotaku.twidere.util.Utils.configBaseAdapter
|
||||
import org.mariotaku.twidere.view.holder.TwoLineWithIconViewHolder
|
||||
|
||||
class SimpleParcelableUserListsAdapter(
|
||||
context: Context
|
||||
) : BaseArrayAdapter<ParcelableUserList>(context, R.layout.list_item_two_line), IBaseAdapter {
|
||||
|
||||
init {
|
||||
configBaseAdapter(context, this)
|
||||
}
|
||||
) : BaseArrayAdapter<ParcelableUserList>(context, R.layout.list_item_two_line) {
|
||||
|
||||
fun appendData(data: List<ParcelableUserList>) {
|
||||
setData(data, false)
|
||||
|
@ -58,13 +52,13 @@ class SimpleParcelableUserListsAdapter(
|
|||
// Clear images in order to prevent images in recycled view shown.
|
||||
holder.icon.setImageDrawable(null)
|
||||
|
||||
val user_list = getItem(position)
|
||||
val display_name = userColorNameManager.getDisplayName(user_list, isDisplayNameFirst)
|
||||
holder.text1.text = user_list.name
|
||||
val userList = getItem(position)
|
||||
val display_name = userColorNameManager.getDisplayName(userList, nameFirst)
|
||||
holder.text1.text = userList.name
|
||||
holder.text2.text = context.getString(R.string.created_by, display_name)
|
||||
holder.icon.visibility = if (isProfileImageDisplayed) View.VISIBLE else View.GONE
|
||||
if (isProfileImageDisplayed) {
|
||||
mediaLoader.displayProfileImage(holder.icon, user_list.user_profile_image_url)
|
||||
holder.icon.visibility = if (profileImageEnabled) View.VISIBLE else View.GONE
|
||||
if (profileImageEnabled) {
|
||||
mediaLoader.displayProfileImage(holder.icon, userList.user_profile_image_url)
|
||||
} else {
|
||||
mediaLoader.cancelDisplayTask(holder.icon)
|
||||
}
|
||||
|
|
|
@ -23,21 +23,14 @@ import android.content.Context
|
|||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import org.mariotaku.twidere.R
|
||||
import org.mariotaku.twidere.adapter.iface.IBaseAdapter
|
||||
import org.mariotaku.twidere.model.ParcelableUser
|
||||
import org.mariotaku.twidere.model.UserKey
|
||||
import org.mariotaku.twidere.util.Utils.configBaseAdapter
|
||||
import org.mariotaku.twidere.util.display
|
||||
import org.mariotaku.twidere.view.holder.TwoLineWithIconViewHolder
|
||||
import org.mariotaku.twidere.view.holder.SimpleUserViewHolder
|
||||
|
||||
class SimpleParcelableUsersAdapter @JvmOverloads constructor(
|
||||
context: Context,
|
||||
layoutRes: Int = R.layout.list_item_simple_user
|
||||
) : BaseArrayAdapter<ParcelableUser>(context, layoutRes), IBaseAdapter {
|
||||
|
||||
init {
|
||||
configBaseAdapter(context, this)
|
||||
}
|
||||
) : BaseArrayAdapter<ParcelableUser>(context, layoutRes) {
|
||||
|
||||
override fun getItemId(position: Int): Long {
|
||||
val item = getItem(position)
|
||||
|
@ -50,18 +43,14 @@ class SimpleParcelableUsersAdapter @JvmOverloads constructor(
|
|||
|
||||
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View {
|
||||
val view = super.getView(position, convertView, parent)
|
||||
val tag = view.tag
|
||||
val holder: TwoLineWithIconViewHolder
|
||||
if (tag is TwoLineWithIconViewHolder) {
|
||||
holder = tag
|
||||
} else {
|
||||
holder = TwoLineWithIconViewHolder(view)
|
||||
view.tag = holder
|
||||
val holder = view.tag as? SimpleUserViewHolder ?: run {
|
||||
val h = SimpleUserViewHolder(view, this)
|
||||
view.tag = h
|
||||
return@run h
|
||||
}
|
||||
|
||||
val user = getItem(position)
|
||||
|
||||
holder.display(user, mediaLoader, userColorNameManager, isProfileImageDisplayed)
|
||||
holder.displayUser(user)
|
||||
return view
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.mariotaku.twidere.view.holder.ActivityTitleSummaryViewHolder
|
|||
/**
|
||||
* Created by mariotaku on 14/11/18.
|
||||
*/
|
||||
interface IActivitiesAdapter<in Data> : IContentCardAdapter, IGapSupportedAdapter {
|
||||
interface IActivitiesAdapter<in Data> : IContentAdapter, IGapSupportedAdapter {
|
||||
|
||||
val activityCount: Int
|
||||
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
* Twidere - Twitter client for Android
|
||||
*
|
||||
* Copyright (C) 2012-2014 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.mariotaku.twidere.adapter.iface
|
||||
|
||||
import android.widget.ListAdapter
|
||||
|
||||
import org.mariotaku.twidere.util.MediaLoaderWrapper
|
||||
|
||||
interface IBaseAdapter : ListAdapter {
|
||||
|
||||
val mediaLoader: MediaLoaderWrapper
|
||||
|
||||
val linkHighlightOption: Int
|
||||
|
||||
var textSize: Float
|
||||
|
||||
var isDisplayNameFirst: Boolean
|
||||
|
||||
var isProfileImageDisplayed: Boolean
|
||||
|
||||
var isShowAccountColor: Boolean
|
||||
|
||||
fun notifyDataSetChanged()
|
||||
|
||||
fun setLinkHighlightOption(option: String)
|
||||
}
|
|
@ -19,9 +19,7 @@
|
|||
|
||||
package org.mariotaku.twidere.adapter.iface
|
||||
|
||||
import android.content.Context
|
||||
import android.support.v4.text.BidiFormatter
|
||||
|
||||
import org.mariotaku.twidere.util.AsyncTwitterWrapper
|
||||
import org.mariotaku.twidere.util.MediaLoaderWrapper
|
||||
import org.mariotaku.twidere.util.UserColorNameManager
|
||||
|
@ -30,9 +28,7 @@ import org.mariotaku.twidere.view.ShapedImageView.ShapeStyle
|
|||
/**
|
||||
* Created by mariotaku on 15/1/3.
|
||||
*/
|
||||
interface IContentCardAdapter : ILoadMoreSupportAdapter {
|
||||
|
||||
val context: Context
|
||||
interface IContentAdapter {
|
||||
|
||||
val userColorNameManager: UserColorNameManager
|
||||
|
|
@ -25,7 +25,7 @@ import org.mariotaku.twidere.view.holder.GroupViewHolder
|
|||
/**
|
||||
* Created by mariotaku on 15/4/16.
|
||||
*/
|
||||
interface IGroupsAdapter<in Data> : IContentCardAdapter {
|
||||
interface IGroupsAdapter<in Data> : IContentAdapter {
|
||||
|
||||
val groupsCount: Int
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import org.mariotaku.twidere.view.holder.iface.IStatusViewHolder
|
|||
/**
|
||||
* Created by mariotaku on 14/11/18.
|
||||
*/
|
||||
interface IStatusesAdapter<in Data> : IContentCardAdapter, IGapSupportedAdapter {
|
||||
interface IStatusesAdapter<in Data> : IContentAdapter, IGapSupportedAdapter {
|
||||
|
||||
@TwidereLinkify.HighlightStyle
|
||||
val linkHighlightingStyle: Int
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.mariotaku.twidere.view.holder.UserListViewHolder
|
|||
/**
|
||||
* Created by mariotaku on 15/4/16.
|
||||
*/
|
||||
interface IUserListsAdapter<in Data> : IContentCardAdapter {
|
||||
interface IUserListsAdapter<in Data> : IContentAdapter {
|
||||
|
||||
val userListsCount: Int
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.mariotaku.twidere.view.holder.UserViewHolder
|
|||
/**
|
||||
* Created by mariotaku on 15/4/16.
|
||||
*/
|
||||
interface IUsersAdapter<in Data> : IContentCardAdapter {
|
||||
interface IUsersAdapter<in Data> : IContentAdapter {
|
||||
|
||||
val userCount: Int
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.mariotaku.twidere.Constants.KEY_NO_CLOSE_AFTER_TWEET_SENT
|
|||
import org.mariotaku.twidere.TwidereConstants.*
|
||||
import org.mariotaku.twidere.annotation.AccountType
|
||||
import org.mariotaku.twidere.constant.SharedPreferenceConstants.KEY_CUSTOM_API_TYPE
|
||||
import org.mariotaku.twidere.constant.SharedPreferenceConstants.VALUE_MEDIA_PREVIEW_STYLE_CODE_CROP
|
||||
import org.mariotaku.twidere.extension.getNonEmptyString
|
||||
import org.mariotaku.twidere.model.CustomAPIConfig
|
||||
import org.mariotaku.twidere.model.account.cred.Credentials
|
||||
|
@ -24,7 +25,6 @@ import org.mariotaku.twidere.view.ProfileImageView
|
|||
* Created by mariotaku on 16/8/25.
|
||||
*/
|
||||
|
||||
val mediaPreviewStyleKey = KStringKey(KEY_MEDIA_PREVIEW_STYLE, VALUE_MEDIA_PREVIEW_STYLE_CROP)
|
||||
val textSizeKey = KIntKey(KEY_TEXT_SIZE, 15)
|
||||
val nameFirstKey = KBooleanKey(KEY_NAME_FIRST, true)
|
||||
val displayProfileImageKey = KBooleanKey(KEY_DISPLAY_PROFILE_IMAGE, true)
|
||||
|
@ -105,6 +105,19 @@ object profileImageStyleKey : KSimpleKey<Int>(KEY_PROFILE_IMAGE_STYLE, ProfileIm
|
|||
|
||||
}
|
||||
|
||||
object mediaPreviewStyleKey : KSimpleKey<Int>(KEY_MEDIA_PREVIEW_STYLE, VALUE_MEDIA_PREVIEW_STYLE_CODE_CROP) {
|
||||
override fun read(preferences: SharedPreferences): Int {
|
||||
if (preferences.getString(key, null) == VALUE_MEDIA_PREVIEW_STYLE_SCALE) return VALUE_MEDIA_PREVIEW_STYLE_CODE_SCALE
|
||||
return VALUE_MEDIA_PREVIEW_STYLE_CODE_CROP
|
||||
}
|
||||
|
||||
override fun write(editor: SharedPreferences.Editor, value: Int): Boolean {
|
||||
editor.putString(key, if (value == VALUE_MEDIA_PREVIEW_STYLE_CODE_SCALE) VALUE_MEDIA_PREVIEW_STYLE_SCALE else VALUE_MEDIA_PREVIEW_STYLE_CROP)
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
object refreshIntervalKey : KSimpleKey<Long>(KEY_REFRESH_INTERVAL, 15) {
|
||||
override fun read(preferences: SharedPreferences): Long {
|
||||
return preferences.getString(key, null).toLong(def)
|
||||
|
|
|
@ -60,7 +60,6 @@ class AccountsManagerFragment : BaseSupportFragment(), LoaderManager.LoaderCallb
|
|||
setHasOptionsMenu(true)
|
||||
val am = AccountManager.get(context)
|
||||
adapter = AccountDetailsAdapter(context).apply {
|
||||
Utils.configBaseAdapter(context, this)
|
||||
setSortEnabled(true)
|
||||
setSwitchEnabled(true)
|
||||
accountToggleListener = { pos, checked ->
|
||||
|
|
|
@ -82,7 +82,7 @@ class InteractionsTimelineFragment : CursorActivitiesFragment() {
|
|||
}
|
||||
|
||||
override fun onCreateAdapter(context: Context): ParcelableActivitiesAdapter {
|
||||
val adapter = ParcelableActivitiesAdapter(context, false)
|
||||
val adapter = ParcelableActivitiesAdapter(context)
|
||||
val arguments = arguments
|
||||
if (arguments != null) {
|
||||
val extras = arguments.getParcelable<InteractionsTabExtras>(EXTRA_EXTRAS)
|
||||
|
|
|
@ -88,9 +88,8 @@ import org.mariotaku.twidere.adapter.iface.ILoadMoreSupportAdapter.IndicatorPosi
|
|||
import org.mariotaku.twidere.adapter.iface.IStatusesAdapter
|
||||
import org.mariotaku.twidere.annotation.AccountType
|
||||
import org.mariotaku.twidere.annotation.Referral
|
||||
import org.mariotaku.twidere.constant.*
|
||||
import org.mariotaku.twidere.constant.KeyboardShortcutConstants.*
|
||||
import org.mariotaku.twidere.constant.SharedPreferenceConstants
|
||||
import org.mariotaku.twidere.constant.newDocumentApiKey
|
||||
import org.mariotaku.twidere.extension.model.getAccountType
|
||||
import org.mariotaku.twidere.loader.ConversationLoader
|
||||
import org.mariotaku.twidere.loader.ParcelableStatusLoader
|
||||
|
@ -1253,9 +1252,6 @@ class StatusFragment : BaseSupportFragment(), LoaderCallbacks<SingleResponse<Par
|
|||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
val textSize: Float
|
||||
get() = statusAdapter.textSize
|
||||
|
||||
val countItemsCount: Int
|
||||
get() {
|
||||
if (counts == null) return 0
|
||||
|
@ -1440,17 +1436,13 @@ class StatusFragment : BaseSupportFragment(), LoaderCallbacks<SingleResponse<Par
|
|||
private val mItemCounts: IntArray
|
||||
|
||||
override val nameFirst: Boolean
|
||||
private val mTextSize: Int
|
||||
private val cardBackgroundColor: Int
|
||||
override val profileImageStyle: Int
|
||||
override val mediaPreviewStyle: Int
|
||||
override val linkHighlightingStyle: Int
|
||||
override val mediaPreviewEnabled: Boolean
|
||||
override val profileImageEnabled: Boolean
|
||||
override val sensitiveContentEnabled: Boolean
|
||||
private val mShowCardActions: Boolean
|
||||
override val useStarsForLikes: Boolean
|
||||
override val isShowAbsoluteTime: Boolean
|
||||
private var mDetailMediaExpanded: Boolean = false
|
||||
|
||||
var status: ParcelableStatus? = null
|
||||
|
@ -1497,26 +1489,19 @@ class StatusFragment : BaseSupportFragment(), LoaderCallbacks<SingleResponse<Par
|
|||
cardBackgroundColor = ThemeUtils.getCardBackgroundColor(context,
|
||||
ThemeUtils.getThemeBackgroundOption(context),
|
||||
ThemeUtils.getUserThemeBackgroundAlpha(context))
|
||||
nameFirst = preferences.getBoolean(SharedPreferenceConstants.KEY_NAME_FIRST, true)
|
||||
mTextSize = preferences.getInt(SharedPreferenceConstants.KEY_TEXT_SIZE, res.getInteger(R.integer.default_text_size))
|
||||
profileImageStyle = Utils.getProfileImageStyle(preferences.getString(SharedPreferenceConstants.KEY_PROFILE_IMAGE_STYLE, null))
|
||||
mediaPreviewStyle = Utils.getMediaPreviewStyle(preferences.getString(SharedPreferenceConstants.KEY_MEDIA_PREVIEW_STYLE, null))
|
||||
nameFirst = preferences[nameFirstKey]
|
||||
mediaPreviewStyle = preferences[mediaPreviewStyleKey]
|
||||
linkHighlightingStyle = Utils.getLinkHighlightingStyleInt(preferences.getString(SharedPreferenceConstants.KEY_LINK_HIGHLIGHT_OPTION, null))
|
||||
profileImageEnabled = preferences.getBoolean(SharedPreferenceConstants.KEY_DISPLAY_PROFILE_IMAGE, true)
|
||||
mediaPreviewEnabled = Utils.isMediaPreviewEnabled(context, preferences)
|
||||
mediaPreviewEnabled = preferences[mediaPreviewKey]
|
||||
sensitiveContentEnabled = preferences.getBoolean(SharedPreferenceConstants.KEY_DISPLAY_SENSITIVE_CONTENTS, false)
|
||||
mShowCardActions = !preferences.getBoolean(SharedPreferenceConstants.KEY_HIDE_CARD_ACTIONS, false)
|
||||
useStarsForLikes = preferences.getBoolean(SharedPreferenceConstants.KEY_I_WANT_MY_STARS_BACK)
|
||||
isShowAbsoluteTime = preferences.getBoolean(SharedPreferenceConstants.KEY_SHOW_ABSOLUTE_TIME)
|
||||
mShowCardActions = !preferences[hideCardActionsKey]
|
||||
useStarsForLikes = preferences[iWantMyStarsBackKey]
|
||||
val listener = StatusAdapterLinkClickHandler<List<ParcelableStatus>>(context,
|
||||
preferences)
|
||||
listener.setAdapter(this)
|
||||
twidereLinkify = TwidereLinkify(listener)
|
||||
}
|
||||
|
||||
override val textSize: Float
|
||||
get() = mTextSize.toFloat()
|
||||
|
||||
override fun getStatus(position: Int): ParcelableStatus? {
|
||||
val itemType = getItemType(position)
|
||||
when (itemType) {
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.mariotaku.ktextension.*
|
|||
import org.mariotaku.twidere.R
|
||||
import org.mariotaku.twidere.activity.BaseActivity
|
||||
import org.mariotaku.twidere.adapter.LoadMoreSupportAdapter
|
||||
import org.mariotaku.twidere.adapter.iface.IContentCardAdapter
|
||||
import org.mariotaku.twidere.adapter.iface.IContentAdapter
|
||||
import org.mariotaku.twidere.adapter.iface.ILoadMoreSupportAdapter
|
||||
import org.mariotaku.twidere.adapter.iface.ILoadMoreSupportAdapter.IndicatorPosition
|
||||
import org.mariotaku.twidere.constant.*
|
||||
|
@ -238,16 +238,12 @@ abstract class BaseFiltersImportFragment : AbsContentListRecyclerViewFragment<Ba
|
|||
}
|
||||
|
||||
|
||||
class SelectableUsersAdapter(context: Context) : LoadMoreSupportAdapter<RecyclerView.ViewHolder>(context), IContentCardAdapter {
|
||||
override val isShowAbsoluteTime: Boolean
|
||||
override val profileImageEnabled: Boolean
|
||||
override val profileImageStyle: Int
|
||||
override val textSize: Float
|
||||
class SelectableUsersAdapter(context: Context) : LoadMoreSupportAdapter<RecyclerView.ViewHolder>(context), IContentAdapter {
|
||||
|
||||
val ITEM_VIEW_TYPE_USER = 2
|
||||
|
||||
private val inflater: LayoutInflater
|
||||
private val itemStates: MutableMap<UserKey, Boolean>
|
||||
private val inflater: LayoutInflater = LayoutInflater.from(context)
|
||||
private val itemStates: MutableMap<UserKey, Boolean> = ArrayMap()
|
||||
var itemCheckedListener: ((Int, Boolean) -> Unit)? = null
|
||||
|
||||
var data: List<ParcelableUser>? = null
|
||||
|
@ -261,15 +257,6 @@ abstract class BaseFiltersImportFragment : AbsContentListRecyclerViewFragment<Ba
|
|||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
init {
|
||||
inflater = LayoutInflater.from(context)
|
||||
itemStates = ArrayMap<UserKey, Boolean>()
|
||||
isShowAbsoluteTime = preferences[showAbsoluteTimeKey]
|
||||
profileImageEnabled = preferences[displayProfileImageKey]
|
||||
profileImageStyle = preferences[profileImageStyleKey]
|
||||
textSize = preferences[textSizeKey].toFloat()
|
||||
}
|
||||
|
||||
private fun bindUser(holder: SelectableUserViewHolder, position: Int) {
|
||||
holder.displayUser(getUser(position)!!)
|
||||
}
|
||||
|
|
|
@ -10,13 +10,13 @@ import kotlinx.android.synthetic.main.layout_extra_config_user.view.*
|
|||
import kotlinx.android.synthetic.main.list_item_simple_user.view.*
|
||||
import org.mariotaku.twidere.R
|
||||
import org.mariotaku.twidere.activity.UserListSelectorActivity
|
||||
import org.mariotaku.twidere.adapter.DummyItemAdapter
|
||||
import org.mariotaku.twidere.constant.IntentConstants.*
|
||||
import org.mariotaku.twidere.fragment.CustomTabsFragment.TabEditorDialogFragment
|
||||
import org.mariotaku.twidere.model.ParcelableUser
|
||||
import org.mariotaku.twidere.model.tab.TabConfiguration
|
||||
import org.mariotaku.twidere.util.dagger.DependencyHolder
|
||||
import org.mariotaku.twidere.util.display
|
||||
import org.mariotaku.twidere.view.holder.TwoLineWithIconViewHolder
|
||||
import org.mariotaku.twidere.view.holder.SimpleUserViewHolder
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 2016/11/28.
|
||||
|
@ -26,7 +26,7 @@ class UserExtraConfiguration(key: String) : TabConfiguration.ExtraConfiguration(
|
|||
var value: ParcelableUser? = null
|
||||
private set
|
||||
|
||||
private lateinit var viewHolder: TwoLineWithIconViewHolder
|
||||
private lateinit var viewHolder: SimpleUserViewHolder
|
||||
private lateinit var dependencyHolder: DependencyHolder
|
||||
private lateinit var hintView: View
|
||||
|
||||
|
@ -49,9 +49,11 @@ class UserExtraConfiguration(key: String) : TabConfiguration.ExtraConfiguration(
|
|||
fragment.startExtraConfigurationActivityForResult(this@UserExtraConfiguration, intent, 1)
|
||||
}
|
||||
hintView = view.selectUserHint
|
||||
viewHolder = TwoLineWithIconViewHolder(view.listItem)
|
||||
val adapter = DummyItemAdapter(context)
|
||||
adapter.updateOptions()
|
||||
viewHolder = SimpleUserViewHolder(view.listItem, adapter)
|
||||
|
||||
viewHolder.view.visibility = View.GONE
|
||||
viewHolder.itemView.visibility = View.GONE
|
||||
hintView.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
|
@ -60,8 +62,8 @@ class UserExtraConfiguration(key: String) : TabConfiguration.ExtraConfiguration(
|
|||
1 -> {
|
||||
if (resultCode == Activity.RESULT_OK) {
|
||||
val user: ParcelableUser = data!!.getParcelableExtra(EXTRA_USER)
|
||||
viewHolder.display(user, dependencyHolder.mediaLoader, dependencyHolder.userColorNameManager, true)
|
||||
viewHolder.view.visibility = View.VISIBLE
|
||||
viewHolder.displayUser(user)
|
||||
viewHolder.itemView.visibility = View.VISIBLE
|
||||
hintView.visibility = View.GONE
|
||||
|
||||
this.value = user
|
||||
|
|
|
@ -5,7 +5,7 @@ import android.view.View
|
|||
import android.widget.CheckBox
|
||||
import android.widget.TextView
|
||||
import kotlinx.android.synthetic.main.list_item_simple_user.view.*
|
||||
import org.mariotaku.twidere.adapter.iface.IContentCardAdapter
|
||||
import org.mariotaku.twidere.adapter.iface.IContentAdapter
|
||||
import org.mariotaku.twidere.model.ParcelableUser
|
||||
import org.mariotaku.twidere.view.ProfileImageView
|
||||
|
||||
|
@ -13,25 +13,26 @@ import org.mariotaku.twidere.view.ProfileImageView
|
|||
* Created by mariotaku on 2016/12/1.
|
||||
*/
|
||||
|
||||
open class SimpleUserViewHolder(itemView: View, val adapter: IContentCardAdapter) : RecyclerView.ViewHolder(itemView) {
|
||||
open class SimpleUserViewHolder(itemView: View, val adapter: IContentAdapter) : RecyclerView.ViewHolder(itemView) {
|
||||
|
||||
val nameView: TextView
|
||||
val secondaryNameView: TextView
|
||||
val profileImageView: ProfileImageView
|
||||
val checkBox: CheckBox
|
||||
val nameView: TextView = itemView.name
|
||||
val secondaryNameView: TextView = itemView.screenName
|
||||
val profileImageView: ProfileImageView = itemView.profileImage
|
||||
val checkBox: CheckBox = itemView.checkBox
|
||||
|
||||
init {
|
||||
nameView = itemView.name
|
||||
secondaryNameView = itemView.screenName
|
||||
profileImageView = itemView.profileImage
|
||||
checkBox = itemView.checkBox
|
||||
|
||||
profileImageView.style = adapter.profileImageStyle
|
||||
}
|
||||
|
||||
open fun displayUser(user: ParcelableUser) {
|
||||
nameView.text = user.name
|
||||
secondaryNameView.text = "@${user.screen_name}"
|
||||
adapter.mediaLoader.displayProfileImage(profileImageView, user)
|
||||
if (adapter.profileImageEnabled) {
|
||||
adapter.mediaLoader.displayProfileImage(profileImageView, user)
|
||||
profileImageView.visibility = View.VISIBLE
|
||||
} else {
|
||||
adapter.mediaLoader.cancelDisplayTask(profileImageView)
|
||||
profileImageView.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -122,11 +122,11 @@ class StatusViewHolder(private val adapter: IStatusesAdapter<*>, itemView: View)
|
|||
override fun displayStatus(status: ParcelableStatus, displayInReplyTo: Boolean,
|
||||
shouldDisplayExtraType: Boolean) {
|
||||
|
||||
val context = itemView.context
|
||||
val loader = adapter.mediaLoader
|
||||
val twitter = adapter.twitterWrapper
|
||||
val linkify = adapter.twidereLinkify
|
||||
val formatter = adapter.bidiFormatter
|
||||
val context = adapter.context
|
||||
val nameFirst = adapter.nameFirst
|
||||
val showCardActions = isCardActionsShown
|
||||
|
||||
|
@ -471,7 +471,7 @@ class StatusViewHolder(private val adapter: IStatusesAdapter<*>, itemView: View)
|
|||
val favIcon: Int
|
||||
val favStyle: Int
|
||||
val favColor: Int
|
||||
val context = adapter.context
|
||||
val context = itemView.context
|
||||
if (adapter.useStarsForLikes) {
|
||||
favIcon = R.drawable.ic_action_star
|
||||
favStyle = LikeAnimationDrawable.Style.FAVORITE
|
||||
|
|
|
@ -115,8 +115,7 @@ class UserViewHolder(
|
|||
}
|
||||
|
||||
fun displayUser(user: ParcelableUser) {
|
||||
|
||||
val context = adapter.context
|
||||
val context = itemView.context
|
||||
val loader = adapter.mediaLoader
|
||||
val manager = adapter.userColorNameManager
|
||||
val twitter = adapter.twitterWrapper
|
||||
|
@ -277,7 +276,7 @@ class UserViewHolder(
|
|||
private fun RelativeLayout.LayoutParams.clearVerticalRules() {
|
||||
intArrayOf(RelativeLayout.ABOVE, RelativeLayout.BELOW, RelativeLayout.ALIGN_BASELINE,
|
||||
RelativeLayout.ALIGN_TOP, RelativeLayout.ALIGN_BOTTOM).forEach { verb ->
|
||||
removeRule(verb)
|
||||
addRule(verb, 0)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue