[mobile] fix detail bug

pull/123/head
FongMi 3 years ago
parent c552894e56
commit 5ae9f5679a
  1. 13
      app/src/mobile/java/com/fongmi/android/tv/ui/activity/DetailActivity.java
  2. 55
      app/src/mobile/res/layout/activity_detail.xml
  3. 2
      app/src/mobile/res/layout/activity_main.xml

@ -323,14 +323,12 @@ public class DetailActivity extends BaseActivity implements CustomKeyDownVod.Lis
mBinding.video.setTag(item.getVodPic());
mBinding.name.setText(item.getVodName());
setText(mBinding.remark, 0, item.getVodRemarks());
setText(mBinding.year, R.string.detail_year, item.getVodYear());
setText(mBinding.area, R.string.detail_area, item.getVodArea());
setText(mBinding.type, R.string.detail_type, item.getTypeName());
setText(mBinding.site, R.string.detail_site, getSite().getName());
setText(mBinding.actor, R.string.detail_actor, Html.fromHtml(item.getVodActor()).toString());
setText(mBinding.content, 0, Html.fromHtml(item.getVodContent()).toString());
setText(mBinding.director, R.string.detail_director, Html.fromHtml(item.getVodDirector()).toString());
mFlagAdapter.addAll(item.getVodFlags());
setOther(mBinding.other, item);
checkFlag(item);
checkKeepImg();
checkLine();
@ -342,6 +340,15 @@ public class DetailActivity extends BaseActivity implements CustomKeyDownVod.Lis
view.setTag(text);
}
private void setOther(TextView view, Vod item) {
StringBuilder sb = new StringBuilder();
if (!item.getVodYear().isEmpty()) sb.append(getString(R.string.detail_year, item.getVodYear())).append(" ");
if (!item.getVodArea().isEmpty()) sb.append(getString(R.string.detail_area, item.getVodArea())).append(" ");
if (!item.getTypeName().isEmpty()) sb.append(getString(R.string.detail_type, item.getTypeName())).append(" ");
view.setVisibility(sb.length() == 0 ? View.GONE : View.VISIBLE);
view.setText(Utils.substring(sb.toString(), 2));
}
private void checkLine() {
mBinding.content.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override

@ -101,50 +101,29 @@
android:textSize="14sp"
tools:text="更新到第二季" />
<LinearLayout
<TextView
android:id="@+id/site"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:orientation="horizontal">
<TextView
android:id="@+id/site"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:textColor="@color/white"
android:textSize="14sp"
tools:text="站源:泥巴" />
<TextView
android:id="@+id/year"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:textColor="@color/white"
android:textSize="14sp"
tools:text="年份:2022" />
<TextView
android:id="@+id/area"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:textColor="@color/white"
android:textSize="14sp"
tools:text="地區:台灣" />
<TextView
android:id="@+id/type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:textSize="14sp"
tools:text="類型:科幻" />
android:singleLine="true"
android:textColor="@color/white"
android:textSize="14sp"
tools:text="站源:泥巴" />
</LinearLayout>
<TextView
android:id="@+id/other"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:singleLine="true"
android:textColor="@color/white"
android:textSize="14sp"
tools:text="年份:2022 地區:台灣 類型:科幻" />
<TextView
android:id="@+id/director"

@ -16,7 +16,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@color/white_70"
android:background="@color/white_80"
app:elevation="0dp"
app:menu="@menu/menu_nav" />

Loading…
Cancel
Save