diff --git a/app/src/main/java/com/qhclh/ytzh/utils/BitmapUtils.java b/app/src/main/java/com/qhclh/ytzh/utils/BitmapUtils.java
new file mode 100644
index 0000000..ea16265
--- /dev/null
+++ b/app/src/main/java/com/qhclh/ytzh/utils/BitmapUtils.java
@@ -0,0 +1,168 @@
+package com.qhclh.ytzh.utils;
+
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.os.Environment;
+import android.util.Base64;
+
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
+/**
+ * Created by ZH on 2017/8/18.
+ */
+
+public class BitmapUtils {
+ /**
+ * 图片处理类
+ *
+ * @author Ricko
+ */
+
+ /**
+ * 采样率压缩 按照图片宽高自动计算缩放比,图片质量有保障
+ *
+ * @param filePath 设置宽高并不是设置图片实际宽高,而是根据宽高自动计算缩放比,压缩后图片不会变形,宽高会根据计算的缩放比同时缩放,
+ * 宽高建议都设置300 设置300后图片大小为100-200KB,图片质量能接受;设置为400到500,图片大小为500-600kb,上传偏大,可自行设置
+ * @param reqHeight
+ * @param reqWidth
+ * @return
+ */
+ public static Bitmap getSmallBitmap(String filePath, int reqHeight, int reqWidth) {
+ final BitmapFactory.Options options = new BitmapFactory.Options();
+ options.inJustDecodeBounds = true;
+ BitmapFactory.decodeFile(filePath, options);
+ //计算图片的缩放值
+ final int height = options.outHeight;
+ final int width = options.outWidth;
+ int inSampleSize = 1;
+ if (height > reqHeight || width > reqWidth) {
+ final int heightRatio = Math.round((float) height / (float) reqHeight);
+ final int widthRatio = Math.round((float) width / (float) reqWidth);
+ inSampleSize = heightRatio < widthRatio ? heightRatio : widthRatio;
+ }
+ options.inSampleSize = inSampleSize;
+ options.inJustDecodeBounds = false;
+ return BitmapFactory.decodeFile(filePath, options);
+ }
+
+
+ /**
+ *这个可以压缩到指定的宽,但是图片大小可能达不到预期,图片本身较小的可以使用,图片较大的建议使用上一个压缩方式
+ * 根据自定义宽度设置图片大小,高度自适应 0不压缩
+ *
+ * @param path
+ * @param width
+ * @return
+ */
+ public static Bitmap createScaledBitemap(String path, int width) {
+ Bitmap bit = BitmapFactory.decodeFile(path);
+ int bitWidth = bit.getWidth();//得到图片宽
+ float scaleWidth = ((float) width) / ((float) bitWidth);//计算宽度缩放比例
+ if (width == 0) {
+ return bit;
+ } else {
+ int height = (int) (bit.getHeight() * scaleWidth);//根据宽度缩放比例设置高度
+ Bitmap bitmap = Bitmap.createScaledBitmap(bit, width, height, true);
+ return bitmap;
+ }
+ }
+
+ /**
+ *这是个保存Bitmap到sd卡中的方法,可以返回保存图片的路径
+ * 保存Bitmap到sd
+ *
+ * @param mBitmap
+ * @param bitName 图片保存的名称,返回存储图片的路径
+ */
+// public static String saveBitmap(Bitmap mBitmap, String bitName) {
+// File f;
+// //判断是否有sd卡 有就保存到sd卡,没有就保存到app缓存目录
+// if (isStorage()) {
+// File file = new File("/data/data/name");//保存的路径
+// if (!file.exists()) {//判断目录是否存在
+// file.mkdir();//不存在就创建目录
+// }
+// f = new File(file, bitName + ".jpg");
+// } else {
+// File file = new File(MyApplication.getContext().getCacheDir().toString());
+// if (!file.exists()) {//判断目录是否存在
+// file.mkdir();
+// }
+// f = new File(file, bitName + ".jpg");
+// }
+// FileOutputStream fOut = null;
+// try {
+// fOut = new FileOutputStream(f);
+// } catch (FileNotFoundException e) {
+// e.printStackTrace();
+// }
+// if (fOut != null) {
+// mBitmap.compress(Bitmap.CompressFormat.JPEG, 100, fOut);
+// try {
+// fOut.flush();
+// fOut.close();
+// } catch (IOException e) {
+// e.printStackTrace();
+// }
+// }
+// return f.toString();
+// }
+ /**
+ * 判断是否有sd卡
+ *
+ * @return
+ */
+ public static boolean isStorage() {
+ boolean isstorage = Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED);
+ return isstorage;
+ }
+
+ /**
+ *把Bimtmap转成Base64,用于上传图片到服务器,一般是先压缩然后转成Base64,在上传
+ *
+ *
+ */
+ public static String getBitmapStrBase64(Bitmap bitmap) {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ bitmap.compress(Bitmap.CompressFormat.PNG, 100, baos);
+ byte[] bytes = baos.toByteArray();
+ return Base64.encodeToString(bytes, Base64.NO_WRAP);
+ }
+
+ public static String bitmapToBase64(Bitmap bitmap) {
+
+ String result = null;
+ ByteArrayOutputStream baos = null;
+ try {
+ if (bitmap != null) {
+ baos = new ByteArrayOutputStream();
+ bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos);
+ baos.flush();
+ baos.close();
+ byte[] bitmapBytes = baos.toByteArray();
+ result = Base64.encodeToString(bitmapBytes, Base64.NO_WRAP);
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ try {
+ if (baos != null) {
+ baos.flush();
+ baos.close();
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ return result;
+ }
+
+ // 把Base64转换成Bitmap
+ public static Bitmap getBitmapFromBase64(String iconBase64) {
+ byte[] bitmapArray = Base64.decode(iconBase64, Base64.DEFAULT);
+ return BitmapFactory.decodeByteArray(bitmapArray, 0, bitmapArray.length);
+ }
+
+}
diff --git a/app/src/main/java/com/qhclh/ytzh/utils/DateUtils.java b/app/src/main/java/com/qhclh/ytzh/utils/DateUtils.java
new file mode 100644
index 0000000..c4bdcc8
--- /dev/null
+++ b/app/src/main/java/com/qhclh/ytzh/utils/DateUtils.java
@@ -0,0 +1,253 @@
+package com.qhclh.ytzh.utils;
+
+import android.text.TextUtils;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+
+/**
+ * Created by jiangxk on 2016/12/28.
+ */
+
+public class DateUtils {
+
+
+ public static SimpleDateFormat getCommonSimpleDateFormat() {
+ return new SimpleDateFormat("yyyy年MM月dd日", Locale.getDefault());
+ }
+
+ public static SimpleDateFormat getCurrectimeSimpleDateFormat() {
+ return new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
+ }
+ public static SimpleDateFormat getSpritSimpleDateFormat() {
+ return new SimpleDateFormat("yyyy/MM/dd", Locale.getDefault());
+ }
+
+ public static SimpleDateFormat getCommonMinuteDateFormat() {
+ return new SimpleDateFormat("yyyy年MM月dd日 HH:mm", Locale.getDefault());
+ }
+
+
+ /**
+ * 获取当前时间
+ *
+ * @return 当前时间
+ */
+ public static String getCurrentDate() {
+ return getCommonSimpleDateFormat().format(new Date());
+ }
+ public static String getCurrentTimeDate() {
+ return getCurrectimeSimpleDateFormat().format(new Date());
+ }
+
+ public static String getCurrentMinuteDate() {
+ return getCommonMinuteDateFormat().format(new Date());
+ }
+
+
+ /**
+ * ERP后台时间格式转换为时间戳
+ *
+ * @param date ERP后台时间
+ * @return 时间戳
+ */
+ public static long getLongDate(String date) {
+ try {
+ if (!TextUtils.isEmpty(date)) {
+ return Long.parseLong(date.substring(date.indexOf("(") + 1, date.indexOf("+")));
+ } else {
+ return 0;
+ }
+ } catch (Exception e) {
+ return 0;
+ }
+ }
+
+
+ /**
+ * 讲时间戳转换为yyyy年MM月dd日格式
+ *
+ * @param realDate 时间戳
+ * @return
+ */
+ public static String getRealDate(long realDate) {
+ if (realDate == 0) {
+ return "";
+ }
+ Date date = new Date(realDate);
+ return getCommonSimpleDateFormat().format(date);
+ }
+
+ /**
+ * 将ERP时间格式转换为yyyy年MM月dd日格式
+ *
+ * @return
+ */
+ public static String getRealDate(String date) {
+ long dateLong = getLongDate(date);
+ if (dateLong == 0) {
+ return "";
+ }
+ return getCommonSimpleDateFormat().format(dateLong);
+ }
+
+ /**
+ * 将ERP时间格式转换为yyyy/MM/dd格式
+ *
+ * @return
+ */
+ public static String getSpritRealDate(String date) {
+ long dateLong = getLongDate(date);
+ if (dateLong == 0) {
+ return "";
+ }
+ return getSpritSimpleDateFormat().format(dateLong);
+ }
+
+ /**
+ * 获取当前时间毫秒数
+ *
+ * @return 当前时间
+ */
+ public static long getCurrentMillisecondDate() {
+ return new Date().getTime();
+ }
+
+
+ /**
+ * 获取ERP后台时间格式
+ *
+ * @param string
+ * @return
+ */
+ public static String getERPMillisecond(String string) {
+ try {
+ if (!TextUtils.isEmpty(string)) {
+ SimpleDateFormat simpleDateFormat = getCommonSimpleDateFormat();
+ Date date = simpleDateFormat.parse(string);
+ return "/Date(" + date.getTime() + "+0800)/";
+ } else {
+ return string;
+ }
+ } catch (ParseException e) {
+ return string;
+ }
+ }
+
+
+ /**
+ * 获取当前时间的 ERP后台时间格式
+ *
+ * @return
+ */
+ public static String getCurrentERPMillisecond() {
+ Date date = new Date(new Date().getTime());
+ return "/Date(" + date.getTime() + "+0800)/";
+ }
+
+
+
+ public static final String PATTERN_DEFAULT = "yyyy年MM月dd日";
+ public static final String PATTERN_DEFAULT_TIME = "yyyy年MM月dd日 HH:mm";
+ public static final String PATTERN_SPRIT = "yyyy/MM/dd";
+ public static final String PATTERN_TRANSVERSE = "yyyy-MM-dd";
+ public static final String PATTERN_TRANSVERSE_TIME = "yyyy-MM-dd HH:mm";
+
+
+
+
+ private static SimpleDateFormat getDateFormat(String pattern) {
+ return new SimpleDateFormat(pattern, Locale.getDefault());
+ }
+
+
+ public static String format(Date date, String pattern) {
+ if (date == null) {
+ return "";
+ }
+ return getDateFormat(pattern).format(date);
+ }
+
+
+
+ public static String erpTimeToDateStr(String erpTime, String pattern) {
+ Date date = erpTimeToDate(erpTime);
+ return format(date, pattern);
+ }
+
+ /**
+ * ERP后台时间格式转换为时间戳
+ *
+ * @param erpTime ERP后台时间
+ * @return Date
+ */
+ public static Date erpTimeToDate(String erpTime) {
+ try {
+ if (!TextUtils.isEmpty(erpTime)) {
+ long dateLong = Long.parseLong(erpTime.substring(erpTime.indexOf("(") + 1, erpTime.indexOf("+")));
+ return new Date(dateLong);
+ } else {
+ return null;
+ }
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ /**
+ * 获取ERP后台时间格式
+ *
+ * @param millisecond 毫秒值
+ * @return
+ */
+ public static String dateToErpTime(long millisecond) {
+ return "/Date(" + millisecond + "+0800)/";
+ }
+
+ /**
+ * 获取ERP后台时间格式
+ *
+ * @param date date
+ * @return
+ */
+ public static String dateToErpTime(Date date) {
+ return dateToErpTime(date.getTime());
+ }
+
+
+ /**
+ * 获取ERP后台时间格式
+ *
+ * @param dateStr yyyy-MM-dd
+ * @param pattern "yyyy-MM-dd"
+ * @return /Date(1491753600000+0800)/
+ */
+ public static String dateStrToErpTime(String dateStr, String pattern) {
+ SimpleDateFormat dateFormat = getDateFormat(pattern);
+ Date date = null;
+ try {
+ date = dateFormat.parse(dateStr);
+ } catch (ParseException e) {
+ date = new Date();
+ }
+ return dateToErpTime(date);
+ }
+
+
+ public static int dayBetweenTwoDate(Date date1, Date date2) {
+// Calendar calendar = Calendar.getInstance();
+// calendar.setTime(date1);
+// int day1 = calendar.get(Calendar.DAY_OF_YEAR);
+// calendar.setTime(date2);
+// int day2 = calendar.get(Calendar.DAY_OF_YEAR);
+ long dateTime1 = date1.getTime();
+ long dateTime2 = date2.getTime();
+
+ int betweenDay = (int) ((dateTime1 - dateTime2) / (1000 * 60 * 60 * 24));
+
+ return Math.abs(betweenDay);
+ }
+
+}
diff --git a/app/src/main/java/com/qhclh/ytzh/utils/GlideLoader.java b/app/src/main/java/com/qhclh/ytzh/utils/GlideLoader.java
new file mode 100644
index 0000000..24f6263
--- /dev/null
+++ b/app/src/main/java/com/qhclh/ytzh/utils/GlideLoader.java
@@ -0,0 +1,31 @@
+package com.qhclh.ytzh.utils;
+
+import android.app.Activity;
+import android.content.Context;
+
+import com.bumptech.glide.Glide;
+import com.qhclh.ytzh.R;
+import com.yancy.gallerypick.inter.ImageLoader;
+import com.yancy.gallerypick.widget.GalleryImageView;
+
+/**
+ * Created by ZH on 2017/12/1.
+ */
+
+public class GlideLoader implements ImageLoader{
+ private final static String TAG = "GlideImageLoader";
+
+ @Override
+ public void displayImage(Activity activity, Context context, String path, GalleryImageView galleryImageView, int width, int height) {
+ Glide.with(context)
+ .load(path)
+ .placeholder(R.mipmap.gallery_pick_photo)
+ .centerCrop()
+ .into(galleryImageView);
+ }
+
+ @Override
+ public void clearMemoryCache() {
+
+ }
+}
diff --git a/app/src/main/java/com/qhclh/ytzh/utils/MyProvider.java b/app/src/main/java/com/qhclh/ytzh/utils/MyProvider.java
new file mode 100644
index 0000000..a17a8e1
--- /dev/null
+++ b/app/src/main/java/com/qhclh/ytzh/utils/MyProvider.java
@@ -0,0 +1,10 @@
+package com.qhclh.ytzh.utils;
+
+import android.support.v4.content.FileProvider;
+
+/**
+ * Created by ZH on 2017/10/19.
+ */
+
+public class MyProvider extends FileProvider {
+}
diff --git a/app/src/main/java/com/qhclh/ytzh/utils/dialog/MixedDialog.java b/app/src/main/java/com/qhclh/ytzh/utils/dialog/MixedDialog.java
new file mode 100644
index 0000000..48e41a6
--- /dev/null
+++ b/app/src/main/java/com/qhclh/ytzh/utils/dialog/MixedDialog.java
@@ -0,0 +1,243 @@
+package com.qhclh.ytzh.utils.dialog;
+
+
+import android.app.Activity;
+import android.app.Dialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.support.annotation.Nullable;
+import android.support.v7.app.AlertDialog;
+import android.view.View;
+import android.view.WindowManager;
+import android.view.inputmethod.InputMethodManager;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.ImageButton;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import com.qhclh.ytzh.R;
+
+public class MixedDialog extends Dialog implements View.OnClickListener
+{
+ public static final int SINGLE = 1;
+ public static final int MULTI = 2;
+ public static final int ALERT = 3;
+ public static final int SHARE = 4;
+
+ private TextView mTitle;
+ public LinearLayout text1_ll;
+ private TextView nameTextView;
+ public EditText importEditText;
+
+ private TextView name2TextView;
+ public EditText import2EditText;
+
+ private TextView name3TextView;
+ public EditText import3EditText;
+
+ public ImageButton buttonCancel;
+ public Button buttonOK;
+ public Button wechat_btn ;
+ public Button cancel_btn;
+
+ private Context mContext;
+
+ public MixedDialog(Context context, int mode, int style)
+ {
+ super(context, style);
+
+ mContext = context;
+ switch (mode)
+ {
+
+ case SINGLE:
+ setContentView(R.layout.dialog_basic_data_single);
+ getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
+
+ initSingleImportDialogView();
+ break;
+
+ case MULTI:
+ setContentView(R.layout.dialog_basic_data_multi);
+ getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
+ initMultiImportDialogView();
+ break;
+
+ case ALERT:
+ setContentView(R.layout.dialog_basic_data_alert);
+ initAlertImportDialogView();
+ break;
+
+ case SHARE:
+ setContentView(R.layout.dialog_share_message);
+ initShareImportDialogView();
+
+ default:
+ break;
+ }
+
+ }
+
+ private void initShareImportDialogView() {
+ mTitle = (TextView) findViewById(R.id.tv_dlg_share_title);
+ importEditText = (EditText) findViewById(R.id.et_dlg_share_import);
+
+ buttonCancel = (ImageButton) findViewById(R.id.imgbtn_dlg_share_cancel);
+ buttonCancel.setOnClickListener(this);
+
+ buttonCancel = (ImageButton) findViewById(R.id.imgbtn_dlg_share_cancel);
+ buttonCancel.setOnClickListener(this);
+
+ Button msg_btn = (Button) findViewById(R.id.btn_dlg_msg);
+ msg_btn.setOnClickListener(this);
+
+ wechat_btn = (Button) findViewById(R.id.btn_dlg_wechat);
+ wechat_btn.setOnClickListener(this);
+ }
+
+ private void initSingleImportDialogView()
+ {
+ mTitle = (TextView) findViewById(R.id.tv_dlg_single_title);
+ nameTextView = (TextView) findViewById(R.id.tv_dlg_single_name);
+ importEditText = (EditText) findViewById(R.id.et_dlg_single_import);
+
+ buttonCancel = (ImageButton) findViewById(R.id.imgbtn_dlg_single_cancel);
+ buttonCancel.setOnClickListener(this);
+
+ buttonOK = (Button) findViewById(R.id.btn_dlg_single_ok);
+ buttonOK.setOnClickListener(this);
+ }
+
+ private void initMultiImportDialogView()
+ {
+ text1_ll = (LinearLayout) findViewById(R.id.text1_ll);
+ mTitle = (TextView) findViewById(R.id.tv_dlg_multi_title);
+ nameTextView = (TextView) findViewById(R.id.tv_dlg_multi_name1);
+ importEditText = (EditText) findViewById(R.id.et_dlg_multi_import1);
+
+ name2TextView = (TextView) findViewById(R.id.tv_dlg_multi_name2);
+ import2EditText = (EditText) findViewById(R.id.et_dlg_multi_import2);
+
+ name3TextView = (TextView) findViewById(R.id.tv_dlg_multi_name3);
+ import3EditText = (EditText) findViewById(R.id.et_dlg_multi_import3);
+
+ buttonCancel = (ImageButton) findViewById(R.id.imgbtn_dlg_multi_cancel);
+ buttonCancel.setOnClickListener(this);
+
+ buttonOK = (Button) findViewById(R.id.btn_dlg_multi_ok);
+ buttonOK.setOnClickListener(this);
+ }
+
+ private void initAlertImportDialogView() {
+ mTitle = (TextView) findViewById(R.id.tv_dlg_multi_title);
+ nameTextView = (TextView) findViewById(R.id.tv_dlg_multi_name1);
+
+ buttonOK = (Button) findViewById(R.id.btn_dlg_multi_ok);
+ buttonOK.setOnClickListener(this);
+
+ cancel_btn = (Button) findViewById(R.id.btn_dlg_alert_cancel);
+ cancel_btn.setOnClickListener(this);
+ }
+
+ public void setTitleText(String titleString)
+ {
+ mTitle.setText(titleString);
+
+ }
+
+ public void setNameText(String nameString)
+ {
+ nameTextView.setText(nameString);
+
+ }
+
+ public void setName2Text(String nameString)
+ {
+ name2TextView.setText(nameString);
+
+ }
+
+ public void setName3Text(String nameString)
+ {
+ name3TextView.setText(nameString);
+
+ }
+
+ @Override
+ public void onClick(View v)
+ {
+ InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
+ switch (v.getId())
+ {
+ case R.id.imgbtn_dlg_single_cancel:
+ imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); //强制隐藏键盘
+ cancel();
+ break;
+
+ case R.id.imgbtn_dlg_multi_cancel:
+ imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); //强制隐藏键盘
+ cancel();
+ break;
+
+ case R.id.btn_dlg_alert_cancel:
+ cancel();
+ break;
+
+ case R.id.imgbtn_dlg_share_cancel:
+ imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); //强制隐藏键盘
+ cancel();
+ break;
+
+ default:
+ break;
+ }
+
+ }
+
+
+ /**
+ * 系统对话框
+ *
+ */
+ public static void showDialog(Activity context, String[] items, String title,
+ DialogInterface.OnClickListener onClickListener) {
+ AlertDialog.Builder builder = new AlertDialog.Builder(context);
+ if (!android.text.TextUtils.isEmpty(title)) {
+ builder.setTitle(title);
+ }
+ builder.setItems(items, onClickListener).create().show();
+ }
+ public static void showDialog(Activity context, String[] items,
+ DialogInterface.OnClickListener onClickListener) {
+ showDialog(context, items, null, onClickListener);
+ }
+ public interface OnClickListener {
+ void onPositiveButtonClick();
+ }
+
+
+ public static void showAlertDialog(Activity context, @Nullable CharSequence message, final OnClickListener onClickListener) {
+ AlertDialog.Builder builder = new AlertDialog.Builder(context);
+ builder.setMessage(message)
+ .setTitle("提示")
+ .setPositiveButton("确认", new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ if (onClickListener != null) {
+ onClickListener.onPositiveButtonClick();
+ }
+ dialog.dismiss();
+ }
+ })
+ .setNegativeButton("取消", new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ dialog.dismiss();
+ }
+ })
+ .show();
+ }
+
+
+}
diff --git a/app/src/main/java/com/qhclh/ytzh/utils/widget/DateTimePickDialog.java b/app/src/main/java/com/qhclh/ytzh/utils/widget/DateTimePickDialog.java
new file mode 100644
index 0000000..d706b12
--- /dev/null
+++ b/app/src/main/java/com/qhclh/ytzh/utils/widget/DateTimePickDialog.java
@@ -0,0 +1,172 @@
+package com.qhclh.ytzh.utils.widget;
+
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.DatePicker;
+import android.widget.TimePicker;
+
+import com.qhclh.ytzh.R;
+
+import java.util.Calendar;
+import java.util.Date;
+
+
+/**
+ * 时间选择器
+ */
+
+public class DateTimePickDialog implements DatePicker.OnDateChangedListener, TimePicker.OnTimeChangedListener {
+ private Context mContext;
+ private DatePicker mDatePicker;
+ private TimePicker mTimePicker;
+ private Calendar mCalendar;
+ private AlertDialog mAlertDialog;
+
+ private DateChangedCallBack mDateChangedCallBack;
+
+ private boolean isTimePickerAvailable = false;
+
+
+ public DateTimePickDialog(Context context, DateChangedCallBack dateChangedCallBack) {
+ this(context, null, dateChangedCallBack);
+ }
+
+ public DateTimePickDialog(Context context, Date date, DateChangedCallBack dateChangedCallBack) {
+ this.mContext = context;
+ this.mDateChangedCallBack = dateChangedCallBack;
+ mCalendar = Calendar.getInstance();
+ if (date != null) {
+ mCalendar.setTime(date);
+ }
+ initDatePicker();
+ }
+
+ private void initDatePicker() {
+ View view = LayoutInflater.from(mContext).inflate(R.layout.dialog_datepicker, null);
+ mDatePicker = (DatePicker) view.findViewById(R.id.dp_date);
+ mTimePicker = (TimePicker) view.findViewById(R.id.tp_date);
+
+ mDatePicker.init(mCalendar.get(Calendar.YEAR), mCalendar.get(Calendar.MONTH), mCalendar.get(Calendar.DAY_OF_MONTH), this);
+ mTimePicker.setCurrentHour(mCalendar.get(Calendar.HOUR_OF_DAY));
+ mTimePicker.setCurrentMinute(mCalendar.get(Calendar.MINUTE));
+ mTimePicker.setIs24HourView(true);
+ mTimePicker.setOnTimeChangedListener(this);
+ mAlertDialog = new AlertDialog.Builder(mContext)
+ .setView(view)
+ .setPositiveButton("确定", new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+
+ if (mDateChangedCallBack != null) {
+ mDateChangedCallBack.onDateChanged(mCalendar.getTime());
+ }
+ }
+ })
+ .setNegativeButton("取消", new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+
+ }
+ })
+ .create();
+ }
+
+ public void setTimePickerAvailable(boolean isTimePickerAvailable) {
+ this.isTimePickerAvailable = isTimePickerAvailable;
+ if (isTimePickerAvailable) {
+ mTimePicker.setVisibility(View.VISIBLE);
+ } else {
+ mTimePicker.setVisibility(View.GONE);
+ }
+ }
+
+ public void setIs24HourView(boolean is24Hour) {
+ mTimePicker.setIs24HourView(is24Hour);
+ }
+
+
+ public void show() {
+ if (mAlertDialog != null) {
+ mAlertDialog.show();
+ }
+ }
+
+ @Override
+ public void onDateChanged(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
+ mCalendar.set(year, monthOfYear, dayOfMonth);
+ }
+
+
+ /**
+ * @param view The view associated with this listener.
+ * @param hourOfDay The current hour.
+ * @param minute The current minute.
+ */
+ @Override
+ public void onTimeChanged(TimePicker view, int hourOfDay, int minute) {
+ mCalendar.set(Calendar.HOUR_OF_DAY, hourOfDay);
+ mCalendar.set(Calendar.MINUTE, minute);
+ }
+
+
+
+ public interface DateChangedCallBack {
+ void onDateChanged(Date date);
+ }
+
+ public void setCurrentDate(Date date) {
+ mCalendar.setTime(date);
+ updateDate();
+ }
+
+ private void updateDate() {
+ mDatePicker.updateDate(mCalendar.get(Calendar.YEAR), mCalendar.get(Calendar.MONTH), mCalendar.get(Calendar.DAY_OF_MONTH));
+ mTimePicker.setCurrentHour(mCalendar.get(Calendar.HOUR_OF_DAY));
+ mTimePicker.setCurrentMinute(mCalendar.get(Calendar.MINUTE));
+ }
+
+ /**
+ * 设置最大日期
+ *
+ * @param maxDate 最大日期毫秒数
+ */
+ public void setMaxDate(long maxDate) {
+ mDatePicker.setMaxDate(maxDate);
+ }
+
+ /**
+ * 设置最大日期
+ *
+ * @param maxDate 最大日期
+ */
+ public void setMaxDate(Date maxDate) {
+ setMaxDate(maxDate.getTime());
+ }
+
+ /**
+ * 设置最小日期
+ *
+ * @param minDate 最小日期毫秒数
+ */
+ public void setMinDate(long minDate) {
+ long currentDate = new Date().getTime();
+ if (currentDate <= minDate) {
+ mDatePicker.setMinDate(currentDate - 1000);
+ } else {
+ mDatePicker.setMinDate(minDate);
+ }
+
+ }
+
+ /**
+ * 设置最小日期
+ *
+ * @param minDate 最小日期
+ */
+ public void setMinDate(Date minDate) {
+ setMinDate(minDate.getTime());
+ }
+}
diff --git a/app/src/main/res/drawable-xhdpi/ui_dialog_cancel.png b/app/src/main/res/drawable-xhdpi/ui_dialog_cancel.png
new file mode 100644
index 0000000..41e175d
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ui_dialog_cancel.png differ
diff --git a/app/src/main/res/drawable/dialog_basic_data_bg.xml b/app/src/main/res/drawable/dialog_basic_data_bg.xml
new file mode 100644
index 0000000..0525afc
--- /dev/null
+++ b/app/src/main/res/drawable/dialog_basic_data_bg.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/gray_round_stroke_btn.xml b/app/src/main/res/drawable/gray_round_stroke_btn.xml
new file mode 100644
index 0000000..d62ab9c
--- /dev/null
+++ b/app/src/main/res/drawable/gray_round_stroke_btn.xml
@@ -0,0 +1,28 @@
+
+
+ -
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/green_round_solid_btn.xml b/app/src/main/res/drawable/green_round_solid_btn.xml
new file mode 100644
index 0000000..9bb7f13
--- /dev/null
+++ b/app/src/main/res/drawable/green_round_solid_btn.xml
@@ -0,0 +1,26 @@
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/dialog_basic_data_alert.xml b/app/src/main/res/layout/dialog_basic_data_alert.xml
new file mode 100644
index 0000000..69f1a48
--- /dev/null
+++ b/app/src/main/res/layout/dialog_basic_data_alert.xml
@@ -0,0 +1,67 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/dialog_basic_data_multi.xml b/app/src/main/res/layout/dialog_basic_data_multi.xml
new file mode 100644
index 0000000..36777e0
--- /dev/null
+++ b/app/src/main/res/layout/dialog_basic_data_multi.xml
@@ -0,0 +1,132 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/dialog_basic_data_single.xml b/app/src/main/res/layout/dialog_basic_data_single.xml
new file mode 100644
index 0000000..1224dc7
--- /dev/null
+++ b/app/src/main/res/layout/dialog_basic_data_single.xml
@@ -0,0 +1,77 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/dialog_datepicker.xml b/app/src/main/res/layout/dialog_datepicker.xml
new file mode 100644
index 0000000..29634f1
--- /dev/null
+++ b/app/src/main/res/layout/dialog_datepicker.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/dialog_share_message.xml b/app/src/main/res/layout/dialog_share_message.xml
new file mode 100644
index 0000000..9113644
--- /dev/null
+++ b/app/src/main/res/layout/dialog_share_message.xml
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/xml/file_paths.xml b/app/src/main/res/xml/file_paths.xml
new file mode 100644
index 0000000..18ee4b1
--- /dev/null
+++ b/app/src/main/res/xml/file_paths.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/xml/fileselect_paths.xml b/app/src/main/res/xml/fileselect_paths.xml
new file mode 100644
index 0000000..e7fc954
--- /dev/null
+++ b/app/src/main/res/xml/fileselect_paths.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file