package com.example.register.fragment;

import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.example.register.R;

public class PearsonFragment extends Fragment implements View.OnClickListener {
    private ImageView userIconImage;
    private TextView usernameText, userSexText, userCityText;
    private LinearLayout usernameLine, userSexline, userCityLine, userPayLine, userSettingLine, userGeneralLine;


    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = LayoutInflater.from(getActivity()).inflate(R.layout.user, container, false);
        init(view);
        return view;
    }

    /**
     * 组件初始化
     */
    private void init(View view) {
        userIconImage = view.findViewById(R.id.user_face);
        usernameText = view.findViewById(R.id.login_name);
        userSexText = view.findViewById(R.id.reg_sex);
        userCityText = view.findViewById(R.id.reg_address);
        usernameLine = view.findViewById(R.id.login_name_line);
        userSexline = view.findViewById(R.id.reg_sex_line);
        userCityLine = view.findViewById(R.id.reg_address_line);
        userPayLine = view.findViewById(R.id.redbag_line);
        userSettingLine = view.findViewById(R.id.user_setting);
        //userGeneralLine = view.findViewById(R.id.user_general);
        setData();
    }

    /**
     * 组件赋值
     */
    private void setData() {
        Bundle bundle = getArguments();
        usernameText.setText(String.format("用户名：%s", bundle.getString("username")));
        userSexText.setText(String.format("性别：%s", bundle.getString("sex")));
        userCityText.setText(String.format("城市：%s", bundle.getString("city")));
    }

    @Override
    public void onClick(View v) {

    }


}
