mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-30 23:03:00 +00:00 
			
		
		
		
	Fix some code smells
This commit is contained in:
		| @@ -24,7 +24,7 @@ public final class CommentRepliesFragment | |||||||
|         extends BaseListInfoFragment<CommentsInfoItem, CommentRepliesInfo> { |         extends BaseListInfoFragment<CommentsInfoItem, CommentRepliesInfo> { | ||||||
|  |  | ||||||
|     // has the same content as super.currentInfo, except that it's never null |     // 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 |     // the original comments info loaded alongside stream | ||||||
|     private CommentsInfo commentsInfo; |     private CommentsInfo commentsInfo; | ||||||
|  |  | ||||||
| @@ -40,7 +40,7 @@ public final class CommentRepliesFragment | |||||||
|     public CommentRepliesFragment(final CommentsInfo commentsInfo, |     public CommentRepliesFragment(final CommentsInfo commentsInfo, | ||||||
|                                   final CommentsInfoItem commentsInfoItem) { |                                   final CommentsInfoItem commentsInfoItem) { | ||||||
|         this(); |         this(); | ||||||
|         this.currentInfo = CommentRepliesInfo.getInfo(commentsInfoItem); |         this.commentRepliesInfo = CommentRepliesInfo.getInfo(commentsInfoItem); | ||||||
|         this.commentsInfo = commentsInfo; |         this.commentsInfo = commentsInfo; | ||||||
|         setInitialData(commentsInfo.getServiceId(), commentsInfo.getUrl(), commentsInfo.getName()); |         setInitialData(commentsInfo.getServiceId(), commentsInfo.getUrl(), commentsInfo.getName()); | ||||||
|     } |     } | ||||||
| @@ -61,14 +61,14 @@ public final class CommentRepliesFragment | |||||||
|     @Override |     @Override | ||||||
|     public void writeTo(final Queue<Object> objectsToSave) { |     public void writeTo(final Queue<Object> objectsToSave) { | ||||||
|         super.writeTo(objectsToSave); |         super.writeTo(objectsToSave); | ||||||
|         objectsToSave.add(currentInfo); |         objectsToSave.add(commentRepliesInfo); | ||||||
|         objectsToSave.add(commentsInfo); |         objectsToSave.add(commentsInfo); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public void readFrom(@NonNull final Queue<Object> savedObjects) throws Exception { |     public void readFrom(@NonNull final Queue<Object> savedObjects) throws Exception { | ||||||
|         super.readFrom(savedObjects); |         super.readFrom(savedObjects); | ||||||
|         currentInfo = (CommentRepliesInfo) savedObjects.poll(); |         commentRepliesInfo = (CommentRepliesInfo) savedObjects.poll(); | ||||||
|         commentsInfo = (CommentsInfo) savedObjects.poll(); |         commentsInfo = (CommentsInfo) savedObjects.poll(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -79,7 +79,7 @@ public final class CommentRepliesFragment | |||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     protected Single<CommentRepliesInfo> loadResult(final boolean forceLoad) { |     protected Single<CommentRepliesInfo> loadResult(final boolean forceLoad) { | ||||||
|         return Single.just(this.currentInfo); |         return Single.just(this.commentRepliesInfo); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|   | |||||||
| @@ -148,7 +148,7 @@ public class CommentInfoItemHolder extends InfoItemHolder { | |||||||
|         itemHeartView.setVisibility(item.isHeartedByUploader() ? View.VISIBLE : View.GONE); |         itemHeartView.setVisibility(item.isHeartedByUploader() ? View.VISIBLE : View.GONE); | ||||||
|  |  | ||||||
|         final boolean hasReplies = item.getReplies() != null; |         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.setVisibility(hasReplies ? View.VISIBLE : View.GONE); | ||||||
|         repliesButton.setText(hasReplies |         repliesButton.setText(hasReplies | ||||||
|                 ? Localization.replyCount(itemBuilder.getContext(), item.getReplyCount()) : ""); |                 ? Localization.replyCount(itemBuilder.getContext(), item.getReplyCount()) : ""); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Stypox
					Stypox