|
@@ -1,5 +1,6 @@
|
|
|
package com.yingyangfly.baselib.ext
|
|
|
|
|
|
+import android.annotation.SuppressLint
|
|
|
import android.content.Context
|
|
|
import android.content.Intent
|
|
|
import android.view.View
|
|
@@ -8,6 +9,7 @@ import com.alibaba.android.arouter.facade.Postcard
|
|
|
import com.yingyangfly.baselib.utils.ScreenUtil
|
|
|
import com.yingyangfly.baselib.utils.SingleClickUtil
|
|
|
import java.io.Serializable
|
|
|
+import java.text.SimpleDateFormat
|
|
|
|
|
|
fun View.setOnSingleClickListener(onClickListener: View.OnClickListener) {
|
|
|
SingleClickUtil.proxyOnClickListener(this) {
|
|
@@ -69,3 +71,18 @@ fun EditText.isEmpty(): Boolean {
|
|
|
val toString = this.text.toString()
|
|
|
return toString.isNullOrEmpty()
|
|
|
}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 时间格式转换工具
|
|
|
+ *
|
|
|
+ * @param beforeTime 2022-09-04T08:56:35.000+0000
|
|
|
+ * @return 2022-09-04 08:56:35
|
|
|
+ */
|
|
|
+@SuppressLint("SimpleDateFormat")
|
|
|
+fun timeFormat(beforeTime: String): String {
|
|
|
+ val sdf1 = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
|
|
|
+ val sdf2 = SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ val date = sdf1.parse(beforeTime);
|
|
|
+ return sdf2.format(date);
|
|
|
+}
|
|
|
+
|