fix live channel bug;

pull/144/head
jun 1 year ago
parent f5f0d72e59
commit 46d551a5dd
  1. 16
      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<LiveChannelItem> mLastChannelList = new ArrayList<>();
private void refreshChannelList(int currentChannelGroupIndex) {
// 1. 获取新数据
List<LiveChannelItem> 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);

Loading…
Cancel
Save