fix: layout and theme issues
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -15,3 +15,4 @@
|
|||||||
local.properties
|
local.properties
|
||||||
deploymentTargetDropDown.xml
|
deploymentTargetDropDown.xml
|
||||||
env.properties
|
env.properties
|
||||||
|
app/debug
|
||||||
|
|||||||
@@ -88,14 +88,14 @@ object DecoderIaq {
|
|||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return "M{" +
|
return "M{" +
|
||||||
"type=" + msgType +
|
"type=" + msgType +
|
||||||
"co2=" + co2 +
|
", co2=" + co2 +
|
||||||
", voc=" + voc +
|
", voc=" + voc +
|
||||||
", hum=" + humidity +
|
", hum=" + humidity +
|
||||||
", temp=" + temperature +
|
", temp=" + temperature +
|
||||||
", press=" + pressure +
|
", press=" + pressure +
|
||||||
", occ=" + occupancy +
|
|
||||||
", pm25=" + pm25 +
|
", pm25=" + pm25 +
|
||||||
", pm10=" + pm10 +
|
", pm10=" + pm10 +
|
||||||
|
", occ=" + occupancy +
|
||||||
'}'
|
'}'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,8 +120,6 @@ class DeviceListAdapter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val measurements = result.getMeasurements()
|
val measurements = result.getMeasurements()
|
||||||
|
|
||||||
val measurementsRowHeight = 100
|
|
||||||
val measurementsAdapter = object :
|
val measurementsAdapter = object :
|
||||||
ArrayAdapter<Measurement>(
|
ArrayAdapter<Measurement>(
|
||||||
context,
|
context,
|
||||||
@@ -147,7 +145,6 @@ class DeviceListAdapter(
|
|||||||
)
|
)
|
||||||
measurementView.findViewById<TextView>(R.id.measurement_value).text =
|
measurementView.findViewById<TextView>(R.id.measurement_value).text =
|
||||||
measurement.getFormattedValue()
|
measurement.getFormattedValue()
|
||||||
measurementView.layoutParams.height = measurementsRowHeight
|
|
||||||
return measurementView
|
return measurementView
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,13 +155,11 @@ class DeviceListAdapter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
measurementsListView.adapter = measurementsAdapter
|
measurementsListView.adapter = measurementsAdapter
|
||||||
measurementsListView.divider = null
|
|
||||||
|
|
||||||
if (measurements.isEmpty()) {
|
if (measurements.isEmpty()) {
|
||||||
measurementsListView.visibility = GONE
|
measurementsListView.visibility = GONE
|
||||||
} else {
|
} else {
|
||||||
measurementsListView.visibility = VISIBLE
|
measurementsListView.visibility = VISIBLE
|
||||||
measurementsListView.layoutParams.height = measurementsRowHeight * measurements.size
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -185,8 +185,14 @@ class KirbyDevice(
|
|||||||
override fun getMeasurements(): List<Measurement> {
|
override fun getMeasurements(): List<Measurement> {
|
||||||
val result = mutableListOf<Measurement>()
|
val result = mutableListOf<Measurement>()
|
||||||
|
|
||||||
measurements.forEach { m -> result.addAll(payloadToMeasurements(m))}
|
measurements.reversed().forEach { m -> result.addAll(payloadToMeasurements(m))}
|
||||||
return result.reversed()
|
|
||||||
|
/*
|
||||||
|
var pl = Payload(payload = "006b04ab74a1ed0d101404", ts = "2000")
|
||||||
|
result.addAll(payloadToMeasurements(pl))
|
||||||
|
result.addAll(payloadToMeasurements(pl))
|
||||||
|
*/
|
||||||
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getActions(): List<Action> {
|
override fun getActions(): List<Action> {
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.example.sensortestingapp;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ListView;
|
||||||
|
|
||||||
|
public class NonScrollListView extends ListView {
|
||||||
|
|
||||||
|
public NonScrollListView(Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
public NonScrollListView(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
}
|
||||||
|
public NonScrollListView(Context context, AttributeSet attrs, int defStyle) {
|
||||||
|
super(context, attrs, defStyle);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||||
|
int heightMeasureSpec_custom = MeasureSpec.makeMeasureSpec(
|
||||||
|
Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
|
||||||
|
super.onMeasure(widthMeasureSpec, heightMeasureSpec_custom);
|
||||||
|
ViewGroup.LayoutParams params = getLayoutParams();
|
||||||
|
params.height = getMeasuredHeight();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -38,6 +38,7 @@
|
|||||||
android:id="@+id/device_name"
|
android:id="@+id/device_name"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="#000000"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
@@ -84,6 +85,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
|
android:textColor="@color/black"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
tools:text="MAC: XX:XX:XX:XX:XX" />
|
tools:text="MAC: XX:XX:XX:XX:XX" />
|
||||||
@@ -94,6 +96,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:drawablePadding="2dp"
|
android:drawablePadding="2dp"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
|
android:textColor="@color/black"
|
||||||
app:drawableEndCompat="@drawable/signal_strength_medium"
|
app:drawableEndCompat="@drawable/signal_strength_medium"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
@@ -113,6 +116,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
|
android:textColor="@color/black"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
tools:text="Device Status" />
|
tools:text="Device Status" />
|
||||||
@@ -120,12 +124,17 @@
|
|||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<ListView
|
<com.example.sensortestingapp.NonScrollListView
|
||||||
android:layout_marginTop="20dp"
|
|
||||||
android:id="@+id/measurement_fields"
|
android:id="@+id/measurement_fields"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintTop_toBottomOf="@id/device_meta" />
|
android:layout_marginTop="20dp"
|
||||||
|
android:divider="@color/greyDarker"
|
||||||
|
android:dividerHeight="1px"
|
||||||
|
android:footerDividersEnabled="true"
|
||||||
|
android:headerDividersEnabled="true"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/device_meta"
|
||||||
|
tools:layout_editor_absoluteX="10dp" />
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:drawablePadding="2dp"
|
android:drawablePadding="2dp"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
|
android:textColor="@color/black"
|
||||||
app:drawableStartCompat="@drawable/baseline_device_thermostat_24"
|
app:drawableStartCompat="@drawable/baseline_device_thermostat_24"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
@@ -20,16 +21,18 @@
|
|||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/measurement_value"
|
android:id="@+id/measurement_value"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
|
||||||
android:layout_width="@dimen/match_constraint"
|
android:layout_width="@dimen/match_constraint"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
|
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
tools:text="android:layout_margin="18dp" android:maxWidth="250dp" android:text="@string/year" android:maxLines="24" android:textSize="18sp" app:layout_constraintBottom_toBottomOf="parent"" />
|
tools:text="600°" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="Base.Theme.SensorTestingApp" parent="Theme.Material3.DayNight.NoActionBar">
|
<style name="Base.Theme.SensorTestingApp" parent="Theme.Material3.Light.NoActionBar">
|
||||||
<!-- Customize your dark theme here. -->
|
<!-- Customize your dark theme here. -->
|
||||||
<!-- <item name="colorPrimary">@color/my_dark_primary</item> -->
|
<!-- <item name="colorPrimary">@color/my_dark_primary</item> -->
|
||||||
|
<item name="android:forceDarkAllowed">false</item>
|
||||||
</style>
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="Base.Theme.SensorTestingApp" parent="Theme.Material3.DayNight.NoActionBar">
|
<style name="Base.Theme.SensorTestingApp" parent="Theme.Material3.Light.NoActionBar">
|
||||||
<!-- Customize your light theme here. -->
|
<!-- Customize your light theme here. -->
|
||||||
<!-- <item name="colorPrimary">@color/my_light_primary</item> -->
|
<!-- <item name="colorPrimary">@color/my_light_primary</item> -->
|
||||||
|
<item name="textAppearanceBody1">@color/black</item>
|
||||||
|
<item name="android:forceDarkAllowed">false</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Theme.SensorTestingApp" parent="Base.Theme.SensorTestingApp" />
|
<style name="Theme.SensorTestingApp" parent="Base.Theme.SensorTestingApp" />
|
||||||
|
|||||||
Reference in New Issue
Block a user