fix #31, never allow phone sleep while on the main screen

This commit is contained in:
tibbi 2016-11-15 22:23:03 +01:00
parent c8266491be
commit 0dab91be56
1 changed files with 2 additions and 0 deletions

View File

@ -549,6 +549,7 @@ public class MainActivity extends SimpleActivity
checkButtons(); checkButtons();
} }
} }
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
} }
private void resumeCameraItems() { private void resumeCameraItems() {
@ -577,6 +578,7 @@ public class MainActivity extends SimpleActivity
@Override @Override
protected void onPause() { protected void onPause() {
super.onPause(); super.onPause();
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
if (!hasCameraAndStoragePermission() || mIsAskingPermissions) if (!hasCameraAndStoragePermission() || mIsAskingPermissions)
return; return;