Merge pull request #7577 from dkramer95/feature/pinned-comment

Added ability to see pinned comment
This commit is contained in:
Tobi 2021-12-27 16:51:36 +01:00 committed by GitHub
commit 45ef9b0278
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 60 additions and 1 deletions

View File

@ -34,12 +34,14 @@ import org.schabi.newpipe.local.history.HistoryRecordManager;
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
@ -55,5 +57,7 @@ public class CommentsInfoItemHolder extends CommentsMiniInfoItemHolder {
itemTitleView.setText(item.getUploaderName());
itemHeartView.setVisibility(item.isHeartedByUploader() ? View.VISIBLE : View.GONE);
itemPinnedView.setVisibility(item.isPinned() ? View.VISIBLE : View.GONE);
}
}

View File

@ -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>

View File

@ -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>

View File

@ -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"

View File

@ -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>

View File

@ -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>

View File

@ -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>
@ -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>

View File

@ -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>