Automatically switch into full screen when changing orientation #698

This commit is contained in:
stom79 2019-01-05 09:44:45 +01:00
parent 577e5b3067
commit c39cff7e27
2 changed files with 15 additions and 1 deletions

View File

@ -22,6 +22,7 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.drawable.Drawable;
import android.media.MediaPlayer;
@ -455,6 +456,19 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
});
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
setFullscreen(FullScreenMediaController.fullscreen.ON);
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT){
setFullscreen(FullScreenMediaController.fullscreen.OFF);
}
change();
fullScreenMediaController.changeIcon();
}
@Override
public void onRetrievePeertubeComments(APIResponse apiResponse) {
if( apiResponse == null || (apiResponse.getError() != null && apiResponse.getError().getStatusCode() != 404) ){

View File

@ -122,7 +122,7 @@ public class FullScreenMediaController extends MediaController {
resolution.setText(String.format("%sp",resolutionVal));
}
private void changeIcon(){
public void changeIcon(){
//fullscreen indicator from intent
if(((PeertubeActivity)getContext()).getFullscreen() == fullscreen.ON){
Resources resources = getResources();