Parcourir la source

1.修改Android Apex Drivers Detail没有位置信息图标显示。

Pen Li il y a 7 ans
Parent
commit
566cb011f1

+ 23 - 3
ApexDrivers/app/src/main/java/com/usai/redant/apexdrivers/detail/DetailAdapter.java

@@ -587,18 +587,38 @@ public class DetailAdapter extends BaseExpandableListAdapter {
                     String lat = model.getLat();
                     String lon = model.getLon();
                     boolean showMap = lat != null && lat.length() > 0 && lon != null && lon.length() > 0;
-                    mapBtn.setVisibility(showMap ? View.VISIBLE : View.GONE);
+
+                    if (showMap) {
+
+                        if (lat.equals("-999") && lon.equals("-999")) {
+
+                            mapBtn.setEnabled(false);
+                            mapBtn.setImageResource(R.drawable.btn_map_no);
+                        } else {
+
+                            mapBtn.setEnabled(true);
+                            mapBtn.setImageResource(R.drawable.btn_map);
+                        }
+
+                    } else {
+
+                        mapBtn.setEnabled(false);
+                        mapBtn.setImageResource(R.drawable.btn_map_no);
+                    }
+
 
                 } else {
 
                     titleTv.setText(null);
                     valueTv.setText(null);
-                    mapBtn.setVisibility(View.GONE);
+                    mapBtn.setEnabled(false);
+                    mapBtn.setImageResource(R.drawable.btn_map_no);
                 }
             } else {
                 titleTv.setText(null);
                 valueTv.setText(null);
-                mapBtn.setVisibility(View.GONE);
+                mapBtn.setEnabled(false);
+                mapBtn.setImageResource(R.drawable.btn_map_no);
             }
         }
     }

+ 6 - 2
ApexDrivers/app/src/main/java/com/usai/redant/apexdrivers/update/UpdateActivity.java

@@ -566,10 +566,14 @@ public class UpdateActivity extends BasicActivity implements UpdateAdapter.Updat
         }
         if (ApexDriverApplication.sharedApplication().getRequiredLocation()) {
             Location location = ApexDriverApplication.sharedApplication().getCurrentLocation();
+
+            String locationStr = null;
             if (location != null) {
-                String locationStr = location.getLatitude() + "," + location.getLongitude();
-                params.putString("location",locationStr);
+                locationStr = location.getLatitude() + "," + location.getLongitude();
+            } else {
+                locationStr = "-999,-999";
             }
+            params.putString("location",locationStr);
         }
 
         ArrayList<String> emptyArr = new ArrayList<>();