Added Keep screen on function
This commit is contained in:
parent
a031b1c2d9
commit
313056da11
3 changed files with 17 additions and 2 deletions
|
|
@ -13,6 +13,7 @@ import android.preference.PreferenceManager;
|
|||
import android.support.v4.app.FragmentActivity;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.ericsson.uecontrol.R;
|
||||
|
|
@ -187,11 +188,17 @@ public class MainActivity extends FragmentActivity implements OnSharedPreference
|
|||
}
|
||||
|
||||
private void updateExecutionState(){
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
if(action_execute != null) {
|
||||
if (currentExecutor.isRunning())
|
||||
if (currentExecutor.isRunning()) {
|
||||
action_execute.setTitle(R.string.action_stop);
|
||||
else
|
||||
if(prefs.getBoolean("screen_on", false))
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
}
|
||||
else {
|
||||
action_execute.setTitle(R.string.action_run);
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue