Optimize live list ui

pull/617/head
FongMi 3 months ago
parent 3238778202
commit 5de2db4ec3
  1. 8
      app/src/leanback/java/com/fongmi/android/tv/ui/activity/LiveActivity.java
  2. 4
      app/src/leanback/res/drawable/shape_live_focused.xml
  3. 2
      app/src/leanback/res/drawable/shape_live_list.xml
  4. 10
      app/src/leanback/res/layout/activity_live.xml
  5. 2
      app/src/leanback/res/layout/adapter_channel.xml
  6. 3
      app/src/leanback/res/layout/adapter_epg_data.xml
  7. 3
      app/src/leanback/res/layout/adapter_group.xml

@ -265,7 +265,7 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick
}
private void setWidth(Live live) {
int padding = ResUtil.dp2px(48);
int padding = ResUtil.dp2px(52);
if (live.getWidth() == 0) for (Group item : live.getGroups()) live.setWidth(Math.max(live.getWidth(), ResUtil.getTextWidth(item.getName(), 16)));
int width = live.getWidth() == 0 ? 0 : Math.min(live.getWidth() + padding, ResUtil.getScreenWidth() / 4);
setWidth(mBinding.group, width);
@ -273,7 +273,7 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick
private Group setWidth(Group group) {
int logo = ResUtil.dp2px(60);
int padding = ResUtil.dp2px(60);
int padding = ResUtil.dp2px(64);
if (group.isKeep()) group.setWidth(0);
if (group.getWidth() == 0) for (Channel item : group.getChannel()) group.setWidth(Math.max(group.getWidth(), (item.getLogo().isEmpty() ? 0 : logo) + ResUtil.getTextWidth(item.getNumber() + item.getName(), 16)));
int width = group.getWidth() == 0 ? 0 : Math.min(group.getWidth() + padding, ResUtil.getScreenWidth() / 2);
@ -282,9 +282,9 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick
}
private void setWidth(Epg epg) {
int padding = ResUtil.dp2px(48);
int padding = ResUtil.dp2px(52);
if (epg.getList().isEmpty()) return;
int minWidth = ResUtil.getTextWidth(epg.getList().get(0).getTime(), 16);
int minWidth = ResUtil.getTextWidth(epg.getList().get(0).getTime(), 14);
if (epg.getWidth() == 0) for (EpgData item : epg.getList()) epg.setWidth(Math.max(epg.getWidth(), ResUtil.getTextWidth(item.getTitle(), 16)));
int width = epg.getWidth() == 0 ? 0 : Math.min(Math.max(epg.getWidth(), minWidth) + padding, ResUtil.getScreenWidth() / 2);
setWidth(mBinding.epgData, width);

@ -10,8 +10,8 @@
<padding
android:bottom="12dp"
android:left="20dp"
android:right="20dp"
android:left="12dp"
android:right="12dp"
android:top="12dp" />
</shape>

@ -4,7 +4,7 @@
<gradient
android:angle="0"
android:centerColor="@color/black_60"
android:centerColor="@color/black_40"
android:endColor="@color/black_05"
android:startColor="@color/black_80"
android:type="linear" />

@ -56,6 +56,9 @@
android:id="@+id/group"
android:layout_width="0dp"
android:layout_height="match_parent"
android:clipChildren="false"
android:clipToPadding="false"
android:padding="12dp"
tools:itemCount="5"
tools:listitem="@layout/adapter_group" />
@ -63,6 +66,10 @@
android:id="@+id/channel"
android:layout_width="0dp"
android:layout_height="match_parent"
android:clipChildren="false"
android:translationX="-12dp"
android:clipToPadding="false"
android:padding="12dp"
tools:itemCount="5"
tools:listitem="@layout/adapter_channel" />
@ -70,6 +77,9 @@
android:id="@+id/epgData"
android:layout_width="0dp"
android:layout_height="match_parent"
android:clipChildren="false"
android:clipToPadding="false"
android:padding="12dp"
tools:itemCount="5"
tools:listitem="@layout/adapter_epg_data" />

@ -3,7 +3,6 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="1.5dp"
android:background="@drawable/selector_live"
android:focusable="true"
android:focusableInTouchMode="true"
@ -16,6 +15,7 @@
android:layout_height="wrap_content"
android:layout_marginEnd="12dp"
android:duplicateParentState="true"
android:fontFeatureSettings="tnum"
android:textColor="@color/live"
android:textSize="16sp"
tools:text="01" />

@ -1,9 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<com.fongmi.android.tv.ui.custom.CustomLeftRightLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="1.5dp"
android:background="@drawable/selector_live"
android:focusable="true"
android:focusableInTouchMode="true"

@ -3,8 +3,6 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="1.5dp"
android:background="@drawable/selector_live"
android:focusable="true"
android:focusableInTouchMode="true"
android:gravity="center"
@ -14,6 +12,7 @@
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/selector_live"
android:duplicateParentState="true"
android:ellipsize="marquee"
android:singleLine="true"

Loading…
Cancel
Save