Explorar o código

1.修改Android Apex Mobile地图图标。

Pen Li %!s(int64=8) %!d(string=hai) anos
pai
achega
cb529f7f49
Modificáronse 31 ficheiros con 67 adicións e 16 borrados
  1. 67 16
      Apex Mobile/app/src/main/java/com/usai/apex/ShipMap/ShipMap.java
  2. BIN=BIN
      Apex Mobile/app/src/main/res/drawable-hdpi/new_location_destination.png
  3. BIN=BIN
      Apex Mobile/app/src/main/res/drawable-hdpi/new_location_origin.png
  4. BIN=BIN
      Apex Mobile/app/src/main/res/drawable-hdpi/new_location_pod.png
  5. BIN=BIN
      Apex Mobile/app/src/main/res/drawable-hdpi/new_location_poe.png
  6. BIN=BIN
      Apex Mobile/app/src/main/res/drawable-hdpi/new_location_pol.png
  7. BIN=BIN
      Apex Mobile/app/src/main/res/drawable-hdpi/new_location_por.png
  8. BIN=BIN
      Apex Mobile/app/src/main/res/drawable-ldpi/new_location_destination.png
  9. BIN=BIN
      Apex Mobile/app/src/main/res/drawable-ldpi/new_location_origin.png
  10. BIN=BIN
      Apex Mobile/app/src/main/res/drawable-ldpi/new_location_pod.png
  11. BIN=BIN
      Apex Mobile/app/src/main/res/drawable-ldpi/new_location_poe.png
  12. BIN=BIN
      Apex Mobile/app/src/main/res/drawable-ldpi/new_location_pol.png
  13. BIN=BIN
      Apex Mobile/app/src/main/res/drawable-ldpi/new_location_por.png
  14. BIN=BIN
      Apex Mobile/app/src/main/res/drawable-mdpi/new_location_destination.png
  15. BIN=BIN
      Apex Mobile/app/src/main/res/drawable-mdpi/new_location_origin.png
  16. BIN=BIN
      Apex Mobile/app/src/main/res/drawable-mdpi/new_location_pod.png
  17. BIN=BIN
      Apex Mobile/app/src/main/res/drawable-mdpi/new_location_poe.png
  18. BIN=BIN
      Apex Mobile/app/src/main/res/drawable-mdpi/new_location_pol.png
  19. BIN=BIN
      Apex Mobile/app/src/main/res/drawable-mdpi/new_location_por.png
  20. BIN=BIN
      Apex Mobile/app/src/main/res/drawable-xhdpi/new_location_destination.png
  21. BIN=BIN
      Apex Mobile/app/src/main/res/drawable-xhdpi/new_location_origin.png
  22. BIN=BIN
      Apex Mobile/app/src/main/res/drawable-xhdpi/new_location_pod.png
  23. BIN=BIN
      Apex Mobile/app/src/main/res/drawable-xhdpi/new_location_poe.png
  24. BIN=BIN
      Apex Mobile/app/src/main/res/drawable-xhdpi/new_location_pol.png
  25. BIN=BIN
      Apex Mobile/app/src/main/res/drawable-xhdpi/new_location_por.png
  26. BIN=BIN
      Apex Mobile/app/src/main/res/drawable-xxhdpi/new_location_destination.png
  27. BIN=BIN
      Apex Mobile/app/src/main/res/drawable-xxhdpi/new_location_origin.png
  28. BIN=BIN
      Apex Mobile/app/src/main/res/drawable-xxhdpi/new_location_pod.png
  29. BIN=BIN
      Apex Mobile/app/src/main/res/drawable-xxhdpi/new_location_poe.png
  30. BIN=BIN
      Apex Mobile/app/src/main/res/drawable-xxhdpi/new_location_pol.png
  31. BIN=BIN
      Apex Mobile/app/src/main/res/drawable-xxhdpi/new_location_por.png

+ 67 - 16
Apex Mobile/app/src/main/java/com/usai/apex/ShipMap/ShipMap.java

@@ -36,6 +36,7 @@ import com.google.android.gms.maps.model.CameraPosition;
 import com.usai.apex.ApexTrackingApplication;
 import com.usai.apex.R;
 
