Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ability to see pinned comment #7577

Merged
merged 1 commit into from
Dec 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@
public class CommentsInfoItemHolder extends CommentsMiniInfoItemHolder {
public final TextView itemTitleView;
private final ImageView itemHeartView;
private final ImageView itemPinnedView;

public CommentsInfoItemHolder(final InfoItemBuilder infoItemBuilder, final ViewGroup parent) {
super(infoItemBuilder, R.layout.list_comments_item, parent);

itemTitleView = itemView.findViewById(R.id.itemTitleView);
itemHeartView = itemView.findViewById(R.id.detail_heart_image_view);
itemPinnedView = itemView.findViewById(R.id.detail_pinned_view);
}

@Override
Expand All @@ -55,5 +57,7 @@ public void updateFromItem(final InfoItem infoItem,
itemTitleView.setText(item.getUploaderName());

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

itemPinnedView.setVisibility(item.isPinned() ? View.VISIBLE : View.GONE);
}
}
19 changes: 19 additions & 0 deletions app/src/main/res/drawable-night/ic_pin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="#FFFFFF"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M14.566,1.729l7.705,7.704c0.355,0.355 0.354,0.93 0,1.284l-1.926,1.926c-0.354,0.355 -0.93,0.355 -1.285,0l-7.704,-7.704c-0.354,-0.354 -0.354,-0.929 0,-1.284l1.926,-1.926C13.639,1.374 14.213,1.374 14.566,1.729z"
android:fillColor="#FF000000"/>
<path
android:pathData="M2.369,12.643l8.988,8.989c0.356,0.352 0.929,0.352 1.284,0c1.417,-1.418 1.417,-3.719 0,-5.137l-5.136,-5.136c-1.418,-1.418 -3.718,-1.418 -5.136,0C2.016,11.714 2.016,12.287 2.369,12.643z"
android:fillColor="#FF000000"/>
<path
android:pathData="M13.2823,15.8538l-5.1357,-5.1357l3.8523,-3.8523l5.1357,5.1357z"
android:fillColor="#FF000000"/>
<path
android:pathData="M1.727,22.273c0.355,0.353 0.929,0.353 1.284,0l3.852,-3.853l-1.284,-1.283l-3.852,3.852C1.374,21.345 1.375,21.918 1.727,22.273z"
android:fillColor="#FF000000"/>
</vector>
18 changes: 18 additions & 0 deletions app/src/main/res/drawable/ic_pin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M14.566,1.729l7.705,7.704c0.355,0.355 0.354,0.93 0,1.284l-1.926,1.926c-0.354,0.355 -0.93,0.355 -1.285,0l-7.704,-7.704c-0.354,-0.354 -0.354,-0.929 0,-1.284l1.926,-1.926C13.639,1.374 14.213,1.374 14.566,1.729z"
android:fillColor="#FF000000"/>
<path
android:pathData="M2.369,12.643l8.988,8.989c0.356,0.352 0.929,0.352 1.284,0c1.417,-1.418 1.417,-3.719 0,-5.137l-5.136,-5.136c-1.418,-1.418 -3.718,-1.418 -5.136,0C2.016,11.714 2.016,12.287 2.369,12.643z"
android:fillColor="#FF000000"/>
<path
android:pathData="M13.2823,15.8538l-5.1357,-5.1357l3.8523,-3.8523l5.1357,5.1357z"
android:fillColor="#FF000000"/>
<path
android:pathData="M1.727,22.273c0.355,0.353 0.929,0.353 1.284,0l3.852,-3.853l-1.284,-1.283l-3.852,3.852C1.374,21.345 1.375,21.918 1.727,22.273z"
android:fillColor="#FF000000"/>
</vector>
14 changes: 13 additions & 1 deletion app/src/main/res/layout/list_comments_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,25 @@
android:src="@drawable/buddy"
tools:ignore="RtlHardcoded" />

<ImageView
android:id="@+id/detail_pinned_view"
android:layout_width="@dimen/video_item_detail_pinned_image_width"
android:layout_height="@dimen/video_item_detail_pinned_image_height"
android:layout_alignParentTop="true"
android:layout_marginRight="@dimen/video_item_detail_pinned_right_margin"
android:layout_toEndOf="@+id/itemThumbnailView"
android:contentDescription="@string/detail_pinned_comment_view_description"
android:visibility="gone"
app:srcCompat="@drawable/ic_pin"
tools:visibility="visible" />

<org.schabi.newpipe.views.NewPipeTextView
android:id="@+id/itemTitleView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginBottom="@dimen/video_item_search_image_right_margin"
android:layout_toEndOf="@+id/itemThumbnailView"
android:layout_toEndOf="@+id/detail_pinned_view"
android:ellipsize="end"
android:lines="1"
android:textAppearance="?android:attr/textAppearanceSmall"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-land/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<dimen name="channel_avatar_size">90dp</dimen>
<dimen name="sub_channel_avatar_size">45dp</dimen>
<!-- Paddings & Margins -->
<dimen name="video_item_detail_pinned_right_margin">8dp</dimen>
<dimen name="video_item_detail_like_margin">8dp</dimen>
<dimen name="video_item_detail_error_panel_margin">4dp</dimen>

Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-sw600dp/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<dimen name="video_item_detail_like_image_height">18sp</dimen>
<dimen name="video_item_detail_like_image_width">18sp</dimen>
<!-- Paddings & Margins -->
<dimen name="video_item_detail_pinned_right_margin">10dp</dimen>
<dimen name="video_item_detail_like_margin">10dp</dimen>

<dimen name="search_suggestion_text_size">14sp</dimen>
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@
<dimen name="channel_rss_title_size">12sp</dimen>
<!-- Elements Size -->
<dimen name="video_item_detail_uploader_image_size">32dp</dimen>
<dimen name="video_item_detail_pinned_image_width">18sp</dimen>
<dimen name="video_item_detail_pinned_image_height">18sp</dimen>
<dimen name="video_item_detail_sub_channel_image_size">16dp</dimen>
<dimen name="video_item_detail_like_image_height">18sp</dimen>
<dimen name="video_item_detail_like_image_width">18sp</dimen>
Expand All @@ -79,6 +81,7 @@
<dimen name="sub_channel_avatar_size">35dp</dimen>
<dimen name="mini_player_height">60dp</dimen>
<!-- Paddings & Margins -->
<dimen name="video_item_detail_pinned_right_margin">5dp</dimen>
<dimen name="video_item_detail_like_margin">5dp</dimen>
<dimen name="video_item_detail_heart_margin">5dp</dimen>
<dimen name="video_item_detail_error_panel_margin">50dp</dimen>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,7 @@
<string name="metadata_privacy_unlisted">Unlisted</string>
<string name="metadata_privacy_private">Private</string>
<string name="metadata_privacy_internal">Internal</string>
<string name="detail_pinned_comment_view_description">Pinned comment</string>
<string name="detail_heart_img_view_description">Hearted by creator</string>
<string name="open_website_license">Open website</string>
<string name="tablet_mode_title">Tablet mode</string>
Expand Down