package com.example.orangesale_05.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.orangesale_05.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.content_user, container, false);
        init(view);
        return view;
    }

    /**
     * 组件初始化
     */
    private void init(View view) {
        userIconImage = view.findViewById(R.id.user_icon);
        usernameText = view.findViewById(R.id.user_username);
        userSexText = view.findViewById(R.id.user_sex);
        userCityText = view.findViewById(R.id.user_city);
        usernameLine = view.findViewById(R.id.user_username_line);
        userSexline = view.findViewById(R.id.user_sex_line);
        userCityLine = view.findViewById(R.id.user_city_line);
        userPayLine = view.findViewById(R.id.user_pay);
        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) {

    }


}
