Search in sources :

Example 1 with AsyncImageManager

use of com.aviary.android.feather.async_tasks.AsyncImageManager in project mobile-android by photo.

the class StickersPanel method onCreate.

@SuppressWarnings("deprecation")
@Override
public void onCreate(Bitmap bitmap) {
    super.onCreate(bitmap);
    mStatus = new SimpleStatusMachine();
    // determine if the external packs are enabled
    mExternalPacksEnabled = Constants.getExternalStickersEnabled();
    // init layout components
    mListPacks = (HorizontalVariableListView) getOptionView().findViewById(R.id.list_packs);
    mListStickers = (HorizontalVariableListView) getOptionView().findViewById(R.id.list_stickers);
    mViewFlipper = (ViewFlipper) getOptionView().findViewById(R.id.flipper);
    mImageView = (ImageViewDrawableOverlay) getContentView().findViewById(R.id.overlay);
    // init services
    mPluginService = getContext().getService(PluginService.class);
    mConfigService = getContext().getService(ConfigService.class);
    mPreferenceService = getContext().getService(PreferenceService.class);
    mCacheService = getContext().getService(ImageCacheService.class);
    // TODO: only for testing
    // mCacheService.deleteCache();
    // setup the main horizontal listview
    mListPacks.setGravity(Gravity.BOTTOM);
    mListPacks.setOverScrollMode(View.OVER_SCROLL_ALWAYS);
    mListPacks.setEdgeGravityY(Gravity.BOTTOM);
    // setup the stickers listview
    mListStickers.setGravity(Gravity.BOTTOM);
    mListStickers.setOverScrollMode(View.OVER_SCROLL_ALWAYS);
    mListStickers.setEdgeGravityY(Gravity.BOTTOM);
    // setup the main imageview
    ((ImageViewDrawableOverlay) mImageView).setForceSingleSelection(false);
    ((ImageViewDrawableOverlay) mImageView).setDropTargetListener(this);
    ((ImageViewDrawableOverlay) mImageView).setScaleWithContent(true);
    // create the default action list
    mActionList = MoaActionFactory.actionList();
    // load the configuration for the sticker drawable
    mStickerHvEllipse = mConfigService.getInteger(R.integer.feather_sticker_highlight_ellipse);
    mStickerHvStrokeWidth = mConfigService.getInteger(R.integer.feather_sticker_highlight_stroke_width);
    mStickerHvStrokeColorStateList = mConfigService.getColorStateList(R.color.feather_sticker_color_stroke_selector);
    mStickerHvFillColorStateList = mConfigService.getColorStateList(R.color.feather_sticker_color_fill_selector);
    mStickerHvMinSize = mConfigService.getInteger(R.integer.feather_sticker_highlight_minsize);
    mStickerHvPadding = mConfigService.getInteger(R.integer.feather_sticker_highlight_padding);
    mFeaturedCount = mConfigService.getInteger(R.integer.feather_featured_count);
    mFeaturedDefaultTitle = mConfigService.getString(R.string.feather_featured);
    // update the background drawable
    View content = getOptionView().findViewById(R.id.background);
    content.setBackgroundDrawable(RepeatableHorizontalDrawable.createFromView(content));
    mImageManager = new AsyncImageManager();
    // create the preview for the main imageview
    createAndConfigurePreview();
    if (android.os.Build.VERSION.SDK_INT > 8) {
        DragControllerService dragger = getContext().getService(DragControllerService.class);
        dragger.addDropTarget((DropTarget) mImageView);
        dragger.setMoveTarget(mImageView);
        dragger.setDragListener(this);
        // TODO: remember to activate this!
        // dragger.activate();
        setDragController(dragger);
    }
}
Also used : ImageViewDrawableOverlay(com.aviary.android.feather.widget.ImageViewDrawableOverlay) DragControllerService(com.aviary.android.feather.library.services.DragControllerService) ConfigService(com.aviary.android.feather.library.services.ConfigService) PreferenceService(com.aviary.android.feather.library.services.PreferenceService) PluginService(com.aviary.android.feather.library.services.PluginService) ImageCacheService(com.aviary.android.feather.library.services.ImageCacheService) AsyncImageManager(com.aviary.android.feather.async_tasks.AsyncImageManager) ImageView(android.widget.ImageView) DragView(com.aviary.android.feather.library.services.drag.DragView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) DrawableHighlightView(com.aviary.android.feather.widget.DrawableHighlightView) HorizontalVariableListView(com.aviary.android.feather.widget.HorizontalVariableListView)

