Timeline: render TimelineItemReadMarkerModel

This commit is contained in:
Benoit Marty
2023-11-14 18:10:26 +01:00
parent 2f71be0404
commit 3db5d8bf68
23 changed files with 77 additions and 12 deletions

View File

@@ -21,6 +21,7 @@ import androidx.compose.ui.Modifier
import io.element.android.features.messages.impl.timeline.session.SessionState
import io.element.android.features.messages.impl.timeline.components.virtual.TimelineEncryptedHistoryBannerView
import io.element.android.features.messages.impl.timeline.components.virtual.TimelineItemDaySeparatorView
import io.element.android.features.messages.impl.timeline.components.virtual.TimelineItemReadMarkerView
import io.element.android.features.messages.impl.timeline.model.TimelineItem
import io.element.android.features.messages.impl.timeline.model.virtual.TimelineItemDaySeparatorModel
import io.element.android.features.messages.impl.timeline.model.virtual.TimelineItemEncryptedHistoryBannerVirtualModel
@@ -34,7 +35,7 @@ fun TimelineItemVirtualRow(
) {
when (virtual.model) {
is TimelineItemDaySeparatorModel -> TimelineItemDaySeparatorView(virtual.model, modifier)
TimelineItemReadMarkerModel -> return
TimelineItemReadMarkerModel -> TimelineItemReadMarkerView()
is TimelineItemEncryptedHistoryBannerVirtualModel -> TimelineEncryptedHistoryBannerView(sessionState, modifier)
}
}

View File

