Design review fixes.
This commit is contained in:
parent
bd2ed4c58a
commit
4c8a8d8cfb
@ -130,6 +130,6 @@
|
|||||||
|
|
||||||
<attr name="vctr_voice_message_toast_background" format="color" />
|
<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_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>
|
</resources>
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<item name="chunkSoftTransition">true</item>
|
<item name="chunkSoftTransition">true</item>
|
||||||
<item name="chunkSpace">2dp</item>
|
<item name="chunkSpace">2dp</item>
|
||||||
<item name="chunkWidth">2dp</item>
|
<item name="chunkWidth">2dp</item>
|
||||||
<item name="direction">leftToRight</item>
|
<item name="direction">rightToLeft</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Widget.Vector.TextView.Caption.Toast">
|
<style name="Widget.Vector.TextView.Caption.Toast">
|
||||||
|
@ -27,6 +27,7 @@ import android.os.Build
|
|||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
import android.text.Spannable
|
import android.text.Spannable
|
||||||
|
import android.text.format.DateUtils
|
||||||
import android.view.HapticFeedbackConstants
|
import android.view.HapticFeedbackConstants
|
||||||
import android.view.KeyEvent
|
import android.view.KeyEvent
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
@ -987,7 +988,12 @@ class RoomDetailFragment @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val messageContent: MessageContent? = event.getLastMessageContent()
|
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
|
var formattedBody: CharSequence? = null
|
||||||
if (messageContent is MessageTextContent && messageContent.format == MessageFormat.FORMAT_MATRIX_HTML) {
|
if (messageContent is MessageTextContent && messageContent.format == MessageFormat.FORMAT_MATRIX_HTML) {
|
||||||
val parser = Parser.builder().build()
|
val parser = Parser.builder().build()
|
||||||
|
@ -79,7 +79,11 @@ class VoiceMessageHelper @Inject constructor(
|
|||||||
return outputFileUri
|
return outputFileUri
|
||||||
?.toMultiPickerAudioType(context)
|
?.toMultiPickerAudioType(context)
|
||||||
?.apply {
|
?.apply {
|
||||||
waveform = amplitudeList
|
waveform = if (amplitudeList.size < 50) {
|
||||||
|
amplitudeList
|
||||||
|
} else {
|
||||||
|
amplitudeList.chunked(amplitudeList.size / 50) { items -> items.maxOrNull() ?: 0 }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} ?: return null
|
} ?: return null
|
||||||
} catch (e: FileNotFoundException) {
|
} catch (e: FileNotFoundException) {
|
||||||
@ -154,7 +158,7 @@ class VoiceMessageHelper @Inject constructor(
|
|||||||
|
|
||||||
private fun startRecordingAmplitudes() {
|
private fun startRecordingAmplitudes() {
|
||||||
amplitudeTicker?.stop()
|
amplitudeTicker?.stop()
|
||||||
amplitudeTicker = CountUpTimer(100).apply {
|
amplitudeTicker = CountUpTimer(50).apply {
|
||||||
tickListener = object : CountUpTimer.TickListener {
|
tickListener = object : CountUpTimer.TickListener {
|
||||||
override fun onTick(milliseconds: Long) {
|
override fun onTick(milliseconds: Long) {
|
||||||
onAmplitudeTick()
|
onAmplitudeTick()
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package im.vector.app.features.home.room.detail.composer
|
package im.vector.app.features.home.room.detail.composer
|
||||||
|
|
||||||
|
import android.animation.Animator
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.text.format.DateUtils
|
import android.text.format.DateUtils
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
@ -23,6 +24,7 @@ import android.view.MotionEvent
|
|||||||
import androidx.constraintlayout.widget.ConstraintLayout
|
import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.core.view.updateLayoutParams
|
import androidx.core.view.updateLayoutParams
|
||||||
|
import com.visualizer.amplitude.AudioRecordView
|
||||||
import im.vector.app.BuildConfig
|
import im.vector.app.BuildConfig
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.core.hardware.vibrate
|
import im.vector.app.core.hardware.vibrate
|
||||||
@ -192,7 +194,7 @@ class VoiceMessageRecorderView @JvmOverloads constructor(
|
|||||||
views.voiceMessageLockArrow.translationY = 0F
|
views.voiceMessageLockArrow.translationY = 0F
|
||||||
}
|
}
|
||||||
RecordingState.LOCKING -> {
|
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)
|
val translationAmount = -distanceY.coerceIn(0F, distanceToLock)
|
||||||
views.voiceMessageMicButton.translationY = translationAmount
|
views.voiceMessageMicButton.translationY = translationAmount
|
||||||
views.voiceMessageLockArrow.translationY = translationAmount
|
views.voiceMessageLockArrow.translationY = translationAmount
|
||||||
@ -320,7 +322,7 @@ class VoiceMessageRecorderView @JvmOverloads constructor(
|
|||||||
views.voicePlaybackWaveform.apply {
|
views.voicePlaybackWaveform.apply {
|
||||||
post {
|
post {
|
||||||
// TODO We could avoid recreating the whole view here and just call update() with the new value(s).
|
// TODO We could avoid recreating the whole view here and just call update() with the new value(s).
|
||||||
recreate()
|
//recreate()
|
||||||
amplitudeList.forEach { amplitude ->
|
amplitudeList.forEach { amplitude ->
|
||||||
update(amplitude)
|
update(amplitude)
|
||||||
}
|
}
|
||||||
@ -349,6 +351,7 @@ class VoiceMessageRecorderView @JvmOverloads constructor(
|
|||||||
views.voiceMessageTimer.isVisible = true
|
views.voiceMessageTimer.isVisible = true
|
||||||
views.voiceMessageSlideToCancel.alpha = 1f
|
views.voiceMessageSlideToCancel.alpha = 1f
|
||||||
views.voiceMessageSendButton.isVisible = false
|
views.voiceMessageSendButton.isVisible = false
|
||||||
|
views.voiceMessageLockImage.setImageResource(R.drawable.ic_voice_message_unlocked)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun hideRecordingViews() {
|
private fun hideRecordingViews() {
|
||||||
|
@ -74,6 +74,8 @@ abstract class MessageVoiceItem : AbsMessageItem<MessageVoiceItem.Holder>() {
|
|||||||
holder.progressLayout.isVisible = false
|
holder.progressLayout.isVisible = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
holder.voicePlaybackWaveform.setOnLongClickListener(attributes.itemLongClickListener)
|
||||||
|
|
||||||
holder.voicePlaybackWaveform.post {
|
holder.voicePlaybackWaveform.post {
|
||||||
holder.voicePlaybackWaveform.recreate()
|
holder.voicePlaybackWaveform.recreate()
|
||||||
waveform.forEach { amplitude ->
|
waveform.forEach { amplitude ->
|
||||||
|
@ -3449,10 +3449,11 @@
|
|||||||
<string name="a11y_delete_recorded_voice_message">Delete recorded voice message</string>
|
<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_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_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="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="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_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_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="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>
|
</resources>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user