From 591ed2e01fab18ea718876f2a7a6793bbb0f2c7e Mon Sep 17 00:00:00 2001 From: Stypox Date: Tue, 11 Apr 2023 23:12:17 +0200 Subject: [PATCH] Fix some code smells --- .../list/comments/CommentRepliesFragment.java | 10 +++++----- .../info_list/holder/CommentInfoItemHolder.java | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/fragments/list/comments/CommentRepliesFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/list/comments/CommentRepliesFragment.java index da8017963..8cd8222d2 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/list/comments/CommentRepliesFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/list/comments/CommentRepliesFragment.java @@ -24,7 +24,7 @@ public final class CommentRepliesFragment extends BaseListInfoFragment { // has the same content as super.currentInfo, except that it's never null - private CommentRepliesInfo currentInfo; + private CommentRepliesInfo commentRepliesInfo; // the original comments info loaded alongside stream private CommentsInfo commentsInfo; @@ -40,7 +40,7 @@ public final class CommentRepliesFragment public CommentRepliesFragment(final CommentsInfo commentsInfo, final CommentsInfoItem commentsInfoItem) { this(); - this.currentInfo = CommentRepliesInfo.getInfo(commentsInfoItem); + this.commentRepliesInfo = CommentRepliesInfo.getInfo(commentsInfoItem); this.commentsInfo = commentsInfo; setInitialData(commentsInfo.getServiceId(), commentsInfo.getUrl(), commentsInfo.getName()); } @@ -61,14 +61,14 @@ public final class CommentRepliesFragment @Override public void writeTo(final Queue objectsToSave) { super.writeTo(objectsToSave); - objectsToSave.add(currentInfo); + objectsToSave.add(commentRepliesInfo); objectsToSave.add(commentsInfo); } @Override public void readFrom(@NonNull final Queue savedObjects) throws Exception { super.readFrom(savedObjects); - currentInfo = (CommentRepliesInfo) savedObjects.poll(); + commentRepliesInfo = (CommentRepliesInfo) savedObjects.poll(); commentsInfo = (CommentsInfo) savedObjects.poll(); } @@ -79,7 +79,7 @@ public final class CommentRepliesFragment @Override protected Single loadResult(final boolean forceLoad) { - return Single.just(this.currentInfo); + return Single.just(this.commentRepliesInfo); } @Override diff --git a/app/src/main/java/org/schabi/newpipe/info_list/holder/CommentInfoItemHolder.java b/app/src/main/java/org/schabi/newpipe/info_list/holder/CommentInfoItemHolder.java index cbc7096bf..74c80c73d 100644 --- a/app/src/main/java/org/schabi/newpipe/info_list/holder/CommentInfoItemHolder.java +++ b/app/src/main/java/org/schabi/newpipe/info_list/holder/CommentInfoItemHolder.java @@ -148,7 +148,7 @@ public class CommentInfoItemHolder extends InfoItemHolder { itemHeartView.setVisibility(item.isHeartedByUploader() ? View.VISIBLE : View.GONE); final boolean hasReplies = item.getReplies() != null; - repliesButton.setOnClickListener(hasReplies ? (v) -> openRepliesFragment(item) : null); + repliesButton.setOnClickListener(hasReplies ? v -> openRepliesFragment(item) : null); repliesButton.setVisibility(hasReplies ? View.VISIBLE : View.GONE); repliesButton.setText(hasReplies ? Localization.replyCount(itemBuilder.getContext(), item.getReplyCount()) : "");