+import org.json.JSONException;
 import org.json.JSONObject;
 
 public class ShipMap extends RelativeLayout implements GoogleMap.OnMarkerClickListener, BaiduMap.OnMarkerClickListener, GoogleMap.OnInfoWindowClickListener, OnMapReadyCallback, InfoWindow.OnInfoWindowClickListener {
@@ -161,45 +162,80 @@ public class ShipMap extends RelativeLayout implements GoogleMap.OnMarkerClickLi
         if (showPol()) {
             JSONObject pol = annotation.optJSONObject("pol");
             if (pol != null) {
-                handleLocation(pol,AnnotationDisplayPriorityHigh);
+                try {
+                    pol.put("port","Port Of Load");
+                } catch (JSONException e) {
+                    e.printStackTrace();
+                }
+                handleLocation(pol,AnnotationDisplayPriorityHigh,R.drawable.new_location_pol);
             }
 //            moveToLocation(pol);
         }
         if (showPoe()) {
             JSONObject poe = annotation.optJSONObject("poe");
             if (poe != null) {
-                handleLocation(poe,AnnotationDisplayPriorityLow);
+                try {
+                    poe.put("port","Place Of Deliver");
+                } catch (JSONException e) {
+                    e.printStackTrace();
+                }
+                handleLocation(poe,AnnotationDisplayPriorityLow,R.drawable.new_location_poe);
             }
         }
         if (showPod()) {
             JSONObject pod = annotation.optJSONObject("pod");
             if (pod != null) {
-                handleLocation(pod,AnnotationDisplayPriorityHigh);
+                try {
+                    pod.put("port","Port Of Discharge");
+                } catch (JSONException e) {
+                    e.printStackTrace();
+                }
+                handleLocation(pod,AnnotationDisplayPriorityHigh,R.drawable.new_location_pod);
             }
         }
         if (showPor()) {
             JSONObject por = annotation.optJSONObject("por");
             if (por != null) {
-                handleLocation(por,AnnotationDisplayPriorityLow);
+                try {
+                    por.put("port","Place Of Receipt");
+                } catch (JSONException e) {
+                    e.printStackTrace();
+                }
+                handleLocation(por,AnnotationDisplayPriorityLow,R.drawable.new_location_por);
             }
         }
         if (showOrigin()) {
             JSONObject origin = annotation.optJSONObject("origin");
             if (origin != null) {
-                handleLocation(origin,AnnotationDisplayPriorityLow);
+                try {
+                    origin.put("port","Origin");
+                } catch (JSONException e) {
+                    e.printStackTrace();
+                }
+                handleLocation(origin,AnnotationDisplayPriorityLow,R.drawable.new_location_origin);
             }
         }
         if (showDestination()) {
             JSONObject destination = annotation.optJSONObject("destination");
             if (destination != null) {
-                handleLocation(destination,AnnotationDisplayPriorityLow);
+                try {
+                    destination.put("port","Destination");
+                } catch (JSONException e) {
+                    e.printStackTrace();
+                }
+                handleLocation(destination,AnnotationDisplayPriorityLow,R.drawable.new_location_destination);
             }
         }
 
         JSONObject current = annotation.optJSONObject("current");
         if (showCurrent()) {
             if (current != null) {
-                handleLocation(current,AnnotationDisplayPriorityRequired);
+                try {
+                    current.put("port","Current");
+                } catch (JSONException e) {
+                    e.printStackTrace();
+                }
+                handleLocation(current,AnnotationDisplayPriorityRequired,R.drawable.ic_marker);
             }
         }
         moveToLocation(current);
@@ -240,22 +276,23 @@ public class ShipMap extends RelativeLayout implements GoogleMap.OnMarkerClickLi
 
     }
 
-    private void handleLocation(JSONObject location,int priority) {
+    private void handleLocation(JSONObject location,int priority, int imageId) {
 
         if (location == null) {
             return;
         }
 
         if (mUseGoogleMap) {
-            handleGoogleLocation(location,priority);
+            handleGoogleLocation(location,priority,imageId);
         } else {
-            handleBaiduLocation(location,priority);
+            handleBaiduLocation(location,priority,imageId);
         }
 
     }
 
-    private void handleGoogleLocation(JSONObject location,int priority) {
+    private void handleGoogleLocation(JSONObject location,int priority, int imageId) {
 
+        String port = location.optString("port");
         String name = location.optString("name");
         String addr = location.optString("addr");
         String lonStr = location.optString("lon");
@@ -263,12 +300,18 @@ public class ShipMap extends RelativeLayout implements GoogleMap.OnMarkerClickLi
 
         if (lonStr != null && lonStr.length() > 0 && latStr != null && latStr.length() > 0) {
 
+            if (port == null) {
+                port = "";
+            }
+            if (addr == null) {
+                addr = "";
+            }
 
             mGoogleMap.addMarker(new com.google.android.gms.maps.model.MarkerOptions()
-                    .icon(com.google.android.gms.maps.model.BitmapDescriptorFactory.fromResource(R.drawable.ic_marker))
+                    .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)))
                     .title(name)
-                    .snippet(addr));
+                    .snippet(port + " " + addr));
 
         } else {
             return;
@@ -276,8 +319,9 @@ public class ShipMap extends RelativeLayout implements GoogleMap.OnMarkerClickLi
 
     }
 
