Remove content description of mic button if it is not visible.

This commit is contained in:
Onuray Sahin 2021-08-10 14:36:01 +03:00
parent a0730943b4
commit bf1db5dcf9

View file

@ -20,6 +20,7 @@ import android.content.Context
import android.text.format.DateUtils import android.text.format.DateUtils
import android.util.AttributeSet import android.util.AttributeSet
import android.view.MotionEvent import android.view.MotionEvent
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.view.isInvisible import androidx.core.view.isInvisible
import androidx.core.view.isVisible import androidx.core.view.isVisible
@ -87,6 +88,15 @@ class VoiceMessageRecorderView @JvmOverloads constructor(
initListeners() initListeners()
} }
override fun onVisibilityChanged(changedView: View, visibility: Int) {
super.onVisibilityChanged(changedView, visibility)
if (changedView == this && visibility == VISIBLE) {
views.voiceMessageMicButton.contentDescription = context.getString(R.string.a11y_start_voice_message)
} else {
views.voiceMessageMicButton.contentDescription = ""
}
}
fun initVoiceRecordingViews() { fun initVoiceRecordingViews() {
recordingState = RecordingState.NONE recordingState = RecordingState.NONE