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);
}
}
Aggregations