Kaynağa Gözat

Merge branch 'feature' of https://gitlab.com/Arisono/SkWeiChat-Baidu into developer

Arison 8 yıl önce
ebeveyn
işleme
c0703e78bd
33 değiştirilmiş dosya ile 1968 ekleme ve 1424 silme
  1. 4 4
      WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/message/MessageFragment.java
  2. 233 231
      app_core/common/src/main/java/com/common/ui/CameraUtil.java
  3. 12 0
      app_core/common/src/main/java/com/core/app/Constants.java
  4. 0 1
      app_core/common/src/main/res/layout/person_setting_activity.xml
  5. 938 847
      app_modular/appcontact/src/main/java/com/uas/appcontact/ui/activity/ContactsActivity.java
  6. 0 27
      app_modular/appme/src/main/java/com/uas/appme/pedometer/constant/Constant.java
  7. 3 3
      app_modular/appme/src/main/java/com/uas/appme/pedometer/service/StepService.java
  8. 2 2
      app_modular/appme/src/main/java/com/uas/appme/pedometer/utils/StepHttpUtils.java
  9. 4 5
      app_modular/appme/src/main/java/com/uas/appme/pedometer/utils/StepUtils.java
  10. 3 3
      app_modular/appme/src/main/java/com/uas/appme/pedometer/view/NewStepActivity.java
  11. 4 4
      app_modular/appme/src/main/java/com/uas/appme/pedometer/view/PersonalPageActivity.java
  12. 2 2
      app_modular/appme/src/main/java/com/uas/appme/pedometer/view/StepSplashActivity.java
  13. 2 2
      app_modular/appme/src/main/java/com/uas/appme/pedometer/view/UURanking.java
  14. 0 22
      app_modular/appme/src/main/java/com/uas/appme/settings/Constant/Constant.java
  15. 2 2
      app_modular/appme/src/main/java/com/uas/appme/settings/activity/BComSetCompanyRestActivity.java
  16. 3 3
      app_modular/appme/src/main/java/com/uas/appme/settings/activity/BComSetEmployeeRestActivity.java
  17. 1 2
      app_modular/appme/src/main/java/com/uas/appme/settings/activity/BRestActivity.java
  18. 29 6
      app_modular/appme/src/main/java/com/uas/appme/settings/activity/BSetComRestListActivity.java
  19. 2 2
      app_modular/appme/src/main/java/com/uas/appme/settings/activity/BSettingActivity.java
  20. 395 81
      app_modular/appme/src/main/java/com/uas/appme/settings/activity/BSettingLocationActivity.java
  21. 4 4
      app_modular/appme/src/main/java/com/uas/appme/settings/activity/BusinessHoursSetting.java
  22. 2 2
      app_modular/appme/src/main/java/com/uas/appme/settings/activity/ImageSettingActivity.java
  23. 8 4
      app_modular/appme/src/main/java/com/uas/appme/settings/activity/PersonSettingActivity.java
  24. 3 3
      app_modular/appme/src/main/java/com/uas/appme/settings/activity/PersonSettingListActivity.java
  25. 15 18
      app_modular/appme/src/main/java/com/uas/appme/settings/activity/SettingActivity.java
  26. 18 0
      app_modular/appme/src/main/java/com/uas/appme/settings/model/BSetLocationBean.java
  27. 40 1
      app_modular/appme/src/main/java/com/uas/appme/settings/model/BSettingPlaceBean.java
  28. 75 22
      app_modular/appme/src/main/res/layout/com_location_input_item.xml
  29. 50 24
      app_modular/appme/src/main/res/layout/com_location_item.xml
  30. 3 3
      app_modular/appme/src/main/res/layout/com_rest_item.xml
  31. 14 1
      app_modular/appme/src/main/res/layout/item_edit_location_pop.xml
  32. 6 2
      app_modular/appworks/src/main/java/com/uas/appworks/OA/erp/activity/ExpenseReimbursementActivity.java
  33. 91 91
      app_modular/appworks/src/main/java/com/uas/appworks/OA/erp/utils/approvautils/NodeAdapter.java

+ 4 - 4
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/message/MessageFragment.java

@@ -25,6 +25,7 @@ import com.common.preferences.PreferenceUtils;
 import com.common.system.DisplayUtil;
 import com.core.api.wxapi.ApiPlatform;
 import com.core.api.wxapi.ApiUtils;
+import com.core.app.Constants;
 import com.core.base.EasyFragment;
 import com.core.model.Friend;
 import com.core.utils.sortlist.BaseSortModel;
@@ -45,7 +46,6 @@ import com.modular.appmessages.model.MessageHeader;
 import com.modular.appmessages.presenter.MessagePresenter;
 import com.modular.appmessages.presenter.imp.IMessageView;
 import com.uas.appme.pedometer.view.UURanking;
-import com.uas.appme.settings.Constant.Constant;
 import com.xzjmyk.pm.activity.R;
 import com.xzjmyk.pm.activity.ui.platform.task.TaskActivity;
 import com.xzjmyk.pm.activity.ui.platform.task.TaskB2BActivity;
@@ -123,7 +123,7 @@ public class MessageFragment extends EasyFragment implements IMessageView, View.
 		presenter.loadData();
 	}
 
- 
+
 
 	private void initEvent() {
 		message_net_set.setOnClickListener(this);
@@ -173,7 +173,7 @@ public class MessageFragment extends EasyFragment implements IMessageView, View.
 	}
 
 
-	
+
 
 	private void showPopupWindow() {
 		if (setWindow == null) initPopupWindow();
@@ -252,7 +252,7 @@ public class MessageFragment extends EasyFragment implements IMessageView, View.
 				//				startActivity(new Intent(mContext, UUSportActivity.class));
 				startActivity(new Intent(mContext, UURanking.class));
 //				uustepRedtv.setVisibility(View.GONE);
-				PreferenceUtils.putBoolean(Constant.UU_STEP_RED, true);
+				PreferenceUtils.putBoolean(Constants.UU_STEP_RED, true);
 				break;
 		}
 

+ 233 - 231
app_core/common/src/main/java/com/common/ui/CameraUtil.java

@@ -1,5 +1,6 @@
 package com.common.ui;
 
+import android.annotation.TargetApi;
 import android.app.Activity;
 import android.content.ContentUris;
 import android.content.Context;
@@ -20,256 +21,257 @@ import java.io.File;
 
 
 public final class CameraUtil {
-    public static final int MEDIA_TYPE_IMAGE = 1;
-    public static final int MEDIA_TYPE_VIDEO = 2;
+	public static final int MEDIA_TYPE_IMAGE = 1;
+	public static final int MEDIA_TYPE_VIDEO = 2;
 
-    /**
-     * Create a file Uri for saving an image or video
-     *
-     * @param context
-     * @param type    the type of the file you want saved {@link #MEDIA_TYPE_IMAGE}
-     *                {@link #MEDIA_TYPE_VIDEO}
-     * @return return the uri of the file ,if create failed,return null
-     */
-    public static Uri getOutputMediaFileUri(Context context, String userId, int type) {
-        File file = getOutputMediaFile(context, userId, type);
-        if (file == null) {
-            return null;
-        }
-        return Uri.fromFile(file);
-    }
+	/**
+	 * Create a file Uri for saving an image or video
+	 *
+	 * @param context
+	 * @param type    the type of the file you want saved {@link #MEDIA_TYPE_IMAGE}
+	 *                {@link #MEDIA_TYPE_VIDEO}
+	 * @return return the uri of the file ,if create failed,return null
+	 */
+	public static Uri getOutputMediaFileUri(Context context, String userId, int type) {
+		File file = getOutputMediaFile(context, userId, type);
+		if (file == null) {
+			return null;
+		}
+		return Uri.fromFile(file);
+	}
 
-    /**
-     * Create a file for saving an image or video,is default in the
-     * ../Pictures/[you app PackageName] directory
-     *
-     * @param context
-     * @param type    the type of the file you want saved {@link #MEDIA_TYPE_IMAGE}
-     *                {@link #MEDIA_TYPE_VIDEO}
-     * @return return the file you create,if create failed,return null
-     */
-    private static File getOutputMediaFile(Context context, String userId, int type) {
-        String filePath = null;
-        if (type == MEDIA_TYPE_IMAGE) {
-            filePath = CacheFileUtil.getRandomImageFilePath(context);
+	/**
+	 * Create a file for saving an image or video,is default in the
+	 * ../Pictures/[you app PackageName] directory
+	 *
+	 * @param context
+	 * @param type    the type of the file you want saved {@link #MEDIA_TYPE_IMAGE}
+	 *                {@link #MEDIA_TYPE_VIDEO}
+	 * @return return the file you create,if create failed,return null
+	 */
+	private static File getOutputMediaFile(Context context, String userId, int type) {
+		String filePath = null;
+		if (type == MEDIA_TYPE_IMAGE) {
+			filePath = CacheFileUtil.getRandomImageFilePath(context);
 //			FileUtil.getRandomImageFilePath();
-        } else if (type == MEDIA_TYPE_VIDEO) {
-            filePath = CacheFileUtil.getRandomVideoFilePath(context, userId);
-        } else {
-            return null;
-        }
-        if (TextUtils.isEmpty(filePath)) {
-            return null;
-        } else {
-            return new File(filePath);
-        }
-    }
+		} else if (type == MEDIA_TYPE_VIDEO) {
+			filePath = CacheFileUtil.getRandomVideoFilePath(context, userId);
+		} else {
+			return null;
+		}
+		if (TextUtils.isEmpty(filePath)) {
+			return null;
+		} else {
+			return new File(filePath);
+		}
+	}
 
-    /**
-     * invoke the system Camera app and capture a image。 you can received the
-     * successed,you can use the outputUri to get the image
-     *
-     * @param activity
-     * @param outputUri   拍照后图片的存储路径
-     * @param requestCode
-     */
-    public static void captureImage(Activity activity, Uri outputUri, int requestCode) {
-        final Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
-        intent.putExtra(MediaStore.EXTRA_OUTPUT, outputUri);
-        activity.startActivityForResult(intent, requestCode);
-    }
+	/**
+	 * invoke the system Camera app and capture a image。 you can received the
+	 * successed,you can use the outputUri to get the image
+	 *
+	 * @param activity
+	 * @param outputUri   拍照后图片的存储路径
+	 * @param requestCode
+	 */
+	public static void captureImage(Activity activity, Uri outputUri, int requestCode) {
+		final Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
+		intent.putExtra(MediaStore.EXTRA_OUTPUT, outputUri);
+		activity.startActivityForResult(intent, requestCode);
+	}
 
-    /**
-     * 调用系统裁减功能,裁减某张指定的图片,并输出到指定的位置
-     *
-     * @param activity
-     * @param originalFileUri 原始图片位置
-     * @param outputFileUri   裁减后图片的输出位置,两个地址最好不一样。如果一样的话,有的手机上面无法保存裁减的结果
-     * @return
-     */
-    public static void cropImage(Activity activity, Uri originalFileUri, Uri outputFileUri, int requestCode, int aspectX, int aspectY, int outputX,
-                                 int outputY) {
-        if (originalFileUri == null) {
-            return;
-        }
-        final Intent intent = new Intent("com.android.camera.action.CROP");
-        intent.setDataAndType(originalFileUri, "image/*");
-        intent.putExtra("crop", "true");
-        intent.putExtra("aspectX", aspectX);
-        intent.putExtra("aspectY", aspectY);
-        intent.putExtra("outputX", outputX);
-        intent.putExtra("outputY", outputY);
+	/**
+	 * 调用系统裁减功能,裁减某张指定的图片,并输出到指定的位置
+	 *
+	 * @param activity
+	 * @param originalFileUri 原始图片位置
+	 * @param outputFileUri   裁减后图片的输出位置,两个地址最好不一样。如果一样的话,有的手机上面无法保存裁减的结果
+	 * @return
+	 */
+	public static void cropImage(Activity activity, Uri originalFileUri, Uri outputFileUri, int requestCode, int aspectX, int aspectY, int outputX,
+	                             int outputY) {
+		if (originalFileUri == null) {
+			return;
+		}
+		final Intent intent = new Intent("com.android.camera.action.CROP");
+		intent.setDataAndType(originalFileUri, "image/*");
+		intent.putExtra("crop", "true");
+		intent.putExtra("aspectX", aspectX);
+		intent.putExtra("aspectY", aspectY);
+		intent.putExtra("outputX", outputX);
+		intent.putExtra("outputY", outputY);
 
-        intent.putExtra("scale", true);
-        intent.putExtra("scaleUpIfNeeded", true); // 部分机型没有设置该参数截图会有黑边
-        intent.putExtra("return-data", false);
-        intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
-        intent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString());
-        // 不启用人脸识别
-        intent.putExtra("noFaceDetection", false);
-        activity.startActivityForResult(intent, requestCode);
-    }
+		intent.putExtra("scale", true);
+		intent.putExtra("scaleUpIfNeeded", true); // 部分机型没有设置该参数截图会有黑边
+		intent.putExtra("return-data", false);
+		intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
+		intent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString());
+		// 不启用人脸识别
+		intent.putExtra("noFaceDetection", false);
+		activity.startActivityForResult(intent, requestCode);
+	}
 
-    /**
-     * 调用系统图库选择照片 使用 {@link }方法从
-     * onActivityResult的data.getData()中解析获得的Uri
-     *
-     * @param activity
-     * @param requestCode
-     * @return
-     */
-    public static void pickImageSimple(Activity activity, int requestCode) {
-        Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
-        activity.startActivityForResult(intent, requestCode);
-    }
+	/**
+	 * 调用系统图库选择照片 使用 {@link }方法从
+	 * onActivityResult的data.getData()中解析获得的Uri
+	 *
+	 * @param activity
+	 * @param requestCode
+	 * @return
+	 */
+	public static void pickImageSimple(Activity activity, int requestCode) {
+		Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
+		activity.startActivityForResult(intent, requestCode);
+	}
 
-    /**
-     * 获得The data stream for the file
-     */
-    public static String getImagePathFromUri(Context context, Uri uri) {
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
-            if (DocumentsContract.isDocumentUri(context, uri)) {
-                return getImagePathFromUriKitkat(context, uri);
-            }
-        }
-        return getImagePathFromUriSimple(context, uri);
-    }
+	/**
+	 * 获得The data stream for the file
+	 */
+	public static String getImagePathFromUri(Context context, Uri uri) {
+		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
+			if (DocumentsContract.isDocumentUri(context, uri)) {
+				return getImagePathFromUriKitkat(context, uri);
+			}
+		}
+		return getImagePathFromUriSimple(context, uri);
+	}
 
-    /**
-     * 4.4以下
-     *
-     * @param context
-     * @param uri
-     */
-    private static String getImagePathFromUriSimple(Context context, Uri uri) {
-        String[] proj = {MediaStore.Images.Media.DATA};
-        Cursor cursor = context.getContentResolver().query(uri, proj, null, null, null);
-        int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
-        cursor.moveToFirst();
-        return cursor.getString(column_index);
-    }
+	/**
+	 * 4.4以下
+	 *
+	 * @param context
+	 * @param uri
+	 */
+	private static String getImagePathFromUriSimple(Context context, Uri uri) {
+		String[] proj = {MediaStore.Images.Media.DATA};
+		Cursor cursor = context.getContentResolver().query(uri, proj, null, null, null);
+		int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
+		cursor.moveToFirst();
+		return cursor.getString(column_index);
+	}
 
-    /**
-     * 4.4以上的Document Uri
-     *
-     * @param context
-     * @param uri
-     * @return
-     */
-    private static String getImagePathFromUriKitkat(Context context, Uri uri) {
-        String wholeID = DocumentsContract.getDocumentId(uri);
-        if (TextUtils.isEmpty(wholeID) || !wholeID.contains(":")) {
-            return null;
-        }
-        // 获得资源唯一ID
-        String id = wholeID.split(":")[1];
-        // 定义索引字段
-        String[] column = {MediaStore.Images.Media.DATA};
-        String sel = MediaStore.Images.Media._ID + "=?";
+	/**
+	 * 4.4以上的Document Uri
+	 *
+	 * @param context
+	 * @param uri
+	 * @return
+	 */
+	@TargetApi(Build.VERSION_CODES.KITKAT)
+	private static String getImagePathFromUriKitkat(Context context, Uri uri) {
+		String wholeID = DocumentsContract.getDocumentId(uri);
+		if (TextUtils.isEmpty(wholeID) || !wholeID.contains(":")) {
+			return null;
+		}
+		// 获得资源唯一ID
+		String id = wholeID.split(":")[1];
+		// 定义索引字段
+		String[] column = {MediaStore.Images.Media.DATA};
+		String sel = MediaStore.Images.Media._ID + "=?";
 
-        Cursor cursor = context.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, column, sel, new String[]{id}, null);
-        int columnIndex = cursor.getColumnIndex(column[0]);
+		Cursor cursor = context.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, column, sel, new String[]{id}, null);
+		int columnIndex = cursor.getColumnIndex(column[0]);
 
-        String filePath = null;
-        if (cursor.moveToFirst()) {
-            // DATA字段就是本地资源的全路径
-            filePath = cursor.getString(columnIndex);
-        }
-        // 切记要关闭游标
-        cursor.close();
-        return filePath;
-    }
+		String filePath = null;
+		if (cursor.moveToFirst()) {
+			// DATA字段就是本地资源的全路径
+			filePath = cursor.getString(columnIndex);
+		}
+		// 切记要关闭游标
+		cursor.close();
+		return filePath;
+	}
 
-    /**
-     * 调用系统图库选择照片,裁减后返回
-     * ,4.4上无法确定用户是否是在图库里选择的照片,所以不使用该方法,使用pickImageSimple,返回后在调用裁减
-     *
-     * @param activity    拍照后图片的存储路径
-     * @param requestCode
-     * @return
-     */
-    @Deprecated
-    public static void pickImageCrop(Activity activity, Uri outputUri, int requestCode, int aspectX, int aspectY, int outputX, int outputY) {
-        // Intent intent = new Intent(Intent.ACTION_GET_CONTENT, null);
-        Intent intent = new Intent();
-        // 根据版本号不同使用不同的Action
-        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
-            intent.setAction(Intent.ACTION_GET_CONTENT);
-        } else {
-            intent.setAction(Intent.ACTION_OPEN_DOCUMENT);
-            intent.addCategory(Intent.CATEGORY_OPENABLE);
-        }
+	/**
+	 * 调用系统图库选择照片,裁减后返回
+	 * ,4.4上无法确定用户是否是在图库里选择的照片,所以不使用该方法,使用pickImageSimple,返回后在调用裁减
+	 *
+	 * @param activity    拍照后图片的存储路径
+	 * @param requestCode
+	 * @return
+	 */
+	@Deprecated
+	public static void pickImageCrop(Activity activity, Uri outputUri, int requestCode, int aspectX, int aspectY, int outputX, int outputY) {
+		// Intent intent = new Intent(Intent.ACTION_GET_CONTENT, null);
+		Intent intent = new Intent();
+		// 根据版本号不同使用不同的Action
+		if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
+			intent.setAction(Intent.ACTION_GET_CONTENT);
+		} else {
+			intent.setAction(Intent.ACTION_OPEN_DOCUMENT);
+			intent.addCategory(Intent.CATEGORY_OPENABLE);
+		}
 
-        intent.setType("image/*");
-        intent.putExtra("crop", "true");
-        // 裁剪框比例
-        intent.putExtra("aspectX", aspectX);
-        intent.putExtra("aspectY", aspectY);
-        // 图片输出大小
-        intent.putExtra("outputX", outputX);
-        intent.putExtra("outputY", outputY);
-        intent.putExtra("scale", true);
-        intent.putExtra("scaleUpIfNeeded", true); // 部分机型没有设置该参数截图会有黑边
-        intent.putExtra("return-data", false);
-        intent.putExtra(MediaStore.EXTRA_OUTPUT, outputUri);
+		intent.setType("image/*");
+		intent.putExtra("crop", "true");
+		// 裁剪框比例
+		intent.putExtra("aspectX", aspectX);
+		intent.putExtra("aspectY", aspectY);
+		// 图片输出大小
+		intent.putExtra("outputX", outputX);
+		intent.putExtra("outputY", outputY);
+		intent.putExtra("scale", true);
+		intent.putExtra("scaleUpIfNeeded", true); // 部分机型没有设置该参数截图会有黑边
+		intent.putExtra("return-data", false);
+		intent.putExtra(MediaStore.EXTRA_OUTPUT, outputUri);
 
-        intent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString());
-        // 不启用人脸识别
-        intent.putExtra("noFaceDetection", false);
-        activity.startActivityForResult(intent, requestCode);
-    }
+		intent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString());
+		// 不启用人脸识别
+		intent.putExtra("noFaceDetection", false);
+		activity.startActivityForResult(intent, requestCode);
+	}
 
-    public static interface ScannerResult {
-        void onResult(boolean success);
-    }
+	public static interface ScannerResult {
+		void onResult(boolean success);
+	}
 
-    /**
-     * 扫描某张指定的图片放入系统媒体库
-     */
-    public static void scannerImage(Activity activity, final Uri fileUri, final ScannerResult scannerResult) {
-        if (fileUri == null) {
-            if (scannerResult != null) {
-                scannerResult.onResult(false);
-            }
-            return;
-        }
-        sMediaScannerConnection = new MediaScannerConnection(activity, new MediaScannerConnectionClient() {
-            public void onMediaScannerConnected() {
-                sMediaScannerConnection.scanFile(fileUri.getPath(), "image/*");
-            }
+	/**
+	 * 扫描某张指定的图片放入系统媒体库
+	 */
+	public static void scannerImage(Activity activity, final Uri fileUri, final ScannerResult scannerResult) {
+		if (fileUri == null) {
+			if (scannerResult != null) {
+				scannerResult.onResult(false);
+			}
+			return;
+		}
+		sMediaScannerConnection = new MediaScannerConnection(activity, new MediaScannerConnectionClient() {
+			public void onMediaScannerConnected() {
+				sMediaScannerConnection.scanFile(fileUri.getPath(), "image/*");
+			}
 
-            public void onScanCompleted(String path, Uri uri) {
-                sMediaScannerConnection.disconnect();
-                if (scannerResult != null) {
-                    scannerResult.onResult(uri != null);
-                }
-            }
-        });
-        sMediaScannerConnection.connect();
-    }
+			public void onScanCompleted(String path, Uri uri) {
+				sMediaScannerConnection.disconnect();
+				if (scannerResult != null) {
+					scannerResult.onResult(uri != null);
+				}
+			}
+		});
+		sMediaScannerConnection.connect();
+	}
 
-    private static MediaScannerConnection sMediaScannerConnection;
+	private static MediaScannerConnection sMediaScannerConnection;
 
