Added marking log ability.
This commit is contained in:
parent
c1b2da18d5
commit
bd82634b6b
4 changed files with 30 additions and 5 deletions
|
|
@ -5,8 +5,6 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.preference.PreferenceManager;
|
||||
|
|
@ -21,7 +19,6 @@ import com.ericsson.uecontrol.core.UeControlExecutor;
|
|||
import com.ericsson.uecontrol.core.behaviour.UeBehaviourSleep;
|
||||
import com.ericsson.uecontrol.core.behaviour.UeBehaviourSurfing;
|
||||
import com.ericsson.uecontrol.gui.fragments.BehaviourListFragment;
|
||||
import com.ericsson.uecontrol.gui.fragments.NavigationDrawerFragment;
|
||||
import com.ericsson.uecontrol.gui.fragments.StatusFragment;
|
||||
import com.ericsson.uecontrol.gui.util.CSVWriter;
|
||||
|
||||
|
|
@ -42,6 +39,7 @@ public class MainActivity extends FragmentActivity implements OnSharedPreference
|
|||
/** Fragments **/
|
||||
private StatusFragment statusFragment;
|
||||
private MenuItem action_execute;
|
||||
private MenuItem action_mark;
|
||||
private boolean backButtonPressed = false;
|
||||
|
||||
private static UeControlExecutor currentExecutor;
|
||||
|
|
@ -54,6 +52,7 @@ public class MainActivity extends FragmentActivity implements OnSharedPreference
|
|||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
// Set static fields
|
||||
PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
|
||||
uid = getApplicationInfo().uid;
|
||||
context = this;
|
||||
|
||||
|
|
@ -139,6 +138,7 @@ public class MainActivity extends FragmentActivity implements OnSharedPreference
|
|||
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
|
||||
actionBar.setDisplayShowTitleEnabled(true);
|
||||
action_execute = (MenuItem) menu.findItem(R.id.action_execute);
|
||||
action_mark = (MenuItem) menu.findItem(R.id.action_mark);
|
||||
updateExecutionState();
|
||||
|
||||
return true;
|
||||
|
|
@ -167,11 +167,18 @@ public class MainActivity extends FragmentActivity implements OnSharedPreference
|
|||
updateExecutionState();
|
||||
return true;
|
||||
}
|
||||
else if (id == R.id.action_mark) {
|
||||
if(csvLogger != null) {
|
||||
csvLogger.addComment("--- Mark ---");
|
||||
Toast.makeText(this, "Mark added to log", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
else if (id == R.id.action_reset) {
|
||||
if(currentExecutor != null)
|
||||
currentExecutor.reset();
|
||||
if(statusFragment != null)
|
||||
statusFragment.reset();
|
||||
csvLogger = null;
|
||||
updateExecutionState();
|
||||
}
|
||||
else if (id == R.id.action_edit) {
|
||||
|
|
@ -195,11 +202,14 @@ public class MainActivity extends FragmentActivity implements OnSharedPreference
|
|||
if(action_execute != null) {
|
||||
if (currentExecutor.isRunning()) {
|
||||
action_execute.setTitle(R.string.action_stop);
|
||||
if(action_mark != null && csvLogger != null)
|
||||
action_mark.setEnabled(true);
|
||||
if(prefs.getBoolean("screen_on", false))
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
}
|
||||
else {
|
||||
action_execute.setTitle(R.string.action_run);
|
||||
action_mark.setEnabled(false);
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue