调整
This commit is contained in:
@@ -76,6 +76,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.AppCompatButton;
|
||||
import io.flutter.plugin.platform.PlatformView;
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
@@ -204,6 +205,8 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
||||
|
||||
endInput = new TextView(context);
|
||||
endInput.setHint("请输入目的地,不输入则自动匹配推荐加氢站");
|
||||
endInput.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_search, 0, 0, 0);
|
||||
endInput.setCompoundDrawablePadding(dp2px(8));
|
||||
endInput.setTextSize(13);
|
||||
endInput.setTextColor(Color.parseColor("#333333"));
|
||||
endInput.setHintTextColor(Color.GRAY);
|
||||
@@ -248,8 +251,12 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
||||
View vSpace = new View(context);
|
||||
searchArea.addView(vSpace, new LinearLayout.LayoutParams(1, dp2px(12)));
|
||||
|
||||
Button planBtn = new Button(context);
|
||||
AppCompatButton planBtn = new AppCompatButton(context);
|
||||
planBtn.setText("规划路线");
|
||||
planBtn.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_path, 0, 0, 0);
|
||||
planBtn.setCompoundDrawablePadding(dp2px(4));
|
||||
planBtn.setGravity(Gravity.CENTER);
|
||||
planBtn.setPadding(dp2px(8), 0, dp2px(8), 0);
|
||||
planBtn.setTextColor(Color.WHITE);
|
||||
planBtn.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
planBtn.setBackground(getRoundedDrawable(Color.parseColor("#017143"), 99));
|
||||
@@ -377,8 +384,8 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
||||
row1.setOrientation(LinearLayout.HORIZONTAL);
|
||||
row1.setGravity(Gravity.CENTER_VERTICAL);
|
||||
row1.setPadding(0, dp2px(8), 0, 0); // 增加行间距
|
||||
tvDuration = createInfoItem(row1, R.drawable.ic_time, "预计时间:", "", 1.0f);
|
||||
tvTollsFuel = createInfoItem(row1, R.drawable.ic_fuel, "加氢费用:", "", 1.0f);
|
||||
tvDuration = createInfoItem(row1, R.drawable.ic_time, "预计时间:", "-", 1.0f);
|
||||
tvTollsFuel = createInfoItem(row1, R.drawable.ic_fuel, "加氢费用:", "-", 1.0f);
|
||||
routeInfoLayout.addView(row1);
|
||||
|
||||
// 第二行:里程 + 过路费
|
||||
@@ -388,9 +395,9 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
||||
row2.setPadding(0, dp2px(10), 0, 0); // 增加行间距
|
||||
|
||||
// 里程
|
||||
tvDistance = createInfoItem(row2, R.drawable.ic_mileage, "行驶里程:", "", 1.0f);
|
||||
tvDistance = createInfoItem(row2, R.drawable.ic_mileage, "行驶里程:", "-", 1.0f);
|
||||
// 过路费
|
||||
tvTolls = createInfoItem(row2, R.drawable.ic_toll, "过路费:", "", 1.0f);
|
||||
tvTolls = createInfoItem(row2, R.drawable.ic_toll, "过路费:", "-", 1.0f);
|
||||
routeInfoLayout.addView(row2);
|
||||
|
||||
//第三行
|
||||
@@ -398,15 +405,15 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
||||
row3.setOrientation(LinearLayout.HORIZONTAL);
|
||||
row3.setGravity(Gravity.CENTER_VERTICAL);
|
||||
row3.setPadding(0, dp2px(8), 0, 0); // 增加行间距
|
||||
tvPerson = createInfoItem(row3, R.drawable.ic_person, "站联系人:", "", 1.0f);
|
||||
tvPrice = createInfoItem(row3, R.drawable.ic_price, "加氢价格:", "", 1.0f);
|
||||
tvPerson = createInfoItem(row3, R.drawable.ic_person, "站联系人:", "-", 1.0f);
|
||||
tvPrice = createInfoItem(row3, R.drawable.ic_price, "加氢价格:", "-", 1.0f);
|
||||
routeInfoLayout.addView(row3);
|
||||
|
||||
LinearLayout row4 = new LinearLayout(context);
|
||||
row4.setOrientation(LinearLayout.HORIZONTAL);
|
||||
row4.setGravity(Gravity.CENTER_VERTICAL);
|
||||
row4.setPadding(0, dp2px(8), 0, 0); // 增加行间距
|
||||
tvPhone = createInfoItem(row4, R.drawable.ic_phone, "联系方式:", "", 1.0f);
|
||||
tvPhone = createInfoItem(row4, R.drawable.ic_phone, "联系方式:", "-", 1.0f);
|
||||
routeInfoLayout.addView(row4);
|
||||
|
||||
|
||||
@@ -431,6 +438,7 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
||||
searchArea.setVisibility(View.VISIBLE);
|
||||
planToggleBtn.setVisibility(View.VISIBLE);
|
||||
mLocBtn.setVisibility(View.VISIBLE);
|
||||
|
||||
}
|
||||
|
||||
private boolean isGetInputtips = false;
|
||||
@@ -449,6 +457,8 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
||||
//如果是输入地址提示内容
|
||||
|
||||
if (isGetInputtips) {
|
||||
truckRouteData = null;
|
||||
|
||||
RouteSearch.FromAndTo fromAndTo = new RouteSearch.FromAndTo(new LatLonPoint(startPoint.latitude, startPoint.longitude), new LatLonPoint(endPoint.latitude, endPoint.longitude));
|
||||
RouteSearch.DriveRouteQuery query = new RouteSearch.DriveRouteQuery(fromAndTo, RouteSearch.DRIVING_SINGLE_DEFAULT, null, null, "");
|
||||
routeSearch.calculateDriveRouteAsyn(query);
|
||||
@@ -478,6 +488,11 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
||||
String liaisonPhone = "-";
|
||||
String startBusiness = "-";
|
||||
String endBusiness = "-";
|
||||
double distanceKm = 0;
|
||||
String distanceKmStr = "-";
|
||||
long durationMin = 0;
|
||||
String durationMinStr = "-";
|
||||
String tolls = "-";
|
||||
|
||||
if (rCode == AMapException.CODE_AMAP_SUCCESS && result != null && !result.getPaths().isEmpty()) {
|
||||
|
||||
@@ -494,18 +509,20 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
||||
tvStationName.setText(endName);
|
||||
tvStationAddr.setText(endAddress);
|
||||
|
||||
DestinationSite destinationSite = truckRouteData.destinationSite;
|
||||
|
||||
PathDto pathDto = truckRouteData.pathDto;
|
||||
double distanceKm = 0;
|
||||
long durationMin = 0;
|
||||
String tolls = "-";
|
||||
if (pathDto != null) {
|
||||
distanceKm = pathDto.distance / 1000f;
|
||||
durationMin = pathDto.duration / 60;
|
||||
tolls = pathDto.tolls + "元";
|
||||
if (truckRouteData != null) {
|
||||
PathDto pathDto = truckRouteData.pathDto;
|
||||
if (pathDto != null) {
|
||||
distanceKm = pathDto.distance / 1000f;
|
||||
durationMin = pathDto.duration / 60;
|
||||
tolls = pathDto.tolls + "元";
|
||||
|
||||
distanceKmStr = String.format("%.1f", distanceKm) + "公里";
|
||||
durationMinStr = durationMin + "分钟";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 增加多级非空校验,防止点击搜索条目时崩溃
|
||||
if (truckRouteData != null &&
|
||||
truckRouteData.algorithmPath != null &&
|
||||
@@ -515,26 +532,31 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
||||
hydrogenCost = (isGetInputtips ? "--" : hydrogenCost) + "元";
|
||||
}
|
||||
|
||||
tvDuration.setText("预计时间:" + durationMin + "分钟");
|
||||
tvDistance.setText("行驶里程:" + String.format("%.1f", distanceKm) + "公里");
|
||||
tvDuration.setText("预计时间:" + durationMinStr);
|
||||
tvDistance.setText("行驶里程:" + distanceKmStr);
|
||||
tvTolls.setText("过路费:" + tolls);
|
||||
tvTollsFuel.setText("预计加氢费用:" + hydrogenCost);
|
||||
|
||||
if (destinationSite != null) {
|
||||
startBusiness = destinationSite.startBusiness;
|
||||
endBusiness = destinationSite.endBusiness;
|
||||
hydrogenPrice = destinationSite.hydrogenPrice;
|
||||
liaisonName = destinationSite.liaisonName;
|
||||
liaisonPhone = destinationSite.liaisonPhone;
|
||||
|
||||
if (truckRouteData != null) {
|
||||
DestinationSite destinationSite = truckRouteData.destinationSite;
|
||||
if (destinationSite != null) {
|
||||
startBusiness = destinationSite.startBusiness;
|
||||
endBusiness = destinationSite.endBusiness;
|
||||
hydrogenPrice = destinationSite.hydrogenPrice + "/L";
|
||||
liaisonName = destinationSite.liaisonName;
|
||||
liaisonPhone = destinationSite.liaisonPhone;
|
||||
//开始结束时间
|
||||
startBusiness = startBusiness + "-" + endBusiness;
|
||||
}
|
||||
}
|
||||
|
||||
tvBusinessHours.setText("营业时间:" + startBusiness + "-" + endBusiness);
|
||||
String displayValue = "";
|
||||
tvBusinessHours.setText("营业时间:" + startBusiness);
|
||||
if (liaisonName != null && liaisonName.length() > 5) {
|
||||
displayValue = liaisonName.substring(0, 5) + "...";
|
||||
liaisonName = liaisonName.substring(0, 5) + "...";
|
||||
}
|
||||
tvPerson.setText("站联系人:" + displayValue);
|
||||
tvPrice.setText("加氢价格:" + hydrogenPrice + "/L");
|
||||
tvPerson.setText("站联系人:" + liaisonName);
|
||||
tvPrice.setText("加氢价格:" + hydrogenPrice);
|
||||
tvPhone.setText("联系方式:" + liaisonPhone);
|
||||
|
||||
isGetInputtips = false;
|
||||
@@ -634,6 +656,11 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
||||
// 检查途径点数量,决定使用哪种导航方式
|
||||
int wayPointsCount = waysPoiIds.size();
|
||||
Log.d(TAG, "途经点数量: " + wayPointsCount);
|
||||
|
||||
//如果是输入地址提示内容,不判断途经点
|
||||
if (isGetInputtips) {
|
||||
wayPointsCount = 0;
|
||||
}
|
||||
if (wayPointsCount > 3) {
|
||||
// 途经点超过3个,跳转到 NavigationActivity
|
||||
Intent intent = new Intent(mContext, NavigationActivity.class);
|
||||
@@ -826,11 +853,13 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
||||
if (detailPanel != null && detailPanel.getVisibility() == View.VISIBLE) {
|
||||
resetView();
|
||||
}
|
||||
modeMenu.setVisibility(View.GONE);
|
||||
});
|
||||
aMap.setOnPOIClickListener(poi -> {
|
||||
if (detailPanel != null && detailPanel.getVisibility() == View.VISIBLE) {
|
||||
resetView();
|
||||
}
|
||||
modeMenu.setVisibility(View.GONE);
|
||||
});
|
||||
|
||||
MyLocationStyle myLocationStyle = new MyLocationStyle();
|
||||
@@ -1259,7 +1288,6 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
||||
TextView tv = new TextView(mContext);
|
||||
|
||||
|
||||
|
||||
tv.setText(label + value);
|
||||
|
||||
tv.setTextSize(12);
|
||||
@@ -1298,9 +1326,9 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
||||
TextView item3 = createMenuItem(context, "加氢规划模式", true);
|
||||
item3.setOnClickListener(v -> switchMode("加氢规划"));
|
||||
|
||||
menu.addView(item1);
|
||||
menu.addView(item2);
|
||||
menu.addView(item3);
|
||||
menu.addView(item2);
|
||||
menu.addView(item1);
|
||||
return menu;
|
||||
}
|
||||
|
||||
|
||||
BIN
ln_jq_app/android/app/src/main/res/drawable/ic_path.png
Normal file
BIN
ln_jq_app/android/app/src/main/res/drawable/ic_path.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 577 B |
BIN
ln_jq_app/android/app/src/main/res/drawable/ic_search.png
Normal file
BIN
ln_jq_app/android/app/src/main/res/drawable/ic_search.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 596 B |
Reference in New Issue
Block a user