use of com.herewhite.sdk.domain.Scene in project whiteboard-android by netless-io.
the class Room method getScenes.
/**
* 获取房间当前场景组下的场景列表。
*
* @note
* - 该方法为异步调用。
* - 调用以下方法修改或新增场景后,可以调用 {@link #getScenes(Promise<Scene[]> promise) getScenes},立即获取最新的场景列表。
* - {@link #setScenePath(String path) setScenePath}[1/2]
* - {@link #setScenePath(String path, Promise<Boolean> promise) setScenePath}[2/2]
* - {@link #putScenes(String, Scene[], int) putScenes}
*
* @param promise `Promise<Scene[]>` 接口实例,详见 {@link com.herewhite.sdk.domain.Promise Promise}。你可以通过该接口获取 `getScenes` 的调用结果:
* - 如果方法调用成功,则返回场景列表,详见 {@link com.herewhite.sdk.domain.Scene Scene}。
* - 如果方法调用失败,则返回错误信息。
*/
public void getScenes(final Promise<Scene[]> promise) {
bridge.callHandler("room.getScenes", new Object[] {}, new OnReturnValue<Object>() {
@Override
public void onValue(Object o) {
try {
promise.then(gson.fromJson(String.valueOf(o), Scene[].class));
} catch (AssertionError a) {
throw a;
} catch (JsonSyntaxException e) {
Logger.error("An JsonSyntaxException occurred while parse json from getScenes", e);
promise.catchEx(new SDKError(e.getMessage()));
} catch (Throwable e) {
Logger.error("An exception occurred in getScenes promise then method", e);
promise.catchEx(new SDKError(e.getMessage()));
}
}
});
}
use of com.herewhite.sdk.domain.Scene in project whiteboard-android by netless-io.
the class PptResourceCacheActivity method insertNewScene.
public void insertNewScene(MenuItem item) {
logAction();
mRoom.putScenes(SCENE_DIR, new Scene[] { new Scene("page1") }, 0);
mRoom.setScenePath(SCENE_DIR + "/page1");
}
use of com.herewhite.sdk.domain.Scene in project whiteboard-android by netless-io.
the class RoomActivity method insertPPT.
public void insertPPT(MenuItem item) {
logAction();
mRoom.putScenes(SCENE_DIR, new Scene[] { new Scene("page2", new PptPage("https://white-pan.oss-cn-shanghai.aliyuncs.com/101/image/alin-rusu-1239275-unsplash_opt.jpg", 600d, 600d)) }, 0);
mRoom.setScenePath(SCENE_DIR + "/page2");
}
use of com.herewhite.sdk.domain.Scene in project whiteboard-android by netless-io.
the class RoomActivityTest method moveScene.
@Test
public void moveScene() {
onIdle();
SceneStateRecover recover = new SceneStateRecover(mActivity.mRoom.getSceneState());
CountDownLatch latch = new CountDownLatch(2);
onIdle((Callable<Void>) () -> {
mActivity.mRoom.putScenes(PUT_TEST_DIR, new Scene[] { new Scene(PUT_TEST_PAGE) }, 0);
mActivity.mRoom.setScenePath(PUT_TEST_PATH, new SimpleLatchDownPromise<>(latch));
mActivity.mRoom.moveScene(PUT_TEST_PATH, PUT_TEST_PATH_TARGET);
mActivity.mRoom.getSceneState(new SimpleLatchDownPromise<>(latch));
return null;
});
try {
latch.await();
} catch (InterruptedException e) {
fail();
}
onIdle((Callable<Void>) () -> {
assertEquals(PUT_TEST_PATH_TARGET, mActivity.mRoom.getSceneState().getScenePath());
mActivity.mRoom.removeScenes(PUT_TEST_DIR);
return null;
});
recover.restore();
}
use of com.herewhite.sdk.domain.Scene in project whiteboard-android by netless-io.
the class Converter method getPpt.
private ConvertedFiles getPpt(ConversionInfo info, ConvertType type) {
int fileLength = info.getConvertedFileList().length;
String[] sliderURLs = new String[fileLength];
Scene[] scenes = new Scene[fileLength];
ConvertedFiles files = new ConvertedFiles();
files.setTaskId(taskId);
files.setType(convertType(type));
for (int i = 0; i < fileLength; i++) {
PptPage pptPage = info.getConvertedFileList()[i];
pptPage.setSrc(info.getPrefix() + pptPage.getSrc());
sliderURLs[i] = pptPage.getSrc();
scenes[i] = new Scene(String.valueOf(i + 1), pptPage);
}
files.setSlideURLs(sliderURLs);
files.setScenes(scenes);
return files;
}
Aggregations