Search in sources :

Example 1 with Converter

use of com.herewhite.sdk.Converter in project whiteboard-android by netless-io.

the class RoomActivity method dynamicConvert.

public void dynamicConvert(MenuItem item) {
    Converter c = new Converter(this.token);
    c.startConvertTask("https://white-cn-edge-doc-convert.oss-cn-hangzhou.aliyuncs.com/-1/1.pptx", Converter.ConvertType.Dynamic, new ConverterCallbacks() {

        @Override
        public void onFailure(ConvertException e) {
            logAction(e.getMessage());
        }

        @Override
        public void onFinish(ConvertedFiles ppt, ConversionInfo convertInfo) {
            mRoom.putScenes("/dynamic", ppt.getScenes(), 0);
            mRoom.setScenePath("/dynamic/1");
            logAction(convertInfo.toString());
        }

        @Override
        public void onProgress(Double progress, ConversionInfo convertInfo) {
            logAction(String.valueOf(progress));
        }
    });
    // ConvertV5
    ConverterV5.Builder builder = new ConverterV5.Builder();
    ConverterV5 converter = builder.setResource("https://white-cn-edge-doc-convert.oss-cn-hangzhou.aliyuncs.com/-1/1.pptx").setType(ConvertType.Dynamic).setPreview(true).setSdkToken(demoAPI.getSdkToken()).setTaskUuid(null).setTaskToken(null).setCallback(new ConverterCallbacks() {

        @Override
        public void onProgress(Double progress, ConversionInfo convertInfo) {
        }

        @Override
        public void onFinish(ConvertedFiles ppt, ConversionInfo convertInfo) {
        }

        @Override
        public void onFailure(ConvertException e) {
        }
    }).build();
    converter.startConvertTask();
}
Also used : ConvertException(com.herewhite.sdk.domain.ConvertException) MapBuilder(com.herewhite.demo.utils.MapBuilder) Converter(com.herewhite.sdk.Converter) ConverterCallbacks(com.herewhite.sdk.ConverterCallbacks) ConvertedFiles(com.herewhite.sdk.domain.ConvertedFiles) ConversionInfo(com.herewhite.sdk.domain.ConversionInfo) ConverterV5(com.herewhite.sdk.converter.ConverterV5)

Example 2 with Converter

use of com.herewhite.sdk.Converter in project whiteboard-android by netless-io.

the class PptResourceCacheActivity method dynamicConvert.

public void dynamicConvert(MenuItem item) {
    Converter c = new Converter(this.token);
    c.startConvertTask("https://white-cn-edge-doc-convert.oss-cn-hangzhou.aliyuncs.com/-1/1.pptx", Converter.ConvertType.Dynamic, new ConverterCallbacks() {

        @Override
        public void onFailure(ConvertException e) {
            logAction(e.getMessage());
        }

        @Override
        public void onFinish(ConvertedFiles ppt, ConversionInfo convertInfo) {
            mRoom.putScenes("/dynamic", ppt.getScenes(), 0);
            mRoom.setScenePath("/dynamic/1");
            logAction(convertInfo.toString());
        }

        @Override
        public void onProgress(Double progress, ConversionInfo convertInfo) {
            logAction(String.valueOf(progress));
        }
    });
}
Also used : ConvertException(com.herewhite.sdk.domain.ConvertException) Converter(com.herewhite.sdk.Converter) ConverterCallbacks(com.herewhite.sdk.ConverterCallbacks) ConvertedFiles(com.herewhite.sdk.domain.ConvertedFiles) ConversionInfo(com.herewhite.sdk.domain.ConversionInfo)

Example 3 with Converter

use of com.herewhite.sdk.Converter in project whiteboard-android by netless-io.

the class PptResourceCacheActivity method staticConvert.

public void staticConvert(MenuItem item) {
    Converter c = new Converter(this.token);
    c.startConvertTask("https://white-cn-edge-doc-convert.oss-cn-hangzhou.aliyuncs.com/LightWaves.pdf", Converter.ConvertType.Static, new ConverterCallbacks() {

        @Override
        public void onFailure(ConvertException e) {
            logAction(e.getMessage());
        }

        @Override
        public void onFinish(ConvertedFiles ppt, ConversionInfo convertInfo) {
            mRoom.putScenes("/static", ppt.getScenes(), 0);
            mRoom.setScenePath("/static/1");
            logAction(convertInfo.toString());
        }

        @Override
        public void onProgress(Double progress, ConversionInfo convertInfo) {
            logAction(String.valueOf(progress));
        }
    });
}
Also used : ConvertException(com.herewhite.sdk.domain.ConvertException) Converter(com.herewhite.sdk.Converter) ConverterCallbacks(com.herewhite.sdk.ConverterCallbacks) ConvertedFiles(com.herewhite.sdk.domain.ConvertedFiles) ConversionInfo(com.herewhite.sdk.domain.ConversionInfo)

Example 4 with Converter

use of com.herewhite.sdk.Converter in project whiteboard-android by netless-io.

the class RoomActivity method staticConvert.

public void staticConvert(MenuItem item) {
    Converter c = new Converter(this.token);
    c.startConvertTask("https://white-cn-edge-doc-convert.oss-cn-hangzhou.aliyuncs.com/LightWaves.pdf", Converter.ConvertType.Static, new ConverterCallbacks() {

        @Override
        public void onFailure(ConvertException e) {
            logAction(e.getMessage());
        }

        @Override
        public void onFinish(ConvertedFiles ppt, ConversionInfo convertInfo) {
            mRoom.putScenes("/static", ppt.getScenes(), 0);
            mRoom.setScenePath("/static/1");
            logAction(convertInfo.toString());
        }

        @Override
        public void onProgress(Double progress, ConversionInfo convertInfo) {
            logAction(String.valueOf(progress));
        }
    });
    // ConvertV5
    ConverterV5.Builder builder = new ConverterV5.Builder();
    ConverterV5 converter = builder.setResource("https://white-cn-edge-doc-convert.oss-cn-hangzhou.aliyuncs.com/LightWaves.pdf").setType(ConvertType.Static).setScale(1.5).setOutputFormat(ImageFormat.JPEG).setSdkToken(demoAPI.getSdkToken()).setTaskUuid(null).setTaskToken(null).setCallback(new ConverterCallbacks() {

        @Override
        public void onProgress(Double progress, ConversionInfo convertInfo) {
        }

        @Override
        public void onFinish(ConvertedFiles ppt, ConversionInfo convertInfo) {
        }

        @Override
        public void onFailure(ConvertException e) {
        }
    }).build();
    converter.startConvertTask();
}
Also used : ConvertException(com.herewhite.sdk.domain.ConvertException) MapBuilder(com.herewhite.demo.utils.MapBuilder) Converter(com.herewhite.sdk.Converter) ConverterCallbacks(com.herewhite.sdk.ConverterCallbacks) ConvertedFiles(com.herewhite.sdk.domain.ConvertedFiles) ConversionInfo(com.herewhite.sdk.domain.ConversionInfo) ConverterV5(com.herewhite.sdk.converter.ConverterV5)

Aggregations

Converter (com.herewhite.sdk.Converter)4 ConverterCallbacks (com.herewhite.sdk.ConverterCallbacks)4 ConversionInfo (com.herewhite.sdk.domain.ConversionInfo)4 ConvertException (com.herewhite.sdk.domain.ConvertException)4 ConvertedFiles (com.herewhite.sdk.domain.ConvertedFiles)4 MapBuilder (com.herewhite.demo.utils.MapBuilder)2 ConverterV5 (com.herewhite.sdk.converter.ConverterV5)2