Răsfoiți Sursa

1.修改Android Apex Mobile地图当前位置选取。

Pen Li 8 ani în urmă
părinte
comite
764dd0601e

+ 15 - 0
Apex Mobile/app/src/main/java/com/usai/apex/DetailFragment.java

@@ -314,6 +314,20 @@ public class DetailFragment extends Fragment implements OnClickListener /*
 		outState.putInt("selectTrackingPosition",mSelectTrackingPosition);
 		outState.putInt("selectTrackingPosition",mSelectTrackingPosition);
 	}
 	}
 
 
+	private void configureMap(ShipMap map) {
+		if (map == null) {
+			return;
+		}
+
+		map.setShowCurrent(true);
+		map.setShowDestination(true);
+		map.setShowOrigin(true);
+		map.setShowPor(true);
+		map.setShowPoe(true);
+		map.setShowPod(true);
+		map.setShowPol(true);
+	}
+
 	@Override
 	@Override
 	public View onCreateView(LayoutInflater inflater, ViewGroup container,
 	public View onCreateView(LayoutInflater inflater, ViewGroup container,
 			Bundle savedInstanceState)
 			Bundle savedInstanceState)
@@ -328,6 +342,7 @@ public class DetailFragment extends Fragment implements OnClickListener /*
 		if(this.getArguments().getString("action_type").equals("Tracing")||this.getArguments().getString("action_type").equals("Tracking")) {
 		if(this.getArguments().getString("action_type").equals("Tracing")||this.getArguments().getString("action_type").equals("Tracking")) {
 			view = inflater.inflate(R.layout.detail_fragment_withmap, null);
 			view = inflater.inflate(R.layout.detail_fragment_withmap, null);
 			mTrackingMap = view.findViewById(R.id.tracking_map);
 			mTrackingMap = view.findViewById(R.id.tracking_map);
+			configureMap(mTrackingMap);
 		} else {
 		} else {
 			view = inflater.inflate(R.layout.detail_fragment, null);
 			view = inflater.inflate(R.layout.detail_fragment, null);
 			mTrackingMap = null;
 			mTrackingMap = null;

+ 45 - 21
Apex Mobile/app/src/main/java/com/usai/apex/ShipMap/ShipMap.java

@@ -135,9 +135,9 @@ public class ShipMap extends RelativeLayout implements GoogleMap.OnMarkerClickLi
         }
         }
     }
     }
 
 
-    private static int AnnotationDisplayPriorityRequired = 0;
+    private static int AnnotationDisplayPriorityRequired = 2;
     private static int AnnotationDisplayPriorityHigh= 1;
     private static int AnnotationDisplayPriorityHigh= 1;
-    private static int AnnotationDisplayPriorityLow = 2;
+    private static int AnnotationDisplayPriorityLow = 0;
 
 
     private JSONObject mAnnotation;
     private JSONObject mAnnotation;
 
 
@@ -159,8 +159,9 @@ public class ShipMap extends RelativeLayout implements GoogleMap.OnMarkerClickLi
         }
         }
         mAnnotation = null;
         mAnnotation = null;
 
 
+        JSONObject pol = annotation.optJSONObject("pol");
         if (showPol()) {
         if (showPol()) {
-            JSONObject pol = annotation.optJSONObject("pol");
+
             if (pol != null) {
             if (pol != null) {
                 try {
                 try {
                     pol.put("port","Port Of Load");
                     pol.put("port","Port Of Load");
@@ -169,32 +170,37 @@ public class ShipMap extends RelativeLayout implements GoogleMap.OnMarkerClickLi
                 }
                 }
                 handleLocation(pol,AnnotationDisplayPriorityHigh,R.drawable.new_location_pol);
                 handleLocation(pol,AnnotationDisplayPriorityHigh,R.drawable.new_location_pol);
             }
             }
-//            moveToLocation(pol);
         }
         }
-        if (showPoe()) {
-            JSONObject poe = annotation.optJSONObject("poe");
-            if (poe != null) {
+
+        JSONObject pod = annotation.optJSONObject("pod");
+        if (showPod()) {
+
+            if (pod != null) {
                 try {
                 try {
-                    poe.put("port","Place Of Deliver");
+                    pod.put("port","Port Of Discharge");
                 } catch (JSONException e) {
                 } catch (JSONException e) {
                     e.printStackTrace();
                     e.printStackTrace();
                 }
                 }
-                handleLocation(poe,AnnotationDisplayPriorityLow,R.drawable.new_location_poe);
+                handleLocation(pod,AnnotationDisplayPriorityHigh,R.drawable.new_location_pod);
             }
             }
         }
         }
-        if (showPod()) {
-            JSONObject pod = annotation.optJSONObject("pod");
-            if (pod != null) {
+
+        JSONObject poe = annotation.optJSONObject("poe");
+        if (showPoe()) {
+
+            if (poe != null) {
                 try {
                 try {
-                    pod.put("port","Port Of Discharge");
+                    poe.put("port","Place Of Deliver");
                 } catch (JSONException e) {
                 } catch (JSONException e) {
                     e.printStackTrace();
                     e.printStackTrace();
                 }
                 }
-                handleLocation(pod,AnnotationDisplayPriorityHigh,R.drawable.new_location_pod);
+                handleLocation(poe,AnnotationDisplayPriorityLow,R.drawable.new_location_poe);
             }
             }
         }
         }
+
+        JSONObject por = annotation.optJSONObject("por");
         if (showPor()) {
         if (showPor()) {
-            JSONObject por = annotation.optJSONObject("por");
+
             if (por != null) {
             if (por != null) {
                 try {
                 try {
                     por.put("port","Place Of Receipt");
                     por.put("port","Place Of Receipt");
@@ -204,8 +210,10 @@ public class ShipMap extends RelativeLayout implements GoogleMap.OnMarkerClickLi
                 handleLocation(por,AnnotationDisplayPriorityLow,R.drawable.new_location_por);
                 handleLocation(por,AnnotationDisplayPriorityLow,R.drawable.new_location_por);
             }
             }
         }
         }
+
+        JSONObject origin = annotation.optJSONObject("origin");
         if (showOrigin()) {
         if (showOrigin()) {
-            JSONObject origin = annotation.optJSONObject("origin");
+
             if (origin != null) {
             if (origin != null) {
                 try {
                 try {
                     origin.put("port","Origin");
                     origin.put("port","Origin");
@@ -215,8 +223,10 @@ public class ShipMap extends RelativeLayout implements GoogleMap.OnMarkerClickLi
                 handleLocation(origin,AnnotationDisplayPriorityLow,R.drawable.new_location_origin);
                 handleLocation(origin,AnnotationDisplayPriorityLow,R.drawable.new_location_origin);
             }
             }
         }
         }
+
+        JSONObject destination = annotation.optJSONObject("destination");
         if (showDestination()) {
         if (showDestination()) {
-            JSONObject destination = annotation.optJSONObject("destination");
+
             if (destination != null) {
             if (destination != null) {
                 try {
                 try {
                     destination.put("port","Destination");
                     destination.put("port","Destination");
@@ -238,7 +248,15 @@ public class ShipMap extends RelativeLayout implements GoogleMap.OnMarkerClickLi
                 handleLocation(current,AnnotationDisplayPriorityRequired,R.drawable.ic_marker);
                 handleLocation(current,AnnotationDisplayPriorityRequired,R.drawable.ic_marker);
             }
             }
         }
         }
-        moveToLocation(current);
+
+
+        if (current != null && showCurrent()) {
+            moveToLocation(current);
+        } else if (pol != null && showPol()) {
+            moveToLocation(pol);
+        } else if (pod != null && showPod()) {
+            moveToLocation(pod);
+        }
 
 
     }
     }
 
 
@@ -307,11 +325,15 @@ public class ShipMap extends RelativeLayout implements GoogleMap.OnMarkerClickLi
                 addr = "";
                 addr = "";
             }
             }
 
 
-            mGoogleMap.addMarker(new com.google.android.gms.maps.model.MarkerOptions()
-                    .icon(com.google.android.gms.maps.model.BitmapDescriptorFactory.fromResource(imageId))
+            com.google.android.gms.maps.model.MarkerOptions options = new com.google.android.gms.maps.model.MarkerOptions();
+            options.icon(com.google.android.gms.maps.model.BitmapDescriptorFactory.fromResource(imageId))
                     .position(new com.google.android.gms.maps.model.LatLng(Double.parseDouble(latStr), Double.parseDouble(lonStr)))
                     .position(new com.google.android.gms.maps.model.LatLng(Double.parseDouble(latStr), Double.parseDouble(lonStr)))
                     .title(name)
                     .title(name)
-                    .snippet(port + " " + addr));
+                    .snippet(port + " " + addr);
+            options.zIndex(priority);
+
+            mGoogleMap.addMarker(options);
+
 
 
         } else {
         } else {
             return;
             return;
@@ -343,6 +365,8 @@ public class ShipMap extends RelativeLayout implements GoogleMap.OnMarkerClickLi
             extrainfo.putString("detail",port + " " + addr);
             extrainfo.putString("detail",port + " " + addr);
 
 
             MarkerOptions markeroption = new MarkerOptions().position(llA).icon(icon).zIndex(9).title(name).extraInfo(extrainfo).draggable(true);
             MarkerOptions markeroption = new MarkerOptions().position(llA).icon(icon).zIndex(9).title(name).extraInfo(extrainfo).draggable(true);
+            markeroption.zIndex(priority);
+
             mBaiduMap.getMap().addOverlay(markeroption);
             mBaiduMap.getMap().addOverlay(markeroption);
 
 
         } else {
         } else {

+ 15 - 0
Apex Mobile/app/src/main/java/com/usai/apex/mainframe/TrackingListFragment.java

@@ -555,6 +555,20 @@ TrackingListSearchResult searchresult	= new TrackingListSearchResult();
         return mShipMap;
         return mShipMap;
     }
     }
 
 
+    private void configureMap(ShipMap map) {
+        if (map == null) {
+            return;
+        }
+
+        map.setShowCurrent(true);
+        map.setShowDestination(true);
+        map.setShowOrigin(true);
+        map.setShowPor(true);
+        map.setShowPoe(true);
+        map.setShowPod(true);
+        map.setShowPol(true);
+    }
+
     @Override
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container,
     public View onCreateView(LayoutInflater inflater, ViewGroup container,
                              Bundle savedInstanceState) {
                              Bundle savedInstanceState) {
@@ -584,6 +598,7 @@ TrackingListSearchResult searchresult	= new TrackingListSearchResult();
 
 
             linearLayout.addView(shipMap,mapLayoutParams);
             linearLayout.addView(shipMap,mapLayoutParams);
 
 
+            configureMap(mShipMap);
         }
         }
 
 
         // ------------------------------------------------------------------
         // ------------------------------------------------------------------