Fix orientation issues
This commit is contained in:
parent
f2b46fffe0
commit
dd7d253a1b
|
@ -521,7 +521,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||||
isRemote = false;
|
isRemote = false;
|
||||||
peertubeInstance = b.getString("peertube_instance", Helper.getLiveInstance(PeertubeActivity.this));
|
peertubeInstance = b.getString("peertube_instance", Helper.getLiveInstance(PeertubeActivity.this));
|
||||||
videoUuid = b.getString("video_uuid", null);
|
videoUuid = b.getString("video_uuid", null);
|
||||||
setRequestedOrientation(initialOrientation);
|
setRequestedOrientationCustom(initialOrientation);
|
||||||
if (comments != null && comments.size() > 0) {
|
if (comments != null && comments.size() > 0) {
|
||||||
int number = comments.size();
|
int number = comments.size();
|
||||||
comments.clear();
|
comments.clear();
|
||||||
|
@ -1215,7 +1215,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||||
binding.videoContainer.setLayoutParams(param);
|
binding.videoContainer.setLayoutParams(param);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//change();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1301,6 +1300,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||||
private void enterVideoMode() {
|
private void enterVideoMode() {
|
||||||
if (playInMinimized && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && player != null) {
|
if (playInMinimized && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && player != null) {
|
||||||
isPlayInMinimized = true;
|
isPlayInMinimized = true;
|
||||||
|
setRequestedOrientationCustom(initialOrientation);
|
||||||
MediaSessionCompat mediaSession = new MediaSessionCompat(this, getPackageName());
|
MediaSessionCompat mediaSession = new MediaSessionCompat(this, getPackageName());
|
||||||
MediaSessionConnector mediaSessionConnector = new MediaSessionConnector(mediaSession);
|
MediaSessionConnector mediaSessionConnector = new MediaSessionConnector(mediaSession);
|
||||||
mediaSessionConnector.setPlayer(player);
|
mediaSessionConnector.setPlayer(player);
|
||||||
|
@ -1332,6 +1332,12 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||||
closeCommentThread();
|
closeCommentThread();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fullScreenMode && player != null && player.isPlaying()) {
|
||||||
|
player.setPlayWhenReady(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (playInMinimized && player != null) {
|
if (playInMinimized && player != null) {
|
||||||
enterVideoMode();
|
enterVideoMode();
|
||||||
} else {
|
} else {
|
||||||
|
@ -1359,9 +1365,13 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||||
binding.bottomVideo.setVisibility(View.GONE);
|
binding.bottomVideo.setVisibility(View.GONE);
|
||||||
Objects.requireNonNull(getSupportActionBar()).hide();
|
Objects.requireNonNull(getSupportActionBar()).hide();
|
||||||
if (videoOrientationType == videoOrientation.LANDSCAPE) {
|
if (videoOrientationType == videoOrientation.LANDSCAPE) {
|
||||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
if (getResources().getConfiguration().orientation != ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
|
||||||
|
setRequestedOrientationCustom(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
if (getResources().getConfiguration().orientation != ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
|
||||||
|
setRequestedOrientationCustom(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,
|
getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,
|
||||||
|
@ -1850,10 +1860,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||||
openFullscreenDialog();
|
openFullscreenDialog();
|
||||||
} else {
|
} else {
|
||||||
closeFullscreenDialog();
|
closeFullscreenDialog();
|
||||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
setRequestedOrientationCustom(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
Handler handler = new Handler();
|
|
||||||
handler.postDelayed(() -> setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR), 2000);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1877,6 +1884,12 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setRequestedOrientationCustom(int orientationCustom) {
|
||||||
|
setRequestedOrientation(orientationCustom);
|
||||||
|
Handler handler = new Handler();
|
||||||
|
handler.postDelayed(() -> setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR), 2000);
|
||||||
|
}
|
||||||
|
|
||||||
private void initResolution() {
|
private void initResolution() {
|
||||||
PlayerControlView controlView = binding.doubleTapPlayerView.findViewById(R.id.exo_controller);
|
PlayerControlView controlView = binding.doubleTapPlayerView.findViewById(R.id.exo_controller);
|
||||||
TextView resolution = controlView.findViewById(R.id.resolution);
|
TextView resolution = controlView.findViewById(R.id.resolution);
|
||||||
|
|
Loading…
Reference in New Issue