diff --git a/.idea/misc.xml b/.idea/misc.xml index 5c9f89fe..fbe5affc 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,5 +1,14 @@ + + + diff --git a/app/src/main/java/com/github/tvbox/osc/api/ApiConfig.java b/app/src/main/java/com/github/tvbox/osc/api/ApiConfig.java index c3789c17..871ffb44 100644 --- a/app/src/main/java/com/github/tvbox/osc/api/ApiConfig.java +++ b/app/src/main/java/com/github/tvbox/osc/api/ApiConfig.java @@ -439,6 +439,10 @@ public class ApiConfig { public List getChannelGroupList() { return channelGroupList; } + public void setChannelGroupList(List list) { + channelGroupList.clear(); + channelGroupList.addAll(list); + } public List getIjkCodes() { return ijkCodes; diff --git a/app/src/main/java/com/github/tvbox/osc/ui/activity/LivePlayActivity.java b/app/src/main/java/com/github/tvbox/osc/ui/activity/LivePlayActivity.java index a5847a2d..4999fadb 100644 --- a/app/src/main/java/com/github/tvbox/osc/ui/activity/LivePlayActivity.java +++ b/app/src/main/java/com/github/tvbox/osc/ui/activity/LivePlayActivity.java @@ -82,7 +82,7 @@ public class LivePlayActivity extends BaseActivity { // layoutParams.width = 100; // layoutParams.height = 50; // mVideoView.setLayoutParams(layoutParams); - tvLeftLinearLayout = findViewById(R.id.tvLeftlinearLayout); + tvLeftLinearLayout = findViewById(R.id.tvLeftLinearLayout); mGroupGridView = findViewById(R.id.mGroupGridView); mChannelGridView = findViewById(R.id.mChannelGridView); tvChannel = findViewById(R.id.tvChannel); @@ -306,6 +306,7 @@ public class LivePlayActivity extends BaseActivity { } channelGroupList.add(channelGroup); } + ApiConfig.get().setChannelGroupList(channelGroupList); } private void initLiveState() { @@ -388,7 +389,7 @@ public class LivePlayActivity extends BaseActivity { private Runnable showListAfterScrollOk = new Runnable() { @Override public void run() { - if (mGroupGridView.isScrolling()) { + if (mGroupGridView.isScrolling() || mChannelGridView.isScrolling()) { mHandler.postDelayed(this, 100); } else { ViewObj viewObj = new ViewObj(tvLeftLinearLayout, (ViewGroup.MarginLayoutParams) tvLeftLinearLayout.getLayoutParams()); @@ -409,11 +410,18 @@ public class LivePlayActivity extends BaseActivity { private void showChannelList() { if (tvLeftLinearLayout.getVisibility() == View.INVISIBLE) { - tvHint.setVisibility(View.VISIBLE); - tvLeftLinearLayout.setVisibility(View.VISIBLE); + if (selectedGroupIndex != currentGroupIndex) { + channelGroupList.get(selectedGroupIndex).setDefault(false); + groupAdapter.notifyItemChanged(selectedGroupIndex); + selectedGroupIndex = currentGroupIndex; + channelGroupList.get(selectedGroupIndex).setDefault(true); + groupAdapter.notifyItemChanged(selectedGroupIndex); + } channelAdapter.setNewData(channelGroupList.get(currentGroupIndex).getLiveChannels()); mGroupGridView.setSelection(currentGroupIndex); mChannelGridView.setSelection(currentChannelIndex); + tvHint.setVisibility(View.VISIBLE); + tvLeftLinearLayout.setVisibility(View.VISIBLE); mHandler.postDelayed(showListAfterScrollOk, 100); } } @@ -442,9 +450,9 @@ public class LivePlayActivity extends BaseActivity { || channelIndex < 0 || channelIndex >= channelGroupList.get(groupIndex).getLiveChannels().size()) return false; - if (groupIndex != currentGroupIndex) { - channelGroupList.get(currentGroupIndex).setDefault(false); - groupAdapter.notifyItemChanged(currentGroupIndex); + if (groupIndex != selectedGroupIndex) { + channelGroupList.get(selectedGroupIndex).setDefault(false); + groupAdapter.notifyItemChanged(selectedGroupIndex); } if (channelIndex != currentChannelIndex) { channelGroupList.get(currentGroupIndex).getLiveChannels().get(currentChannelIndex).setDefault(false); diff --git a/app/src/main/res/layout/activity_live_play.xml b/app/src/main/res/layout/activity_live_play.xml index b81685f1..813dfa97 100644 --- a/app/src/main/res/layout/activity_live_play.xml +++ b/app/src/main/res/layout/activity_live_play.xml @@ -10,10 +10,10 @@ android:layout_height="match_parent" /> diff --git a/app/src/main/res/layout/item_channel_group_layout.xml b/app/src/main/res/layout/item_channel_group_layout.xml index 170659a1..8e596b18 100644 --- a/app/src/main/res/layout/item_channel_group_layout.xml +++ b/app/src/main/res/layout/item_channel_group_layout.xml @@ -4,7 +4,6 @@ android:layout_height="wrap_content" android:layout_marginTop="10mm" android:layout_marginBottom="10mm" - android:background="@drawable/live_focus" android:focusable="true" android:focusableInTouchMode="true" android:orientation="horizontal"> diff --git a/app/src/main/res/layout/item_live_channel_layout.xml b/app/src/main/res/layout/item_live_channel_layout.xml index 6c59b5c0..2bde1020 100644 --- a/app/src/main/res/layout/item_live_channel_layout.xml +++ b/app/src/main/res/layout/item_live_channel_layout.xml @@ -4,15 +4,16 @@ android:layout_height="wrap_content" android:layout_marginTop="10mm" android:layout_marginBottom="10mm" - android:background="@drawable/live_focus" + android:layout_marginLeft="10mm" + android:layout_marginRight="10mm" android:focusable="true" android:focusableInTouchMode="true" android:orientation="horizontal">