-    /**
-     * 查询某张图片有没有被扫描到媒体库
-     *
-     * @param filePath
-     * @return 返回这个图片在媒体库的Uri,如果没有扫描到媒体库,则返回null
-     */
-    public static Uri isImageFileInMedia(Context context, String filePath) {
-        File file = new File(filePath);
-        if (!file.exists()) {
-            return null;
-        }
-        Cursor cursor = context.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, null,
-                MediaStore.Images.Media.DISPLAY_NAME + "='" + file.getName() + "'", null, null);
-        Uri uri = null;
-        if (cursor != null && cursor.getCount() > 0) {
-            cursor.moveToLast();
-            long id = cursor.getLong(0);
-            uri = ContentUris.withAppendedId(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, id);
-        }
-        return uri;
-    }
+	/**
+	 * 查询某张图片有没有被扫描到媒体库
+	 *
+	 * @param filePath
+	 * @return 返回这个图片在媒体库的Uri,如果没有扫描到媒体库,则返回null
+	 */
+	public static Uri isImageFileInMedia(Context context, String filePath) {
+		File file = new File(filePath);
+		if (!file.exists()) {
+			return null;
+		}
+		Cursor cursor = context.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, null,
+				MediaStore.Images.Media.DISPLAY_NAME + "='" + file.getName() + "'", null, null);
+		Uri uri = null;
+		if (cursor != null && cursor.getCount() > 0) {
+			cursor.moveToLast();
+			long id = cursor.getLong(0);
+			uri = ContentUris.withAppendedId(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, id);
+		}
+		return uri;
+	}
 
 }

+ 12 - 0
app_core/common/src/main/java/com/core/app/Constants.java

@@ -394,4 +394,16 @@ public class Constants {
 
     public static final String ACTION_LOCATION_CHANGE = "action_location_Change";//位置改变发送广播
     public static final String ACTION_WORK_SIGNIN = "action_work_signin";//当时间合理的时候回调计算内勤打卡
+
+
+    //设置计步相关迁移
+    public static String BAIDU_PUSH = "BAIDUPUSH";
+    public static String UU_STEP = "UUSTEP";
+    public static String B_SETTINGRED = "B_SETTINGRED";
+    public static String UU_STEP_RED = "UU_STEP_RED";
+    public static final int MSG_FROM_CLIENT = 0;
+    public static final int MSG_FROM_SERVER = 1;
+    public static final String BASEURL = "http://news-at.zhihu.com/api/4/";
+    public static final String START = "start-image/1080*1776";
+    public static String BASE_STEP_URL = "http://113.105.74.140:8092/user/";
 }

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

@@ -201,7 +201,6 @@
                     android:background="@null"
                     android:hint="@string/common_input1"
                     android:textSize="15sp"
-                    android:inputType="number"
                     android:gravity="center_vertical|right"
                     android:layout_marginLeft="5dp"
                     whatever:testType="regexp"

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

@@ -82,6 +82,9 @@ import com.uas.appcontact.model.contacts.ContactsModel;
 import com.uas.appcontact.utils.ContactsUtils;
 
 import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.List;
@@ -89,861 +92,949 @@ import java.util.Map;
 
 public class ContactsActivity extends OABaseActivity implements ContactsAdapter.ResultItemsInface {
 
-    private PullToRefreshListView mlist;
-    private VoiceSearchView voiceSearchView;
-    private RelativeLayout select_rl;
-    private TextView mumber_tv;
-    private CheckBox all_sure_cb;
-    private boolean isClickCb = true;
-    private boolean mBind;
-    private CoreService mXmppService;
-    private ContactsAdapter adapter;
-    private ContactsDao contactsDao;
-    private EmptyLayout emptyLayout;
-    private List<ContactsModel> models = new ArrayList<>();
-    private List<ContactsModel> tmodels = new ArrayList<>();
-    private int type = 0;//0默认情况。1 其它界面调用
-    private boolean isSingleSelect = true;//true 单选  false 多选
-    private String searchKey;
-    private int allSelect = 0;
-
-    private LinearLayout include_tag;
-    private ArrayList<ContactsModel> stateModels= new ArrayList<>();//记住状态值
-
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.activity_contacts);
-        ViewUtils.inject(this);
-        contactsDao = ContactsDao.getInstance();
-        initView();
-        initData();
-    }
-
-    private ServiceConnection mServiceConnection = new ServiceConnection() {
-        @Override
-        public void onServiceDisconnected(ComponentName name) {
-            LogUtil.i("onServiceDisconnected");
-            mXmppService = null;
-        }
-
-        @Override
-        public void onServiceConnected(ComponentName name, IBinder service) {
-            mXmppService = ((CoreService.CoreServiceBinder) service).getService();
-            LogUtil.i("onServiceConnected");
-            LogUtil.i("mXmppService=" + (mXmppService == null));
-        }
-    };
-
-    private void initView() {
-        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);
-        voiceSearchView = (VoiceSearchView) findViewById(R.id.voiceSearchView);
-        if (getIntent() != null) {
-            type = getIntent().getIntExtra("type", 0);
-            String title = getIntent().getStringExtra("title");
-            isSingleSelect = getIntent().getBooleanExtra("isSingleSelect", true);
-            stateModels=getIntent().getParcelableArrayListExtra("models");
-            if (isSingleSelect) {
-                select_rl.setVisibility(View.GONE);
-            } else {
-                select_rl.setVisibility(View.VISIBLE);
-            }
-            if (!StringUtil.isEmpty(title)) {
-                getSupportActionBar().setTitle(title);
-            } else {
-                getSupportActionBar().setTitle(getString(R.string.common_Contact_person));
-            }
-        }
-        //设置为空显示列表
-        emptyLayout = new EmptyLayout(ct, mlist.getRefreshableView());
-        emptyLayout.setShowLoadingButton(false);
-        emptyLayout.setShowEmptyButton(false);
-        emptyLayout.setShowErrorButton(false);
+	private PullToRefreshListView mlist;
+	private VoiceSearchView voiceSearchView;
+	private RelativeLayout select_rl;
+	private TextView mumber_tv;
+	private CheckBox all_sure_cb;
+	private boolean isClickCb = true;
+	private boolean mBind;
+	private CoreService mXmppService;
+	private ContactsAdapter adapter;
+	private ContactsDao contactsDao;
+	private EmptyLayout emptyLayout;
+	private List<ContactsModel> models = new ArrayList<>();
+	private List<ContactsModel> tmodels = new ArrayList<>();
+	private List<ContactsModel> allModels = new ArrayList<>();
+	private int type = 0;//0默认情况。1 其它界面调用
+	private boolean isSingleSelect = true;//true 单选  false 多选
+	private String searchKey;
+	private int allSelect = 0;
+
+	private LinearLayout include_tag;
+	private ArrayList<ContactsModel> stateModels = new ArrayList<>();//记住状态值
+
+
+	@Override
+	protected void onCreate(Bundle savedInstanceState) {
+		super.onCreate(savedInstanceState);
+		setContentView(R.layout.activity_contacts);
+		ViewUtils.inject(this);
+		contactsDao = ContactsDao.getInstance();
+		initView();
+		initData();
+	}
+
+	private ServiceConnection mServiceConnection = new ServiceConnection() {
+		@Override
+		public void onServiceDisconnected(ComponentName name) {
+			LogUtil.i("onServiceDisconnected");
+			mXmppService = null;
+		}
+
+		@Override
+		public void onServiceConnected(ComponentName name, IBinder service) {
+			mXmppService = ((CoreService.CoreServiceBinder) service).getService();
+			LogUtil.i("onServiceConnected");
+			LogUtil.i("mXmppService=" + (mXmppService == null));
+		}
+	};
+
+	private void initView() {
+		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);
+		voiceSearchView = (VoiceSearchView) findViewById(R.id.voiceSearchView);
+		if (getIntent() != null) {
+			type = getIntent().getIntExtra("type", 0);
+			String title = getIntent().getStringExtra("title");
+			isSingleSelect = getIntent().getBooleanExtra("isSingleSelect", true);
+			stateModels = getIntent().getParcelableArrayListExtra("models");
+			if (isSingleSelect) {
+				select_rl.setVisibility(View.GONE);
+			} else {
+				select_rl.setVisibility(View.VISIBLE);
+			}
+			if (!StringUtil.isEmpty(title)) {
+				getSupportActionBar().setTitle(title);
+			} else {
+				getSupportActionBar().setTitle(getString(R.string.common_Contact_person));
+			}
+		}
+		//设置为空显示列表
+		emptyLayout = new EmptyLayout(ct, mlist.getRefreshableView());
+		emptyLayout.setShowLoadingButton(false);
+		emptyLayout.setShowEmptyButton(false);
+		emptyLayout.setShowErrorButton(false);
 //        emptyLayout.setEmptyViewRes(R.layout.book_empty_list);
 
