remove unnecessary code and cleaned onBindViewHolder

This commit is contained in:
Chumva 2018-08-09 17:05:47 +03:00
parent 1d9ee00225
commit 0a28034449
2 changed files with 18 additions and 8 deletions

View file

@ -163,10 +163,8 @@
android:id="@+id/options_title"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginEnd="@dimen/content_padding_standard"
android:layout_marginLeft="@dimen/content_padding_standard"
android:layout_marginRight="@dimen/content_padding_standard"
android:layout_marginStart="@dimen/content_padding_standard"
android:background="?attr/selectableItemBackgroundBorderless"
android:paddingLeft="@dimen/content_padding_half"
android:paddingRight="@dimen/content_padding_half"

View file

@ -528,20 +528,32 @@ class MyLocationTabFragment : Fragment(), TelegramListener, ChatLiveMessagesList
notifyItemChanged(position)
}
}
val stopDescription = "${getText(R.string.stop_at)}:"
holder.stopSharingDescr?.text = stopDescription
holder.stopSharingDescr?.apply {
visibility = View.VISIBLE
val stopDescription = "${getText(R.string.stop_at)}:"
text = stopDescription
}
holder.stopSharingFirstPart?.text = OsmandFormatter.getFormattedTime(expiresIn)
holder.stopSharingFirstPart?.apply {
visibility = View.VISIBLE
text = OsmandFormatter.getFormattedTime(expiresIn)
}
val stopSharingSecondPart = "(${getString(R.string.in_time,
OsmandFormatter.getFormattedDuration(context!!, expiresIn, true))})"
holder.stopSharingSecondPart?.text = stopSharingSecondPart
holder.stopSharingSecondPart?.apply {
visibility = View.VISIBLE
val stopSharingSecondPart = "(${getString(R.string.in_time,
OsmandFormatter.getFormattedDuration(context!!, expiresIn, true))})"
text = stopSharingSecondPart
}
if (expiresIn == 0) {
removeItem(chat)
}
}
} else {
holder.textInArea?.visibility = View.INVISIBLE
holder.stopSharingDescr?.visibility = View.INVISIBLE
holder.stopSharingFirstPart?.visibility = View.INVISIBLE
holder.stopSharingSecondPart?.visibility = View.INVISIBLE
}
}
}