Initial implementation of a history view, no parsing of csv file yet
This commit is contained in:
parent
5172a268ad
commit
b3d75b9ad9
15 changed files with 281 additions and 118 deletions
|
|
@ -7,6 +7,7 @@
|
||||||
android:icon="@drawable/icon"
|
android:icon="@drawable/icon"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@style/AppTheme" >
|
android:theme="@style/AppTheme" >
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".gui.MainActivity"
|
android:name=".gui.MainActivity"
|
||||||
android:label="@string/app_name" >
|
android:label="@string/app_name" >
|
||||||
|
|
@ -15,6 +16,17 @@
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".gui.EditActivity"
|
||||||
|
android:label="@string/title_activity_edit" >
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".gui.HistoryActivity"
|
||||||
|
android:label="@string/title_activity_history" >
|
||||||
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".gui.SettingsActivity"
|
android:name=".gui.SettingsActivity"
|
||||||
android:label="@string/app_name" >
|
android:label="@string/app_name" >
|
||||||
|
|
@ -22,14 +34,12 @@
|
||||||
android:name="android.support.PARENT_ACTIVITY"
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
android:value=".gui.MainActivity" />
|
android:value=".gui.MainActivity" />
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
|
||||||
android:name=".gui.EditActivity"
|
|
||||||
android:label="@string/title_activity_edit" >
|
|
||||||
</activity>
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".gui.AboutActivity"
|
android:name=".gui.AboutActivity"
|
||||||
android:label="@string/title_activity_about" >
|
android:label="@string/title_activity_about" >
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="15"
|
<uses-sdk android:minSdkVersion="15"
|
||||||
|
|
|
||||||
100
app/src/main/java/com/ericsson/uecontrol/gui/HistoryActivity.java
Executable file
100
app/src/main/java/com/ericsson/uecontrol/gui/HistoryActivity.java
Executable file
|
|
@ -0,0 +1,100 @@
|
||||||
|
package com.ericsson.uecontrol.gui;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.ListActivity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
|
import android.view.*;
|
||||||
|
import android.widget.*;
|
||||||
|
import com.ericsson.uecontrol.R;
|
||||||
|
import com.jjoe64.graphview.GraphView;
|
||||||
|
import com.jjoe64.graphview.GraphViewSeries;
|
||||||
|
import com.jjoe64.graphview.GraphViewStyle;
|
||||||
|
import com.jjoe64.graphview.LineGraphView;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class HistoryActivity extends ListActivity {
|
||||||
|
private static final Logger log = Logger.getLogger(HistoryActivity.class);
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_history);
|
||||||
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
|
||||||
|
TextView warning = (TextView)this.findViewById(R.id.warning);
|
||||||
|
if(!prefs.getBoolean("logging", false))
|
||||||
|
warning.setVisibility(View.VISIBLE);
|
||||||
|
else
|
||||||
|
warning.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
String strPath = prefs.getString("logging_path", MainActivity.DEFAULT_LOG_PATH);
|
||||||
|
File logPath = new File(strPath);
|
||||||
|
List<File> fileList = new ArrayList<File>();
|
||||||
|
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<File> {
|
||||||
|
private static final int VIEW_RESOURCE = R.layout.list_history_item;
|
||||||
|
|
||||||
|
|
||||||
|
public HistoryListAdapter(Activity a, List<File> 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -188,8 +188,7 @@ public class MainActivity extends FragmentActivity implements OnSharedPreference
|
||||||
else {
|
else {
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
if(prefs.getBoolean("logging", false))
|
if(prefs.getBoolean("logging", false))
|
||||||
executor.setLogPath(prefs.getString("logging_path",
|
executor.setLogPath(prefs.getString("logging_path", DEFAULT_LOG_PATH));
|
||||||
Environment.getExternalStorageDirectory().getAbsolutePath()+"/uecontrol/"));
|
|
||||||
else
|
else
|
||||||
executor.setLogPath(null);
|
executor.setLogPath(null);
|
||||||
executor.execute();
|
executor.execute();
|
||||||
|
|
@ -233,6 +232,10 @@ public class MainActivity extends FragmentActivity implements OnSharedPreference
|
||||||
"/sdcard", FileBrowserDialog.BrowserMode.NEW_FILE);
|
"/sdcard", FileBrowserDialog.BrowserMode.NEW_FILE);
|
||||||
browser.show(this.getFragmentManager(), "export");
|
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) {
|
else if (id == R.id.action_settings) {
|
||||||
startActivity(new Intent(this, SettingsActivity.class));
|
startActivity(new Intent(this, SettingsActivity.class));
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ public class BehaviourListFragment extends Fragment {
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
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
|
// Set the adapter
|
||||||
listView = (AdapterView) view.findViewById(android.R.id.list);
|
listView = (AdapterView) view.findViewById(android.R.id.list);
|
||||||
|
|
|
||||||
|
|
@ -69,12 +69,11 @@ public class StatusFragment extends Fragment {
|
||||||
new GraphViewData[]{new GraphViewData(0, 0)});
|
new GraphViewData[]{new GraphViewData(0, 0)});
|
||||||
|
|
||||||
graphView = new LineGraphView(this.getActivity(), "GraphView");
|
graphView = new LineGraphView(this.getActivity(), "GraphView");
|
||||||
|
graphView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
|
||||||
graphView.addSeries(downGraph);
|
graphView.addSeries(downGraph);
|
||||||
graphView.addSeries(upGraph);
|
graphView.addSeries(upGraph);
|
||||||
graphView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
|
|
||||||
graphView.getGraphViewStyle().setGridStyle(GraphViewStyle.GridStyle.BOTH);
|
graphView.getGraphViewStyle().setGridStyle(GraphViewStyle.GridStyle.BOTH);
|
||||||
graphView.setShowVerticalLabels(false);
|
graphView.setShowVerticalLabels(false);
|
||||||
//graphView.setDrawDataPoints(true);
|
|
||||||
updateGraphLength();
|
updateGraphLength();
|
||||||
graphView.setViewPort(0, length);
|
graphView.setViewPort(0, length);
|
||||||
graphView.setScrollable(true);
|
graphView.setScrollable(true);
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ import java.util.List;
|
||||||
* Created by ezivkoc on 2014-07-15.
|
* Created by ezivkoc on 2014-07-15.
|
||||||
*/
|
*/
|
||||||
public class BehaviourListAdapter extends StableArrayAdapter<UeBehaviour>{
|
public class BehaviourListAdapter extends StableArrayAdapter<UeBehaviour>{
|
||||||
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;
|
private static LayoutInflater inflater = null;
|
||||||
|
|
||||||
|
|
|
||||||
25
app/src/main/res/layout/activity_history.xml
Executable file
25
app/src/main/res/layout/activity_history.xml
Executable file
|
|
@ -0,0 +1,25 @@
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
tools:context="com.ericsson.uecontrol.gui.HistoryActivity">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/warning"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
|
android:text="CSV Logging is not enabled"
|
||||||
|
android:background="#ff0000"
|
||||||
|
android:gravity="center"
|
||||||
|
android:paddingTop="5dp"
|
||||||
|
android:paddingBottom="5dp" />
|
||||||
|
|
||||||
|
<ListView
|
||||||
|
android:id="@android:id/list"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:listitem="@layout/list_history_item" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:name="com.ericsson.uecontrol.gui.fragments.BehaviourListFragment"
|
android:name="com.ericsson.uecontrol.gui.fragments.BehaviourListFragment"
|
||||||
tools:layout="@layout/fragment_item" />
|
tools:layout="@layout/fragment_list" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,8 @@
|
||||||
<ListView
|
<ListView
|
||||||
android:id="@android:id/list"
|
android:id="@android:id/list"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent"
|
||||||
|
tools:listitem="@layout/list_behaviour_item" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@android:id/empty"
|
android:id="@android:id/empty"
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,6 @@
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/graph"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="horizontal" >
|
android:orientation="horizontal" >
|
||||||
|
|
@ -72,6 +71,11 @@
|
||||||
android:text="n/a"
|
android:text="n/a"
|
||||||
android:id="@+id/rat_type" />
|
android:id="@+id/rat_type" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/graph"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="horizontal" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
25
app/src/main/res/layout/list_history_item.xml
Executable file
25
app/src/main/res/layout/list_history_item.xml
Executable file
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="100dp"
|
||||||
|
android:background="#ff000000">
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/graph"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:id="@+id/file_name"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:textColor="#ffffffff"
|
||||||
|
android:text="filename.csv"/>
|
||||||
|
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
@ -30,8 +30,14 @@
|
||||||
android:showAsAction="never"
|
android:showAsAction="never"
|
||||||
android:enabled="true" />
|
android:enabled="true" />
|
||||||
|
|
||||||
|
<item android:id="@+id/action_history"
|
||||||
|
android:title="@string/action_history"
|
||||||
|
android:orderInCategory="200"
|
||||||
|
android:showAsAction="never"
|
||||||
|
android:enabled="true" />
|
||||||
|
|
||||||
<item android:id="@+id/action_settings"
|
<item android:id="@+id/action_settings"
|
||||||
android:title="@string/action_settings"
|
android:title="@string/action_settings"
|
||||||
android:orderInCategory="100"
|
android:orderInCategory="300"
|
||||||
android:showAsAction="never" />
|
android:showAsAction="never" />
|
||||||
</menu>
|
</menu>
|
||||||
|
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
<resources>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Layout alias to replace the single-pane version of the layout with a
|
|
||||||
two-pane version on Large screens.
|
|
||||||
|
|
||||||
For more on layout aliases, see:
|
|
||||||
http://developer.android.com/training/multiscreen/screensizes.html#TaskUseAliasFilters
|
|
||||||
-->
|
|
||||||
<item name="fragment_item" type="layout">@layout/fragment_list</item>
|
|
||||||
|
|
||||||
</resources>
|
|
||||||
|
|
@ -40,6 +40,8 @@
|
||||||
<string name="pref_join_beta_summ">Join the Google+ group to get access to the beta releases of the app.</string>
|
<string name="pref_join_beta_summ">Join the Google+ group to get access to the beta releases of the app.</string>
|
||||||
<string name="pref_throughput_average_freq">Throughput Averaging Frequency</string>
|
<string name="pref_throughput_average_freq">Throughput Averaging Frequency</string>
|
||||||
<string name="pref_throughput_average_freq_summ">Frequency per second(Will also impact csv logging frequency)</string>
|
<string name="pref_throughput_average_freq_summ">Frequency per second(Will also impact csv logging frequency)</string>
|
||||||
|
<string name="action_history">History</string>
|
||||||
|
<string name="title_activity_history">Execution History</string>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue