use of com.aviary.android.feather.effects.AbstractEffectPanel.ContentPanel in project mobile-android by photo.
the class FilterManager method cancel.
@Override
public void cancel() {
logger.info("FilterManager::cancel");
if (!getEnabled() || !isOpened())
return;
if (mCurrentEffect == null)
throw new IllegalStateException("there is no current effect active in the context");
Tracker.recordTag(mCurrentEntry.name.name().toLowerCase(Locale.US) + ": cancelled");
// send the cancel event to the effect
mCurrentEffect.onCancelled();
// check changed image
if (mCurrentEffect.getIsChanged()) {
if (mCurrentEffect instanceof ContentPanel) {
ContentPanel panel = (ContentPanel) mCurrentEffect;
setNextBitmap(mBitmap, true, panel.getContentDisplayMatrix());
} else {
setNextBitmap(mBitmap, false);
}
} else {
// panel is not changed
if (mCurrentEffect instanceof ContentPanel) {
ContentPanel panel = (ContentPanel) mCurrentEffect;
setNextBitmap(mBitmap, true, panel.getContentDisplayMatrix());
} else {
setNextBitmap(mBitmap, false);
}
}
onClose(false);
}
use of com.aviary.android.feather.effects.AbstractEffectPanel.ContentPanel in project mobile-android by photo.
the class FilterManager method onComplete.
/*
* (non-Javadoc)
*
* @see com.aviary.android.feather.effects.AbstractEffectPanel.OnApplyResultListener#onComplete(android.graphics.Bitmap,
* java.util.HashMap)
*/
@Override
public void onComplete(final Bitmap result, MoaActionList actions, HashMap<String, String> trackingAttributes) {
logger.info("onComplete: " + android.os.Debug.getNativeHeapAllocatedSize());
Tracker.recordTag(mCurrentEntry.name.name().toLowerCase(Locale.US) + ": applied", trackingAttributes);
if (result != null) {
if (mCurrentEffect instanceof ContentPanel) {
ContentPanel panel = (ContentPanel) mCurrentEffect;
final boolean changed = BitmapUtils.compareBySize(mBitmap, result);
setNextBitmap(result, true, changed ? null : panel.getContentDisplayMatrix());
} else {
setNextBitmap(result, false);
}
} else {
logger.error("Error: returned bitmap is null!");
setNextBitmap(mBitmap, true);
}
onClose(true);
if (mHiResEnabled) {
// send the actions...
if (null == actions)
logger.error("WTF actionlist is null!!!!");
HiResService service = getService(HiResService.class);
if (service.isRunning()) {
service.execute(mSessionId, mApiKey, actions);
}
}
if (null != mHiResListener) {
mHiResListener.OnApplyActions(actions);
}
}
use of com.aviary.android.feather.effects.AbstractEffectPanel.ContentPanel in project mobile-android by photo.
the class FilterManager method prepareEffectPanel.
/**
* Prepare effect panel.
*
* @param effect
* the effect
* @param entry
* the entry
*/
private void prepareEffectPanel(final AbstractEffectPanel effect, final EffectEntry entry) {
View option_child = null;
View drawing_child = null;
if (effect instanceof OptionPanel) {
option_child = ((OptionPanel) effect).getOptionView(UIUtils.getLayoutInflater(), mContext.getOptionsPanelContainer());
mContext.getOptionsPanelContainer().addView(option_child);
}
if (effect instanceof ContentPanel) {
drawing_child = ((ContentPanel) effect).getContentView(UIUtils.getLayoutInflater());
drawing_child.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
mContext.getDrawingImageContainer().addView(drawing_child);
}
effect.onCreate(mBitmap);
}
Aggregations