package com.dollearn.student.ui.mine
|
|
import androidx.recyclerview.widget.LinearLayoutManager
|
import com.dollearn.student.R
|
import com.dollearn.student.network.HttpManager
|
import com.dollearn.student.network.entity.GameRecord
|
import com.dollearn.student.network.request
|
import com.dollearn.student.ui.TransparentStatusBarActivity
|
import com.dollearn.student.ui.mine.adapter.GameRecordAdapter
|
import com.dollearn.student.utils.extention.formatToChinese
|
import kotlinx.android.synthetic.main.activity_learn_record.*
|
|
class LearnRecordActivity : TransparentStatusBarActivity() {
|
override fun setContentView() = R.layout.activity_learn_record
|
|
private val list = arrayListOf<GameRecord>()
|
private val adapter = GameRecordAdapter(list)
|
|
override fun initClick() {
|
|
}
|
|
override fun initView() {
|
rv_record.layoutManager = LinearLayoutManager(this)
|
rv_record.adapter = adapter
|
|
getData()
|
}
|
|
private fun getData(){
|
HttpManager.studyRecord().request(this,success = {_,data->
|
list.clear()
|
list.addAll(data?.gameRecordList?: arrayListOf())
|
adapter.notifyDataSetChanged()
|
tv_current.text = "当前进度:周目${(data?.record?.week?:0).formatToChinese()}"
|
tv_last.text = "剩余进度:${(data?.record?.surplus?:0).formatToChinese()}周目"
|
tv_total.text = "${data?.record?.totalStudy}小时"
|
tv_today.text = "${data?.record?.todayStudy}小时"
|
tv_week.text = "${data?.record?.weekStudy}小时"
|
tv_month.text = "${data?.record?.monthStudy}小时"
|
}){_,_->
|
|
}
|
}
|
}
|