package com.cooleshow.teacher.ui.live;

import android.view.LayoutInflater;
import android.view.View;
import android.widget.RadioGroup;

import com.cooleshow.base.ui.fragment.BaseFragment;
import com.cooleshow.teacher.R;
import com.cooleshow.teacher.databinding.FragmentLiveBeautyLayoutBinding;
import com.cooleshow.teacher.widgets.helper.LiveRoomBeautyHelper;

/**
 * Author by pq, Date on 2022/6/13.
 */
public class LiveBeautyOptionsFragment extends BaseFragment<FragmentLiveBeautyLayoutBinding> {
    private OnEventListener mEventListener;

    @Override
    protected void initView(View rootView) {
        mViewBinding.rgOptions.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                int type = LiveRoomBeautyHelper.OPTIONS_TYPE1;
                if (checkedId == R.id.rb_options1) {
                    type = LiveRoomBeautyHelper.OPTIONS_TYPE1;
                } else if (checkedId == R.id.rb_options2) {
                    type = LiveRoomBeautyHelper.OPTIONS_TYPE2;
                } else if (checkedId == R.id.rb_options3) {
                    type = LiveRoomBeautyHelper.OPTIONS_TYPE3;
                } else if (checkedId == R.id.rb_options4) {
                    type = LiveRoomBeautyHelper.OPTIONS_TYPE4;
                }
                if (mEventListener != null) {
                    mEventListener.onChangeOptions(type);
                }
            }
        });

    }

    @Override
    protected void initData() {

    }


    @Override
    protected FragmentLiveBeautyLayoutBinding getLayoutView() {
        return FragmentLiveBeautyLayoutBinding.inflate(getLayoutInflater());
    }

    public void setOnEventListener(OnEventListener listener) {
        this.mEventListener = listener;
    }

    public interface OnEventListener {
        void onChangeOptions(int type);
    }
}
