mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-25 10:55:55 +03:00
Design review fixes.
This commit is contained in:
parent
bd2ed4c58a
commit
4c8a8d8cfb
7 changed files with 24 additions and 8 deletions
|
@ -130,6 +130,6 @@
|
|||
|
||||
<attr name="vctr_voice_message_toast_background" format="color" />
|
||||
<color name="vctr_voice_message_toast_background_light">@color/palette_black_900</color>
|
||||
<color name="vctr_voice_message_toast_background_dark">@color/palette_gray_450</color>
|
||||
<color name="vctr_voice_message_toast_background_dark">@color/palette_gray_400</color>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<item name="chunkSoftTransition">true</item>
|
||||
<item name="chunkSpace">2dp</item>
|
||||
<item name="chunkWidth">2dp</item>
|
||||
<item name="direction">leftToRight</item>
|
||||
<item name="direction">rightToLeft</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.Vector.TextView.Caption.Toast">
|
||||
|
|
|
@ -27,6 +27,7 @@ import android.os.Build
|
|||
import android.os.Bundle
|
||||
import android.os.Parcelable
|
||||
import android.text.Spannable
|
||||
import android.text.format.DateUtils
|
||||
import android.view.HapticFeedbackConstants
|
||||
import android.view.KeyEvent
|
||||
import android.view.LayoutInflater
|
||||
|
@ -987,7 +988,12 @@ class RoomDetailFragment @Inject constructor(
|
|||
}
|
||||
|
||||
val messageContent: MessageContent? = event.getLastMessageContent()
|
||||
val nonFormattedBody = messageContent?.body ?: ""
|
||||
val nonFormattedBody = if (messageContent is MessageAudioContent && messageContent.voiceMessageIndicator != null) {
|
||||
val formattedDuration = DateUtils.formatElapsedTime(((messageContent.audioInfo?.duration ?: 0) / 1000).toLong())
|
||||
getString(R.string.voice_message_reply_content, formattedDuration)
|
||||
} else {
|
||||
messageContent?.body ?: ""
|
||||
}
|
||||
var formattedBody: CharSequence? = null
|
||||
if (messageContent is MessageTextContent && messageContent.format == MessageFormat.FORMAT_MATRIX_HTML) {
|
||||
val parser = Parser.builder().build()
|
||||
|
|
|
@ -79,7 +79,11 @@ class VoiceMessageHelper @Inject constructor(
|
|||
return outputFileUri
|
||||
?.toMultiPickerAudioType(context)
|
||||
?.apply {
|
||||
waveform = amplitudeList
|
||||
waveform = if (amplitudeList.size < 50) {
|
||||
amplitudeList
|
||||
} else {
|
||||
amplitudeList.chunked(amplitudeList.size / 50) { items -> items.maxOrNull() ?: 0 }
|
||||
}
|
||||
}
|
||||
} ?: return null
|
||||
} catch (e: FileNotFoundException) {
|
||||
|
@ -154,7 +158,7 @@ class VoiceMessageHelper @Inject constructor(
|
|||
|
||||
private fun startRecordingAmplitudes() {
|
||||
amplitudeTicker?.stop()
|
||||
amplitudeTicker = CountUpTimer(100).apply {
|
||||
amplitudeTicker = CountUpTimer(50).apply {
|
||||
tickListener = object : CountUpTimer.TickListener {
|
||||
override fun onTick(milliseconds: Long) {
|
||||
onAmplitudeTick()
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
package im.vector.app.features.home.room.detail.composer
|
||||
|
||||
import android.animation.Animator
|
||||
import android.content.Context
|
||||
import android.text.format.DateUtils
|
||||
import android.util.AttributeSet
|
||||
|
@ -23,6 +24,7 @@ import android.view.MotionEvent
|
|||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import com.visualizer.amplitude.AudioRecordView
|
||||
import im.vector.app.BuildConfig
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.hardware.vibrate
|
||||
|
@ -192,7 +194,7 @@ class VoiceMessageRecorderView @JvmOverloads constructor(
|
|||
views.voiceMessageLockArrow.translationY = 0F
|
||||
}
|
||||
RecordingState.LOCKING -> {
|
||||
views.voiceMessageLockImage.setImageResource(R.drawable.ic_voice_message_unlocked)
|
||||
views.voiceMessageLockImage.setImageResource(R.drawable.ic_voice_message_locked)
|
||||
val translationAmount = -distanceY.coerceIn(0F, distanceToLock)
|
||||
views.voiceMessageMicButton.translationY = translationAmount
|
||||
views.voiceMessageLockArrow.translationY = translationAmount
|
||||
|
@ -320,7 +322,7 @@ class VoiceMessageRecorderView @JvmOverloads constructor(
|
|||
views.voicePlaybackWaveform.apply {
|
||||
post {
|
||||
// TODO We could avoid recreating the whole view here and just call update() with the new value(s).
|
||||
recreate()
|
||||
//recreate()
|
||||
amplitudeList.forEach { amplitude ->
|
||||
update(amplitude)
|
||||
}
|
||||
|
@ -349,6 +351,7 @@ class VoiceMessageRecorderView @JvmOverloads constructor(
|
|||
views.voiceMessageTimer.isVisible = true
|
||||
views.voiceMessageSlideToCancel.alpha = 1f
|
||||
views.voiceMessageSendButton.isVisible = false
|
||||
views.voiceMessageLockImage.setImageResource(R.drawable.ic_voice_message_unlocked)
|
||||
}
|
||||
|
||||
private fun hideRecordingViews() {
|
||||
|
|
|
@ -74,6 +74,8 @@ abstract class MessageVoiceItem : AbsMessageItem<MessageVoiceItem.Holder>() {
|
|||
holder.progressLayout.isVisible = false
|
||||
}
|
||||
|
||||
holder.voicePlaybackWaveform.setOnLongClickListener(attributes.itemLongClickListener)
|
||||
|
||||
holder.voicePlaybackWaveform.post {
|
||||
holder.voicePlaybackWaveform.recreate()
|
||||
waveform.forEach { amplitude ->
|
||||
|
|
|
@ -3449,10 +3449,11 @@
|
|||
<string name="a11y_delete_recorded_voice_message">Delete recorded voice message</string>
|
||||
<string name="voice_message_release_to_send_toast">Hold to record, release to send</string>
|
||||
<string name="voice_message_n_seconds_warning_toast">%1$ds left</string>
|
||||
<string name="voice_message_tap_on_waveform_to_stop_toast">Tap on the waveform to stop and playback</string>
|
||||
<string name="voice_message_tap_on_waveform_to_stop_toast">Tap on your recording to stop or listen</string>
|
||||
<string name="labs_use_voice_message">Enable voice message</string>
|
||||
<string name="voice_message_tap_to_stop_toast">Tap on the wavelength to stop and playback</string>
|
||||
<string name="error_voice_message_unable_to_play">Cannot play this voice message</string>
|
||||
<string name="error_voice_message_unable_to_record">Cannot record a voice message</string>
|
||||
<string name="error_voice_message_cannot_reply_or_edit">Cannot reply or edit while voice message is active</string>
|
||||
<string name="voice_message_reply_content">Voice Message (%1$s)</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue