[driver passenger ] bus 乘客屏站点UI处理

This commit is contained in:
wangmingjun
2022-04-24 15:34:37 +08:00
parent 75a7f09a9e
commit 6d25cf9ad4
11 changed files with 109 additions and 32 deletions

View File

@@ -28,6 +28,7 @@ public class BusPassengerLineStationsAdapter extends RecyclerView.Adapter<Recycl
private static final int LINE_START_STATION_ITEM = 0;
private static final int LINE_END_STATION_ITEM = 1;
private static final int LINE_MIDDLE_STATION_ITEM = 2;
private String preArrivingStation = "";
public BusPassengerLineStationsAdapter(Context context, List<BusPassengerStation> stations){
this.mContext = context;
@@ -57,41 +58,58 @@ public class BusPassengerLineStationsAdapter extends RecyclerView.Adapter<Recycl
BusPassengerStation station = mStations.get(position);
if (holder instanceof StartStationViewHolder){
StartStationViewHolder viewHolder = (StartStationViewHolder)holder;
viewHolder.startStationName.setText(station.getName());
if (!preArrivingStation.equals(station.getName())){
viewHolder.startStationName.setText(station.getName());
}
if (station.getDrivingStatus() == STATION_STATUS_STOPPED && !station.isLeaving()){//到站
viewHolder.curStationBg.setVisibility(View.VISIBLE);
viewHolder.stationCircle.setVisibility(View.GONE);
viewHolder.startStationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_current_station_txt_color));
viewHolder.startStationName.setSelected(true);
preArrivingStation = station.getName();
}else {
viewHolder.curStationBg.setVisibility(View.GONE);
viewHolder.stationCircle.setVisibility(View.VISIBLE);
viewHolder.startStationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_station_txt_color));
viewHolder.startStationName.setSelected(false);
}
}else if (holder instanceof EndStationViewHolder){
EndStationViewHolder viewHolder = (EndStationViewHolder)holder;
viewHolder.endStationName.setText(station.getName());
if (!preArrivingStation.equals(station.getName())){
viewHolder.endStationName.setText(station.getName());
}
BusPassengerStation preStation = mStations.get(position -1);
if ((preStation.getDrivingStatus() == STATION_STATUS_STOPPED && preStation.isLeaving())
|| (station.getDrivingStatus() == STATION_STATUS_STOPPED && !station.isLeaving())){//到站
viewHolder.curStationBg.setVisibility(View.VISIBLE);
viewHolder.stationCircle.setVisibility(View.GONE);
viewHolder.endStationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_current_station_txt_color));
viewHolder.endStationName.setSelected(true);
preArrivingStation = station.getName();
}else {
viewHolder.curStationBg.setVisibility(View.GONE);
viewHolder.stationCircle.setVisibility(View.VISIBLE);
viewHolder.endStationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_station_txt_color));
viewHolder.endStationName.setSelected(false);
}
}else {
MiddleStationViewHolder viewHolder = (MiddleStationViewHolder)holder;
viewHolder.middleStationName.setText(station.getName());
if (!preArrivingStation.equals(station.getName())){
viewHolder.middleStationName.setText(station.getName());
}
BusPassengerStation preStation = mStations.get(position -1);
if ((preStation.getDrivingStatus() == STATION_STATUS_STOPPED && preStation.isLeaving())
|| (station.getDrivingStatus() == STATION_STATUS_STOPPED && !station.isLeaving())) {//到站
viewHolder.curStationBg.setVisibility(View.VISIBLE);
viewHolder.middleStationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_current_station_txt_color));
viewHolder.stationCircle.setVisibility(View.GONE);
viewHolder.middleStationName.setSelected(true);
preArrivingStation = station.getName();
}else {
viewHolder.curStationBg.setVisibility(View.GONE);
viewHolder.middleStationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_station_txt_color));
viewHolder.stationCircle.setVisibility(View.VISIBLE);
viewHolder.middleStationName.setSelected(false);
}
}
}
@@ -144,9 +162,11 @@ class MiddleStationViewHolder extends RecyclerView.ViewHolder{
public TextView middleStationName;
public ImageView curStationBg;
public ImageView stationCircle;
public MiddleStationViewHolder(@NonNull View itemView) {
super(itemView);
middleStationName = itemView.findViewById(R.id.bus_p_middle_station);
curStationBg = itemView.findViewById(R.id.bus_p_middle_tag);
stationCircle = itemView.findViewById(R.id.bus_p_middle_circle);
}
}

View File

@@ -198,13 +198,13 @@ public class BusPassengerMapDirectionView
}
boundsBuilder.include(currentLatLng);
//第二个参数为四周留空宽度
mAMap.animateCamera(CameraUpdateFactory.newLatLngBoundsRect(boundsBuilder.build(),100,100,100,100));
mAMap.moveCamera(CameraUpdateFactory.newLatLngBoundsRect(boundsBuilder.build(),100,100,100,100));
}else {
//设置希望展示的地图缩放级别
CameraPosition cameraPosition = new CameraPosition.Builder()
.target(mCarMarker.getPosition()).tilt(0).bearing(location.getBearing()).zoom(zoomLevel).build();
mAMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
mAMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
}
}

