| | |
| | | import cn.sinata.xldutils.visible |
| | | import com.amap.api.location.AMapLocationListener |
| | | import com.dollearn.student.R |
| | | import com.dollearn.student.WeparkApplication |
| | | import com.dollearn.student.DollearnApplication |
| | | import com.dollearn.student.dialog.ChooseTimeDialog |
| | | import com.dollearn.student.network.HttpManager |
| | | import com.dollearn.student.network.entity.CommonData |
| | |
| | | getShop() |
| | | } |
| | | tv_current.setOnClickListener { |
| | | if (WeparkApplication.cityCode.isNotEmpty()){ |
| | | if (DollearnApplication.cityCode.isNotEmpty()){ |
| | | cb_city.isChecked = false |
| | | cityCode = WeparkApplication.cityCode |
| | | cb_city.text = WeparkApplication.cityName |
| | | cityCode = DollearnApplication.cityCode |
| | | cb_city.text = DollearnApplication.cityName |
| | | shop = null |
| | | refreshLayout.autoRefresh() |
| | | getShop() |
| | |
| | | .subscribe { |
| | | if (it){ |
| | | AMapKit.initLocation(this, AMapLocationListener { |
| | | WeparkApplication.lat = it.latitude |
| | | WeparkApplication.lon = it.longitude |
| | | WeparkApplication.province = it.province |
| | | WeparkApplication.provinceCode = "${it.adCode.substring(0,3)}000" |
| | | WeparkApplication.cityName = it.city |
| | | WeparkApplication.cityCode = "${it.adCode.substring(0,4)}00" |
| | | DollearnApplication.lat = it.latitude |
| | | DollearnApplication.lon = it.longitude |
| | | DollearnApplication.province = it.province |
| | | DollearnApplication.provinceCode = "${it.adCode.substring(0,3)}000" |
| | | DollearnApplication.cityName = it.city |
| | | DollearnApplication.cityCode = "${it.adCode.substring(0,4)}00" |
| | | tv_current.text = it.city |
| | | }) |
| | | }else |
| | |
| | | } |
| | | |
| | | override fun initView() { |
| | | shop = WeparkApplication.storeId |
| | | shop = DollearnApplication.storeId |
| | | rv_course.layoutManager = LinearLayoutManager(this) |
| | | rv_course.adapter = adapter |
| | | refreshLayout.setOnRefreshListener { |
| | |
| | | } |
| | | rv_filter.layoutManager = LinearLayoutManager(this) |
| | | rv_filter.adapter = filterAdapter |
| | | tv_current.text = SpanBuilder("当前城市:${WeparkApplication.cityName}").color(this,0,5,R.color.textColor).build() |
| | | tv_current.text = SpanBuilder("当前城市:${DollearnApplication.cityName}").color(this,0,5,R.color.textColor).build() |
| | | //筛选项数据 |
| | | getCity() |
| | | getTypes() |
| | |
| | | } |
| | | |
| | | private fun getShop(){ |
| | | HttpManager.queryStoreLists(WeparkApplication.lat,WeparkApplication.lon,cityCode).request(this){_,data-> |
| | | HttpManager.queryStoreLists(DollearnApplication.lat,DollearnApplication.lon,cityCode).request(this){ _, data-> |
| | | storeList.clear() |
| | | storeList.add(CommonData(name = "全部")) |
| | | storeList.addAll(data?: arrayListOf()) |