Skip to content

Commit da1ccfd

Browse files
Additional fixes
1 parent 49c3299 commit da1ccfd

4 files changed

Lines changed: 9 additions & 11 deletions

File tree

app/src/main/java/org/schabi/newpipe/fragments/detail/DescriptionFragment.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,13 @@ public List<String> getTags() {
6868
@Override
6969
protected void setupMetadata(final LayoutInflater inflater,
7070
final LinearLayout layout) {
71-
final var date = Optional.ofNullable(streamInfo)
71+
Optional.ofNullable(streamInfo)
7272
.map(StreamInfo::getUploadDate)
73-
.map(wrapper -> Localization.formatDate(wrapper.offsetDateTime()))
74-
.orElse(null);
75-
if (date != null) {
76-
binding.detailUploadDateView.setText(date);
77-
} else {
78-
binding.detailUploadDateView.setVisibility(View.GONE);
79-
}
73+
.ifPresentOrElse(
74+
wrapper -> binding.detailUploadDateView
75+
.setText(Localization.formatDate(wrapper.offsetDateTime())),
76+
() -> binding.detailUploadDateView.setVisibility(View.GONE)
77+
);
8078

8179
if (streamInfo == null) {
8280
return;

app/src/main/java/org/schabi/newpipe/fragments/list/comments/CommentRepliesFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ protected Supplier<View> getListHeaderSupplier() {
9797

9898
// setup like count, hearted and pinned
9999
binding.thumbsUpCount.setText(
100-
Localization.likeCount(requireContext(), item.getLikeCount()));
100+
Localization.formatLikeCount(requireContext(), item.getLikeCount()));
101101
// for heartImage goneMarginEnd was used, but there is no way to tell ConstraintLayout
102102
// not to use a different margin only when both the next two views are gone
103103
((ConstraintLayout.LayoutParams) binding.thumbsUpCount.getLayoutParams())

app/src/main/java/org/schabi/newpipe/info_list/holder/CommentInfoItemHolder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public void updateFromItem(final InfoItem infoItem,
113113

114114
// setup bottom row, with likes, heart and replies button
115115
itemLikesCountView.setText(
116-
Localization.likeCount(itemBuilder.getContext(), item.getLikeCount()));
116+
Localization.formatLikeCount(itemBuilder.getContext(), item.getLikeCount()));
117117

118118
itemHeartView.setVisibility(item.isHeartedByUploader() ? View.VISIBLE : View.GONE);
119119

app/src/main/java/org/schabi/newpipe/util/Localization.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ public static String formatReplyCount(@NonNull final Context context, final int
214214
* @return if {@code likeCount} is smaller than {@code 0}, the string {@code "-"}, otherwise
215215
* the result of calling {@link #getShortCount(Context, long)} on the like count
216216
*/
217-
public static String likeCount(@NonNull final Context context, final int likeCount) {
217+
public static String formatLikeCount(@NonNull final Context context, final int likeCount) {
218218
if (likeCount < 0) {
219219
return "-";
220220
} else {

0 commit comments

Comments
 (0)