Procházet zdrojové kódy

字段搜索修改为全部可搜索

Bitliker před 7 roky
rodič
revize
7bb2d75e9a

+ 3 - 3
WeiChat/version.properties

@@ -1,5 +1,5 @@
-#Mon Jul 23 10:02:27 CST 2018
-debugName=518
+#Mon Jul 23 13:58:54 CST 2018
+debugName=519
 versionName=637
-debugCode=518
+debugCode=519
 versionCode=178

+ 28 - 31
app_modular/applocation/src/main/java/com/uas/applocation/base/NativeLocationManager.java

@@ -11,8 +11,6 @@ import android.location.LocationListener;
 import android.location.LocationManager;
 import android.location.LocationProvider;
 import android.os.Bundle;
-import android.os.Handler;
-import android.os.Looper;
 import android.support.v4.app.ActivityCompat;
 import android.text.TextUtils;
 import android.util.Log;
@@ -256,27 +254,27 @@ public class NativeLocationManager implements BaseLocationManager {
     }
 
 
-    /**
-     * 由于google收费,必须限制每天使用量
-     * 流程:
-     * 1.第一次进入直接进行搜索
-     */
-    private String lastKey;
-    private boolean isWhating, isResulting = false;
-    private Handler mWhatHandler = new Handler(Looper.getMainLooper());
-
-    private void startWhat(final Context ct, final OnSearchLocationListener mOnSearchLocationListener) {
-        if (!isWhating) {
-            isWhating = true;
-            mWhatHandler.postAtTime(new Runnable() {
-                @Override
-                public void run() {
-                    isWhating = false;
-                    loadByInput(ct, null, lastKey, mOnSearchLocationListener);
-                }
-            }, 1000);
-        }
-    }
+//    /**
+//     * 由于google收费,必须限制每天使用量
+//     * 流程:
+//     * 1.第一次进入直接进行搜索
+//     */
+//    private String lastKey;
+//    private boolean isWhating, isResulting = false;
+//    private Handler mWhatHandler = new Handler(Looper.getMainLooper());
+//
+//    private void startWhat(final Context ct, final OnSearchLocationListener mOnSearchLocationListener) {
+//        if (!isWhating) {
+//            isWhating = true;
+//            mWhatHandler.postAtTime(new Runnable() {
+//                @Override
+//                public void run() {
+//                    isWhating = false;
+//                    loadByInput(ct, null, lastKey, mOnSearchLocationListener);
+//                }
+//            }, 1000);
+//        }
+//    }
 
     /**
      * 通过输入进行搜索
@@ -289,13 +287,12 @@ public class NativeLocationManager implements BaseLocationManager {
     public void loadByInput(Context ct, String city, String keyWord, final OnSearchLocationListener mOnSearchLocationListener) {
         if (ct == null || mOnSearchLocationListener == null)
             return;
-
-        this.lastKey = keyWord;
-        if (isWhating || isResulting) {
-            startWhat(ct, mOnSearchLocationListener);
-            return;
-        }
-        isResulting = true;
+//        this.lastKey = keyWord;
+//        if (isWhating || isResulting) {
+//            startWhat(ct, mOnSearchLocationListener);
+//            return;
+//        }
+//        isResulting = true;
         HttpClient.Builder requestBuilder = new HttpClient.Builder()
                 .isDebug(true)
                 .url("textsearch/json")
@@ -319,7 +316,7 @@ public class NativeLocationManager implements BaseLocationManager {
                 } catch (Exception e) {
 
                 } finally {
-                    isResulting = false;
+//                    isResulting = false;
                 }
             }
 

+ 48 - 2
app_modular/applocation/src/main/java/com/uas/applocation/utils/AreaUtils.java

@@ -1,9 +1,12 @@
 package com.uas.applocation.utils;
 
+import android.app.PendingIntent;
 import android.content.Context;
+import android.content.Intent;
+import android.location.LocationManager;
+import android.net.Uri;
 import android.telephony.TelephonyManager;
 import android.text.TextUtils;
-import android.util.Log;
 
 import com.uas.applocation.model.UASLocation;
 
@@ -22,7 +25,9 @@ public class AreaUtils {
      */
     public static void initArea(Context context) {
         type = isChinaSimCard(context) ? UASLocation.TYPE_BAIDU : UASLocation.TYPE_NATIVE;
-        Log.i("gong","type="+type);
+        if(type==UASLocation.TYPE_NATIVE&&!isOPen(context)){
+            openGPS(context);
+        }
     }
 
     public static int getLocationServiceType() {
@@ -89,4 +94,45 @@ public class AreaUtils {
             return mcc.startsWith("460");
         }
     }
+
+
+    /**
+     * 判断GPS是否开启,GPS或者AGPS开启一个就认为是开启的
+     *
+     * @param context
+     * @return true 表示开启
+     */
+    public static final boolean isOPen(final Context context) {
+        LocationManager locationManager
+                = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
+        // 通过GPS卫星定位,定位级别可以精确到街(通过24颗卫星定位,在室外和空旷的地方定位准确、速度快)
+        boolean gps = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
+        // 通过WLAN或移动网络(3G/2G)确定的位置(也称作AGPS,辅助GPS定位。主要用于在室内或遮盖物(建筑群或茂密的深林等)密集的地方定位)
+        boolean network = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
+        if (gps || network) {
+            return true;
+        }
+
+        return false;
+    }
+
+    /**
+     * 强制帮用户打开GPS
+     *
+     * @param context
+     */
+    public static final void openGPS(Context context) {
+        Intent GPSIntent = new Intent();
+        GPSIntent.setClassName("com.android.settings",
+                "com.android.settings.widget.SettingsAppWidgetProvider");
+        GPSIntent.addCategory("android.intent.category.ALTERNATIVE");
+        GPSIntent.setData(Uri.parse("custom:3"));
+        try {
+            PendingIntent.getBroadcast(context, 0, GPSIntent, 0).send();
+        } catch (PendingIntent.CanceledException e) {
+            e.printStackTrace();
+        }
+    }
+
+
 }

+ 0 - 1
app_modular/appme/src/main/java/com/uas/appme/settings/activity/SettingActivity.java

@@ -286,7 +286,6 @@ public class SettingActivity extends SupportToolBarActivity implements View.OnCl
             language_us_rl.setVisibility(View.VISIBLE);
         }
 //        UserRoleUtils.checkUserRole(this,getRootView());
-
         doShowBSettingJudge();  //判断商家是不是管理员