diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 055eca5..6a6f248 100755 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -7,6 +7,7 @@ android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/AppTheme" > + @@ -15,6 +16,17 @@ + + + + + + + @@ -22,14 +34,12 @@ android:name="android.support.PARENT_ACTIVITY" android:value=".gui.MainActivity" /> - - + + fileList = new ArrayList(); + for(File file : logPath.listFiles()){ + if(file.getName().endsWith(".csv")) + fileList.add(file); + } + Collections.sort(fileList, Collections.reverseOrder()); + + HistoryListAdapter adapter = new HistoryListAdapter(this, fileList); + // Set the adapter + ListView listView = (ListView) this.findViewById(android.R.id.list); + listView.setAdapter(adapter); + } + + + /** + * Created by ezivkoc on 2014-07-15. + */ + public class HistoryListAdapter extends ArrayAdapter { + private static final int VIEW_RESOURCE = R.layout.list_history_item; + + + public HistoryListAdapter(Activity a, List fileList) { + super(a, VIEW_RESOURCE, fileList); + } + + + public View getView(int position, View convertView, ViewGroup parent) { + View view = convertView; + if(convertView==null) { + LayoutInflater inflater = (LayoutInflater) HistoryActivity.this + .getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view = inflater.inflate(VIEW_RESOURCE, parent, false); + } + File csvFile = super.getItem(position); + + TextView fileNameView = (TextView)view.findViewById(R.id.file_name); + fileNameView.setText(csvFile.getName()); + + LineGraphView graphView = new LineGraphView(this.getContext(), "HistoryView"); + graphView.setLayoutParams(new LinearLayout.LayoutParams( + LinearLayout.LayoutParams.MATCH_PARENT, + LinearLayout.LayoutParams.MATCH_PARENT)); + graphView.getGraphViewStyle().setGridStyle(GraphViewStyle.GridStyle.BOTH); + graphView.addSeries(new GraphViewSeries("Download Throughput", new GraphViewSeries.GraphViewSeriesStyle(Color.GREEN, 3), + new GraphView.GraphViewData[]{new GraphView.GraphViewData(0, 0)})); + graphView.addSeries(new GraphViewSeries("Upload Throughput", new GraphViewSeries.GraphViewSeriesStyle(Color.RED, 3), + new GraphView.GraphViewData[]{new GraphView.GraphViewData(0, 0)})); + graphView.setShowVerticalLabels(false); + graphView.setShowHorizontalLabels(false); + graphView.setDisableTouch(true); + LinearLayout graphLayout = (LinearLayout)view.findViewById(R.id.graph); + graphLayout.addView(graphView); + + + return view; + } + } + +} diff --git a/app/src/main/java/com/ericsson/uecontrol/gui/MainActivity.java b/app/src/main/java/com/ericsson/uecontrol/gui/MainActivity.java index 1a84b82..55be440 100755 --- a/app/src/main/java/com/ericsson/uecontrol/gui/MainActivity.java +++ b/app/src/main/java/com/ericsson/uecontrol/gui/MainActivity.java @@ -188,8 +188,7 @@ public class MainActivity extends FragmentActivity implements OnSharedPreference else { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); if(prefs.getBoolean("logging", false)) - executor.setLogPath(prefs.getString("logging_path", - Environment.getExternalStorageDirectory().getAbsolutePath()+"/uecontrol/")); + executor.setLogPath(prefs.getString("logging_path", DEFAULT_LOG_PATH)); else executor.setLogPath(null); executor.execute(); @@ -233,6 +232,10 @@ public class MainActivity extends FragmentActivity implements OnSharedPreference "/sdcard", FileBrowserDialog.BrowserMode.NEW_FILE); browser.show(this.getFragmentManager(), "export"); } + else if (id == R.id.action_history) { + startActivity(new Intent(this, HistoryActivity.class)); + return true; + } else if (id == R.id.action_settings) { startActivity(new Intent(this, SettingsActivity.class)); return true; diff --git a/app/src/main/java/com/ericsson/uecontrol/gui/fragments/BehaviourListFragment.java b/app/src/main/java/com/ericsson/uecontrol/gui/fragments/BehaviourListFragment.java index 36cee3a..76b441b 100755 --- a/app/src/main/java/com/ericsson/uecontrol/gui/fragments/BehaviourListFragment.java +++ b/app/src/main/java/com/ericsson/uecontrol/gui/fragments/BehaviourListFragment.java @@ -48,7 +48,7 @@ public class BehaviourListFragment extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.fragment_item, container, false); + View view = inflater.inflate(R.layout.fragment_list, container, false); // Set the adapter listView = (AdapterView) view.findViewById(android.R.id.list); diff --git a/app/src/main/java/com/ericsson/uecontrol/gui/fragments/StatusFragment.java b/app/src/main/java/com/ericsson/uecontrol/gui/fragments/StatusFragment.java index 6b6b796..f4a182b 100755 --- a/app/src/main/java/com/ericsson/uecontrol/gui/fragments/StatusFragment.java +++ b/app/src/main/java/com/ericsson/uecontrol/gui/fragments/StatusFragment.java @@ -69,12 +69,11 @@ public class StatusFragment extends Fragment { new GraphViewData[]{new GraphViewData(0, 0)}); graphView = new LineGraphView(this.getActivity(), "GraphView"); + graphView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); graphView.addSeries(downGraph); graphView.addSeries(upGraph); - graphView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); graphView.getGraphViewStyle().setGridStyle(GraphViewStyle.GridStyle.BOTH); graphView.setShowVerticalLabels(false); - //graphView.setDrawDataPoints(true); updateGraphLength(); graphView.setViewPort(0, length); graphView.setScrollable(true); diff --git a/app/src/main/java/com/ericsson/uecontrol/gui/util/BehaviourListAdapter.java b/app/src/main/java/com/ericsson/uecontrol/gui/util/BehaviourListAdapter.java index e0149f4..1cb124f 100755 --- a/app/src/main/java/com/ericsson/uecontrol/gui/util/BehaviourListAdapter.java +++ b/app/src/main/java/com/ericsson/uecontrol/gui/util/BehaviourListAdapter.java @@ -19,7 +19,7 @@ import java.util.List; * Created by ezivkoc on 2014-07-15. */ public class BehaviourListAdapter extends StableArrayAdapter{ - private static final int VIEW_RESOURCE = R.layout.behaviour_list_item; + private static final int VIEW_RESOURCE = R.layout.list_behaviour_item; private static LayoutInflater inflater = null; diff --git a/app/src/main/res/layout/activity_history.xml b/app/src/main/res/layout/activity_history.xml new file mode 100755 index 0000000..759dab0 --- /dev/null +++ b/app/src/main/res/layout/activity_history.xml @@ -0,0 +1,25 @@ + + + + + + + diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 25ff25c..fd188f5 100755 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -25,7 +25,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:name="com.ericsson.uecontrol.gui.fragments.BehaviourListFragment" - tools:layout="@layout/fragment_item" /> + tools:layout="@layout/fragment_list" /> diff --git a/app/src/main/res/layout/fragment_list.xml b/app/src/main/res/layout/fragment_list.xml index 76c0d0e..12d4806 100755 --- a/app/src/main/res/layout/fragment_list.xml +++ b/app/src/main/res/layout/fragment_list.xml @@ -8,7 +8,8 @@ + android:layout_height="match_parent" + tools:listitem="@layout/list_behaviour_item" /> @@ -72,6 +71,11 @@ android:text="n/a" android:id="@+id/rat_type" /> + diff --git a/app/src/main/res/layout/behaviour_list_item.xml b/app/src/main/res/layout/list_behaviour_item.xml similarity index 97% rename from app/src/main/res/layout/behaviour_list_item.xml rename to app/src/main/res/layout/list_behaviour_item.xml index 6125154..eb50db5 100755 --- a/app/src/main/res/layout/behaviour_list_item.xml +++ b/app/src/main/res/layout/list_behaviour_item.xml @@ -1,93 +1,93 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/list_history_item.xml b/app/src/main/res/layout/list_history_item.xml new file mode 100755 index 0000000..0befde1 --- /dev/null +++ b/app/src/main/res/layout/list_history_item.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/menu/main.xml b/app/src/main/res/menu/main.xml index 1888522..faf243c 100755 --- a/app/src/main/res/menu/main.xml +++ b/app/src/main/res/menu/main.xml @@ -30,8 +30,14 @@ android:showAsAction="never" android:enabled="true" /> + + diff --git a/app/src/main/res/values/refs.xml b/app/src/main/res/values/refs.xml deleted file mode 100755 index ee7a684..0000000 --- a/app/src/main/res/values/refs.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - @layout/fragment_list - - \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9bbac11..f1a96a7 100755 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -40,6 +40,8 @@ Join the Google+ group to get access to the beta releases of the app. Throughput Averaging Frequency Frequency per second(Will also impact csv logging frequency) + History + Execution History