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.support.v4.app.FragmentActivity;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
import android.view.WindowManager;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.ericsson.uecontrol.R;
|
import com.ericsson.uecontrol.R;
|
||||||
|
|
@ -187,11 +188,17 @@ public class MainActivity extends FragmentActivity implements OnSharedPreference
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateExecutionState(){
|
private void updateExecutionState(){
|
||||||
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
if(action_execute != null) {
|
if(action_execute != null) {
|
||||||
if (currentExecutor.isRunning())
|
if (currentExecutor.isRunning()) {
|
||||||
action_execute.setTitle(R.string.action_stop);
|
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);
|
action_execute.setTitle(R.string.action_run);
|
||||||
|
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,5 +29,7 @@
|
||||||
<string name="pref_debug">Debug Logging</string>
|
<string name="pref_debug">Debug Logging</string>
|
||||||
<string name="pref_debug_summ">Enable application debug logging</string>
|
<string name="pref_debug_summ">Enable application debug logging</string>
|
||||||
<string name="action_reset">Reset</string>
|
<string name="action_reset">Reset</string>
|
||||||
|
<string name="pref_screen_on_summ">Keep screen on while execution</string>
|
||||||
|
<string name="pref_screen_on">Keep Screen On</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,12 @@
|
||||||
android:title="@string/pref_logging_path"
|
android:title="@string/pref_logging_path"
|
||||||
android:summary="@string/pref_logging_path_summ"
|
android:summary="@string/pref_logging_path_summ"
|
||||||
android:defaultValue="/sdcard/uecontrol/" />
|
android:defaultValue="/sdcard/uecontrol/" />
|
||||||
|
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:key="screen_on"
|
||||||
|
android:title="@string/pref_screen_on"
|
||||||
|
android:summary="@string/pref_screen_on_summ"
|
||||||
|
android:defaultValue="false" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue