Loading packages/CarSystemUI/src/com/android/systemui/statusbar/car/hvac/HvacController.java +14 −0 Original line number Diff line number Diff line Loading @@ -16,7 +16,11 @@ package com.android.systemui.statusbar.car.hvac; import static android.car.VehicleAreaType.VEHICLE_AREA_TYPE_GLOBAL; import static android.car.VehiclePropertyIds.HVAC_TEMPERATURE_DISPLAY_UNITS; import android.car.Car; import android.car.VehicleUnit; import android.car.hardware.CarPropertyValue; import android.car.hardware.hvac.CarHvacManager; import android.car.hardware.hvac.CarHvacManager.CarHvacEventCallback; Loading Loading @@ -167,7 +171,17 @@ public class HvacController { private void initComponent(TemperatureView view) { int id = view.getPropertyId(); int zone = view.getAreaId(); try { if (mHvacManager != null && mHvacManager.isPropertyAvailable(HVAC_TEMPERATURE_DISPLAY_UNITS, VEHICLE_AREA_TYPE_GLOBAL)) { if (mHvacManager.getIntProperty(HVAC_TEMPERATURE_DISPLAY_UNITS, VEHICLE_AREA_TYPE_GLOBAL) == VehicleUnit.FAHRENHEIT) { view.setDisplayInFahrenheit(true); } } if (mHvacManager == null || !mHvacManager.isPropertyAvailable(id, zone)) { view.setTemp(Float.NaN); return; Loading packages/CarSystemUI/src/com/android/systemui/statusbar/car/hvac/TemperatureTextView.java +9 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ public class TemperatureTextView extends TextView implements TemperatureView { private final int mAreaId; private final int mPropertyId; private final String mTempFormat; private boolean mDisplayFahrenheit = false; public TemperatureTextView(Context context, AttributeSet attrs) { super(context, attrs); Loading @@ -57,9 +58,17 @@ public class TemperatureTextView extends TextView implements TemperatureView { setText("--"); return; } if (mDisplayFahrenheit) { temp = convertToFahrenheit(temp); } setText(String.format(mTempFormat, temp)); } @Override public void setDisplayInFahrenheit(boolean displayFahrenheit) { mDisplayFahrenheit = displayFahrenheit; } /** * @return propertiyId Example: CarHvacManager.ID_ZONED_TEMP_SETPOINT (16385) */ Loading packages/CarSystemUI/src/com/android/systemui/statusbar/car/hvac/TemperatureView.java +17 −1 Original line number Diff line number Diff line Loading @@ -23,10 +23,26 @@ public interface TemperatureView { /** * Formats the float for display * * @param temp - The current temp or NaN * @param temp - The current temp in Celsius or NaN */ void setTemp(float temp); /** * Render the displayed temperature in Fahrenheit * * @param displayFahrenheit - True if temperature should be displayed in Fahrenheit */ void setDisplayInFahrenheit(boolean displayFahrenheit); /** * Convert the given temperature in Celsius into Fahrenheit * * @param realTemp - The temperature in Celsius * @return Temperature in Fahrenheit. */ default float convertToFahrenheit(float realTemp) { return (realTemp * 9f / 5f) + 32; } /** * @return propertiyId Example: CarHvacManager.ID_ZONED_TEMP_SETPOINT (16385) Loading packages/CarSystemUI/src/com/android/systemui/statusbar/hvac/AnimatedTemperatureView.java +9 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,7 @@ public class AnimatedTemperatureView extends FrameLayout implements TemperatureV private final TemperatureColorStore mColorStore = new TemperatureColorStore(); private final TemperatureBackgroundAnimator mBackgroundAnimator; private final TemperatureTextAnimator mTextAnimator; boolean mDisplayInFahrenheit = false; public AnimatedTemperatureView(Context context, AttributeSet attrs) { super(context, attrs); Loading Loading @@ -193,6 +194,9 @@ public class AnimatedTemperatureView extends FrameLayout implements TemperatureV */ @Override public void setTemp(float temp) { if (mDisplayInFahrenheit) { temp = convertToFahrenheit(temp); } mTextAnimator.setTemp(temp); if (Float.isNaN(temp)) { mBackgroundAnimator.hideCircle(); Loading @@ -219,6 +223,11 @@ public class AnimatedTemperatureView extends FrameLayout implements TemperatureV mBackgroundAnimator.animateOpen(); } @Override public void setDisplayInFahrenheit(boolean displayInFahrenheit) { mDisplayInFahrenheit = displayInFahrenheit; } boolean isMinValue(float temp) { return !Float.isNaN(mMinValue) && isApproxEqual(temp, mMinValue); } Loading Loading
packages/CarSystemUI/src/com/android/systemui/statusbar/car/hvac/HvacController.java +14 −0 Original line number Diff line number Diff line Loading @@ -16,7 +16,11 @@ package com.android.systemui.statusbar.car.hvac; import static android.car.VehicleAreaType.VEHICLE_AREA_TYPE_GLOBAL; import static android.car.VehiclePropertyIds.HVAC_TEMPERATURE_DISPLAY_UNITS; import android.car.Car; import android.car.VehicleUnit; import android.car.hardware.CarPropertyValue; import android.car.hardware.hvac.CarHvacManager; import android.car.hardware.hvac.CarHvacManager.CarHvacEventCallback; Loading Loading @@ -167,7 +171,17 @@ public class HvacController { private void initComponent(TemperatureView view) { int id = view.getPropertyId(); int zone = view.getAreaId(); try { if (mHvacManager != null && mHvacManager.isPropertyAvailable(HVAC_TEMPERATURE_DISPLAY_UNITS, VEHICLE_AREA_TYPE_GLOBAL)) { if (mHvacManager.getIntProperty(HVAC_TEMPERATURE_DISPLAY_UNITS, VEHICLE_AREA_TYPE_GLOBAL) == VehicleUnit.FAHRENHEIT) { view.setDisplayInFahrenheit(true); } } if (mHvacManager == null || !mHvacManager.isPropertyAvailable(id, zone)) { view.setTemp(Float.NaN); return; Loading
packages/CarSystemUI/src/com/android/systemui/statusbar/car/hvac/TemperatureTextView.java +9 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ public class TemperatureTextView extends TextView implements TemperatureView { private final int mAreaId; private final int mPropertyId; private final String mTempFormat; private boolean mDisplayFahrenheit = false; public TemperatureTextView(Context context, AttributeSet attrs) { super(context, attrs); Loading @@ -57,9 +58,17 @@ public class TemperatureTextView extends TextView implements TemperatureView { setText("--"); return; } if (mDisplayFahrenheit) { temp = convertToFahrenheit(temp); } setText(String.format(mTempFormat, temp)); } @Override public void setDisplayInFahrenheit(boolean displayFahrenheit) { mDisplayFahrenheit = displayFahrenheit; } /** * @return propertiyId Example: CarHvacManager.ID_ZONED_TEMP_SETPOINT (16385) */ Loading
packages/CarSystemUI/src/com/android/systemui/statusbar/car/hvac/TemperatureView.java +17 −1 Original line number Diff line number Diff line Loading @@ -23,10 +23,26 @@ public interface TemperatureView { /** * Formats the float for display * * @param temp - The current temp or NaN * @param temp - The current temp in Celsius or NaN */ void setTemp(float temp); /** * Render the displayed temperature in Fahrenheit * * @param displayFahrenheit - True if temperature should be displayed in Fahrenheit */ void setDisplayInFahrenheit(boolean displayFahrenheit); /** * Convert the given temperature in Celsius into Fahrenheit * * @param realTemp - The temperature in Celsius * @return Temperature in Fahrenheit. */ default float convertToFahrenheit(float realTemp) { return (realTemp * 9f / 5f) + 32; } /** * @return propertiyId Example: CarHvacManager.ID_ZONED_TEMP_SETPOINT (16385) Loading
packages/CarSystemUI/src/com/android/systemui/statusbar/hvac/AnimatedTemperatureView.java +9 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,7 @@ public class AnimatedTemperatureView extends FrameLayout implements TemperatureV private final TemperatureColorStore mColorStore = new TemperatureColorStore(); private final TemperatureBackgroundAnimator mBackgroundAnimator; private final TemperatureTextAnimator mTextAnimator; boolean mDisplayInFahrenheit = false; public AnimatedTemperatureView(Context context, AttributeSet attrs) { super(context, attrs); Loading Loading @@ -193,6 +194,9 @@ public class AnimatedTemperatureView extends FrameLayout implements TemperatureV */ @Override public void setTemp(float temp) { if (mDisplayInFahrenheit) { temp = convertToFahrenheit(temp); } mTextAnimator.setTemp(temp); if (Float.isNaN(temp)) { mBackgroundAnimator.hideCircle(); Loading @@ -219,6 +223,11 @@ public class AnimatedTemperatureView extends FrameLayout implements TemperatureV mBackgroundAnimator.animateOpen(); } @Override public void setDisplayInFahrenheit(boolean displayInFahrenheit) { mDisplayInFahrenheit = displayInFahrenheit; } boolean isMinValue(float temp) { return !Float.isNaN(mMinValue) && isApproxEqual(temp, mMinValue); } Loading