mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-27 17:08:34 +03: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
a7a56a64a4
commit
4c8c8ac98a
9 changed files with 52 additions and 17 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -5,4 +5,5 @@ interface SharedItem {
|
|||
val name: String
|
||||
val actorId: String
|
||||
val actorName: String
|
||||
val dateTime: String
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -24,4 +24,5 @@ data class SharedOtherItem(
|
|||
override val name: String,
|
||||
override val actorId: String,
|
||||
override val actorName: String,
|
||||
override val dateTime: String
|
||||
) : SharedItem
|
||||
|
|
|
@ -24,4 +24,5 @@ data class SharedPollItem(
|
|||
override val name: String,
|
||||
override val actorId: String,
|
||||
override val actorName: String,
|
||||
override val dateTime: String
|
||||
) : 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.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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@
|
|||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:id="@+id/separator"
|
||||
android:id="@+id/separator_1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/controller_chat_separator" />
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
tools:text="11 KB" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/separator"
|
||||
android:id="@+id/separator_1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/standard_quarter_margin"
|
||||
|
@ -110,6 +110,25 @@
|
|||
android:textSize="14sp"
|
||||
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>
|
||||
</RelativeLayout>
|
||||
|
|
Loading…
Reference in a new issue