@@ -0,0 +1,64 @@
/*
* 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.Arrangement.spacedBy
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
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.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.HorizontalDivider
import io.element.android.libraries.designsystem.theme.components.Text
import io.element.android.libraries.theme.ElementTheme
@Composable
internal fun TimelineItemReadMarkerView(
modifier: Modifier = Modifier
) {
Column(
modifier = modifier
.fillMaxWidth()
.padding(vertical = 12.dp, horizontal = 18.dp),
horizontalAlignment = Alignment.End,
verticalArrangement = spacedBy(4.dp),
) {
Text(
text = stringResource(id = R.string.room_timeline_read_marker_title).uppercase(),
style = ElementTheme.typography.fontBodySmMedium,
color = ElementTheme.colors.textSecondary,
)
HorizontalDivider(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 2.dp),
color = ElementTheme.colors.borderInteractivePrimary,
)
}
}
@PreviewsDayNight
@Composable
internal fun TimelineItemReadMarkerViewPreview() = ElementPreview {
TimelineItemReadMarkerView()
}

View File

@@ -17,6 +17,7 @@
<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="room_timeline_read_marker_title">"Nové"</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>

View File

@@ -16,6 +16,7 @@
<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="room_timeline_read_marker_title">"Neu"</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>

View File

@@ -16,6 +16,7 @@
<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="room_timeline_read_marker_title">"Nuevos"</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>

View File

@@ -16,6 +16,7 @@
<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="room_timeline_read_marker_title">"Nouveau"</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>

View File

@@ -16,6 +16,7 @@
<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="room_timeline_read_marker_title">"Nuovo"</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>

View File

@@ -17,6 +17,7 @@
<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="room_timeline_read_marker_title">"Nou"</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>

View File

@@ -17,6 +17,7 @@
<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="room_timeline_read_marker_title">"Новый"</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>

View File

@@ -17,6 +17,7 @@
<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="room_timeline_read_marker_title">"Nové"</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>

View File

@@ -12,6 +12,7 @@
<item quantity="other">"%1$d 個聊天室變更"</item>
</plurals>
<string name="report_content_hint">"檢舉這個內容的原因"</string>
<string name="room_timeline_read_marker_title">"新訊息"</string>
<string name="screen_room_attachment_source_camera">"照相機"</string>
<string name="screen_room_attachment_source_camera_photo">"拍照"</string>
<string name="screen_room_attachment_source_camera_video">"錄影"</string>

View File

@@ -16,6 +16,7 @@
<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="room_timeline_read_marker_title">"New"</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>

View File

@@ -209,7 +209,6 @@
<item quantity="other">"%d hlasů"</item>
</plurals>
<string name="preference_rageshake">"Zatřeste zařízením pro nahlášení chyby"</string>
<string name="room_timeline_read_marker_title">"Nové"</string>
<string name="screen_media_picker_error_failed_selection">"Výběr média se nezdařil, zkuste to prosím znovu."</string>
<string name="screen_media_upload_preview_error_failed_processing">"Nahrání média se nezdařilo, zkuste to prosím znovu."</string>
<string name="screen_media_upload_preview_error_failed_sending">"Nahrání média se nezdařilo, zkuste to prosím znovu."</string>

View File

@@ -175,7 +175,6 @@
<item quantity="other">"%d Stimmen"</item>
</plurals>
<string name="preference_rageshake">"Schüttel heftig zum Melden von Fehlern"</string>
<string name="room_timeline_read_marker_title">"Neu"</string>
<string name="screen_media_picker_error_failed_selection">"Medienauswahl fehlgeschlagen, bitte versuche es erneut."</string>
<string name="screen_media_upload_preview_error_failed_processing">"Fehler beim Verarbeiten des hochgeladenen Mediums. Bitte versuche es erneut."</string>
<string name="screen_media_upload_preview_error_failed_sending">"Das Hochladen der Medien ist fehlgeschlagen. Bitte versuche es erneut."</string>

View File

@@ -105,7 +105,6 @@
<item quantity="other">"%1$d miembros"</item>
</plurals>
<string name="preference_rageshake">"Agitar con fuerza para informar de un error"</string>
<string name="room_timeline_read_marker_title">"Nuevos"</string>
<string name="settings_version_number">"Versión: %1$s (%2$s)"</string>
<string name="test_language_identifier">"es"</string>
<string name="dialog_title_error">"Error"</string>

View File

@@ -202,7 +202,6 @@
<item quantity="other">"%d votes"</item>
</plurals>
<string name="preference_rageshake">"Rageshake pour signaler un problème"</string>
<string name="room_timeline_read_marker_title">"Nouveau"</string>
<string name="screen_media_picker_error_failed_selection">"Échec de la sélection du média, veuillez réessayer."</string>
<string name="screen_media_upload_preview_error_failed_processing">"Échec du traitement des médias à télécharger, veuillez réessayer."</string>
<string name="screen_media_upload_preview_error_failed_sending">"Échec du téléchargement du média, veuillez réessayer."</string>

View File

@@ -105,7 +105,6 @@
<item quantity="other">"%1$d membri"</item>
</plurals>
<string name="preference_rageshake">"Scuoti per segnalare un problema"</string>
<string name="room_timeline_read_marker_title">"Nuovo"</string>
<string name="settings_version_number">"Versione: %1$s (%2$s)"</string>
<string name="test_language_identifier">"it"</string>
<string name="dialog_title_error">"Errore"</string>

View File

@@ -159,7 +159,6 @@
<item quantity="other">"%d voturi"</item>
</plurals>
<string name="preference_rageshake">"Rageshake pentru a raporta erori"</string>
<string name="room_timeline_read_marker_title">"Nou"</string>
<string name="screen_media_picker_error_failed_selection">"Selectarea fișierelor media a eșuat, încercați din nou."</string>
<string name="screen_media_upload_preview_error_failed_processing">"Procesarea datelor media a eșuat, vă rugăm să încercați din nou."</string>
<string name="screen_media_upload_preview_error_failed_sending">"Încărcarea fișierelor media a eșuat, încercați din nou."</string>

View File

@@ -209,7 +209,6 @@
<item quantity="many">"%d голосов"</item>
</plurals>
<string name="preference_rageshake">"Rageshake сообщит об ошибке"</string>
<string name="room_timeline_read_marker_title">"Новый"</string>
<string name="screen_media_picker_error_failed_selection">"Не удалось выбрать носитель, попробуйте еще раз."</string>
<string name="screen_media_upload_preview_error_failed_processing">"Не удалось обработать медиафайл для загрузки, попробуйте еще раз."</string>
<string name="screen_media_upload_preview_error_failed_sending">"Не удалось загрузить медиафайлы, попробуйте еще раз."</string>

View File

@@ -209,7 +209,6 @@
<item quantity="other">"%d hlasov"</item>
</plurals>
<string name="preference_rageshake">"Zúrivo potriasť pre nahlásenie chyby"</string>
<string name="room_timeline_read_marker_title">"Nové"</string>
<string name="screen_media_picker_error_failed_selection">"Nepodarilo sa vybrať médium, skúste to prosím znova."</string>
<string name="screen_media_upload_preview_error_failed_processing">"Nepodarilo sa spracovať médiá na odoslanie, skúste to prosím znova."</string>
<string name="screen_media_upload_preview_error_failed_sending">"Nepodarilo sa nahrať médiá, skúste to prosím znova."</string>

View File

@@ -167,7 +167,6 @@
<plurals name="common_poll_votes_count">
<item quantity="other">"%d 票"</item>
</plurals>
<string name="room_timeline_read_marker_title">"新訊息"</string>
<string name="screen_media_upload_preview_error_failed_sending">"無法上傳媒體檔案,請稍後再試。"</string>
<string name="screen_share_location_title">"分享位置"</string>
<string name="screen_share_my_location_action">"分享我的位置"</string>

View File

@@ -206,7 +206,6 @@
<item quantity="other">"%d votes"</item>
</plurals>
<string name="preference_rageshake">"Rageshake to report bug"</string>
<string name="room_timeline_read_marker_title">"New"</string>
<string name="screen_media_picker_error_failed_selection">"Failed selecting media, please try again."</string>
<string name="screen_media_upload_preview_error_failed_processing">"Failed processing media to upload, please try again."</string>
<string name="screen_media_upload_preview_error_failed_sending">"Failed uploading media, please try again."</string>

View File

@@ -125,7 +125,7 @@
"screen_room_.*",
"screen\\.room\\..*",
"screen_dm_details_.*",
"room_timeline_state_changes",
"room_timeline_.*",
"emoji_picker_category_.*",
".*report_content_.*"
],