[leanback] live support seek

pull/496/head
FongMi 2 years ago
parent 97939349ba
commit b45d1e41bb
  1. 2
      app/src/leanback/java/com/fongmi/android/tv/ui/activity/CastActivity.java
  2. 2
      app/src/leanback/java/com/fongmi/android/tv/ui/activity/HomeActivity.java
  3. 21
      app/src/leanback/java/com/fongmi/android/tv/ui/activity/LiveActivity.java
  4. 4
      app/src/leanback/java/com/fongmi/android/tv/ui/activity/VideoActivity.java
  5. 2
      app/src/leanback/res/layout/activity_home.xml
  6. 2
      app/src/leanback/res/layout/view_widget_cast.xml
  7. 2
      app/src/leanback/res/layout/view_widget_live.xml
  8. 2
      app/src/leanback/res/layout/view_widget_vod.xml

@ -91,7 +91,7 @@ public class CastActivity extends BaseActivity implements CustomKeyDownCast.List
@Override
protected void initView() {
bindService(new Intent(this, DLNARendererService.class), this, Context.BIND_AUTO_CREATE);
mClock = Clock.create(mBinding.widget.time);
mClock = Clock.create(mBinding.widget.clock);
mKeyDown = CustomKeyDownCast.create(this);
mPlayers = new Players().init(this);
mParser = new DIDLParser();

@ -101,7 +101,7 @@ public class HomeActivity extends BaseActivity implements CustomTitleView.Listen
@Override
protected void initView() {
DLNARendererService.Companion.start(this, R.drawable.ic_logo);
mClock = Clock.create(mBinding.time).format("MM/dd HH:mm:ss");
mClock = Clock.create(mBinding.clock).format("MM/dd HH:mm:ss");
mBinding.progressLayout.showProgress();
Updater.get().release().start(this);
mResult = Result.empty();

@ -139,7 +139,7 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick
@Override
protected void initView() {
mClock = Clock.create(mBinding.widget.time);
mClock = Clock.create(mBinding.widget.clock);
mKeyDown = CustomKeyDownLive.create(this);
mPlayers = new Players().init(this);
mHides = new ArrayList<>();
@ -822,14 +822,14 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick
}
private void prevLine() {
if (mChannel == null) return;
if (mChannel == null || mChannel.isOnly()) return;
mChannel.prevLine();
showInfo();
fetch();
}
private void nextLine(boolean show) {
if (mChannel == null) return;
if (mChannel == null || mChannel.isOnly()) return;
mChannel.nextLine();
if (show) showInfo();
else setInfo();
@ -838,6 +838,7 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick
private void seekTo(int time) {
mPlayers.seekTo(time);
mKeyDown.resetTime();
showProgress();
hideCenter();
}
@ -907,7 +908,7 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick
@Override
public void onSeeking(int time) {
if (!mPlayers.isVod() || !mChannel.isOnly()) return;
if (!mPlayers.isVod()) return;
mBinding.widget.exoDuration.setText(mPlayers.getDurationTime());
mBinding.widget.exoPosition.setText(mPlayers.getPositionTime(time));
mBinding.widget.action.setImageResource(time > 0 ? R.drawable.ic_widget_forward : R.drawable.ic_widget_rewind);
@ -927,18 +928,14 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick
@Override
public void onKeyLeft(int time) {
if (mChannel == null) return;
if (mChannel.isOnly() && mPlayers.isVod()) App.post(() -> seekTo(time), 250);
else if (!mChannel.isOnly()) prevLine();
mKeyDown.resetTime();
if (!mPlayers.isVod()) prevLine();
else App.post(() -> seekTo(time), 250);
}
@Override
public void onKeyRight(int time) {
if (mChannel == null) return;
if (mChannel.isOnly() && mPlayers.isVod()) App.post(() -> seekTo(time), 250);
else if (!mChannel.isOnly()) nextLine(true);
mKeyDown.resetTime();
if (!mPlayers.isVod()) nextLine(true);
else App.post(() -> seekTo(time), 250);
}
@Override

@ -292,7 +292,7 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List
@Override
protected void initView() {
mFrameParams = mBinding.video.getLayoutParams();
mClock = Clock.create(mBinding.widget.time);
mClock = Clock.create(mBinding.widget.clock);
mKeyDown = CustomKeyDownVod.create(this);
mPlayers = new Players().init(this);
mBroken = new ArrayList<>();
@ -1416,8 +1416,8 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List
@Override
public void onSeekTo(int time) {
mKeyDown.resetTime();
mPlayers.seekTo(time);
mKeyDown.resetTime();
showProgress();
onPlay();
}

@ -46,7 +46,7 @@
</LinearLayout>
<TextView
android:id="@+id/time"
android:id="@+id/clock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"

@ -43,7 +43,7 @@
tools:text="1920 x 1080" />
<TextView
android:id="@+id/time"
android:id="@+id/clock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"

@ -232,7 +232,7 @@
tools:text="來源 1" />
<TextView
android:id="@+id/time"
android:id="@+id/clock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white"

@ -43,7 +43,7 @@
tools:text="1920 x 1080" />
<TextView
android:id="@+id/time"
android:id="@+id/clock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"

Loading…
Cancel
Save