Пример #1
0
  @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()) {
      // panel is changed, restore the original bitmap

      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);
  }
Пример #2
0
  @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);
    }
  }