From 6952cfac944e2964b708aae570f3cd25e65b8bbc Mon Sep 17 00:00:00 2001 From: tongchenfei Date: Fri, 22 Jan 2021 09:58:22 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=9F=BA=E7=A1=80?= =?UTF-8?q?=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mogo/och/bus/fragment/OchBusFragment.java | 61 +++++++------------ .../java/com/mogo/och/BaseOchFragment.java | 29 +++++++++ .../com/mogo/och/view/SlidePanelView.java | 35 +++++++---- .../layout/module_mogo_och_base_fragment.xml | 1 + .../mogo/httpdns/IHttpDnsLocationChanged.java | 4 +- gradle.properties | 6 +- .../statusmanager/IMogoStatusManager.java | 13 ++++ .../statusmanager/StatusDescriptor.java | 4 ++ .../impl/statusmanager/MogoStatusManager.java | 10 +++ 9 files changed, 106 insertions(+), 57 deletions(-) diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/OchBusFragment.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/OchBusFragment.java index 00ca10e6c3..42933a51dc 100644 --- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/OchBusFragment.java +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/OchBusFragment.java @@ -37,22 +37,6 @@ public class OchBusFragment extends BaseOchFragment{ -// mPresenter.onArriveAt(new AdasOCHData(10, nextStation.getLon(), nextStation.getLat())); -// }); -// btnExecute = findViewById(R.id.btnExecute); -// btnExecute.setOnClickListener(new OnPreventFastClickListener() { -// @Override -// public void onClickImpl(View v) { -// mPresenter.autoDriveToNextStation(); -// } -// }); tvNotice = findViewById(R.id.module_mogo_och_bus_station_notice); tvNotice.setOnClickListener(view->{ @@ -101,26 +85,26 @@ public class OchBusFragment extends BaseOchFragment> e LayoutInflater.from(getContext()).inflate(getStationPanelViewId(), flStationPanelContainer); slidePanelView.setOnSlidePanelMoveToEndListener(onSlideToEndListener); + + checkCallView(MogoApisHandler.getInstance().getApis().getStatusManagerApi().isCallViewShow()); + MogoApisHandler.getInstance().getApis().getStatusManagerApi().registerStatusChangedListener("Och", StatusDescriptor.CALL_VIEW, callViewListener); + } + + private void checkCallView(boolean isShown){ + if (flStationPanelContainer == null) { + return; + } + if (isShown) { + flStationPanelContainer.setTranslationY(131f); + }else{ + flStationPanelContainer.setTranslationY(0f); + } } public void showSlidePanle(String text) { @@ -79,6 +96,18 @@ public abstract class BaseOchFragment> e return null; } + private final IMogoStatusChangedListener callViewListener = (descriptor, isTrue) -> { + if (descriptor == StatusDescriptor.CALL_VIEW) { + checkCallView(isTrue); + } + }; + + @Override + public void onDestroyView() { + super.onDestroyView(); + MogoApisHandler.getInstance().getApis().getStatusManagerApi().unregisterStatusChangedListener("Och", StatusDescriptor.CALL_VIEW, callViewListener); + } + /** * 获取站点面板view,在{@link #initViews()}时候添加到container中 * @return 站点面板view diff --git a/OCH/mogo-och/src/main/java/com/mogo/och/view/SlidePanelView.java b/OCH/mogo-och/src/main/java/com/mogo/och/view/SlidePanelView.java index d93463dd99..98101a57b5 100644 --- a/OCH/mogo-och/src/main/java/com/mogo/och/view/SlidePanelView.java +++ b/OCH/mogo-och/src/main/java/com/mogo/och/view/SlidePanelView.java @@ -14,7 +14,6 @@ import android.graphics.Rect; import android.graphics.RectF; import android.graphics.Shader; import android.util.AttributeSet; -import android.util.Log; import android.view.MotionEvent; import android.view.View; import android.view.animation.DecelerateInterpolator; @@ -49,10 +48,15 @@ public class SlidePanelView extends View { private final Paint blockPaint = new Paint(Paint.ANTI_ALIAS_FLAG); private final Paint textPaint = new Paint(Paint.ANTI_ALIAS_FLAG); - private static final int BLOCK_START_X = 10; - private static final int BLOCK_START_Y = 10; - private static final int TEXT_MARGIN_LEFT = 20; - private static final int TEXT_MARGIN_RIGHT = 30; + private static final int BLOCK_START_X = 15; + private static final int BLOCK_START_Y = 15; + private static final int NORMAL_TEXT_MARGIN_LEFT = 40; + private static final int NORMAL_TEXT_MARGIN_RIGHT = 50; + private static final int SHORT_TEXT_MARGIN_LEFT = 60; + private static final int SHORT_TEXT_MARGIN_RIGHT = 70; + + private int textMarginLeft = NORMAL_TEXT_MARGIN_LEFT; + private int textMarginRight = NORMAL_TEXT_MARGIN_RIGHT; private OnSlidePanelMoveToEndListener moveToEndListener; @@ -105,7 +109,7 @@ public class SlidePanelView extends View { textPaint.setStyle(Paint.Style.FILL); textPaint.setTextSize(40); textPaint.setTextAlign(Paint.Align.LEFT); - textGradient = new LinearGradient(-GRADIENT_OFFSET, 0, 0, 0, new int[]{0x33ffffff, 0xffffffff, 0x29ffffff}, new float[]{0, 0.5f, 1f}, Shader.TileMode.CLAMP); + textGradient = new LinearGradient(-GRADIENT_OFFSET, 0, 0, 0, new int[]{0x33ffffff, 0xffffffff, 0x33ffffff}, null, Shader.TileMode.CLAMP); textGradient.setLocalMatrix(gradientMatrix); textPaint.setShader(textGradient); textPaint.getFontMetrics(blockTextMetrics); @@ -118,17 +122,22 @@ public class SlidePanelView extends View { protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int widthMode = MeasureSpec.getMode(widthMeasureSpec); int heightMode = MeasureSpec.getMode(heightMeasureSpec); - int widthSize = MeasureSpec.getSize(widthMeasureSpec); - int heightSize = MeasureSpec.getSize(heightMeasureSpec); + int widthSize; + int heightSize; - Log.d(TAG, "onMeasure:\r\n widthMode: " + widthMode + " widthSize: " + widthSize + " \r\n heightMode: " + heightMode + " heightSize: " + heightSize); + if (blockText.length() < 5) { + textMarginLeft = SHORT_TEXT_MARGIN_LEFT; + textMarginRight = SHORT_TEXT_MARGIN_RIGHT; + } else { + textMarginLeft = NORMAL_TEXT_MARGIN_LEFT; + textMarginRight = NORMAL_TEXT_MARGIN_RIGHT; + } - Log.d(TAG, "textMetrics: ascent: " + blockTextMetrics.ascent + " descent: " + blockTextMetrics.descent + " top: " + blockTextMetrics.top + " bottom: " + blockTextMetrics.bottom); if (widthMode == MeasureSpec.AT_MOST) { // 宽度根据图片大小,字符串长度,各种间隔确定 // 高度根据图片大小和上下间隔确定 textPaint.getTextBounds(blockText, 0, blockText.length(), textRect); - widthSize = BLOCK_START_X * 2 + bmBlock.getWidth() + TEXT_MARGIN_LEFT + TEXT_MARGIN_RIGHT + textRect.width(); + widthSize = BLOCK_START_X * 2 + bmBlock.getWidth() + textMarginLeft + textMarginRight + textRect.width(); heightSize = BLOCK_START_Y * 2 + bmBlock.getHeight(); widthMeasureSpec = MeasureSpec.makeMeasureSpec(widthSize, widthMode); heightMeasureSpec = MeasureSpec.makeMeasureSpec(heightSize, heightMode); @@ -148,7 +157,7 @@ public class SlidePanelView extends View { matrixAnim.cancel(); } textOffset = (getHeight() - blockTextMetrics.ascent - blockTextMetrics.descent) / 2; - matrixAnim = ObjectAnimator.ofFloat(this, "matrixTranslate", 0, w + GRADIENT_OFFSET).setDuration(1000); + matrixAnim = ObjectAnimator.ofFloat(this, "matrixTranslate", 0, w + GRADIENT_OFFSET).setDuration(2000); matrixAnim.setRepeatCount(ValueAnimator.INFINITE); matrixAnim.start(); } @@ -231,7 +240,7 @@ public class SlidePanelView extends View { gradientMatrix.setTranslate(matrixTranslate, 0); textGradient.setLocalMatrix(gradientMatrix); canvas.save(); - canvas.drawText(blockText, blockWidth + BLOCK_START_X + TEXT_MARGIN_LEFT, textOffset, textPaint); + canvas.drawText(blockText, blockWidth + BLOCK_START_X + textMarginLeft, textOffset, textPaint); canvas.restore(); // 画滑块 canvas.drawBitmap(bmBlock, BLOCK_START_X + blockOffset, BLOCK_START_Y, blockPaint); diff --git a/OCH/mogo-och/src/main/res/layout/module_mogo_och_base_fragment.xml b/OCH/mogo-och/src/main/res/layout/module_mogo_och_base_fragment.xml index 94f34cc808..06495b6018 100644 --- a/OCH/mogo-och/src/main/res/layout/module_mogo_och_base_fragment.xml +++ b/OCH/mogo-och/src/main/res/layout/module_mogo_och_base_fragment.xml @@ -37,6 +37,7 @@ android:drawableTop="@drawable/icon_heart_choose" android:drawablePadding="@dimen/module_mogo_och_autopilot_status_text_drawable_padding" android:gravity="center" + android:textAlignment="center" android:paddingTop="@dimen/module_mogo_och_autopilot_status_text_padding_top" android:text="自动驾驶" android:textColor="@color/module_mogo_och_autopilot_text_color_selector" diff --git a/foudations/httpdns-base/src/main/java/com/mogo/httpdns/IHttpDnsLocationChanged.java b/foudations/httpdns-base/src/main/java/com/mogo/httpdns/IHttpDnsLocationChanged.java index 3753ebc90e..37da4adc43 100644 --- a/foudations/httpdns-base/src/main/java/com/mogo/httpdns/IHttpDnsLocationChanged.java +++ b/foudations/httpdns-base/src/main/java/com/mogo/httpdns/IHttpDnsLocationChanged.java @@ -2,8 +2,10 @@ package com.mogo.httpdns; import android.location.Location; -import com.mogo.utils.httpdns.HttpSimpleLocation; +import androidx.annotation.Keep; +import com.mogo.utils.httpdns.HttpSimpleLocation; +@Keep public interface IHttpDnsLocationChanged { /** * 获取当前定位 diff --git a/gradle.properties b/gradle.properties index d28199cc55..fc1ecec0cd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -57,9 +57,9 @@ MOGO_UTILS_VERSION=2.0.12 MAP_AMAP_VERSION=2.0.12 MAP_AUTONAVI_VERSION=2.0.12 MOGO_MAP_VERSION=2.0.12 -MOGO_MAP_API_VERSION=2.0.12 +MOGO_MAP_API_VERSION=2.0.13 MOGO_SERVICE_VERSION=2.0.12 -MOGO_SERVICE_API_VERSION=2.0.12 +MOGO_SERVICE_API_VERSION=2.0.14 MOGO_CONNECTION_VERSION=2.0.12 MOGO_MODULE_APPS_VERSION=2.0.12 MOGO_MODULE_NAVI_VERSION=2.0.12 @@ -145,7 +145,7 @@ MOGO_OCH_TAXI_VERSION=1.0.0 ######## 外部依赖引用 # 车聊聊 -CARCHATTING_VERSION=2.2.70 +CARCHATTING_VERSION=2.2.77 # 车聊聊接口 CARCHATTINGPROVIDER_VERSION=1.1.11 # websocket diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/statusmanager/IMogoStatusManager.java b/services/mogo-service-api/src/main/java/com/mogo/service/statusmanager/IMogoStatusManager.java index 92a70288b1..16da7ccf7d 100644 --- a/services/mogo-service-api/src/main/java/com/mogo/service/statusmanager/IMogoStatusManager.java +++ b/services/mogo-service-api/src/main/java/com/mogo/service/statusmanager/IMogoStatusManager.java @@ -129,6 +129,19 @@ public interface IMogoStatusManager extends IProvider { */ boolean isMainPageLaunched(); + /** + * 对话框是否展示 + * @return + */ + boolean isCallViewShow(); + + /** + * 设置对话框展示状态 + * @param tag + * @param status + */ + void setCallViewShow(String tag, boolean status); + /** * 设置vrMode状态 * @param tag 业务类型 diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/statusmanager/StatusDescriptor.java b/services/mogo-service-api/src/main/java/com/mogo/service/statusmanager/StatusDescriptor.java index 3d29ab95f0..7710a84832 100644 --- a/services/mogo-service-api/src/main/java/com/mogo/service/statusmanager/StatusDescriptor.java +++ b/services/mogo-service-api/src/main/java/com/mogo/service/statusmanager/StatusDescriptor.java @@ -101,4 +101,8 @@ public enum StatusDescriptor { * 顶部弹框容器准备就绪 */ TOP_CONTAINER_READY, + /** + * 聊天框是否正在展示 + */ + CALL_VIEW } diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/statusmanager/MogoStatusManager.java b/services/mogo-service/src/main/java/com/mogo/service/impl/statusmanager/MogoStatusManager.java index bdad2d535b..34181e7e32 100644 --- a/services/mogo-service/src/main/java/com/mogo/service/impl/statusmanager/MogoStatusManager.java +++ b/services/mogo-service/src/main/java/com/mogo/service/impl/statusmanager/MogoStatusManager.java @@ -142,6 +142,16 @@ public class MogoStatusManager implements IMogoStatusManager { return get_bool_val( StatusDescriptor.MEDIA_PLAYER_STATUS ); } + @Override + public boolean isCallViewShow() { + return get_bool_val(StatusDescriptor.CALL_VIEW); + } + + @Override + public void setCallViewShow(String tag, boolean status) { + doSetStatus(tag,StatusDescriptor.CALL_VIEW,status); + } + @Override public void setMediaPlayStatus(String tag, boolean status) { doSetStatus(tag, StatusDescriptor.MEDIA_PLAYER_STATUS, status); From 3f49398b393c6945bed8f6621253b0faf36b8634 Mon Sep 17 00:00:00 2001 From: tongchenfei Date: Fri, 22 Jan 2021 18:25:27 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=BD=A6=E7=AB=99?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/gradle.xml | 1 + OCH/mogo-och-bus/build.gradle | 2 + .../och/bus/adapter/OchBusStationAdapter.java | 94 +++++++++++++++++++ .../mogo/och/bus/constant/OchBusConst.java | 13 +++ .../mogo/och/bus/fragment/OchBusFragment.java | 56 ++++++----- .../och/bus/presenter/OchBusPresenter.java | 10 +- ...e_mogo_och_bus_station_green_dash_line.xml | 9 ++ ...dule_mogo_och_bus_station_v_green_dash.xml | 9 ++ .../src/main/res/layout/fragment_och_bus.xml | 57 +++++++++-- .../main/res/layout/item_och_bus_station.xml | 47 ++++++++++ .../src/main/res/values/colors.xml | 9 ++ .../src/main/res/values/dimens.xml | 22 ++++- .../layout/module_mogo_och_base_fragment.xml | 15 +-- 13 files changed, 289 insertions(+), 55 deletions(-) create mode 100644 OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/adapter/OchBusStationAdapter.java create mode 100644 OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/constant/OchBusConst.java create mode 100644 OCH/mogo-och-bus/src/main/res/drawable/module_mogo_och_bus_station_green_dash_line.xml create mode 100644 OCH/mogo-och-bus/src/main/res/drawable/module_mogo_och_bus_station_v_green_dash.xml create mode 100644 OCH/mogo-och-bus/src/main/res/layout/item_och_bus_station.xml create mode 100644 OCH/mogo-och-bus/src/main/res/values/colors.xml diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 771c1f74d7..740794bd48 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -89,6 +89,7 @@ diff --git a/OCH/mogo-och-bus/build.gradle b/OCH/mogo-och-bus/build.gradle index 2e4e685dd9..0cfd857606 100644 --- a/OCH/mogo-och-bus/build.gradle +++ b/OCH/mogo-och-bus/build.gradle @@ -44,6 +44,8 @@ dependencies { implementation rootProject.ext.dependencies.rxjava implementation rootProject.ext.dependencies.rxandroid + implementation rootProject.ext.dependencies.androidxrecyclerview + if (Boolean.valueOf(RELEASE)) { implementation rootProject.ext.dependencies.mogooch implementation rootProject.ext.dependencies.mogoutils diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/adapter/OchBusStationAdapter.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/adapter/OchBusStationAdapter.java new file mode 100644 index 0000000000..59e6699b93 --- /dev/null +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/adapter/OchBusStationAdapter.java @@ -0,0 +1,94 @@ +package com.mogo.och.bus.adapter; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.mogo.och.bus.R; +import com.mogo.och.bus.bean.OchBusStation; +import com.mogo.och.bus.constant.OchBusConst; + +import java.util.ArrayList; +import java.util.List; + +/** + * Station Panel 中的车站列表adapter + * + * @author tongchenfei + */ +public class OchBusStationAdapter extends RecyclerView.Adapter { + + private final Context context; + private final List stationList = new ArrayList<>(); + private int currentStation; + + public OchBusStationAdapter(Context context) { + this.context = context; + } + + public void refreshStationList(List stationList) { + this.stationList.clear(); + this.stationList.addAll(stationList); + for (int i = 0; i < stationList.size(); i++) { + OchBusStation station = stationList.get(i); + if (station.getIsCurrentSite() == OchBusConst.STATION_STATUS_ARRIVING || station.getIsCurrentSite() == OchBusConst.STATION_STATUS_STOPED) { + currentStation = i; + break; + } + } + notifyDataSetChanged(); + } + + @NonNull + @Override + public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + return new ViewHolder(LayoutInflater.from(context).inflate(R.layout.item_och_bus_station, parent, false)); + } + + @Override + public void onBindViewHolder(@NonNull ViewHolder holder, int position) { + holder.tvStationName.setText(stationList.get(position).getSiteName()); + if (position == currentStation) { + holder.tvStationName.setTextColor(context.getResources().getColor(R.color.module_mogo_och_bus_current_station_name_text_color)); + } else if (position < currentStation) { + // 驶过 + holder.tvStationName.setTextColor(context.getResources().getColor(R.color.module_mogo_och_bus_arrived_station_name_text_color)); + }else { + holder.tvStationName.setTextColor(context.getResources().getColor(R.color.module_mogo_och_bus_not_arrive_station_name_text_color)); + } + + if (position == 0) { + holder.tvStationNotice.setText("起点"); + holder.tvStationNotice.setVisibility(View.VISIBLE); + } else if (position == getItemCount() - 1) { + holder.tvStationNotice.setText("终点"); + holder.tvStationNotice.setVisibility(View.VISIBLE); + }else{ + holder.tvStationNotice.setVisibility(View.GONE); + } + + } + + @Override + public int getItemCount() { + return stationList.size(); + } + + static class ViewHolder extends RecyclerView.ViewHolder{ + ImageView ivIcon; + TextView tvStationName; + TextView tvStationNotice; + public ViewHolder(@NonNull View itemView) { + super(itemView); + ivIcon = itemView.findViewById(R.id.module_mogo_och_bus_station_icon); + tvStationName = itemView.findViewById(R.id.module_mogo_och_bus_station_name); + tvStationNotice = itemView.findViewById(R.id.module_mogo_och_bus_station_notice); + } + } +} diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/constant/OchBusConst.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/constant/OchBusConst.java new file mode 100644 index 0000000000..b528100786 --- /dev/null +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/constant/OchBusConst.java @@ -0,0 +1,13 @@ +package com.mogo.och.bus.constant; + +/** + * 常量 + * + * @author tongchenfei + */ +public class OchBusConst { + public static final int STATION_STATUS_IDLE = 0; + public static final int STATION_STATUS_STOPED = 1; + public static final int STATION_STATUS_LEAVING = 2; + public static final int STATION_STATUS_ARRIVING = 3; +} diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/OchBusFragment.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/OchBusFragment.java index 42933a51dc..4e6c91f6da 100644 --- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/OchBusFragment.java +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/OchBusFragment.java @@ -1,22 +1,19 @@ package com.mogo.och.bus.fragment; -import android.view.LayoutInflater; -import android.view.View; -import android.widget.Button; import android.widget.TextView; import androidx.annotation.NonNull; -import androidx.constraintlayout.widget.Group; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; -import com.mogo.commons.mvp.MvpFragment; import com.mogo.module.common.MogoApisHandler; -import com.mogo.module.common.view.OnPreventFastClickListener; import com.mogo.och.BaseOchFragment; import com.mogo.och.bus.R; +import com.mogo.och.bus.adapter.OchBusStationAdapter; import com.mogo.och.bus.bean.OchBusStation; +import com.mogo.och.bus.constant.OchBusConst; import com.mogo.och.bus.presenter.OchBusPresenter; import com.mogo.och.view.SlidePanelView; -import com.mogo.service.adas.entity.AdasOCHData; import com.mogo.utils.logger.Logger; import java.util.ArrayList; @@ -30,16 +27,25 @@ import java.util.List; */ public class OchBusFragment extends BaseOchFragment implements SlidePanelView.OnSlidePanelMoveToEndListener { private static final String TAG = "OchBusFragment"; - private final List stationList = new ArrayList<>(); - private TextView tvNotice; + private TextView tvStationNotice; + private TextView tvStationName; + private RecyclerView rvStationList; + + private OchBusStationAdapter adapter; @Override protected void initViews() { super.initViews(); - tvNotice = findViewById(R.id.module_mogo_och_bus_station_notice); + tvStationNotice = findViewById(R.id.module_mogo_och_bus_current_station_notice); + tvStationName = findViewById(R.id.module_mogo_och_bus_current_station_name); + rvStationList = findViewById(R.id.module_mogo_och_bus_rv_station_list); - tvNotice.setOnClickListener(view->{ + adapter = new OchBusStationAdapter(getContext()); + rvStationList.setAdapter(adapter); + rvStationList.setLayoutManager(new LinearLayoutManager(getContext())); + + tvStationNotice.setOnClickListener(view -> { showSlidePanle("到达站点,乘客以下车"); }); } @@ -72,34 +78,34 @@ public class OchBusFragment extends BaseOchFragment busStationList) { + public void refreshBusStations(List stationList) { if (getActivity() == null) { return; } getActivity().runOnUiThread(() -> { - if (busStationList == null) { + if (stationList == null) { // todo 获取小巴数据失败 } else { // todo 渲染小巴路线数据 - stationList.clear(); - stationList.addAll(busStationList); + adapter.refreshStationList(stationList); + for (int i = 0; i < stationList.size(); i++) { OchBusStation station = stationList.get(i); - if (station.getIsCurrentSite() == OchBusPresenter.STATION_STATUS_LEAVING) { - tvNotice.setText("正在从 " + i + "站驶向" + (i + 1) + "站"); - nextStation = stationList.get(i + 1); + if (station.getIsCurrentSite() == OchBusConst.STATION_STATUS_ARRIVING) { + tvStationName.setText(station.getSiteName()); + tvStationNotice.setText("下一站"); onAutopilotStatusChanged(true); break; - } else if (station.getIsCurrentSite() == OchBusPresenter.STATION_STATUS_STOPED) { - tvNotice.setText("车辆正停在" + i + "站"); + } else if (station.getIsCurrentSite() == OchBusConst.STATION_STATUS_STOPED) { + tvStationNotice.setText("当前车站"); + tvStationName.setText(station.getSiteName()); onAutopilotStatusChanged(false); if (i == stationList.size() - 1) { + tvStationNotice.setText("终点"); showSlidePanle("单程结束"); - }else if(i == 0){ + } else if (i == 0) { showSlidePanle("准备出发"); - }else{ + } else { showSlidePanle("乘客已上车,准备出发"); } break; @@ -114,7 +120,7 @@ public class OchBusFragment extends BaseOchFragment implements IMogoA private static final String TAG = "OchBusPresenter"; private static final int VEHICAL_TYPE = 10; - public static final int STATION_STATUS_IDLE = 0; - public static final int STATION_STATUS_STOPED = 1; - public static final int STATION_STATUS_LEAVING = 2; - public static final int STATION_STATUS_ARRIVING = 3; - public OchBusPresenter(OchBusFragment view) { super(view); MogoApisHandler.getInstance().getApis().getAdasControllerApi().addAdasOCHCallback(this); diff --git a/OCH/mogo-och-bus/src/main/res/drawable/module_mogo_och_bus_station_green_dash_line.xml b/OCH/mogo-och-bus/src/main/res/drawable/module_mogo_och_bus_station_green_dash_line.xml new file mode 100644 index 0000000000..ede7dd747d --- /dev/null +++ b/OCH/mogo-och-bus/src/main/res/drawable/module_mogo_och_bus_station_green_dash_line.xml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/OCH/mogo-och-bus/src/main/res/drawable/module_mogo_och_bus_station_v_green_dash.xml b/OCH/mogo-och-bus/src/main/res/drawable/module_mogo_och_bus_station_v_green_dash.xml new file mode 100644 index 0000000000..d184a7bf11 --- /dev/null +++ b/OCH/mogo-och-bus/src/main/res/drawable/module_mogo_och_bus_station_v_green_dash.xml @@ -0,0 +1,9 @@ + + + + + + \ No newline at end of file diff --git a/OCH/mogo-och-bus/src/main/res/layout/fragment_och_bus.xml b/OCH/mogo-och-bus/src/main/res/layout/fragment_och_bus.xml index 0e51a45408..78888b54d8 100644 --- a/OCH/mogo-och-bus/src/main/res/layout/fragment_och_bus.xml +++ b/OCH/mogo-och-bus/src/main/res/layout/fragment_och_bus.xml @@ -1,19 +1,58 @@ - + android:layout_height="@dimen/module_mogo_och_bus_station_panel_height" + android:background="#FF2C3862"> + + android:layout_marginStart="@dimen/module_mogo_och_bus_station_panel_guide_offset_left" + android:layout_marginTop="@dimen/module_mogo_och_bus_station_panel_padding_top" + android:text="顺义政府站" + android:textColor="@color/module_mogo_och_bus_current_station_name_text_color" + android:textSize="@dimen/module_mogo_och_bus_current_station_name_text_size" + app:layout_constraintLeft_toLeftOf="@id/vGuide" + app:layout_constraintTop_toTopOf="parent" /> + + + + + \ No newline at end of file diff --git a/OCH/mogo-och-bus/src/main/res/layout/item_och_bus_station.xml b/OCH/mogo-och-bus/src/main/res/layout/item_och_bus_station.xml new file mode 100644 index 0000000000..9e953e0753 --- /dev/null +++ b/OCH/mogo-och-bus/src/main/res/layout/item_och_bus_station.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/OCH/mogo-och-bus/src/main/res/values/colors.xml b/OCH/mogo-och-bus/src/main/res/values/colors.xml new file mode 100644 index 0000000000..b2dbac5862 --- /dev/null +++ b/OCH/mogo-och-bus/src/main/res/values/colors.xml @@ -0,0 +1,9 @@ + + + #FF1FA7FF + #FFFFFFFF + #FFFFFFFF + #FF51649D + #FF8299EB + + \ No newline at end of file diff --git a/OCH/mogo-och-bus/src/main/res/values/dimens.xml b/OCH/mogo-och-bus/src/main/res/values/dimens.xml index 2a67585b14..3e8dc4658a 100644 --- a/OCH/mogo-och-bus/src/main/res/values/dimens.xml +++ b/OCH/mogo-och-bus/src/main/res/values/dimens.xml @@ -1,7 +1,25 @@ - 24px 464px - 310px + 348px + + 32px + 20px + 26px + 20px + + 15px + + 20px + 36px + 28px + 36px + + 3px + 3px + 17px + 17px + + \ No newline at end of file diff --git a/OCH/mogo-och/src/main/res/layout/module_mogo_och_base_fragment.xml b/OCH/mogo-och/src/main/res/layout/module_mogo_och_base_fragment.xml index 06495b6018..251f80379c 100644 --- a/OCH/mogo-och/src/main/res/layout/module_mogo_och_base_fragment.xml +++ b/OCH/mogo-och/src/main/res/layout/module_mogo_och_base_fragment.xml @@ -16,19 +16,6 @@ app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintTop_toTopOf="parent" /> - - - - - - - - - - - - -