Commit 7145743a authored by Craig Earley's avatar Craig Earley
Browse files

Merge branch 'sensor-sample-screen-cleanup' into 'master'

overhauls the sampling display to work for both phones and tablets

See merge request !17
parents 9311dc1d 99c59beb
......@@ -72,4 +72,5 @@ android {
dependencies {
implementation files('libs/jsoup-1.9.2.jar')
implementation 'com.android.support:appcompat-v7'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
}
\ No newline at end of file
......@@ -177,7 +177,7 @@ public class SensorSampleActivity extends AppCompatActivity {
one.setVisibility(View.VISIBLE);
}
ListView mSensors = findViewById(android.R.id.list);
ListView mSensors = findViewById(R.id.sensor_and_value_list);
adapter = new SensorListAdapter(this, listSensors);
mSensors.setAdapter(adapter);
Intent i = new Intent(context, SensorSampleService.class);
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:id="@+id/relativeLayout2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/phone_mode_pad"
android:background="@drawable/take_a_sample_landscape"
android:focusableInTouchMode="true"
android:background="@drawable/take_a_sample_landscape">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="15sp"
android:textStyle="bold"
android:text=""
android:id="@+id/tripNameText"
android:layout_toStartOf="@id/battery_status" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/LatLong"
android:id="@+id/longandlat"
android:textStyle="bold"
android:textSize="20sp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/Accuracy"
android:layout_below="@id/longandlat"
android:layout_marginStart="5dp"
android:id="@+id/accuracy"
android:textStyle="bold"
android:textSize="20sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/Satellites"
android:layout_below="@id/longandlat"
android:id="@+id/satellites"
android:textStyle="bold"
android:textSize="20sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/Elevation"
android:layout_below="@id/longandlat"
android:layout_marginEnd="5dp"
android:id="@+id/elevation"
android:textStyle="bold"
android:textSize="20sp"
android:layout_toEndOf="@+id/longandlat" />
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/site"
android:layout_below="@id/accuracy"
android:layout_alignStart="@id/accuracy"
android:layout_toStartOf="@+id/sector" />
android:baselineAligned="false"
android:orientation="horizontal">
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/sector"
android:layout_below="@id/satellites"
android:layout_alignTop="@id/site"
android:layout_alignStart="@+id/interval"
android:layout_alignEnd="@+id/longandlat" />
<LinearLayout
android:id="@+id/globalDataContainer"
android:layout_width="360dp"
android:layout_height="match_parent"
android:gravity="start"
android:layout_weight="1"
android:orientation="vertical">
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="10"
android:id="@+id/spotNumber"
android:hint="@string/Spot"
android:layout_below="@id/elevation"
android:layout_alignEnd="@id/elevation"
android:layout_toEndOf="@+id/sector"
android:autofillHints=""
tools:targetApi="o" />
<RadioGroup
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/site"
android:orientation="horizontal"
android:layout_marginTop="0dp"
android:layout_centerInParent="true"
android:id="@+id/interval">
<RadioButton
android:id="@+id/oneSecond"
style="@style/intervalButtons"
android:checked="true"
android:onClick="changeInterval"
android:text="@string/oneSecond"
android:visibility="invisible"
tools:visibility="visible" />
<RadioButton
android:id="@+id/threeSeconds"
style="@style/intervalButtons"
android:checked="true"
android:onClick="changeInterval"
android:text="@string/threeSeconds" />
<RadioButton
android:id="@+id/fiveSeconds"
style="@style/intervalButtons"
android:onClick="changeInterval"
android:text="@string/fiveSeconds"/>
<RadioButton
android:id="@+id/tenSeconds"
style="@style/intervalButtons"
android:onClick="changeInterval"
android:text="@string/tenSeconds" />
<RadioButton
android:id="@+id/thirtySeconds"
style="@style/intervalButtons"
android:onClick="changeInterval"
android:text="@string/thirtySeconds" />
<RadioButton
android:id="@+id/sixtySeconds"
style="@style/intervalButtons"
android:onClick="changeInterval"
android:text="@string/sixtySeconds" />
</RadioGroup>
<ListView
android:layout_width="330dp"
android:layout_height="wrap_content"
android:id="@android:id/list"
android:layout_gravity="start"
android:layout_below="@+id/interval"
android:layout_marginBottom="10dp"
android:layout_alignEnd="@+id/spotNumber"
android:layout_alignStart="@+id/site"
android:layout_above="@+id/streamButton">
</ListView>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/streamButton"
android:background="@null"
android:contentDescription="@string/stream"
app:srcCompat="@drawable/stream_button"
android:layout_alignParentBottom="true"
android:layout_toEndOf="@+id/sampleButton" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/sampleButton"
android:background="@null"
android:contentDescription="@string/sample"
app:srcCompat="@drawable/sample_button"
android:layout_alignParentBottom="true"
android:layout_marginStart="23dp" />
<Button
android:id="@+id/addPictureButton"
style="@style/noteAndImagebuttons"
android:layout_above="@+id/streamButton"
android:layout_toStartOf="@+id/addNotesButton"
android:onClick="takePicture"
android:text="@string/add_picture_text" />
<Button
android:id="@+id/addNotesButton"
style="@style/noteAndImagebuttons"
android:layout_above="@+id/streamButton"
android:layout_alignEnd="@+id/satellites"
android:onClick="addNotes"
android:text="@string/add_notes" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/calibrateSensorButton"
android:onClick="calibrateSensor"
android:visibility="invisible"
android:text="@string/calibrate_sensor"
android:layout_above="@+id/sampleButton"
android:layout_toEndOf="@+id/addNotesButton"
android:layout_alignTop="@+id/addNotesButton" />
<TextView
android:id="@+id/battery_status"
<TextView
android:id="@+id/tripNameText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text=""
android:textSize="15sp"
android:textStyle="bold" />
<TextView
android:id="@+id/longandlat"
style="@style/latlongsensorsample"
android:text="@string/LatLong"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/battery_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/batt_text"
android:textStyle="bold" />
<Spinner
android:id="@+id/site"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Spinner
android:id="@+id/sector"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/accuracy"
style="@style/quality_descriptors_small"
android:paddingStart="@dimen/phone_mode_descriptor_pad"
android:paddingEnd="@dimen/phone_mode_descriptor_pad"
android:text="@string/Accuracy" />
<TextView
android:id="@+id/satellites"
style="@style/quality_descriptors_small"
android:paddingStart="@dimen/phone_mode_descriptor_pad"
android:paddingEnd="@dimen/phone_mode_descriptor_pad"
android:text="@string/Satellites" />
<TextView
android:id="@+id/elevation"
style="@style/quality_descriptors_small"
android:paddingStart="@dimen/phone_mode_descriptor_pad"
android:paddingEnd="@dimen/phone_mode_descriptor_pad"
android:text="@string/Elevation" />
</LinearLayout>
<ListView
android:id="@+id/sensor_and_value_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="20dp"
android:layout_gravity="start" />
<Button
android:id="@+id/calibrateSensorButton"
style="?android:buttonBarButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="calibrateSensor"
android:text="@string/calibrate_sensor"
android:visibility="invisible" />
</LinearLayout>
<LinearLayout
android:id="@+id/sensorSampleContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:layout_marginTop="15dp"
android:layout_marginEnd="10dp"
android:text="@string/batt_text"
android:textStyle="bold"
android:textSize="18sp"/>
</RelativeLayout>
\ No newline at end of file
android:gravity="end"
android:layout_weight="1"
android:orientation="vertical">
<RadioGroup
android:id="@+id/interval"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RadioButton
android:id="@+id/oneSecond"
style="@style/intervalButtons"
android:checked="true"
android:onClick="changeInterval"
android:text="@string/oneSecond"
android:visibility="invisible"
tools:visibility="visible" />
<RadioButton
android:id="@+id/threeSeconds"
style="@style/intervalButtons"
android:checked="true"
android:onClick="changeInterval"
android:text="@string/threeSeconds" />
<RadioButton
android:id="@+id/fiveSeconds"
style="@style/intervalButtons"
android:onClick="changeInterval"
android:text="@string/fiveSeconds" />
<RadioButton
android:id="@+id/tenSeconds"
style="@style/intervalButtons"
android:onClick="changeInterval"
android:text="@string/tenSeconds" />
<RadioButton
android:id="@+id/thirtySeconds"
style="@style/intervalButtons"
android:onClick="changeInterval"
android:text="@string/thirtySeconds" />
<RadioButton
android:id="@+id/sixtySeconds"
style="@style/intervalButtons"
android:onClick="changeInterval"
android:text="@string/sixtySeconds" />
</RadioGroup>
<ImageButton
android:id="@+id/streamButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:contentDescription="@string/stream"
app:srcCompat="@drawable/stream_button" />
<EditText
android:id="@+id/spotNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autofillHints=""
android:ems="10"
android:hint="@string/Spot"
android:background="@color/white"
android:inputType="number"
tools:targetApi="o" />
<ImageButton
android:id="@+id/sampleButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:contentDescription="@string/sample"
app:srcCompat="@drawable/sample_button" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/addPictureButton"
style="@style/noteAndImagebuttons"
android:onClick="takePicture"
android:text="@string/add_picture_text" />
<Button
android:id="@+id/addNotesButton"
style="@style/noteAndImagebuttons"
android:onClick="addNotes"
android:text="@string/add_notes" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/relativeLayout2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/tablet_mode_pad"
android:background="@drawable/take_a_sample_landscape"
android:focusableInTouchMode="true"
android:orientation="vertical">
<LinearLayout
android:id="@+id/globalDataContainer"
android:layout_width="566dp"
android:layout_height="441dp"
android:orientation="vertical"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/tripNameText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text=""
android:textSize="15sp"
android:textStyle="bold" />
<TextView
android:id="@+id/longandlat"
style="@style/latlongsensorsample"
android:text="@string/LatLong"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/accuracy"
style="@style/quality_descriptors"
android:text="@string/Accuracy" />
<TextView
android:id="@+id/satellites"
style="@style/quality_descriptors"
android:text="@string/Satellites" />
<TextView
android:id="@+id/elevation"
style="@style/quality_descriptors"
android:text="@string/Elevation" />
<TextView
android:id="@+id/battery_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/batt_text"
android:textStyle="bold" />
<Spinner
android:id="@+id/site"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Spinner
android:id="@+id/sector"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<ListView
android:id="@+id/sensor_and_value_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start" />
</LinearLayout>
<LinearLayout
android:id="@+id/sensorSampleContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="@dimen/sensor_sample_button_padding">
<RadioGroup
android:id="@+id/interval"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RadioButton
android:id="@+id/oneSecond"
style="@style/intervalButtons"
android:checked="true"
android:onClick="changeInterval"
android:text="@string/oneSecond"
android:visibility="invisible"
tools:visibility="visible" />
<RadioButton
android:id="@+id/threeSeconds"
style="@style/intervalButtons"
android:checked="true"
android:onClick="changeInterval"
android:text="@string/threeSeconds" />
<RadioButton
android:id="@+id/fiveSeconds"
style="@style/intervalButtons"
android:onClick="changeInterval"
android:text="@string/fiveSeconds" />
<RadioButton
android:id="@+id/tenSeconds"
style="@style/intervalButtons"
android:onClick="changeInterval"
android:text="@string/tenSeconds" />
<RadioButton
android:id="@+id/thirtySeconds"
style="@style/intervalButtons"
android:onClick="changeInterval"
android:text="@string/thirtySeconds" />
<RadioButton
android:id="@+id/sixtySeconds"
style="@style/intervalButtons"
android:onClick="changeInterval"
android:text="@string/sixtySeconds" />
</RadioGroup>
<ImageButton
android:id="@+id/streamButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:contentDescription="@string/stream"
app:srcCompat="@drawable/stream_button" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="@dimen/sensor_sample_button_padding">
<EditText
android:id="@+id/spotNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autofillHints=""
android:ems="10"
android:hint="@string/Spot"
android:background="@color/white"
android:inputType="number"
tools:targetApi="o" />
<ImageButton
android:id="@+id/sampleButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:contentDescription="@string/sample"
app:srcCompat="@drawable/sample_button" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="@dimen/sensor_sample_button_padding">
<Button
android:id="@+id/addPictureButton"
style="@style/noteAndImagebuttons"
android:onClick="takePicture"
android:text="@string/add_picture_text" />
<Button
android:id="@+id/addNotesButton"
style="@style/noteAndImagebuttons"
android:onClick="addNotes"