Don't save decode when auto change

pull/497/head
FongMi 2 years ago
parent 64d9d9b5b4
commit 771b7d933e
  1. 8
      app/src/leanback/java/com/fongmi/android/tv/ui/activity/CastActivity.java
  2. 10
      app/src/leanback/java/com/fongmi/android/tv/ui/activity/LiveActivity.java
  3. 8
      app/src/leanback/java/com/fongmi/android/tv/ui/activity/VideoActivity.java
  4. 4
      app/src/main/java/com/fongmi/android/tv/player/Players.java
  5. 8
      app/src/mobile/java/com/fongmi/android/tv/ui/activity/LiveActivity.java
  6. 9
      app/src/mobile/java/com/fongmi/android/tv/ui/activity/VideoActivity.java

@ -189,7 +189,11 @@ public class CastActivity extends BaseActivity implements CustomKeyDownCast.List
}
private void onDecode() {
mPlayers.toggleDecode();
onDecode(true);
}
private void onDecode(boolean save) {
mPlayers.toggleDecode(save);
mPlayers.set(mBinding.exo);
setDecode();
onReset();
@ -334,7 +338,7 @@ public class CastActivity extends BaseActivity implements CustomKeyDownCast.List
@Subscribe(threadMode = ThreadMode.MAIN)
public void onErrorEvent(ErrorEvent event) {
if (event.getCode() / 1000 == 4 && Players.isHard()) onDecode();
if (event.getCode() / 1000 == 4 && Players.isHard()) onDecode(false);
else if (mPlayers.addRetry() > 1) onError(event);
else onReset();
}

@ -3,9 +3,7 @@ package com.fongmi.android.tv.ui.activity;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.support.v4.media.MediaMetadataCompat;
import android.view.KeyEvent;
import android.view.View;
@ -380,7 +378,11 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick
}
private void onDecode() {
mPlayers.toggleDecode();
onDecode(true);
}
private void onDecode(boolean save) {
mPlayers.toggleDecode(save);
mPlayers.set(mBinding.exo);
setDecode();
fetch();
@ -712,7 +714,7 @@ public class LiveActivity extends BaseActivity implements GroupPresenter.OnClick
@Subscribe(threadMode = ThreadMode.MAIN)
public void onErrorEvent(ErrorEvent event) {
if (event.getCode() / 1000 == 4 && Players.isHard()) onDecode();
if (event.getCode() / 1000 == 4 && Players.isHard()) onDecode(false);
else if (mPlayers.addRetry() > 1) onError(event);
else fetch();
}

@ -835,7 +835,11 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List
}
private void onDecode() {
mPlayers.toggleDecode();
onDecode(true);
}
private void onDecode(boolean save) {
mPlayers.toggleDecode(save);
mPlayers.set(mBinding.exo);
setDecode();
onRefresh();
@ -1130,7 +1134,7 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List
@Subscribe(threadMode = ThreadMode.MAIN)
public void onErrorEvent(ErrorEvent event) {
if (isBackground()) return;
if (event.getCode() / 1000 == 4 && Players.isHard()) onDecode();
if (event.getCode() / 1000 == 4 && Players.isHard()) onDecode(false);
else if (mPlayers.addRetry() > 1) onError(event);
else onRefresh();
}

@ -261,9 +261,9 @@ public class Players implements Player.Listener, AnalyticsListener, ParseCallbac
return setSpeed(speed);
}
public void toggleDecode() {
public void toggleDecode(boolean save) {
setDecode(decode == HARD ? SOFT : HARD);
Setting.putDecode(decode);
if (save) Setting.putDecode(decode);
}
public String getPositionTime(long time) {

@ -409,7 +409,11 @@ public class LiveActivity extends BaseActivity implements CustomKeyDownLive.List
}
private void onDecode() {
mPlayers.toggleDecode();
onDecode(true);
}
private void onDecode(boolean save) {
mPlayers.toggleDecode(save);
mPlayers.set(mBinding.exo);
setR1Callback();
setDecode();
@ -769,7 +773,7 @@ public class LiveActivity extends BaseActivity implements CustomKeyDownLive.List
@Subscribe(threadMode = ThreadMode.MAIN)
public void onErrorEvent(ErrorEvent event) {
if (event.getCode() / 1000 == 4 && Players.isHard()) onDecode();
if (event.getCode() / 1000 == 4 && Players.isHard()) onDecode(false);
else if (mPlayers.addRetry() > 1) onError(event);
else fetch();
}

@ -7,7 +7,6 @@ import android.app.Dialog;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
@ -760,7 +759,11 @@ public class VideoActivity extends BaseActivity implements Clock.Callback, Custo
}
private void onDecode() {
mPlayers.toggleDecode();
onDecode(true);
}
private void onDecode(boolean save) {
mPlayers.toggleDecode(save);
mPlayers.set(mBinding.exo);
setR1Callback();
setDecode();
@ -1141,7 +1144,7 @@ public class VideoActivity extends BaseActivity implements Clock.Callback, Custo
@Subscribe(threadMode = ThreadMode.MAIN)
public void onErrorEvent(ErrorEvent event) {
if (isRedirect()) return;
if (event.getCode() / 1000 == 4 && Players.isHard()) onDecode();
if (event.getCode() / 1000 == 4 && Players.isHard()) onDecode(false);
else if (mPlayers.addRetry() > 1) onError(event);
else onRefresh();
}

Loading…
Cancel
Save