Search in sources :

Example 1 with DragControllerService

use of com.aviary.android.feather.library.services.DragControllerService 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)

Aggregations

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