Commit 9e46b8e8 authored by Craig Earley's avatar Craig Earley
Browse files

checks null & empty sites & sectors before stream, fixes a text warning

parent 8eb0d083
......@@ -127,14 +127,13 @@ public class SensorSampleActivity extends AppCompatActivity {
progress.dismiss();
calibrateButton.setVisibility(View.VISIBLE);
Log.d("BATT_TEST_CONN", adapter.toString());
batteryStatus.setText("battery");
batteryStatus.setText("");
} else if (SensorSampleService.ACTION_UPDATED_LIST.equals(intent.getAction())) {
sensors = intent.getParcelableArrayListExtra(SensorSampleService.SENSOR_LIST);
adapter.clear();
adapter.addAll(sensors);
adapter.notifyDataSetChanged();
Log.d("BATT_TEST_UP", adapter.toString());
batteryStatus.setText("new batt level");
} else if (SensorSampleService.ACTION_DISCONNECTED.equals(intent.getAction())) {
buttonHandler.removeMessages(0);
buttonHandler.removeCallbacksAndMessages(buttonRunner);
......@@ -193,7 +192,12 @@ public class SensorSampleActivity extends AppCompatActivity {
streamButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!streaming) {
if (site == null || sector == null || site.equals("") || sector.equals("")) {
Toast t = Toast.makeText(SensorSampleActivity.this, "You must pick a site and sector to stream.", Toast.LENGTH_LONG);
t.setGravity(Gravity.CENTER, 0, 0);
t.show();
}
else if (!streaming) {
streaming = true;
streamStatusId = 1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment