use of com.android.layoutlib.bridge.impl.RenderSessionImpl in project android_frameworks_base by ResurrectionRemix.
the class Bridge method createSession.
/**
* Starts a layout session by inflating and rendering it. The method returns a
* {@link RenderSession} on which further actions can be taken.
* <p/>
* If {@link SessionParams} includes the {@link RenderParamsFlags#FLAG_DO_NOT_RENDER_ON_CREATE},
* this method will only inflate the layout but will NOT render it.
* @param params the {@link SessionParams} object with all the information necessary to create
* the scene.
* @return a new {@link RenderSession} object that contains the result of the layout.
* @since 5
*/
@Override
public RenderSession createSession(SessionParams params) {
try {
Result lastResult = SUCCESS.createResult();
RenderSessionImpl scene = new RenderSessionImpl(params);
try {
prepareThread();
lastResult = scene.init(params.getTimeout());
if (lastResult.isSuccess()) {
lastResult = scene.inflate();
boolean doNotRenderOnCreate = Boolean.TRUE.equals(params.getFlag(RenderParamsFlags.FLAG_DO_NOT_RENDER_ON_CREATE));
if (lastResult.isSuccess() && !doNotRenderOnCreate) {
lastResult = scene.render(true);
}
}
} finally {
scene.release();
cleanupThread();
}
return new BridgeRenderSession(scene, lastResult);
} catch (Throwable t) {
// get the real cause of the exception.
Throwable t2 = t;
while (t2.getCause() != null) {
t2 = t.getCause();
}
return new BridgeRenderSession(null, ERROR_UNKNOWN.createResult(t2.getMessage(), t));
}
}
use of com.android.layoutlib.bridge.impl.RenderSessionImpl in project android_frameworks_base by DirtyUnicorns.
the class Bridge method createSession.
/**
* Starts a layout session by inflating and rendering it. The method returns a
* {@link RenderSession} on which further actions can be taken.
* <p/>
* If {@link SessionParams} includes the {@link RenderParamsFlags#FLAG_DO_NOT_RENDER_ON_CREATE},
* this method will only inflate the layout but will NOT render it.
* @param params the {@link SessionParams} object with all the information necessary to create
* the scene.
* @return a new {@link RenderSession} object that contains the result of the layout.
* @since 5
*/
@Override
public RenderSession createSession(SessionParams params) {
try {
Result lastResult = SUCCESS.createResult();
RenderSessionImpl scene = new RenderSessionImpl(params);
try {
prepareThread();
lastResult = scene.init(params.getTimeout());
if (lastResult.isSuccess()) {
lastResult = scene.inflate();
boolean doNotRenderOnCreate = Boolean.TRUE.equals(params.getFlag(RenderParamsFlags.FLAG_DO_NOT_RENDER_ON_CREATE));
if (lastResult.isSuccess() && !doNotRenderOnCreate) {
lastResult = scene.render(true);
}
}
} finally {
scene.release();
cleanupThread();
}
return new BridgeRenderSession(scene, lastResult);
} catch (Throwable t) {
// get the real cause of the exception.
Throwable t2 = t;
while (t2.getCause() != null) {
t2 = t.getCause();
}
return new BridgeRenderSession(null, ERROR_UNKNOWN.createResult(t2.getMessage(), t));
}
}
use of com.android.layoutlib.bridge.impl.RenderSessionImpl in project platform_frameworks_base by android.
the class Bridge method createSession.
/**
* Starts a layout session by inflating and rendering it. The method returns a
* {@link RenderSession} on which further actions can be taken.
* <p/>
* If {@link SessionParams} includes the {@link RenderParamsFlags#FLAG_DO_NOT_RENDER_ON_CREATE},
* this method will only inflate the layout but will NOT render it.
* @param params the {@link SessionParams} object with all the information necessary to create
* the scene.
* @return a new {@link RenderSession} object that contains the result of the layout.
* @since 5
*/
@Override
public RenderSession createSession(SessionParams params) {
try {
Result lastResult = SUCCESS.createResult();
RenderSessionImpl scene = new RenderSessionImpl(params);
try {
prepareThread();
lastResult = scene.init(params.getTimeout());
if (lastResult.isSuccess()) {
lastResult = scene.inflate();
boolean doNotRenderOnCreate = Boolean.TRUE.equals(params.getFlag(RenderParamsFlags.FLAG_DO_NOT_RENDER_ON_CREATE));
if (lastResult.isSuccess() && !doNotRenderOnCreate) {
lastResult = scene.render(true);
}
}
} finally {
scene.release();
cleanupThread();
}
return new BridgeRenderSession(scene, lastResult);
} catch (Throwable t) {
// get the real cause of the exception.
Throwable t2 = t;
while (t2.getCause() != null) {
t2 = t.getCause();
}
return new BridgeRenderSession(null, ERROR_UNKNOWN.createResult(t2.getMessage(), t));
}
}
use of com.android.layoutlib.bridge.impl.RenderSessionImpl in project android_frameworks_base by ParanoidAndroid.
the class Bridge method createSession.
/**
* Starts a layout session by inflating and rendering it. The method returns a
* {@link RenderSession} on which further actions can be taken.
*
* @param params the {@link SessionParams} object with all the information necessary to create
* the scene.
* @return a new {@link RenderSession} object that contains the result of the layout.
* @since 5
*/
@Override
public RenderSession createSession(SessionParams params) {
try {
Result lastResult = SUCCESS.createResult();
RenderSessionImpl scene = new RenderSessionImpl(params);
try {
prepareThread();
lastResult = scene.init(params.getTimeout());
if (lastResult.isSuccess()) {
lastResult = scene.inflate();
if (lastResult.isSuccess()) {
lastResult = scene.render(true);
}
}
} finally {
scene.release();
cleanupThread();
}
return new BridgeRenderSession(scene, lastResult);
} catch (Throwable t) {
// get the real cause of the exception.
Throwable t2 = t;
while (t2.getCause() != null) {
t2 = t.getCause();
}
return new BridgeRenderSession(null, ERROR_UNKNOWN.createResult(t2.getMessage(), t));
}
}
use of com.android.layoutlib.bridge.impl.RenderSessionImpl in project android_frameworks_base by AOSPA.
the class Bridge method createSession.
/**
* Starts a layout session by inflating and rendering it. The method returns a
* {@link RenderSession} on which further actions can be taken.
* <p/>
* If {@link SessionParams} includes the {@link RenderParamsFlags#FLAG_DO_NOT_RENDER_ON_CREATE},
* this method will only inflate the layout but will NOT render it.
* @param params the {@link SessionParams} object with all the information necessary to create
* the scene.
* @return a new {@link RenderSession} object that contains the result of the layout.
* @since 5
*/
@Override
public RenderSession createSession(SessionParams params) {
try {
Result lastResult = SUCCESS.createResult();
RenderSessionImpl scene = new RenderSessionImpl(params);
try {
prepareThread();
lastResult = scene.init(params.getTimeout());
if (lastResult.isSuccess()) {
lastResult = scene.inflate();
boolean doNotRenderOnCreate = Boolean.TRUE.equals(params.getFlag(RenderParamsFlags.FLAG_DO_NOT_RENDER_ON_CREATE));
if (lastResult.isSuccess() && !doNotRenderOnCreate) {
lastResult = scene.render(true);
}
}
} finally {
scene.release();
cleanupThread();
}
return new BridgeRenderSession(scene, lastResult);
} catch (Throwable t) {
// get the real cause of the exception.
Throwable t2 = t;
while (t2.getCause() != null) {
t2 = t.getCause();
}
return new BridgeRenderSession(null, ERROR_UNKNOWN.createResult(t2.getMessage(), t));
}
}
Aggregations