-
Notifications
You must be signed in to change notification settings - Fork 267
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
Avoid IndexOutOfBoundsException at RecyclerView.getChildAdapterPosition #798
Avoid IndexOutOfBoundsException at RecyclerView.getChildAdapterPosition #798
Conversation
@@ -58,8 +58,13 @@ open class TimetableCurrentTimeLineDecoration( | |||
} | |||
|
|||
protected fun calcLineHeight(parent: RecyclerView, currentTime: Long): Float { | |||
val originView = parent.getChildAt(0) | |||
val originStartUnixMillis = groupAdapter.getItem(parent.getChildAdapterPosition(originView)) |
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.
Sorry, Probably originView is null.
So you can fix.Can you fix it?
parent.getChildAt(0) ?: return 0F
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, I did!
すいません!
対応したはずなのですが、別の対応をした方が良いということでしょうか?
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.
parent.getChildAt(0)でnullが返ってきているのでparent.getChildAdapterPosition(originView)が-1を返してきているのではという説があって、
val originView = parent.getChildAt(0) ?: return 0F
こうすれば解決するかもということです 🙏
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.
こちら、修正前のコードになり、修正後のコードにはご指摘の対応を入れてある認識です……!
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.
あ、すいません。
下のコードは不要ではないか、という指摘ですね。直します!
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.
既存のコードも同じ感じで直したいんですが、今日リリース予定で時間がとれないので😇
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.
修正しました。
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.
😇
Apk comparision results
Generated by 🚫 Danger |
Asserted successfully. 💯 Generated by 🚫 Danger |
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.
Thank you for fixing fast 🏎
Thanks! |
Issue
Overview (Required)
Links
Screenshot