lmw
2024-07-09 b13afc751dbbce24753d008f1f87d2c5e133a4ad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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}小时"
        }){_,_->
 
        }
    }
}