lmw
2024-06-18 1f45a54dc8e149548d3a61d1228741627aa4f23e
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
package com.dollearn.student.ui.welfare
 
import android.content.Intent
import androidx.recyclerview.widget.LinearLayoutManager
import com.dollearn.student.R
import com.dollearn.student.network.HttpManager
import com.dollearn.student.network.entity.ExchangeRecord
import com.dollearn.student.network.request
import com.dollearn.student.ui.TransparentStatusBarActivity
import com.dollearn.student.ui.welfare.adapter.ExchangeRecordAdapter
import kotlinx.android.synthetic.main.activity_exchange_record.*
 
class ExchangeRecordActivity : TransparentStatusBarActivity() {
    override fun setContentView() = R.layout.activity_exchange_record
 
    private val list = arrayListOf<ExchangeRecord>()
    private val adapter = ExchangeRecordAdapter(list)
 
 
    override fun initClick() {
 
    }
 
    override fun initView() {
        rv_record.layoutManager = LinearLayoutManager(this)
        rv_record.adapter = adapter
        getData()
    }
 
    private fun getData() {
        HttpManager.exchangeRecord().request(this){_,data->
            list.clear()
            list.addAll(data?: arrayListOf())
            adapter.notifyDataSetChanged()
        }
    }
 
    override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        super.onActivityResult(requestCode, resultCode, data)
        if (resultCode == RESULT_OK){
            getData()
        }
    }
}