mirror of
https://github.com/SimpleMobileTools/Simple-Flashlight.git
synced 2025-02-16 20:00:40 +01:00
make sure the device doesnt fall asleep while the flashlight is on
- does not work with the widget, only with the app itself
This commit is contained in:
parent
a4683d5417
commit
7e90b6c8c7
@ -3,6 +3,7 @@ package flashlight.simplemobiletools.com;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Toast;
|
||||
|
||||
@ -61,11 +62,13 @@ public class MainActivity extends AppCompatActivity implements MyCamera {
|
||||
@Override
|
||||
public void enableFlashlight() {
|
||||
toggleBtn.setImageResource(R.mipmap.flashlight_big_on);
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableFlashlight() {
|
||||
toggleBtn.setImageResource(R.mipmap.flashlight_big_off);
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user