package com.yutou.jianr_mg.Tools;

import android.content.Context;
import android.os.Bundle;

import com.tencent.smtt.sdk.TbsReaderView;

import java.io.File;

public class ExcelUtils {
    private TbsReaderView tbs;
    private Context context;

    public ExcelUtils(Context context) {
        this.context = context;
        tbs = new TbsReaderView(context, null);
    }

    public TbsReaderView getReader() {
        return tbs;
    }

    public void start(File file) {
        if(tbs==null){
            Log.e("TBS服务已关闭");
        }
        Bundle bundle = new Bundle();
        bundle.putString("filePath", file.getAbsolutePath());
        bundle.putString("tempPath", Utils.getAppPath()+ "/" + "TbsReaderTemp");
       boolean flag= tbs.preOpen("xlsx", false);
        System.out.println("打开文件："+flag);
        tbs.openFile(bundle);
    }
    public void close(){
        tbs.onStop();
    }
    public void stop() {
        tbs.onStop();
        tbs=null;
    }
}
