-
Notifications
You must be signed in to change notification settings - Fork 754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash on opening a room on Android 5.0 and 5.1 - Regression with Voice message #3903
Conversation
…fore constructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR.
A few remarks after our internal discussion
// Don't convert to primary constructor. | ||
// We need to define views as lateinit var to be able to check if initialized for the bug fix on api 21 and 22. | ||
@JvmOverloads constructor( | ||
context: Context, | ||
attrs: AttributeSet? = null, | ||
defStyleAttr: Int = 0 | ||
) : super(context, attrs, defStyleAttr) { | ||
initialize() | ||
} | ||
|
||
fun initialize() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, views
has to be lateinit var
to be able to use isInitialized
. When we initialize views in init, lint says it is redundant to mark as lateinit...
...r/src/main/java/im/vector/app/features/home/room/detail/composer/VoiceMessageRecorderView.kt
Outdated
Show resolved
Hide resolved
attrs: AttributeSet? = null, | ||
defStyleAttr: Int = 0 | ||
) : ConstraintLayout(context, attrs, defStyleAttr), VoiceMessagePlaybackTracker.Listener { | ||
class VoiceMessageRecorderView: ConstraintLayout, VoiceMessagePlaybackTracker.Listener { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same reason with the first comment.
…omposer/VoiceMessageRecorderView.kt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your comments
Do you have any estimation when this fix is going to be released on F-Droid? |
@@ -90,6 +96,9 @@ class VoiceMessageRecorderView @JvmOverloads constructor( | |||
|
|||
override fun onVisibilityChanged(changedView: View, visibility: Int) { | |||
super.onVisibilityChanged(changedView, visibility) | |||
// onVisibilityChanged is called by constructor on api 21 and 22. | |||
if (!this::views.isInitialized) return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bmarty Were you able to reproduce the error on Android 5 and verify if this patch works?
Fixes #3897