mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-21 20:49:36 +01:00
Fix date selection & time formatting for lobby
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
86974a8437
commit
85a322dd61
@ -205,13 +205,13 @@ class ConversationInfoController(args: Bundle) : BaseController(args) {
|
|||||||
|
|
||||||
reconfigureLobbyTimerView()
|
reconfigureLobbyTimerView()
|
||||||
|
|
||||||
val currentTimeCalendar = Calendar.getInstance()
|
|
||||||
if (conversation!!.lobbyTimer != null && conversation!!.lobbyTimer != 0L) {
|
|
||||||
currentTimeCalendar.set(Calendar.MILLISECOND, (conversation!!.lobbyTimer * 1000).toInt())
|
|
||||||
}
|
|
||||||
|
|
||||||
startTimeView.setOnClickListener {
|
startTimeView.setOnClickListener {
|
||||||
MaterialDialog(activity!!, BottomSheet(WRAP_CONTENT)).show {
|
MaterialDialog(activity!!, BottomSheet(WRAP_CONTENT)).show {
|
||||||
|
val currentTimeCalendar = Calendar.getInstance()
|
||||||
|
if (conversation!!.lobbyTimer != null && conversation!!.lobbyTimer != 0L) {
|
||||||
|
currentTimeCalendar.timeInMillis = conversation!!.lobbyTimer * 1000
|
||||||
|
}
|
||||||
|
|
||||||
dateTimePicker(minDateTime = Calendar.getInstance(), requireFutureDateTime =
|
dateTimePicker(minDateTime = Calendar.getInstance(), requireFutureDateTime =
|
||||||
true, currentDateTime = currentTimeCalendar, dateTimeCallback = { _,
|
true, currentDateTime = currentTimeCalendar, dateTimeCallback = { _,
|
||||||
dateTime ->
|
dateTime ->
|
||||||
@ -234,7 +234,7 @@ class ConversationInfoController(args: Bundle) : BaseController(args) {
|
|||||||
val isChecked = (conversationInfoLobby.findViewById<View>(R.id.mp_checkable) as SwitchCompat).isChecked
|
val isChecked = (conversationInfoLobby.findViewById<View>(R.id.mp_checkable) as SwitchCompat).isChecked
|
||||||
|
|
||||||
if (dateTime != null && isChecked) {
|
if (dateTime != null && isChecked) {
|
||||||
conversation!!.lobbyTimer = dateTime.timeInMillis / 1000
|
conversation!!.lobbyTimer = (dateTime.timeInMillis - (dateTime.time.seconds * 1000)) / 1000
|
||||||
} else if (!isChecked) {
|
} else if (!isChecked) {
|
||||||
conversation!!.lobbyTimer = 0
|
conversation!!.lobbyTimer = 0
|
||||||
}
|
}
|
||||||
@ -534,8 +534,8 @@ class ConversationInfoController(args: Bundle) : BaseController(args) {
|
|||||||
R.drawable.ic_link_white_24px))
|
R.drawable.ic_link_white_24px))
|
||||||
Conversation.ConversationType.ROOM_SYSTEM -> {
|
Conversation.ConversationType.ROOM_SYSTEM -> {
|
||||||
val layers = arrayOfNulls<Drawable>(2)
|
val layers = arrayOfNulls<Drawable>(2)
|
||||||
layers[0] = context!!.getDrawable(R.drawable.ic_launcher_background)
|
layers[0] = context.getDrawable(R.drawable.ic_launcher_background)
|
||||||
layers[1] = context!!.getDrawable(R.drawable.ic_launcher_foreground)
|
layers[1] = context.getDrawable(R.drawable.ic_launcher_foreground)
|
||||||
val layerDrawable = LayerDrawable(layers)
|
val layerDrawable = LayerDrawable(layers)
|
||||||
conversationAvatarImageView.hierarchy.setPlaceholderImage(DisplayUtils.getRoundedDrawable(layerDrawable))
|
conversationAvatarImageView.hierarchy.setPlaceholderImage(DisplayUtils.getRoundedDrawable(layerDrawable))
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ object DateUtils {
|
|||||||
val tz = cal.timeZone
|
val tz = cal.timeZone
|
||||||
|
|
||||||
/* date formatter in local timezone */
|
/* date formatter in local timezone */
|
||||||
val format = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.MEDIUM, Locale
|
val format = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.SHORT, Locale
|
||||||
.getDefault())
|
.getDefault())
|
||||||
format.timeZone = tz
|
format.timeZone = tz
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user