-    private void handleBaiduLocation(JSONObject location,int priority) {
+    private void handleBaiduLocation(JSONObject location,int priority, int imageId) {
 
+        String port = location.optString("port");
         String name = location.optString("name");
         String addr = location.optString("addr");
         String lonStr = location.optString("lon");
@@ -285,11 +329,18 @@ public class ShipMap extends RelativeLayout implements GoogleMap.OnMarkerClickLi
 
         if (lonStr != null && lonStr.length() > 0 && latStr != null && latStr.length() > 0) {
 
+            if (port == null) {
+                port = "";
+            }
+            if (addr == null) {
+                addr = "";
+            }
+
             LatLng llA = new LatLng(Double.parseDouble(latStr), Double.parseDouble(lonStr));
-            BitmapDescriptor icon = BitmapDescriptorFactory.fromResource(R.drawable.ic_marker);
+            BitmapDescriptor icon = BitmapDescriptorFactory.fromResource(imageId);
 
             Bundle extrainfo = new Bundle();
-            extrainfo.putString("detail",addr);
+            extrainfo.putString("detail",port + " " + addr);
 
             MarkerOptions markeroption = new MarkerOptions().position(llA).icon(icon).zIndex(9).title(name).extraInfo(extrainfo).draggable(true);
             mBaiduMap.getMap().addOverlay(markeroption);

BIN=BIN
Apex Mobile/app/src/main/res/drawable-hdpi/new_location_destination.png


BIN=BIN
Apex Mobile/app/src/main/res/drawable-hdpi/new_location_origin.png


BIN=BIN
Apex Mobile/app/src/main/res/drawable-hdpi/new_location_pod.png


BIN=BIN
Apex Mobile/app/src/main/res/drawable-hdpi/new_location_poe.png


BIN=BIN
Apex Mobile/app/src/main/res/drawable-hdpi/new_location_pol.png


BIN=BIN
Apex Mobile/app/src/main/res/drawable-hdpi/new_location_por.png


BIN=BIN
Apex Mobile/app/src/main/res/drawable-ldpi/new_location_destination.png


BIN=BIN
Apex Mobile/app/src/main/res/drawable-ldpi/new_location_origin.png


BIN=BIN
Apex Mobile/app/src/main/res/drawable-ldpi/new_location_pod.png


BIN=BIN
Apex Mobile/app/src/main/res/drawable-ldpi/new_location_poe.png


BIN=BIN
Apex Mobile/app/src/main/res/drawable-ldpi/new_location_pol.png


BIN=BIN
Apex Mobile/app/src/main/res/drawable-ldpi/new_location_por.png


BIN=BIN
Apex Mobile/app/src/main/res/drawable-mdpi/new_location_destination.png


BIN=BIN
Apex Mobile/app/src/main/res/drawable-mdpi/new_location_origin.png


BIN=BIN
Apex Mobile/app/src/main/res/drawable-mdpi/new_location_pod.png


BIN=BIN
Apex Mobile/app/src/main/res/drawable-mdpi/new_location_poe.png


BIN=BIN
Apex Mobile/app/src/main/res/drawable-mdpi/new_location_pol.png


BIN=BIN
Apex Mobile/app/src/main/res/drawable-mdpi/new_location_por.png


BIN=BIN
Apex Mobile/app/src/main/res/drawable-xhdpi/new_location_destination.png


BIN=BIN
Apex Mobile/app/src/main/res/drawable-xhdpi/new_location_origin.png


BIN=BIN
Apex Mobile/app/src/main/res/drawable-xhdpi/new_location_pod.png


BIN=BIN
Apex Mobile/app/src/main/res/drawable-xhdpi/new_location_poe.png


BIN=BIN
Apex Mobile/app/src/main/res/drawable-xhdpi/new_location_pol.png


BIN=BIN
Apex Mobile/app/src/main/res/drawable-xhdpi/new_location_por.png


BIN=BIN
Apex Mobile/app/src/main/res/drawable-xxhdpi/new_location_destination.png


BIN=BIN
Apex Mobile/app/src/main/res/drawable-xxhdpi/new_location_origin.png


BIN=BIN
Apex Mobile/app/src/main/res/drawable-xxhdpi/new_location_pod.png


BIN=BIN
Apex Mobile/app/src/main/res/drawable-xxhdpi/new_location_poe.png


BIN=BIN
Apex Mobile/app/src/main/res/drawable-xxhdpi/new_location_pol.png


BIN=BIN
Apex Mobile/app/src/main/res/drawable-xxhdpi/new_location_por.png