mirror of
https://github.com/yuliskov/SmartTube.git
synced 2026-01-27 09:00:45 -06:00
improve pip
This commit is contained in:
Submodule SharedModules updated: 864becb76c...065d038af3
@@ -10,6 +10,7 @@ import androidx.fragment.app.Fragment;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import com.liskovsoft.sharedutils.mylogger.Log;
|
||||
import com.liskovsoft.smartyoutubetv2.common.app.models.playback.controller.PlaybackEngineController;
|
||||
import com.liskovsoft.smartyoutubetv2.common.app.views.ViewManager;
|
||||
import com.liskovsoft.smartyoutubetv2.tv.R;
|
||||
@@ -23,6 +24,7 @@ import com.liskovsoft.smartyoutubetv2.tv.ui.common.LeanbackActivity;
|
||||
* <a href="https://developer.android.com/training/game-controllers/controller-input.html">docs</href>.
|
||||
*/
|
||||
public class PlaybackActivity extends LeanbackActivity {
|
||||
private static final String TAG = PlaybackActivity.class.getSimpleName();
|
||||
private static final float GAMEPAD_TRIGGER_INTENSITY_ON = 0.5f;
|
||||
// Off-condition slightly smaller for button debouncing.
|
||||
private static final float GAMEPAD_TRIGGER_INTENSITY_OFF = 0.45f;
|
||||
@@ -96,6 +98,13 @@ public class PlaybackActivity extends LeanbackActivity {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode) {
|
||||
super.onPictureInPictureModeChanged(isInPictureInPictureMode);
|
||||
|
||||
mPlaybackFragment.restartPlayer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
super.onBackPressed();
|
||||
@@ -123,6 +132,13 @@ public class PlaybackActivity extends LeanbackActivity {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
|
||||
Log.d(TAG, "Config changed: " + newConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finish() {
|
||||
ViewManager.instance(this).startParentView(this);
|
||||
|
||||
@@ -153,6 +153,16 @@ public class PlaybackFragment extends VideoSupportFragment implements PlaybackVi
|
||||
return selectedPosition;
|
||||
}
|
||||
|
||||
public void restartPlayer() {
|
||||
boolean engineBlocked = isEngineBlocked();
|
||||
blockEngine(false);
|
||||
|
||||
releasePlayer();
|
||||
initializePlayer();
|
||||
|
||||
blockEngine(engineBlocked);
|
||||
}
|
||||
|
||||
private void releasePlayer() {
|
||||
if (isEngineBlocked()) {
|
||||
Log.d(TAG, "releasePlayer: Engine release is blocked. Exiting...");
|
||||
|
||||
Reference in New Issue
Block a user