ContactCustomerServiceActivity.java 4 KB
Newer Older
ydl committed
1 2 3 4 5 6 7 8 9 10 11
package com.yidianling.user.mine;

import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.view.View;
import android.widget.TextView;

import com.tbruyelle.rxpermissions2.RxPermissions;
import com.ydl.ydlcommon.base.BaseActivity;
12
import com.ydl.ydlcommon.bean.StatusBarOptions;
ydl committed
13 14 15 16 17 18
import com.ydl.ydlcommon.data.PlatformDataManager;
import com.ydl.ydlcommon.view.JumpTextView;
import com.ydl.ydlcommon.view.TitleBar;
import com.ydl.ydlcommon.view.dialog.CommonDialog;
import com.yidianling.user.R;

19 20
import org.jetbrains.annotations.NotNull;

ydl committed
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
/**
 * 联系客服
 * Created by softrice on 15/12/1.
 */
public class ContactCustomerServiceActivity extends BaseActivity {

    //    @BindView(R.id.tb_title)
    TitleBar tb_title;
    //    @BindView(R.id.jtv_custom_service)
    JumpTextView jtv_custom_service;
    //    @BindView(R.id.jtv_wechat)
    JumpTextView jtv_wechat;

    //    @BindView(R.id.tv_service_time)
    TextView tvServiceTime;

    String work_time = PlatformDataManager.INSTANCE.getRam().getGlobalInfo() == null ? "早8:30-凌晨2:00" : PlatformDataManager.INSTANCE.getRam().getGlobalInfo().info.work_time;
38
    final String tel = PlatformDataManager.INSTANCE.getRam().getGlobalInfo() == null ? "400-765-1010" : PlatformDataManager.INSTANCE.getRam().getGlobalInfo().info.tel;
ydl committed
39 40 41 42
    String wechatAccount = PlatformDataManager.INSTANCE.getRam().getGlobalInfo() == null ? " xinliyidianling" : PlatformDataManager.INSTANCE.getRam().getGlobalInfo().info.wechatAccount;

    private RxPermissions rxPermissions;

43 44 45 46 47 48
    @NotNull
    @Override
    public StatusBarOptions getStatusViewOptions() {
        return new StatusBarOptions(true,true);
    }

ydl committed
49 50 51 52 53 54 55 56 57 58 59 60
    @Override
    protected int layoutResId() {
        return R.layout.user_mine_activity_contact_customer_service;
    }

    @Override
    protected void initDataAndEvent() {
        tb_title = findViewById(R.id.tb_title);
        jtv_custom_service = findViewById(R.id.jtv_custom_service);
        jtv_wechat = findViewById(R.id.jtv_wechat);

        jtv_custom_service.setOnClickListener(v -> {
61
            String con = "\n400-765-1010\n(服务时间 早8:30-凌晨2:00)";
ydl committed
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113

            if (PlatformDataManager.INSTANCE.getRam().getGlobalInfo() != null && PlatformDataManager.INSTANCE.getRam().getGlobalInfo().info != null) {
                con = PlatformDataManager.INSTANCE.getRam().getGlobalInfo().info.tel + "\n" + PlatformDataManager.INSTANCE.getRam().getGlobalInfo().info.work_time;
            }

            new CommonDialog(this)
                    .setTitle("欢迎致电壹点灵客服热线")
                    .setMessage(con)
                    .setLeftOnclick("取消", new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {

                        }
                    }).setRightClick("拨打", new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Intent phoneIntent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + tel));
                    startActivity(phoneIntent);
                }
            }).show();
        });

        jtv_wechat.setOnClickListener(v -> {
            copy(wechatAccount, this);
            new CommonDialog(this)
                    .setMessage("壹点灵微信号已复制到粘贴板,请\n打开微信搜索就能关注我们咯~")
                    .setRightClick("好的", new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {

                        }
                    }).show();
        });
        init();
    }


    void init() {
        rxPermissions = new RxPermissions(this);

        jtv_custom_service.setRightText(tel);

    }


    public void copy(String content, Context context) {
        // 得到剪贴板管理器
        ClipboardManager cmb = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
        cmb.setText(content.trim());
    }

}