-        mBind = activity.bindService(getIntent(), mServiceConnection, activity.BIND_AUTO_CREATE);
-        mlist.setMode(PullToRefreshBase.Mode.PULL_FROM_START);
-        mlist.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener<ListView>() {
-            @Override
-            public void onRefresh(PullToRefreshBase<ListView> refreshView) {
-                ThreadPool.getThreadPool().addTask(new Runnable() {
-                    @Override
-                    public void run() {
-                        if (NetUtils.isNetWorkConnected(MyApplication.getInstance())) {
-                            if (!ListUtils.isEmpty(tmodels)) {
-                                tmodels.clear();
-                            }
-                            contactsDao.delete();//删除缓存
-                            loadUUFriendForNet();//先加载UU好友---》企业架构人员----》本地通讯录
-                        } else {
-                            getCaceData(true);//先加载UU好友---》企业架构人员----》本地通讯录
-                        }
-                    }
-                });
-            }
-        });
-        mlist.setOnItemClickListener(new AdapterView.OnItemClickListener() {
-            @Override
-            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
-                ContactsAdapter.ViewHolder viewHolder = (ContactsAdapter.ViewHolder) view.getTag();
-                if (type == 0) {//默认情况---点击查看详情
-                    if (viewHolder.model.getType() == 3) {
-                        return;
-                    }
-                    Intent intent = new Intent("com.modular.basic.BasicInfoActivity");
-                    intent.putExtra(AppConstant.EXTRA_NICK_CODE, viewHolder.sub_tv.getText().toString());
-                    intent.putExtra(AppConstant.EXTRA_USER_ID, viewHolder.model.getImid());
-                    intent.putExtra(AppConstant.EXTRA_NICK_NAME, viewHolder.name_tv.getText().toString());
-                    //intent.putExtra(AppConstant.EXTRA_EM_CODE, friend.getEmCode());
-                    Friend friend = new Friend();
-                    friend.setPhone(viewHolder.model.getPhone());
-                    friend.setUserId(viewHolder.model.getImid());
-                    friend.setRemarkName(viewHolder.model.getName());
-                    //friend.setStatus();
-                    intent.putExtra("friend", friend);
-                    startActivity(intent);
-                } else if (type == 1) { //预约---获取对象界面
-                    //预约对象
-                    if (isSingleSelect) {
-                        Intent intent = new Intent();
-                        intent.putExtra("data", viewHolder.model);
-                        setResult(0x20, intent);
-                        finish();
-                    } else {
-                        boolean isChecked = !viewHolder.checkBox.isChecked();
-                        LogUtil.d("ContactsActivity", "isChecked:" + isChecked);
-                        setSelectNumber(isChecked);
-                        adapter.getItem(position - 1).setClick(isChecked);
-                        adapter.notifyDataSetChanged();
-                    }
-
-                }
-            }
-        });
-
-        voiceSearchView.addTextChangedListener(new EditChangeListener() {
-            @Override
-            public void afterTextChanged(Editable s) {
-                searchKey = s.toString();
-                LogUtil.d("arison", " searchKey:" + searchKey);
-                if (!StringUtil.isEmpty(s.toString())) {
-                    mlist.setMode(PullToRefreshBase.Mode.DISABLED);
-                    //contactsDao.find(s.toString());
-                    List<ContactsModel> cacheData =contactsDao.find(s.toString()) ;
-                    if (!ListUtils.isEmpty(stateModels)){
-                        for (int i = 0; i <cacheData.size() ; i++) {
-                            for (int j = 0; j <stateModels.size(); j++) {
-                                if (cacheData.get(i).getImid().equals(stateModels.get(j).getImid())){
-                                    cacheData.get(i).setClick(stateModels.get(j).isClick);
-                                }
-                            }
-                        }
-                    }
-                    if (adapter != null) {
-                        if (ListUtils.isEmpty(cacheData)) {
-                            searchContactsByNet(s.toString());
-                            return;
-                        }
-                        models.clear();
-                        models.addAll(cacheData);
-                        adapter.notifyDataSetChanged();
-                        //查询需要优化
-                        //getStateByPhones(cacheData);
-                        if (models.size() == 0) {
-                            emptyLayout.showEmpty();
-                        }
-                    } else {
-
-                    }
-                } else {
-                    mlist.setMode(PullToRefreshBase.Mode.PULL_FROM_START);
-                    getCaceData(false);
-                }
-
-            }
-        });
-
-        all_sure_cb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
-            @Override
-            public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
-                if (isClickCb) {
-                    if (adapter == null) return;
-                    for (int i = 0; i < adapter.getModels().size(); i++) {
-                        adapter.getModels().get(i).setClick(b);
-                    }
-                    allSelect = getSelectNumber().size();
-                    mumber_tv.setText(getString(R.string.selected) + allSelect + " " + "人员");
-                    adapter.notifyDataSetChanged();
-                    all_sure_cb.setText(b ? R.string.cancel_select_all : R.string.select_all);
-                }
-                isClickCb = true;
-            }
-        });
-
-
-        findViewById(R.id.sure_tv).setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View view) {
-                ArrayList<ContactsModel> models = getSelectNumber();
-                Intent intent = new Intent();
-                intent.putParcelableArrayListExtra("data", models);
-                activity.setResult(0x01, intent);
-                activity.finish();
-            }
-        });
-
-    }
-
-    public ArrayList<ContactsModel> getSelectNumber() {
-        ArrayList<ContactsModel> models = new ArrayList<>();
-        for (int i = 0; i < adapter.getModels().size(); i++) {
-            if (adapter.getModels().get(i).isClick) {
-                if (StringUtil.isEmpty(adapter.getModels().get(i).getImid())){
-                    adapter.getItem(i).setImid("0");
-                }
-                models.add(adapter.getItem(i));
-            }
-        }
-        LogUtil.d("myTest","选择的联系人:"+JSON.toJSONString(models));
-        return models;
-    }
-
-    /**
-     * 点击后
-     *
-     * @param isClicked 点击后是否为选中状态
-     */
-    private void setSelectNumber(boolean isClicked) {
-        allSelect += isClicked ? 1 : -1;
-        if (allSelect < 0)
-            allSelect = 0;
-        if (!isClicked && all_sure_cb.isChecked()) {
-            isClickCb = false;
-            all_sure_cb.setChecked(false);
-            all_sure_cb.setText(R.string.select_all);
-        } else if (isClicked && !all_sure_cb.isChecked() && !ListUtils.isEmpty(adapter.getModels()) && allSelect == adapter.getModels().size()) {
-            isClickCb = false;
-            all_sure_cb.setChecked(true);
-            all_sure_cb.setText(R.string.cancel_select_all);
-        }
-        mumber_tv.setText(getString(R.string.selected) + allSelect + " " + "人员");
-    }
-
-    private void initData() {
-        if (!ListUtils.isEmpty(models)) {
-            models.clear();
-        }
-        showLoading();
-        adapter = new ContactsAdapter(this, models);
-        adapter.setSingleSelect(isSingleSelect);
-        mlist.setAdapter(adapter);
-        String[] permissions = {Manifest.permission.READ_CONTACTS};
-        if (PermissionUtil.lacksPermissions(ct, permissions)) {
-            PermissionUtil.requestPermission(this, PermissionUtil.DEFAULT_REQUEST, permissions);
-        } else {
-            getCaceData(false);
-            isHasPermiss = true;
-            LogUtil.d("Test", "有权限@....");
-        }
-    }
-
-    boolean isHasPermiss = false;
-
-    @Override
-    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
-        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
-        if (requestCode == PermissionUtil.DEFAULT_REQUEST) {
-            if (grantResults.length != 1 || grantResults[0] != PackageManager.PERMISSION_GRANTED) {
-                ToastUtil.showToast(ct, R.string.not_system_permission);
-                isHasPermiss = false;
-                getCaceData(false);
-                LogUtil.d("Test", "没有权限....");
-            } else {
-                isHasPermiss = true;
-                getCaceData(false);
-                LogUtil.d("Test", "有权限....");
-            }
-        }
-    }
-
-
-    //1
-    public void loadCompanyContacts() {
-        ThreadPool.getThreadPool().addTask(new Runnable() {
-            @Override
-            public void run() {
-                List<EmployeesEntity> emdatas = getEmListByDB();
-                if (emdatas != null) {
-                    LogUtil.d("Test", "企业架构人员不为空!");
-                    for (EmployeesEntity entity : emdatas) {
-                        ContactsModel model = new ContactsModel();
-                        model.setImid(String.valueOf(entity.getEm_IMID()));
-                        model.setType(2);
-                        model.setOwnerId(MyApplication.getInstance().mLoginUser.getUserId());
-                        model.setName(entity.getEM_NAME());
-                        model.setEmail(entity.getEM_EMAIL());
-                        model.setPhone(entity.getEM_MOBILE());
-                        model.setWhichsys(entity.getWHICHSYS());
-                        model.setCompany(entity.getCOMPANY());
-                        tmodels.add(model);
-                    }
-                    //执行第二步
-                    loadLocalContacts();
-                } else {
-                    //联网取企业架构
-                    loadUASFriendsNet();
-                }
-            }
-        });
-    }
-
-    //2
-    public void loadIMContacts() {
-        ThreadPool.getThreadPool().addTask(new Runnable() {
-            @Override
-            public void run() {
-                List<Friend> friends = FriendDao.getInstance().getFriends(MyApplication.getInstance().mLoginUser.getUserId());
-                if (friends != null) {
-                    LogUtil.d("Test", "IM好友不为空!");
-                    for (Friend entity : friends) {
-                        ContactsModel model = new ContactsModel();
-                        model.setImid(String.valueOf(entity.getUserId()));
-                        model.setType(1);
-                        model.setName(entity.getShowName());
-                        model.setEmail("");
-                        model.setOwnerId(MyApplication.getInstance().mLoginUser.getUserId());
-                        model.setPhone(entity.getPhone());
-                        model.setWhichsys(CommonUtil.getSharedPreferences(MyApplication.getInstance(), "erp_master"));
-                        model.setCompany("");
-                        tmodels.add(model);
-                    }
-                    loadCompanyContacts();
-                } else {
-                    //联网取UU好友数据
-                    loadUUFriendForNet();
-                }
-
-            }
-
-        });
-    }
-
-    //3需要权限
-    public void loadLocalContacts() {
-        ThreadPool.getThreadPool().addTask(new Runnable() {
-            @Override
-            public void run() {
-                if (isHasPermiss) {
-                    List<Contacts> contacts = ContactsUtils.getContacts1();
-                    if (contacts != null) {
-                        for (Contacts entity : contacts) {
-                            ContactsModel model = new ContactsModel();
-                            model.setImid("0");
-                            model.setName(StringUtil.isEmpty(entity.getName()) ? entity.getNickname() : entity.getName());
-                            model.setType(3);
-                            model.setEmail("");
-                            model.setOwnerId(MyApplication.getInstance().mLoginUser.getUserId());
-                            model.setPhone(entity.getPhone());
-                            model.setWhichsys(CommonUtil.getSharedPreferences(MyApplication.getInstance(), "erp_master"));
-                            model.setCompany("");
-                            tmodels.add(model);
-
-                        }
-                        contactsDao.save(tmodels);
-                        getCaceData(false);
-                    }
-                } else {
-                    //没权限
-                    contactsDao.save(tmodels);
-                    getCaceData(false);
-                }
-
-            }
-        });
-    }
-
-    /**
-     * @desc:加载通讯录数据
-     */
-    public void getCaceData(final boolean isHasNet) {
-        ThreadPool.getThreadPool().addTask(new Runnable() {
-            @Override
-            public void run() {
-                final List<ContactsModel> lists = getLocalContactsByDB();
-                //上传
-                if (!ListUtils.isEmpty(stateModels)){
-                    for (int i = 0; i <lists.size() ; i++) {
-                        for (int j = 0; j <stateModels.size(); j++) {
-                            if (lists.get(i).getImid().equals(stateModels.get(j).getImid())){
-                                lists.get(i).setClick(stateModels.get(j).isClick);
-                            }
-                        }
-                    }
-                }
-                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())) {
-                                contacts.add(model);
-                            }
-                        }
-                        uploadData(contacts);
-                    }
-                });
-                boolean falg = !ListUtils.isEmpty(lists) && !isHasNet;
-                if (falg) {
-                    LogUtil.d("Test", "取缓存数据:" + falg);
-                    getStateByPhones(lists);
-                    OAHttpHelper.getInstance().post(new Runnable() {
-                        @Override
-                        public void run() {
-                            //更新ui
-                            if (adapter != null) {
-                                models.clear();
-                                models.addAll(lists);
-                                adapter.notifyDataSetChanged();
-                                if (adapter.getCount() == 0) emptyLayout.showEmpty();
-                                mlist.onRefreshComplete();
-                                voiceSearchView.getSearch_edit().setHint(lists.size() + "位联系人");
-                                dimssLoading();
-                                allSelect = getSelectNumber().size();
-                                mumber_tv.setText(getString(R.string.selected) + allSelect + " " + "人员");
-                            }
-                        }
-                    });
-
-                } else {
-                    LogUtil.d("Test", "-----------缓存为空!---------");
-                    if (!ListUtils.isEmpty(tmodels)) {
-                        tmodels.clear();
-                    }
-                    contactsDao.delete();//删除缓存
-                    loadUUFriendForNet();//先加载UU好友---》企业架构人员----》本地通讯录
-                }
-            }
-        });
-    }
-
-    private List<ContactsModel> getLocalContactsByDB() {
-        if (StringUtil.isEmpty(searchKey)) {
-            List<ContactsModel> models = contactsDao.find();
-            return models;
-        } else {
-            return contactsDao.find(searchKey);
-        }
-    }
-
-    private List<EmployeesEntity> getEmListByDB() {
-        DBManager manager = new DBManager();
-        String master = CommonUtil.getMaster();
-        List<EmployeesEntity> emList = null;
-        if (!StringUtil.isEmpty(master)) {
-            try {
-                emList = manager.select_getEmployee(new String[]{master}, "whichsys=?");
-            } catch (Exception e) {
-
-            }
-        }
-        manager.closeDB();
-        return emList;
-    }
-
-
-    @Deprecated
-    private void getStateByPhones(final List<ContactsModel> models) {
-        StringBuilder builder = new StringBuilder();
-        int i = 0;
-        for (ContactsModel u : models) {
-            if (u.getType() == 3) {
-                if (i == models.size() - 1) {
-                    builder.append(u.getPhone());
-                } else {
-                    builder.append(u.getPhone() + ",");
-                }
-            }
-            i++;
-        }
-        HashMap<String, String> params = new HashMap<>();
-        String myUserId = MyApplication.getInstance().mLoginUser.getUserId();
-        params.put("token", MyApplication.getInstance().mAccessToken);
-        params.put("userid", myUserId);
-        params.put("telephones", builder.toString());
-        LogUtil.d("array builder.toString=" + builder.toString());
-        StringJsonObjectRequest<String> request = new StringJsonObjectRequest<String>(
-                MyApplication.getInstance().getConfig().APP_QUER_YUSER, new Response.ErrorListener() {
-            @Override
-            public void onErrorResponse(VolleyError arg0) {
-                ToastUtil.showErrorNet(MyApplication.getInstance());
-            }
-        }, new StringJsonObjectRequest.Listener<String>() {
-            @Override
-            public void onResponse(ObjectResult<String> result) {
-                String message = result.toString();
-                if (!StringUtil.isEmpty(message)) {
-                    LogUtil.d("Test", "message:" + message);
-                    try {
-                        hanlderAppQueryuserInThread(message);
-                    } catch (Exception e) {
-
-                    }
-                }
-            }
-        }, String.class, params);
-        MyApplication.getInstance().getFastVolley().addDefaultRequest("Volley", request);
-    }
-
-    @Deprecated
-    private void hanlderAppQueryuserInThread(String message) {
-        if (JSONUtil.validate(message)) {
-            JSONObject object = JSON.parseObject(message);
-            String resultData = object.getString("resultData");
-            object = object.parseObject(resultData);
-            String user = object.getString("user");
-            JSONArray array = JSON.parseArray(user);
-            LogUtil.i("array=" + array);
-
-            if (!ListUtils.isEmpty(array)) {
-                JSONObject o = null;
+		mBind = activity.bindService(getIntent(), mServiceConnection, activity.BIND_AUTO_CREATE);
+		mlist.setMode(PullToRefreshBase.Mode.PULL_FROM_START);
+		mlist.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener<ListView>() {
+			@Override
+			public void onRefresh(PullToRefreshBase<ListView> refreshView) {
+				ThreadPool.getThreadPool().addTask(new Runnable() {
+					@Override
+					public void run() {
+						if (NetUtils.isNetWorkConnected(MyApplication.getInstance())) {
+							if (!ListUtils.isEmpty(tmodels)) {
+								tmodels.clear();
+							}
+							contactsDao.delete();//删除缓存
+							loadUUFriendForNet();//先加载UU好友---》企业架构人员----》本地通讯录
+						} else {
+							getCaceData(true);//先加载UU好友---》企业架构人员----》本地通讯录
+						}
+					}
+				});
+			}
+		});
+		mlist.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+			@Override
+			public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+				ContactsAdapter.ViewHolder viewHolder = (ContactsAdapter.ViewHolder) view.getTag();
+				if (type == 0) {//默认情况---点击查看详情
+					if (viewHolder.model.getType() == 3) {
+						return;
+					}
+					Intent intent = new Intent("com.modular.basic.BasicInfoActivity");
+					intent.putExtra(AppConstant.EXTRA_NICK_CODE, viewHolder.sub_tv.getText().toString());
+					intent.putExtra(AppConstant.EXTRA_USER_ID, viewHolder.model.getImid());
+					intent.putExtra(AppConstant.EXTRA_NICK_NAME, viewHolder.name_tv.getText().toString());
+					//intent.putExtra(AppConstant.EXTRA_EM_CODE, friend.getEmCode());
+					Friend friend = new Friend();
+					friend.setPhone(viewHolder.model.getPhone());
+					friend.setUserId(viewHolder.model.getImid());
+					friend.setRemarkName(viewHolder.model.getName());
+					//friend.setStatus();
+					intent.putExtra("friend", friend);
+					startActivity(intent);
+				} else if (type == 1) { //预约---获取对象界面
+					//预约对象
+					if (isSingleSelect) {
+						Intent intent = new Intent();
+						intent.putExtra("data", viewHolder.model);
+						setResult(0x20, intent);
+						finish();
+					} else {
+						boolean isChecked = !viewHolder.checkBox.isChecked();
+						LogUtil.d("ContactsActivity", "isChecked:" + isChecked);
+						setSelectNumber(isChecked);
+						adapter.getItem(position - 1).setClick(isChecked);
+						adapter.notifyDataSetChanged();
+					}
+
+				}
+			}
+		});
+
+		voiceSearchView.addTextChangedListener(new EditChangeListener() {
+			@Override
+			public void afterTextChanged(Editable s) {
+//				sreachKeyWorkOld(s == null ? "" : s.toString());
+				sreachKeyWork(s == null ? "" : s.toString());
+			}
+		});
+
+		all_sure_cb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+			@Override
+			public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
+				if (isClickCb) {
+					if (adapter == null) return;
+					for (int i = 0; i < adapter.getModels().size(); i++) {
+						adapter.getModels().get(i).setClick(b);
+					}
+					allSelect = getSelectNumber().size();
+					mumber_tv.setText(getString(R.string.selected) + allSelect + " " + "人员");
+					adapter.notifyDataSetChanged();
+					all_sure_cb.setText(b ? R.string.cancel_select_all : R.string.select_all);
+				}
+				isClickCb = true;
+			}
+		});
+
+
+		findViewById(R.id.sure_tv).setOnClickListener(new View.OnClickListener() {
+			@Override
+			public void onClick(View view) {
+				ArrayList<ContactsModel> models = getSelectNumber();
+				Intent intent = new Intent();
+				intent.putParcelableArrayListExtra("data", models);
+				activity.setResult(0x01, intent);
+				activity.finish();
+			}
+		});
+
+	}
+
+	public ArrayList<ContactsModel> getSelectNumber() {
+		ArrayList<ContactsModel> models = new ArrayList<>();
+		for (int i = 0; i < adapter.getModels().size(); i++) {
+			if (adapter.getModels().get(i).isClick) {
+				if (StringUtil.isEmpty(adapter.getModels().get(i).getImid())) {
+					adapter.getItem(i).setImid("0");
+				}
+				models.add(adapter.getItem(i));
+			}
+		}
+		LogUtil.d("myTest", "选择的联系人:" + JSON.toJSONString(models));
+		return models;
+	}
+
+	/**
+	 * 搜索,原版  by Arison
+	 *
+	 * @param keyWork
+	 */
+	private void sreachKeyWorkOld(String keyWork) {
+		searchKey = keyWork;
+		LogUtil.d("arison", " searchKey:" + searchKey);
+		if (!StringUtil.isEmpty(keyWork)) {
+			mlist.setMode(PullToRefreshBase.Mode.DISABLED);
+			//contactsDao.find(s.toString());
+			List<ContactsModel> cacheData = contactsDao.find(keyWork);
+			if (!ListUtils.isEmpty(stateModels)) {
+				for (int i = 0; i < cacheData.size(); i++) {
+					for (int j = 0; j < stateModels.size(); j++) {
+						if (cacheData.get(i).getImid().equals(stateModels.get(j).getImid())) {
+							cacheData.get(i).setClick(stateModels.get(j).isClick);
+						}
+					}
+				}
+			}
+			if (adapter != null) {
+				if (ListUtils.isEmpty(cacheData)) {
+					searchContactsByNet(keyWork);
+					return;
+				}
+				models.clear();
+				models.addAll(cacheData);
+				adapter.notifyDataSetChanged();
+				//查询需要优化
+				//getStateByPhones(cacheData);
+				if (models.size() == 0) {
+					emptyLayout.showEmpty();
+				}
+			} else {
+
+			}
+		} else {
+			mlist.setMode(PullToRefreshBase.Mode.PULL_FROM_START);
+			getCaceData(false);
+		}
+	}
+
+	/**
+	 * 搜索,原版  by Bitliker
+	 *
+	 * @param keyWork
+	 */
+	private void sreachKeyWork(final String keyWork) {
+		searchKey = keyWork;
+		LogUtil.i("allModels=" + allModels.size());
+		if (StringUtil.isEmail(keyWork)) {
+			mlist.setMode(PullToRefreshBase.Mode.PULL_FROM_START);
+			models.clear();
+			models.addAll(allModels);
+			adapter.notifyDataSetChanged();
+		} else {
+			LogUtil.i("start for=" +System.currentTimeMillis());
+			List<ContactsModel> keyWorkModels = new ArrayList<>();
+			for (ContactsModel e : allModels) {
+				if (includeKeyWork(e, searchKey)) {
+					keyWorkModels.add(e);
+				}
+			}
+			if (!ListUtils.isEmpty(stateModels)) {
+				for (int i = 0; i < keyWorkModels.size(); i++) {
+					for (int j = 0; j < stateModels.size(); j++) {
+						if (keyWorkModels.get(i).getImid().equals(stateModels.get(j).getImid())) {
+							keyWorkModels.get(i).setClick(stateModels.get(j).isClick);
+						}
+					}
+				}
+			}
+			LogUtil.i("end for=" +System.currentTimeMillis());
+			updateAdapter(keyWorkModels);
+		}
+	}
+
+	private Comparator<ContactsModel> comparator;
+
+	public Comparator<ContactsModel> getComparator() {
+		return comparator == null ? comparator = new Comparator<ContactsModel>() {
+			@Override
+			public int compare(ContactsModel t1, ContactsModel t2) {
+				return t1.getType() - t2.getType();
+			}
+		} : comparator;
+	}
+
+	private void updateAdapter(List<ContactsModel> models) {
+		if (adapter != null) {
+			if (ListUtils.isEmpty(models)) {
+				searchContactsByNet(searchKey);
+			} else {
+				this.models.clear();
+				this.models.addAll(models);
+				Collections.sort(this.models,getComparator());
+				adapter.notifyDataSetChanged();
+				if (models.size() == 0) {
+					emptyLayout.showEmpty();
+				}
+			}
+		}
+	}
+
+	private boolean includeKeyWork(ContactsModel e, String searchKey) {
+		return hasOneContainsUpperCase(searchKey, e.getCompany(), e.getName(), e.getPhone(), e.getImid(), e.getEmail());
+	}
+
+	public static boolean hasOneContainsUpperCase(String key, String... message) {
+		if (StringUtil.isEmpty(key)) return true;
+		if (message == null || message.length <= 0) return false;
+		for (String e : message) {
+			if (e != null && e.toUpperCase().contains(key.toUpperCase()))
+				return true;
+		}
+		return false;
+	}
+	/**
+	 * 点击后
+	 *
+	 * @param isClicked 点击后是否为选中状态
+	 */
+	private void setSelectNumber(boolean isClicked) {
+		allSelect += isClicked ? 1 : -1;
+		if (allSelect < 0)
+			allSelect = 0;
+		if (!isClicked && all_sure_cb.isChecked()) {
+			isClickCb = false;
+			all_sure_cb.setChecked(false);
+			all_sure_cb.setText(R.string.select_all);
+		} else if (isClicked && !all_sure_cb.isChecked() && !ListUtils.isEmpty(adapter.getModels()) && allSelect == adapter.getModels().size()) {
+			isClickCb = false;
+			all_sure_cb.setChecked(true);
+			all_sure_cb.setText(R.string.cancel_select_all);
+		}
+		mumber_tv.setText(getString(R.string.selected) + allSelect + " " + "人员");
+	}
+
+	private void initData() {
+		if (!ListUtils.isEmpty(models)) {
+			models.clear();
+		}
+		showLoading();
+		adapter = new ContactsAdapter(this, models);
+		adapter.setSingleSelect(isSingleSelect);
+		mlist.setAdapter(adapter);
+		String[] permissions = {Manifest.permission.READ_CONTACTS};
+		if (PermissionUtil.lacksPermissions(ct, permissions)) {
+			PermissionUtil.requestPermission(this, PermissionUtil.DEFAULT_REQUEST, permissions);
+		} else {
+			getCaceData(false);
+			isHasPermiss = true;
+			LogUtil.d("Test", "有权限@....");
+		}
+	}
+
+	boolean isHasPermiss = false;
+
+	@Override
+	public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
+		super.onRequestPermissionsResult(requestCode, permissions, grantResults);
+		if (requestCode == PermissionUtil.DEFAULT_REQUEST) {
+			if (grantResults.length != 1 || grantResults[0] != PackageManager.PERMISSION_GRANTED) {
+				ToastUtil.showToast(ct, R.string.not_system_permission);
+				isHasPermiss = false;
+				getCaceData(false);
+				LogUtil.d("Test", "没有权限....");
+			} else {
+				isHasPermiss = true;
+				getCaceData(false);
+				LogUtil.d("Test", "有权限....");
+			}
+		}
+	}
+
+
+	//1
+	public void loadCompanyContacts() {
+		ThreadPool.getThreadPool().addTask(new Runnable() {
+			@Override
+			public void run() {
+				List<EmployeesEntity> emdatas = getEmListByDB();
+				if (emdatas != null) {
+					LogUtil.d("Test", "企业架构人员不为空!");
+					for (EmployeesEntity entity : emdatas) {
+						ContactsModel model = new ContactsModel();
+						model.setImid(String.valueOf(entity.getEm_IMID()));
+						model.setType(2);
+						model.setOwnerId(MyApplication.getInstance().mLoginUser.getUserId());
+						model.setName(entity.getEM_NAME());
+						model.setEmail(entity.getEM_EMAIL());
+						model.setPhone(entity.getEM_MOBILE());
+						model.setWhichsys(entity.getWHICHSYS());
+						model.setCompany(entity.getCOMPANY());
+						tmodels.add(model);
+					}
+					//执行第二步
+					loadLocalContacts();
+				} else {
+					//联网取企业架构
+					loadUASFriendsNet();
+				}
+			}
+		});
+	}
+
+	//2
+	public void loadIMContacts() {
+		ThreadPool.getThreadPool().addTask(new Runnable() {
+			@Override
+			public void run() {
+				List<Friend> friends = FriendDao.getInstance().getFriends(MyApplication.getInstance().mLoginUser.getUserId());
+				if (friends != null) {
+					LogUtil.d("Test", "IM好友不为空!");
+					for (Friend entity : friends) {
+						ContactsModel model = new ContactsModel();
+						model.setImid(String.valueOf(entity.getUserId()));
+						model.setType(1);
+						model.setName(entity.getShowName());
+						model.setEmail("");
+						model.setOwnerId(MyApplication.getInstance().mLoginUser.getUserId());
+						model.setPhone(entity.getPhone());
+						model.setWhichsys(CommonUtil.getSharedPreferences(MyApplication.getInstance(), "erp_master"));
+						model.setCompany("");
+						tmodels.add(model);
+					}
+					loadCompanyContacts();
+				} else {
+					//联网取UU好友数据
+					loadUUFriendForNet();
+				}
+
+			}
+
+		});
+	}
+
+	//3需要权限
+	public void loadLocalContacts() {
+		ThreadPool.getThreadPool().addTask(new Runnable() {
+			@Override
+			public void run() {
+				if (isHasPermiss) {
+					List<Contacts> contacts = ContactsUtils.getContacts1();
+					if (contacts != null) {
+						for (Contacts entity : contacts) {
+							ContactsModel model = new ContactsModel();
+							model.setImid("0");
+							model.setName(StringUtil.isEmpty(entity.getName()) ? entity.getNickname() : entity.getName());
+							model.setType(3);
+							model.setEmail("");
+							model.setOwnerId(MyApplication.getInstance().mLoginUser.getUserId());
+							model.setPhone(entity.getPhone());
+							model.setWhichsys(CommonUtil.getSharedPreferences(MyApplication.getInstance(), "erp_master"));
+							model.setCompany("");
+							tmodels.add(model);
+
+						}
+						contactsDao.save(tmodels);
+						getCaceData(false);
+					}
+				} else {
+					//没权限
+					contactsDao.save(tmodels);
+					getCaceData(false);
+				}
+
+			}
+		});
+	}
+
+	/**
+	 * @desc:加载通讯录数据
+	 */
+	public void getCaceData(final boolean isHasNet) {
+		ThreadPool.getThreadPool().addTask(new Runnable() {
+			@Override
+			public void run() {
+				final List<ContactsModel> lists = getLocalContactsByDB();
+				//上传
+				if (!ListUtils.isEmpty(stateModels)) {
+					for (int i = 0; i < lists.size(); i++) {
+						for (int j = 0; j < stateModels.size(); j++) {
+							if (lists.get(i).getImid().equals(stateModels.get(j).getImid())) {
+								lists.get(i).setClick(stateModels.get(j).isClick);
+							}
+						}
+					}
+				}
+				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())) {
+								contacts.add(model);
+							}
+						}
+						uploadData(contacts);
+					}
+				});
+				boolean falg = !ListUtils.isEmpty(lists) && !isHasNet;
+				if (falg) {
+					LogUtil.d("Test", "取缓存数据:" + falg);
+					getStateByPhones(lists);
+					allModels.clear();
+					allModels.addAll(lists);
+					OAHttpHelper.getInstance().post(new Runnable() {
+						@Override
+						public void run() {
+							//更新ui
+							if (adapter != null) {
+								models.clear();
+								models.addAll(lists);
+								Collections.sort(models,getComparator());
+								adapter.notifyDataSetChanged();
+								if (adapter.getCount() == 0) emptyLayout.showEmpty();
+								mlist.onRefreshComplete();
+								voiceSearchView.getSearch_edit().setHint(lists.size() + "位联系人");
+								dimssLoading();
+								allSelect = getSelectNumber().size();
+								mumber_tv.setText(getString(R.string.selected) + allSelect + " " + "人员");
+							}
+						}
+					});
+
+				} else {
+					LogUtil.d("Test", "-----------缓存为空!---------");
+					if (!ListUtils.isEmpty(tmodels)) {
+						tmodels.clear();
+					}
+					contactsDao.delete();//删除缓存
+					loadUUFriendForNet();//先加载UU好友---》企业架构人员----》本地通讯录
+				}
+			}
+		});
+	}
+
+	private List<ContactsModel> getLocalContactsByDB() {
+		if (StringUtil.isEmpty(searchKey)) {
+			List<ContactsModel> models = contactsDao.find();
+			return models;
+		} else {
+			return contactsDao.find(searchKey);
+		}
+	}
+
+	private List<EmployeesEntity> getEmListByDB() {
+		DBManager manager = new DBManager();
+		String master = CommonUtil.getMaster();
+		List<EmployeesEntity> emList = null;
+		if (!StringUtil.isEmpty(master)) {
+			try {
+				emList = manager.select_getEmployee(new String[]{master}, "whichsys=?");
+			} catch (Exception e) {
+
+			}
+		}
+		manager.closeDB();
+		return emList;
+	}
+
+
+	@Deprecated
+	private void getStateByPhones(final List<ContactsModel> models) {
+		StringBuilder builder = new StringBuilder();
+		int i = 0;
+		for (ContactsModel u : models) {
+			if (u.getType() == 3) {
+				if (i == models.size() - 1) {
+					builder.append(u.getPhone());
+				} else {
+					builder.append(u.getPhone() + ",");
+				}
+			}
+			i++;
+		}
+		HashMap<String, String> params = new HashMap<>();
+		String myUserId = MyApplication.getInstance().mLoginUser.getUserId();
+		params.put("token", MyApplication.getInstance().mAccessToken);
+		params.put("userid", myUserId);
+		params.put("telephones", builder.toString());
+		LogUtil.d("array builder.toString=" + builder.toString());
+		StringJsonObjectRequest<String> request = new StringJsonObjectRequest<String>(
+				MyApplication.getInstance().getConfig().APP_QUER_YUSER, new Response.ErrorListener() {
+			@Override
+			public void onErrorResponse(VolleyError arg0) {
+				ToastUtil.showErrorNet(MyApplication.getInstance());
+			}
+		}, new StringJsonObjectRequest.Listener<String>() {
+			@Override
+			public void onResponse(ObjectResult<String> result) {
+				String message = result.toString();
+				if (!StringUtil.isEmpty(message)) {
+					LogUtil.d("Test", "message:" + message);
+					try {
+						hanlderAppQueryuserInThread(message);
+					} catch (Exception e) {
+
+					}
+				}
+			}
+		}, String.class, params);
+		MyApplication.getInstance().getFastVolley().addDefaultRequest("Volley", request);
+	}
+
+	@Deprecated
+	private void hanlderAppQueryuserInThread(String message) {
+		if (JSONUtil.validate(message)) {
+			JSONObject object = JSON.parseObject(message);
+			String resultData = object.getString("resultData");
+			object = object.parseObject(resultData);
+			String user = object.getString("user");
+			JSONArray array = JSON.parseArray(user);
+			LogUtil.i("array=" + array);
+
+			if (!ListUtils.isEmpty(array)) {
+				JSONObject o = null;
 //                for (ContactsModel model:models){
 //                    model.setType(3);
 //                }
-                for (int i = 0; i < array.size(); i++) {
-                    o = array.getJSONObject(i);
-                    String telephone = JSONUtil.getText(o, "telephone");
-                    String isfriend = JSONUtil.getText(o, "isfriend");
-                    int _id = JSONUtil.getInt(o, "_id");
-                    for (int j = 0; j < models.size(); j++) {
-                        ContactsModel model = models.get(j);
-                        if (model.getPhone().equals(telephone)) {
-                            if (isfriend.equals("0")) {
-                                model.setType(2);//非好友
-                                model.setImid(String.valueOf(_id));
-                                contactsDao.update(model, "0");
-                            } else if (isfriend.equals("1")) {
-                                model.setType(1);//好友
-                                model.setImid(String.valueOf(_id));
-                                contactsDao.update(model, "0");
-                            }
-                        }
-                    }
-                }
-                adapter.notifyDataSetChanged();
-            }
-        }
-        //计算全部数据完成
-
-    }
-
-    @Override
-    public void onResultForItems(View view, ContactsModel model, int position) {
-        TextView textView = (TextView) view;
-        String add = MyApplication.getInstance().getString(R.string.add);
-        String invite = MyApplication.getInstance().getString(R.string.invite);
-        if (textView.getText().toString().equals(add)) {
-            addUser(model, position);
-        }
-        if (textView.getText().toString().equals(invite)) {
-            invite(model, position);
-        }
-    }
-
-
-    //TODO 添加好友
-    private void addUser(final ContactsModel user, final int position) {
-        if (user == null) {
-            return;
-        }
-        showLoading();
-        HashMap<String, String> params = new HashMap<String, String>();
-        params.put("access_token", MyApplication.getInstance().mAccessToken);
-        params.put("toUserId", String.valueOf(user.getImid()));
-        StringJsonObjectRequest<AddAttentionResult> request = new StringJsonObjectRequest<AddAttentionResult>(
-                MyApplication.getInstance().getConfig().FRIENDS_ATTENTION_ADD, new Response.ErrorListener() {
-            @Override
-            public void onErrorResponse(VolleyError arg0) {
-                dimssLoading();
-                ToastUtil.showErrorNet(activity);
-            }
-        }, new StringJsonObjectRequest.Listener<AddAttentionResult>() {
-            @Override
-            public void onResponse(ObjectResult<AddAttentionResult> result) {
-                dimssLoading();
-                boolean success = Result.defaultParser(MyApplication.getInstance(), result, true);
-                String message = result.toString();
-                if (success) {
-                    showToast(R.string.add_attention_succ, R.color.load_submit);
-                    // 添加为关注
-                    User mUser = new User();
-                    mUser.setUserId(String.valueOf(user.getImid()));//已经开通了UU IM的人
-                    mUser.setNickName(user.getName());//手机通讯录的名字
-                    // 发送推送的消息
-                    NewFriendMessage mess = NewFriendMessage.createWillSendMessage(
-                            MyApplication.getInstance().mLoginUser, XmppMessage.TYPE_FRIEND, null, mUser);
-                    LogUtil.i("mXmppService=" + (mXmppService == null));
-                    if (mXmppService != null)
-                        mXmppService.sendNewFriendMessage(mUser.getUserId(), mess);
-                    // 添加为好友
-                    NewFriendDao.getInstance().ascensionNewFriend(mess, Friend.STATUS_FRIEND);
-
-
-                    ContactsModel tData = models.get(position);
-                    if (StringUtil.isEmpty(tData.getWhichsys())) {
-                        tData.setWhichsys("");
-                    }
-                    tData.setType(1);
-                    LogUtil.d("Test", "tdata:" + JSON.toJSONString(tData));
-                    contactsDao.update(tData);
-                    adapter.notifyDataSetChanged();
-                }
-            }
-        }, AddAttentionResult.class, params);
-        MyApplication.getInstance().getFastVolley().addDefaultRequest("Volley", request);
-    }
-
-
-    private void invite(ContactsModel user, int position) {
-        LogUtil.i("invite");
-        final String name = CommonUtil.getName();
-        final String phone = user.getPhone().trim().replaceAll(" ", "");
+				for (int i = 0; i < array.size(); i++) {
+					o = array.getJSONObject(i);
+					String telephone = JSONUtil.getText(o, "telephone");
+					String isfriend = JSONUtil.getText(o, "isfriend");
+					int _id = JSONUtil.getInt(o, "_id");
+					for (int j = 0; j < models.size(); j++) {
+						ContactsModel model = models.get(j);
+						if (model.getPhone().equals(telephone)) {
+							if (isfriend.equals("0")) {
+								model.setType(2);//非好友
+								model.setImid(String.valueOf(_id));
+								contactsDao.update(model, "0");
+							} else if (isfriend.equals("1")) {
+								model.setType(1);//好友
+								model.setImid(String.valueOf(_id));
+								contactsDao.update(model, "0");
+							}
+						}
+					}
+				}
+				adapter.notifyDataSetChanged();
+			}
+		}
+		//计算全部数据完成
+
+	}
+
+	@Override
+	public void onResultForItems(View view, ContactsModel model, int position) {
+		TextView textView = (TextView) view;
+		String add = MyApplication.getInstance().getString(R.string.add);
+		String invite = MyApplication.getInstance().getString(R.string.invite);
+		if (textView.getText().toString().equals(add)) {
+			addUser(model, position);
+		}
+		if (textView.getText().toString().equals(invite)) {
+			invite(model, position);
+		}
+	}
+
+
+	//TODO 添加好友
+	private void addUser(final ContactsModel user, final int position) {
+		if (user == null) {
+			return;
+		}
+		showLoading();
+		HashMap<String, String> params = new HashMap<String, String>();
+		params.put("access_token", MyApplication.getInstance().mAccessToken);
+		params.put("toUserId", String.valueOf(user.getImid()));
+		StringJsonObjectRequest<AddAttentionResult> request = new StringJsonObjectRequest<AddAttentionResult>(
+				MyApplication.getInstance().getConfig().FRIENDS_ATTENTION_ADD, new Response.ErrorListener() {
+			@Override
+			public void onErrorResponse(VolleyError arg0) {
+				dimssLoading();
+				ToastUtil.showErrorNet(activity);
+			}
+		}, new StringJsonObjectRequest.Listener<AddAttentionResult>() {
+			@Override
+			public void onResponse(ObjectResult<AddAttentionResult> result) {
+				dimssLoading();
+				boolean success = Result.defaultParser(MyApplication.getInstance(), result, true);
+				String message = result.toString();
+				if (success) {
+					showToast(R.string.add_attention_succ, R.color.load_submit);
+					// 添加为关注
+					User mUser = new User();
+					mUser.setUserId(String.valueOf(user.getImid()));//已经开通了UU IM的人
+					mUser.setNickName(user.getName());//手机通讯录的名字
+					// 发送推送的消息
+					NewFriendMessage mess = NewFriendMessage.createWillSendMessage(
+							MyApplication.getInstance().mLoginUser, XmppMessage.TYPE_FRIEND, null, mUser);
+					LogUtil.i("mXmppService=" + (mXmppService == null));
+					if (mXmppService != null)
+						mXmppService.sendNewFriendMessage(mUser.getUserId(), mess);
+					// 添加为好友
+					NewFriendDao.getInstance().ascensionNewFriend(mess, Friend.STATUS_FRIEND);
+
+
+					ContactsModel tData = models.get(position);
+					if (StringUtil.isEmpty(tData.getWhichsys())) {
+						tData.setWhichsys("");
+					}
+					tData.setType(1);
+					LogUtil.d("Test", "tdata:" + JSON.toJSONString(tData));
+					contactsDao.update(tData);
+					adapter.notifyDataSetChanged();
+				}
+			}
+		}, AddAttentionResult.class, params);
+		MyApplication.getInstance().getFastVolley().addDefaultRequest("Volley", request);
+	}
+
+
+	private void invite(ContactsModel user, int position) {
+		LogUtil.i("invite");
+		final String name = CommonUtil.getName();
+		final String phone = user.getPhone().trim().replaceAll(" ", "");
 
 //        if (!com.xzjmyk.pm.activity.util.StringUtil.isMobileNumber(phone)) {
 //            showToast("选择人员电话号码为空或是格式不正确", R.color.load_submit);
 //            return;
 //        }
-        StringJsonObjectRequest<AddAttentionResult> request = new StringJsonObjectRequest<AddAttentionResult>(
-                Request.Method.POST, "http://message.ubtob.com/sms/send", new Response.ErrorListener() {
-            @Override
-            public void onErrorResponse(VolleyError arg0) {
-                dimssLoading();
-            }
-        }, new StringJsonObjectRequest.Listener<AddAttentionResult>() {
-            @Override
-            public void onResponse(ObjectResult<AddAttentionResult> result) {
-                String message = result.toString();
-                showToast("短信发送成功", R.color.load_submit);
-                LogUtil.i("message=" + message);
-            }
-        }, AddAttentionResult.class, null) {
-            @Override
-            public byte[] getBody() throws AuthFailureError {
-                String param = "{\"receiver\":\"" + phone + "\",\"params\":[\"" + name + "\"],\"templateId\":\"4b60e18b-de2e-410f-9de1-819265d9e636\"}";
-                LogUtil.i("param=" + param);
-                return param.getBytes();
-            }
-
-            @Override
-            public Map<String, String> getHeaders() {
-                HashMap<String, String> headers = new HashMap<String, String>();
-                headers.put("Accept", "application/json");
-                headers.put("Content-Type", "application/json; charset=UTF-8");
-                return headers;
-            }
-        };
-        MyApplication.getInstance().getFastVolley().addDefaultRequest("Volley", request);
-    }
-
-    @Override
-    protected void onDestroy() {
-        super.onDestroy();
-        if (mBind) {
-            activity.unbindService(mServiceConnection);
-        }
-    }
-
-    private void loadUASFriendsNet() {
-        CommonInterface.getInstance().loadCompanyData(new CommonInterface.OnResultListener() {
-            @Override
-            public void result(@NonNull boolean success, @NonNull int what, @Nullable String message) {
-                try {
-                    if (success) {
-                        String role = CommonUtil.getUserRole();
-                        if ("1".equals(role)) {
-                            //个人用户不需要加载企业架构
-                            loadLocalContacts();
-                        }
-                        boolean isB2b = ApiUtils.getApiModel() instanceof ApiPlatform;
-                        JSONObject object = JSON.parseObject(message);
-                        List<EmployeesEntity> emdatas = null;
-                        if (isB2b) {
-                            emdatas = CompanyHandlerInfoUtil.getEmployeesByB2b(object);
-                        } else {
-                            emdatas = CompanyHandlerInfoUtil.getEmployeesByNet(object);
-                        }
-                        if (ListUtils.isEmpty(emdatas)) return;
-                        for (EmployeesEntity entity : emdatas) {
-                            ContactsModel model = new ContactsModel();
-                            model.setImid(String.valueOf(entity.getEm_IMID()));
-                            model.setType(2);
-                            model.setOwnerId(MyApplication.getInstance().mLoginUser.getUserId());
-                            model.setName(entity.getEM_NAME());
-                            model.setEmail(entity.getEM_EMAIL());
-                            model.setPhone(entity.getEM_MOBILE());
-                            model.setWhichsys(entity.getWHICHSYS());
-                            model.setCompany(entity.getCOMPANY());
-                            tmodels.add(model);
-                        }
-                        loadLocalContacts();
-                    } else {
-                        loadLocalContacts();
-                    }
-                } catch (Exception e) {
-                    loadLocalContacts();
-                }
-            }
-        });
-    }
-
-
-    String HASHCODE = Integer.toHexString(this.hashCode()) + "@";
-
-    private void loadUUFriendForNet() {
-        HashMap<String, String> params = new HashMap<String, String>();
-        params.put("access_token", MyApplication.getInstance().mAccessToken);
-        LogUtil.d("Test", "url:" + MyApplication.getInstance().getConfig().FRIENDS_ATTENTION_LIST);
-        LogUtil.d("Test", "access_token" + MyApplication.getInstance().mAccessToken);
-        StringJsonArrayRequest<AttentionUser> request = new StringJsonArrayRequest<AttentionUser>(
-                MyApplication.getInstance().getConfig().FRIENDS_ATTENTION_LIST, new Response.ErrorListener() {
-            @Override
-            public void onErrorResponse(VolleyError arg0) {
-                loadCompanyContacts();
-            }
-        }, new StringJsonArrayRequest.Listener<AttentionUser>() {
-            @Override
-            public void onResponse(ArrayResult<AttentionUser> result) {
-                LogUtil.d("Test", "result:" + result);
-                boolean success = Result.defaultParser(MyApplication.getInstance(), result, false);
-                if (success) {
-                    FriendDao.getInstance().addAttentionUsers(OAHttpHelper.getInstance(), MyApplication.getInstance().mLoginUser.getUserId(), result.getData(),
-                            new OnCompleteListener() {
-                                @Override
-                                public void onCompleted() {
-                                    List<Friend> friends = FriendDao.getInstance().getFriends(MyApplication.getInstance().mLoginUser.getUserId());
-                                    if (!ListUtils.isEmpty(friends)) {
-                                        for (Friend entity : friends) {
-                                            ContactsModel model = new ContactsModel();
-                                            model.setImid(String.valueOf(entity.getUserId()));
-                                            model.setType(1);
-                                            model.setName(entity.getShowName());
-                                            model.setEmail("");
-                                            model.setOwnerId(MyApplication.getInstance().mLoginUser.getUserId());
-                                            model.setPhone(entity.getPhone());
-                                            //uu好友
-                                            model.setWhichsys(CommonUtil.getSharedPreferences(MyApplication.getInstance(), "erp_master"));
-                                            model.setCompany("");
-                                            tmodels.add(model);
-                                        }
-                                    }
-                                    loadUASFriendsNet();
-                                }
-                            });
-                } else {
-                    loadUASFriendsNet();
-                }
-            }
-        }, AttentionUser.class, params);
-        MyApplication.getInstance().getFastVolley().addDefaultRequest(HASHCODE, request);
-    }
-
-    private void searchContactsByNet(String key) {
-        String url = Constants.IM_BASE_URL() + "user/appSearch";
-        Map<String, Object> params = new HashMap<>();
-        params.put("token", MyApplication.getInstance().mAccessToken);
-        params.put("name", key);
-
-        LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
-        headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
-        ViewUtil.httpSendRequest(ct, url, params, mHandler, headers, 0x01, null, null, "post");
-    }
-
-    private Handler mHandler = new Handler() {
-        @Override
-        public void handleMessage(Message msg) {
-            switch (msg.what) {
-                case 0x01:
-                    try {
-                        String result = msg.getData().getString("result");
-                        String root = JSON.parseObject(result).getString("result");
-                        JSONArray array = JSON.parseArray(root);
-                        List<ContactsModel> xmodels = new ArrayList<>();
-                        for (int i = 0; i < array.size(); i++) {
-                            ContactsModel model = new ContactsModel();
-                            model.setType(2);
-                            model.setOwnerId(MyApplication.getInstance().mLoginUser.getUserId());
-                            model.setImid(array.getJSONObject(i).getString("imid"));
-                            model.setName(array.getJSONObject(i).getString("nickname"));
-                            model.setPhone(array.getJSONObject(i).getString("telephone"));
-                            xmodels.add(model);
-                        }
-                        if (!ListUtils.isEmpty(models)) {
-                            models.clear();
-                            models.addAll(xmodels);
-                        } else {
-                            models.addAll(xmodels);
-                        }
-                        if (adapter != null) {
-                            adapter.notifyDataSetChanged();
-                        }
-                        if (adapter.getCount() == 0) {
-                            emptyLayout.showEmpty();
-                        }
-                    } catch (Exception e) {
-
-                    }
-                    break;
-            }
-        }
-    };
-
-
-    //
-    public void uploadData(List<ContactsModel> models) {
-        if (!ListUtils.isEmpty(models)) {
-            StringBuilder mapBuilder = new StringBuilder("[");
-            for (int i = 0; i < models.size(); i++) {
-                if (i == models.size() - 1) {
-                    mapBuilder.append("{\n" +
-                            "\"am_telephone\":\"" + models.get(i).getPhone() + "\",\n" +
-                            "\"am_username\":\"" + models.get(i).getName() + "\",\n" +
-                            "\"am_userid\":\"" + 0 + "\"\n" +
-                            "}]");
-                } else {
-                    mapBuilder.append("{\n" +
-                            "\"am_telephone\":\"" + models.get(i).getPhone() + "\",\n" +
-                            "\"am_username\":\"" + models.get(i).getName() + "\",\n" +
-                            "\"am_userid\":\"" + 0 + "\"\n" +
-                            "},");
-                }
-            }
-
-            HttpClient httpClient = new HttpClient.Builder().url(Constants.IM_BASE_URL())
-                    .add("comParam", "param")
-                    .isDebug(true).build(true);
-            httpClient.Api().send(new HttpClient.Builder()
-                    .url("/user/appMobileContact")
-                    .header("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8")
-                    .add("token", MyApplication.getInstance().mAccessToken)
-                    .add("userid", MyApplication.getInstance().mLoginUser.getUserId())
-                    .add("username", MyApplication.getInstance().mLoginUser.getNickName())
-                    .add("map", mapBuilder.toString())
-                    .method(Method.POST)
-                    .build(), new ResultSubscriber<>(new ResultListener<Object>() {
-
-                @Override
-                public void onResponse(Object o) {
-                    LogUtil.prinlnLongMsg("HttpLogs", o.toString());
-                    LogUtil.d("HttpLogs", "result:" + o.toString());
-                    if (JSONUtil.validate(o.toString())) {
-
-                    }
-                }
-            }));
-        }
-    }
+		StringJsonObjectRequest<AddAttentionResult> request = new StringJsonObjectRequest<AddAttentionResult>(
+				Request.Method.POST, "http://message.ubtob.com/sms/send", new Response.ErrorListener() {
+			@Override
+			public void onErrorResponse(VolleyError arg0) {
+				dimssLoading();
+			}
+		}, new StringJsonObjectRequest.Listener<AddAttentionResult>() {
+			@Override
+			public void onResponse(ObjectResult<AddAttentionResult> result) {
+				String message = result.toString();
+				showToast("短信发送成功", R.color.load_submit);
+				LogUtil.i("message=" + message);
+			}
+		}, AddAttentionResult.class, null) {
+			@Override
+			public byte[] getBody() throws AuthFailureError {
+				String param = "{\"receiver\":\"" + phone + "\",\"params\":[\"" + name + "\"],\"templateId\":\"4b60e18b-de2e-410f-9de1-819265d9e636\"}";
+				LogUtil.i("param=" + param);
+				return param.getBytes();
+			}
+
+			@Override
+			public Map<String, String> getHeaders() {
+				HashMap<String, String> headers = new HashMap<String, String>();
+				headers.put("Accept", "application/json");
+				headers.put("Content-Type", "application/json; charset=UTF-8");
+				return headers;
+			}
+		};
+		MyApplication.getInstance().getFastVolley().addDefaultRequest("Volley", request);
+	}
+
+	@Override
+	protected void onDestroy() {
+		super.onDestroy();
+		if (mBind) {
+			activity.unbindService(mServiceConnection);
+		}
+	}
+
+	private void loadUASFriendsNet() {
+		CommonInterface.getInstance().loadCompanyData(new CommonInterface.OnResultListener() {
+			@Override
+			public void result(@NonNull boolean success, @NonNull int what, @Nullable String message) {
+				try {
+					if (success) {
+						String role = CommonUtil.getUserRole();
+						if ("1".equals(role)) {
+							//个人用户不需要加载企业架构
+							loadLocalContacts();
+						}
+						boolean isB2b = ApiUtils.getApiModel() instanceof ApiPlatform;
+						JSONObject object = JSON.parseObject(message);
+						List<EmployeesEntity> emdatas = null;
+						if (isB2b) {
+							emdatas = CompanyHandlerInfoUtil.getEmployeesByB2b(object);
+						} else {
+							emdatas = CompanyHandlerInfoUtil.getEmployeesByNet(object);
+						}
+						if (ListUtils.isEmpty(emdatas)) return;
+						for (EmployeesEntity entity : emdatas) {
+							ContactsModel model = new ContactsModel();
+							model.setImid(String.valueOf(entity.getEm_IMID()));
+							model.setType(2);
+							model.setOwnerId(MyApplication.getInstance().mLoginUser.getUserId());
+							model.setName(entity.getEM_NAME());
+							model.setEmail(entity.getEM_EMAIL());
+							model.setPhone(entity.getEM_MOBILE());
+							model.setWhichsys(entity.getWHICHSYS());
+							model.setCompany(entity.getCOMPANY());
+							tmodels.add(model);
+						}
+						loadLocalContacts();
+					} else {
+						loadLocalContacts();
+					}
+				} catch (Exception e) {
+					loadLocalContacts();
+				}
+			}
+		});
+	}
+
+
+	String HASHCODE = Integer.toHexString(this.hashCode()) + "@";
+
+	private void loadUUFriendForNet() {
+		HashMap<String, String> params = new HashMap<String, String>();
+		params.put("access_token", MyApplication.getInstance().mAccessToken);
+		LogUtil.d("Test", "url:" + MyApplication.getInstance().getConfig().FRIENDS_ATTENTION_LIST);
+		LogUtil.d("Test", "access_token" + MyApplication.getInstance().mAccessToken);
+		StringJsonArrayRequest<AttentionUser> request = new StringJsonArrayRequest<AttentionUser>(
+				MyApplication.getInstance().getConfig().FRIENDS_ATTENTION_LIST, new Response.ErrorListener() {
+			@Override
+			public void onErrorResponse(VolleyError arg0) {
+				loadCompanyContacts();
+			}
+		}, new StringJsonArrayRequest.Listener<AttentionUser>() {
+			@Override
+			public void onResponse(ArrayResult<AttentionUser> result) {
+				LogUtil.d("Test", "result:" + result);
+				boolean success = Result.defaultParser(MyApplication.getInstance(), result, false);
+				if (success) {
+					FriendDao.getInstance().addAttentionUsers(OAHttpHelper.getInstance(), MyApplication.getInstance().mLoginUser.getUserId(), result.getData(),
+							new OnCompleteListener() {
+								@Override
+								public void onCompleted() {
+									List<Friend> friends = FriendDao.getInstance().getFriends(MyApplication.getInstance().mLoginUser.getUserId());
+									if (!ListUtils.isEmpty(friends)) {
+										for (Friend entity : friends) {
+											ContactsModel model = new ContactsModel();
+											model.setImid(String.valueOf(entity.getUserId()));
+											model.setType(1);
+											model.setName(entity.getShowName());
+											model.setEmail("");
+											model.setOwnerId(MyApplication.getInstance().mLoginUser.getUserId());
+											model.setPhone(entity.getPhone());
+											//uu好友
+											model.setWhichsys(CommonUtil.getSharedPreferences(MyApplication.getInstance(), "erp_master"));
+											model.setCompany("");
+											tmodels.add(model);
+										}
+									}
+									loadUASFriendsNet();
+								}
+							});
+				} else {
+					loadUASFriendsNet();
+				}
+			}
+		}, AttentionUser.class, params);
+		MyApplication.getInstance().getFastVolley().addDefaultRequest(HASHCODE, request);
+	}
+
+	private void searchContactsByNet(String key) {
+		String url = Constants.IM_BASE_URL() + "user/appSearch";
+		Map<String, Object> params = new HashMap<>();
+		params.put("token", MyApplication.getInstance().mAccessToken);
+		params.put("name", key);
+
+		LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
+		headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
+		ViewUtil.httpSendRequest(ct, url, params, mHandler, headers, 0x01, null, null, "post");
+	}
+
+	private Handler mHandler = new Handler() {
+		@Override
+		public void handleMessage(Message msg) {
+			switch (msg.what) {
+				case 0x01:
+					try {
+						String result = msg.getData().getString("result");
+						String root = JSON.parseObject(result).getString("result");
+						JSONArray array = JSON.parseArray(root);
+						List<ContactsModel> xmodels = new ArrayList<>();
+						for (int i = 0; i < array.size(); i++) {
+							ContactsModel model = new ContactsModel();
+							model.setType(2);
+							model.setOwnerId(MyApplication.getInstance().mLoginUser.getUserId());
+							model.setImid(array.getJSONObject(i).getString("imid"));
+							model.setName(array.getJSONObject(i).getString("nickname"));
+							model.setPhone(array.getJSONObject(i).getString("telephone"));
+							xmodels.add(model);
+						}
+						if (!ListUtils.isEmpty(models)) {
+							models.clear();
+							models.addAll(xmodels);
+						} else {
+							models.addAll(xmodels);
+						}
+						if (adapter != null) {
+							adapter.notifyDataSetChanged();
+						}
+						if (adapter.getCount() == 0) {
+							emptyLayout.showEmpty();
+						}
+					} catch (Exception e) {
+
+					}
+					break;
+			}
+		}
+	};
+
+
+	//
+	public void uploadData(List<ContactsModel> models) {
+		if (!ListUtils.isEmpty(models)) {
+			StringBuilder mapBuilder = new StringBuilder("[");
+			for (int i = 0; i < models.size(); i++) {
+				if (i == models.size() - 1) {
+					mapBuilder.append("{\n" +
+							"\"am_telephone\":\"" + models.get(i).getPhone() + "\",\n" +
+							"\"am_username\":\"" + models.get(i).getName() + "\",\n" +
+							"\"am_userid\":\"" + 0 + "\"\n" +
+							"}]");
+				} else {
+					mapBuilder.append("{\n" +
+							"\"am_telephone\":\"" + models.get(i).getPhone() + "\",\n" +
+							"\"am_username\":\"" + models.get(i).getName() + "\",\n" +
+							"\"am_userid\":\"" + 0 + "\"\n" +
+							"},");
+				}
+			}
+
+			HttpClient httpClient = new HttpClient.Builder().url(Constants.IM_BASE_URL())
+					.add("comParam", "param")
+					.isDebug(true).build(true);
+			httpClient.Api().send(new HttpClient.Builder()
+					.url("/user/appMobileContact")
+					.header("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8")
+					.add("token", MyApplication.getInstance().mAccessToken)
+					.add("userid", MyApplication.getInstance().mLoginUser.getUserId())
+					.add("username", MyApplication.getInstance().mLoginUser.getNickName())
+					.add("map", mapBuilder.toString())
+					.method(Method.POST)
+					.build(), new ResultSubscriber<>(new ResultListener<Object>() {
+
+				@Override
+				public void onResponse(Object o) {
+					LogUtil.prinlnLongMsg("HttpLogs", o.toString());
+					LogUtil.d("HttpLogs", "result:" + o.toString());
+					if (JSONUtil.validate(o.toString())) {
+
+					}
+				}
+			}));
+		}
+	}
 }

