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 {
visibility = View.VISIBLE
text = "${getText(R.string.stop_at)}:"
if (expiresIn > 0) {
visibility = View.VISIBLE
text = "${getText(R.string.stop_at)}:"
} else {
visibility = View.INVISIBLE
}
}
holder.stopSharingFirstPart?.apply {
visibility = View.VISIBLE
text = OsmandFormatter.getFormattedTime(expiresIn)
if (expiresIn > 0) {
visibility = View.VISIBLE
text = OsmandFormatter.getFormattedTime(expiresIn)
} else {
visibility = View.INVISIBLE
}
}
holder.stopSharingSecondPart?.apply {
visibility = View.VISIBLE
text = "(${getString(R.string.in_time,
OsmandFormatter.getFormattedDuration(context!!, expiresIn, true))})"
if (expiresIn > 0) {
visibility = View.VISIBLE
text = "(${getString(
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
inner class ChatViewHolder(val view: View) : RecyclerView.ViewHolder(view) {
val icon: ImageView? = view.findViewById(R.id.icon)
val title: TextView? = view.findViewById(R.id.title)