diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerBaseFragment.java b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerBaseFragment.java index 2bb232e69a..6059ccdf03 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerBaseFragment.java +++ b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerBaseFragment.java @@ -5,16 +5,15 @@ import android.os.Looper; import android.view.View; import android.widget.FrameLayout; import android.widget.ImageView; -import android.widget.TextView; import androidx.annotation.NonNull; import androidx.fragment.app.FragmentTransaction; import com.mogo.commons.AbsMogoApplication; import com.mogo.commons.mvp.MvpFragment; -import com.mogo.eagle.core.data.config.HmiBuildConfig; import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener; import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager; +import com.mogo.eagle.core.function.call.hmi.CallerHmiManager; import com.mogo.eagle.core.function.call.map.CallerSmpManager; import com.mogo.map.listener.IMogoMapListener; import com.mogo.map.uicontroller.VisualAngleMode; @@ -39,8 +38,7 @@ public class TaxiPassengerBaseFragment extends MvpFragment { + mCurrentLightId = 0; + TaxiPassengerTrafficLightView.this.setVisibility(GONE); + }); + } + + /** + * @param redNum 红灯倒计时 + * @param yellowNum 黄灯倒计时 + * @param greenNum 绿灯倒计时 + */ + @Override + public void changeCountdownTrafficLightNum(int redNum, int yellowNum, int greenNum) { + super.changeCountdownTrafficLightNum(redNum, yellowNum, greenNum); + switch (mCurrentLightId) { + case 1: + changeCountdownRed(redNum); + break; + case 2: + changeCountdownYellow(yellowNum); + break; + case 3: + changeCountdownGreen(greenNum); + break; + default: + UiThreadHandler.post(() -> { + mLightTimeTV.setText(""); + }); + break; + } + } + + @Override + public void changeCountdownRed(int redNum) { + super.changeCountdownRed(redNum); + UiThreadHandler.post(() -> { + if (redNum > 0) { + Shader shader = new LinearGradient( + 0, 0, 0, mLightTimeTV.getLineHeight(), + getResources().getColor(R.color.taxi_p_traffic_light_red_color_up), + getResources().getColor(R.color.taxi_p_traffic_light_red_color_down), + Shader.TileMode.REPEAT); + mLightTimeTV.getPaint().setShader(shader); + mLightTimeTV.setText(String.valueOf(redNum)); + } else { + mLightTimeTV.setText(""); + } + }); + } + + @Override + public void changeCountdownGreen(int greenNum) { + super.changeCountdownGreen(greenNum); + UiThreadHandler.post(() -> { + if (greenNum > 0) { + Shader shader = new LinearGradient( + 0, 0, 0, mLightTimeTV.getLineHeight(), + getResources().getColor(R.color.taxi_p_traffic_light_green_color_up), + getResources().getColor(R.color.taxi_p_traffic_light_green_color_down), + Shader.TileMode.REPEAT); + mLightTimeTV.getPaint().setShader(shader); + mLightTimeTV.setText(String.valueOf(greenNum)); + } else { + mLightTimeTV.setText(""); + } + }); + } + + @Override + public void changeCountdownYellow(int yellowNum) { + super.changeCountdownYellow(yellowNum); + UiThreadHandler.post(() -> { + if (yellowNum > 0) { + Shader shader = new LinearGradient( + 0, 0, 0, mLightTimeTV.getLineHeight(), + getResources().getColor(R.color.taxi_p_traffic_light_yellow_color_up), + getResources().getColor(R.color.taxi_p_traffic_light_yellow_color_down), + Shader.TileMode.REPEAT); + mLightTimeTV.getPaint().setShader(shader); + mLightTimeTV.setText(String.valueOf(yellowNum)); + } else { + mLightTimeTV.setText(""); + } + }); + } + + /** + * 更新红绿灯icon + * + * @param lightId 0-都是默认,1-红,2-黄,3-绿 + */ + private void updateTrafficLightIcon(int lightId) { + UiThreadHandler.post(() -> { + switch (lightId) { + case 1: + mLightIconIV.setBackgroundResource(R.drawable.taxi_p_light_red_nor); + TaxiPassengerTrafficLightView.this.setVisibility(VISIBLE); + break; + case 2: + mLightIconIV.setBackgroundResource(R.drawable.taxi_p_lightyellow_nor); + TaxiPassengerTrafficLightView.this.setVisibility(VISIBLE); + break; + case 3: + mLightIconIV.setBackgroundResource(R.drawable.taxi_p_light_green_nor); + TaxiPassengerTrafficLightView.this.setVisibility(VISIBLE); + break; + default: + TaxiPassengerTrafficLightView.this.setVisibility(GONE); + break; + } + }); + } +} diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/bg_taxi_p_traffic_light_background.xml b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/bg_taxi_p_traffic_light_background.xml new file mode 100644 index 0000000000..941a082881 --- /dev/null +++ b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/bg_taxi_p_traffic_light_background.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_base_fragment.xml b/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_base_fragment.xml index 00a8e07265..f013f01624 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_base_fragment.xml +++ b/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_base_fragment.xml @@ -104,24 +104,13 @@ app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent"/> - - - - - + \ No newline at end of file diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_traffic_light_view.xml b/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_traffic_light_view.xml new file mode 100644 index 0000000000..de3920b35a --- /dev/null +++ b/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_traffic_light_view.xml @@ -0,0 +1,35 @@ + + + + + + + + + + \ No newline at end of file diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/values-sw320dp/dimens.xml b/OCH/mogo-och-taxi-passenger/src/main/res/values-sw320dp/dimens.xml index ff217787bf..c160630cf4 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/res/values-sw320dp/dimens.xml +++ b/OCH/mogo-och-taxi-passenger/src/main/res/values-sw320dp/dimens.xml @@ -26,4 +26,17 @@ 520px 820px + + 225px + 154px + 60px + 40px + 23px + 210px + 120px + 15px + 17px + 154px + 127px + 60px \ No newline at end of file diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/values-xhdpi-2560x1440/dimens.xml b/OCH/mogo-och-taxi-passenger/src/main/res/values-xhdpi-2560x1440/dimens.xml index a2eb014595..1dc9f73763 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/res/values-xhdpi-2560x1440/dimens.xml +++ b/OCH/mogo-och-taxi-passenger/src/main/res/values-xhdpi-2560x1440/dimens.xml @@ -90,4 +90,16 @@ 520px 820px + 225px + 154px + 60px + 40px + 23px + 210px + 120px + 15px + 17px + 154px + 127px + 60px \ No newline at end of file diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/values/colors.xml b/OCH/mogo-och-taxi-passenger/src/main/res/values/colors.xml index 082091e63d..3d8d1d88f4 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/res/values/colors.xml +++ b/OCH/mogo-och-taxi-passenger/src/main/res/values/colors.xml @@ -16,4 +16,11 @@ #1FC3FF #57ABFF + + #FFA28B + #DA1100 + #60FFD3 + #006D43 + #FFE198 + #FF9B00 \ No newline at end of file diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/values/dimens.xml b/OCH/mogo-och-taxi-passenger/src/main/res/values/dimens.xml index 2e13cc5ee9..679981a15f 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/res/values/dimens.xml +++ b/OCH/mogo-och-taxi-passenger/src/main/res/values/dimens.xml @@ -87,4 +87,17 @@ 820px 520px 432px + + 225px + 154px + 60px + 40px + 23px + 210px + 120px + 15px + 17px + 154px + 127px + 60px \ No newline at end of file