From ce21fe208738ea6f27936df4314b78d76a80074b Mon Sep 17 00:00:00 2001 From: Vasily Date: Wed, 29 Aug 2018 07:53:58 +0300 Subject: [PATCH] Always show description on tablets --- .../fragments/detail/VideoDetailFragment.java | 37 ++++++++++++------- .../fragment_video_detail.xml | 16 +------- 2 files changed, 24 insertions(+), 29 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java index ad3dacf6b..8f46ec7c6 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java @@ -156,6 +156,7 @@ public class VideoDetailFragment private View videoTitleRoot; private TextView videoTitleTextView; + @Nullable private ImageView videoTitleToggleArrow; private TextView videoCountView; @@ -417,14 +418,16 @@ public class VideoDetailFragment } private void toggleTitleAndDescription() { - if (videoDescriptionRootLayout.getVisibility() == View.VISIBLE) { - videoTitleTextView.setMaxLines(1); - videoDescriptionRootLayout.setVisibility(View.GONE); - videoTitleToggleArrow.setImageResource(R.drawable.arrow_down); - } else { - videoTitleTextView.setMaxLines(10); - videoDescriptionRootLayout.setVisibility(View.VISIBLE); - videoTitleToggleArrow.setImageResource(R.drawable.arrow_up); + if (videoTitleToggleArrow != null) { //it is null for tablets + if (videoDescriptionRootLayout.getVisibility() == View.VISIBLE) { + videoTitleTextView.setMaxLines(1); + videoDescriptionRootLayout.setVisibility(View.GONE); + videoTitleToggleArrow.setImageResource(R.drawable.arrow_down); + } else { + videoTitleTextView.setMaxLines(10); + videoDescriptionRootLayout.setVisibility(View.VISIBLE); + videoTitleToggleArrow.setImageResource(R.drawable.arrow_up); + } } } @@ -1119,8 +1122,10 @@ public class VideoDetailFragment animateView(videoTitleTextView, true, 0); videoDescriptionRootLayout.setVisibility(View.GONE); - videoTitleToggleArrow.setImageResource(R.drawable.arrow_down); - videoTitleToggleArrow.setVisibility(View.GONE); + if (videoTitleToggleArrow != null) { + videoTitleToggleArrow.setImageResource(R.drawable.arrow_down); + videoTitleToggleArrow.setVisibility(View.GONE); + } videoTitleRoot.setClickable(false); imageLoader.cancelDisplayTask(thumbnailImageView); @@ -1195,11 +1200,15 @@ public class VideoDetailFragment detailDurationView.setVisibility(View.GONE); } - videoTitleRoot.setClickable(true); - videoTitleToggleArrow.setVisibility(View.VISIBLE); - videoTitleToggleArrow.setImageResource(R.drawable.arrow_down); videoDescriptionView.setVisibility(View.GONE); - videoDescriptionRootLayout.setVisibility(View.GONE); + if (videoTitleToggleArrow != null) { + videoTitleRoot.setClickable(true); + videoTitleToggleArrow.setVisibility(View.VISIBLE); + videoTitleToggleArrow.setImageResource(R.drawable.arrow_down); + videoDescriptionRootLayout.setVisibility(View.GONE); + } else { + videoDescriptionRootLayout.setVisibility(View.VISIBLE); + } if (!TextUtils.isEmpty(info.getUploadDate())) { videoUploadDateView.setText(Localization.localizeDate(activity, info.getUploadDate())); } diff --git a/app/src/main/res/layout-large-land/fragment_video_detail.xml b/app/src/main/res/layout-large-land/fragment_video_detail.xml index bf49a01a6..73939d60a 100644 --- a/app/src/main/res/layout-large-land/fragment_video_detail.xml +++ b/app/src/main/res/layout-large-land/fragment_video_detail.xml @@ -109,9 +109,6 @@ android:id="@+id/detail_title_root_layout" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="?attr/selectableItemBackground" - android:clickable="true" - android:focusable="true" android:paddingLeft="12dp" android:paddingRight="12dp"> @@ -129,15 +126,6 @@ tools:ignore="RtlHardcoded" tools:text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed a ultricies ex. Integer sit amet sodales risus. Duis non mi et urna pretium bibendum. Nunc eleifend est quis ipsum porttitor egestas. Sed facilisis, nisl quis eleifend pellentesque, orci metus egestas dolor, at accumsan eros metus quis libero." /> - - @@ -413,9 +401,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="5dp" - android:orientation="vertical" - android:visibility="gone" - tools:visibility="visible"> + android:orientation="vertical">