Added data time and time diffrence between data points to main activity2 common fragment
This commit is contained in:
@@ -93,6 +93,13 @@ public class FragmentCommon extends FragmentOsdBaseClass {
|
|||||||
tv.setBackgroundColor(okColour);
|
tv.setBackgroundColor(okColour);
|
||||||
tv.setTextColor(okTextColour);
|
tv.setTextColor(okTextColour);
|
||||||
|
|
||||||
|
tv = (TextView) mRootView.findViewById(R.id.data_time_tv);
|
||||||
|
tv.setText("Time =" + mConnection.mSdServer.mSdData.dataTime.format("%H:%M:%S")
|
||||||
|
+ " (" + String.format("%.1f s)",mConnection.mSdServer.mSdData.timeDiff));
|
||||||
|
tv.setBackgroundColor(okColour);
|
||||||
|
tv.setTextColor(okTextColour);
|
||||||
|
|
||||||
|
|
||||||
tv = (TextView) mRootView.findViewById(R.id.alarmTv);
|
tv = (TextView) mRootView.findViewById(R.id.alarmTv);
|
||||||
if ((mConnection.mSdServer.mSdData.alarmState == 0)
|
if ((mConnection.mSdServer.mSdData.alarmState == 0)
|
||||||
&& !mConnection.mSdServer.mSdData.alarmStanding
|
&& !mConnection.mSdServer.mSdData.alarmStanding
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ public class SdData implements Parcelable {
|
|||||||
|
|
||||||
/* Analysis results */
|
/* Analysis results */
|
||||||
public Time dataTime = null;
|
public Time dataTime = null;
|
||||||
|
public float timeDiff = 0f;
|
||||||
public long alarmState;
|
public long alarmState;
|
||||||
public String alarmCause = "";
|
public String alarmCause = "";
|
||||||
public boolean alarmStanding = false;
|
public boolean alarmStanding = false;
|
||||||
@@ -136,6 +137,7 @@ public class SdData implements Parcelable {
|
|||||||
rawData = new double[N_RAW_DATA];
|
rawData = new double[N_RAW_DATA];
|
||||||
rawData3D = new double[N_RAW_DATA * 3];
|
rawData3D = new double[N_RAW_DATA * 3];
|
||||||
dataTime = new Time(Time.getCurrentTimezone());
|
dataTime = new Time(Time.getCurrentTimezone());
|
||||||
|
timeDiff = 0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -153,6 +155,10 @@ public class SdData implements Parcelable {
|
|||||||
//cal.setTime(sdf.parse(jo.optString("dataTimeStr")));
|
//cal.setTime(sdf.parse(jo.optString("dataTimeStr")));
|
||||||
//dataTime = cal.getTime();
|
//dataTime = cal.getTime();
|
||||||
// FIXME - this doesn't work!!!
|
// FIXME - this doesn't work!!!
|
||||||
|
Time tnow = new Time();
|
||||||
|
tnow.setToNow();
|
||||||
|
timeDiff = (tnow.toMillis(false)
|
||||||
|
- dataTime.toMillis(false))/1000f;
|
||||||
dataTime.setToNow();
|
dataTime.setToNow();
|
||||||
Log.v(TAG, "fromJSON(): dataTime = " + dataTime.toString());
|
Log.v(TAG, "fromJSON(): dataTime = " + dataTime.toString());
|
||||||
maxVal = jo.optInt("maxVal");
|
maxVal = jo.optInt("maxVal");
|
||||||
|
|||||||
@@ -504,6 +504,12 @@ public abstract class SdDataSource {
|
|||||||
mDataStatusTime.setToNow();
|
mDataStatusTime.setToNow();
|
||||||
mSdData.specPower = (long) specPower / ACCEL_SCALE_FACTOR;
|
mSdData.specPower = (long) specPower / ACCEL_SCALE_FACTOR;
|
||||||
mSdData.roiPower = (long) roiPower / ACCEL_SCALE_FACTOR;
|
mSdData.roiPower = (long) roiPower / ACCEL_SCALE_FACTOR;
|
||||||
|
Time tnow = new Time();
|
||||||
|
tnow.setToNow();
|
||||||
|
mSdData.timeDiff = (tnow.toMillis(false)
|
||||||
|
- mSdData.dataTime.toMillis(false))/1000f;
|
||||||
|
mSdData.dataTime.setToNow();
|
||||||
|
|
||||||
mSdData.dataTime.setToNow();
|
mSdData.dataTime.setToNow();
|
||||||
mSdData.maxVal = 0; // not used
|
mSdData.maxVal = 0; // not used
|
||||||
mSdData.maxFreq = 0; // not used
|
mSdData.maxFreq = 0; // not used
|
||||||
|
|||||||
@@ -25,6 +25,12 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="---" />
|
android:text="---" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/data_time_tv"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="---" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/statusLayout"
|
android:id="@+id/statusLayout"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
|
|||||||
Reference in New Issue
Block a user