forked from GitHub-Mirror/riotX-android
Media : exposes the view to allow animation.
This commit is contained in:
parent
157068634a
commit
ff6d1f611a
@ -45,6 +45,7 @@ import org.koin.android.scope.ext.android.bindScope
|
||||
import org.koin.android.scope.ext.android.getOrCreateScope
|
||||
import org.koin.core.parameter.parametersOf
|
||||
|
||||
|
||||
@Parcelize
|
||||
data class RoomDetailArgs(
|
||||
val roomId: String,
|
||||
@ -166,7 +167,7 @@ class RoomDetailFragment : RiotFragment(), TimelineEventController.Callback {
|
||||
roomDetailViewModel.process(RoomDetailActions.EventDisplayed(event, index))
|
||||
}
|
||||
|
||||
override fun onMediaClicked(mediaData: MediaContentRenderer.Data) {
|
||||
override fun onMediaClicked(mediaData: MediaContentRenderer.Data, view: View) {
|
||||
val intent = MediaViewerActivity.newIntent(riotActivity, mediaData)
|
||||
startActivity(intent)
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
package im.vector.riotredesign.features.home.room.detail.timeline
|
||||
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.airbnb.epoxy.EpoxyAsyncUtil
|
||||
import com.airbnb.epoxy.EpoxyModel
|
||||
@ -103,7 +104,7 @@ class TimelineEventController(private val dateFormatter: TimelineDateFormatter,
|
||||
interface Callback {
|
||||
fun onEventVisible(event: TimelineEvent, index: Int)
|
||||
fun onUrlClicked(url: String)
|
||||
fun onMediaClicked(mediaData: MediaContentRenderer.Data)
|
||||
fun onMediaClicked(mediaData: MediaContentRenderer.Data, view: View)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ class MessageItemFactory(private val colorProvider: ColorProvider,
|
||||
return MessageImageItem_()
|
||||
.informationData(informationData)
|
||||
.mediaData(data)
|
||||
.clickListener { callback?.onMediaClicked(data) }
|
||||
.clickListener { view -> callback?.onMediaClicked(data, view) }
|
||||
}
|
||||
|
||||
private fun buildTextMessageItem(messageContent: MessageTextContent,
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
package im.vector.riotredesign.features.home.room.detail.timeline.item
|
||||
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import com.airbnb.epoxy.EpoxyAttribute
|
||||
@ -28,12 +29,12 @@ abstract class MessageImageItem : AbsMessageItem<MessageImageItem.Holder>() {
|
||||
|
||||
@EpoxyAttribute lateinit var mediaData: MediaContentRenderer.Data
|
||||
@EpoxyAttribute override lateinit var informationData: MessageInformationData
|
||||
@EpoxyAttribute var clickListener: (() -> Unit)? = null
|
||||
@EpoxyAttribute var clickListener: View.OnClickListener? = null
|
||||
|
||||
override fun bind(holder: Holder) {
|
||||
super.bind(holder)
|
||||
MediaContentRenderer.render(mediaData, MediaContentRenderer.Mode.THUMBNAIL, holder.imageView)
|
||||
holder.imageView.setOnClickListener { clickListener?.invoke() }
|
||||
holder.imageView.setOnClickListener(clickListener)
|
||||
}
|
||||
|
||||
class Holder : AbsMessageItem.Holder() {
|
||||
|
@ -0,0 +1,53 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright 2019 New Vector Ltd
|
||||
* *
|
||||
* * Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* * you may not use this file except in compliance with the License.
|
||||
* * You may obtain a copy of the License at
|
||||
* *
|
||||
* * http://www.apache.org/licenses/LICENSE-2.0
|
||||
* *
|
||||
* * Unless required by applicable law or agreed to in writing, software
|
||||
* * distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* * See the License for the specific language governing permissions and
|
||||
* * limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package im.vector.riotredesign.features.media
|
||||
|
||||
import com.github.piasy.biv.loader.ImageLoader
|
||||
import java.io.File
|
||||
|
||||
interface DefaultImageLoaderCallback : ImageLoader.Callback {
|
||||
|
||||
override fun onFinish() {
|
||||
//no-op
|
||||
}
|
||||
|
||||
override fun onSuccess(image: File?) {
|
||||
//no-op
|
||||
}
|
||||
|
||||
override fun onFail(error: Exception?) {
|
||||
//no-op
|
||||
}
|
||||
|
||||
override fun onCacheHit(imageType: Int, image: File?) {
|
||||
//no-op
|
||||
}
|
||||
|
||||
override fun onCacheMiss(imageType: Int, image: File?) {
|
||||
//no-op
|
||||
}
|
||||
|
||||
override fun onProgress(progress: Int) {
|
||||
//no-op
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
//no-op
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user