车队长接口对接
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
package com.dahe.mylibrary.callback
|
||||
|
||||
/**
|
||||
* @ClassName OnMyDatePickedListener
|
||||
* @Author john
|
||||
* @Date 2024/3/1 10:26
|
||||
* @Description TODO
|
||||
*/
|
||||
fun interface OnMyDatePickedListener {
|
||||
fun onDatePicked(date: String)
|
||||
}
|
||||
@@ -11,9 +11,9 @@ public class CommonResponseBean<T> implements Serializable {
|
||||
private int code;
|
||||
private String info;
|
||||
private String msg;
|
||||
private String url;
|
||||
private int res;
|
||||
private String fileName;
|
||||
private int total;
|
||||
|
||||
private boolean success;
|
||||
|
||||
public int getRes() {
|
||||
@@ -64,19 +64,12 @@ public class CommonResponseBean<T> implements Serializable {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
|
||||
public int getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public void setFileName(String fileName) {
|
||||
this.fileName = fileName;
|
||||
public void setTotal(int total) {
|
||||
this.total = total;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,14 +49,14 @@ public class JsonInterceptor implements Interceptor {
|
||||
JSONObject jsonObject = new JSONObject(responseBodyStr);
|
||||
String str = jsonObject.optString("data");
|
||||
int code = jsonObject.optInt("code");
|
||||
if (-1 == code) {
|
||||
jsonObject.put("data", new JSONObject());
|
||||
throw new ResultException();
|
||||
} else {
|
||||
if (TextUtils.isEmpty(str)) {
|
||||
jsonObject.put("data", new JSONObject());
|
||||
}
|
||||
}
|
||||
// if (-1 == code) {
|
||||
// jsonObject.put("data", new JSONObject());
|
||||
// throw new ResultException();
|
||||
// } else {
|
||||
// if (TextUtils.isEmpty(str)) {
|
||||
// jsonObject.put("data", new JSONObject());
|
||||
// }
|
||||
// }
|
||||
|
||||
String data = jsonObject.toString();
|
||||
responseBody = ResponseBody.create(MediaType.parse("application/json; charset=utf-8"), data);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.dahe.mylibrary.utils
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.dahe.mylibrary.R
|
||||
import com.lxj.xpopup.XPopup
|
||||
import com.lxj.xpopup.impl.LoadingPopupView
|
||||
|
||||
@@ -28,7 +29,7 @@ class LoadingUtils private constructor() {
|
||||
loadingPopup = XPopup.Builder(activity)
|
||||
.dismissOnBackPressed(false)
|
||||
.isLightNavigationBar(true)
|
||||
.asLoading(message, LoadingPopupView.Style.ProgressBar)
|
||||
.asLoading(message, LoadingPopupView.Style.Spinner)
|
||||
|
||||
return loadingPopup
|
||||
}
|
||||
@@ -38,7 +39,8 @@ class LoadingUtils private constructor() {
|
||||
loadingPopup = XPopup.Builder(activity)
|
||||
.dismissOnBackPressed(true)
|
||||
.isLightNavigationBar(true)
|
||||
.asLoading(message, LoadingPopupView.Style.ProgressBar)
|
||||
// .asLoading(message, R.layout.custom_loading_popup,LoadingPopupView.Style.Spinner)
|
||||
.asLoading(message, LoadingPopupView.Style.Spinner)
|
||||
.show() as LoadingPopupView
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,11 @@ package com.dahe.mylibrary.utils
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.dahe.mylibrary.base.SingletonNoPHolder
|
||||
import com.dahe.mylibrary.callback.OnMyDatePickedListener
|
||||
import com.github.gzuliyujiang.wheelpicker.BirthdayPicker
|
||||
import com.github.gzuliyujiang.wheelpicker.DatePicker
|
||||
import com.github.gzuliyujiang.wheelpicker.OptionPicker
|
||||
import com.github.gzuliyujiang.wheelpicker.annotation.DateMode
|
||||
import com.github.gzuliyujiang.wheelpicker.contract.OnDatePickedListener
|
||||
import com.github.gzuliyujiang.wheelpicker.contract.OnOptionPickedListener
|
||||
import com.github.gzuliyujiang.wheelpicker.entity.DateEntity
|
||||
@@ -30,17 +33,46 @@ class PickerUtils private constructor() {
|
||||
activity: AppCompatActivity,
|
||||
title: String = "",
|
||||
dateEntity: DateEntity = DateEntity.today(),
|
||||
listener: OnDatePickedListener
|
||||
listener: OnMyDatePickedListener
|
||||
) {
|
||||
val picker = BirthdayPicker(activity)
|
||||
picker.setTitle(title)
|
||||
picker.setDefaultValue(1991, 11, 11)
|
||||
picker.setDefaultValue(dateEntity.year, dateEntity.month, dateEntity.day)
|
||||
picker.setOnDatePickedListener(listener)
|
||||
picker.setOnDatePickedListener { year, month, day ->
|
||||
if (listener != null)
|
||||
listener.onDatePicked("$year-${if (month <= 9) "0${month}" else month}-${if (day <= 9) "0${day}" else day}")
|
||||
}
|
||||
picker.wheelLayout.setResetWhenLinkage(false)
|
||||
picker.show()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* 底部弹出日期选择
|
||||
* @param activity
|
||||
* @param title 日期选择title
|
||||
* @param listener
|
||||
*/
|
||||
fun showDateSim(
|
||||
activity: AppCompatActivity,
|
||||
title: String = "",
|
||||
listener: OnMyDatePickedListener
|
||||
) {
|
||||
val picker = DatePicker(activity)
|
||||
picker.setTitle(title)
|
||||
val wheelLayout = picker.wheelLayout
|
||||
wheelLayout.setDateMode(DateMode.YEAR_MONTH_DAY)
|
||||
wheelLayout.setDateLabel("年", "月", "日")
|
||||
picker.setOnDatePickedListener { year, month, day ->
|
||||
listener.onDatePicked("$year-${if (month <= 9) "0${month}" else month}-${if (day <= 9) "0${day}" else day}")
|
||||
|
||||
}
|
||||
picker.show()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 选择驾驶证类型
|
||||
* @param activity
|
||||
|
||||
@@ -177,6 +177,9 @@ public final class TimeUtil {
|
||||
*/
|
||||
|
||||
private static final DateFormat DEFAULT_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault());
|
||||
private static final DateFormat DEFAULT_FORMAT_DATE = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
|
||||
private static final DateFormat DEFAULT_FORMAT_DATE_POINT = new SimpleDateFormat("yyyy.MM.dd", Locale.getDefault());
|
||||
private static final DateFormat DEFAULT_FORMAT_DATE_NONE = new SimpleDateFormat("yyyyMMdd", Locale.getDefault());
|
||||
private static final DateFormat DEFAULT_FORMAT2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZSS:SS", Locale.getDefault());
|
||||
private static final DateFormat DEFAULT_FORMAT3 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.getDefault());
|
||||
|
||||
@@ -215,7 +218,7 @@ public final class TimeUtil {
|
||||
* @return 毫秒时间戳
|
||||
*/
|
||||
public static long string2Millis(final String time) {
|
||||
if (TextUtils.isEmpty(time)){
|
||||
if (TextUtils.isEmpty(time)) {
|
||||
return -1;
|
||||
}
|
||||
return string2Millis(time, DEFAULT_FORMAT);
|
||||
@@ -242,10 +245,10 @@ public final class TimeUtil {
|
||||
* 将时间字符串转为时间戳
|
||||
* <p>time格式为format</p>
|
||||
*
|
||||
* @param time 时间字符串
|
||||
* @param time 时间字符串
|
||||
* @return 毫秒时间戳
|
||||
*/
|
||||
public static String string2String(final String time,final SimpleDateFormat format) {
|
||||
public static String string2String(final String time, final SimpleDateFormat format) {
|
||||
try {
|
||||
return date2String(format.parse(time));
|
||||
// return DEFAULT_FORMAT.format(DEFAULT_FORMAT2.parse(time).getTime());
|
||||
@@ -421,7 +424,7 @@ public final class TimeUtil {
|
||||
* @return 合适型两个时间差
|
||||
*/
|
||||
public static String getFitTimeSpan(final String time0, final String time1, final int precision) {
|
||||
if (TextUtils.isEmpty(time0)||TextUtils.isEmpty(time1)){
|
||||
if (TextUtils.isEmpty(time0) || TextUtils.isEmpty(time1)) {
|
||||
return "";
|
||||
}
|
||||
return millis2FitTimeSpan(Math.abs(string2Millis(time0, DEFAULT_FORMAT) - string2Millis(time1, DEFAULT_FORMAT)), precision);
|
||||
@@ -638,6 +641,24 @@ public final class TimeUtil {
|
||||
return getFitTimeSpan(getNowString(format), time, format, precision);
|
||||
}
|
||||
|
||||
|
||||
public static String changeDateFormat(String date) {
|
||||
long l = string2Millis(date,DEFAULT_FORMAT_DATE_POINT);
|
||||
if (l != -1) {
|
||||
return millis2String(l, DEFAULT_FORMAT_DATE);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
public static String changeDateNoneFormat(String date) {
|
||||
long l = string2Millis(date,DEFAULT_FORMAT_DATE_NONE);
|
||||
if (l != -1) {
|
||||
return millis2String(l, DEFAULT_FORMAT_DATE);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取合适型与当前时间的差
|
||||
*
|
||||
@@ -1685,7 +1706,7 @@ public final class TimeUtil {
|
||||
* @param compareDate
|
||||
* @return
|
||||
*/
|
||||
public static boolean compareDate(String nowDate, String compareDate,DateFormat format) {
|
||||
public static boolean compareDate(String nowDate, String compareDate, DateFormat format) {
|
||||
DateFormat df = format;
|
||||
try {
|
||||
Date now = df.parse(nowDate);
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:padding="40dp"
|
||||
android:background="#EED3CFCF"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ProgressBar
|
||||
android:indeterminate="false"
|
||||
android:indeterminateTintMode="src_atop"
|
||||
android:indeterminateTint="#FFFFFF"
|
||||
android:layout_width="35dp"
|
||||
android:layout_height="35dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#28B950</color>
|
||||
<color name="colorPrimaryDark">#28B950</color>
|
||||
<color name="colorPrimary">#FFFFFF</color>
|
||||
<color name="colorPrimaryDark">#FFFFFF</color>
|
||||
<color name="colorAccent">#D81B60</color>
|
||||
|
||||
<color name="colorWhite">#FFFFFFFF</color>
|
||||
|
||||
Reference in New Issue
Block a user