Commiting stuff the IDE did not
This commit is contained in:
parent
73a3de5eb8
commit
ff7138bf9d
52 changed files with 3887 additions and 3887 deletions
|
|
@ -1,123 +1,123 @@
|
|||
package com.ericsson.uecontrol.gui;
|
||||
|
||||
import android.app.ActionBar;
|
||||
import android.app.FragmentManager;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import com.ericsson.uecontrol.R;
|
||||
import com.ericsson.uecontrol.core.UeControlExecutor;
|
||||
import com.ericsson.uecontrol.core.behaviour.UeBehaviourFtp;
|
||||
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;
|
||||
|
||||
|
||||
public class MainActivity extends FragmentActivity {
|
||||
|
||||
/**
|
||||
* Fragment managing the behaviors, interactions and presentation of the navigation drawer.
|
||||
*/
|
||||
private NavigationDrawerFragment navigationDrawerFragment;
|
||||
private StatusFragment statusFragment;
|
||||
|
||||
private static UeControlExecutor currentExecutor;
|
||||
private static CSVWriter logger;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
//navigationDrawerFragment = (NavigationDrawerFragment)
|
||||
// getFragmentManager().findFragmentById(R.id.navigation_drawer);
|
||||
statusFragment = (StatusFragment)
|
||||
getFragmentManager().findFragmentById(R.id.status_fragment);
|
||||
getFragmentManager().beginTransaction()
|
||||
.replace(R.id.container, BehaviourListFragment.newInstance()).commit();
|
||||
|
||||
// Set up the drawer.
|
||||
//navigationDrawerFragment.setUp(
|
||||
// R.id.navigation_drawer,
|
||||
// (DrawerLayout) findViewById(R.id.drawer_layout));
|
||||
|
||||
currentExecutor = new UeControlExecutor();
|
||||
currentExecutor.addBehaviour(new UeBehaviourSleep());
|
||||
currentExecutor.addBehaviour(new UeBehaviourSurfing());
|
||||
currentExecutor.addBehaviour(new UeBehaviourSleep(4000));
|
||||
currentExecutor.setThroughputListener(statusFragment.getThroughputListener());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
if (navigationDrawerFragment == null || !navigationDrawerFragment.isDrawerOpen()) {
|
||||
// Only show items in the action bar relevant to this screen
|
||||
// if the drawer is not showing. Otherwise, let the drawer
|
||||
// decide what to show in the action bar.
|
||||
getMenuInflater().inflate(R.menu.main, menu);
|
||||
|
||||
ActionBar actionBar = getActionBar();
|
||||
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
|
||||
actionBar.setDisplayShowTitleEnabled(true);
|
||||
|
||||
return true;
|
||||
}
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle action bar item clicks here. The action bar will
|
||||
// automatically handle clicks on the Home/Up button, so long
|
||||
// as you specify a parent activity in AndroidManifest.xml.
|
||||
int id = item.getItemId();
|
||||
if (id == R.id.action_execute) {
|
||||
if(currentExecutor.isRunning()){
|
||||
currentExecutor.terminate();
|
||||
item.setTitle(R.string.action_run);
|
||||
}
|
||||
else {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
if(prefs.getBoolean("logging", false))
|
||||
logger = new CSVWriter(this);
|
||||
else
|
||||
logger = null;
|
||||
currentExecutor.execute();
|
||||
item.setTitle(R.string.action_stop);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (id == R.id.action_edit) {
|
||||
Intent intent = new Intent(this, EditActivity.class);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
if (id == R.id.action_settings) {
|
||||
startActivity(new Intent(this, SettingsActivity.class));
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
public static UeControlExecutor getExecutor() {
|
||||
return currentExecutor;
|
||||
}
|
||||
|
||||
public static void logThroughput(double downThroughput, double upThroughput) {
|
||||
if(logger == null || currentExecutor == null || currentExecutor.getRunningBehaviour() == null)
|
||||
return;
|
||||
|
||||
logger.write(currentExecutor.getRunningBehaviour().getName(), downThroughput, upThroughput);
|
||||
}
|
||||
}
|
||||
package com.ericsson.uecontrol.gui;
|
||||
|
||||
import android.app.ActionBar;
|
||||
import android.app.FragmentManager;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import com.ericsson.uecontrol.R;
|
||||
import com.ericsson.uecontrol.core.UeControlExecutor;
|
||||
import com.ericsson.uecontrol.core.behaviour.UeBehaviourFtp;
|
||||
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;
|
||||
|
||||
|
||||
public class MainActivity extends FragmentActivity {
|
||||
|
||||
/**
|
||||
* Fragment managing the behaviors, interactions and presentation of the navigation drawer.
|
||||
*/
|
||||
private NavigationDrawerFragment navigationDrawerFragment;
|
||||
private StatusFragment statusFragment;
|
||||
|
||||
private static UeControlExecutor currentExecutor;
|
||||
private static CSVWriter logger;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
//navigationDrawerFragment = (NavigationDrawerFragment)
|
||||
// getFragmentManager().findFragmentById(R.id.navigation_drawer);
|
||||
statusFragment = (StatusFragment)
|
||||
getFragmentManager().findFragmentById(R.id.status_fragment);
|
||||
getFragmentManager().beginTransaction()
|
||||
.replace(R.id.container, BehaviourListFragment.newInstance()).commit();
|
||||
|
||||
// Set up the drawer.
|
||||
//navigationDrawerFragment.setUp(
|
||||
// R.id.navigation_drawer,
|
||||
// (DrawerLayout) findViewById(R.id.drawer_layout));
|
||||
|
||||
currentExecutor = new UeControlExecutor();
|
||||
currentExecutor.addBehaviour(new UeBehaviourSleep());
|
||||
currentExecutor.addBehaviour(new UeBehaviourSurfing());
|
||||
currentExecutor.addBehaviour(new UeBehaviourSleep(4000));
|
||||
currentExecutor.setThroughputListener(statusFragment.getThroughputListener());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
if (navigationDrawerFragment == null || !navigationDrawerFragment.isDrawerOpen()) {
|
||||
// Only show items in the action bar relevant to this screen
|
||||
// if the drawer is not showing. Otherwise, let the drawer
|
||||
// decide what to show in the action bar.
|
||||
getMenuInflater().inflate(R.menu.main, menu);
|
||||
|
||||
ActionBar actionBar = getActionBar();
|
||||
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
|
||||
actionBar.setDisplayShowTitleEnabled(true);
|
||||
|
||||
return true;
|
||||
}
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle action bar item clicks here. The action bar will
|
||||
// automatically handle clicks on the Home/Up button, so long
|
||||
// as you specify a parent activity in AndroidManifest.xml.
|
||||
int id = item.getItemId();
|
||||
if (id == R.id.action_execute) {
|
||||
if(currentExecutor.isRunning()){
|
||||
currentExecutor.terminate();
|
||||
item.setTitle(R.string.action_run);
|
||||
}
|
||||
else {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
if(prefs.getBoolean("logging", false))
|
||||
logger = new CSVWriter(this);
|
||||
else
|
||||
logger = null;
|
||||
currentExecutor.execute();
|
||||
item.setTitle(R.string.action_stop);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (id == R.id.action_edit) {
|
||||
Intent intent = new Intent(this, EditActivity.class);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
if (id == R.id.action_settings) {
|
||||
startActivity(new Intent(this, SettingsActivity.class));
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
public static UeControlExecutor getExecutor() {
|
||||
return currentExecutor;
|
||||
}
|
||||
|
||||
public static void logThroughput(double downThroughput, double upThroughput) {
|
||||
if(logger == null || currentExecutor == null || currentExecutor.getRunningBehaviour() == null)
|
||||
return;
|
||||
|
||||
logger.write(currentExecutor.getRunningBehaviour().getName(), downThroughput, upThroughput);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue