| @ -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); | |||||
| } | |||||
| } | |||||
| @ -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); | |||||
| } | |||||
| } | |||||
| @ -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() { | |||||
| } | |||||
| } | |||||
| @ -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 { | |||||
| } | |||||
| @ -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(); | |||||
| } | |||||
| } | |||||
| @ -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()); | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,7 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <shape xmlns:android="http://schemas.android.com/apk/res/android" > | |||||
| <corners android:radius="8dp" /> | |||||
| <solid android:color="#FFFFFFFF" /> | |||||
| </shape> | |||||
| @ -0,0 +1,28 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <selector | |||||
| xmlns:android="http://schemas.android.com/apk/res/android"> | |||||
| <item android:state_pressed="true"> | |||||
| <shape> | |||||
| <solid android:color="#00000000"/> | |||||
| <stroke android:width="1px" android:color="#FF666666" /> | |||||
| <corners android:topLeftRadius="5dp" android:topRightRadius="5dp" android:bottomLeftRadius="5dp" android:bottomRightRadius="5dp" /> | |||||
| <padding android:left="3dp" android:top="2dp" android:right="3dp" android:bottom="2dp" /> | |||||
| </shape> | |||||
| </item> | |||||
| <item android:state_focused="true"> | |||||
| <shape> | |||||
| <solid android:color="#00000000"/> | |||||
| <stroke android:width="1px" android:color="#FF666666" /> | |||||
| <corners android:topLeftRadius="5dp" android:topRightRadius="5dp" android:bottomLeftRadius="5dp" android:bottomRightRadius="5dp" /> | |||||
| <padding android:left="3dp" android:top="2dp" android:right="3dp" android:bottom="2dp" /> | |||||
| </shape> | |||||
| </item> | |||||
| <item> | |||||
| <shape> | |||||
| <solid android:color="#00000000"/> | |||||
| <stroke android:width="1px" android:color="#FF666666" /> | |||||
| <corners android:topLeftRadius="5dp" android:topRightRadius="5dp" android:bottomLeftRadius="5dp" android:bottomRightRadius="5dp" /> | |||||
| <padding android:left="3dp" android:top="2dp" android:right="3dp" android:bottom="2dp" /> | |||||
| </shape> | |||||
| </item> | |||||
| </selector> | |||||
| @ -0,0 +1,26 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <selector xmlns:android="http://schemas.android.com/apk/res/android"> | |||||
| <item android:state_pressed="true"><shape> | |||||
| <solid android:color="@color/ui_deep_green" /> | |||||
| <padding android:left="12.0dip" android:top="12.0dip" android:right="12.0dip" android:bottom="12.0dip" /> | |||||
| <corners android:bottomLeftRadius="5dp" android:bottomRightRadius="5dp" android:topLeftRadius="5dp" android:topRightRadius="5dp" /> | |||||
| </shape></item> | |||||
| <item android:state_focused="true"><shape> | |||||
| <solid android:color="@color/ui_green" /> | |||||
| <padding android:left="12.0dip" android:top="12.0dip" android:right="12.0dip" android:bottom="12.0dip" /> | |||||
| <corners android:bottomLeftRadius="5dp" android:bottomRightRadius="5dp" android:topLeftRadius="5dp" android:topRightRadius="5dp" /> | |||||
| </shape></item> | |||||
| <item><shape> | |||||
| <solid android:color="@color/ui_green" /> | |||||
| <padding android:left="12.0dip" android:top="12.0dip" android:right="12.0dip" android:bottom="12.0dip" /> | |||||
| <corners android:bottomLeftRadius="5dp" android:bottomRightRadius="5dp" android:topLeftRadius="5dp" android:topRightRadius="5dp" /> | |||||
| </shape></item> | |||||
| </selector> | |||||
| @ -0,0 +1,67 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content" | |||||
| android:background="@drawable/dialog_basic_data_bg" | |||||
| android:gravity="center_vertical|center_horizontal" > | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_gravity="center|top" | |||||
| android:layout_margin="8dp" | |||||
| android:gravity="center" | |||||
| android:orientation="vertical" > | |||||
| <TextView | |||||
| android:id="@+id/tv_dlg_multi_title" | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_margin="5dp" | |||||
| android:gravity="center" | |||||
| android:text="Title" | |||||
| android:visibility="gone" | |||||
| android:textColor="#FF333333" | |||||
| android:textSize="18sp" /> | |||||
| <TextView | |||||
| android:id="@+id/tv_dlg_multi_name1" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_marginTop="20dp" | |||||
| android:layout_height="wrap_content" | |||||
| android:gravity="left" | |||||
| android:text="确定要退出吗?" | |||||
| android:textColor="#FF999999" | |||||
| android:textSize="20sp" /> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content" | |||||
| android:gravity="center" > | |||||
| <Button | |||||
| android:id="@+id/btn_dlg_alert_cancel" | |||||
| android:layout_width="150dp" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_marginBottom="10dp" | |||||
| android:layout_marginTop="20dp" | |||||
| android:layout_marginRight="12dp" | |||||
| android:background="@drawable/green_round_solid_btn" | |||||
| android:text="取消" | |||||
| android:textColor="@color/white" /> | |||||
| <Button | |||||
| android:id="@+id/btn_dlg_multi_ok" | |||||
| android:layout_width="150dp" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_marginBottom="10dp" | |||||
| android:layout_marginTop="20dp" | |||||
| android:background="@drawable/green_round_solid_btn" | |||||
| android:text="确定" | |||||
| android:textColor="@color/white" /> | |||||
| </LinearLayout> | |||||
| </LinearLayout> | |||||
| </RelativeLayout> | |||||
| @ -0,0 +1,132 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content" | |||||
| android:background="@drawable/dialog_basic_data_bg" | |||||
| android:gravity="center_vertical|center_horizontal" > | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_gravity="center|top" | |||||
| android:layout_margin="8dp" | |||||
| android:gravity="center" | |||||
| android:orientation="vertical" > | |||||
| <TextView | |||||
| android:id="@+id/tv_dlg_multi_title" | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_margin="5dp" | |||||
| android:gravity="center" | |||||
| android:text="Title" | |||||
| android:textColor="#FF333333" | |||||
| android:textSize="18sp" /> | |||||
| <LinearLayout | |||||
| android:id="@+id/text1_ll" | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_marginTop="10dp" | |||||
| android:gravity="center" | |||||
| android:orientation="horizontal" > | |||||
| <TextView | |||||
| android:id="@+id/tv_dlg_multi_name1" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:gravity="left" | |||||
| android:text="名称1: " | |||||
| android:textColor="#FF999999" | |||||
| android:textSize="16sp" /> | |||||
| <EditText | |||||
| android:id="@+id/et_dlg_multi_import1" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_marginLeft="5dp" | |||||
| android:background="@drawable/gray_round_stroke_btn" | |||||
| android:minWidth="200dp" | |||||
| android:padding="8dp" | |||||
| android:scrollHorizontally="true" | |||||
| android:textSize="16sp" /> | |||||
| </LinearLayout> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_marginTop="10dp" | |||||
| android:gravity="center" | |||||
| android:orientation="horizontal" > | |||||
| <TextView | |||||
| android:id="@+id/tv_dlg_multi_name2" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:gravity="left" | |||||
| android:text="名称2: " | |||||
| android:textColor="#FF999999" | |||||
| android:textSize="16sp" /> | |||||
| <EditText | |||||
| android:id="@+id/et_dlg_multi_import2" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_marginLeft="5dp" | |||||
| android:background="@drawable/gray_round_stroke_btn" | |||||
| android:minWidth="200dp" | |||||
| android:padding="8dp" | |||||
| android:scrollHorizontally="true" | |||||
| android:textSize="16sp" /> | |||||
| </LinearLayout> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_marginTop="10dp" | |||||
| android:gravity="center" | |||||
| android:orientation="horizontal" > | |||||
| <TextView | |||||
| android:id="@+id/tv_dlg_multi_name3" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:gravity="left" | |||||
| android:text="名称3: " | |||||
| android:textColor="#FF999999" | |||||
| android:textSize="16sp" /> | |||||
| <EditText | |||||
| android:id="@+id/et_dlg_multi_import3" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_marginLeft="5dp" | |||||
| android:background="@drawable/gray_round_stroke_btn" | |||||
| android:minWidth="200dp" | |||||
| android:padding="8dp" | |||||
| android:scrollHorizontally="true" | |||||
| android:textSize="16sp" /> | |||||
| </LinearLayout> | |||||
| <Button | |||||
| android:id="@+id/btn_dlg_multi_ok" | |||||
| android:layout_width="150dp" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_marginBottom="10dp" | |||||
| android:layout_marginTop="20dp" | |||||
| android:background="@drawable/green_round_solid_btn" | |||||
| android:text="确定" | |||||
| android:textColor="@color/white" /> | |||||
| </LinearLayout> | |||||
| <ImageButton | |||||
| android:id="@+id/imgbtn_dlg_multi_cancel" | |||||
| android:layout_width="20dp" | |||||
| android:layout_height="20dp" | |||||
| android:layout_alignParentRight="true" | |||||
| android:layout_alignParentTop="true" | |||||
| android:layout_margin="10dp" | |||||
| android:background="#00000000" | |||||
| android:src="@drawable/ui_dialog_cancel" /> | |||||
| </RelativeLayout> | |||||
| @ -0,0 +1,77 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content" | |||||
| android:background="@drawable/dialog_basic_data_bg" | |||||
| android:gravity="center_vertical|center_horizontal" > | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_gravity="center|top" | |||||
| android:layout_margin="8dp" | |||||
| android:gravity="center" | |||||
| android:orientation="vertical" > | |||||
| <TextView | |||||
| android:id="@+id/tv_dlg_single_title" | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_margin="5dp" | |||||
| android:gravity="center" | |||||
| android:text="Title" | |||||
| android:textColor="#FF333333" | |||||
| android:textSize="18sp" /> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_marginTop="10dp" | |||||
| android:gravity="center" | |||||
| android:orientation="horizontal" > | |||||
| <TextView | |||||
| android:id="@+id/tv_dlg_single_name" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:gravity="left" | |||||
| android:text="名称: " | |||||
| android:textSize="16sp" | |||||
| android:visibility="gone" | |||||
| android:textColor="#FF999999" /> | |||||
| <EditText | |||||
| android:id="@+id/et_dlg_single_import" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_marginLeft="5dp" | |||||
| android:background="@drawable/gray_round_stroke_btn" | |||||
| android:hint="请输入手机号" | |||||
| android:minWidth="200dp" | |||||
| android:padding="8dp" | |||||
| android:scrollHorizontally="true" | |||||
| android:textSize="16sp" /> | |||||
| </LinearLayout> | |||||
| <Button | |||||
| android:id="@+id/btn_dlg_single_ok" | |||||
| android:layout_width="150dp" | |||||
| android:layout_height="wrap_content" | |||||
| android:background="@drawable/green_round_solid_btn" | |||||
| android:layout_marginTop="20dp" | |||||
| android:layout_marginBottom="10dp" | |||||
| android:text="确定" | |||||
| android:textColor="@color/white" /> | |||||
| </LinearLayout> | |||||
| <ImageButton | |||||
| android:id="@+id/imgbtn_dlg_single_cancel" | |||||
| android:layout_width="20dp" | |||||
| android:layout_height="20dp" | |||||
| android:layout_alignParentRight="true" | |||||
| android:layout_alignParentTop="true" | |||||
| android:layout_margin="10dp" | |||||
| android:background="#00000000" | |||||
| android:src="@drawable/ui_dialog_cancel" /> | |||||
| </RelativeLayout> | |||||
| @ -0,0 +1,39 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content" | |||||
| android:orientation="vertical"> | |||||
| <ScrollView | |||||
| android:layout_width="match_parent" | |||||
| android:scrollbars="none" | |||||
| android:layout_height="wrap_content"> | |||||
| <LinearLayout | |||||
| android:orientation="vertical" | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content"> | |||||
| <DatePicker | |||||
| android:id="@+id/dp_date" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_gravity="center" | |||||
| android:calendarViewShown="false"> | |||||
| </DatePicker> | |||||
| <TimePicker | |||||
| android:visibility="gone" | |||||
| android:layout_gravity="center" | |||||
| android:id="@+id/tp_date" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content"> | |||||
| </TimePicker> | |||||
| </LinearLayout> | |||||
| </ScrollView> | |||||
| </LinearLayout> | |||||
| @ -0,0 +1,81 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content" | |||||
| android:background="@drawable/dialog_basic_data_bg" | |||||
| android:gravity="center_vertical|center_horizontal" > | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_gravity="center|top" | |||||
| android:layout_margin="8dp" | |||||
| android:gravity="center" | |||||
| android:orientation="vertical" > | |||||
| <TextView | |||||
| android:id="@+id/tv_dlg_share_title" | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_margin="5dp" | |||||
| android:gravity="center" | |||||
| android:text="请选择发送方式" | |||||
| android:textColor="#FF333333" | |||||
| android:textSize="18sp" /> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_marginTop="10dp" | |||||
| android:gravity="center" | |||||
| android:orientation="horizontal" > | |||||
| <EditText | |||||
| android:id="@+id/et_dlg_share_import" | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="90dp" | |||||
| android:background="@drawable/gray_round_stroke_btn" | |||||
| android:minWidth="200dp" | |||||
| android:padding="8dp" | |||||
| android:scrollHorizontally="true" | |||||
| android:textSize="16sp" /> | |||||
| </LinearLayout> | |||||
| <LinearLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="match_parent" > | |||||
| <Button | |||||
| android:id="@+id/btn_dlg_msg" | |||||
| android:layout_width="100dp" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_margin="15dp" | |||||
| android:layout_weight="1" | |||||
| android:background="@drawable/green_round_solid_btn" | |||||
| android:text="短信发送" | |||||
| android:textColor="@color/white" /> | |||||
| <Button | |||||
| android:id="@+id/btn_dlg_wechat" | |||||
| android:layout_width="100dp" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_margin="15dp" | |||||
| android:layout_weight="1" | |||||
| android:background="@drawable/green_round_solid_btn" | |||||
| android:text="微信发送" | |||||
| android:textColor="@color/white" /> | |||||
| </LinearLayout> | |||||
| </LinearLayout> | |||||
| <ImageButton | |||||
| android:id="@+id/imgbtn_dlg_share_cancel" | |||||
| android:layout_width="20dp" | |||||
| android:layout_height="20dp" | |||||
| android:layout_alignParentRight="true" | |||||
| android:layout_alignParentTop="true" | |||||
| android:layout_margin="10dp" | |||||
| android:background="#00000000" | |||||
| android:src="@drawable/ui_dialog_cancel" /> | |||||
| </RelativeLayout> | |||||
| @ -0,0 +1,5 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <paths> | |||||
| <external-path path="Android/data/com.qhclh.ytzh/" name="files_root" /> | |||||
| <external-path path="." name="external_storage_root" /> | |||||
| </paths> | |||||
| @ -0,0 +1,16 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <paths> | |||||
| <paths> | |||||
| <external-path | |||||
| name="external" | |||||
| path="" /> | |||||
| <files-path | |||||
| name="files" | |||||
| path="" /> | |||||
| <cache-path | |||||
| name="cache" | |||||
| path="" /> | |||||
| </paths> | |||||
| <!--<external-path name="external_files" path="diary sdcard/photo"/>--> | |||||
| </paths> | |||||