forked from upstream-mirrors/OpenTracks
@@ -1,8 +1,11 @@
|
|||||||
package de.dennisguse.opentracks.data.models;
|
package de.dennisguse.opentracks.data.models;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import de.dennisguse.opentracks.R;
|
import de.dennisguse.opentracks.R;
|
||||||
|
import de.dennisguse.opentracks.ui.util.ThemeUtils;
|
||||||
|
|
||||||
public class HeartRateZones {
|
public class HeartRateZones {
|
||||||
|
|
||||||
@@ -12,7 +15,7 @@ public class HeartRateZones {
|
|||||||
this.max = max;
|
this.max = max;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getColorForZone(HeartRate current) {
|
public int getColorForZone(Context context, HeartRate current) {
|
||||||
if (current != null) {
|
if (current != null) {
|
||||||
if (current.getBPM() >= max.getBPM() * 0.9) {
|
if (current.getBPM() >= max.getBPM() * 0.9) {
|
||||||
return R.color.heart_rate_zone_textcolor_5;
|
return R.color.heart_rate_zone_textcolor_5;
|
||||||
@@ -28,6 +31,7 @@ public class HeartRateZones {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return R.color.heart_rate_zone_textcolor_1;
|
// Zone 1
|
||||||
|
return ThemeUtils.getTextColorPrimary(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -274,10 +274,10 @@ public abstract class GenericStatisticsViewHolder extends StatisticViewHolder<St
|
|||||||
if (sensorDataSet != null && sensorDataSet.getHeartRate() != null) {
|
if (sensorDataSet != null && sensorDataSet.getHeartRate() != null) {
|
||||||
valueAndUnit = StringUtils.getHeartRateParts(getContext(), sensorDataSet.getHeartRate().first);
|
valueAndUnit = StringUtils.getHeartRateParts(getContext(), sensorDataSet.getHeartRate().first);
|
||||||
sensorName = sensorDataSet.getHeartRate().second;
|
sensorName = sensorDataSet.getHeartRate().second;
|
||||||
textColor = zones.getColorForZone(sensorDataSet.getHeartRate().first);
|
textColor = zones.getColorForZone(getContext(), sensorDataSet.getHeartRate().first);
|
||||||
} else {
|
} else {
|
||||||
valueAndUnit = StringUtils.getHeartRateParts(getContext(), null);
|
valueAndUnit = StringUtils.getHeartRateParts(getContext(), null);
|
||||||
textColor = zones.getColorForZone(null);
|
textColor = zones.getColorForZone(getContext(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
getBinding().statsValue.setText(valueAndUnit.first);
|
getBinding().statsValue.setText(valueAndUnit.first);
|
||||||
|
|||||||
@@ -61,5 +61,4 @@ limitations under the License.
|
|||||||
<color name="heart_rate_zone_textcolor_4">#FFBD04</color>
|
<color name="heart_rate_zone_textcolor_4">#FFBD04</color>
|
||||||
<color name="heart_rate_zone_textcolor_3">#6ACC2B</color>
|
<color name="heart_rate_zone_textcolor_3">#6ACC2B</color>
|
||||||
<color name="heart_rate_zone_textcolor_2">#64D1FD</color>
|
<color name="heart_rate_zone_textcolor_2">#64D1FD</color>
|
||||||
<color name="heart_rate_zone_textcolor_1">@color/opentracks_on_primary_color</color>
|
|
||||||
</resources>
|
</resources>
|
||||||
Reference in New Issue
Block a user