Skip to content

Commit 448531d

Browse files
committed
bugs fixes & proxy mode optimize
1 parent 8ec2c2f commit 448531d

File tree

6 files changed

+35
-14
lines changed

6 files changed

+35
-14
lines changed

.idea/misc.xml

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/main/java/com/github/tvbox/osc/api/ApiConfig.java

+4
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,10 @@ public SourceBean getHomeSourceBean() {
439439
public List<ChannelGroup> getChannelGroupList() {
440440
return channelGroupList;
441441
}
442+
public void setChannelGroupList(List<ChannelGroup> list) {
443+
channelGroupList.clear();
444+
channelGroupList.addAll(list);
445+
}
442446

443447
public List<IJKCode> getIjkCodes() {
444448
return ijkCodes;

app/src/main/java/com/github/tvbox/osc/ui/activity/LivePlayActivity.java

+15-7
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ protected void init() {
8282
// layoutParams.width = 100;
8383
// layoutParams.height = 50;
8484
// mVideoView.setLayoutParams(layoutParams);
85-
tvLeftLinearLayout = findViewById(R.id.tvLeftlinearLayout);
85+
tvLeftLinearLayout = findViewById(R.id.tvLeftLinearLayout);
8686
mGroupGridView = findViewById(R.id.mGroupGridView);
8787
mChannelGridView = findViewById(R.id.mChannelGridView);
8888
tvChannel = findViewById(R.id.tvChannel);
@@ -306,6 +306,7 @@ public void loadLives(JsonArray livesArray) {
306306
}
307307
channelGroupList.add(channelGroup);
308308
}
309+
ApiConfig.get().setChannelGroupList(channelGroupList);
309310
}
310311

311312
private void initLiveState() {
@@ -388,7 +389,7 @@ public void run() {
388389
private Runnable showListAfterScrollOk = new Runnable() {
389390
@Override
390391
public void run() {
391-
if (mGroupGridView.isScrolling()) {
392+
if (mGroupGridView.isScrolling() || mChannelGridView.isScrolling()) {
392393
mHandler.postDelayed(this, 100);
393394
} else {
394395
ViewObj viewObj = new ViewObj(tvLeftLinearLayout, (ViewGroup.MarginLayoutParams) tvLeftLinearLayout.getLayoutParams());
@@ -409,11 +410,18 @@ public void onAnimationEnd(Animator animation) {
409410

410411
private void showChannelList() {
411412
if (tvLeftLinearLayout.getVisibility() == View.INVISIBLE) {
412-
tvHint.setVisibility(View.VISIBLE);
413-
tvLeftLinearLayout.setVisibility(View.VISIBLE);
413+
if (selectedGroupIndex != currentGroupIndex) {
414+
channelGroupList.get(selectedGroupIndex).setDefault(false);
415+
groupAdapter.notifyItemChanged(selectedGroupIndex);
416+
selectedGroupIndex = currentGroupIndex;
417+
channelGroupList.get(selectedGroupIndex).setDefault(true);
418+
groupAdapter.notifyItemChanged(selectedGroupIndex);
419+
}
414420
channelAdapter.setNewData(channelGroupList.get(currentGroupIndex).getLiveChannels());
415421
mGroupGridView.setSelection(currentGroupIndex);
416422
mChannelGridView.setSelection(currentChannelIndex);
423+
tvHint.setVisibility(View.VISIBLE);
424+
tvLeftLinearLayout.setVisibility(View.VISIBLE);
417425
mHandler.postDelayed(showListAfterScrollOk, 100);
418426
}
419427
}
@@ -442,9 +450,9 @@ private boolean playChannel(int groupIndex, int channelIndex, boolean changeSour
442450
|| channelIndex < 0 || channelIndex >= channelGroupList.get(groupIndex).getLiveChannels().size())
443451
return false;
444452

445-
if (groupIndex != currentGroupIndex) {
446-
channelGroupList.get(currentGroupIndex).setDefault(false);
447-
groupAdapter.notifyItemChanged(currentGroupIndex);
453+
if (groupIndex != selectedGroupIndex) {
454+
channelGroupList.get(selectedGroupIndex).setDefault(false);
455+
groupAdapter.notifyItemChanged(selectedGroupIndex);
448456
}
449457
if (channelIndex != currentChannelIndex) {
450458
channelGroupList.get(currentGroupIndex).getLiveChannels().get(currentChannelIndex).setDefault(false);

app/src/main/res/layout/activity_live_play.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
android:layout_height="match_parent" />
1111

1212
<LinearLayout
13-
android:id="@+id/tvLeftlinearLayout"
13+
android:id="@+id/tvLeftLinearLayout"
1414
android:layout_width="421mm"
1515
android:layout_height="match_parent"
16-
android:layout_marginLeft="0mm"
16+
android:layout_marginLeft="-421mm"
1717
android:gravity="center_vertical"
1818
android:orientation="horizontal"
1919
android:visibility="visible" >

app/src/main/res/layout/item_channel_group_layout.xml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
android:layout_height="wrap_content"
55
android:layout_marginTop="10mm"
66
android:layout_marginBottom="10mm"
7-
android:background="@drawable/live_focus"
87
android:focusable="true"
98
android:focusableInTouchMode="true"
109
android:orientation="horizontal">

app/src/main/res/layout/item_live_channel_layout.xml

+5-4
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44
android:layout_height="wrap_content"
55
android:layout_marginTop="10mm"
66
android:layout_marginBottom="10mm"
7-
android:background="@drawable/live_focus"
7+
android:layout_marginLeft="10mm"
8+
android:layout_marginRight="10mm"
89
android:focusable="true"
910
android:focusableInTouchMode="true"
1011
android:orientation="horizontal">
1112

1213
<TextView
1314
android:id="@+id/tvChannelNum"
14-
android:layout_width="40mm"
15-
android:layout_height="60mm"
15+
android:layout_width="60mm"
16+
android:layout_height="50mm"
1617
android:ellipsize="marquee"
1718
android:gravity="center"
1819
android:marqueeRepeatLimit="marquee_forever"
@@ -26,7 +27,7 @@
2627
android:layout_height="60mm"
2728
android:layout_weight="1"
2829
android:ellipsize="marquee"
29-
android:gravity="center"
30+
android:gravity="left"
3031
android:marqueeRepeatLimit="marquee_forever"
3132
android:singleLine="true"
3233
android:textColor="@android:color/white"

0 commit comments

Comments
 (0)