Преглед изворни кода

Apex Mobile a191219

替换地图
去掉部分不再使用的框架和类
兼容Android 10
Ray Zhang пре 6 година
родитељ
комит
35ec43c04a

+ 6 - 1
ApexDrivers/RAUtilsLibrary/src/main/java/com/usai/redant/rautils/contactkit/ContactHelper.java

@@ -20,6 +20,7 @@ import com.usai.redant.rautils.contactkit.element.Photo;
 import com.usai.redant.rautils.contactkit.element.PostalAddress;
 import com.usai.redant.rautils.contactkit.element.SocialProfile;
 import com.usai.redant.rautils.contactkit.element.WebSite;
+import com.usai.redant.rautils.utils.RAUtil;
 
 import java.util.ArrayList;
 
@@ -544,6 +545,8 @@ public class ContactHelper {
         return null;
     }
 
+
+
     /**
      * 查询联系人
      * */
@@ -551,7 +554,9 @@ public class ContactHelper {
 
         if (keyword != null) {
 
-            Uri uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_FILTER_URI, keyword);
+
+            String test=RAUtil.encodeURIcomponent(keyword);
+            Uri uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_FILTER_URI, test);
             String[] projection = new String[]{
                     ContactsContract.Contacts._ID
             };

+ 28 - 0
ApexDrivers/RAUtilsLibrary/src/main/java/com/usai/redant/rautils/utils/RAUtil.java

@@ -44,6 +44,34 @@ import java.util.Set;
 import java.util.concurrent.atomic.AtomicInteger;
 
 public class RAUtil {
+
+
+    public static String encodeURIcomponent(String s)
+    {
+        StringBuilder o = new StringBuilder();
+        for (char ch : s.toCharArray()) {
+            if (isUnsafe(ch)) {
+                o.append('%');
+                o.append(toHex(ch/16));
+                o.append(toHex(ch % 16));
+            }
+            else o.append(ch);
+        }
+        return o.toString();
+    }
+
+    private static char toHex(int ch)
+    {
+        return (char)(ch <10? '0' + ch : 'A' + ch - 10);
+    }
+
+    private static boolean isUnsafe(char ch)
+    {
+        if (ch> 128 || ch <0)
+            return true;
+        return" %$&+,/:;=?@<>#%".indexOf(ch)>= 0;
+    }
+
     public static void LibTest2() {
         dbgUtil.Logd("RAUtilsLibrary", "LibTest1 aar update successful");
     }

+ 2 - 2
ApexDrivers/apexcrm/src/main/AndroidManifest.xml

@@ -73,8 +73,8 @@
 
             <intent-filter>
                 <action android:name="android.intent.action.BOOT_COMPLETED"/>
-                <!--<action android:name="android.intent.action.LOCKED_BOOT_COMPLETED"-->
-                    />
+                <!--<action android:name="android.intent.action.LOCKED_BOOT_COMPLETED"
+                    />-->
             </intent-filter>
 
         </receiver>

+ 16 - 13
ApexDrivers/apexdriverslib/build.gradle

@@ -23,21 +23,24 @@ android {
     }
     libraryVariants.all { variant ->
 //        if (variant.buildType.name == 'release') {
-        variant.assemble.doLast {
-            variant.outputs.each { output ->
-                def outputFile = output.outputFile
+        variant.getAssembleProvider().configure()
+                {
+                    it.doLast {
+                        variant.outputs.each { output ->
+                            def outputFile = output.outputFile
 //                    if (outputFile != null && outputFile.name.endsWith('release.aar')) {
-                def fileName = "${project.name}"
-                println(fileName)
-                def outputPath = "../output"
-                copy {
-                    from outputFile
-                    into outputPath
-                    rename { fileName + ".aar" }
-                }
+                            def fileName = "${project.name}"
+                            println(fileName)
+                            def outputPath = "../output"
+                            copy {
+                                from outputFile
+                                into outputPath
+                                rename { fileName + ".aar" }
+                            }
 //                    }
-            }
-        }
+                        }
+                    }
+                }
 //        }
     }
     gradle.projectsEvaluated {

+ 2 - 2
ApexDrivers/apexmap/src/main/java/redant/usai/com/apexmap/mapkit/ApexMapTileSource.java

@@ -8,7 +8,7 @@ public class ApexMapTileSource extends OnlineTileSourceBase {
 
     public static ApexMapTileSource defaultTileSource() {
 
-        ApexMapTileSource tileSource = new ApexMapTileSource("ApexTileNormal", 1, 18, 256, ".png", null);
+        ApexMapTileSource tileSource = new ApexMapTileSource("ApexTileNormal", 1, 19, 512, ".png", null);
         return tileSource;
     }
 
@@ -36,6 +36,6 @@ public class ApexMapTileSource extends OnlineTileSourceBase {
         int y = MapTileIndex.getY(pMapTileIndex);
         int z = MapTileIndex.getZoom(pMapTileIndex);
 
-        return String.format("https://map.apexshipping.com/osm_tiles/%d/%d/%d.png",z, x, y);
+        return String.format("https://map.apexshipping.com/osmhd/%d/%d/%d.png",z, x, y);
     }
 }

+ 17 - 9
ApexDrivers/apexmap/src/main/java/redant/usai/com/apexmap/mapkit/ApexMapView.java

@@ -79,14 +79,16 @@ public class ApexMapView extends MapView implements ApexMapLegalOverlay.LegalCli
         // 地图适应不同像素密度
         setTilesScaledToDpi(true);
 
-        // 主动修改瓦片缩放大小
-        float density = getResources().getDisplayMetrics().density;
-        if (density > 1) {
-            density = (density - 1) * 0.6f + 1;
-        } else {
-            density = 1;
-        }
-        int tile_size = (int) (density * 256);
+//        // 主动修改瓦片缩放大小
+//        float density = getResources().getDisplayMetrics().density;
+//        if (density > 1) {
+////            density = (density - 1) * 0.6f + 1;
+//            density = 1.2f;
+//        } else {
+//            density = 1;
+//        }
+//        int tile_size = (int) (density * 512);
+        int tile_size = 512;
         TileSystem.setTileSize(tile_size);
 
 
@@ -99,7 +101,7 @@ public class ApexMapView extends MapView implements ApexMapLegalOverlay.LegalCli
         getOverlays().add(mScaleBarOverlay);
 
         // 设置地图中心
-       setCenter(39.9074647400,116.3912822800); // 天安门
+//       setCenter(39.9074647400,116.3912822800); // 天安门
 
         setUseDataConnection(true);
 
@@ -183,7 +185,13 @@ public class ApexMapView extends MapView implements ApexMapLegalOverlay.LegalCli
             postInvalidate();
         }
     }
