mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 03:29:28 +01:00
Shared items: Show actor and date-time
For all item types it will now shown who (actor) and when (date-time) the item was shared. Signed-off-by: Tim Krüger <t@timkrueger.me>
This commit is contained in:
parent
81a3e8216d
commit
f73b9c4727
@ -37,7 +37,6 @@ import com.nextcloud.talk.shareditems.model.SharedItem
|
|||||||
import com.nextcloud.talk.shareditems.model.SharedLocationItem
|
import com.nextcloud.talk.shareditems.model.SharedLocationItem
|
||||||
import com.nextcloud.talk.shareditems.model.SharedOtherItem
|
import com.nextcloud.talk.shareditems.model.SharedOtherItem
|
||||||
import com.nextcloud.talk.shareditems.model.SharedPollItem
|
import com.nextcloud.talk.shareditems.model.SharedPollItem
|
||||||
import com.nextcloud.talk.utils.DateUtils
|
|
||||||
|
|
||||||
class SharedItemsListViewHolder(
|
class SharedItemsListViewHolder(
|
||||||
override val binding: SharedItemListBinding,
|
override val binding: SharedItemListBinding,
|
||||||
@ -62,16 +61,18 @@ class SharedItemsListViewHolder(
|
|||||||
it
|
it
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
binding.fileDate.text = DateUtils.getLocalDateTimeStringFromTimestamp(
|
binding.fileDate.text = item.dateTime
|
||||||
item.date * ONE_SECOND_IN_MILLIS
|
binding.actor.text = item.actorName
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBind(item: SharedPollItem, showPoll: (item: SharedItem, context: Context) -> Unit) {
|
override fun onBind(item: SharedPollItem, showPoll: (item: SharedItem, context: Context) -> Unit) {
|
||||||
super.onBind(item, showPoll)
|
super.onBind(item, showPoll)
|
||||||
|
|
||||||
binding.fileName.text = item.name
|
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.hierarchy.setPlaceholderImage(R.drawable.ic_baseline_bar_chart_24)
|
||||||
image.setColorFilter(
|
image.setColorFilter(
|
||||||
ContextCompat.getColor(image.context, R.color.high_emphasis_menu_icon),
|
ContextCompat.getColor(image.context, R.color.high_emphasis_menu_icon),
|
||||||
@ -86,7 +87,10 @@ class SharedItemsListViewHolder(
|
|||||||
super.onBind(item)
|
super.onBind(item)
|
||||||
|
|
||||||
binding.fileName.text = item.name
|
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.hierarchy.setPlaceholderImage(R.drawable.ic_baseline_location_on_24)
|
||||||
image.setColorFilter(
|
image.setColorFilter(
|
||||||
ContextCompat.getColor(image.context, R.color.high_emphasis_menu_icon),
|
ContextCompat.getColor(image.context, R.color.high_emphasis_menu_icon),
|
||||||
@ -105,15 +109,14 @@ class SharedItemsListViewHolder(
|
|||||||
super.onBind(item)
|
super.onBind(item)
|
||||||
|
|
||||||
binding.fileName.text = item.name
|
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.hierarchy.setPlaceholderImage(R.drawable.ic_mimetype_file)
|
||||||
image.setColorFilter(
|
image.setColorFilter(
|
||||||
ContextCompat.getColor(image.context, R.color.high_emphasis_menu_icon),
|
ContextCompat.getColor(image.context, R.color.high_emphasis_menu_icon),
|
||||||
android.graphics.PorterDuff.Mode.SRC_IN
|
android.graphics.PorterDuff.Mode.SRC_IN
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
|
||||||
private const val ONE_SECOND_IN_MILLIS = 1000
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,8 @@ data class SharedFileItem(
|
|||||||
override val name: String,
|
override val name: String,
|
||||||
override val actorId: String,
|
override val actorId: String,
|
||||||
override val actorName: String,
|
override val actorName: String,
|
||||||
|
override val dateTime: String,
|
||||||
val fileSize: Long,
|
val fileSize: Long,
|
||||||
val date: Long,
|
|
||||||
val path: String,
|
val path: String,
|
||||||
val link: String,
|
val link: String,
|
||||||
val mimeType: String,
|
val mimeType: String,
|
||||||
|
@ -5,4 +5,5 @@ interface SharedItem {
|
|||||||
val name: String
|
val name: String
|
||||||
val actorId: String
|
val actorId: String
|
||||||
val actorName: String
|
val actorName: String
|
||||||
|
val dateTime: String
|
||||||
}
|
}
|
||||||
|
@ -26,5 +26,6 @@ data class SharedLocationItem(
|
|||||||
override val name: String,
|
override val name: String,
|
||||||
override val actorId: String,
|
override val actorId: String,
|
||||||
override val actorName: String,
|
override val actorName: String,
|
||||||
|
override val dateTime: String,
|
||||||
val geoUri: Uri
|
val geoUri: Uri
|
||||||
) : SharedItem
|
) : SharedItem
|
||||||
|
@ -24,4 +24,5 @@ data class SharedOtherItem(
|
|||||||
override val name: String,
|
override val name: String,
|
||||||
override val actorId: String,
|
override val actorId: String,
|
||||||
override val actorName: String,
|
override val actorName: String,
|
||||||
|
override val dateTime: String
|
||||||
) : SharedItem
|
) : SharedItem
|
||||||
|
@ -24,4 +24,5 @@ data class SharedPollItem(
|
|||||||
override val name: String,
|
override val name: String,
|
||||||
override val actorId: String,
|
override val actorId: String,
|
||||||
override val actorName: String,
|
override val actorName: String,
|
||||||
|
override val dateTime: String
|
||||||
) : SharedItem
|
) : SharedItem
|
||||||
|
@ -36,6 +36,7 @@ import com.nextcloud.talk.shareditems.model.SharedLocationItem
|
|||||||
import com.nextcloud.talk.shareditems.model.SharedOtherItem
|
import com.nextcloud.talk.shareditems.model.SharedOtherItem
|
||||||
import com.nextcloud.talk.shareditems.model.SharedPollItem
|
import com.nextcloud.talk.shareditems.model.SharedPollItem
|
||||||
import com.nextcloud.talk.utils.ApiUtils
|
import com.nextcloud.talk.utils.ApiUtils
|
||||||
|
import com.nextcloud.talk.utils.DateUtils
|
||||||
import io.reactivex.Observable
|
import io.reactivex.Observable
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
@ -83,6 +84,10 @@ class SharedItemsRepositoryImpl @Inject constructor(private val ncApi: NcApi) :
|
|||||||
if (mediaItems != null) {
|
if (mediaItems != null) {
|
||||||
for (it in mediaItems) {
|
for (it in mediaItems) {
|
||||||
val actorParameters = it.value.messageParameters!!["actor"]!!
|
val actorParameters = it.value.messageParameters!!["actor"]!!
|
||||||
|
val dateTime = DateUtils.getLocalDateTimeStringFromTimestamp(
|
||||||
|
it.value.timestamp * ONE_SECOND_IN_MILLIS
|
||||||
|
)
|
||||||
|
|
||||||
if (it.value.messageParameters?.containsKey("file") == true) {
|
if (it.value.messageParameters?.containsKey("file") == true) {
|
||||||
val fileParameters = it.value.messageParameters!!["file"]!!
|
val fileParameters = it.value.messageParameters!!["file"]!!
|
||||||
|
|
||||||
@ -94,8 +99,8 @@ class SharedItemsRepositoryImpl @Inject constructor(private val ncApi: NcApi) :
|
|||||||
fileParameters["name"]!!,
|
fileParameters["name"]!!,
|
||||||
actorParameters["id"]!!,
|
actorParameters["id"]!!,
|
||||||
actorParameters["name"]!!,
|
actorParameters["name"]!!,
|
||||||
|
dateTime,
|
||||||
fileParameters["size"]!!.toLong(),
|
fileParameters["size"]!!.toLong(),
|
||||||
it.value.timestamp,
|
|
||||||
fileParameters["path"]!!,
|
fileParameters["path"]!!,
|
||||||
fileParameters["link"]!!,
|
fileParameters["link"]!!,
|
||||||
fileParameters["mimetype"]!!,
|
fileParameters["mimetype"]!!,
|
||||||
@ -110,7 +115,8 @@ class SharedItemsRepositoryImpl @Inject constructor(private val ncApi: NcApi) :
|
|||||||
objectParameters["id"]!!,
|
objectParameters["id"]!!,
|
||||||
objectParameters["name"]!!,
|
objectParameters["name"]!!,
|
||||||
actorParameters["id"]!!,
|
actorParameters["id"]!!,
|
||||||
actorParameters["name"]!!
|
actorParameters["name"]!!,
|
||||||
|
dateTime
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
"geo-location" -> {
|
"geo-location" -> {
|
||||||
@ -119,6 +125,7 @@ class SharedItemsRepositoryImpl @Inject constructor(private val ncApi: NcApi) :
|
|||||||
objectParameters["name"]!!,
|
objectParameters["name"]!!,
|
||||||
actorParameters["id"]!!,
|
actorParameters["id"]!!,
|
||||||
actorParameters["name"]!!,
|
actorParameters["name"]!!,
|
||||||
|
dateTime,
|
||||||
Uri.parse(objectParameters["id"]!!.replace("geo:", "geo:0,0?z=11&q="))
|
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["id"]!!,
|
||||||
objectParameters["name"]!!,
|
objectParameters["name"]!!,
|
||||||
actorParameters["id"]!!,
|
actorParameters["id"]!!,
|
||||||
actorParameters["name"]!!
|
actorParameters["name"]!!,
|
||||||
|
dateTime
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -182,6 +190,7 @@ class SharedItemsRepositoryImpl @Inject constructor(private val ncApi: NcApi) :
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val BATCH_SIZE: Int = 28
|
const val BATCH_SIZE: Int = 28
|
||||||
|
private const val ONE_SECOND_IN_MILLIS = 1000
|
||||||
private val TAG = SharedItemsRepositoryImpl::class.simpleName
|
private val TAG = SharedItemsRepositoryImpl::class.simpleName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@
|
|||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/separator"
|
android:id="@+id/separator_1"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
android:background="@color/controller_chat_separator" />
|
android:background="@color/controller_chat_separator" />
|
||||||
|
@ -92,7 +92,7 @@
|
|||||||
tools:text="11 KB" />
|
tools:text="11 KB" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/separator"
|
android:id="@+id/separator_1"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="@dimen/standard_quarter_margin"
|
android:layout_marginStart="@dimen/standard_quarter_margin"
|
||||||
@ -110,6 +110,25 @@
|
|||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
tools:text="04-05-2022 21:16" />
|
tools:text="04-05-2022 21:16" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/separator_2"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="@dimen/standard_quarter_margin"
|
||||||
|
android:text="|"
|
||||||
|
android:textColor="@color/textColorMaxContrast"
|
||||||
|
android:textSize="14sp"
|
||||||
|
tools:ignore="HardcodedText" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/actor"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="@dimen/standard_quarter_margin"
|
||||||
|
android:textColor="@color/textColorMaxContrast"
|
||||||
|
android:textSize="14sp"
|
||||||
|
tools:text="Actor" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
Loading…
Reference in New Issue
Block a user