Always show description on tablets

This commit is contained in:
Vasily 2018-08-29 07:53:58 +03:00
parent 4208c852e1
commit ce21fe2087
2 changed files with 24 additions and 29 deletions

View File

@ -156,6 +156,7 @@ public class VideoDetailFragment
private View videoTitleRoot; private View videoTitleRoot;
private TextView videoTitleTextView; private TextView videoTitleTextView;
@Nullable
private ImageView videoTitleToggleArrow; private ImageView videoTitleToggleArrow;
private TextView videoCountView; private TextView videoCountView;
@ -417,14 +418,16 @@ public class VideoDetailFragment
} }
private void toggleTitleAndDescription() { private void toggleTitleAndDescription() {
if (videoDescriptionRootLayout.getVisibility() == View.VISIBLE) { if (videoTitleToggleArrow != null) { //it is null for tablets
videoTitleTextView.setMaxLines(1); if (videoDescriptionRootLayout.getVisibility() == View.VISIBLE) {
videoDescriptionRootLayout.setVisibility(View.GONE); videoTitleTextView.setMaxLines(1);
videoTitleToggleArrow.setImageResource(R.drawable.arrow_down); videoDescriptionRootLayout.setVisibility(View.GONE);
} else { videoTitleToggleArrow.setImageResource(R.drawable.arrow_down);
videoTitleTextView.setMaxLines(10); } else {
videoDescriptionRootLayout.setVisibility(View.VISIBLE); videoTitleTextView.setMaxLines(10);
videoTitleToggleArrow.setImageResource(R.drawable.arrow_up); videoDescriptionRootLayout.setVisibility(View.VISIBLE);
videoTitleToggleArrow.setImageResource(R.drawable.arrow_up);
}
} }
} }
@ -1119,8 +1122,10 @@ public class VideoDetailFragment
animateView(videoTitleTextView, true, 0); animateView(videoTitleTextView, true, 0);
videoDescriptionRootLayout.setVisibility(View.GONE); videoDescriptionRootLayout.setVisibility(View.GONE);
videoTitleToggleArrow.setImageResource(R.drawable.arrow_down); if (videoTitleToggleArrow != null) {
videoTitleToggleArrow.setVisibility(View.GONE); videoTitleToggleArrow.setImageResource(R.drawable.arrow_down);
videoTitleToggleArrow.setVisibility(View.GONE);
}
videoTitleRoot.setClickable(false); videoTitleRoot.setClickable(false);
imageLoader.cancelDisplayTask(thumbnailImageView); imageLoader.cancelDisplayTask(thumbnailImageView);
@ -1195,11 +1200,15 @@ public class VideoDetailFragment
detailDurationView.setVisibility(View.GONE); detailDurationView.setVisibility(View.GONE);
} }
videoTitleRoot.setClickable(true);
videoTitleToggleArrow.setVisibility(View.VISIBLE);
videoTitleToggleArrow.setImageResource(R.drawable.arrow_down);
videoDescriptionView.setVisibility(View.GONE); 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())) { if (!TextUtils.isEmpty(info.getUploadDate())) {
videoUploadDateView.setText(Localization.localizeDate(activity, info.getUploadDate())); videoUploadDateView.setText(Localization.localizeDate(activity, info.getUploadDate()));
} }

View File

@ -109,9 +109,6 @@
android:id="@+id/detail_title_root_layout" android:id="@+id/detail_title_root_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:paddingLeft="12dp" android:paddingLeft="12dp"
android:paddingRight="12dp"> android:paddingRight="12dp">
@ -129,15 +126,6 @@
tools:ignore="RtlHardcoded" 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." /> 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." />
<ImageView
android:id="@+id/detail_toggle_description_view"
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_gravity="center_vertical|right"
android:layout_marginLeft="5dp"
android:src="@drawable/arrow_down"
tools:ignore="ContentDescription,RtlHardcoded" />
</FrameLayout> </FrameLayout>
<!-- LOADING INDICATOR--> <!-- LOADING INDICATOR-->
@ -413,9 +401,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:orientation="vertical" android:orientation="vertical">
android:visibility="gone"
tools:visibility="visible">
<TextView <TextView
android:id="@+id/detail_upload_date_view" android:id="@+id/detail_upload_date_view"