diff --git a/app/src/main/java/com/nextcloud/talk/shareditems/adapters/SharedItemsListViewHolder.kt b/app/src/main/java/com/nextcloud/talk/shareditems/adapters/SharedItemsListViewHolder.kt index 28195e0ee..be36eb630 100644 --- a/app/src/main/java/com/nextcloud/talk/shareditems/adapters/SharedItemsListViewHolder.kt +++ b/app/src/main/java/com/nextcloud/talk/shareditems/adapters/SharedItemsListViewHolder.kt @@ -37,7 +37,6 @@ import com.nextcloud.talk.shareditems.model.SharedItem import com.nextcloud.talk.shareditems.model.SharedLocationItem import com.nextcloud.talk.shareditems.model.SharedOtherItem import com.nextcloud.talk.shareditems.model.SharedPollItem -import com.nextcloud.talk.utils.DateUtils class SharedItemsListViewHolder( override val binding: SharedItemListBinding, @@ -62,16 +61,18 @@ class SharedItemsListViewHolder( it ) } - binding.fileDate.text = DateUtils.getLocalDateTimeStringFromTimestamp( - item.date * ONE_SECOND_IN_MILLIS - ) + binding.fileDate.text = item.dateTime + binding.actor.text = item.actorName } override fun onBind(item: SharedPollItem, showPoll: (item: SharedItem, context: Context) -> Unit) { super.onBind(item, showPoll) binding.fileName.text = item.name - binding.fileMetadata.visibility = View.GONE + binding.fileSize.visibility = View.GONE + binding.separator1.visibility = View.GONE + binding.fileDate.text = item.dateTime + binding.actor.text = item.actorName image.hierarchy.setPlaceholderImage(R.drawable.ic_baseline_bar_chart_24) image.setColorFilter( ContextCompat.getColor(image.context, R.color.high_emphasis_menu_icon), @@ -86,7 +87,10 @@ class SharedItemsListViewHolder( super.onBind(item) binding.fileName.text = item.name - binding.fileMetadata.visibility = View.GONE + binding.fileSize.visibility = View.GONE + binding.separator1.visibility = View.GONE + binding.fileDate.text = item.dateTime + binding.actor.text = item.actorName image.hierarchy.setPlaceholderImage(R.drawable.ic_baseline_location_on_24) image.setColorFilter( ContextCompat.getColor(image.context, R.color.high_emphasis_menu_icon), @@ -105,15 +109,14 @@ class SharedItemsListViewHolder( super.onBind(item) binding.fileName.text = item.name - binding.fileMetadata.visibility = View.GONE + binding.fileSize.visibility = View.GONE + binding.separator1.visibility = View.GONE + binding.fileDate.text = item.dateTime + binding.actor.text = item.actorName image.hierarchy.setPlaceholderImage(R.drawable.ic_mimetype_file) image.setColorFilter( ContextCompat.getColor(image.context, R.color.high_emphasis_menu_icon), android.graphics.PorterDuff.Mode.SRC_IN ) } - - companion object { - private const val ONE_SECOND_IN_MILLIS = 1000 - } } diff --git a/app/src/main/java/com/nextcloud/talk/shareditems/model/SharedFileItem.kt b/app/src/main/java/com/nextcloud/talk/shareditems/model/SharedFileItem.kt index 2366b7e13..904dc0b12 100644 --- a/app/src/main/java/com/nextcloud/talk/shareditems/model/SharedFileItem.kt +++ b/app/src/main/java/com/nextcloud/talk/shareditems/model/SharedFileItem.kt @@ -27,8 +27,8 @@ data class SharedFileItem( override val name: String, override val actorId: String, override val actorName: String, + override val dateTime: String, val fileSize: Long, - val date: Long, val path: String, val link: String, val mimeType: String, diff --git a/app/src/main/java/com/nextcloud/talk/shareditems/model/SharedItem.kt b/app/src/main/java/com/nextcloud/talk/shareditems/model/SharedItem.kt index 5c577b4c4..7575ae2bb 100644 --- a/app/src/main/java/com/nextcloud/talk/shareditems/model/SharedItem.kt +++ b/app/src/main/java/com/nextcloud/talk/shareditems/model/SharedItem.kt @@ -5,4 +5,5 @@ interface SharedItem { val name: String val actorId: String val actorName: String + val dateTime: String } diff --git a/app/src/main/java/com/nextcloud/talk/shareditems/model/SharedLocationItem.kt b/app/src/main/java/com/nextcloud/talk/shareditems/model/SharedLocationItem.kt index 2d5c6ea2b..291840e13 100644 --- a/app/src/main/java/com/nextcloud/talk/shareditems/model/SharedLocationItem.kt +++ b/app/src/main/java/com/nextcloud/talk/shareditems/model/SharedLocationItem.kt @@ -26,5 +26,6 @@ data class SharedLocationItem( override val name: String, override val actorId: String, override val actorName: String, + override val dateTime: String, val geoUri: Uri ) : SharedItem diff --git a/app/src/main/java/com/nextcloud/talk/shareditems/model/SharedOtherItem.kt b/app/src/main/java/com/nextcloud/talk/shareditems/model/SharedOtherItem.kt index 7d3ae324a..9d23a6a61 100644 --- a/app/src/main/java/com/nextcloud/talk/shareditems/model/SharedOtherItem.kt +++ b/app/src/main/java/com/nextcloud/talk/shareditems/model/SharedOtherItem.kt @@ -24,4 +24,5 @@ data class SharedOtherItem( override val name: String, override val actorId: String, override val actorName: String, + override val dateTime: String ) : SharedItem diff --git a/app/src/main/java/com/nextcloud/talk/shareditems/model/SharedPollItem.kt b/app/src/main/java/com/nextcloud/talk/shareditems/model/SharedPollItem.kt index 367aba189..ed19917b1 100644 --- a/app/src/main/java/com/nextcloud/talk/shareditems/model/SharedPollItem.kt +++ b/app/src/main/java/com/nextcloud/talk/shareditems/model/SharedPollItem.kt @@ -24,4 +24,5 @@ data class SharedPollItem( override val name: String, override val actorId: String, override val actorName: String, + override val dateTime: String ) : SharedItem diff --git a/app/src/main/java/com/nextcloud/talk/shareditems/repositories/SharedItemsRepositoryImpl.kt b/app/src/main/java/com/nextcloud/talk/shareditems/repositories/SharedItemsRepositoryImpl.kt index f2d669560..d35ebdd0a 100644 --- a/app/src/main/java/com/nextcloud/talk/shareditems/repositories/SharedItemsRepositoryImpl.kt +++ b/app/src/main/java/com/nextcloud/talk/shareditems/repositories/SharedItemsRepositoryImpl.kt @@ -36,6 +36,7 @@ import com.nextcloud.talk.shareditems.model.SharedLocationItem import com.nextcloud.talk.shareditems.model.SharedOtherItem import com.nextcloud.talk.shareditems.model.SharedPollItem import com.nextcloud.talk.utils.ApiUtils +import com.nextcloud.talk.utils.DateUtils import io.reactivex.Observable import retrofit2.Response import java.util.Locale @@ -83,6 +84,10 @@ class SharedItemsRepositoryImpl @Inject constructor(private val ncApi: NcApi) : if (mediaItems != null) { for (it in mediaItems) { val actorParameters = it.value.messageParameters!!["actor"]!! + val dateTime = DateUtils.getLocalDateTimeStringFromTimestamp( + it.value.timestamp * ONE_SECOND_IN_MILLIS + ) + if (it.value.messageParameters?.containsKey("file") == true) { val fileParameters = it.value.messageParameters!!["file"]!! @@ -94,8 +99,8 @@ class SharedItemsRepositoryImpl @Inject constructor(private val ncApi: NcApi) : fileParameters["name"]!!, actorParameters["id"]!!, actorParameters["name"]!!, + dateTime, fileParameters["size"]!!.toLong(), - it.value.timestamp, fileParameters["path"]!!, fileParameters["link"]!!, fileParameters["mimetype"]!!, @@ -110,7 +115,8 @@ class SharedItemsRepositoryImpl @Inject constructor(private val ncApi: NcApi) : objectParameters["id"]!!, objectParameters["name"]!!, actorParameters["id"]!!, - actorParameters["name"]!! + actorParameters["name"]!!, + dateTime ) } "geo-location" -> { @@ -119,6 +125,7 @@ class SharedItemsRepositoryImpl @Inject constructor(private val ncApi: NcApi) : objectParameters["name"]!!, actorParameters["id"]!!, actorParameters["name"]!!, + dateTime, Uri.parse(objectParameters["id"]!!.replace("geo:", "geo:0,0?z=11&q=")) ) } @@ -127,7 +134,8 @@ class SharedItemsRepositoryImpl @Inject constructor(private val ncApi: NcApi) : objectParameters["id"]!!, objectParameters["name"]!!, actorParameters["id"]!!, - actorParameters["name"]!! + actorParameters["name"]!!, + dateTime ) } } @@ -182,6 +190,7 @@ class SharedItemsRepositoryImpl @Inject constructor(private val ncApi: NcApi) : companion object { const val BATCH_SIZE: Int = 28 + private const val ONE_SECOND_IN_MILLIS = 1000 private val TAG = SharedItemsRepositoryImpl::class.simpleName } } diff --git a/app/src/main/res/layout/controller_chat.xml b/app/src/main/res/layout/controller_chat.xml index 5453d27df..60be4c6d4 100644 --- a/app/src/main/res/layout/controller_chat.xml +++ b/app/src/main/res/layout/controller_chat.xml @@ -115,7 +115,7 @@ android:orientation="vertical"> diff --git a/app/src/main/res/layout/shared_item_list.xml b/app/src/main/res/layout/shared_item_list.xml index 81c680408..5b399bc0f 100644 --- a/app/src/main/res/layout/shared_item_list.xml +++ b/app/src/main/res/layout/shared_item_list.xml @@ -92,7 +92,7 @@ tools:text="11 KB" /> + + + +