Add a View to show the beginning of the timeline (parity with iOS)
This commit is contained in:
parent
5209627f67
commit
2cb0060f96
33 changed files with 156 additions and 28 deletions
|
|
@ -373,6 +373,7 @@ private fun MessagesViewContent(
|
|||
TimelineView(
|
||||
modifier = Modifier.padding(paddingValues),
|
||||
state = state.timelineState,
|
||||
roomName = state.roomName.dataOrNull(),
|
||||
onMessageClicked = onMessageClicked,
|
||||
onMessageLongClicked = onMessageLongClicked,
|
||||
onUserDataClicked = onUserDataClicked,
|
||||
|
|
|
|||
|
|
@ -43,7 +43,11 @@ import kotlin.random.Random
|
|||
|
||||
fun aTimelineState(timelineItems: ImmutableList<TimelineItem> = persistentListOf()) = TimelineState(
|
||||
timelineItems = timelineItems,
|
||||
paginationState = MatrixTimeline.PaginationState(isBackPaginating = false, hasMoreToLoadBackwards = true),
|
||||
paginationState = MatrixTimeline.PaginationState(
|
||||
isBackPaginating = false,
|
||||
hasMoreToLoadBackwards = true,
|
||||
beginningOfRoomReached = false,
|
||||
),
|
||||
highlightedEventId = null,
|
||||
userHasPermissionToSendMessage = true,
|
||||
hasNewItems = false,
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ import io.element.android.features.messages.impl.timeline.components.TimelineIte
|
|||
import io.element.android.features.messages.impl.timeline.components.TimelineItemStateEventRow
|
||||
import io.element.android.features.messages.impl.timeline.components.TimelineItemVirtualRow
|
||||
import io.element.android.features.messages.impl.timeline.components.group.GroupHeaderView
|
||||
import io.element.android.features.messages.impl.timeline.components.virtual.TimelineItemRoomBeginningView
|
||||
import io.element.android.features.messages.impl.timeline.components.virtual.TimelineLoadingMoreIndicator
|
||||
import io.element.android.features.messages.impl.timeline.di.LocalTimelineItemPresenterFactories
|
||||
import io.element.android.features.messages.impl.timeline.di.aFakeTimelineItemPresenterFactories
|
||||
|
|
@ -82,6 +83,7 @@ import kotlinx.coroutines.launch
|
|||
@Composable
|
||||
fun TimelineView(
|
||||
state: TimelineState,
|
||||
roomName: String?,
|
||||
onUserDataClicked: (UserId) -> Unit,
|
||||
onMessageClicked: (TimelineItem.Event) -> Unit,
|
||||
onMessageLongClicked: (TimelineItem.Event) -> Unit,
|
||||
|
|
@ -148,6 +150,11 @@ fun TimelineView(
|
|||
}
|
||||
}
|
||||
}
|
||||
if (state.paginationState.beginningOfRoomReached) {
|
||||
item(contentType = "BeginningOfRoomReached") {
|
||||
TimelineItemRoomBeginningView(roomName = roomName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TimelineScrollHelper(
|
||||
|
|
@ -346,6 +353,7 @@ internal fun TimelineViewPreview(
|
|||
) {
|
||||
TimelineView(
|
||||
state = aTimelineState(timelineItems),
|
||||
roomName = null,
|
||||
onMessageClicked = {},
|
||||
onTimestampClicked = {},
|
||||
onUserDataClicked = {},
|
||||
|
|
|
|||
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* Copyright (c) 2023 New Vector Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.element.android.features.messages.impl.timeline.components.virtual
|
||||
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.element.android.features.messages.impl.R
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.libraries.designsystem.theme.components.Text
|
||||
import io.element.android.libraries.theme.ElementTheme
|
||||
|
||||
@Composable
|
||||
fun TimelineItemRoomBeginningView(
|
||||
roomName: String?,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
Box(
|
||||
modifier = modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp, vertical = 8.dp),
|
||||
contentAlignment = Alignment.Center,
|
||||
) {
|
||||
val text = if (roomName == null) {
|
||||
stringResource(id = R.string.room_timeline_beginning_of_room_no_name)
|
||||
} else {
|
||||
stringResource(id = R.string.room_timeline_beginning_of_room, roomName)
|
||||
}
|
||||
Text(
|
||||
color = MaterialTheme.colorScheme.secondary,
|
||||
style = ElementTheme.typography.fontBodyMdRegular,
|
||||
text = text,
|
||||
textAlign = TextAlign.Center,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@PreviewsDayNight
|
||||
@Composable
|
||||
internal fun TimelineItemRoomBeginningViewPreview() = ElementPreview {
|
||||
Column {
|
||||
TimelineItemRoomBeginningView(
|
||||
roomName = null,
|
||||
)
|
||||
TimelineItemRoomBeginningView(
|
||||
roomName = "Room Name",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -15,6 +15,8 @@
|
|||
</plurals>
|
||||
<string name="report_content_explanation">"Tato zpráva bude nahlášena správci vašeho domovského serveru. Nebude si moci přečíst žádné šifrované zprávy."</string>
|
||||
<string name="report_content_hint">"Důvod nahlášení tohoto obsahu"</string>
|
||||
<string name="room_timeline_beginning_of_room">"Toto je začátek %1$s."</string>
|
||||
<string name="room_timeline_beginning_of_room_no_name">"Toto je začátek této konverzace."</string>
|
||||
<string name="screen_room_mentions_at_room_subtitle">"Informujte celou místnost"</string>
|
||||
<string name="screen_report_content_block_user_hint">"Zaškrtněte, pokud chcete skrýt všechny aktuální a budoucí zprávy od tohoto uživatele"</string>
|
||||
<string name="screen_room_attachment_source_camera">"Fotoaparát"</string>
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@
|
|||
</plurals>
|
||||
<string name="report_content_explanation">"Diese Meldung wird an den Administrator deines Homeservers weitergeleitet. Dieser kann keine verschlüsselten Nachrichten lesen."</string>
|
||||
<string name="report_content_hint">"Grund für die Meldung dieses Inhalts"</string>
|
||||
<string name="room_timeline_beginning_of_room">"Dies ist der Anfang von %1$s."</string>
|
||||
<string name="room_timeline_beginning_of_room_no_name">"Dies ist der Anfang dieses Gesprächs."</string>
|
||||
<string name="screen_report_content_block_user_hint">"Prüfe, ob du alle aktuellen und zukünftigen Nachrichten dieses Benutzers ausblenden möchtest"</string>
|
||||
<string name="screen_room_attachment_source_camera">"Kamera"</string>
|
||||
<string name="screen_room_attachment_source_camera_photo">"Foto machen"</string>
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@
|
|||
</plurals>
|
||||
<string name="report_content_explanation">"Este mensaje se notificará al administrador de su homeserver. No podrán leer ningún mensaje cifrado."</string>
|
||||
<string name="report_content_hint">"Motivo para denunciar este contenido"</string>
|
||||
<string name="room_timeline_beginning_of_room">"Este es el principio de %1$s."</string>
|
||||
<string name="room_timeline_beginning_of_room_no_name">"Este es el principio de esta conversación."</string>
|
||||
<string name="screen_report_content_block_user_hint">"Marque si quieres ocultar todos los mensajes actuales y futuros de este usuario"</string>
|
||||
<string name="screen_report_content_block_user">"Bloquear usuario"</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@
|
|||
</plurals>
|
||||
<string name="report_content_explanation">"Ce message sera signalé à l’administrateur de votre serveur d’accueil. Il ne pourra lire aucun message chiffré."</string>
|
||||
<string name="report_content_hint">"Raison du signalement de ce contenu"</string>
|
||||
<string name="room_timeline_beginning_of_room">"Ceci est le début de %1$s."</string>
|
||||
<string name="room_timeline_beginning_of_room_no_name">"Ceci est le début de cette conversation."</string>
|
||||
<string name="screen_room_mentions_at_room_subtitle">"Notifier tout le salon"</string>
|
||||
<string name="screen_report_content_block_user_hint">"Cochez si vous souhaitez masquer tous les messages actuels et futurs de cet utilisateur."</string>
|
||||
<string name="screen_room_attachment_source_camera">"Appareil photo"</string>
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@
|
|||
</plurals>
|
||||
<string name="report_content_explanation">"Questo messaggio verrà segnalato all\'amministratore dell\'homeserver. Questi non sarà in grado di leggere i messaggi criptati."</string>
|
||||
<string name="report_content_hint">"Motivo della segnalazione di questo contenuto"</string>
|
||||
<string name="room_timeline_beginning_of_room">"Questo è l\'inizio di %1$s."</string>
|
||||
<string name="room_timeline_beginning_of_room_no_name">"Questo è l\'inizio della conversazione."</string>
|
||||
<string name="screen_report_content_block_user_hint">"Seleziona se vuoi nascondere tutti i messaggi attuali e futuri di questo utente"</string>
|
||||
<string name="screen_report_content_block_user">"Blocca utente"</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@
|
|||
</plurals>
|
||||
<string name="report_content_explanation">"Acest mesaj va fi raportat administratorilor homeserver-ului tau. Ei nu vor putea citi niciun mesaj criptat."</string>
|
||||
<string name="report_content_hint">"Motivul raportării acestui conținut"</string>
|
||||
<string name="room_timeline_beginning_of_room">"Acesta este începutul conversației %1$s."</string>
|
||||
<string name="room_timeline_beginning_of_room_no_name">"Acesta este începutul acestei conversații."</string>
|
||||
<string name="screen_report_content_block_user_hint">"Confirmați că doriți să ascundeți toate mesajele curente și viitoare de la acest utilizator"</string>
|
||||
<string name="screen_room_attachment_source_camera">"Cameră foto"</string>
|
||||
<string name="screen_room_attachment_source_camera_photo">"Faceți o fotografie"</string>
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@
|
|||
</plurals>
|
||||
<string name="report_content_explanation">"Это сообщение будет передано администратору вашего домашнего сервера. Они не смогут прочитать зашифрованные сообщения."</string>
|
||||
<string name="report_content_hint">"Причина, по которой вы пожаловались на этот контент"</string>
|
||||
<string name="room_timeline_beginning_of_room">"Это начало %1$s."</string>
|
||||
<string name="room_timeline_beginning_of_room_no_name">"Это начало разговора."</string>
|
||||
<string name="screen_room_mentions_at_room_subtitle">"Уведомить всю комнату"</string>
|
||||
<string name="screen_report_content_block_user_hint">"Отметьте, хотите ли вы скрыть все текущие и будущие сообщения от этого пользователя"</string>
|
||||
<string name="screen_room_attachment_source_camera">"Камера"</string>
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@
|
|||
</plurals>
|
||||
<string name="report_content_explanation">"Táto správa bude nahlásená správcovi vášho domovského servera. Nebude môcť prečítať žiadne šifrované správy."</string>
|
||||
<string name="report_content_hint">"Dôvod nahlásenia tohto obsahu"</string>
|
||||
<string name="room_timeline_beginning_of_room">"Toto je začiatok %1$s."</string>
|
||||
<string name="room_timeline_beginning_of_room_no_name">"Toto je začiatok tejto konverzácie."</string>
|
||||
<string name="screen_room_mentions_at_room_subtitle">"Informovať celú miestnosť"</string>
|
||||
<string name="screen_report_content_block_user_hint">"Označte, či chcete skryť všetky aktuálne a budúce správy od tohto používateľa"</string>
|
||||
<string name="screen_room_attachment_source_camera">"Kamera"</string>
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@
|
|||
</plurals>
|
||||
<string name="report_content_explanation">"This message will be reported to your homeserver’s administrator. They will not be able to read any encrypted messages."</string>
|
||||
<string name="report_content_hint">"Reason for reporting this content"</string>
|
||||
<string name="room_timeline_beginning_of_room">"This is the beginning of %1$s."</string>
|
||||
<string name="room_timeline_beginning_of_room_no_name">"This is the beginning of this conversation."</string>
|
||||
<string name="screen_room_mentions_at_room_subtitle">"Notify the whole room"</string>
|
||||
<string name="screen_report_content_block_user_hint">"Check if you want to hide all current and future messages from this user"</string>
|
||||
<string name="screen_room_attachment_source_camera">"Camera"</string>
|
||||
|
|
@ -41,6 +43,7 @@
|
|||
<string name="screen_room_notification_settings_error_loading_settings">"An error occurred while loading notification settings."</string>
|
||||
<string name="screen_room_notification_settings_error_restoring_default">"Failed restoring the default mode, please try again."</string>
|
||||
<string name="screen_room_notification_settings_error_setting_mode">"Failed setting the mode, please try again."</string>
|
||||
<string name="screen_room_notification_settings_mentions_only_disclaimer">"Your homeserver does not support this option in encrypted rooms, you won\'t get notified in this room."</string>
|
||||
<string name="screen_room_notification_settings_mode_all_messages">"All messages"</string>
|
||||
<string name="screen_room_notification_settings_room_custom_settings_title">"In this room, notify me for"</string>
|
||||
<string name="screen_room_reactions_show_less">"Show less"</string>
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ If you proceed, some of your settings may change."</string>
|
|||
<string name="screen_notification_settings_enable_notifications">"Enable notifications on this device"</string>
|
||||
<string name="screen_notification_settings_failed_fixing_configuration">"The configuration has not been corrected, please try again."</string>
|
||||
<string name="screen_notification_settings_group_chats">"Group chats"</string>
|
||||
<string name="screen_notification_settings_mentions_only_disclaimer">"Your homeserver does not support this option in encrypted rooms, you may not get notified in some rooms."</string>
|
||||
<string name="screen_notification_settings_mentions_section_title">"Mentions"</string>
|
||||
<string name="screen_notification_settings_mode_all">"All"</string>
|
||||
<string name="screen_notification_settings_mode_mentions">"Mentions"</string>
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
<string name="screen_room_notification_settings_error_loading_settings">"An error occurred while loading notification settings."</string>
|
||||
<string name="screen_room_notification_settings_error_restoring_default">"Failed restoring the default mode, please try again."</string>
|
||||
<string name="screen_room_notification_settings_error_setting_mode">"Failed setting the mode, please try again."</string>
|
||||
<string name="screen_room_notification_settings_mentions_only_disclaimer">"Your homeserver does not support this option in encrypted rooms, you won\'t get notified in this room."</string>
|
||||
<string name="screen_room_notification_settings_mode_all_messages">"All messages"</string>
|
||||
<string name="screen_room_notification_settings_room_custom_settings_title">"In this room, notify me for"</string>
|
||||
<string name="screen_dm_details_block_alert_action">"Block"</string>
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@
|
|||
<string name="screen_recovery_key_change_success">"Klíč pro obnovení byl změněn"</string>
|
||||
<string name="screen_recovery_key_change_title">"Změnit klíč pro obnovení?"</string>
|
||||
<string name="screen_recovery_key_confirm_description">"Zadejte klíč pro obnovení a potvrďte přístup k záloze chatu."</string>
|
||||
<string name="screen_recovery_key_confirm_error_content">"Zkuste prosím znovu potvrdit přístup k záloze chatu."</string>
|
||||
<string name="screen_recovery_key_confirm_error_title">"Nesprávný klíč pro obnovení"</string>
|
||||
<string name="screen_recovery_key_confirm_key_description">"Zadejte kód o délce 48 znaků."</string>
|
||||
<string name="screen_recovery_key_confirm_key_placeholder">"Zadejte…"</string>
|
||||
<string name="screen_recovery_key_confirm_success">"Klíč pro obnovení potvrzen"</string>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue