package com.dollearn.student.ui.home
|
|
import cn.sinata.xldutils.fragment.BaseFragment
|
import com.dollearn.student.R
|
import com.dollearn.student.dialog.RecommendGoodsDialog
|
import com.dollearn.student.network.HttpManager
|
import com.dollearn.student.network.requestByF
|
import com.dollearn.student.utils.extention.clickDelay
|
import kotlinx.android.synthetic.main.fragment_home.*
|
import org.jetbrains.anko.support.v4.startActivity
|
|
class HomeFragment : BaseFragment() {
|
override fun contentViewId() = R.layout.fragment_home
|
|
|
override fun onFirstVisibleToUser() {
|
initClick()
|
}
|
|
private fun initClick() {
|
cl_listen.clickDelay {
|
HttpManager.goodRecommend().requestByF(this,false,{_,data->
|
if (data.isNullOrEmpty())
|
startActivity<WeekSelectActivity>()
|
else{
|
RecommendGoodsDialog.show(childFragmentManager,data)
|
}
|
}){_,_->
|
startActivity<WeekSelectActivity>()
|
}
|
}
|
}
|
|
}
|