View File

@@ -14,7 +14,6 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.amap.api.maps.model.LatLng;
import com.mogo.eagle.core.data.app.AppConfigInfo;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
@@ -36,7 +35,8 @@ import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS
* @date: 2022/4/12
*/
public class BusPassengerRouteFragment extends
BusPassengerBaseFragment<BusPassengerRouteFragment, BaseBusPassengerPresenter> implements IBusPassengerMapViewCallback {
BusPassengerBaseFragment<BusPassengerRouteFragment, BaseBusPassengerPresenter>
implements IBusPassengerMapViewCallback {
private final String TAG = "BusPassengerRouteFragment";
@@ -224,6 +224,10 @@ public class BusPassengerRouteFragment extends
mStationsList.addAll(stations);
mAdapter.notifyDataSetChanged();
if (currentStationIndex > -1){
updateCurrentStation(currentStationIndex);
}
if (currentStationIndex == 0 && isArrived){ //到达始发站且并未出发, 恢复站点marker 清楚路径 清空路径点
clearPolyline();
if (mMapDirectionView != null) mMapDirectionView.clearCoordinatesLatLng();
@@ -282,4 +286,10 @@ public class BusPassengerRouteFragment extends
int speedKM = (int) (Math.abs(speed) * 3.6F);
mSpeedTv.setText(String.valueOf(speedKM));
}
public void updateCurrentStation(int position) {
if (mStationsListRv != null){
mStationsListRv.smoothScrollToPosition(position);
}
}
}

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/bus_p_tag_line_color" />
<corners android:radius="@dimen/bus_p_station_circle_radius_size" />
</shape>

View File

@@ -53,13 +53,15 @@
<TextView
android:id="@+id/bus_p_cur_station_name"
android:layout_width="wrap_content"
android:layout_width="@dimen/bus_p_curent_station_txt_width"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:textColor="@color/bus_p_panel_cur_station_txt_color"
android:textSize="@dimen/bus_p_curent_station_txt_size1"
android:textStyle="bold"
android:text="-- --"
android:maxLines="1"
android:ellipsize="end"
android:elevation="@dimen/dp_10"
app:layout_constraintLeft_toLeftOf="@+id/bus_p_cur_station_title"
app:layout_constraintTop_toBottomOf="@+id/bus_p_cur_station_title" />

View File

@@ -145,10 +145,12 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/bus_p_line_stations_rl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/bus_p_driver_number_plate_margin_top"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_280"
android:paddingBottom="@dimen/dp_30"
android:paddingLeft="@dimen/bus_p_route_info_margin_left"
android:paddingRight="@dimen/bus_p_route_info_margin_right"
android:requiresFadingEdge="vertical"
app:layout_constraintLeft_toLeftOf="@+id/bus_p_driver_num_plate_tv"
app:layout_constraintTop_toBottomOf="@+id/dividing_line_2" />

View File

@@ -1,12 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/bus_p_station_item_height"
android:layout_height="wrap_content"
android:minHeight="@dimen/bus_p_station_item_height"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ImageView
android:layout_width="@dimen/bus_p_station_tag_line_width"
android:layout_height="@dimen/bus_p_station_tag_line_height"
android:layout_height="@dimen/bus_p_station_tag_line_height1"
android:background="@color/bus_p_tag_line_color"
android:layout_marginLeft="@dimen/dp_7"
app:layout_constraintTop_toTopOf="parent"
@@ -14,17 +15,21 @@
<TextView
android:id="@+id/bus_p_end_station"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="--"
android:textSize="@dimen/bus_p_station_txt_size"
android:textStyle="bold"
android:includeFontPadding = "false"
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:layout_marginRight="@dimen/dp_60"
android:textColor="@color/bus_p_station_txt_color"
android:layout_marginLeft="@dimen/dp_45"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@+id/bus_p_end_tag"
app:layout_constraintBottom_toBottomOf="@+id/bus_p_end_tag"/>
app:layout_constraintRight_toLeftOf="@+id/bus_p_end_tag"
app:layout_constraintBottom_toBottomOf="parent"/>
<ImageView
android:id="@+id/bus_p_end_circle"
@@ -38,9 +43,11 @@
android:id="@+id/bus_p_cur_end_station_tag"
android:layout_width="@dimen/bus_p_cur_station_circle_width"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:background="@drawable/bg_bus_p_arrived_station"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintBottom_toBottomOf="@+id/bus_p_end_station"/>
app:layout_constraintBottom_toBottomOf="@+id/bus_p_end_station"
app:layout_constraintTop_toTopOf="@+id/bus_p_end_station"/>
<ImageView
android:id="@+id/bus_p_end_tag"

View File

@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/bus_p_station_item_middle_height"
android:layout_height="wrap_content"
android:minHeight="@dimen/bus_p_station_item_middle_height"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ImageView
@@ -20,11 +21,17 @@
app:layout_constraintLeft_toLeftOf="parent"/>
<TextView
android:id="@+id/bus_p_middle_station"
android:layout_width="wrap_content"
android:layout_width="@dimen/bus_p_station_txt_width"
android:layout_height="wrap_content"
android:text="--"
android:textSize="@dimen/bus_p_station_txt_size"
android:textStyle="bold"
android:layout_marginTop="@dimen/dp_20"
android:layout_marginBottom="@dimen/dp_20"
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:layout_marginRight="@dimen/dp_60"
android:includeFontPadding = "false"
android:textColor="@color/bus_p_current_station_txt_color"
android:layout_marginLeft="@dimen/dp_45"
@@ -32,15 +39,23 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<ImageView
android:id="@+id/bus_p_middle_circle"
android:layout_width="@dimen/bus_p_station_circle_width_height"
android:layout_height="@dimen/bus_p_station_circle_width_height"
android:background="@drawable/bg_bus_p_middle_station_circle"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@+id/bus_p_middle_station"
app:layout_constraintBottom_toBottomOf="@+id/bus_p_middle_station"/>
<ImageView
android:id="@+id/bus_p_middle_tag"
android:layout_width="@dimen/bus_p_cur_station_circle_width"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:background="@drawable/bg_bus_p_arrived_station"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
app:layout_constraintTop_toTopOf="@+id/bus_p_middle_station"
app:layout_constraintBottom_toBottomOf="@+id/bus_p_middle_station"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1,12 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/bus_p_station_item_height"
android:layout_height="wrap_content"
android:minHeight="@dimen/bus_p_station_item_height"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ImageView
android:layout_width="@dimen/bus_p_station_tag_line_width"
android:layout_height="@dimen/bus_p_station_tag_line_height"
android:layout_height="@dimen/bus_p_station_tag_line_height1"
android:background="@color/bus_p_tag_line_color"
android:layout_marginLeft="@dimen/dp_7"
app:layout_constraintBottom_toBottomOf="parent"
@@ -14,17 +15,21 @@
<TextView
android:id="@+id/bus_p_start_station"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_45"
android:includeFontPadding="false"
android:text="--"
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:textColor="@color/bus_p_station_txt_color"
android:textSize="@dimen/bus_p_station_txt_size"
android:textStyle="bold"
android:includeFontPadding = "false"
android:textColor="@color/bus_p_station_txt_color"
android:layout_marginLeft="@dimen/dp_45"
android:layout_marginRight="@dimen/dp_60"
app:layout_constraintRight_toLeftOf="@+id/bus_p_start_tag"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@+id/bus_p_start_tag"
app:layout_constraintBottom_toBottomOf="@+id/bus_p_start_tag"/>
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/bus_p_start_circle"
@@ -39,9 +44,11 @@
android:id="@+id/bus_p_cur_start_station_tag"
android:layout_width="@dimen/bus_p_cur_station_circle_width"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:background="@drawable/bg_bus_p_arrived_station"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@+id/bus_p_start_station"/>
app:layout_constraintTop_toTopOf="@+id/bus_p_start_station"
app:layout_constraintBottom_toBottomOf="@+id/bus_p_start_station"/>
<ImageView
android:id="@+id/bus_p_start_tag"

View File

@@ -43,7 +43,8 @@
<dimen name="bus_p_station_tag_txt_size">36px</dimen>
<dimen name="bus_p_station_item_height">80px</dimen>
<dimen name="bus_p_station_item_middle_height">100px</dimen>
<dimen name="bus_p_station_tag_line_height">50px</dimen>
<dimen name="bus_p_station_tag_line_height">80px</dimen>
<dimen name="bus_p_station_tag_line_height1">60px</dimen>
<dimen name="bus_p_station_tag_line_width">6px</dimen>
<dimen name="bus_p_curent_station_panel_width">638px</dimen>
@@ -52,4 +53,7 @@
<dimen name="bus_p_curent_station_txt_size">44px</dimen>
<dimen name="bus_p_curent_station_txt_size1">55px</dimen>
<dimen name="bus_p_curent_station_tip_size1">40px</dimen>
<dimen name="bus_p_curent_station_txt_width">584px</dimen>
<dimen name="bus_p_station_txt_width">550px</dimen>
</resources>

View File

@@ -44,7 +44,8 @@
<dimen name="bus_p_station_tag_txt_size">36px</dimen>
<dimen name="bus_p_station_item_height">80px</dimen>
<dimen name="bus_p_station_item_middle_height">100px</dimen>
<dimen name="bus_p_station_tag_line_height">50px</dimen>
<dimen name="bus_p_station_tag_line_height">80px</dimen>
<dimen name="bus_p_station_tag_line_height1">60px</dimen>
<dimen name="bus_p_station_tag_line_width">6px</dimen>
<dimen name="bus_p_curent_station_panel_width">638px</dimen>
@@ -53,4 +54,7 @@
<dimen name="bus_p_curent_station_txt_size">44px</dimen>
<dimen name="bus_p_curent_station_txt_size1">55px</dimen>
<dimen name="bus_p_curent_station_tip_size1">40px</dimen>
<dimen name="bus_p_curent_station_txt_width">584px</dimen>
<dimen name="bus_p_station_txt_width">550px</dimen>
</resources>