lmw
2023-03-11 4df5bb59e5fe9f9d140e5610f7772dd8a05a28d4
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
package com.fuban.driver.ui.mine
 
import com.fuban.driver.R
import com.fuban.driver.base.MyBaseActivity
import com.fuban.driver.bean.AllPhoneBean
import com.fuban.driver.netUtls.Api
import com.fuban.driver.netUtls.callNet
import com.fuban.driver.netUtls.getMapByAny
import com.fuban.driver.utils.MyUtils
import kotlinx.android.synthetic.main.activity_server_phone.*
import org.jetbrains.anko.toast
 
class ServerPhoneActivity: MyBaseActivity() {
    override fun setContentView() {
        setContentView(R.layout.activity_server_phone)
    }
 
    override fun initView() {
        setTitleText("客服电话")
        callPhones()
    }
 
    private fun callPhones() {
        callNet(Api.queryPhoneAll, getMapByAny()){
            var bean = gson.fromJson<AllPhoneBean>(it,AllPhoneBean::class.java)
            tv_phone_three.text = bean.data.platform
            tv_phone_two.text = bean.data.branch
            tv_phone_one.text = bean.data.franchisee
        }
    }
 
    override fun setOnclick() {
        tv_phone_three.setOnClickListener {
            if (tv_phone_three.text.isEmpty()){
                toast("平台暂无联系方式")
                return@setOnClickListener
            }
            MyUtils.getInstans().CallPhone(this,tv_phone_three.text.toString())
        }
        tv_phone_two.setOnClickListener {
            if (tv_phone_two.text.isEmpty()){
                toast("分公司暂无联系方式")
                return@setOnClickListener
            }
            MyUtils.getInstans().CallPhone(this,tv_phone_two.text.toString())
        }
        tv_phone_one.setOnClickListener {
            if (tv_phone_one.text.isEmpty()){
                toast("车队暂无联系方式")
                return@setOnClickListener
            }
            MyUtils.getInstans().CallPhone(this,tv_phone_one.text.toString())
        }
    }
}