Как я понял, вам нужен метод stati c с таким кодом:
imageView1.setImageDrawable(ContextCompat.getDrawable(VideoPlayerActivity.this, R.drawable.ic_fullscreen_open));
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
if(getSupportActionBar() != null){
getSupportActionBar().show();
}
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) playerView.getLayoutParams();
params.width = params.MATCH_PARENT;
params.height = params.MATCH_PARENT;
playerView.setLayoutParams(params);
fullscreen = false;
Итак, вот ваш последний код:
FullScreenActitvity. java
static boolean method(ImageView imageView1, View playerView, Context context) {
imageView1.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_fullscreen_open));
((Activity) context).getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
if(getSupportActionBar() != null){
((AppCompatActivity) context).getSupportActionBar().show();
}
((Activity) context).setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) playerView.getLayoutParams();
params.width = params.MATCH_PARENT;
params.height = params.MATCH_PARENT;
playerView.setLayoutParams(params);
return false;
}
imageView1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(fullscreen) {
fullscreen = FullScreenActitvity.method(imageView1, playerView, VideoPlayerActivity.this);
}else{
imageView1.setImageDrawable(ContextCompat.getDrawable(VideoPlayerActivity.this, R.drawable.ic_fullscreen_close));
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN
|View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
|View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
if(getSupportActionBar() != null){
getSupportActionBar().hide();
}
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) playerView.getLayoutParams();
params.width = params.MATCH_PARENT;
params.height = params.MATCH_PARENT;
playerView.setLayoutParams(params);
fullscreen = true;
}
}
});