+ 0 - 27
app_modular/appme/src/main/java/com/uas/appme/pedometer/constant/Constant.java

@@ -1,27 +0,0 @@
-package com.uas.appme.pedometer.constant;
-
-/**
- * Created by FANGLH
- * Date : 2017/3/24
- * To do :
- */
-
-public class Constant {
-    public static final int MSG_FROM_CLIENT = 0;
-    public static final int MSG_FROM_SERVER = 1;
-    public static final String BASEURL = "http://news-at.zhihu.com/api/4/";
-    public static final String START = "start-image/1080*1776";
-    public static final String THEMES = "themes";
-    public static final String LATESTNEWS = "news/latest";
-    public static final String BEFORE = "news/before/";
-    public static final String THEMENEWS = "theme/";
-    public static final String CONTENT = "news/";
-    public static final int TOPIC = 131;
-    public static final String START_LOCATION = "start_location";
-    public static final String CACHE = "cache";
-    public static final int LATEST_COLUMN = Integer.MAX_VALUE;
-    public static final int BASE_COLUMN = 100000000;
-    public static String TRACK_STEP = "TRACKSTEP";
-    public static String BASE_STEP_URL = "http://113.105.74.140:8092/user/";
-//    public static String BASE_STEP_URL = "http://192.168.253.136:8092/";
-}

