lmw
2023-05-12 f67802a41f9e01444d1115f34ecc6e1beb05fc3b
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.fuban.user.ui.mine
 
import android.view.View
import androidx.core.os.bundleOf
import androidx.fragment.app.Fragment
import com.fuban.user.R
import com.fuban.user.network.HttpManager
import com.fuban.user.network.request
import com.fuban.user.ui.TransparentStatusBarActivity
import com.fuban.user.dialog.TipDialog
import kotlinx.android.synthetic.main.activity_order.*
 
class MsgActivity : TransparentStatusBarActivity() {
    override fun setContentView() = R.layout.activity_order
 
    private val titles = arrayOf("系统提示","平台公告")
    private val fragments = arrayListOf<Fragment>()
    override fun initClick() {
    }
 
    override fun initView() {
        title = "消息"
        titleBar.addRightButton("清空消息",onClickListener = View.OnClickListener {
            val tipDialog = TipDialog()
            tipDialog.arguments = bundleOf("msg" to "是否确认清除所有消息和公告?")
            tipDialog.setCallback(object :TipDialog.OnClickCallback{
                override fun onOk() {
                    HttpManager.clearSystemNotice().request(this@MsgActivity){_,_->
                        fragments.forEach {
                            (it as MsgFragment).clear()
                        }
                    }
                }
 
                override fun onCancel() {
                }
            })
            tipDialog.show(supportFragmentManager,"clear")
        })
        fragments.add(MsgFragment.newInstance(MsgFragment.TYPE_MSG))
        fragments.add(MsgFragment.newInstance(MsgFragment.TYPE_NOTICE))
        tab_type.setViewPager(view_pager,titles,this,fragments)
    }
 
}