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()
|
}
|
}
|
}
|