i18n
This commit is contained in:
parent
bcd384c31c
commit
345e8a0679
@ -22,6 +22,7 @@ import android.view.View
|
||||
import android.widget.ImageView
|
||||
import com.bumptech.glide.request.target.CustomViewTarget
|
||||
import com.bumptech.glide.request.transition.Transition
|
||||
import im.vector.app.core.resources.StringProvider
|
||||
import im.vector.lib.attachmentviewer.AttachmentInfo
|
||||
import im.vector.lib.attachmentviewer.AttachmentSourceProvider
|
||||
import im.vector.lib.attachmentviewer.ImageLoaderTarget
|
||||
@ -32,7 +33,8 @@ import java.io.File
|
||||
|
||||
abstract class BaseAttachmentProvider(
|
||||
private val imageContentRenderer: ImageContentRenderer,
|
||||
protected val fileService: FileService
|
||||
protected val fileService: FileService,
|
||||
protected val stringProvider: StringProvider
|
||||
) : AttachmentSourceProvider {
|
||||
|
||||
interface InteractionListener {
|
||||
|
@ -19,8 +19,10 @@ package im.vector.app.features.media
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import androidx.core.view.isVisible
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.date.DateFormatKind
|
||||
import im.vector.app.core.date.VectorDateFormatter
|
||||
import im.vector.app.core.resources.StringProvider
|
||||
import im.vector.lib.attachmentviewer.AttachmentInfo
|
||||
import org.matrix.android.sdk.api.MatrixCallback
|
||||
import org.matrix.android.sdk.api.session.events.model.isVideoMessage
|
||||
@ -33,7 +35,9 @@ class DataAttachmentRoomProvider(
|
||||
private val room: Room?,
|
||||
imageContentRenderer: ImageContentRenderer,
|
||||
private val dateFormatter: VectorDateFormatter,
|
||||
fileService: FileService) : BaseAttachmentProvider(imageContentRenderer, fileService) {
|
||||
fileService: FileService,
|
||||
stringProvider: StringProvider
|
||||
) : BaseAttachmentProvider(imageContentRenderer, fileService, stringProvider) {
|
||||
|
||||
override fun getItemCount(): Int = attachments.size
|
||||
|
||||
@ -78,7 +82,10 @@ class DataAttachmentRoomProvider(
|
||||
val timeLineEvent = room?.getTimeLineEvent(item.eventId)
|
||||
if (timeLineEvent != null) {
|
||||
val dateString = dateFormatter.format(timeLineEvent.root.originServerTs, DateFormatKind.DEFAULT_DATE_AND_TIME)
|
||||
overlayView?.updateWith("${position + 1} of ${attachments.size}", "${timeLineEvent.senderInfo.displayName} $dateString")
|
||||
overlayView?.updateWith(
|
||||
counter = stringProvider.getString(R.string.attachment_viewer_item_x_of_y, position + 1, attachments.size),
|
||||
senderInfo = "${timeLineEvent.senderInfo.displayName} $dateString"
|
||||
)
|
||||
overlayView?.videoControlsGroup?.isVisible = timeLineEvent.root.isVideoMessage()
|
||||
} else {
|
||||
overlayView?.updateWith("", "")
|
||||
|
@ -19,8 +19,10 @@ package im.vector.app.features.media
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import androidx.core.view.isVisible
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.date.DateFormatKind
|
||||
import im.vector.app.core.date.VectorDateFormatter
|
||||
import im.vector.app.core.resources.StringProvider
|
||||
import im.vector.lib.attachmentviewer.AttachmentInfo
|
||||
import org.matrix.android.sdk.api.MatrixCallback
|
||||
import org.matrix.android.sdk.api.session.Session
|
||||
@ -42,8 +44,9 @@ class RoomEventsAttachmentProvider(
|
||||
private val attachments: List<TimelineEvent>,
|
||||
imageContentRenderer: ImageContentRenderer,
|
||||
private val dateFormatter: VectorDateFormatter,
|
||||
fileService: FileService
|
||||
) : BaseAttachmentProvider(imageContentRenderer, fileService) {
|
||||
fileService: FileService,
|
||||
stringProvider: StringProvider
|
||||
) : BaseAttachmentProvider(imageContentRenderer, fileService, stringProvider) {
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return attachments.size
|
||||
@ -128,7 +131,10 @@ class RoomEventsAttachmentProvider(
|
||||
super.overlayViewAtPosition(context, position)
|
||||
val item = attachments[position]
|
||||
val dateString = dateFormatter.format(item.root.originServerTs, DateFormatKind.DEFAULT_DATE_AND_TIME)
|
||||
overlayView?.updateWith("${position + 1} of ${attachments.size}", "${item.senderInfo.displayName} $dateString")
|
||||
overlayView?.updateWith(
|
||||
counter = stringProvider.getString(R.string.attachment_viewer_item_x_of_y, position + 1, attachments.size),
|
||||
senderInfo = "${item.senderInfo.displayName} $dateString"
|
||||
)
|
||||
overlayView?.videoControlsGroup?.isVisible = item.root.isVideoMessage()
|
||||
return overlayView
|
||||
}
|
||||
@ -163,14 +169,28 @@ class RoomEventsAttachmentProvider(
|
||||
class AttachmentProviderFactory @Inject constructor(
|
||||
private val imageContentRenderer: ImageContentRenderer,
|
||||
private val vectorDateFormatter: VectorDateFormatter,
|
||||
private val stringProvider: StringProvider,
|
||||
private val session: Session
|
||||
) {
|
||||
|
||||
fun createProvider(attachments: List<TimelineEvent>): RoomEventsAttachmentProvider {
|
||||
return RoomEventsAttachmentProvider(attachments, imageContentRenderer, vectorDateFormatter, session.fileService())
|
||||
return RoomEventsAttachmentProvider(
|
||||
attachments,
|
||||
imageContentRenderer,
|
||||
vectorDateFormatter,
|
||||
session.fileService(),
|
||||
stringProvider
|
||||
)
|
||||
}
|
||||
|
||||
fun createProvider(attachments: List<AttachmentData>, room: Room?): DataAttachmentRoomProvider {
|
||||
return DataAttachmentRoomProvider(attachments, room, imageContentRenderer, vectorDateFormatter, session.fileService())
|
||||
return DataAttachmentRoomProvider(
|
||||
attachments,
|
||||
room,
|
||||
imageContentRenderer,
|
||||
vectorDateFormatter,
|
||||
session.fileService(),
|
||||
stringProvider
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -1852,6 +1852,8 @@
|
||||
<string name="rotate_and_crop_screen_title">Rotate and crop</string>
|
||||
<string name="error_handling_incoming_share">Couldn\'t handle share data</string>
|
||||
|
||||
<string name="attachment_viewer_item_x_of_y">%1$d of %2$d</string>
|
||||
|
||||
<string name="uploads_media_title">MEDIA</string>
|
||||
<string name="uploads_media_no_result">There are no media in this room</string>
|
||||
<string name="uploads_files_title">FILES</string>
|
||||
|
Loading…
Reference in New Issue
Block a user