Example 2 with AsyncImageManager

use of com.aviary.android.feather.async_tasks.AsyncImageManager in project mobile-android by photo.

the class BordersPanel method onCreate.

@SuppressWarnings("deprecation")
@Override
public void onCreate(Bitmap bitmap) {
    super.onCreate(bitmap);
    mImageManager = new AsyncImageManager(1);
    mThumbnailOptions = new Options();
    mThumbnailOptions.inPreferredConfig = Config.RGB_565;
    mPluginService = getContext().getService(PluginService.class);
    mCacheService = getContext().getService(ImageCacheService.class);
    mPreferenceService = getContext().getService(PreferenceService.class);
    if (mPluginType == FeatherIntent.PluginType.TYPE_FILTER)
        mExternalPacksEnabled = Constants.getValueFromIntent(Constants.EXTRA_EFFECTS_ENABLE_EXTERNAL_PACKS, true);
    else
        mExternalPacksEnabled = Constants.getValueFromIntent(Constants.EXTRA_FRAMES_ENABLE_EXTERNAL_PACKS, true);
    mViewFlipper = (ViewFlipper) getOptionView().findViewById(R.id.flipper);
    mHList = (HorizontalVariableListView) getOptionView().findViewById(R.id.list);
    mHList.setOverScrollMode(View.OVER_SCROLL_ALWAYS);
    mPreview = BitmapUtils.copy(mBitmap, Bitmap.Config.ARGB_8888);
    // ImageView Switcher setup
    mImageSwitcher = (ImageSwitcher) getContentView().findViewById(R.id.switcher);
    initContentImage(mImageSwitcher);
    // Horizontal list setup
    mHList.setOnScrollListener(this);
    View content = getOptionView().findViewById(R.id.background);
    content.setBackgroundDrawable(RepeatableHorizontalDrawable.createFromView(content));
    try {
        updateArrowBitmap = BitmapFactory.decodeResource(getContext().getBaseContext().getResources(), R.drawable.feather_update_arrow);
    } catch (Throwable t) {
    }
    mEnableEffectAnimation = Constants.ANDROID_SDK > android.os.Build.VERSION_CODES.GINGERBREAD && SystemUtils.getCpuMhz() > 800;
// mSelectedPosition = 0;
}
Also used : Options(android.graphics.BitmapFactory.Options) PreferenceService(com.aviary.android.feather.library.services.PreferenceService) PluginService(com.aviary.android.feather.library.services.PluginService) ImageCacheService(com.aviary.android.feather.library.services.ImageCacheService) AsyncImageManager(com.aviary.android.feather.async_tasks.AsyncImageManager) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) HorizontalVariableListView(com.aviary.android.feather.widget.HorizontalVariableListView)

Aggregations

View (android.view.View)2 AdapterView (android.widget.AdapterView)2 ImageView (android.widget.ImageView)2 TextView (android.widget.TextView)2 AsyncImageManager (com.aviary.android.feather.async_tasks.AsyncImageManager)2 ImageCacheService (com.aviary.android.feather.library.services.ImageCacheService)2 PluginService (com.aviary.android.feather.library.services.PluginService)2 PreferenceService (com.aviary.android.feather.library.services.PreferenceService)2 HorizontalVariableListView (com.aviary.android.feather.widget.HorizontalVariableListView)2 Options (android.graphics.BitmapFactory.Options)1 ConfigService (com.aviary.android.feather.library.services.ConfigService)1 DragControllerService (com.aviary.android.feather.library.services.DragControllerService)1 DragView (com.aviary.android.feather.library.services.drag.DragView)1 DrawableHighlightView (com.aviary.android.feather.widget.DrawableHighlightView)1 ImageViewDrawableOverlay (com.aviary.android.feather.widget.ImageViewDrawableOverlay)1