Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #305 from the-blank-x/ryd-runonuithread
Browse files Browse the repository at this point in the history
Attempt to fix crash by RYD showing dislike info while screen is being rotated
  • Loading branch information
polymorphicshade committed Apr 8, 2023
2 parents 5c4f0f4 + b26df18 commit f112058
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1528,11 +1528,18 @@ public void handleResult(@NonNull final StreamInfo info) {
new Thread(() -> {
info.setDislikeCount(ReturnYouTubeDislikeUtils.getDislikes(getContext(), info));
if (info.getDislikeCount() >= 0) {
if (activity == null) {
return;
}
activity.runOnUiThread(() -> {
binding.detailThumbsDownCountView.setText(Localization
.shortCount(activity, info.getDislikeCount()));
binding.detailThumbsDownCountView.setVisibility(View.VISIBLE);
binding.detailThumbsDownImgView.setVisibility(View.VISIBLE);
if (binding != null && binding.detailThumbsDownCountView != null) {
binding.detailThumbsDownCountView.setText(Localization
.shortCount(activity, info.getDislikeCount()));
binding.detailThumbsDownCountView.setVisibility(View.VISIBLE);
}
if (binding != null && binding.detailThumbsDownImgView != null) {
binding.detailThumbsDownImgView.setVisibility(View.VISIBLE);
}
});
}
}).start();
Expand Down

0 comments on commit f112058

Please sign in to comment.