diff --git a/OCH/common/common/src/main/java/com/mogo/och/common/module/utils/DateTimeUtil.java b/OCH/common/common/src/main/java/com/mogo/och/common/module/utils/DateTimeUtil.java index 04f7d48529..42583fdad4 100644 --- a/OCH/common/common/src/main/java/com/mogo/och/common/module/utils/DateTimeUtil.java +++ b/OCH/common/common/src/main/java/com/mogo/och/common/module/utils/DateTimeUtil.java @@ -1,10 +1,13 @@ package com.mogo.och.common.module.utils; +import android.annotation.SuppressLint; + import com.mogo.eagle.core.utilcode.util.DateTimeUtils; import java.text.SimpleDateFormat; import java.util.Calendar; -import java.util.Date; +import java.util.HashMap; +import java.util.Map; import java.util.TimeZone; /** @@ -24,8 +27,7 @@ public class DateTimeUtil { public static String formatCalendarToString(Calendar calendar, String format){ if (calendar == null) return ""; try { - SimpleDateFormat dateFormat = new SimpleDateFormat(format); - return dateFormat.format(calendar.getTime()); + return getSafeDateFormat(format).format(calendar.getTime()); }catch (Exception e){ e.printStackTrace(); } @@ -50,8 +52,7 @@ public class DateTimeUtil { } public static String formatLongToString(long time, String format){ try { - SimpleDateFormat dateFormat = new SimpleDateFormat(format); - return dateFormat.format(time); + return getSafeDateFormat(format).format(time); }catch (Exception e){ e.printStackTrace(); } @@ -108,11 +109,6 @@ public class DateTimeUtil { return calendar.getTimeInMillis(); } - public static String getAfterSecondTime(int timeInSecond,String formate){ - Calendar beforeTime = Calendar.getInstance(); - beforeTime.add(Calendar.SECOND, timeInSecond); - return formatCalendarToString(beforeTime, formate); - } public static String getAfterSecondTime(int timeInSecond){ Calendar beforeTime = Calendar.getInstance(); beforeTime.add(Calendar.SECOND, timeInSecond); @@ -163,4 +159,31 @@ public class DateTimeUtil { return stringBuffer.toString(); } + + private static final ThreadLocal> SDF_THREAD_LOCAL + = new ThreadLocal>() { + @Override + protected Map initialValue() { + return new HashMap<>(); + } + + @Override + public void remove() { + super.remove(); + } + }; + + + @SuppressLint("SimpleDateFormat") + public static SimpleDateFormat getSafeDateFormat(String pattern) { + Map sdfMap = SDF_THREAD_LOCAL.get(); + //noinspection ConstantConditions + SimpleDateFormat simpleDateFormat = sdfMap.get(pattern); + if (simpleDateFormat == null) { + simpleDateFormat = new SimpleDateFormat(pattern); + sdfMap.put(pattern, simpleDateFormat); + } + return simpleDateFormat; + } + } diff --git a/OCH/taxi/passenger/src/main/java/com/mogo/och/taxi/passenger/ui/evaluate/EvaluateView.kt b/OCH/taxi/passenger/src/main/java/com/mogo/och/taxi/passenger/ui/evaluate/EvaluateView.kt new file mode 100644 index 0000000000..d51fb1a765 --- /dev/null +++ b/OCH/taxi/passenger/src/main/java/com/mogo/och/taxi/passenger/ui/evaluate/EvaluateView.kt @@ -0,0 +1,107 @@ +package com.mogo.och.taxi.passenger.ui.evaluate + +import android.animation.Animator +import android.animation.AnimatorListenerAdapter +import android.animation.ObjectAnimator +import android.animation.ValueAnimator +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import androidx.constraintlayout.widget.ConstraintLayout +import com.mogo.commons.voice.AIAssist +import com.mogo.eagle.core.utilcode.kotlin.onClick +import com.mogo.och.common.module.utils.RxUtils +import com.mogo.och.common.module.voice.VoiceNotice +import com.mogo.och.taxi.passenger.R +import kotlinx.android.synthetic.main.taxi_p_evaluate.view.iv_close +import kotlinx.android.synthetic.main.taxi_p_evaluate.view.iv_evaluate_great +import kotlinx.android.synthetic.main.taxi_p_evaluate.view.iv_evaluate_low +import kotlinx.android.synthetic.main.taxi_p_evaluate.view.iv_taxt_p_greate_text + + +class EvaluateView : ConstraintLayout { + + private val TAG = "EvaluateView" + + constructor(context: Context) : super(context) + + constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet) + + constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(context, attributeSet, defStyleAttr) + + constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attributeSet, defStyleAttr, defStyleRes) + + private var isFirat = true + + private fun initView() { + LayoutInflater.from(context).inflate(R.layout.taxi_p_evaluate, this, true) + iv_evaluate_great.onClick { + if(isFirat){ + iv_evaluate_great.pivotX = (iv_evaluate_great.width / 2).toFloat() + iv_evaluate_great.pivotY = iv_evaluate_great.height.toFloat() + iv_evaluate_great.animate().scaleY(1.7f).scaleX(1.7f).setListener(object + :AnimatorListenerAdapter() { + override fun onAnimationStart(animation: Animator) { + VoiceNotice.showNotice("感谢您的认可,我们会再接再厉", AIAssist.LEVEL2) + iv_taxt_p_greate_text.animate().alpha(1f).duration = 1000 + // 小智爱心动作 + RxUtils.createSubscribe(3_000) { + visibility = GONE + iv_taxt_p_greate_text.visibility = GONE + // 小智回归默认动作 + } + } + }).duration = 1000 + isFirat = false + } + } + + iv_evaluate_low.onClick { + if(isFirat){ + iv_evaluate_low.pivotX = (iv_evaluate_low.width / 2).toFloat() + iv_evaluate_low.pivotY = iv_evaluate_low.height.toFloat() + iv_evaluate_low.animate().scaleY(1.7f).scaleX(1.7f).setListener(object : + AnimatorListenerAdapter() { + override fun onAnimationStart(animation: Animator) { + VoiceNotice.showNotice("感谢您的反馈,我们会继续努力!", AIAssist.LEVEL2) + // 小智爱心动作 + RxUtils.createSubscribe(3_000) { + visibility = GONE + // 小智回归默认动作 + } + } + }).duration = 1000 + isFirat = false + } + } + iv_close.onClick { + visibility = GONE + } + + } + + override fun onVisibilityAggregated(isVisible: Boolean) { + super.onVisibilityAggregated(isVisible) + if(isVisible){ + isFirat = true + VoiceNotice.showNotice("行程即将结束咯~小智很想知道您的体验如何呢", AIAssist.LEVEL2) + } + } + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + + } + + + + init { + try { + initView() + } catch (e: Exception) { + e.printStackTrace() + } + } + + +} \ No newline at end of file diff --git a/OCH/taxi/passenger/src/main/res/drawable-nodpi/taxi_p_evaluate_close.png b/OCH/taxi/passenger/src/main/res/drawable-nodpi/taxi_p_evaluate_close.png new file mode 100644 index 0000000000..068c08b2f3 Binary files /dev/null and b/OCH/taxi/passenger/src/main/res/drawable-nodpi/taxi_p_evaluate_close.png differ diff --git a/OCH/taxi/passenger/src/main/res/drawable-nodpi/taxi_p_evaluate_great.png b/OCH/taxi/passenger/src/main/res/drawable-nodpi/taxi_p_evaluate_great.png new file mode 100644 index 0000000000..3abc85a7ae Binary files /dev/null and b/OCH/taxi/passenger/src/main/res/drawable-nodpi/taxi_p_evaluate_great.png differ diff --git a/OCH/taxi/passenger/src/main/res/drawable-nodpi/taxi_p_evaluate_low.png b/OCH/taxi/passenger/src/main/res/drawable-nodpi/taxi_p_evaluate_low.png new file mode 100644 index 0000000000..9f409392c0 Binary files /dev/null and b/OCH/taxi/passenger/src/main/res/drawable-nodpi/taxi_p_evaluate_low.png differ diff --git a/OCH/taxi/passenger/src/main/res/drawable-nodpi/taxt_p_greate_text.png b/OCH/taxi/passenger/src/main/res/drawable-nodpi/taxt_p_greate_text.png new file mode 100644 index 0000000000..21334f62d6 Binary files /dev/null and b/OCH/taxi/passenger/src/main/res/drawable-nodpi/taxt_p_greate_text.png differ diff --git a/OCH/taxi/passenger/src/main/res/layout/taxi_p_evaluate.xml b/OCH/taxi/passenger/src/main/res/layout/taxi_p_evaluate.xml new file mode 100644 index 0000000000..065c04e4e6 --- /dev/null +++ b/OCH/taxi/passenger/src/main/res/layout/taxi_p_evaluate.xml @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OCH/taxi/passenger/src/main/res/values/colors.xml b/OCH/taxi/passenger/src/main/res/values/colors.xml index 69d7f8459d..972c8dfbdb 100644 --- a/OCH/taxi/passenger/src/main/res/values/colors.xml +++ b/OCH/taxi/passenger/src/main/res/values/colors.xml @@ -47,6 +47,7 @@ #598CFF #253A5A #4DFFFFFF + #131415 #464646