add check for messages expire time

This commit is contained in:
Chumva 2018-08-16 10:41:46 +03:00
parent 1b4b83e5bd
commit be04f298e6
2 changed files with 21 additions and 8 deletions

View file

@ -577,19 +577,33 @@ class MyLocationTabFragment : Fragment(), TelegramListener {
} }
holder.stopSharingDescr?.apply { holder.stopSharingDescr?.apply {
if (expiresIn > 0) {
visibility = View.VISIBLE visibility = View.VISIBLE
text = "${getText(R.string.stop_at)}:" text = "${getText(R.string.stop_at)}:"
} else {
visibility = View.INVISIBLE
}
} }
holder.stopSharingFirstPart?.apply { holder.stopSharingFirstPart?.apply {
if (expiresIn > 0) {
visibility = View.VISIBLE visibility = View.VISIBLE
text = OsmandFormatter.getFormattedTime(expiresIn) text = OsmandFormatter.getFormattedTime(expiresIn)
} else {
visibility = View.INVISIBLE
}
} }
holder.stopSharingSecondPart?.apply { holder.stopSharingSecondPart?.apply {
if (expiresIn > 0) {
visibility = View.VISIBLE visibility = View.VISIBLE
text = "(${getString(R.string.in_time, text = "(${getString(
OsmandFormatter.getFormattedDuration(context!!, expiresIn, true))})" R.string.in_time,
OsmandFormatter.getFormattedDuration(context!!, expiresIn, true)
)})"
} else {
visibility = View.INVISIBLE
}
} }
} }
} }

View file

@ -324,7 +324,6 @@ class SetTimeDialogFragment : DialogFragment(), TelegramLocationListener, Telegr
private fun getListItemLiveTime(message: TdApi.Message): Long = (System.currentTimeMillis() / 1000) - message.date private fun getListItemLiveTime(message: TdApi.Message): Long = (System.currentTimeMillis() / 1000) - message.date
inner class ChatViewHolder(val view: View) : RecyclerView.ViewHolder(view) { inner class ChatViewHolder(val view: View) : RecyclerView.ViewHolder(view) {
val icon: ImageView? = view.findViewById(R.id.icon) val icon: ImageView? = view.findViewById(R.id.icon)
val title: TextView? = view.findViewById(R.id.title) val title: TextView? = view.findViewById(R.id.title)