package com.qhclh.ytzh.me;

import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.qhclh.ytzh.R;
import com.qhclh.ytzh.base.BaseFragment;

import butterknife.BindView;
import butterknife.OnClick;


/**
 * Created by 青花瓷 on 2017/11/28.
 */

public class MeFragment extends BaseFragment {
    @BindView(R.id.imageView)
    ImageView imageView;
    @BindView(R.id.me_msg)
    TextView meMsg;
    @BindView(R.id.me_set)
    TextView meSet;
    private TextView me_msg, me_set;

    @Override
    protected int setLayout() {
        return R.layout.fragment_me;
    }

    @Override
    protected void initView() {
        drawView();
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void initOper() {

    }

    /**
     * 初始化布局对象
     * 代码控制图片大小
     */
    private void drawView() {
        me_msg = getActivity().findViewById(R.id.me_msg);
        me_set = getActivity().findViewById(R.id.me_set);
        Drawable message_icon = getResources().getDrawable(R.drawable.message_icon);
        Drawable setting_icon = getResources().getDrawable(R.drawable.setting_icon);
        Drawable zhankai_3x = getResources().getDrawable(R.drawable.zhankai_3x);
        message_icon.setBounds(0, 0, 40, 30);//第一0是距左边距离，第二0是距上边距离，40分别是长宽
        setting_icon.setBounds(0, 0, 44, 40);//第一0是距左边距离，第二0是距上边距离，40分别是长宽
        zhankai_3x.setBounds(0, 0, 20, 40);//第一0是距左边距离，第二0是距上边距离，40分别是长宽
        me_msg.setCompoundDrawables(message_icon, null, zhankai_3x, null);//只放左边 右边
        me_set.setCompoundDrawables(setting_icon, null, zhankai_3x, null);//只放左边 右边
    }

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

    @OnClick({R.id.me_msg, R.id.me_set})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.me_msg:
                Intent intent=new Intent(getActivity(),MineInfoActivity.class);
                getActivity().startActivity(intent);
                break;
            case R.id.me_set:
                Intent settingIntent=new Intent(getActivity(),SettingActivity.class);
                getActivity().startActivity(settingIntent);
                break;
        }
    }
}
