| | |
| | | import cn.sinata.xldutils.utils.ViewClickDelay.hash |
| | | import cn.sinata.xldutils.utils.ViewClickDelay.lastClickTime |
| | | import cn.sinata.xldutils.xldUtils |
| | | import com.google.gson.Gson |
| | | import com.okgoincar.base.MyApplication |
| | | import com.okgoincar.bean.OrderBean |
| | | import com.okgoincar.netUtls.Api |
| | | import com.okgoincar.netUtls.callNet |
| | | import com.okgoincar.netUtls.getMapByAny |
| | | import com.okgoincar.utils.Cache.CacheKey |
| | | import org.jetbrains.anko.internals.AnkoInternals |
| | | import java.lang.NumberFormatException |
| | | import java.util.* |
| | |
| | | this.visibility = View.GONE |
| | | } |
| | | |
| | | fun doubleTwo(price: Double): String? { |
| | | return String.format("%.2f", price) |
| | | } |
| | | |
| | | fun View.visible() { |
| | | this.visibility = View.VISIBLE |
| | |
| | | } |
| | | |
| | | |
| | | fun TextView.setDrawableNull() { |
| | | this.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null) |
| | | } |
| | | |
| | | |
| | | fun TextView.setDrawableBottom(drawableResourseId: Int) { |
| | | val topAct: Drawable = context.resources.getDrawable(drawableResourseId) |
| | | this.setCompoundDrawablesWithIntrinsicBounds(null, null, null, topAct) |
| | |
| | | val topAct: Drawable = context.resources.getDrawable(drawableResourseId) |
| | | this.setCompoundDrawablesWithIntrinsicBounds(null, topAct, null, null) |
| | | } |
| | | |
| | | |
| | | fun TextView.setColor(context: Context, resourse: Int) { |
| | | this.setTextColor(ContextCompat.getColor(context, resourse)) |
| | |
| | | Log.e("OkTrip----trip", "--------" + msg) |
| | | } |
| | | |
| | | fun getFormatOne(value:Double?):String{ |
| | | return Formatter().format("%.1f",value).toString() |
| | | fun getFormatOne(value: Double?): String { |
| | | return Formatter().format("%.1f", value).toString() |
| | | } |
| | | fun getFormatTwo(value:Double?):String{ |
| | | return Formatter().format("%.2f",value).toString() |
| | | |
| | | fun getFormatTwo(value: Double?): String { |
| | | return Formatter().format("%.2f", value).toString() |
| | | } |
| | | |
| | | //多个参数 |
| | |
| | | // } |
| | | //}) |
| | | |
| | | fun getNowTimeBlack():Boolean{ |
| | | var hour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY) |
| | | // if (hour < 7 || hour >= 18){ |
| | | if (hour < 7 || hour >= 12){ |
| | | |
| | | fun getNowTimeBlack(): Boolean { |
| | | var hour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY) //此时的小时 |
| | | var dayNow = Calendar.getInstance().get(Calendar.DAY_OF_MONTH)//此时的天数 |
| | | var date = CacheKey.getKeyStr("date_mode") //记录为点击切换的时间Long |
| | | var mode = CacheKey.getKeyStr("mode_now_time") ///记录为点击切换的颜色 1 白色 2 黑色 |
| | | |
| | | if (date.isEmpty()) { |
| | | if (hour < 7 || hour >= 18) { |
| | | return true |
| | | } |
| | | return false |
| | | } else { |
| | | var time: Long = date.toLong() |
| | | var calendar = Calendar.getInstance() |
| | | calendar.timeInMillis = time |
| | | var day = calendar.get(Calendar.DAY_OF_MONTH) |
| | | if (day != dayNow) { |
| | | CacheKey.putKeyStr("date_mode", "") |
| | | return getNowTimeBlack() |
| | | } else { |
| | | return mode != "1" |
| | | } |
| | | } |
| | | return false |
| | | } |
| | | |
| | | fun toast(s:String){ |
| | | Toast.makeText(MyApplication.appContext,s,Toast.LENGTH_SHORT).show() |
| | | interface Isyy{ |
| | | fun isYy(b:Boolean) |
| | | } |
| | | |
| | | fun calldetailOrderIsYy(context: Context,orderId:String,orderType:String,isyy: Isyy){ |
| | | var map = getMapByAny() |
| | | map["orderId"] = orderId |
| | | map["orderType"] = orderType |
| | | map["lat"] = MyApplication.getLocation().latitude |
| | | map["lon"] = MyApplication.getLocation().longitude |
| | | callNet(context, Api.queryPushOrder, map) { |
| | | val data = Gson().fromJson<OrderBean>(it, OrderBean::class.java).data |
| | | data?.let { |
| | | if(it.reservation != 2){ |
| | | isyy.isYy(true) |
| | | }else{ |
| | | isyy.isYy(false) |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | fun toast(s: String) { |
| | | Toast.makeText(MyApplication.appContext, s, Toast.LENGTH_SHORT).show() |
| | | } |