package com.meeting.demo.view.sdk;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;

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

import com.meeting.demo.R;
import com.meeting.demo.utils.DemoUtil;
import com.meeting.demo.view.base.BaseDialogFragment;

public class CustomUITextFragment extends BaseDialogFragment {

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.set_custom_ui_text_layout, container, false);
        EditText descEditTextCN = rootView.findViewById(R.id.custom_live_desc_editview_cn);
        EditText toastEditTextCN = rootView.findViewById(R.id.custom_live_toast_editview_cn);
        EditText descEditTextEN = rootView.findViewById(R.id.custom_live_desc_editview_en);
        EditText toastEditTextEN = rootView.findViewById(R.id.custom_live_toast_editview_en);
        Button setButton = rootView.findViewById(R.id.set_custom_text_button);
        setButton.setOnClickListener(v -> {
            String descCN = descEditTextCN.getText().toString();
            String toastCN = toastEditTextCN.getText().toString();
            String descEN = descEditTextEN.getText().toString();
            String toastEN = toastEditTextEN.getText().toString();
            DemoUtil.saveString("customLiveDescCN", descCN);
            DemoUtil.saveString("customLiveToastCN", toastCN);
            DemoUtil.saveString("customLiveDescEN", descEN);
            DemoUtil.saveString("customLiveToastEN", toastEN);
            doDismissDialogAndFragment();
        });
        return rootView;
    }
}
