fixed sensitive media in activities click

This commit is contained in:
Mariotaku Lee 2016-08-27 13:36:38 +08:00
parent 52b5bfc159
commit 7b7ef16fb2
2 changed files with 7 additions and 8 deletions

View File

@ -589,16 +589,12 @@ class StatusViewHolder(private val adapter: IStatusesAdapter<*>, itemView: View)
listener.onItemActionClick(holder, R.id.favorite, position)
}
holder.mediaLabel -> {
val media = holder.adapter.getStatus(position)?.media ?: return
if (media.isNotEmpty()) {
listener.onMediaClick(holder, v, media[0], position)
}
val firstMedia = holder.adapter.getStatus(position)?.media?.firstOrNull() ?: return
listener.onMediaClick(holder, v, firstMedia, position)
}
holder.quotedMediaLabel -> {
val media = holder.adapter.getStatus(position)?.quoted_media ?: return
if (media.isNotEmpty()) {
listener.onMediaClick(holder, v, media[0], position)
}
val firstMedia = holder.adapter.getStatus(position)?.quoted_media?.firstOrNull() ?: return
listener.onMediaClick(holder, v, firstMedia, position)
}
}
}

View File

@ -12,6 +12,7 @@ import org.mariotaku.twidere.model.ParcelableStatus
import org.mariotaku.twidere.model.ParcelableUser
import org.mariotaku.twidere.model.ParcelableUserList
import org.mariotaku.twidere.model.UserKey
import org.mariotaku.twidere.model.util.getActivityStatus
import org.mariotaku.twidere.util.*
import org.mariotaku.twidere.util.dagger.GeneralComponentHelper
import org.mariotaku.twidere.view.holder.iface.IStatusViewHolder
@ -91,6 +92,8 @@ class DummyItemAdapter @JvmOverloads constructor(
return adapter.getStatus(position)
} else if (adapter is VariousItemsAdapter) {
return adapter.getItem(position) as ParcelableStatus
} else if (adapter is ParcelableActivitiesAdapter) {
return adapter.getActivity(position)?.getActivityStatus()
}
return null
}