+ 3 - 3
app_modular/appme/src/main/java/com/uas/appme/pedometer/service/StepService.java

@@ -25,10 +25,10 @@ import android.os.RemoteException;
 
 import com.baidu.mapapi.model.LatLng;
 import com.common.LogUtil;
+import com.core.app.Constants;
 import com.core.app.MyApplication;
 import com.uas.appme.R;
 import com.uas.appme.pedometer.bean.StepEntity;
-import com.uas.appme.pedometer.constant.Constant;
 import com.uas.appme.pedometer.db.StepDataDao;
 import com.uas.appme.pedometer.utils.StepUtils;
 import com.uas.appme.pedometer.utils.TimeUtil;
@@ -137,11 +137,11 @@ public class StepService extends Service implements SensorEventListener {
         @Override
         public void handleMessage(Message msg) {
             switch (msg.what) {
-                case Constant.MSG_FROM_CLIENT:
+                case Constants.MSG_FROM_CLIENT:
                     try {
                         //这里负责将当前的步数发送出去,可以在界面或者其他地方获取,我这里是在MainActivity中获取来更新界面
                         Messenger messenger = msg.replyTo;
-                        Message replyMsg = Message.obtain(null, Constant.MSG_FROM_SERVER);
+                        Message replyMsg = Message.obtain(null, Constants.MSG_FROM_SERVER);
                         Bundle bundle = new Bundle();
                         bundle.putInt("steps", CURRENT_STEP);
                         replyMsg.setData(bundle);

+ 2 - 2
app_modular/appme/src/main/java/com/uas/appme/pedometer/utils/StepHttpUtils.java

@@ -4,9 +4,9 @@ import android.content.Context;
 import android.net.ConnectivityManager;
 import android.net.NetworkInfo;
 
+import com.core.app.Constants;
 import com.loopj.android.http.AsyncHttpClient;
 import com.loopj.android.http.ResponseHandlerInterface;
-import com.uas.appme.pedometer.constant.Constant;
 
 /**
  *Created by FANGlh on 2017/4/24.
@@ -16,7 +16,7 @@ public class StepHttpUtils {
     private static AsyncHttpClient client = new AsyncHttpClient();
 
     public static void get(String url, ResponseHandlerInterface responseHandler) {
-        client.get(Constant.BASEURL + url, responseHandler);
+        client.get(Constants.BASEURL + url, responseHandler);
     }
 
     public static void getImage(String url, ResponseHandlerInterface responseHandler) {

+ 4 - 5
app_modular/appme/src/main/java/com/uas/appme/pedometer/utils/StepUtils.java

@@ -1,7 +1,6 @@
 package com.uas.appme.pedometer.utils;
 
 import android.content.Intent;
-import android.support.v4.content.LocalBroadcastManager;
 import android.util.Log;
 import android.widget.Toast;
 
@@ -14,6 +13,7 @@ import com.common.data.JSONUtil;
 import com.common.data.ListUtils;
 import com.common.data.StringUtil;
 import com.core.app.AppConstant;
+import com.core.app.Constants;
 import com.core.app.MyApplication;
 import com.core.broadcast.MsgBroadcast;
 import com.core.model.Friend;
@@ -33,7 +33,6 @@ import com.me.network.app.http.rx.ResultSubscriber;
 import com.uas.appme.pedometer.bean.PersonalStepBean;
 import com.uas.appme.pedometer.bean.StepEntity;
 import com.uas.appme.pedometer.bean.StepsRankingBean;
-import com.uas.appme.pedometer.constant.Constant;
 import com.uas.appme.pedometer.db.StepDataDao;
 
 import java.util.HashMap;
@@ -66,7 +65,7 @@ public class StepUtils {
         saveMap.put("as_uusteps", steps);
         saveMap.put("as_date", date);
         String map = JSONUtil.map2JSON(saveMap);
-        HttpClient httpClient = new HttpClient.Builder(Constant.BASE_STEP_URL).isDebug(true).build(true);
+        HttpClient httpClient = new HttpClient.Builder(Constants.BASE_STEP_URL).isDebug(true).build(true);
         httpClient.Api().send(new HttpClient.Builder()
                 .url("appUUsteps")
                 .add("map", map)
@@ -150,7 +149,7 @@ public class StepUtils {
         if (MyApplication.getInstance() == null
                 || MyApplication.getInstance().mLoginUser == null
                 || MyApplication.getInstance().mLoginUser.getUserId() == null) return;
-        HttpClient httpClient = new HttpClient.Builder(Constant.BASE_STEP_URL).isDebug(true).build(true);
+        HttpClient httpClient = new HttpClient.Builder(Constants.BASE_STEP_URL).isDebug(true).build(true);
         httpClient.Api().send(new HttpClient.Builder()
                 .url("appSteps")
                 .add("userid", MyApplication.getInstance().mLoginUser.getUserId())
@@ -207,7 +206,7 @@ public class StepUtils {
         if (!doPrise) return;
 
         //点赞操作
-        HttpClient httpClient = new HttpClient.Builder(Constant.BASE_STEP_URL).isDebug(true).build(true);
+        HttpClient httpClient = new HttpClient.Builder(Constants.BASE_STEP_URL).isDebug(true).build(true);
         httpClient.Api().send(new HttpClient.Builder()
                 .url("appStepPrise")
                 .add("userid",userid) // 点赞对象ID

+ 3 - 3
app_modular/appme/src/main/java/com/uas/appme/pedometer/view/NewStepActivity.java

@@ -20,12 +20,12 @@ import android.view.WindowManager;
 import android.widget.LinearLayout;
 import android.widget.TextView;
 
+import com.core.app.Constants;
 import com.core.base.BaseActivity;
 import com.core.utils.CommonUtil;
 import com.uas.appme.R;
 import com.uas.appme.pedometer.bean.StepEntity;
 import com.uas.appme.pedometer.calendar.BeforeOrAfterCalendarView;
-import com.uas.appme.pedometer.constant.Constant;
 import com.uas.appme.pedometer.db.StepDataDao;
 import com.uas.appme.pedometer.service.StepService;
 import com.uas.appme.pedometer.utils.StepCountCheckUtil;
@@ -188,7 +188,7 @@ public class NewStepActivity extends BaseActivity implements Handler.Callback {
                 public void run() {
                     try {
                         messenger = new Messenger(service);
-                        Message msg = Message.obtain(null, Constant.MSG_FROM_CLIENT);
+                        Message msg = Message.obtain(null, Constants.MSG_FROM_CLIENT);
                         msg.replyTo = mGetReplyMessenger;
                         messenger.send(msg);
                     } catch (RemoteException e) {
@@ -282,7 +282,7 @@ public class NewStepActivity extends BaseActivity implements Handler.Callback {
     public boolean handleMessage(Message msg) {
         switch (msg.what) {
             //这里用来获取到Service发来的数据
-            case Constant.MSG_FROM_SERVER:
+            case Constants.MSG_FROM_SERVER:
 
                 //如果是今天则更新数据
                 if (curSelDate.equals(TimeUtil.getCurrentDate())) {

+ 4 - 4
app_modular/appme/src/main/java/com/uas/appme/pedometer/view/PersonalPageActivity.java

@@ -25,6 +25,7 @@ import com.common.data.JSONUtil;
 import com.common.data.ListUtils;
 import com.common.data.StringUtil;
 import com.common.system.DisplayUtil;
+import com.core.app.Constants;
 import com.core.app.MyApplication;
 import com.core.base.BaseActivity;
 import com.core.utils.CommonUtil;
@@ -39,7 +40,6 @@ import com.uas.appcontact.ui.activity.ContactsActivity;
 import com.uas.appme.R;
 import com.uas.appme.pedometer.bean.ComPolylineBean;
 import com.uas.appme.pedometer.bean.PersonalStepBean;
-import com.uas.appme.pedometer.constant.Constant;
 import com.uas.appme.pedometer.utils.PolylineUtils;
 import com.uas.appme.pedometer.utils.StepUtils;
 import com.uas.appme.pedometer.utils.TimeUtil;
@@ -127,7 +127,7 @@ public class PersonalPageActivity extends BaseActivity implements View.OnClickLi
         }
         if (StringUtil.isEmpty(userid)) return;
         progressDialog.show();
-        HttpClient httpClient = new HttpClient.Builder(Constant.BASE_STEP_URL).isDebug(true).build(true);
+        HttpClient httpClient = new HttpClient.Builder(Constants.BASE_STEP_URL).isDebug(true).build(true);
         httpClient.getHeaders().remove("Content-Type");
         httpClient.Api().send(new HttpClient.Builder()
                 .url("appSteps")
@@ -209,7 +209,7 @@ public class PersonalPageActivity extends BaseActivity implements View.OnClickLi
         mMovementTotalStepsTimeTv.setText(now_time);
 
         //获取点赞信息
-        HttpClient httpClient = new HttpClient.Builder(Constant.BASE_STEP_URL).isDebug(true).build(true);
+        HttpClient httpClient = new HttpClient.Builder(Constants.BASE_STEP_URL).isDebug(true).build(true);
         httpClient.Api().send(new HttpClient.Builder()
                 .url("appPriseList")
                 .add("userid",userid)
@@ -230,7 +230,7 @@ public class PersonalPageActivity extends BaseActivity implements View.OnClickLi
     }
 
     private void doAttendHandle(int attention_type) {
-        HttpClient httpClient = new HttpClient.Builder(Constant.BASE_STEP_URL).isDebug(true).build(true);
+        HttpClient httpClient = new HttpClient.Builder(Constants.BASE_STEP_URL).isDebug(true).build(true);
         httpClient.Api().send(new HttpClient.Builder()
                 .url("appUUSet")
                 .add("userids", userid)

+ 2 - 2
app_modular/appme/src/main/java/com/uas/appme/pedometer/view/StepSplashActivity.java

@@ -12,10 +12,10 @@ import android.view.animation.ScaleAnimation;
 import android.widget.ImageView;
 import android.widget.Toast;
 
+import com.core.app.Constants;
 import com.loopj.android.http.AsyncHttpResponseHandler;
 import com.loopj.android.http.BinaryHttpResponseHandler;
 import com.uas.appme.R;
-import com.uas.appme.pedometer.constant.Constant;
 import com.uas.appme.pedometer.utils.StepHttpUtils;
 
 import org.apache.http.Header;
@@ -74,7 +74,7 @@ public class StepSplashActivity extends Activity {
             @Override
             public void onAnimationEnd(Animation animation) {
                 if (StepHttpUtils.isNetworkConnected(StepSplashActivity.this)) {
-                    StepHttpUtils.get(Constant.START, new AsyncHttpResponseHandler() {
+                    StepHttpUtils.get(Constants.START, new AsyncHttpResponseHandler() {
                         @Override
                         public void onSuccess(int i, Header[] headers, byte[] bytes) {
                             try {

+ 2 - 2
app_modular/appme/src/main/java/com/uas/appme/pedometer/view/UURanking.java

@@ -23,6 +23,7 @@ import com.common.data.JSONUtil;
 import com.common.data.ListUtils;
 import com.common.data.StringUtil;
 import com.core.app.AppConstant;
+import com.core.app.Constants;
 import com.core.app.MyApplication;
 import com.core.base.BaseActivity;
 import com.core.utils.CommonUtil;
@@ -40,7 +41,6 @@ import com.uas.appme.pedometer.adapter.UUAttentionAdapter;
 import com.uas.appme.pedometer.adapter.UURankingAdapter;
 import com.uas.appme.pedometer.bean.StepEntity;
 import com.uas.appme.pedometer.bean.StepsRankingBean;
-import com.uas.appme.pedometer.constant.Constant;
 import com.uas.appme.pedometer.db.StepDataDao;
 import com.uas.appme.pedometer.utils.StepUtils;
 import com.uas.appme.pedometer.utils.TimeUtil;
@@ -200,7 +200,7 @@ public class UURanking extends BaseActivity implements View.OnClickListener {
         }
         progressDialog.show();
         //获取所有人的当天步数数据
-        HttpClient httpClient = new HttpClient.Builder(Constant.BASE_STEP_URL).isDebug(true).build(true);
+        HttpClient httpClient = new HttpClient.Builder(Constants.BASE_STEP_URL).isDebug(true).build(true);
         httpClient.Api().send(new HttpClient.Builder()
                 .url("appStepsrank")
                 .add("userid",MyApplication.getInstance().mLoginUser.getUserId())

+ 0 - 22
app_modular/appme/src/main/java/com/uas/appme/settings/Constant/Constant.java

@@ -1,22 +0,0 @@
-package com.uas.appme.settings.Constant;
-
-import com.core.app.MyApplication;
-import com.core.utils.CommonUtil;
-
-/**
- * Created by FANGlh on 2017/8/30.
- * function:
- */
-
-public class Constant {
-    public static String BAIDU_PUSH = "BAIDUPUSH";
-    public static String UU_STEP = "UUSTEP";
-    public static String BASE_BOOKING_SETTING_URL= "http://113.105.74.140:8092/"; //发布正式ip
-//    public static String BASE_BOOKING_SETTING_URL= "http://192.168.253.136:8092/";   //测试LQM本地ip
-    public static String BASE_COMPANYID =  CommonUtil.getSharedPreferences(MyApplication.getInstance(),"erp_uu");
-//    public static String BASE_COMPANYID = "201";
-
-    public static String B_SETTINGRED = "B_SETTINGRED";
-    public static String UU_STEP_RED = "UU_STEP_RED";
-    public static String BASE_LQM_URL = "http://192.168.253.136:8092/";
-}

+ 2 - 2
app_modular/appme/src/main/java/com/uas/appme/settings/activity/BComSetCompanyRestActivity.java

@@ -19,6 +19,7 @@ import com.common.data.DateFormatUtil;
 import com.common.data.JSONUtil;
 import com.common.data.ListUtils;
 import com.common.data.StringUtil;
+import com.core.app.Constants;
 import com.core.app.MyApplication;
 import com.core.base.BaseActivity;
 import com.core.utils.CommonUtil;
@@ -31,7 +32,6 @@ import com.me.network.app.http.rx.Result2Listener;
 import com.me.network.app.http.rx.ResultSubscriber;
 import com.uas.appme.R;
 import com.uas.appme.pedometer.utils.TimeUtil;
-import com.uas.appme.settings.Constant.Constant;
 import com.uas.appme.settings.model.CompanyRestBean;
 
 import java.util.ArrayList;
@@ -118,7 +118,7 @@ public class BComSetCompanyRestActivity extends BaseActivity implements View.OnC
     }
 
     private void doSave(List<CompanyRestBean> mList) {
-        HttpClient httpClient = new HttpClient.Builder(Constant.BASE_BOOKING_SETTING_URL).isDebug(true).build(true);
+        HttpClient httpClient = new HttpClient.Builder(Constants.IM_BASE_URL()).isDebug(true).build(true);
         progressDialog.show();
         httpClient.Api().send(new HttpClient.Builder()
                 .url("user/appBatchCrest")

+ 3 - 3
app_modular/appme/src/main/java/com/uas/appme/settings/activity/BComSetEmployeeRestActivity.java

@@ -26,6 +26,7 @@ import com.common.data.JSONUtil;
 import com.common.data.ListUtils;
 import com.common.data.StringUtil;
 import com.common.system.DisplayUtil;
+import com.core.app.Constants;
 import com.core.app.MyApplication;
 import com.core.base.BaseActivity;
 import com.core.model.SelectBean;
@@ -41,7 +42,6 @@ import com.me.network.app.http.rx.ResultListener;
 import com.me.network.app.http.rx.ResultSubscriber;
 import com.uas.appme.R;
 import com.uas.appme.pedometer.utils.TimeUtil;
-import com.uas.appme.settings.Constant.Constant;
 import com.uas.appme.settings.model.ComRestBean;
 import com.uas.appme.settings.model.PersonSetingBean;
 
@@ -72,7 +72,7 @@ public class BComSetEmployeeRestActivity extends BaseActivity implements View.On
     private void initData() {
 
         //获取商家服务人员
-        HttpClient httpClient = new HttpClient.Builder(Constant.BASE_BOOKING_SETTING_URL).isDebug(true).build(true);
+        HttpClient httpClient = new HttpClient.Builder(Constants.IM_BASE_URL()).isDebug(true).build(true);
         httpClient.Api().send(new HttpClient.Builder()
                 .url("user/appStoreman")
 //                .add("companyid", 201)
@@ -179,7 +179,7 @@ public class BComSetEmployeeRestActivity extends BaseActivity implements View.On
     }
 
     private void doSave(List<ComRestBean> mList) {
-        HttpClient httpClient = new HttpClient.Builder(Constant.BASE_BOOKING_SETTING_URL).isDebug(true).build(true);
+        HttpClient httpClient = new HttpClient.Builder(Constants.IM_BASE_URL()).isDebug(true).build(true);
         progressDialog.show();
         httpClient.Api().send(new HttpClient.Builder()
                 .url("user/appBatchMrest")

+ 1 - 2
app_modular/appme/src/main/java/com/uas/appme/settings/activity/BRestActivity.java

@@ -28,7 +28,6 @@ import com.me.network.app.http.Method;
 import com.me.network.app.http.rx.ResultListener;
 import com.me.network.app.http.rx.ResultSubscriber;
 import com.uas.appme.R;
-import com.uas.appme.settings.Constant.Constant;
 import com.uas.appme.settings.adapter.BRestAdapter;
 import com.uas.appme.settings.model.BRest;
 import com.uas.appworks.OA.erp.utils.MostLinearLayoutManager;
@@ -172,7 +171,7 @@ public class BRestActivity extends BaseActivity implements BRestAdapter.OnItemCl
                     break;
             }
 
-			HttpClient httpClient = new HttpClient.Builder(Constant.BASE_BOOKING_SETTING_URL).isDebug(true).build(true);
+			HttpClient httpClient = new HttpClient.Builder(Constants.IM_BASE_URL()).isDebug(true).build(true);
 			httpClient.Api().send(new HttpClient.Builder()
 					.url("user/appStoreDel")
 					.add("keyfield", keyfield)

+ 29 - 6
app_modular/appme/src/main/java/com/uas/appme/settings/activity/BSetComRestListActivity.java

@@ -9,6 +9,7 @@ import android.view.View;
 import android.view.ViewGroup;
 import android.widget.AdapterView;
 import android.widget.BaseAdapter;
+import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.PopupWindow;
 import android.widget.RelativeLayout;
@@ -19,7 +20,9 @@ import com.common.LogUtil;
 import com.common.data.DateFormatUtil;
 import com.common.data.JSONUtil;
 import com.common.data.ListUtils;
+import com.common.data.StringUtil;
 import com.common.system.DisplayUtil;
+import com.core.app.Constants;
 import com.core.app.MyApplication;
 import com.core.base.BaseActivity;
 import com.core.utils.CommonUtil;
@@ -29,8 +32,8 @@ import com.me.network.app.http.HttpClient;
 import com.me.network.app.http.Method;
 import com.me.network.app.http.rx.ResultListener;
 import com.me.network.app.http.rx.ResultSubscriber;
+import com.nostra13.universalimageloader.core.ImageLoader;
 import com.uas.appme.R;
-import com.uas.appme.settings.Constant.Constant;
 import com.uas.appme.settings.model.BSettingPlaceBean;
 import com.uas.appme.settings.model.CompanyRestListBean;
 import com.uas.appme.settings.model.EmployeeRestListBean;
@@ -155,7 +158,7 @@ public class BSetComRestListActivity extends BaseActivity {
 				break;
 		}
 
-		HttpClient httpClient = new HttpClient.Builder(Constant.BASE_BOOKING_SETTING_URL).isDebug(true).build(true);
+		HttpClient httpClient = new HttpClient.Builder(Constants.IM_BASE_URL()).isDebug(true).build(true);
 		httpClient.Api().send(new HttpClient.Builder()
 				.url("user/appStoreDel")
 				.add("keyfield", keyfield)
@@ -244,7 +247,7 @@ public class BSetComRestListActivity extends BaseActivity {
 			ToastMessage(getString(R.string.common_notlinknet));
 			return;
 		}
-		HttpClient httpClient = new HttpClient.Builder(Constant.BASE_BOOKING_SETTING_URL).isDebug(true).build(true);
+		HttpClient httpClient = new HttpClient.Builder(Constants.IM_BASE_URL()).isDebug(true).build(true);
 		httpClient.Api().send(new HttpClient.Builder()
 				.url(url)
 //				.add("companyid", 201)
@@ -356,18 +359,38 @@ public class BSetComRestListActivity extends BaseActivity {
 				viewHolder = new ViewHolder();
 				convertView = View.inflate(mContext, R.layout.com_location_item, null);
 				viewHolder.name_tv = (TextView) convertView.findViewById(R.id.name_tv);
-				viewHolder.industry_tv = (TextView) convertView.findViewById(R.id.industry_tv);
+				viewHolder.image_im = (ImageView) convertView.findViewById(R.id.image_im);
+				viewHolder.sTime_rl = (RelativeLayout) convertView.findViewById(R.id.service_time_rl);
+				viewHolder.sTime_tv = (TextView) convertView.findViewById(R.id.service_time_tv);
+				viewHolder.image_rl = (RelativeLayout) convertView.findViewById(R.id.image_rl);
+				if("会所".equals(sc_industry) )
+					viewHolder.sTime_rl.setVisibility(View.VISIBLE);
+				else
+					viewHolder.sTime_rl.setVisibility(View.GONE);
 				convertView.setTag(viewHolder);
 			} else {
 				viewHolder = (ViewHolder) convertView.getTag();
 			}
+			//显示名称
 			viewHolder.name_tv.setText(model.getResult().get(position).getSt_name());
+
+			//显示服务时间
+			viewHolder.sTime_tv.setText(model.getResult().get(position).getSt_servicetime() + getString(R.string.minute));
+
+			//显示照片
+			if (!StringUtil.isEmpty(model.getResult().get(position).getSt_imageurl())){
+				viewHolder.image_rl.setVisibility(View.VISIBLE);
+				ImageLoader.getInstance().displayImage(model.getResult().get(position).getSt_imageurl(),viewHolder.image_im);
+			}else
+				viewHolder.image_rl.setVisibility(View.GONE);
+
 			return convertView;
 		}
 
 		class ViewHolder {
-			TextView name_tv;
-			TextView industry_tv;
+			TextView name_tv,sTime_tv;
+			ImageView image_im;
+			RelativeLayout sTime_rl,image_rl;
 		}
 	}
 

+ 2 - 2
app_modular/appme/src/main/java/com/uas/appme/settings/activity/BSettingActivity.java

@@ -10,6 +10,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.common.LogUtil;
 import com.common.data.JSONUtil;
 import com.common.data.ListUtils;
+import com.core.app.Constants;
 import com.core.app.MyApplication;
 import com.core.base.BaseActivity;
 import com.core.utils.CommonUtil;
@@ -18,7 +19,6 @@ import com.me.network.app.http.Method;
 import com.me.network.app.http.rx.ResultListener;
 import com.me.network.app.http.rx.ResultSubscriber;
 import com.uas.appme.R;
-import com.uas.appme.settings.Constant.Constant;
 
 /**
  * Created by FANGlh on 2017/10/10.
@@ -40,7 +40,7 @@ public class BSettingActivity extends BaseActivity implements View.OnClickListen
     }
 
     private void judgeWhichType() {
-        HttpClient httpClient = new HttpClient.Builder(Constant.BASE_BOOKING_SETTING_URL).isDebug(true).build(true);
+        HttpClient httpClient = new HttpClient.Builder(Constants.IM_BASE_URL()).isDebug(true).build(true);
         httpClient.Api().send(new HttpClient.Builder()
                 .url("user/appCompanyType")
                 .add("companyid", CommonUtil.getSharedPreferences(MyApplication.getInstance(),"erp_uu"))

+ 395 - 81
app_modular/appme/src/main/java/com/uas/appme/settings/activity/BSettingLocationActivity.java

@@ -1,8 +1,12 @@
 package com.uas.appme.settings.activity;
 
+import android.Manifest;
 import android.app.Activity;
+import android.app.AlertDialog;
 import android.content.Context;
+import android.content.DialogInterface;
 import android.content.Intent;
+import android.net.Uri;
 import android.os.Bundle;
 import android.util.DisplayMetrics;
 import android.view.Gravity;
@@ -15,35 +19,52 @@ import android.view.WindowManager;
 import android.widget.BaseAdapter;
 import android.widget.Button;
 import android.widget.EditText;
+import android.widget.ImageView;
 import android.widget.PopupWindow;
 import android.widget.RelativeLayout;
 import android.widget.TextView;
 import android.widget.Toast;
 
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.andreabaccega.widget.FormEditText;
 import com.common.LogUtil;
 import com.common.data.JSONUtil;
 import com.common.data.ListUtils;
 import com.common.data.StringUtil;
 import com.common.system.DisplayUtil;
+import com.common.system.PermissionUtil;
+import com.common.ui.CameraUtil;
+import com.core.app.Constants;
 import com.core.app.MyApplication;
 import com.core.base.BaseActivity;
+import com.core.net.http.ViewUtil;
 import com.core.utils.CommonUtil;
+import com.core.utils.ToastUtil;
 import com.core.widget.MyListView;
+import com.lidroid.xutils.HttpUtils;
+import com.lidroid.xutils.exception.HttpException;
+import com.lidroid.xutils.http.ResponseInfo;
+import com.lidroid.xutils.http.callback.RequestCallBack;
+import com.lidroid.xutils.http.client.HttpRequest;
 import com.me.network.app.http.HttpClient;
 import com.me.network.app.http.Method;
 import com.me.network.app.http.rx.Result2Listener;
 import com.me.network.app.http.rx.ResultListener;
 import com.me.network.app.http.rx.ResultSubscriber;
+import com.nostra13.universalimageloader.core.ImageLoader;
 import com.uas.appme.R;
-import com.uas.appme.settings.Constant.Constant;
 import com.uas.appme.settings.model.BSetLocationBean;
+import com.umeng.socialize.utils.Log;
 
+import java.io.File;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * Created by FANGlh on 2017/10/12.
@@ -62,34 +83,28 @@ public class BSettingLocationActivity extends BaseActivity implements View.OnCli
     private String st_id;
     private String updateData;
     private Button deleteBtn;
-
+    private ArrayList<String> mPhotoList;
+    private int image_position; // 点击点击照片添加/更换 记住的position
+    private Uri mNewPhotoUri;// 拍照和图库 获得图片的URI
+    private static final int REQUEST_CODE_CAPTURE_PHOTO = 1;// 拍照
+    private static final int REQUEST_CODE_PICK_PHOTO = 2;// 图库
+    private Boolean updateChangeP = false; //更新是否更换了照片,若没换
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.service_bcom_setting_activity);
         initView();
         initData();
+        String[] permissions = new String[]{Manifest.permission.CAMERA, Manifest.permission.READ_EXTERNAL_STORAGE};
+        for (String permission : permissions) {
+            if (PermissionUtil.lacksPermissions(ct, permission)) {
+                PermissionUtil.requestPermission(this, PermissionUtil.DEFAULT_REQUEST, permission);
+            }
+        }
     }
 
     private void initData() {
 
-    }
-
-    private void initView() {
-        mList = new ArrayList<>();
-        mComList = (MyListView) findViewById(R.id.com_list);
-        add_new_rl = (RelativeLayout) findViewById(R.id.add_new_rl);
-        add_new_rl.setOnClickListener(this);
-        myAdapter = new BSetLocationAdapter(this);
-        myAdapter.setModelList(mList);
-        mComList.setAdapter(myAdapter);
-        save_bt = (Button) findViewById(R.id.save_bt);
-        save_bt.setOnClickListener(this);
-
-        deleteBtn = (Button)findViewById(R.id.deleteBtn);
-        deleteBtn.setOnClickListener(this);
-
-
         //接收商家类型
         sc_industry = getIntent().getStringExtra("sc_industry");
         sc_industrycode = getIntent().getStringExtra("sc_industrycode");
@@ -99,7 +114,7 @@ public class BSettingLocationActivity extends BaseActivity implements View.OnCli
             update = true;
             save_bt.setText(getString(R.string.common_update_button));
             add_new_rl.setVisibility(View.GONE);
-            getSupportActionBar().setTitle("更新设置服务/场地/房间");
+            getSupportActionBar().setTitle("更新服务/场地/房间");
 
             st_id = JSON.parseObject(updateData).getString("st_id");
             BSetLocationBean model = new BSetLocationBean();
@@ -107,6 +122,8 @@ public class BSettingLocationActivity extends BaseActivity implements View.OnCli
             model.setSt_companyid(JSON.parseObject(updateData).getString("st_companyid"));
             model.setSt_siid(JSON.parseObject(updateData).getString("st_siid"));
             model.setSt_name(JSON.parseObject(updateData).getString("st_name"));
+            model.setSt_servicetime(JSON.parseObject(updateData).getString("st_servicetime"));
+            model.setSt_imageurl(JSON.parseObject(updateData).getString("st_imageurl"));
             mList.add(model);
             myAdapter.notifyDataSetChanged();
         }else {
@@ -116,17 +133,35 @@ public class BSettingLocationActivity extends BaseActivity implements View.OnCli
             model.setSt_companyid(CommonUtil.getSharedPreferences(MyApplication.getInstance(),"erp_uu"));
             model.setSt_siid(StringUtil.isEmpty(sc_industrycode) ? "0" : sc_industrycode);
             model.setSt_name("");
+            model.setSt_servicetime("0");
+            model.setSt_imageurl("");
 //            model.setSt_id("0");
             mList.add(model);
             myAdapter.notifyDataSetChanged();
         }
     }
+
+    private void initView() {
+        mList = new ArrayList<>();
+        mComList = (MyListView) findViewById(R.id.com_list);
+        add_new_rl = (RelativeLayout) findViewById(R.id.add_new_rl);
+        add_new_rl.setOnClickListener(this);
+        myAdapter = new BSetLocationAdapter(this);
+        myAdapter.setModelList(mList);
+        mComList.setAdapter(myAdapter);
+        save_bt = (Button) findViewById(R.id.save_bt);
+        save_bt.setOnClickListener(this);
+
+        deleteBtn = (Button)findViewById(R.id.deleteBtn);
+        deleteBtn.setOnClickListener(this);
+
+        mPhotoList = new ArrayList<>();
+        myAdapter.setPhotoList(mPhotoList);
+    }
     @Override
     public boolean onPrepareOptionsMenu(Menu menu) {
         menu.clear();
-        if (!StringUtil.isEmpty(updateData)) {
-
-        } else {
+        if (StringUtil.isEmpty(updateData)) {
             getMenuInflater().inflate(R.menu.bsetting_more, menu);
         }
         return super.onPrepareOptionsMenu(menu);
@@ -150,29 +185,44 @@ public class BSettingLocationActivity extends BaseActivity implements View.OnCli
     @Override
     public void onClick(View v) {
         if (v.getId() == R.id.add_new_rl){
+            LogUtil.prinlnLongMsg("mPhotoList",JSON.toJSONString(mPhotoList));
             if (StringUtil.isEmpty(mList.get(mList.size()-1).getSt_name())){
                 ToastMessage("请输入名称");
                 return;
             }
+            if (mPhotoList.size() < mList.size()){
+                ToastMessage("请添加照片");
+                return;
+            }
             BSetLocationBean model = new BSetLocationBean();
             model.setSt_companyname(CommonUtil.getSharedPreferences(MyApplication.getInstance(),"erp_commpany"));
             model.setSt_companyid(CommonUtil.getSharedPreferences(MyApplication.getInstance(),"erp_uu"));
             model.setSt_siid(StringUtil.isEmpty(sc_industrycode) ? "0" : sc_industrycode);
             model.setSt_name("");
+            model.setSt_servicetime("");
+            model.setSt_imageurl("");
 //            model.setSt_id("0");
             mList.add(model);
             myAdapter.notifyDataSetChanged();
         }else if (v.getId() == R.id.save_bt){
             LogUtil.prinlnLongMsg("mList", JSON.toJSONString(mList));
             if (ListUtils.isEmpty(mList)) return;
+            if (StringUtil.isEmpty(mList.get(mList.size()-1).getSt_name())){
+                ToastMessage("请输入名称");
+                return;
+            }
             if (!CommonUtil.isNetWorkConnected(this)) {
                 ToastMessage(getString(R.string.common_notlinknet));
                 return;
             }else {
-                if (update && !StringUtil.isEmpty(st_id))
-                    doUpdate();
+                if (update && !StringUtil.isEmpty(st_id)){
+                    if (updateChangeP)   // 更换过照片
+                        doJudegeCNow_p();//开始上传第一张图片
+                    else
+                        doUpdate();
+                }
                 else
-                    doSave(mList);
+                    doSaveJudge(mList);
             }
 
         }else if (v.getId() == R.id.deleteBtn){
@@ -189,7 +239,7 @@ public class BSettingLocationActivity extends BaseActivity implements View.OnCli
         String tablename = "ServiceType";
         String id = st_id;
 
-        HttpClient httpClient = new HttpClient.Builder(Constant.BASE_BOOKING_SETTING_URL).isDebug(true).build(true);
+        HttpClient httpClient = new HttpClient.Builder(Constants.IM_BASE_URL()).isDebug(true).build(true);
         httpClient.Api().send(new HttpClient.Builder()
                 .url("user/appStoreDel")
                 .add("keyfield", keyfield)
@@ -225,10 +275,11 @@ public class BSettingLocationActivity extends BaseActivity implements View.OnCli
             param.put("st_name",mList.get(0).getSt_name());
             param.put("st_siid",mList.get(0).getSt_siid());
             param.put("st_companyid",mList.get(0).getSt_companyid());
-            param.put("st_companyname",mList.get(0).getSt_companyname());
+            param.put("st_imageurl",mList.get(0).getSt_imageurl());
+            param.put("st_servicetime",mList.get(0).getSt_servicetime());
             progressDialog.show();save_bt.setEnabled(false);
 
-            HttpClient httpClient = new HttpClient.Builder(Constant.BASE_BOOKING_SETTING_URL).isDebug(true).build(true);
+            HttpClient httpClient = new HttpClient.Builder(Constants.IM_BASE_URL()).isDebug(true).build(true);
             httpClient.Api().send(new HttpClient.Builder()
                     .url("user/appServiceSet")
                     .add("map",JSON.toJSONString(param))
@@ -258,53 +309,166 @@ public class BSettingLocationActivity extends BaseActivity implements View.OnCli
 
     }
 
-    private void doSave(List<BSetLocationBean> mList) {
+    private void doSaveJudge(List<BSetLocationBean> mList) {
+        if (mPhotoList.size() < mList.size()){
+            ToastMessage("请添加照片");
+            return;
+        }
         for (int i = 0; i < mList.size(); i++) {
             if (StringUtil.isEmpty(mList.get(i).getSt_name())){
                 ToastMessage("请输入名称");
                 break;
             }else if (i==mList.size()-1){
-                progressDialog.show();save_bt.setEnabled(false);
-                HttpClient httpClient = new HttpClient.Builder(Constant.BASE_BOOKING_SETTING_URL).isDebug(true).build(true);
-                httpClient.Api().send(new HttpClient.Builder()
-                        .url("user/appBatchPlace")
-                        .add("map",JSON.toJSONString(mList))
-                        .add("token",MyApplication.getInstance().mAccessToken)
-                        .connectTimeout(10000)
-                        .method(Method.POST)
-                        .build(),new ResultSubscriber<>(new Result2Listener<Object>() {
-                    @Override
-                    public void onResponse(Object o) {
-                        if (!JSONUtil.validate(o.toString()) || o == null) {
-                            progressDialog.dismiss();save_bt.setEnabled(true);
-                            return;
-                        }
-                        LogUtil.prinlnLongMsg("appBatchPlace", o.toString()+"");
-                        if (o.toString().contains("result") && JSON.parseObject(o.toString()).getBooleanValue("result")) {
-                            Toast.makeText(ct,getString(R.string.common_save_success),Toast.LENGTH_LONG).show();
-                            startActivity(new Intent(ct,BSetComRestListActivity.class)
-                                    .putExtra("sc_industry",sc_industry)
-                                    .putExtra("sc_industrycode",sc_industrycode)
-                                    .putExtra("type","place"));
-                            finish();
-                        }
-                        progressDialog.dismiss();save_bt.setEnabled(true);
+                if (updateChangeP)   // 更换过照片
+                    doJudegeCNow_p();//开始上传第一张图片
+                else
+                    doSaveDatasList();
+            }
+        }
+
+
+    }
+    private int now_p = 0;
+    private void sendPictureRequest(String path) {
+        if (StringUtil.isEmpty(path)) return;
+        File waterBitmapToFile=  new File(path);
+        if (!waterBitmapToFile.isFile()){
+            return;
+        }else {
+            com.lidroid.xutils.http.RequestParams params = new com.lidroid.xutils.http.RequestParams();
+            params.addQueryStringParameter("master", CommonUtil.getSharedPreferences(ct, "erp_master"));
+            params.addHeader("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
+            params.addBodyParameter("userid", MyApplication.getInstance().mLoginUser.getUserId());
+            params.addBodyParameter("file1", waterBitmapToFile);
+            String url = "http://113.105.74.140:8080/upload/UploadServlet";
+            final HttpUtils http = new HttpUtils();
+            http.send(HttpRequest.HttpMethod.POST, url, params, new RequestCallBack<String>() {
+                @Override
+                public void onStart() {
+                    progressDialog.show();
+                    ViewUtil.ToastMessage(ct, getString(com.uas.appworks.R.string.sending_picture)+"...");
+                }
+                @Override
+                public void onLoading(long total, long current, boolean isUploading) {
+                    if (isUploading) {
+                    } else {
                     }
+                }
 
-                    @Override
-                    public void onFailure(Object t) {
-                        progressDialog.dismiss();save_bt.setEnabled(true);
+                @Override
+                public void onSuccess(ResponseInfo<String> responseInfo) {
+                    if (JSONUtil.validate(responseInfo.result) && JSON.parseObject(responseInfo.result).getBoolean("success")) {
+                        LogUtil.prinlnLongMsg("UploadServlet", responseInfo.result + "");
+                        try {
+                            JSONObject object = JSON.parseObject(responseInfo.result);
+                            JSONObject dataobject = object.getJSONObject("data");
+                            if (dataobject == null) {
+                                doJudegeCNow_p();
+                                return;
+                            }
+                            JSONArray imagearray = dataobject.getJSONArray("images");
+                            if (ListUtils.isEmpty(imagearray)) {
+                                doJudegeCNow_p();
+                                return;
+                            }
+                            String oUrl = imagearray.getJSONObject(0).getString("oUrl");
+                            if (!StringUtil.isEmpty(oUrl))
+                                mList.get(now_p).setSt_imageurl(oUrl);
+                            else
+                                mList.get(now_p).setSt_imageurl("");
+
+                            now_p++;
+                            LogUtil.prinlnLongMsg("mList",JSON.toJSONString(mList));
+                            doJudegeCNow_p();
+
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
                     }
-                }));
-            }
+                }
+
+                @Override
+                public void onFailure(HttpException error, String msg) {
+                    now_p++;
+                    doJudegeCNow_p();
+                    ViewUtil.ToastMessage(ct, getString(com.uas.appworks.R.string.common_save_failed) + msg);
+                    progressDialog.dismiss();
+                }
+            });
         }
+    }
 
+    //判断当前上传了几张照片,进行是否上传数据操作
+    private void doJudegeCNow_p() {
+        if (now_p == mList.size()){
+            if (update && !StringUtil.isEmpty(st_id))
+                doUpdate();
+            else
+                doSaveDatasList();
+        } else
+            sendPictureRequest(mPhotoList.get(now_p));
 
     }
 
+    private int getID(String chche) {
+        if (StringUtil.isEmpty(chche)) return 0;
+        Pattern p = Pattern.compile("(\\d+)");
+        Matcher m = p.matcher(chche);
+        if (m.find()) {
+            return Integer.parseInt(m.group(0));
+        }
+        return -1;
+    }
+    private void doSaveDatasList() {
+        progressDialog.show();save_bt.setEnabled(false);
+        HttpClient httpClient = new HttpClient.Builder(Constants.IM_BASE_URL()).isDebug(true).build(true);
+
+//        httpClient.getHeaders().remove("Content-Type");
+
+        httpClient.Api().send(new HttpClient.Builder()
+                .url("user/appBatchPlace")
+                .add("map",JSON.toJSONString(mList))
+                .add("token",MyApplication.getInstance().mAccessToken)
+                .connectTimeout(10000)
+                .method(Method.POST)
+                .build(),new ResultSubscriber<>(new Result2Listener<Object>() {
+            @Override
+            public void onResponse(Object o) {
+                if (!JSONUtil.validate(o.toString()) || o == null) {
+                    progressDialog.dismiss();save_bt.setEnabled(true );
+                    return;
+                }
+                LogUtil.prinlnLongMsg("appBatchPlace", o.toString()+"");
+                if (o.toString().contains("result") && JSON.parseObject(o.toString()).getBooleanValue("result")) {
+                    Toast.makeText(ct,getString(R.string.common_save_success),Toast.LENGTH_LONG).show();
+                    startActivity(new Intent(ct,BSetComRestListActivity.class)
+                            .putExtra("sc_industry",sc_industry)
+                            .putExtra("sc_industrycode",sc_industrycode)
+                            .putExtra("type","place"));
+                    finish();
+                }
+                progressDialog.dismiss();save_bt.setEnabled(true);
+            }
+
+            @Override
+            public void onFailure(Object t) {
+                progressDialog.dismiss();save_bt.setEnabled(true);
+            }
+        }));
+    }
+
     private class BSetLocationAdapter extends BaseAdapter{
         private Context mContext;
         private List<BSetLocationBean> modelList;
+        private ArrayList<String> photoList;
+
+        public ArrayList<String> getPhotoList() {
+            return photoList;
+        }
+
+        public void setPhotoList(ArrayList<String> photoList) {
+            this.photoList = photoList;
+        }
 
         public List<BSetLocationBean> getModelList() {
             return modelList;
@@ -339,58 +503,201 @@ public class BSettingLocationActivity extends BaseActivity implements View.OnCli
                 viewHolder = new ViewHolder();
                 convertView =  View.inflate(mContext, R.layout.com_location_input_item,null);
                 viewHolder.name_tv = (FormEditText) convertView.findViewById(R.id.name_tv);
-                viewHolder.industry_tv = (TextView) convertView.findViewById(R.id.industry_tv);
+                viewHolder.image_im = (ImageView) convertView.findViewById(R.id.image_im);
+                viewHolder.sTime_rl = (RelativeLayout) convertView.findViewById(R.id.service_time_rl);
+                viewHolder.sTime_et = (FormEditText)convertView.findViewById(R.id.service_time_et);
+                viewHolder.delete_tv = (TextView) convertView.findViewById(R.id.delete_tv);
                 convertView.setTag(viewHolder);
                 viewHolder.name_tv.setFocusable(false);
                 viewHolder.name_tv.setKeyListener(null);
+                viewHolder.sTime_et.setFocusable(false);
+                viewHolder.sTime_et.setKeyListener(null);
+                if("会所".equals(sc_industry))
+                    viewHolder.sTime_rl.setVisibility(View.VISIBLE);
+                else
+                    viewHolder.sTime_rl.setVisibility(View.GONE);
             }else {
                 viewHolder = (ViewHolder) convertView.getTag();
             }
             viewHolder.name_tv.setOnClickListener(new View.OnClickListener() {
                 @Override
                 public void onClick(View v) {
-                    doInputName(position);
+                    doInputName(1,position);
                 }
             });
-
-            /*viewHolder.name_tv.addTextChangedListener(new TextWatcher() {
+            viewHolder.sTime_et.setOnClickListener(new View.OnClickListener() {
+                @Override
+                public void onClick(View v) {
+                    doInputName(2,position);
+                }
+            });
+      /*     viewHolder.name_tv.addTextChangedListener(new TextWatcher() {
                 @Override
                 public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
                 @Override
                 public void onTextChanged(CharSequence s, int start, int before, int count) {}
                 @Override
                 public void afterTextChanged(Editable s) {
-//                    String strChche =  s.toString().replace(" ", "");//去除空格
-//                    strChche = strChche.replace(" ", " ");//去除空格
-                    if(StringUtil.isEmpty(s.toString())) return;
-                    mList.get(position).setSt_name(s.toString());
+                    String strChche =  s.toString().replace(" ", "");//去除空格
+                    strChche = strChche.replace(" ", " ");//去除空格
+                    if(StringUtil.isEmpty(strChche.toString())) return;
+                    mList.get(position).setSt_name(strChche.toString());
                     myAdapter.notifyDataSetChanged();
                 }
+            });*/
+
+            viewHolder.image_im.setOnClickListener(new View.OnClickListener() {
+                @Override
+                public void onClick(View v) {
+                    image_position = position;  //点击的图片位置
+                    if (PermissionUtil.lacksPermissions(ct, Manifest.permission.CAMERA)) {
+                        PermissionUtil.requestPermission(BSettingLocationActivity.this,PermissionUtil.DEFAULT_REQUEST,Manifest.permission.CAMERA);
+                        ToastUtil.showToast(ct,R.string.not_camera_permission);
+                    } else {
+                        showSelectPictureDialog();//添加
+                    }
+                }
+            });
+            viewHolder.delete_tv.setOnClickListener(new View.OnClickListener() {
+                @Override
+                public void onClick(View v) {
+                    if (modelList.size() > 1){
+                        mList.remove(position);
+                        if (mPhotoList.size() > position)
+                            mPhotoList.remove(position);
+
+                        notifyDataSetChanged();
+                    }
+                }
             });
-*/
-            if (!ListUtils.isEmpty(modelList)){
+
+//            if (modelList.size() == 1) viewHolder.delete_tv.setVisibility(View.GONE);
+//            else viewHolder.delete_tv.setVisibility(View.VISIBLE);
+
+            //显示名称
+            if (!ListUtils.isEmpty(modelList) && !StringUtil.isEmpty(modelList.get(position).getSt_name()))
                 viewHolder.name_tv.setText(modelList.get(position).getSt_name()+"");
+            else
+                viewHolder.name_tv.setText(null);
+
+            //显示照片
+            if (update && !updateChangeP){
+                ImageLoader.getInstance().displayImage(modelList.get(position).getSt_imageurl(),viewHolder.image_im);
+            }else {
+                if (!ListUtils.isEmpty(photoList) && position < photoList.size() &&
+                        !StringUtil.isEmpty(photoList.get(position)))
+                    ImageLoader.getInstance().displayImage(Uri.fromFile(new File(photoList.get(position))).toString(), viewHolder.image_im);
+                else
+                    viewHolder.image_im.setImageResource(R.drawable.add_picture); //设置为默认头像不然会被复用
             }
+
+
+
+            //显示服务时间/分钟
+            if (!ListUtils.isEmpty(modelList) && !StringUtil.isEmpty(modelList.get(position).getSt_servicetime()))
+                viewHolder.sTime_et.setText(modelList.get(position).getSt_servicetime());
+            else
+                viewHolder.sTime_et.setText(null);
+
             return convertView;
         }
         class ViewHolder{
             FormEditText name_tv;
-            TextView industry_tv;
+            ImageView image_im;
+            RelativeLayout sTime_rl;
+            FormEditText sTime_et;
+            TextView delete_tv;
+        }
+    }
+
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+        super.onActivityResult(requestCode, resultCode, data);
+        if (requestCode == REQUEST_CODE_CAPTURE_PHOTO) {// 拍照返回
+            if (resultCode == Activity.RESULT_OK) {
+                if (mNewPhotoUri != null) {
+                    String path = mNewPhotoUri.getPath();
+                    addPhotoList(path);
+                } else {
+                    ToastUtil.showToast(this, com.uas.appworks.R.string.c_take_picture_failed);
+                }
+            }
+        }else if (requestCode == REQUEST_CODE_PICK_PHOTO) {// 传统单选方式,选择一张图片,然后立即调用裁减
+            if (resultCode == Activity.RESULT_OK){
+                if (data != null && data.getData() != null){
+                    String path= CameraUtil.getImagePathFromUri(this, data.getData());
+                    addPhotoList(path);
+                }
+            }
         }
     }
+
+    private void addPhotoList(String path) {
+        if (image_position > mPhotoList.size() -1){
+            mPhotoList.add(path);
+        }else if (image_position <= mPhotoList.size() -1){
+            mPhotoList.set(image_position,path); //替换
+        }
+        myAdapter.notifyDataSetChanged();
+        Log.i("files0x01",path);
+        updateChangeP = true;
+    }
+
+    private void showSelectPictureDialog() {
+        String[] items = new String[]{getString(com.uas.appworks.R.string.c_take_picture), getString(com.uas.appworks.R.string.c_photo_album)};
+        AlertDialog.Builder builder = new AlertDialog.Builder(this).setSingleChoiceItems(items, 0,
+                new DialogInterface.OnClickListener() {
+                    @Override
+                    public void onClick(DialogInterface dialog, int which) {
+                        if (which == 0) {
+                            try {
+                                takePhoto();
+                            } catch (Exception e) {
+                                String message=e.getMessage();
+                                if (!StringUtil.isEmpty(message)&&message.contains("Permission")){
+                                    ToastUtil.showToast(ct,R.string.not_system_permission);
+                                }
+                            }
+                        } else {
+                            CameraUtil.pickImageSimple(BSettingLocationActivity.this, REQUEST_CODE_PICK_PHOTO);  //传统单选方式
+                        }
+                        dialog.dismiss();
+                    }
+                });
+        builder.show();
+    }
+
+    private void takePhoto() {
+        try {
+            mNewPhotoUri = CameraUtil.getOutputMediaFileUri(this, MyApplication.getInstance().getLoginUserId(), CameraUtil.MEDIA_TYPE_IMAGE);
+            CameraUtil.captureImage(this, mNewPhotoUri, REQUEST_CODE_CAPTURE_PHOTO);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
     private PopupWindow popupWindow = null;
-    private void doInputName(final int position) {
+    private void doInputName(final int type, final int position) {
         // 一个自定义的布局,作为显示的内容
         View contentView = LayoutInflater.from(ct).inflate(
                 R.layout.item_edit_location_pop, null);
 
         // 设置按钮的点击事件
         final EditText editname_et = (EditText) contentView.findViewById(R.id.editname_et);
-        TextView cancel_tv = (TextView) contentView.findViewById(R.id.cancel_tv);
-        TextView sure_tv = (TextView) contentView.findViewById(R.id.sure_tv);
-
+        final EditText editname_et2 = (EditText) contentView.findViewById(R.id.editname_et2);
+        TextView title_tv = (TextView) contentView.findViewById(R.id.title_tv);
         editname_et.setText(mList.get(position).getSt_name()+"");
+        editname_et2.setText(mList.get(position).getSt_servicetime()+"");
         DisplayMetrics dm = getResources().getDisplayMetrics();
+        if (type==1) {
+            editname_et.setVisibility(View.VISIBLE);
+            editname_et2.setVisibility(View.GONE);
+            title_tv.setText("请输入服务/场地/房间名称");
+        } else if(type==2) {
+            editname_et.setVisibility(View.GONE);
+            editname_et2.setVisibility(View.VISIBLE);
+            title_tv.setText("请输入服务时间/分钟");
+        }
         int w_screen = dm.widthPixels;
         int h_screen = dm.heightPixels;
         w_screen = DisplayUtil.dip2px(this, 300);
@@ -405,13 +712,20 @@ public class BSettingLocationActivity extends BaseActivity implements View.OnCli
         contentView.findViewById(R.id.sure_tv).setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
-                if (StringUtil.isEmpty(editname_et.getText().toString())){
-                    ToastMessage("请输入服务/场地/房间名称");
-                    return;
-                }else {
-                    mList.get(position).setSt_name(editname_et.getText().toString());
-                    myAdapter.notifyDataSetChanged();
+                if (type==1){
+                    if (StringUtil.isEmpty(editname_et.getText().toString())){
+                        ToastMessage("请输入服务/场地/房间名称");
+                        return;
+                    }else {
+                        mList.get(position).setSt_name(editname_et.getText().toString());
+                        myAdapter.notifyDataSetChanged();
+                    }
+                }else if (type==2){
+                        mList.get(position).setSt_servicetime(
+                                StringUtil.isEmpty(editname_et2.getText().toString()) ? "0" :editname_et2.getText().toString());
+                        myAdapter.notifyDataSetChanged();
                 }
+
                 popupWindow.dismiss();
             }
         });

+ 4 - 4
app_modular/appme/src/main/java/com/uas/appme/settings/activity/BusinessHoursSetting.java

@@ -13,6 +13,7 @@ import com.common.LogUtil;
 import com.common.data.DateFormatUtil;
 import com.common.data.JSONUtil;
 import com.common.data.StringUtil;
+import com.core.app.Constants;
 import com.core.app.MyApplication;
 import com.core.base.BaseActivity;
 import com.core.utils.CommonUtil;
@@ -22,7 +23,6 @@ import com.me.network.app.http.Method;
 import com.me.network.app.http.rx.ResultListener;
 import com.me.network.app.http.rx.ResultSubscriber;
 import com.uas.appme.R;
-import com.uas.appme.settings.Constant.Constant;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -131,7 +131,7 @@ public class BusinessHoursSetting extends BaseActivity implements View.OnClickLi
         param.put("sc_booktype",sc_booktype);
 
         LogUtil.prinlnLongMsg("appStoreUpdate",JSONUtil.map2JSON(param));
-        HttpClient httpClient = new HttpClient.Builder(Constant.BASE_BOOKING_SETTING_URL).isDebug(true).build(true);
+        HttpClient httpClient = new HttpClient.Builder(Constants.IM_BASE_URL()).isDebug(true).build(true);
         httpClient.Api().send(new HttpClient.Builder()
                 .url("user/appStoreUpdate")
                 .add("map", JSONUtil.map2JSON(param))
@@ -174,7 +174,7 @@ public class BusinessHoursSetting extends BaseActivity implements View.OnClickLi
 
     //获取是否之前有设置的时间
     private void initData() {
-        HttpClient httpClient = new HttpClient.Builder(Constant.BASE_BOOKING_SETTING_URL).isDebug(true).build(true);
+        HttpClient httpClient = new HttpClient.Builder(Constants.IM_BASE_URL()).isDebug(true).build(true);
         httpClient.Api().send(new HttpClient.Builder()
                 .url("user/appCompanyAdmin")
                 .add("companyid",CommonUtil.getSharedPreferences(MyApplication.getInstance(),"erp_uu"))
@@ -228,7 +228,7 @@ public class BusinessHoursSetting extends BaseActivity implements View.OnClickLi
         param.put("sc_endtime",mTvEndTime.getText().toString());
 
         LogUtil.prinlnLongMsg("appStoreUpdate",JSONUtil.map2JSON(param));
-        HttpClient httpClient = new HttpClient.Builder(Constant.BASE_BOOKING_SETTING_URL).isDebug(true).build(true);
+        HttpClient httpClient = new HttpClient.Builder(Constants.IM_BASE_URL()).isDebug(true).build(true);
         httpClient.Api().send(new HttpClient.Builder()
                 .url("user/appStoreUpdate")
                 .add("map", JSONUtil.map2JSON(param))

+ 2 - 2
app_modular/appme/src/main/java/com/uas/appme/settings/activity/ImageSettingActivity.java

@@ -22,6 +22,7 @@ import com.common.data.StringUtil;
 import com.common.system.PermissionUtil;
 import com.common.ui.CameraUtil;
 import com.common.ui.ProgressDialogUtil;
+import com.core.app.Constants;
 import com.core.app.MyApplication;
 import com.core.base.BaseActivity;
 import com.core.net.http.ViewUtil;
@@ -38,7 +39,6 @@ import com.me.network.app.http.rx.ResultListener;
 import com.me.network.app.http.rx.ResultSubscriber;
 import com.nostra13.universalimageloader.core.ImageLoader;
 import com.uas.appme.R;
-import com.uas.appme.settings.Constant.Constant;
 import com.umeng.socialize.utils.Log;
 
 import java.io.File;
@@ -161,7 +161,7 @@ public class ImageSettingActivity extends BaseActivity implements View.OnClickLi
         Map<String, Object> params = new HashMap<>();
         params.put("sc_imageurl",oUrl);
         params.put("sc_uu",CommonUtil.getSharedPreferences(MyApplication.getInstance(),"erp_uu"));
-        HttpClient httpClient = new HttpClient.Builder(Constant.BASE_BOOKING_SETTING_URL).isDebug(true).build(true);
+        HttpClient httpClient = new HttpClient.Builder(Constants.IM_BASE_URL()).isDebug(true).build(true);
         httpClient.getHeaders().remove("Content-Type");
         httpClient.Api().send(new HttpClient.Builder()
                 .url("user/appStorurl")

+ 8 - 4
app_modular/appme/src/main/java/com/uas/appme/settings/activity/PersonSettingActivity.java

@@ -32,6 +32,7 @@ import com.common.system.PermissionUtil;
 import com.common.ui.CameraUtil;
 import com.common.ui.ImageUtil;
 import com.common.ui.ProgressDialogUtil;
+import com.core.app.Constants;
 import com.core.app.MyApplication;
 import com.core.base.BaseActivity;
 import com.core.model.SelectBean;
@@ -52,7 +53,6 @@ import com.me.network.app.http.rx.ResultListener;
 import com.me.network.app.http.rx.ResultSubscriber;
 import com.nostra13.universalimageloader.core.ImageLoader;
 import com.uas.appme.R;
-import com.uas.appme.settings.Constant.Constant;
 import com.uas.appme.settings.model.BSettingPlaceBean;
 import com.uas.appme.settings.model.PersonSetingBean;
 import com.umeng.socialize.utils.Log;
@@ -162,7 +162,7 @@ public class PersonSettingActivity extends BaseActivity implements View.OnClickL
 
         HttpClient httpClient =
 //                new HttpClient.Builder(Constant.BASE_BOOKING_SETTING_URL).isDebug(true).build(true);\
-                new HttpClient.Builder(Constant.BASE_BOOKING_SETTING_URL).isDebug(true).build(true);
+                new HttpClient.Builder(Constants.IM_BASE_URL()).isDebug(true).build(true);
         httpClient.Api().send(new HttpClient.Builder()
                 .url("user/appPlaceList")
                 .add("companyid",CommonUtil.getSharedPreferences(MyApplication.getInstance(),"erp_uu"))
@@ -271,7 +271,7 @@ public class PersonSettingActivity extends BaseActivity implements View.OnClickL
         }
     }
     private void doDelete() {
-        HttpClient httpClient = new HttpClient.Builder(Constant.BASE_BOOKING_SETTING_URL).isDebug(true).build(true);
+        HttpClient httpClient = new HttpClient.Builder(Constants.IM_BASE_URL()).isDebug(true).build(true);
         httpClient.Api().send(new HttpClient.Builder()
                 .url("user/appStoreDel")
                 .add("keyfield", "sm_id")
@@ -358,6 +358,10 @@ public class PersonSettingActivity extends BaseActivity implements View.OnClickL
     }
 
     private void saveJudge() {
+        if (StringUtil.isEmpty(photoselect)) {
+            ToastMessage("请添加头像照片");
+            return;
+        }
         File file=  new File(photoselect);
         if (StringUtil.isEmpty(result)){
             if (!file.exists()) {// 录入时的,且图片文件不存在
@@ -405,7 +409,7 @@ public class PersonSettingActivity extends BaseActivity implements View.OnClickL
 
         HttpClient httpClient =
 //                new HttpClient.Builder(Constant.BASE_BOOKING_SETTING_URL).isDebug(true).build(true);
-                    new HttpClient.Builder(Constant.BASE_BOOKING_SETTING_URL).isDebug(true).build(true);
+                    new HttpClient.Builder(Constants.IM_BASE_URL()).isDebug(true).build(true);
         httpClient.Api().send(new HttpClient.Builder()
                 .url("user/appPersonSet")
                 .add("map", JSONUtil.map2JSON(params))

+ 3 - 3
app_modular/appme/src/main/java/com/uas/appme/settings/activity/PersonSettingListActivity.java

@@ -14,6 +14,7 @@ import com.common.LogUtil;
 import com.common.data.JSONUtil;
 import com.common.data.ListUtils;
 import com.common.system.DisplayUtil;
+import com.core.app.Constants;
 import com.core.app.MyApplication;
 import com.core.base.BaseActivity;
 import com.core.utils.CommonUtil;
@@ -24,7 +25,6 @@ import com.me.network.app.http.Method;
 import com.me.network.app.http.rx.ResultListener;
 import com.me.network.app.http.rx.ResultSubscriber;
 import com.uas.appme.R;
-import com.uas.appme.settings.Constant.Constant;
 import com.uas.appme.settings.adapter.PSettingListAdapter;
 import com.uas.appme.settings.model.PersonSetingBean;
 
@@ -75,7 +75,7 @@ public class PersonSettingListActivity extends BaseActivity {
             ToastMessage(getString(R.string.common_notlinknet));
             return;
         }
-        HttpClient httpClient = new HttpClient.Builder(Constant.BASE_BOOKING_SETTING_URL).isDebug(true).build(true);
+        HttpClient httpClient = new HttpClient.Builder(Constants.IM_BASE_URL()).isDebug(true).build(true);
         httpClient.Api().send(new HttpClient.Builder()
                 .url("user/appStoreman")
                 .add("companyid", CommonUtil.getSharedPreferences(MyApplication.getInstance(),"erp_uu"))
@@ -156,7 +156,7 @@ public class PersonSettingListActivity extends BaseActivity {
         DisplayUtil.backgroundAlpha(this, 1f);
     }
     private void doDeleteHandle(int longPosition) {
-        HttpClient httpClient = new HttpClient.Builder(Constant.BASE_BOOKING_SETTING_URL).isDebug(true).build(true);
+        HttpClient httpClient = new HttpClient.Builder(Constants.IM_BASE_URL()).isDebug(true).build(true);
         httpClient.Api().send(new HttpClient.Builder()
                 .url("user/appStoreDel")
                 .add("keyfield", "sm_id")

+ 15 - 18
app_modular/appme/src/main/java/com/uas/appme/settings/activity/SettingActivity.java

@@ -59,7 +59,6 @@ import com.me.network.app.http.rx.ResultSubscriber;
 import com.uas.appme.R;
 import com.uas.appme.pedometer.view.NewStepActivity;
 import com.uas.appme.pedometer.view.StepSplashActivity;
-import com.uas.appme.settings.Constant.Constant;
 import com.uas.appworks.OA.erp.activity.FlightsActivity;
 import com.uas.appworks.OA.erp.activity.MissionSetActivity;
 import com.uas.appworks.OA.erp.activity.MyRuleSetActivity;
@@ -140,7 +139,7 @@ public class SettingActivity extends BaseActivity implements View.OnClickListene
         businessmen_setting_rl.setOnClickListener(this);
         bsettingRed = (TextView) findViewById(R.id.businessmen_setting_new);
 
-        if (PreferenceUtils.getBoolean(MyApplication.getInstance(), Constant.B_SETTINGRED)) //商家设置红点
+        if (PreferenceUtils.getBoolean(MyApplication.getInstance(), Constants.B_SETTINGRED)) //商家设置红点
             bsettingRed.setVisibility(View.GONE);
 
         new_step_rl.setOnClickListener(this);
@@ -151,7 +150,7 @@ public class SettingActivity extends BaseActivity implements View.OnClickListene
         share_rl = (RelativeLayout) findViewById(R.id.share_rl);
         mExitBtn = (Button) findViewById(R.id.exit_btn);
         //share_rl.setVisibility(View.GONE);
-        int isPush = PreferenceUtils.getInt(MyApplication.getInstance(), Constant.BAIDU_PUSH);
+        int isPush = PreferenceUtils.getInt(MyApplication.getInstance(), Constants.BAIDU_PUSH);
 
         if (isPush == -1) {//第一次进入没有配置
             cb_task_reply.setChecked(true);
@@ -165,11 +164,11 @@ public class SettingActivity extends BaseActivity implements View.OnClickListene
             @Override
             public void onCheckedChanged(View view, boolean isChecked) {
                 if (isChecked) {
-                    PreferenceUtils.putInt(Constant.BAIDU_PUSH, 1);
+                    PreferenceUtils.putInt(Constants.BAIDU_PUSH, 1);
                     PushManager.resumeWork(MyApplication.getInstance());
                 } else {
                     PushManager.stopWork(MyApplication.getInstance());
-                    PreferenceUtils.putInt(Constant.BAIDU_PUSH, 0);
+                    PreferenceUtils.putInt(Constants.BAIDU_PUSH, 0);
                 }
             }
         });
@@ -198,7 +197,7 @@ public class SettingActivity extends BaseActivity implements View.OnClickListene
 
 
         //UU开关的 根据StepService是否开启显示状态
-        int isStep = PreferenceUtils.getInt(MyApplication.getInstance(), Constant.UU_STEP);
+        int isStep = PreferenceUtils.getInt(MyApplication.getInstance(), Constants.UU_STEP);
         if (isServiceRunning(newStep_service_name) && (isStep == -1 || isStep == 1)) {
             uu_step_reply.setChecked(true);
         } else {
@@ -212,13 +211,13 @@ public class SettingActivity extends BaseActivity implements View.OnClickListene
                 tv_menu_setting.setVisibility(View.GONE);
                 CommonUtil.putSharedPreferencesBoolean(SettingActivity.this, Constants.NEW_UURUN, true);
                 if (isChecked) {
-                    PreferenceUtils.putInt(Constant.UU_STEP, 1);
+                    PreferenceUtils.putInt(Constants.UU_STEP, 1);
 //                    PushManager.resumeWork(MyApplication.getInstance());
 //
                     startActivity(new Intent(mContext, StepSplashActivity.class));
                 } else {
 //                    PushManager.stopWork(MyApplication.getInstance());
-                    PreferenceUtils.putInt(Constant.UU_STEP, 0);
+                    PreferenceUtils.putInt(Constants.UU_STEP, 0);
 //                    stopService(intent);
                     Toast.makeText(mContext, getString(R.string.set_close_step_notice1), Toast.LENGTH_LONG).show();
                     speech_recognition_rl.setVisibility(View.GONE);
@@ -230,7 +229,7 @@ public class SettingActivity extends BaseActivity implements View.OnClickListene
             public void onClick(View v) {
                 tv_menu_setting.setVisibility(View.GONE);
                 CommonUtil.putSharedPreferencesBoolean(SettingActivity.this, Constants.NEW_UURUN, true);
-                int last_isStep = PreferenceUtils.getInt(MyApplication.getInstance(), Constant.UU_STEP);
+                int last_isStep = PreferenceUtils.getInt(MyApplication.getInstance(), Constants.UU_STEP);
                 if (isServiceRunning(newStep_service_name) && last_isStep == 1) {
                     startActivity(new Intent(mContext, NewStepActivity.class));
                 } else {
@@ -273,7 +272,7 @@ public class SettingActivity extends BaseActivity implements View.OnClickListene
     }
 
     private void doShowBSettingJudge() {
-        HttpClient httpClient = new HttpClient.Builder(Constant.BASE_BOOKING_SETTING_URL).isDebug(true).build(true);
+        HttpClient httpClient = new HttpClient.Builder(Constants.IM_BASE_URL()).isDebug(true).build(true);
         httpClient.Api().send(new HttpClient.Builder()
                 .url("user/appCompanyAdmin")
 //                .add("companyid",10043574)
@@ -294,16 +293,14 @@ public class SettingActivity extends BaseActivity implements View.OnClickListene
                 try {
                     //{"result":"1","url":"http://113.105.74.140:8081/u/0/0/201710/o/48fda5af663f40f795f2dd49e2d8801f.jpg"}
                     if (o.toString().contains("result")) {
-                        if ("1".equals(JSON.parseObject(o.toString()).getString("result"))){
+                        if (!CommonUtil.isReleaseVersion()) {
+                            businessmen_setting_rl.setVisibility(View.VISIBLE);
+                        }else if ("1".equals(JSON.parseObject(o.toString()).getString("result"))){
                             businessmen_setting_rl.setVisibility(View.VISIBLE);
                             if (o.toString().contains("url"))
                                 business_iamge = JSON.parseObject(o.toString()).getString("url");
-                        }
-//                        else if (!CommonUtil.isReleaseVersion()) {
-//                            businessmen_setting_rl.setVisibility(View.VISIBLE);
-//                        }
-                        else{
-                            businessmen_setting_rl.setVisibility(View.VISIBLE);
+                        }else{
+                            businessmen_setting_rl.setVisibility(View.GONE);
                         }
                     }
                 } catch (Exception e) {
@@ -441,7 +438,7 @@ public class SettingActivity extends BaseActivity implements View.OnClickListene
        }else if (v.getId() == R.id.businessmen_setting_rl){
            startActivity(new Intent(this,BSettingActivity.class)
            .putExtra("business_iamge",business_iamge));
-           PreferenceUtils.putBoolean(Constant.B_SETTINGRED, true);
+           PreferenceUtils.putBoolean(Constants.B_SETTINGRED, true);
            bsettingRed.setVisibility(View.GONE);
        }
     }

+ 18 - 0
app_modular/appme/src/main/java/com/uas/appme/settings/model/BSetLocationBean.java

@@ -11,6 +11,24 @@ public class BSetLocationBean {
     private String st_companyid;
     private String st_companyname;
     private String st_id;
+    private String st_servicetime;
+    private String st_imageurl;
+
+    public String getSt_imageurl() {
+        return st_imageurl;
+    }
+
+    public void setSt_imageurl(String st_imageurl) {
+        this.st_imageurl = st_imageurl;
+    }
+
+    public String getSt_servicetime() {
+        return st_servicetime;
+    }
+
+    public void setSt_servicetime(String st_servicetime) {
+        this.st_servicetime = st_servicetime;
+    }
 
     public String getSt_id() {
         return st_id;

+ 40 - 1
app_modular/appme/src/main/java/com/uas/appme/settings/model/BSettingPlaceBean.java

@@ -8,7 +8,8 @@ import java.util.List;
  */
 
 public class BSettingPlaceBean {
-    public List<ResultBean> result;
+
+    private List<ResultBean> result;
 
     public List<ResultBean> getResult() {
         return result;
@@ -19,10 +20,24 @@ public class BSettingPlaceBean {
     }
 
     public static class ResultBean {
+        /**
+         * st_companyid : 10046529
+         * st_companyname : 服务预约1
+         * st_id : 20244
+         * st_imageurl : http://113.105.74.140:8081/u/0/0/201711/o/7cf6e83f6d114352b4e0bea103cc8826.png
+         * st_name : 奋斗的
+         * st_price : 0
+         * st_servicetime : 222
+         * st_siid : 0
+         */
+
         private String st_companyid;
         private String st_companyname;
         private String st_id;
+        private String st_imageurl;
         private String st_name;
+        private String st_price;
+        private String st_servicetime;
         private String st_siid;
 
         public String getSt_companyid() {
@@ -49,6 +64,14 @@ public class BSettingPlaceBean {
             this.st_id = st_id;
         }
 
+        public String getSt_imageurl() {
+            return st_imageurl;
+        }
+
+        public void setSt_imageurl(String st_imageurl) {
+            this.st_imageurl = st_imageurl;
+        }
+
         public String getSt_name() {
             return st_name;
         }
@@ -57,6 +80,22 @@ public class BSettingPlaceBean {
             this.st_name = st_name;
         }
 
+        public String getSt_price() {
+            return st_price;
+        }
+
+        public void setSt_price(String st_price) {
+            this.st_price = st_price;
+        }
+
+        public String getSt_servicetime() {
+            return st_servicetime;
+        }
+
+        public void setSt_servicetime(String st_servicetime) {
+            this.st_servicetime = st_servicetime;
+        }
+
         public String getSt_siid() {
             return st_siid;
         }

+ 75 - 22
app_modular/appme/src/main/res/layout/com_location_input_item.xml

@@ -3,8 +3,6 @@
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     xmlns:whatever="http://schemas.android.com/tools"
-    android:layout_marginLeft="25dp"
-    android:layout_marginRight="25dp"
     android:orientation="vertical">
     <TextView
         android:layout_width="wrap_content"
@@ -20,7 +18,8 @@
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:orientation="vertical"
-        android:background="@drawable/rl_circular_bg">
+        android:background="@drawable/rl_circular_bg"
+        android:layout_marginBottom="10dp">
 
         <RelativeLayout
             android:id="@id/name_rl"
@@ -36,6 +35,7 @@
                 android:layout_centerVertical="true"
                 android:text="名称"
                 android:textSize="14sp"
+                android:textColor="@color/text_main"
                 />
 
             <com.andreabaccega.widget.FormEditText
@@ -43,7 +43,6 @@
                 style="@style/IMTbleLine_TextValue"
                 android:layout_toLeftOf="@+id/of_add_set_range_img"
                 android:layout_toRightOf="@+id/of_add_set_range_text"
-                android:textColor="@color/dark_dark_grey"
                 android:padding="10dp"
                 android:hint="@string/common_input"
                 android:layout_width="wrap_content"
@@ -57,6 +56,7 @@
                 whatever:customRegexp="^[A-Za-z\u4e00-\u9fa5]{1,8}+$"
                 whatever:testErrorString="姓名只能为12个字符之内的中、英文"
                 android:layout_marginLeft="10dp"
+                android:textColor="@color/text_main"
                 />
             <ImageView
                 android:id="@+id/of_add_set_range_img"
@@ -72,49 +72,102 @@
         <View
             android:id="@+id/line"
             android:layout_width="match_parent"
-            android:layout_height="2px"
+            android:layout_height="1px"
             android:background="@color/item_line"
             android:layout_below="@+id/position_tv"
-            android:layout_marginLeft="20dp"
-            android:layout_marginRight="20dp"
-            android:visibility="gone"
+            android:visibility="visible"
+            />
+        <RelativeLayout
+            style="@style/IMTbleLine2"
+            android:minHeight="150dp"
+            android:layout_height="150dp"
+            android:background="@color/white"
+            android:layout_marginTop="10dp">
+            <TextView
+                android:id="@+id/image_tv"
+                style="@style/form_relative_left_text"
+                android:text="照片"
+                android:layout_marginLeft="0dp"
+                android:textColor="@color/text_main"
+                android:textSize="15sp"
+                android:layout_centerVertical="false"
+                />
+            <TextView
+                android:id="@+id/image_tv_"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="点击照片添加/更换"
+                android:textSize="14sp"
+                android:layout_centerHorizontal="true"
+                android:layout_marginBottom="10dp"/>
+            <ImageView
+                android:id="@+id/image_im"
+                android:layout_below="@+id/image_tv_"
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:src="@drawable/add_picture"
+                android:layout_centerInParent="true"/>
+        </RelativeLayout>
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="1px"
+            android:background="@color/item_line"
+            android:layout_below="@+id/position_tv"
+            android:visibility="visible"
             />
         <RelativeLayout
+            android:id="@+id/service_time_rl"
             style="@style/IMTbleLine2"
             android:layout_height="50dp"
             android:background="@color/white"
-            android:visibility="gone"
             >
 
             <TextView
-                android:id="@+id/of_add_set_range_text2"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:text="行业"
+                android:text="服务时间/分钟"
                 android:textSize="14sp"
-                android:layout_alignParentTop="true"
+                android:textColor="@color/text_main"
+                android:layout_alignBaseline="@+id/service_time_et"
+                android:layout_alignBottom="@+id/service_time_et"
                 android:layout_alignParentLeft="true"
-                android:layout_alignParentStart="true"
-                android:layout_marginTop="16dp" />
+                android:layout_alignParentStart="true" />
 
-            <TextView
-                android:id="@+id/industry_tv"
+            <com.andreabaccega.widget.FormEditText
+                android:id="@+id/service_time_et"
                 style="@style/IMTbleLine_TextValue"
-                android:textColor="@color/dark_dark_grey"
                 android:padding="10dp"
-                android:layout_alignBaseline="@+id/of_add_set_range_text2"
-                android:layout_alignBottom="@+id/of_add_set_range_text2"
-                android:layout_toRightOf="@+id/of_add_set_range_text2"
-                android:layout_toEndOf="@+id/of_add_set_range_text2" />
+                android:hint="@string/common_input1"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_alignParentRight="true"
+                android:layout_centerVertical="true"
+                android:background="@null"
+                android:textSize="15sp"
+                android:gravity="center_vertical|right"
+                android:inputType="number"
+                android:textColor="@color/text_main"
+                />
             <ImageView
-                android:id="@+id/of_add_set_range_img2"
                 android:layout_width="@dimen/next_width"
                 android:layout_height="@dimen/next_height"
                 android:layout_alignParentRight="true"
                 android:layout_centerVertical="true"
                 android:background="@drawable/oa_next"
                 android:contentDescription="@string/app_name"
+                android:visibility="gone"
                 />
         </RelativeLayout>
+        <TextView
+            android:id="@+id/delete_tv"
+            android:layout_gravity="right"
+            android:layout_width="100dp"
+            android:layout_height="30dp"
+            android:text="@string/delete"
+            android:textColor="@color/red"
+            android:paddingLeft="40dp"
+            android:paddingTop="6dp"
+            android:visibility="gone"
+            />
     </LinearLayout>
 </LinearLayout>

+ 50 - 24
app_modular/appme/src/main/res/layout/com_location_item.xml

@@ -2,10 +2,8 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:layout_marginLeft="25dp"
-    android:layout_marginRight="25dp"
-    android:orientation="vertical"
-    >
+    xmlns:whatever="http://schemas.android.com/tools"
+    android:orientation="vertical">
     <TextView
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
@@ -20,7 +18,8 @@
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:orientation="vertical"
-        android:background="@drawable/rl_circular_bg">
+        android:background="@drawable/rl_circular_bg"
+        android:layout_marginBottom="10dp">
 
         <RelativeLayout
             android:id="@id/name_rl"
@@ -36,16 +35,18 @@
                 android:layout_centerVertical="true"
                 android:text="名称"
                 android:textSize="14sp"
+                android:textColor="@color/text_main"
                 />
 
+
             <TextView
                 android:id="@+id/name_tv"
                 style="@style/IMTbleLine_TextValue"
                 android:layout_toLeftOf="@+id/of_add_set_range_img"
                 android:layout_toRightOf="@+id/of_add_set_range_text"
-                android:textColor="@color/dark_dark_grey"
                 android:padding="10dp"
                 android:hint="@string/common_input"
+                android:textColor="@color/text_main"
                 />
             <ImageView
                 android:id="@+id/of_add_set_range_img"
@@ -61,48 +62,73 @@
         <View
             android:id="@+id/line"
             android:layout_width="match_parent"
-            android:layout_height="2px"
+            android:layout_height="1px"
+            android:background="@color/item_line"
+            android:layout_below="@+id/position_tv"
+            android:visibility="visible"
+            />
+        <RelativeLayout
+            android:id="@+id/image_rl"
+            style="@style/IMTbleLine2"
+            android:minHeight="150dp"
+            android:layout_height="150dp"
+            android:background="@color/white"
+            android:layout_marginTop="10dp">
+            <TextView
+                android:id="@+id/image_tv"
+                style="@style/form_relative_left_text"
+                android:text="照片"
+                android:layout_marginLeft="0dp"
+                android:textColor="@color/text_main"
+                android:textSize="15sp"
+                android:layout_centerVertical="false"
+                />
+            <ImageView
+                android:id="@+id/image_im"
+                android:layout_below="@+id/image_tv_"
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:src="@drawable/add_picture"
+                android:layout_centerInParent="true"/>
+        </RelativeLayout>
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="1px"
             android:background="@color/item_line"
             android:layout_below="@+id/position_tv"
-            android:layout_marginLeft="20dp"
-            android:layout_marginRight="20dp"
-            android:visibility="gone"
+            android:visibility="visible"
             />
         <RelativeLayout
+            android:id="@+id/service_time_rl"
             style="@style/IMTbleLine2"
             android:layout_height="50dp"
             android:background="@color/white"
-            android:visibility="gone"
             >
 
             <TextView
-                android:id="@+id/of_add_set_range_text2"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:text="行业"
+                android:layout_centerVertical="true"
+                android:text="服务时间/分钟"
                 android:textSize="14sp"
-                android:layout_alignParentTop="true"
-                android:layout_alignParentLeft="true"
-                android:layout_alignParentStart="true"
-                android:layout_marginTop="16dp" />
+                android:textColor="@color/text_main"
+                />
 
             <TextView
-                android:id="@+id/industry_tv"
+                android:id="@+id/service_time_tv"
                 style="@style/IMTbleLine_TextValue"
-                android:textColor="@color/dark_dark_grey"
                 android:padding="10dp"
-                android:layout_alignBaseline="@+id/of_add_set_range_text2"
-                android:layout_alignBottom="@+id/of_add_set_range_text2"
-                android:layout_toRightOf="@+id/of_add_set_range_text2"
-                android:layout_toEndOf="@+id/of_add_set_range_text2" />
+                android:hint="@string/common_input"
+                android:textColor="@color/text_main"
+                />
             <ImageView
-                android:id="@+id/of_add_set_range_img2"
                 android:layout_width="@dimen/next_width"
                 android:layout_height="@dimen/next_height"
                 android:layout_alignParentRight="true"
                 android:layout_centerVertical="true"
                 android:background="@drawable/oa_next"
                 android:contentDescription="@string/app_name"
+                android:visibility="gone"
                 />
         </RelativeLayout>
     </LinearLayout>

+ 3 - 3
app_modular/appme/src/main/res/layout/com_rest_item.xml

@@ -60,11 +60,11 @@
         <View
             android:id="@+id/line"
             android:layout_width="match_parent"
-            android:layout_height="2px"
+            android:layout_height="1px"
             android:background="@color/item_line"
             android:layout_below="@+id/position_tv"
-            android:layout_marginLeft="20dp"
-            android:layout_marginRight="20dp"
+            android:layout_marginLeft="10dp"
+            android:layout_marginRight="10dp"
             />
         <RelativeLayout
             style="@style/IMTbleLine2"

+ 14 - 1
app_modular/appme/src/main/res/layout/item_edit_location_pop.xml

@@ -42,7 +42,20 @@
             android:hint="@string/common_input"
             android:textColor="@color/text_main"
             android:textSize="@dimen/text_main"
-            android:gravity="center_horizontal"/>
+            android:gravity="center_horizontal"
+            />
+        <EditText
+            android:id="@+id/editname_et2"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:background="@null"
+            android:ellipsize="end"
+            android:maxLines="1"
+            android:hint="@string/common_input2"
+            android:textColor="@color/text_main"
+            android:textSize="@dimen/text_main"
+            android:gravity="center_horizontal"
+            android:inputType="number"/>
     </LinearLayout>
 
 

+ 6 - 2
app_modular/appworks/src/main/java/com/uas/appworks/OA/erp/activity/ExpenseReimbursementActivity.java

@@ -1940,8 +1940,12 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
     }
 
     private void takePhoto() {
-        mNewPhotoUri = CameraUtil.getOutputMediaFileUri(this,MyApplication.getInstance().getLoginUserId(), CameraUtil.MEDIA_TYPE_IMAGE);
-        CameraUtil.captureImage(this, mNewPhotoUri, REQUEST_CODE_CAPTURE_PHOTO);
+        try {
+            mNewPhotoUri = CameraUtil.getOutputMediaFileUri(this, MyApplication.getInstance().getLoginUserId(), CameraUtil.MEDIA_TYPE_IMAGE);
+            CameraUtil.captureImage(this, mNewPhotoUri, REQUEST_CODE_CAPTURE_PHOTO);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
     }
     private int Max_Size = 9;
     private void selectPhoto() {

+ 91 - 91
app_modular/appworks/src/main/java/com/uas/appworks/OA/erp/utils/approvautils/NodeAdapter.java

@@ -22,95 +22,95 @@ import java.util.List;
 
 public class NodeAdapter extends BaseAdapter {
 
-    private Context ct;
-    private List<Approval> approvals;
-
-
-    public NodeAdapter(Context ct, List<Approval> approvals) {
-        this.ct = ct;
-        this.approvals = approvals;
-    }
-
-    @Override
-    public int getCount() {
-        return ListUtils.getSize(approvals);
-    }
-
-    @Override
-    public Object getItem(int position) {
-        return approvals.get(position);
-    }
-
-    @Override
-    public long getItemId(int position) {
-        return position;
-    }
-
-    @Override
-    public View getView(int position, View itemView, ViewGroup parent) {
-        NodeViewHolder holder = null;
-        if (itemView == null) {
-            holder = new NodeViewHolder();
-            itemView = LayoutInflater.from(ct).inflate(R.layout.item_approval_node, parent, false);
-            holder.timeTv = (TextView) itemView.findViewById(R.id.timeTv);
-            holder.keyTv = (TextView) itemView.findViewById(R.id.keyTv);
-            holder.valuesTv = (TextView) itemView.findViewById(R.id.valuesTv);
-            holder.handIv = (ImageView) itemView.findViewById(R.id.handIv);
-            holder.statusIV = (ImageView) itemView.findViewById(R.id.statusIV);
-            holder.padding = itemView.findViewById(R.id.padding);
-            itemView.setTag(holder);
-        } else {
-            holder = (NodeViewHolder) itemView.getTag();
-        }
-        bindNodeView(holder, position);
-        return itemView;
-    }
-
-    private void bindNodeView(NodeViewHolder holder, int position) {
-        Approval approval = approvals.get(position);
-        if (position > 0 && approvals.get(position - 1).getType() != Approval.NODES) {
-            holder.padding.setVisibility(View.VISIBLE);
-        } else {
-            holder.padding.setVisibility(View.GONE);
-        }
-        int textColor = R.color.hintColor;
-        if (!StringUtil.isEmpty(approval.getIdKey())) {
-            holder.valuesTv.setText(approval.getIdKey().replace("\\n","\n"));
-            if (approval.getIdKey().startsWith("待审批")) {
-                textColor = R.color.approvaling;
-            } else if (approval.getIdKey().startsWith("未通过")) {
-                textColor = R.color.crimson;
-            }
-        } else {
-            holder.valuesTv.setText("");
-        }
-        holder.valuesTv.setTextColor(ct.getResources().getColor(textColor));
-        holder.keyTv.setText(approval.getCaption());
-        int reId = R.drawable.weishenpi;
-        if (!StringUtil.isEmpty(approval.getIdKey())) {
-            String status = approval.getIdKey().split("\\(")[0];
-            if (StringUtil.isEmpty(status)) status = "";
-            if ("已审批".equals(status)) {
-                reId = R.drawable.node_finished3;
-            } else if ("待审批".equals(status)) {
-                reId = R.drawable.daishenpi;
-            } else if ("未通过".equals(status)) {
-                reId = R.drawable.node_delete;
-            } else {
-                reId = R.drawable.weishenpi;
-            }
-        }
-        holder.statusIV.setImageResource(reId);
-        AvatarHelper.getInstance().display(String.valueOf(approval.getId()), holder.handIv, true, false);
-        holder.timeTv.setTextColor(ct.getResources().getColor(R.color.text_normal));
-        holder.timeTv.setText(approval.getValues());
-    }
-
-    private class NodeViewHolder {
-        ImageView handIv, statusIV;
-        TextView timeTv, keyTv, valuesTv;
-        View padding;
-
-
-    }
+	private Context ct;
+	private List<Approval> approvals;
+
+
+	public NodeAdapter(Context ct, List<Approval> approvals) {
+		this.ct = ct;
+		this.approvals = approvals;
+	}
+
+	@Override
+	public int getCount() {
+		return ListUtils.getSize(approvals);
+	}
+
+	@Override
+	public Object getItem(int position) {
+		return approvals.get(position);
+	}
+
+	@Override
+	public long getItemId(int position) {
+		return position;
+	}
+
+	@Override
+	public View getView(int position, View itemView, ViewGroup parent) {
+		NodeViewHolder holder = null;
+		if (itemView == null) {
+			holder = new NodeViewHolder();
+			itemView = LayoutInflater.from(ct).inflate(R.layout.item_approval_node, parent, false);
+			holder.timeTv = (TextView) itemView.findViewById(R.id.timeTv);
+			holder.keyTv = (TextView) itemView.findViewById(R.id.keyTv);
+			holder.valuesTv = (TextView) itemView.findViewById(R.id.valuesTv);
+			holder.handIv = (ImageView) itemView.findViewById(R.id.handIv);
+			holder.statusIV = (ImageView) itemView.findViewById(R.id.statusIV);
+			holder.padding = itemView.findViewById(R.id.padding);
+			itemView.setTag(holder);
+		} else {
+			holder = (NodeViewHolder) itemView.getTag();
+		}
+		bindNodeView(holder, position);
+		return itemView;
+	}
+
+	private void bindNodeView(NodeViewHolder holder, int position) {
+		Approval approval = approvals.get(position);
+		if (position > 0 && approvals.get(position - 1).getType() != Approval.NODES) {
+			holder.padding.setVisibility(View.VISIBLE);
+		} else {
+			holder.padding.setVisibility(View.GONE);
+		}
+		int textColor = R.color.hintColor;
+		if (!StringUtil.isEmpty(approval.getIdKey())) {
+			holder.valuesTv.setText(approval.getIdKey().replace("\\n", "\n"));
+			if (approval.getIdKey().startsWith("待审批")) {
+				textColor = R.color.approvaling;
+			} else if (approval.getIdKey().startsWith("未通过")) {
+				textColor = R.color.crimson;
+			}
+		} else {
+			holder.valuesTv.setText("");
+		}
+		holder.valuesTv.setTextColor(ct.getResources().getColor(textColor));
+		holder.keyTv.setText(approval.getCaption());
+		int reId = R.drawable.weishenpi;
+		if (!StringUtil.isEmpty(approval.getIdKey())) {
+			String status = approval.getIdKey().split("\\(")[0];
+			if (StringUtil.isEmpty(status)) status = "";
+			if ("已审批".equals(status)) {
+				reId = R.drawable.node_finished3;
+			} else if ("待审批".equals(status)) {
+				reId = R.drawable.daishenpi;
+			} else if ("未通过".equals(status)) {
+				reId = R.drawable.node_delete;
+			} else {
+				reId = R.drawable.weishenpi;
+			}
+		}
+		holder.statusIV.setImageResource(reId);
+		AvatarHelper.getInstance().display(String.valueOf(approval.getId()), holder.handIv, true, false);
+		holder.timeTv.setTextColor(ct.getResources().getColor(R.color.text_normal));
+		holder.timeTv.setText(approval.getValues());
+	}
+
+	private class NodeViewHolder {
+		ImageView handIv, statusIV;
+		TextView timeTv, keyTv, valuesTv;
+		View padding;
+
+
+	}
 }