Optimize detail

pull/123/head
FongMi 3 years ago
parent 39fbe8ab6f
commit 2263705bba
  1. 10
      app/src/leanback/java/com/fongmi/android/tv/ui/activity/DetailActivity.java
  2. 8
      app/src/leanback/res/layout/activity_detail.xml

@ -290,14 +290,22 @@ public class DetailActivity extends BaseActivity implements CustomKeyDownVod.Lis
setText(mBinding.actor, R.string.detail_actor, Html.fromHtml(item.getVodActor()).toString());
setText(mBinding.content, R.string.detail_content, Html.fromHtml(item.getVodContent()).toString());
setText(mBinding.director, R.string.detail_director, Html.fromHtml(item.getVodDirector()).toString());
mBinding.content.setMaxLines(isVisible(mBinding.remark) ? 2 : 3);
mFlagAdapter.setItems(item.getVodFlags(), null);
mBinding.content.setMaxLines(getMaxLines());
mBinding.video.requestFocus();
if (hasFlag()) checkHistory();
getPart(item.getVodName());
checkKeep();
}
private int getMaxLines() {
int lines = 1;
if (isGone(mBinding.actor)) ++lines;
if (isGone(mBinding.remark)) ++lines;
if (isGone(mBinding.director)) ++lines;
return lines;
}
private void setText(TextView view, int resId, String text) {
if (text.isEmpty()) view.setVisibility(View.GONE);
else if (resId > 0) view.setText(ResUtil.getString(resId, text));

@ -9,8 +9,8 @@
<FrameLayout
android:id="@+id/video"
android:layout_width="420dp"
android:layout_height="236.25dp"
android:layout_width="400dp"
android:layout_height="225dp"
android:layout_marginStart="24dp"
android:layout_marginTop="24dp"
android:background="@color/black"
@ -168,9 +168,9 @@
android:layout_alignStart="@+id/name"
android:layout_marginTop="6dp"
android:layout_marginEnd="24dp"
android:lineSpacingExtra="2dp"
android:ellipsize="end"
android:maxLines="2"
android:lineSpacingExtra="4dp"
android:maxLines="1"
android:textColor="@color/white"
android:textSize="16sp"
tools:text="簡介:" />

Loading…
Cancel
Save