Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,14 @@ private class RecordingHintState(
private fun rememberRecordingHint(): RecordingHintState {
val snackbarHostState = remember { SnackbarHostState() }
val scope = rememberCoroutineScope()
val message = stringResource(R.string.stream_compose_audio_recording_hint)
val sendOnComplete = ChatTheme.config.composer.audioRecordingSendOnComplete
val message = stringResource(
if (sendOnComplete) {
R.string.stream_compose_audio_recording_hint_send
} else {
R.string.stream_compose_audio_recording_hint_save
},
)
return remember(snackbarHostState, scope, message) {
RecordingHintState(snackbarHostState, scope, message)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@

<!-- Audio Recording -->
<string name="stream_compose_audio_recording_start">Record audio message</string>
<string name="stream_compose_audio_recording_hint">Hold to record. Release to send.</string>
<string name="stream_compose_audio_recording_hint_send">Hold to record. Release to send.</string>
<string name="stream_compose_audio_recording_hint_save">Hold to record. Release to save.</string>
<string name="stream_compose_audio_recording_slide_to_cancel">Slide to cancel</string>
<string name="stream_compose_audio_recording_delete">Delete recording</string>
<string name="stream_compose_audio_recording_stop">Stop recording</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class AddingRecordingSupport {
fun customizeUiInMessageComposer(context: Context) {
TransformStyle.messageComposerStyleTransformer = StyleTransformer { defaultStyle ->
defaultStyle.copy(
audioRecordingHoldToRecordText = context.getString(R.string.stream_ui_message_composer_hold_to_record),
audioRecordingHoldToRecordText = context.getString(R.string.stream_ui_message_composer_hold_to_record_save),
audioRecordingHoldToRecordTextStyle = TextStyle(
size = context.getDimension(R.dimen.stream_ui_text_medium),
color = context.getColorCompat(R.color.stream_ui_text_color_secondary),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ import io.getstream.chat.android.ui.common.R as UiCommonR
* @param audioRecordingButtonWidth The width of the button to record audio.
* @param audioRecordingButtonHeight The height of the button to record audio.
* @param audioRecordingButtonPadding The padding of the button to record audio.
* @param audioRecordingHoldToRecordText The info text that will be shown if touch event on audio button was too short.
* @param audioRecordingHoldToRecordText Optional override for the info text shown on a short touch of the audio button.
* When `null`, the text is resolved from string resources based on [audioRecordingSendOnComplete].
* @param audioRecordingHoldToRecordTextStyle The text style that will be used for the "hold to record" text.
* @param audioRecordingHoldToRecordBackgroundDrawable The drawable will be used as a background for the "hold to
* record" text.
Expand Down Expand Up @@ -215,7 +216,7 @@ public data class MessageComposerViewStyle(
public val messageInputVideoAttachmentIconDrawablePaddingStart: Int,
public val messageInputVideoAttachmentIconDrawablePaddingEnd: Int,
// Center overlap content
public val audioRecordingHoldToRecordText: String,
public val audioRecordingHoldToRecordText: String?,
public val audioRecordingHoldToRecordTextStyle: TextStyle,
public val audioRecordingHoldToRecordBackgroundDrawable: Drawable,
@ColorInt public val audioRecordingHoldToRecordBackgroundDrawableTint: Int?,
Expand Down Expand Up @@ -534,7 +535,7 @@ public data class MessageComposerViewStyle(
*/
val audioRecordingHoldToRecordText = a.getString(
R.styleable.MessageComposerView_streamUiMessageComposerAudioRecordingHoldToRecordText,
) ?: context.getString(R.string.stream_ui_message_composer_hold_to_record)
)
val audioRecordingHoldToRecordTextStyle = TextStyle.Builder(a)
.size(
R.styleable.MessageComposerView_streamUiMessageComposerAudioRecordingHoldToRecordTextSize,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,13 @@ public open class DefaultMessageComposerOverlappingContent : ConstraintLayout, M
false,
).also {
it.findViewById<TextView>(R.id.holdToRecordText).apply {
text = style.audioRecordingHoldToRecordText
text = style.audioRecordingHoldToRecordText ?: context.getString(
if (style.audioRecordingSendOnComplete) {
R.string.stream_ui_message_composer_hold_to_record_send
} else {
R.string.stream_ui_message_composer_hold_to_record_save
},
)
setTextStyle(style.audioRecordingHoldToRecordTextStyle)
background = style.audioRecordingHoldToRecordBackgroundDrawable.applyTint(
style.audioRecordingHoldToRecordBackgroundDrawableTint,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
android:background="@drawable/stream_ui_message_composer_audio_record_hold_background"
android:paddingHorizontal="16dp"
android:gravity="center_vertical"
android:text="@string/stream_ui_message_composer_hold_to_record"
android:text="@string/stream_ui_message_composer_hold_to_record_save"
android:textColor="@color/stream_ui_white_snow"
android:textStyle="bold"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@
<string name="stream_ui_message_composer_gallery_access">"Permitir acceso a tu galería"</string>
<string name="stream_ui_message_composer_hint_cannot_send_message">"No puedes enviar mensajes en este canal"</string>
<string name="stream_ui_message_composer_hint_normal">"Escribe algo aquí"</string>
<string name="stream_ui_message_composer_hold_to_record">"Mantén pulsado para empezar, suelta para enviar."</string>
<string name="stream_ui_message_composer_hold_to_record_send">"Mantén pulsado para empezar, suelta para enviar."</string>
<string name="stream_ui_message_composer_hold_to_record_save">"Mantén pulsado para empezar, suelta para guardar."</string>
<string name="stream_ui_message_composer_instant_commands">"Comandos instantáneos"</string>
<string name="stream_ui_message_composer_mode_edit">"Editar Mensaje"</string>
<string name="stream_ui_message_composer_mode_reply">"Contestar al mensaje"</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@

<!-- Audio Recording -->
<string name="stream_ui_message_composer_slide_to_cancel">Slide to cancel</string>
<string name="stream_ui_message_composer_hold_to_record">Hold to record. Release to send.</string>
<string name="stream_ui_message_composer_hold_to_record_send">Hold to record. Release to send.</string>
<string name="stream_ui_message_composer_hold_to_record_save">Hold to record. Release to save.</string>

<string name="stream_ui_message_list_empty">No messages</string>
<string name="stream_ui_message_list_download_started">Download started</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1369,9 +1369,6 @@
</item>

<!-- Center overlap content -->
<item name="streamUiMessageComposerAudioRecordingHoldToRecordText">
@string/stream_ui_message_composer_hold_to_record
</item>
<item name="streamUiMessageComposerAudioRecordingHoldToRecordTextSize">
@dimen/stream_ui_text_medium
</item>
Expand Down
Loading