bus速度表设计更新,内容呈现容错

This commit is contained in:
liujing
2022-06-29 11:28:38 +08:00
parent 99115e550c
commit fd7be50598
6 changed files with 22 additions and 21 deletions

View File

@@ -74,7 +74,7 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
private Group groupTestPanel;
private FrameLayout flSpeed;
// private BusArcView mouduleArc;
private TrafficDataView mouduleArc;
private TrafficDataView mTrafficDataView;
private ImageView mUpgradeTipIv;
// private BusTrafficLightView mTrafficLightView;
@@ -120,7 +120,7 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
tvOperationStatus = findViewById(R.id.module_mogo_och_operation_status);
flSpeed = (FrameLayout) findViewById(R.id.fl_speed);
mouduleArc = (TrafficDataView) findViewById(R.id.bus_arc);
mTrafficDataView = (TrafficDataView) findViewById(R.id.bus_arc);
panelView = LayoutInflater.from(getContext()).inflate(getStationPanelViewId(), flStationPanelContainer);
slidePanelView.setOnSlidePanelMoveToEndListener(onSlideToEndListener);
@@ -148,8 +148,8 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
});
if (DebugConfig.isDebug()) {
mouduleArc.setLongClickable(true);
mouduleArc.setOnLongClickListener(v -> {
mTrafficDataView.setLongClickable(true);
mTrafficDataView.setOnLongClickListener(v -> {
CallerLogger.INSTANCE.d(M_BUS + TAG, "长按显示状态工具栏");
Intent intent = new Intent();
intent.putExtra("oper", 52);
@@ -480,11 +480,9 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
*/
public void updateSpeedView(float newSpeed) {
int speed = (int) (Math.abs(newSpeed) * 3.6F); // 倒车时工控机反馈定位信息中speed为负值
mouduleArc.showWithSpeedValue(speed);
// mouduleArc.setArcColor(Color.parseColor(speed > 60 ? "#DB3137" : "#3E77F6"));
// mouduleArc.setValues(speed);
// flSpeed.setBackgroundResource(speed > 60 ? R.drawable.bus_yi_biao_pan_bg_speeding : R.drawable.bus_yi_biao_pan_bg_nor);
if (mTrafficDataView != null){
mTrafficDataView.updateSpeedWithValue(speed);
}
}
@Override

View File

@@ -165,11 +165,15 @@ public class TrafficDataView extends ConstraintLayout {
}
/**
* 车速过快
* value呈现
*/
public void showWithSpeedValue(int newSpeed) {
speedTextView.setText(newSpeed);
speedImage.setBackgroundResource(newSpeed > 60 ? R.drawable.traffic_data_speed_warning : R.drawable.traffic_data_speed);
public void updateSpeedWithValue(int newSpeed) {
if (speedTextView != null) {
speedTextView.setText(String.valueOf(newSpeed));
}
if (speedImage != null) {
speedImage.setBackgroundResource(newSpeed > 60 ? R.drawable.traffic_data_speed_warning : R.drawable.traffic_data_speed);
}
}
}

View File

@@ -87,7 +87,7 @@
android:layout_width="@dimen/dp_390"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_42"
app:defaultColor = "@color/bus_p_default_txt_color"
app:defaultColor = "@color/p_default_txt_color"
app:selectColor="@color/bus_p_select_txt_color"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"

View File

@@ -88,7 +88,7 @@
android:layout_width="@dimen/dp_272"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_30"
app:defaultColor="@color/taxi_p_default_txt_color"
app:defaultColor="@color/p_default_txt_color"
app:selectColor="@color/dark_mode_select_txt_color"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"

View File

@@ -12,7 +12,7 @@
android:gravity="center"
android:text="P"
android:textAlignment="center"
android:textColor="@color/p_default_txt_color"
android:textSize="@dimen/dp_46"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
@@ -27,7 +27,7 @@
android:gravity="center"
android:text="R"
android:textAlignment="center"
android:textColor="@color/p_default_txt_color"
android:textSize="@dimen/dp_46"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
@@ -42,7 +42,7 @@
android:gravity="center"
android:text="N"
android:textAlignment="center"
android:textColor="@color/p_default_txt_color"
android:textSize="@dimen/dp_46"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
@@ -57,7 +57,7 @@
android:gravity="center"
android:text="D"
android:textAlignment="center"
android:textColor="@color/p_default_txt_color"
android:textSize="@dimen/dp_46"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"

View File

@@ -62,8 +62,7 @@
<color name="hmi_clear_00">#00FFFFFF</color>
<color name="acc_default_txt_color">#FF343C63</color>
<color name="bus_p_select_txt_color">#0043FF</color>
<color name="bus_p_default_txt_color">#6E8EC9</color>
<color name="taxi_p_default_txt_color">#FF6E8EC9</color>
<color name="p_default_txt_color">#FF6E8EC9</color>
<color name="dark_mode_select_txt_color">#FFFFFFFF</color>
</resources>