From e8daa3f0b179c5f7be886c5fc481e8fa54f9c5bc Mon Sep 17 00:00:00 2001 From: FongMi Date: Thu, 25 Jan 2024 10:24:39 +0800 Subject: [PATCH] Support epg - part 3 --- app/src/leanback/res/layout/adapter_group.xml | 8 -------- .../android/tv/ui/activity/LiveActivity.java | 17 +++++++++++------ app/src/mobile/res/layout/adapter_channel.xml | 8 -------- app/src/mobile/res/layout/adapter_epg.xml | 12 ++---------- app/src/mobile/res/layout/adapter_group.xml | 4 ---- 5 files changed, 13 insertions(+), 36 deletions(-) diff --git a/app/src/leanback/res/layout/adapter_group.xml b/app/src/leanback/res/layout/adapter_group.xml index 9e7006304..81974d5c7 100644 --- a/app/src/leanback/res/layout/adapter_group.xml +++ b/app/src/leanback/res/layout/adapter_group.xml @@ -11,14 +11,6 @@ android:paddingStart="20dp" android:paddingEnd="20dp"> - - onSpeedLong()); mBinding.control.action.getRoot().setOnTouchListener(this::onActionTouch); mBinding.video.setOnTouchListener((view, event) -> mKeyDown.onTouchEvent(event)); + mBinding.channel.setOnTouchListener(this::onRecyclerTouch); + mBinding.group.setOnTouchListener(this::onRecyclerTouch); + mBinding.epg.setOnTouchListener(this::onRecyclerTouch); } private void setRecyclerView() { @@ -303,12 +306,9 @@ public class LiveActivity extends BaseActivity implements CustomKeyDownLive.List } private void setWidth(Live live) { - int def = ResUtil.dp2px(160); - int logo = ResUtil.dp2px(56); - int group = ResUtil.dp2px(44); for (Group item : live.getGroups()) live.setWidth(Math.max(live.getWidth(), ResUtil.getTextWidth(item.getName(), 14))); - mBinding.group.getLayoutParams().width = live.getWidth() == 0 ? 0 : Math.min(live.getWidth() + group, def); - mBinding.channel.getLayoutParams().width = live.getLogo().isEmpty() ? def : logo; + mBinding.group.getLayoutParams().width = live.getWidth() == 0 ? 0 : Math.min(live.getWidth() + ResUtil.dp2px(44), ResUtil.dp2px(180)); + mBinding.channel.getLayoutParams().width = live.getLogo().isEmpty() ? ResUtil.dp2px(180) : ResUtil.dp2px(236); mBinding.divide1.setVisibility(live.getWidth() == 0 ? View.GONE : View.VISIBLE); } @@ -451,10 +451,15 @@ public class LiveActivity extends BaseActivity implements CustomKeyDownLive.List } private boolean onActionTouch(View v, MotionEvent e) { - setR1Callback(); + if (e.getAction() == MotionEvent.ACTION_UP) setR1Callback(); return false; } + private boolean onRecyclerTouch(View v, MotionEvent e) { + if (e.getAction() == MotionEvent.ACTION_UP) onSingleTap(); + return true; + } + private void hideUI() { if (isGone(mBinding.recycler)) return; mBinding.recycler.setVisibility(View.GONE); diff --git a/app/src/mobile/res/layout/adapter_channel.xml b/app/src/mobile/res/layout/adapter_channel.xml index 6902f041d..5f6edeecf 100644 --- a/app/src/mobile/res/layout/adapter_channel.xml +++ b/app/src/mobile/res/layout/adapter_channel.xml @@ -19,10 +19,6 @@ android:layout_height="wrap_content" android:layout_marginEnd="12dp" android:duplicateParentState="true" - android:shadowColor="@color/grey_900" - android:shadowDx="2" - android:shadowDy="2" - android:shadowRadius="1" android:textColor="@color/channel" android:textSize="14sp" tools:text="01" /> @@ -41,10 +37,6 @@ android:layout_height="wrap_content" android:duplicateParentState="true" android:ellipsize="marquee" - android:shadowColor="@color/grey_900" - android:shadowDx="2" - android:shadowDy="2" - android:shadowRadius="1" android:singleLine="true" android:textColor="@color/channel" android:textSize="14sp" diff --git a/app/src/mobile/res/layout/adapter_epg.xml b/app/src/mobile/res/layout/adapter_epg.xml index 4a3192ea7..da2745d16 100644 --- a/app/src/mobile/res/layout/adapter_epg.xml +++ b/app/src/mobile/res/layout/adapter_epg.xml @@ -4,9 +4,9 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" - android:paddingStart="8dp" + android:paddingStart="12dp" android:paddingTop="6dp" - android:paddingEnd="8dp" + android:paddingEnd="12dp" android:paddingBottom="6dp">