package com.rehome.bhdxj.activity;

import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.rehome.bhdxj.R;
import com.rehome.bhdxj.base.BaseFragment;

/**
 * 我的
 */
public class MineFragment extends BaseFragment {

    private static MineFragment instance = null;
    TextView wechat;
    TextView tvWechat;
    TextView tvName;
    TextView tvMinedb;
    TextView tvMinedbNum;

    private int zjrwNum;

    public static MineFragment getInstance() {
        if (instance == null) {
            instance = new MineFragment();
        }
        return instance;
    }

    @Override
    public int getContentViewId() {
        return R.layout.fragment_mine;
    }

    @Override
    protected void initView() {
        wechat = view.findViewById(R.id.wechat);
        tvWechat = view.findViewById(R.id.tv_wechat);
        tvName = view.findViewById(R.id.tv_name);
        tvMinedb = view.findViewById(R.id.tv_minedb);
        tvMinedbNum = view.findViewById(R.id.tv_minedb_num);
    }

    @Override
    public void initData() {
//        String USERNAME = (String) SPUtils.get(context, Contans.USERNAME, "");
//        tvName.setText(USERNAME);
        wechat.setOnClickListener(v -> {
            try {
                Intent intent = new Intent(Intent.ACTION_MAIN);
                ComponentName cmp = new ComponentName("com.tencent.mm", "com.tencent.mm.ui.LauncherUI");
                intent.addCategory(Intent.CATEGORY_LAUNCHER);
                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                intent.setComponent(cmp);
                startActivity(intent);
            } catch (ActivityNotFoundException e) {
                showToast("请安装微信");
            }
        });

    }

    @Override
    public void onResume() {
        super.onResume();
    }
}
