Support pause for live

pull/590/head
FongMi 11 months ago
parent ab93ae8487
commit 86f569eb8e
  1. 21
      app/src/mobile/java/com/fongmi/android/tv/ui/activity/LiveActivity.java
  2. 55
      app/src/mobile/res/layout/view_control_live.xml

@ -165,6 +165,9 @@ public class LiveActivity extends BaseActivity implements CustomKeyDownLive.List
mBinding.control.seek.setListener(mPlayers);
mBinding.control.cast.setOnClickListener(view -> onCast());
mBinding.control.info.setOnClickListener(view -> onInfo());
mBinding.control.play.setOnClickListener(view -> checkPlay());
mBinding.control.next.setOnClickListener(view -> checkNext());
mBinding.control.prev.setOnClickListener(view -> checkPrev());
mBinding.control.right.back.setOnClickListener(view -> onBack());
mBinding.control.right.lock.setOnClickListener(view -> onLock());
mBinding.control.right.rotate.setOnClickListener(view -> onRotate());
@ -469,10 +472,12 @@ public class LiveActivity extends BaseActivity implements CustomKeyDownLive.List
mBinding.control.cast.setVisibility(mPlayers.isEmpty() ? View.GONE : View.VISIBLE);
mBinding.control.right.rotate.setVisibility(isLock() ? View.GONE : View.VISIBLE);
mBinding.control.right.back.setVisibility(isLock() ? View.GONE : View.VISIBLE);
mBinding.control.center.setVisibility(isLock() ? View.GONE : View.VISIBLE);
mBinding.control.bottom.setVisibility(isLock() ? View.GONE : View.VISIBLE);
mBinding.control.top.setVisibility(isLock() ? View.GONE : View.VISIBLE);
mBinding.control.getRoot().setVisibility(View.VISIBLE);
setR1Callback();
checkPlayImg();
hideInfo();
hideEpg();
}
@ -664,6 +669,7 @@ public class LiveActivity extends BaseActivity implements CustomKeyDownLive.List
}
private void checkPlayImg() {
mBinding.control.play.setImageResource(mPlayers.isPlaying() ? androidx.media3.ui.R.drawable.exo_icon_pause : androidx.media3.ui.R.drawable.exo_icon_play);
mPiP.update(this, mPlayers.isPlaying());
ActionEvent.update();
}
@ -730,9 +736,9 @@ public class LiveActivity extends BaseActivity implements CustomKeyDownLive.List
if (ActionEvent.PLAY.equals(event.getAction()) || ActionEvent.PAUSE.equals(event.getAction())) {
checkPlay();
} else if (ActionEvent.NEXT.equals(event.getAction())) {
nextChannel();
checkNext();
} else if (ActionEvent.PREV.equals(event.getAction())) {
prevChannel();
checkPrev();
} else if (ActionEvent.STOP.equals(event.getAction())) {
finish();
}
@ -863,6 +869,13 @@ public class LiveActivity extends BaseActivity implements CustomKeyDownLive.List
else nextChannel();
}
private void checkPrev() {
int position = mChannel.getData().getSelected() - 1;
boolean hasPrev = position >= 0;
if (hasPrev) onItemClick(mChannel.getData().getList().get(position));
else prevChannel();
}
private void prevLine() {
if (mChannel == null || mChannel.isOnly()) return;
mChannel.prevLine();
@ -978,12 +991,12 @@ public class LiveActivity extends BaseActivity implements CustomKeyDownLive.List
@Override
public void onFlingUp() {
prevChannel();
checkPrev();
}
@Override
public void onFlingDown() {
nextChannel();
checkNext();
}
@Override

@ -74,6 +74,61 @@
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
android:orientation="horizontal">
<FrameLayout
android:id="@+id/prevRoot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/shape_control">
<ImageView
android:id="@+id/prev"
android:layout_width="24dp"
android:layout_height="24dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:src="@drawable/exo_icon_previous" />
</FrameLayout>
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="48dp"
android:layout_marginEnd="48dp"
android:background="@drawable/shape_control">
<ImageView
android:id="@+id/play"
android:layout_width="40dp"
android:layout_height="40dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:src="@drawable/exo_icon_play" />
</FrameLayout>
<FrameLayout
android:id="@+id/nextRoot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/shape_control">
<ImageView
android:id="@+id/next"
android:layout_width="24dp"
android:layout_height="24dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:src="@drawable/exo_icon_next" />
</FrameLayout>
</LinearLayout>
<include
android:id="@+id/right"
layout="@layout/view_control_right"

Loading…
Cancel
Save