package com.bokecc.livemodule.replay.doc;

import android.content.Context;
import android.graphics.Bitmap;
import android.util.AttributeSet;
import android.util.Log;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.Toast;

import androidx.annotation.Nullable;

import com.bokecc.livemodule.base.BaseDocComponent;
import com.bokecc.livemodule.base.DocCaptureListener;
import com.bokecc.livemodule.replay.DWReplayCoreHandler;
import com.bokecc.sdk.mobile.live.widget.DocView;

/**
 * Copyright (C), 20105-2021, 创盛视联数码科技（北京）有限公司
 * FileName:
 * Author: huanghai
 * Date: 2023/4/19
 * Description:
 */
@Deprecated
public class ReplayDocComponentOld extends BaseDocComponent {


    /**
     * 回放直播间文档展示控件
     */

    private static final String TAG = "ReplayDocComponentOld";
    private DocView mDocView;

    public ReplayDocComponentOld(Context context) {
        super(context);
    }

    public ReplayDocComponentOld(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    protected void initViews() {
        mDocView = new DocView(mContext);
        mDocView.setScrollable(false);
        mDocView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
        addView(mDocView);

        DWReplayCoreHandler replayCoreHandler = DWReplayCoreHandler.getInstance();
        if (replayCoreHandler != null) {
            replayCoreHandler.setDocView(mDocView);
        }

        mDocView.setDocViewListener(this);
    }

    @Override
    public void getDocBitmap(DocCaptureListener listener) {

    }

    @Override
    // 设置文档是否可滑动
    public void setDocScrollable(boolean isDocScrollable) {
        if (mDocView != null) {
            mDocView.setScrollable(isDocScrollable);
        }
    }

    // 设置文档的拉伸模式
    @Override
    public void setScaleType(int type) {
        if (DocView.ScaleType.CENTER_INSIDE.ordinal() == type) {
            mDocView.setDocScaleType(DocView.ScaleType.CENTER_INSIDE);
        } else if (DocView.ScaleType.FIT_XY.ordinal() == type) {
            mDocView.setDocScaleType(DocView.ScaleType.FIT_XY);
        } else if (DocView.ScaleType.CROP_CENTER.ordinal() == type) {
            mDocView.setDocScaleType(DocView.ScaleType.CROP_CENTER);
        }
    }

    @Override
    protected void removeView() {
        removeView(mDocView);
    }


}
