Kaynağa Gözat

修复朋友圈权限问题

Bitliker 8 yıl önce
ebeveyn
işleme
10d4f368e1

+ 3 - 0
WeiChat/src/main/res/layout/empty_locayion.xml

@@ -12,9 +12,12 @@
         android:paddingBottom="10dp"/>
 
     <TextView
+        android:id="@+id/messageTv"
         android:layout_marginTop="10dp"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
+        android:layout_marginLeft="30dp"
+        android:layout_marginRight="30dp"
         android:layout_below="@id/empty_img"
         android:layout_centerHorizontal="true"
         android:text="@string/not_find_company_search" />

+ 79 - 75
app_core/common/src/main/java/com/core/db/SQLiteRawUtil.java

@@ -9,86 +9,90 @@ import java.util.List;
 
 /**
  * 对原生SQL语句的一些支持
- * 
+ *
  * @author dty
- * 
  */
 public class SQLiteRawUtil {
-	public static final String CHAT_MESSAGE_TABLE_PREFIX = "msg_";
-	public static String getCreateChatMessageTableSql(String tableName) {
-		String sql = "CREATE TABLE IF NOT EXISTS "
-				+ tableName
-				+ " (_id INTEGER PRIMARY KEY AUTOINCREMENT,type INTEGER NOT NULL,timeSend INTEGER NOT NULL,packetId VARCHAR NOT NULL,timeReceive INTEGER,fromUserId VARCHAR,fromUserName VARCHAR,isMySend SMALLINT,content VARCHAR,filePath VARCHAR,location_y VARCHAR,location_x VARCHAR,isRead SMALLINT,isUpload SMALLINT,isDownload SMALLINT,messageState INTEGER,timeLen INTEGER , fileSize INTEGER,objectId VARCHAR,sipStatus INTEGER,sipDuration INTEGER,cardId VARCHAR)";
-		return sql;
-	}
+    public static final String CHAT_MESSAGE_TABLE_PREFIX = "msg_";
 
-	public static void createTableIfNotExist(SQLiteDatabase db, String tableName, String createTableSql) {
-		if (isTableExist(db, tableName)) {
-			return;
-		}
-		db.execSQL(createTableSql);
-	}
+    public static String getCreateChatMessageTableSql(String tableName) {
+        String sql = "CREATE TABLE IF NOT EXISTS "
+                + tableName
+                + " (_id INTEGER PRIMARY KEY AUTOINCREMENT,type INTEGER NOT NULL,timeSend INTEGER NOT NULL,packetId VARCHAR NOT NULL,timeReceive INTEGER,fromUserId VARCHAR,fromUserName VARCHAR,isMySend SMALLINT,content VARCHAR,filePath VARCHAR,location_y VARCHAR,location_x VARCHAR,isRead SMALLINT,isUpload SMALLINT,isDownload SMALLINT,messageState INTEGER,timeLen INTEGER , fileSize INTEGER,objectId VARCHAR,sipStatus INTEGER,sipDuration INTEGER,cardId VARCHAR)";
+        return sql;
+    }
 
-	public static boolean isTableExist(SQLiteDatabase db, String tableName) {
-		boolean result = false;
-		if (TextUtils.isEmpty(tableName.trim())) {
-			return false;
-		}
-		Cursor cursor = null;
-		try {
-			String sql = "select count(*) as c from Sqlite_master  where type ='table' and name ='" + tableName.trim() + "' ";
-			cursor = db.rawQuery(sql, null);
-			if (cursor.moveToNext()) {
-				int count = cursor.getInt(0);
-				if (count > 0) {
-					result = true;
-				}
-			}
-		} catch (Exception e) {
-			e.printStackTrace();
-		} finally {
-			if (cursor != null) {
-				cursor.close();
-			}
-		}
-		return result;
-	}
+    public static void createTableIfNotExist(SQLiteDatabase db, String tableName, String createTableSql) {
+        if (isTableExist(db, tableName)) {
+            return;
+        }
+        db.execSQL(createTableSql);
+    }
 
-	public static void dropTable(SQLiteDatabase db, String tableName) {
-		String sql = "drop table " + tableName;
-		db.execSQL(sql);
-	}
+    public static boolean isTableExist(SQLiteDatabase db, String tableName) {
+        boolean result = false;
+        if (TextUtils.isEmpty(tableName.trim())) {
+            return false;
+        }
+        Cursor cursor = null;
+        try {
+            String sql = "select count(*) as c from Sqlite_master  where type ='table' and name ='" + tableName.trim() + "' ";
+            cursor = db.rawQuery(sql, null);
+            if (cursor.moveToNext()) {
+                int count = cursor.getInt(0);
+                if (count > 0) {
+                    result = true;
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if (cursor != null) {
+                cursor.close();
+            }
+        }
+        return result;
+    }
 
-	/**
-	 * 获取当前用户的消息表
-	 * 
-	 * @param db
-	 * @param
-	 * @return
-	 */
-	public static List<String> getUserChatMessageTables(SQLiteDatabase db, String ownerId) {
-		String tablePrefix = CHAT_MESSAGE_TABLE_PREFIX + ownerId;
-		Cursor cursor = null;
-		try {
-			String sql = "select name from Sqlite_master where type ='table' and name like '" + tablePrefix + "%'";
-			cursor = db.rawQuery(sql, null);
-			if (cursor != null) {
-				List<String> tables = new ArrayList<String>();
-				while (cursor.moveToNext()) {
-					String name = cursor.getString(0);
-					if (!TextUtils.isEmpty(name)) {
-						tables.add(name);
-					}
-				}
-				return tables;
-			}
-		} catch (Exception e) {
-			e.printStackTrace();
-		} finally {
-			if (cursor != null) {
-				cursor.close();
-			}
-		}
-		return null;
-	}
+    public static void dropTable(SQLiteDatabase db, String tableName) {
+        String sql = "drop table " + tableName;
+        try {
+            db.execSQL(sql);
+        } catch (Exception e) {
+
+        }
+    }
+
+    /**
+     * 获取当前用户的消息表
+     *
+     * @param db
+     * @param
+     * @return
+     */
+    public static List<String> getUserChatMessageTables(SQLiteDatabase db, String ownerId) {
+        String tablePrefix = CHAT_MESSAGE_TABLE_PREFIX + ownerId;
+        Cursor cursor = null;
+        try {
+            String sql = "select name from Sqlite_master where type ='table' and name like '" + tablePrefix + "%'";
+            cursor = db.rawQuery(sql, null);
+            if (cursor != null) {
+                List<String> tables = new ArrayList<String>();
+                while (cursor.moveToNext()) {
+                    String name = cursor.getString(0);
+                    if (!TextUtils.isEmpty(name)) {
+                        tables.add(name);
+                    }
+                }
+                return tables;
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if (cursor != null) {
+                cursor.close();
+            }
+        }
+        return null;
+    }
 }

+ 9 - 1
app_core/common/src/main/java/com/core/widget/view/Activity/SearchLocationActivity.java

@@ -6,6 +6,7 @@ import android.view.View;
 import android.widget.AdapterView;
 import android.widget.EditText;
 import android.widget.RelativeLayout;
+import android.widget.TextView;
 
 import com.baidu.mapapi.map.MapView;
 import com.baidu.mapapi.model.LatLng;
@@ -35,6 +36,7 @@ public class SearchLocationActivity extends OABaseActivity implements ISearchVie
     private SearchPresenter presenter;
     private SearchLocationAdapter mAdapter;
     private EmptyLayout mEmptyLayout;
+    private TextView messageTv;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -56,6 +58,7 @@ public class SearchLocationActivity extends OABaseActivity implements ISearchVie
         mEmptyLayout.setShowEmptyButton(false);
         mEmptyLayout.setShowErrorButton(false);
         mEmptyLayout.setEmptyViewRes(R.layout.empty_locayion);
+        messageTv = (TextView) mEmptyLayout.getEmptyView().findViewById(R.id.messageTv);
 
         presenter = new SearchPresenter(this);
         presenter.init(getIntent());
@@ -89,6 +92,9 @@ public class SearchLocationActivity extends OABaseActivity implements ISearchVie
     public void showPoiList(List<SearchLocationModel> models, String distanceTag) {
         if (ListUtils.isEmpty(models)) {
             mEmptyLayout.showEmpty();
+           if(messageTv!=null&& presenter.isHineOutSize()){
+               messageTv.setText("当前没有找到符合打卡的位置,请移步至打卡位置进行打卡!!");
+           }
         }
         if (mAdapter == null) {
             mAdapter = new SearchLocationAdapter(ct, models, distanceTag);
@@ -105,6 +111,8 @@ public class SearchLocationActivity extends OABaseActivity implements ISearchVie
     }
 
     public void showNotNetWork() {
-        ToastUtil.showToast(this,R.string.networks_out);
+        ToastUtil.showToast(this, R.string.networks_out);
     }
+
+
 }

+ 3 - 1
app_core/common/src/main/java/com/core/widget/view/HorizontalStepsView.java

@@ -74,7 +74,9 @@ public class HorizontalStepsView extends View {
         if (titles == null || progress > titles.length)
             new Exception("titles can not be null  or progress can not out of titles.length");
         this.progress = progress;
-        this.titles = titles;
+        if (titles.length>0){
+            this.titles = titles;
+        }
         invalidate();
 
     }

+ 11 - 2
app_core/common/src/main/java/com/core/widget/view/imp/SearchPresenter.java

@@ -179,16 +179,22 @@ public class SearchPresenter {
         BaiduMapUtil.getInstence().getNearInfo(radius, pageNum, location, listener);
     }
 
+
     /**
      * 获取完数据后进入显示,先进行排序
      *
      * @param chche
      */
     private void showData(List<SearchLocationModel> chche) {
+        List<SearchLocationModel> showModels = new ArrayList<>();
         if (!ListUtils.isEmpty(chche)) {
             for (int i = 0; i < chche.size(); i++) {
                 float distance = Float.valueOf(BaiduMapUtil.getInstence().getDistance(chche.get(i).getPoiInfo().location, param.getContrastLatLng()));
+
                 chche.get(i).setDistance(distance);
+                if (!param.isHineOutSize() || param.getShowRange() > distance) {
+                    showModels.add(chche.get(i));
+                }
             }
             Comparator<SearchLocationModel> comparator = new Comparator<SearchLocationModel>() {
                 public int compare(SearchLocationModel s1, SearchLocationModel s2) {
@@ -196,8 +202,11 @@ public class SearchPresenter {
                     return s1.getDistance() > s2.getDistance() ? 1 : -1;
                 }
             };
-            Collections.sort(chche, comparator);
+            Collections.sort(showModels, comparator);
         }
-        iSearchView.showPoiList(chche, param.getDistanceTag());
+        iSearchView.showPoiList(showModels, param.getDistanceTag());
+    }
+    public boolean isHineOutSize(){
+        return param.isHineOutSize();
     }
 }

+ 66 - 41
app_core/common/src/main/java/com/core/widget/view/model/SearchPoiParam.java

@@ -16,8 +16,8 @@ import com.core.app.MyApplication;
  * create by Bitliker 2017/2/23
  */
 public class SearchPoiParam implements Parcelable {
-    public static final int DEFAULT_RESULTCODE=0x51;
-    public static final String  DEFAULT_RESULTKEY="resultKey";
+    public static final int DEFAULT_RESULTCODE = 0x51;
+    public static final String DEFAULT_RESULTKEY = "resultKey";
 
     private boolean isShowSearchEdit;//是否显示搜索框
     private int resultCode;//返回码
@@ -31,6 +31,8 @@ public class SearchPoiParam implements Parcelable {
     private int radius;//搜索附近时候选择范围大小
     private String keyWork;//搜索名字位置时候位置名称
 
+    private boolean hineOutSize;
+    private float showRange;
 
     public SearchPoiParam() {
         isShowSearchEdit = true;
@@ -41,6 +43,8 @@ public class SearchPoiParam implements Parcelable {
         distanceTag = "m";
         title = "地址微调";
         radius = 200;
+        hineOutSize = false;
+        showRange = 1000;
         contrastLatLng = MyApplication.getInstance().getBdLocationHelper().getLocation();
     }
 
@@ -57,52 +61,25 @@ public class SearchPoiParam implements Parcelable {
         this.keyWork = keyWork;
     }
 
-    protected SearchPoiParam(Parcel in) {
-        isShowSearchEdit = in.readByte() != 0;
-        resultCode = in.readInt();
-        resultKey = in.readString();
-        riceTimes = in.readInt();
-        distanceTag = in.readString();
-        contrastLatLng = in.readParcelable(LatLng.class.getClassLoader());
-        title = in.readString();
-        type = in.readInt();
-        radius = in.readInt();
-        keyWork = in.readString();
+    public boolean isShowSearchEdit() {
+        return isShowSearchEdit;
     }
 
-    @Override
-    public void writeToParcel(Parcel dest, int flags) {
-        dest.writeByte((byte) (isShowSearchEdit ? 1 : 0));
-        dest.writeInt(resultCode);
-        dest.writeString(resultKey);
-        dest.writeInt(riceTimes);
-        dest.writeString(distanceTag);
-        dest.writeParcelable(contrastLatLng, flags);
-        dest.writeString(title);
-        dest.writeInt(type);
-        dest.writeInt(radius);
-        dest.writeString(keyWork);
+    public boolean isHineOutSize() {
+        return hineOutSize;
     }
 
-    @Override
-    public int describeContents() {
-        return 0;
+    public void setHineOutSize(boolean hineOutSize) {
+        this.hineOutSize = hineOutSize;
     }
 
-    public static final Creator<SearchPoiParam> CREATOR = new Creator<SearchPoiParam>() {
-        @Override
-        public SearchPoiParam createFromParcel(Parcel in) {
-            return new SearchPoiParam(in);
-        }
-
-        @Override
-        public SearchPoiParam[] newArray(int size) {
-            return new SearchPoiParam[size];
-        }
-    };
+    public float getShowRange() {
+        return showRange;
+    }
 
-    public boolean isShowSearchEdit() {
-        return isShowSearchEdit;
+    public void setShowRange(float showRange) {
+        this.hineOutSize = true;
+        this.showRange = showRange;
     }
 
     public void setShowSearchEdit(boolean showSearchEdit) {
@@ -180,4 +157,52 @@ public class SearchPoiParam implements Parcelable {
     public void setKeyWork(String keyWork) {
         this.keyWork = keyWork;
     }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel dest, int flags) {
+        dest.writeByte(this.isShowSearchEdit ? (byte) 1 : (byte) 0);
+        dest.writeInt(this.resultCode);
+        dest.writeString(this.resultKey);
+        dest.writeInt(this.riceTimes);
+        dest.writeString(this.distanceTag);
+        dest.writeParcelable(this.contrastLatLng, flags);
+        dest.writeString(this.title);
+        dest.writeInt(this.type);
+        dest.writeInt(this.radius);
+        dest.writeString(this.keyWork);
+        dest.writeByte(this.hineOutSize ? (byte) 1 : (byte) 0);
+        dest.writeFloat(this.showRange);
+    }
+
+    protected SearchPoiParam(Parcel in) {
+        this.isShowSearchEdit = in.readByte() != 0;
+        this.resultCode = in.readInt();
+        this.resultKey = in.readString();
+        this.riceTimes = in.readInt();
+        this.distanceTag = in.readString();
+        this.contrastLatLng = in.readParcelable(LatLng.class.getClassLoader());
+        this.title = in.readString();
+        this.type = in.readInt();
+        this.radius = in.readInt();
+        this.keyWork = in.readString();
+        this.hineOutSize = in.readByte() != 0;
+        this.showRange = in.readFloat();
+    }
+
+    public static final Creator<SearchPoiParam> CREATOR = new Creator<SearchPoiParam>() {
+        @Override
+        public SearchPoiParam createFromParcel(Parcel source) {
+            return new SearchPoiParam(source);
+        }
+
+        @Override
+        public SearchPoiParam[] newArray(int size) {
+            return new SearchPoiParam[size];
+        }
+    };
 }

+ 1 - 0
app_core/common/src/main/res/layout/empty_locayion.xml

@@ -12,6 +12,7 @@
         android:paddingBottom="10dp"/>
 
     <TextView
+        android:id="@+id/messageTv"
         android:layout_marginTop="10dp"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"

+ 18 - 18
app_modular/appcontact/src/main/java/com/uas/appcontact/ui/activity/ContactsActivity.java

@@ -106,7 +106,7 @@ public class ContactsActivity extends OABaseActivity implements ContactsAdapter.
     private boolean isSingleSelect = true;//true 单选  false 多选
     private String searchKey;
     private int allSelect = 0;
-    
+
     private LinearLayout include_tag;
 
 
@@ -139,16 +139,16 @@ public class ContactsActivity extends OABaseActivity implements ContactsAdapter.
         mlist = (PullToRefreshListView) findViewById(R.id.mList);
         all_sure_cb = (CheckBox) findViewById(R.id.all_sure_cb);
         mumber_tv = (TextView) findViewById(R.id.mumber_tv);
-        include_tag= (LinearLayout) findViewById(R.id.include_tag);
-        select_rl= (RelativeLayout) findViewById(R.id.select_rl);
+        include_tag = (LinearLayout) findViewById(R.id.include_tag);
+        select_rl = (RelativeLayout) findViewById(R.id.select_rl);
         voiceSearchView = (VoiceSearchView) findViewById(R.id.voiceSearchView);
         if (getIntent() != null) {
             type = getIntent().getIntExtra("type", 0);
             String title = getIntent().getStringExtra("title");
             isSingleSelect = getIntent().getBooleanExtra("isSingleSelect", true);
-            if(isSingleSelect){
+            if (isSingleSelect) {
                 select_rl.setVisibility(View.GONE);
-            }else{
+            } else {
                 select_rl.setVisibility(View.VISIBLE);
             }
             if (!StringUtil.isEmpty(title)) {
@@ -463,9 +463,9 @@ public class ContactsActivity extends OABaseActivity implements ContactsAdapter.
                 ThreadPool.getThreadPool().addTask(new Runnable() {
                     @Override
                     public void run() {
-                        List<ContactsModel> contacts=new ArrayList<>();
-                        for (ContactsModel model:lists){
-                            if ("0".equals(model.getImid())||StringUtil.isEmpty(model.getImid())){
+                        List<ContactsModel> contacts = new ArrayList<>();
+                        for (ContactsModel model : lists) {
+                            if ("0".equals(model.getImid()) || StringUtil.isEmpty(model.getImid())) {
                                 contacts.add(model);
                             }
                         }
@@ -474,7 +474,7 @@ public class ContactsActivity extends OABaseActivity implements ContactsAdapter.
                 });
                 boolean falg = !ListUtils.isEmpty(lists) && !isHasNet;
                 if (falg) {
-                    LogUtil.d("Test","取缓存数据:"+falg);
+                    LogUtil.d("Test", "取缓存数据:" + falg);
                     getStateByPhones(lists);
                     OAHttpHelper.getInstance().post(new Runnable() {
                         @Override
@@ -488,7 +488,7 @@ public class ContactsActivity extends OABaseActivity implements ContactsAdapter.
                                 mlist.onRefreshComplete();
                                 voiceSearchView.getSearch_edit().setHint(lists.size() + "位联系人");
                                 dimssLoading();
-                              
+
                             }
                         }
                     });
@@ -565,7 +565,7 @@ public class ContactsActivity extends OABaseActivity implements ContactsAdapter.
                     try {
                         hanlderAppQueryuserInThread(message);
                     } catch (Exception e) {
-                      
+
                     }
                 }
             }
@@ -895,9 +895,9 @@ public class ContactsActivity extends OABaseActivity implements ContactsAdapter.
                             "},");
                 }
             }
-         
+
             HttpClient httpClient = new HttpClient.Builder().url(Constants.IM_BASE_URL)
-                    .add("comParam","param")
+                    .add("comParam", "param")
                     .isDebug(true).build(true);
             httpClient.Api().send(new HttpClient.Builder()
                     .url("/user/appMobileContact")
@@ -911,11 +911,11 @@ public class ContactsActivity extends OABaseActivity implements ContactsAdapter.
 
                 @Override
                 public void onResponse(Object o) {
-                    LogUtil.prinlnLongMsg("HttpLogs",o.toString());
-                    LogUtil.d("HttpLogs","result:"+o.toString());
-                       if(JSONUtil.validate(o.toString())){
-                       
-                       }
+                    LogUtil.prinlnLongMsg("HttpLogs", o.toString());
+                    LogUtil.d("HttpLogs", "result:" + o.toString());
+                    if (JSONUtil.validate(o.toString())) {
+
+                    }
                 }
             }));
         }

+ 1 - 0
app_modular/appworks/src/main/java/com/uas/appworks/OA/erp/presenter/WorkPresenter.java

@@ -318,6 +318,7 @@ public class WorkPresenter implements OnHttpResultListener, IWorkPresenter {
         poiParam.setType(1);
         poiParam.setTitle(MyApplication.getInstance().getResources().getString(R.string.unoffice));
         poiParam.setRadius(300);
+        poiParam.setShowRange(companyLocation.getValidrange());
         poiParam.setContrastLatLng(new LatLng(companyLocation.getLocation().longitude, companyLocation.getLocation().latitude));
         poiParam.setResultCode(ADDRESS_CHANGE);
         poiParam.setDistanceTag(MyApplication.getInstance().getResources().getString(R.string.rice));