lmw
2023-06-13 4b7d8d9a038f6522df46d0f14fa07eb940a1b34d
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package com.kuanzhai.driver.ui.mine
 
import android.view.View
import android.widget.LinearLayout
import cn.sinata.xldutils.utils.clickDelay
import cn.sinata.xldutils.utils.textColor
import com.driver.emanagercar.ui.base.BaseRecyclerFragment
import com.kuanzhai.driver.R
import com.kuanzhai.driver.bean.MyCommentList
import com.kuanzhai.driver.bean.MyCommentListData
import com.kuanzhai.driver.netUtls.Api
import com.kuanzhai.driver.netUtls.getMapByAny
import com.kuanzhai.driver.ui.adapter.CommendInfoListAdapter
import com.scwang.smartrefresh.layout.util.SmartUtil.dp2px
import kotlinx.android.synthetic.main.fragment_base_recycler.*
import kotlinx.android.synthetic.main.item_commend_info_top.view.*
import java.util.HashMap
 
class CommendInfoListFragment:BaseRecyclerFragment<MyCommentListData>(CommendInfoListAdapter()) {
 
    var type = 1
 
 
    override fun pathUrl(): String? {
        return if (type == 1) Api.getMyCommentList else Api.getMyReplyCommentList
    }
 
    override fun mapObject(): HashMap<String?, Any?>? {
        return getMapByAny()
    }
 
    override fun mapString(): HashMap<String?, String?>? {
       return null
    }
 
    override fun getDatas(t: String?): List<MyCommentListData> {
        return gson.fromJson<MyCommentList>(t,MyCommentList::class.java).data
    }
 
    override fun onItemClick(view: View?, position: Int) {
    }
 
    override fun initView() {
       var param =  tv_nothing.layoutParams as LinearLayout.LayoutParams
        param.topMargin = dp2px(66f)
        var view= layoutInflater.inflate(R.layout.item_commend_info_top,null)
        addTopView(view)
        view.tv_mine_commend.clickDelay {
            (adapter as CommendInfoListAdapter).type = 1
            type = 1
            view.tv_mine_commend.textColor(requireContext(),R.color.white)
            view.tv_commend_mine.textColor(requireContext(),R.color.commend_gray)
            view.tv_mine_commend.setBackgroundResource(R.drawable.bg_commend_blue)
            view.tv_commend_mine.setBackgroundResource(R.drawable.bg_commend_gray)
            //点击我评论的
            refresh()
        }
        view.tv_commend_mine.clickDelay {
            //点击评论我的
            (adapter as CommendInfoListAdapter).type = 2
            type = 2
            view.tv_commend_mine.textColor(requireContext(),R.color.white)
            view.tv_commend_mine.setBackgroundResource(R.drawable.bg_commend_blue)
            view.tv_mine_commend.textColor(requireContext(),R.color.commend_gray)
            view.tv_mine_commend.setBackgroundResource(R.drawable.bg_commend_gray)
            refresh()
        }
    }
}