mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-31 07:13:00 +00:00 
			
		
		
		
	Fix some code smells
This commit is contained in:
		| @@ -24,7 +24,7 @@ public final class CommentRepliesFragment | ||||
|         extends BaseListInfoFragment<CommentsInfoItem, CommentRepliesInfo> { | ||||
|  | ||||
|     // 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<Object> objectsToSave) { | ||||
|         super.writeTo(objectsToSave); | ||||
|         objectsToSave.add(currentInfo); | ||||
|         objectsToSave.add(commentRepliesInfo); | ||||
|         objectsToSave.add(commentsInfo); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void readFrom(@NonNull final Queue<Object> 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<CommentRepliesInfo> loadResult(final boolean forceLoad) { | ||||
|         return Single.just(this.currentInfo); | ||||
|         return Single.just(this.commentRepliesInfo); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|   | ||||
| @@ -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()) : ""); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Stypox
					Stypox