Search in sources :

Example 1 with HiResService

use of com.aviary.android.feather.library.services.HiResService 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);
    }
}
Also used : HiResService(com.aviary.android.feather.library.services.HiResService) ContentPanel(com.aviary.android.feather.effects.AbstractEffectPanel.ContentPanel)

Example 2 with HiResService

use of com.aviary.android.feather.library.services.HiResService in project mobile-android by photo.

the class FilterManager method initHiResService.

private void initHiResService() {
    logger.info("initHiResService");
    LocalDataService dataService = getService(LocalDataService.class);
    if (Constants.containsValue(Constants.EXTRA_OUTPUT_HIRES_SESSION_ID)) {
        mSessionId = Constants.getValueFromIntent(Constants.EXTRA_OUTPUT_HIRES_SESSION_ID, "");
        logger.info("session-id: " + mSessionId + ", length: " + mSessionId.length());
        if (mSessionId != null && mSessionId.length() == 64) {
            mHiResEnabled = true;
            HiResService service = getService(HiResService.class);
            if (!service.isRunning()) {
                service.start();
            }
            service.load(mSessionId, mApiKey, dataService.getSourceImageUri());
        } else {
            logger.error("session id is invalid");
        }
    } else {
        logger.warning("missing session id");
    }
    if (null != mHiResListener) {
        mHiResListener.OnLoad(dataService.getSourceImageUri());
    }
}
Also used : LocalDataService(com.aviary.android.feather.library.services.LocalDataService) HiResService(com.aviary.android.feather.library.services.HiResService)

Example 3 with HiResService

use of com.aviary.android.feather.library.services.HiResService in project mobile-android by photo.

the class FilterManager method onReplaceImage.

/**
	 * Replace the current bitmap.
	 * 
	 * @param bitmap
	 *           the bitmap
	 */
public void onReplaceImage(final Bitmap bitmap, int[] originalSize) {
    if (!getEnabled() || !isClosed())
        throw new IllegalStateException("Cannot replace bitmap. Not active nor closed!");
    LocalDataService dataService = getService(LocalDataService.class);
    if ((mBitmap != null) && !mBitmap.isRecycled()) {
        logger.warning("[recycle] original Bitmap: " + mBitmap);
        mBitmap.recycle();
        mBitmap = null;
    }
    mChanged = false;
    mBitmap = bitmap;
    dataService.setSourceImageSize(originalSize);
    HiResService service = getService(HiResService.class);
    if (mHiResEnabled && service.isRunning()) {
        service.replace(mSessionId, mApiKey, dataService.getSourceImageUri());
    }
    if (null != mHiResListener) {
        mHiResListener.OnLoad(dataService.getSourceImageUri());
    }
}
Also used : LocalDataService(com.aviary.android.feather.library.services.LocalDataService) HiResService(com.aviary.android.feather.library.services.HiResService)

Aggregations

HiResService (com.aviary.android.feather.library.services.HiResService)3 LocalDataService (com.aviary.android.feather.library.services.LocalDataService)2 ContentPanel (com.aviary.android.feather.effects.AbstractEffectPanel.ContentPanel)1