fun SmartRefreshLayout.Fin() { this.finishLoadMore() this.finishRefresh()}fun String.log() { log.e(this)}private var toast: Toast? = nullfun show(info: Any?) { if (info.toString().isEmpty() || info.toString().length > 100 || info.toString() .contains("code") ) { return } if (toast == null) { toast = Toast.makeText(BaseApplication.getInstance(), null, Toast.LENGTH_SHORT) } try { toast!!.setText(info.toString() + "") toast!!.show() } catch (c: Exception) { LogUtils.e(c.message) }}fun EditText.IsIdCard(msg: String? = "", msg2: String? = ""): Boolean { if (this.text.toString().isEmpty()) { if (msg == null || msg.isEmpty()) { "请输入身份证号".show } else { msg.show } return false } val r1 = Regex("^[1-9][0-9]{5}(18|19|20)[0-9]{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)[0-9]{3}([0-9]|(X|x))") if (!r1.matches(this.text.toString())) { if (msg2 == null || msg2.isEmpty()) { "请输入正确身份证号".show } else { msg2.show } return false } return true}fun String.IsIdCard(msg: String? = "", msg2: String? = ""): Boolean { if (this.isEmpty()) { if (msg == null || msg.isEmpty()) { "请输入身份证号".show } else { msg.show } return false } val r1 = Regex("^[1-9][0-9]{5}(18|19|20)[0-9]{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)[0-9]{3}([0-9]|(X|x))") if (!r1.matches(this)) { if (msg2 == null || msg2.isEmpty()) { "请输入正确身份证号".show } else { msg2.show } return false } return true}val handlers: Handler = Handler(Looper.getMainLooper()) { msg -> if (msg.what == 1993) { val vp = msg.obj as ViewPager vp.adapter?.count?.let { it -> if (vp.currentItem + 1 == it) { vp.currentItem = 0 } else { vp.currentItem++ } vp.jop(msg.arg1) } } false}fun ViewPager.jop(s: Int) { this.adapter?.count?.let { val msg = Message() msg.obj = this msg.what = 1993 msg.arg1 = s handlers.sendMessageDelayed(msg, s.toLong()) }}fun Any.MtoString(): String { return GsonBuilder().disableHtmlEscaping().create().toJson(this)}