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 92e661d7..d48b5337 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 @@ -794,12 +794,6 @@ public class LivePlayActivity extends BaseActivity { }); } refreshChannelList(currentChannelGroupIndex); - if (currentLiveChannelIndex > -1){ - mLiveChannelView.scrollToPosition(currentLiveChannelIndex); - mLiveChannelView.setSelection(currentLiveChannelIndex); - } -// mChannelGroupView.scrollToPosition(currentChannelGroupIndex); -// mChannelGroupView.setSelection(currentChannelGroupIndex); mHandler.postDelayed(mFocusCurrentChannelAndShowChannelList, 50); } @@ -813,13 +807,18 @@ public class LivePlayActivity extends BaseActivity { private List mLastChannelList = new ArrayList<>(); private void refreshChannelList(int currentChannelGroupIndex) { - // 1. 获取新数据 List newChannels = getLiveChannels(currentChannelGroupIndex); - // 2. 判断数据是否变化(相同组索引且数据内容未变) + // 2. 判断数据是否变化 if (currentChannelGroupIndex == mLastChannelGroupIndex && isSameData(newChannels, mLastChannelList)) { return; // 数据未变化,跳过刷新 解决部分直播频道过多时卡顿 } + if (currentLiveChannelIndex > -1){ + mLiveChannelView.scrollToPosition(currentLiveChannelIndex); + mLiveChannelView.setSelection(currentLiveChannelIndex); + } + mChannelGroupView.scrollToPosition(currentChannelGroupIndex); + mChannelGroupView.setSelection(currentChannelGroupIndex); mLastChannelGroupIndex = currentChannelGroupIndex; mLastChannelList = new ArrayList<>(newChannels); liveChannelItemAdapter.setNewData(newChannels); @@ -1530,6 +1529,7 @@ public class LivePlayActivity extends BaseActivity { } private void selectChannelGroup(int groupIndex, boolean focus, int liveChannelIndex) { + mLastChannelGroupIndex=groupIndex; if (focus) { liveChannelGroupAdapter.setFocusedGroupIndex(groupIndex); liveChannelItemAdapter.setFocusedChannelIndex(-1);