+    public void removeMarkers() {
 
+            getOverlays().clear();//添加marker到MapView
+            // 强制重绘,否则可能不显示,除非滑动地图
+            postInvalidate();
+
+    }
     public ApexMarkerInfoWindow addWindowInfoForMarker(Marker marker, Object attachment, ApexMarkerInfoWindow.ApexMarkerInfoWindowClickListener listener) {
         if (marker != null) {
             ApexMarkerInfoWindow infoWindow = new ApexMarkerInfoWindow(self, attachment);

+ 6 - 2
ApexDrivers/apexmap/src/main/java/redant/usai/com/apexmap/mapkit/ApexMarkerInfoWindow.java

@@ -28,10 +28,14 @@ public class ApexMarkerInfoWindow extends MarkerInfoWindow {
         initBubble();
     }
 
-    private ApexMarkerInfoWindow(int layoutResId, MapView mapView) {
+    public ApexMarkerInfoWindow(int layoutResId, MapView mapView) {
         super(layoutResId, mapView);
     }
-
+    public ApexMarkerInfoWindow init()
+    {
+        initBubble();
+        return this;
+    }
     private void initBubble() {
 
         mTitleTv = getView().findViewById(R.id.tv_title);

+ 1 - 1
ApexDrivers/build.gradle

@@ -7,7 +7,7 @@ buildscript {
         jcenter()
     }
     dependencies {
-        classpath 'com.android.tools.build:gradle:3.2.1'
+        classpath 'com.android.tools.build:gradle:3.5.3'
         
 
         // NOTE: Do not place your application dependencies here; they belong

+ 2 - 2
ApexDrivers/gradle/wrapper/gradle-wrapper.properties

@@ -1,6 +1,6 @@
-#Fri Jan 18 14:39:28 CST 2019
+#Thu Dec 12 15:30:24 CST 2019
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

+ 2 - 2
ApexDrivers/local.properties

@@ -4,5 +4,5 @@
 # Location of the SDK. This is only used by Gradle.
 # For customization when using a Version Control System, please read the
 # header note.
-#Tue Dec 04 09:00:14 CST 2018
-sdk.dir=/Users/ray/Library/Android/sdk
+#Thu Aug 29 10:19:02 CST 2019
+sdk.dir=/Users/ruizhang/Library/Android/sdk