app: force finish on double back

This commit is contained in:
Yuriy Liskov
2025-10-25 13:24:14 +03:00
parent 73cace1b21
commit fb52313dd0
6 changed files with 12 additions and 11 deletions

View File

@@ -131,13 +131,12 @@ public class VideoLoaderController extends BasePlayerController {
} else if ((!getVideo().isLive || getVideo().isLiveEnd)
&& getPlayer().getDurationMs() - getPlayer().getPositionMs() < STREAM_END_THRESHOLD_MS) {
getMainController().onPlayEnd();
} else if (!getVideo().isLive && !getVideo().isLiveEnd
&& !getPlayerTweaksData().isNetworkErrorFixingDisabled() && Playlist.instance().getAllAfterCurrent() == null) {
} else if (!getVideo().isLive && !getVideo().isLiveEnd && !getPlayerTweaksData().isNetworkErrorFixingDisabled()) {
MessageHelpers.showLongMessage(getContext(), R.string.playback_buffering_fix);
YouTubeServiceManager.instance().invalidateCache();
// Faster source is different among devices. Try them one by one.
switchNextEngine();
YouTubeServiceManager.instance().invalidateCache();
rebootApp(); // without a reboot the app will keep buffering
restartEngine();
}
}

View File

@@ -19,7 +19,6 @@ import com.liskovsoft.smartyoutubetv2.common.app.models.playback.controllers.Sug
import com.liskovsoft.smartyoutubetv2.common.app.models.playback.controllers.VideoLoaderController;
import com.liskovsoft.smartyoutubetv2.common.app.models.playback.controllers.VideoStateController;
import com.liskovsoft.smartyoutubetv2.common.app.models.playback.listener.PlayerEventListener;
import com.liskovsoft.smartyoutubetv2.common.app.models.playback.listener.PlayerUiEventListener;
import com.liskovsoft.smartyoutubetv2.common.app.models.playback.listener.ViewEventListener;
import com.liskovsoft.smartyoutubetv2.common.app.presenters.base.BasePresenter;
import com.liskovsoft.smartyoutubetv2.common.app.presenters.dialogs.menu.VideoMenuPresenter;

View File

@@ -875,7 +875,6 @@ public class Utils {
*/
public static void properlyFinishTheApp(Context context) {
ViewManager.instance(context).properlyFinishTheApp(context);
//forceFinishTheApp();
}
/**

View File

@@ -60,8 +60,8 @@ android {
applicationId "com.liskovsoft.smarttubetv"
minSdkVersion project.properties.minSdkVersion
targetSdkVersion project.properties.targetSdkVersion
versionCode 2191
versionName "30.01"
versionCode 2192
versionName "30.02"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
buildConfigField "long", "TIMESTAMP", System.currentTimeMillis() + "L"

View File

@@ -6,12 +6,12 @@ import android.view.KeyEvent;
import com.liskovsoft.sharedutils.mylogger.Log;
import com.liskovsoft.smartyoutubetv2.common.app.presenters.SearchPresenter;
import com.liskovsoft.smartyoutubetv2.common.app.views.ViewManager;
import com.liskovsoft.smartyoutubetv2.common.autoframerate.ModeSyncManager;
import com.liskovsoft.smartyoutubetv2.common.misc.GlobalKeyTranslator;
import com.liskovsoft.smartyoutubetv2.common.misc.MotherActivity;
import com.liskovsoft.smartyoutubetv2.common.misc.PlayerKeyTranslator;
import com.liskovsoft.smartyoutubetv2.common.prefs.GeneralData;
import com.liskovsoft.smartyoutubetv2.common.prefs.RemoteControlData;
import com.liskovsoft.smartyoutubetv2.common.utils.Utils;
import com.liskovsoft.smartyoutubetv2.tv.ui.common.keyhandler.DoubleBackManager2;
import com.liskovsoft.smartyoutubetv2.tv.ui.playback.PlaybackActivity;
@@ -137,6 +137,10 @@ public abstract class LeanbackActivity extends MotherActivity {
}
private void finishTheApp() {
Utils.properlyFinishTheApp(this);
if (RemoteControlData.instance(this).isConnectedBefore()) {
Utils.properlyFinishTheApp(this);
} else {
Utils.forceFinishTheApp();
}
}
}