Skip to content

Commit

Permalink
modified Android datalogging
Browse files Browse the repository at this point in the history
  • Loading branch information
jinfenghuang committed Jul 24, 2014
1 parent 9ad872d commit eb60534
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 22 deletions.
42 changes: 20 additions & 22 deletions Android/ConnectedWiper/res/layout/fragment_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,6 @@
android:textColor="#F5F5F5"
android:textSize="18sp" />

<TextView
android:id="@+id/dataLogging"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/status"
android:layout_alignParentBottom="true"
android:layout_marginBottom="80dp"
android:text="The raining status data log is being stored in the wiper_data.txt file in Downloads \n
the daily raining time log is being stored in the daily_record.txt file in Downloads"
android:textColor="#F5F5F5" />

<TextView
android:id="@+id/btStatus"
android:layout_width="wrap_content"
Expand Down Expand Up @@ -85,17 +74,6 @@ the daily raining time log is being stored in the daily_record.txt file in Downl
android:textColor="#F5F5F5"
android:textSize="25sp" />

<TextView
android:id="@+id/heavyHour"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_above="@+id/lightRain"
android:layout_alignRight="@+id/dataLogging"
android:layout_marginRight="13dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#F5F5F5"
android:textSize="20sp" />

<TextView
android:id="@+id/lightHour"
android:layout_width="wrap_content"
Expand Down Expand Up @@ -128,4 +106,24 @@ the daily raining time log is being stored in the daily_record.txt file in Downl
android:text="CLEAR"
android:textColor="#F5F5F5" />

<TextView
android:id="@+id/heavyHour"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_above="@+id/lightRain"
android:layout_alignRight="@+id/status"
android:layout_marginRight="50dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#F5F5F5"
android:textSize="20sp" />

<TextView
android:id="@+id/dataLogging"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/status"
android:layout_alignParentBottom="true"
android:layout_marginBottom="91dp"
android:textColor="#F5F5F5" />

</RelativeLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public class MainActivity extends Activity {
TextView heavyHour;
TextView lightRain;
TextView lightHour;
TextView dataLogging;
Switch bt;
BluetoothAdapter mBluetoothAdapter;
BluetoothSocket socket;
Expand Down Expand Up @@ -93,6 +94,7 @@ public void onCreate(Bundle savedInstanceState) {
wiperStatus = (TextView) findViewById(R.id.wiper);
btStatus = (TextView) findViewById(R.id.btStatus);
bt = (Switch) findViewById(R.id.bluetooth);
dataLogging = (TextView) findViewById(R.id.dataLogging);
clearButton = (Button) findViewById(R.id.clearButton);
recordButton = (Button) findViewById(R.id.recordButton);
heavyRain = (TextView) findViewById(R.id.heavyRain);
Expand Down Expand Up @@ -140,6 +142,7 @@ public void onClick(View v) {
+ "m " + String.valueOf(h_sec) + "s, " + "Light rain " + String.valueOf(l_hrs) + "h "
+ String.valueOf(l_min) + "m " + String.valueOf(l_sec) + "s";
user_record.writeToFile(dailyRecord +"\n");
dataLogging.setText("The raining status data log is being stored in the user_record.txt file in Downloads");
}
});

Expand All @@ -165,6 +168,7 @@ public void onClick(View v) {
+ "m " + String.valueOf(l_sec) + "s";
heavyHour.setText(heavy_display);
lightHour.setText(light_display);
dataLogging.setText("The raining status time has been cleared.");
}
});

Expand Down Expand Up @@ -246,6 +250,7 @@ void timeAdjustment() {
+ "m " + String.valueOf(l_sec) + "s";
heavyHour.setText(heavy_display);
lightHour.setText(light_display);
dataLogging.setText("The raining status data log is being stored in the daily_record.txt file in Downloads");
}
}

Expand Down Expand Up @@ -341,6 +346,7 @@ public void run() {
Time now = new Time(Time.getCurrentTimezone());
now.setToNow();
fileManager.writeToFile(now.toString() + " " + data +"\n");
dataLogging.setText("The raining status data log is being stored in the wiper_data.txt file in Downloads");
readBufferPosition = 0;

handler.post(new Runnable() {
Expand Down
Binary file added Android/Docs/android.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit eb60534

Please sign in to comment.