keep screen on when in fullscreen mode

This commit is contained in:
Tuan Luong 2021-06-13 12:06:37 +07:00
parent c89649b513
commit d094886087

View File

@ -4,6 +4,7 @@ import android.content.pm.ActivityInfo;
import android.os.Bundle; import android.os.Bundle;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.View; import android.view.View;
import android.view.WindowManager;
import android.widget.ImageView; import android.widget.ImageView;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
@ -24,6 +25,8 @@ public class ExoPlayerFullscreenVideoActivity extends AppCompatActivity implemen
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
id = getIntent().getIntExtra(EXTRA_ID, -1); id = getIntent().getIntExtra(EXTRA_ID, -1);
String orientation = getIntent().getStringExtra(EXTRA_ORIENTATION); String orientation = getIntent().getStringExtra(EXTRA_ORIENTATION);
if ("landscape".equals(orientation)) { if ("landscape".equals(orientation)) {