调整
This commit is contained in:
@@ -61,7 +61,6 @@ import com.amap.api.services.geocoder.RegeocodeAddress;
|
||||
import com.amap.api.services.geocoder.RegeocodeQuery;
|
||||
import com.amap.api.services.geocoder.RegeocodeResult;
|
||||
import com.amap.api.services.route.BusRouteResult;
|
||||
import com.amap.api.services.route.DrivePath;
|
||||
import com.amap.api.services.route.DriveRouteResult;
|
||||
import com.amap.api.services.route.RideRouteResult;
|
||||
import com.amap.api.services.route.RouteSearch;
|
||||
@@ -473,9 +472,14 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
String hydrogenCost = "-"; // 默认显示横线
|
||||
String hydrogenPrice = "-"; // 默认显示横线
|
||||
String liaisonName = "-";
|
||||
String liaisonPhone = "-";
|
||||
String startBusiness = "-";
|
||||
String endBusiness = "-";
|
||||
|
||||
if (rCode == AMapException.CODE_AMAP_SUCCESS && result != null && !result.getPaths().isEmpty()) {
|
||||
DrivePath path = result.getPaths().get(0);
|
||||
|
||||
// 规划成功,显示详情面板,隐藏模式选择
|
||||
if (detailPanel != null)
|
||||
@@ -492,29 +496,29 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
||||
|
||||
DestinationSite destinationSite = truckRouteData.destinationSite;
|
||||
|
||||
double distanceKm = truckRouteData.pathDto.distance / 1000f;
|
||||
long durationMin = truckRouteData.pathDto.duration / 60;
|
||||
String tolls = truckRouteData.pathDto.tolls;
|
||||
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 + "元";
|
||||
}
|
||||
|
||||
String hydrogenCost = "-"; // 默认显示横线
|
||||
String hydrogenPrice = "-"; // 默认显示横线
|
||||
String liaisonName = "-";
|
||||
String liaisonPhone = "-";
|
||||
String startBusiness = "-";
|
||||
String endBusiness = "-";
|
||||
try {
|
||||
// 增加多级非空校验,防止点击搜索条目时崩溃
|
||||
if (truckRouteData != null &&
|
||||
truckRouteData.algorithmPath != null &&
|
||||
truckRouteData.algorithmPath.hydrogenCost != null &&
|
||||
!truckRouteData.algorithmPath.hydrogenCost.isEmpty()) {
|
||||
hydrogenCost = truckRouteData.algorithmPath.hydrogenCost;
|
||||
hydrogenCost = (isGetInputtips ? "--" : hydrogenCost) + "元";
|
||||
}
|
||||
|
||||
tvDuration.setText("预计时间:" + durationMin + "分钟");
|
||||
tvDistance.setText("行驶里程:" + String.format("%.1f", distanceKm) + "公里");
|
||||
tvTolls.setText("过路费:" + tolls + "元");
|
||||
tvTollsFuel.setText("预计加氢费用:" + (isGetInputtips ? "--" : hydrogenCost) + "元");
|
||||
tvTolls.setText("过路费:" + tolls);
|
||||
tvTollsFuel.setText("预计加氢费用:" + hydrogenCost);
|
||||
|
||||
if (destinationSite != null) {
|
||||
startBusiness = destinationSite.startBusiness;
|
||||
@@ -525,17 +529,19 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
||||
}
|
||||
|
||||
tvBusinessHours.setText("营业时间:" + startBusiness + "-" + endBusiness);
|
||||
tvPerson.setText("站联系人:" + liaisonName);
|
||||
tvPrice.setText("加氢价格:" + hydrogenPrice);
|
||||
String displayValue = "";
|
||||
if (liaisonName != null && liaisonName.length() > 5) {
|
||||
displayValue = liaisonName.substring(0, 5) + "...";
|
||||
}
|
||||
tvPerson.setText("站联系人:" + displayValue);
|
||||
tvPrice.setText("加氢价格:" + hydrogenPrice + "/L");
|
||||
tvPhone.setText("联系方式:" + liaisonPhone);
|
||||
|
||||
isGetInputtips = false;
|
||||
|
||||
aMap.animateCamera(CameraUpdateFactory.newLatLngZoom(endPoint, 13f));
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "获取加氢费用失败", e);
|
||||
}
|
||||
|
||||
} else {
|
||||
// 规划失败回退面板
|
||||
searchArea.setVisibility(View.VISIBLE);
|
||||
@@ -1251,9 +1257,13 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
||||
|
||||
// 文本内容
|
||||
TextView tv = new TextView(mContext);
|
||||
|
||||
|
||||
|
||||
tv.setText(label + value);
|
||||
tv.setTextSize(14);
|
||||
tv.setTextColor(Color.parseColor("#333333"));
|
||||
|
||||
tv.setTextSize(12);
|
||||
tv.setTextColor(Color.parseColor("#ff1d2129"));
|
||||
tv.setPadding(dp2px(6), 0, 0, 0);
|
||||
|
||||
LinearLayout.LayoutParams tvParams = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1.0f);
|
||||
@@ -1266,23 +1276,6 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
||||
return tv; // 返回TextView以便后续更新内容
|
||||
}
|
||||
|
||||
// 过载一个不需要weight的方法给第一行使用
|
||||
private TextView createInfoItem(LinearLayout parent, int iconRes, String label, String value) {
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
|
||||
ImageView iv = new ImageView(mContext);
|
||||
iv.setImageResource(iconRes);
|
||||
iv.setColorFilter(Color.parseColor("#017143"));
|
||||
parent.addView(iv, new LinearLayout.LayoutParams(dp2px(18), dp2px(18)));
|
||||
|
||||
TextView tv = new TextView(mContext);
|
||||
tv.setTextSize(14);
|
||||
tv.setTextColor(Color.parseColor("#333333"));
|
||||
tv.setPadding(dp2px(6), 0, 0, 0);
|
||||
parent.addView(tv, params);
|
||||
|
||||
return tv;
|
||||
}
|
||||
|
||||
// 创建模式菜单视图
|
||||
private View createModeMenu(Context context) {
|
||||
|
||||
@@ -181,7 +181,7 @@ static inline UIColor *AStationThemeGreen(void) {
|
||||
- (void)_buildUI {
|
||||
// ── 蒙层 ──
|
||||
UIControl *mask = [[UIControl alloc] init];
|
||||
mask.backgroundColor = [UIColor colorWithWhite:0 alpha:0.35];
|
||||
mask.backgroundColor = [UIColor colorWithWhite:0 alpha:0];
|
||||
[mask addTarget:self action:@selector(_onMaskTapped) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self addSubview:mask];
|
||||
self.maskControl = mask;
|
||||
|
||||
Reference in New Issue
Block a user