mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
Add sleep HR average
This commit is contained in:
+7
-8
@@ -77,12 +77,12 @@ public class DaySleepChartFragment extends AbstractActivityChartFragment<DaySlee
|
||||
private TextView lightSleepTimeText;
|
||||
private TextView lowestHrText;
|
||||
private TextView highestHrText;
|
||||
private TextView averageHrText;
|
||||
private TextView movementIntensityText;
|
||||
private LinearLayout movementIntensityTextWrapper;
|
||||
private LinearLayout dummyTile;
|
||||
private TextView sleepDateText;
|
||||
private int heartRateMin = 0;
|
||||
private int heartRateMax = 0;
|
||||
private int heartRateAvg = 0;
|
||||
private float intensityTotal = 0;
|
||||
|
||||
|
||||
@@ -261,12 +261,12 @@ public class DaySleepChartFragment extends AbstractActivityChartFragment<DaySlee
|
||||
mActivityChart.setData(mcd.getChartsData().getData());
|
||||
heartRateMin = mcd.getHeartRateAxisMin();
|
||||
heartRateMax = mcd.getHeartRateAxisMax();
|
||||
heartRateAvg = Math.round(mcd.getHeartRateAverage());
|
||||
intensityTotal = mcd.getIntensityTotal();
|
||||
lowestHrText.setText(String.valueOf(heartRateMin != 0 ? heartRateMin : "-"));
|
||||
highestHrText.setText(String.valueOf(heartRateMax != 0 ? heartRateMax : "-"));
|
||||
lowestHrText.setText(String.valueOf(heartRateMin > 0 ? heartRateMin : "-"));
|
||||
highestHrText.setText(String.valueOf(heartRateMax > 0 ? heartRateMax : "-"));
|
||||
averageHrText.setText(String.valueOf(heartRateAvg > 0 ? heartRateAvg : "-"));
|
||||
movementIntensityText.setText(intensityTotal > 0 ? new DecimalFormat("###.#").format(intensityTotal) : "-");
|
||||
movementIntensityTextWrapper.setVisibility(intensityTotal > 0 ? View.VISIBLE : View.GONE);
|
||||
dummyTile.setVisibility(intensityTotal > 0 ? View.VISIBLE : View.GONE);
|
||||
|
||||
if (supportsHeartrate(getChartsHost().getDevice()) && SHOW_CHARTS_AVERAGE) {
|
||||
if (mcd.getHeartRateAxisMax() != 0 || mcd.getHeartRateAxisMin() != 0) {
|
||||
@@ -396,9 +396,8 @@ public class DaySleepChartFragment extends AbstractActivityChartFragment<DaySlee
|
||||
lightSleepTimeText = rootView.findViewById(R.id.sleep_chart_legend_light_time);
|
||||
lowestHrText = rootView.findViewById(R.id.sleep_hr_lowest);
|
||||
highestHrText = rootView.findViewById(R.id.sleep_hr_highest);
|
||||
averageHrText = rootView.findViewById(R.id.sleep_hr_average);
|
||||
movementIntensityText = rootView.findViewById(R.id.sleep_movement_intensity);
|
||||
movementIntensityTextWrapper = rootView.findViewById(R.id.sleep_chart_legend_movement_intensity_wrapper);
|
||||
dummyTile = rootView.findViewById(R.id.sleep_chart_legend_dummy_tile);
|
||||
sleepDateText = rootView.findViewById(R.id.sleep_date);
|
||||
|
||||
mSleepchartInfo.setMaxLines(sleepLinesLimit);
|
||||
|
||||
@@ -190,7 +190,7 @@
|
||||
android:id="@+id/sleep_hr_lowest"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="0"
|
||||
android:text="@string/stats_empty_value"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<TextView
|
||||
@@ -208,7 +208,7 @@
|
||||
android:id="@+id/sleep_hr_highest"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="0"
|
||||
android:text="@string/stats_empty_value"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<TextView
|
||||
@@ -217,6 +217,24 @@
|
||||
android:text="@string/stats_highest_hr"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_marginBottom="2dp"
|
||||
android:layout_marginEnd="1dp"
|
||||
style="@style/GridTile"
|
||||
>
|
||||
<TextView
|
||||
android:id="@+id/sleep_hr_average"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/stats_empty_value"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/stats_average_hr"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/sleep_chart_legend_movement_intensity_wrapper"
|
||||
android:layout_marginBottom="2dp"
|
||||
@@ -228,7 +246,7 @@
|
||||
android:id="@+id/sleep_movement_intensity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="0"
|
||||
android:text="@string/stats_empty_value"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<TextView
|
||||
@@ -237,12 +255,6 @@
|
||||
android:text="@string/movement_intensity"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/sleep_chart_legend_dummy_tile"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:layout_marginStart="1dp"
|
||||
style="@style/GridTile"
|
||||
/>
|
||||
</GridLayout>
|
||||
|
||||
|
||||
|
||||
@@ -1053,6 +1053,7 @@
|
||||
<string name="date_placeholders__start_time__end_time">%1s - %2s</string>
|
||||
<string name="stats_lowest_hr">Lowest HR</string>
|
||||
<string name="stats_highest_hr">Highest HR</string>
|
||||
<string name="stats_average_hr">Average HR</string>
|
||||
<string name="transition">Transition</string>
|
||||
<string name="you_slept">%1$s - %2$s</string>
|
||||
<string name="you_did_not_sleep">You did not sleep</string>
|
||||
|
||||
Reference in New Issue
Block a user