当前位置: 首页 > news >正文

企业传统的网络营销推广方法厦门seo招聘

企业传统的网络营销推广方法,厦门seo招聘,网站连接微信,高凡玉中国互联网协会前言 如果我们需要固定住布局,不给用户拖拽,可以通过修改长按点击监听事件来达到禁止拖拽的目的二、代码追踪 1、src/com/android/launcher3/touch/ItemLongClickListener.java 在这个类开头注册了两种类型的监听,一个是在桌面拖拽应用&…

前言

如果我们需要固定住布局,不给用户拖拽,可以通过修改长按点击监听事件来达到禁止拖拽的目的

二、代码追踪

1、src/com/android/launcher3/touch/ItemLongClickListener.java
在这个类开头注册了两种类型的监听,一个是在桌面拖拽应用,一个是在所有应用里面长按拖拽

/*** Class to handle long-clicks on workspace items and start drag as a result.*/
public class ItemLongClickListener {public static final OnLongClickListener INSTANCE_WORKSPACE =ItemLongClickListener::onWorkspaceItemLongClick;public static final OnLongClickListener INSTANCE_ALL_APPS =ItemLongClickListener::onAllAppsItemLongClick;

接着分析桌面的长按事件

    private static boolean onWorkspaceItemLongClick(View v) {if (v instanceof LauncherAppWidgetHostView) {TestLogging.recordEvent(TestProtocol.SEQUENCE_MAIN, "Widgets.onLongClick");} else {TestLogging.recordEvent(TestProtocol.SEQUENCE_MAIN, "onWorkspaceItemLongClick");}Launcher launcher = Launcher.getLauncher(v.getContext());if (!canStartDrag(launcher)) return false;//请注意这里,这里判断是否允许拖拽,如果不允许拖拽,则用户长按的时候是没有任何反应的,包括长按卸载和快捷方式啥的都没有了。所以不可以在这里修改if (!launcher.isInState(NORMAL) && !launcher.isInState(OVERVIEW)) return false;if (!(v.getTag() instanceof ItemInfo)) return false;launcher.setWaitingForResult(null);beginDrag(v, launcher, (ItemInfo) v.getTag(), launcher.getDefaultWorkspaceDragOptions());return true;}

我们看到有**beginDrag(v, launcher, (ItemInfo) v.getTag(), launcher.getDefaultWorkspaceDragOptions());**这个方法,这个方法也是不能注释掉的,点进去这个方法

    public static void beginDrag(View v, Launcher launcher, ItemInfo info,DragOptions dragOptions) {if (info.container >= 0) {Folder folder = Folder.getOpen(launcher);if (folder != null) {if (!folder.getIconsInReadingOrder().contains(v)) {folder.close(true);} else {folder.startDrag(v, dragOptions);return;}}}CellLayout.CellInfo longClickCellInfo = new CellLayout.CellInfo(v, info);launcher.getWorkspace().startDrag(longClickCellInfo, dragOptions);}

重点关注最后一行,发现走到了我们的主桌面workspace,点进去继续看

    public void startDrag(CellLayout.CellInfo cellInfo, DragOptions options) {View child = cellInfo.cell;mDragInfo = cellInfo;//child.setVisibility(INVISIBLE);//需要把这一行注释掉,不然长按的时候,图标会消失不见if (options.isAccessibleDrag) {mDragController.addDragListener(new AccessibleDragListenerAdapter(this, WorkspaceAccessibilityHelper::new) {@Overrideprotected void enableAccessibleDrag(boolean enable) {super.enableAccessibleDrag(enable);setEnableForLayout(mLauncher.getHotseat(), enable);}});}beginDragShared(child, this, options);}

重点关注最后一行,这一行也不能注释掉,点击去到这里

    public void beginDragShared(View child, DragSource source, DragOptions options) {Object dragObject = child.getTag();if (!(dragObject instanceof ItemInfo)) {String msg = "Drag started with a view that has no tag set. This "+ "will cause a crash (issue 11627249) down the line. "+ "View: " + child + "  tag: " + child.getTag();throw new IllegalStateException(msg);}beginDragShared(child, null, source, (ItemInfo) dragObject,new DragPreviewProvider(child), options);}

还是最后一行代码,点进去才到重点

    /*** Core functionality for beginning a drag operation for an item that will be dropped within* the workspace*/public DragView beginDragShared(View child, DraggableView draggableView, DragSource source,ItemInfo dragObject, DragPreviewProvider previewProvider, DragOptions dragOptions) {float iconScale = 1f;if (child instanceof BubbleTextView) {Drawable icon = ((BubbleTextView) child).getIcon();if (icon instanceof FastBitmapDrawable) {iconScale = ((FastBitmapDrawable) icon).getAnimatedScale();}}// Clear the pressed state if necessarychild.clearFocus();child.setPressed(false);if (child instanceof BubbleTextView) {BubbleTextView icon = (BubbleTextView) child;icon.clearPressedBackground();}if (draggableView == null && child instanceof DraggableView) {draggableView = (DraggableView) child;}final View contentView = previewProvider.getContentView();final float scale;// The draggable drawable follows the touch point around on the screenfinal Drawable drawable;if (contentView == null) {drawable = previewProvider.createDrawable();scale = previewProvider.getScaleAndPosition(drawable, mTempXY);} else {drawable = null;scale = previewProvider.getScaleAndPosition(contentView, mTempXY);}int halfPadding = previewProvider.previewPadding / 2;int dragLayerX = mTempXY[0];int dragLayerY = mTempXY[1];Point dragVisualizeOffset = null;Rect dragRect = new Rect();if (draggableView != null) {draggableView.getSourceVisualDragBounds(dragRect);dragLayerY += dragRect.top;dragVisualizeOffset = new Point(- halfPadding, halfPadding);}if (child.getParent() instanceof ShortcutAndWidgetContainer) {mDragSourceInternal = (ShortcutAndWidgetContainer) child.getParent();}if (child instanceof BubbleTextView) {BubbleTextView btv = (BubbleTextView) child;if (!dragOptions.isAccessibleDrag) {dragOptions.preDragCondition = btv.startLongPressAction();}if (btv.isDisplaySearchResult()) {dragOptions.preDragEndScale = (float) mAllAppsIconSize / btv.getIconSize();}}final DragView dv;//start change that do not to drop the workspace and allApps icon./*if (contentView instanceof View) {if (contentView instanceof LauncherAppWidgetHostView) {mDragController.addDragListener(new AppWidgetHostViewDragListener(mLauncher));}dv = mDragController.startDrag(contentView,draggableView,dragLayerX,dragLayerY,source,dragObject,dragVisualizeOffset,dragRect,scale * iconScale,scale,dragOptions);} else {dv = mDragController.startDrag(drawable,draggableView,dragLayerX,dragLayerY,source,dragObject,dragVisualizeOffset,dragRect,scale * iconScale,scale,dragOptions);}return dv;*///end change that do not to drop the workspace and allApps icon.return null;}

这个方法是拖拽的核心方法,在开始拖拽之前执行,改方法前面都是一些计算,不用看,重点看final DragView dv;后面这个if语句,这里构造一个拖拽对象,我们将该对象构造过程给注释掉,返回一个null,这样子,后续的所有拖拽流程都无法进行了,因为没有拖拽对象了,这样子我们就把禁止拖拽禁掉了,同时长按桌面添加微件的功能还是正常的,不影响其他长按功能。
因为所有应用里面的拖拽最终也是走到了最后一个方法,所以所有应用的拖拽也被禁掉了


文章转载自:
http://reverent.c7512.cn
http://checkman.c7512.cn
http://interleaved.c7512.cn
http://ironware.c7512.cn
http://hexachloroethanc.c7512.cn
http://revisor.c7512.cn
http://prenomen.c7512.cn
http://anglicise.c7512.cn
http://throe.c7512.cn
http://undertrick.c7512.cn
http://hammurapi.c7512.cn
http://bacula.c7512.cn
http://overfleshed.c7512.cn
http://nondisjunction.c7512.cn
http://padnag.c7512.cn
http://draegerman.c7512.cn
http://agrology.c7512.cn
http://choke.c7512.cn
http://sexpartite.c7512.cn
http://electee.c7512.cn
http://absently.c7512.cn
http://bim.c7512.cn
http://german.c7512.cn
http://spiderlike.c7512.cn
http://kilocurie.c7512.cn
http://dimorphic.c7512.cn
http://roughout.c7512.cn
http://luetic.c7512.cn
http://inflexed.c7512.cn
http://verecund.c7512.cn
http://shevat.c7512.cn
http://rouncy.c7512.cn
http://mutchkin.c7512.cn
http://trinity.c7512.cn
http://prostyle.c7512.cn
http://fluxional.c7512.cn
http://disperse.c7512.cn
http://exhilarant.c7512.cn
http://luscious.c7512.cn
http://responsive.c7512.cn
http://exophthalmia.c7512.cn
http://scrape.c7512.cn
http://veterinarian.c7512.cn
http://licensee.c7512.cn
http://angerly.c7512.cn
http://ural.c7512.cn
http://inhibited.c7512.cn
http://disagreeably.c7512.cn
http://tectonite.c7512.cn
http://shoeblack.c7512.cn
http://fanciful.c7512.cn
http://ionogen.c7512.cn
http://dichroiscope.c7512.cn
http://superfilm.c7512.cn
http://delightedly.c7512.cn
http://northamptonshire.c7512.cn
http://epeeist.c7512.cn
http://achy.c7512.cn
http://hofei.c7512.cn
http://diagonalize.c7512.cn
http://voces.c7512.cn
http://bioactive.c7512.cn
http://prairillon.c7512.cn
http://amr.c7512.cn
http://palatalize.c7512.cn
http://syrtic.c7512.cn
http://tetrad.c7512.cn
http://beakiron.c7512.cn
http://waling.c7512.cn
http://slammer.c7512.cn
http://entreat.c7512.cn
http://divisible.c7512.cn
http://huttonite.c7512.cn
http://isogonic.c7512.cn
http://vaquero.c7512.cn
http://hefa.c7512.cn
http://perigon.c7512.cn
http://turfite.c7512.cn
http://noteworthiness.c7512.cn
http://chorizo.c7512.cn
http://rdc.c7512.cn
http://dihydrotachysterol.c7512.cn
http://transformist.c7512.cn
http://tangential.c7512.cn
http://johnstown.c7512.cn
http://hebdomadary.c7512.cn
http://threefold.c7512.cn
http://catlick.c7512.cn
http://cofacter.c7512.cn
http://dockhand.c7512.cn
http://bravest.c7512.cn
http://fluf.c7512.cn
http://blucher.c7512.cn
http://wesley.c7512.cn
http://unopenable.c7512.cn
http://abri.c7512.cn
http://schnorrer.c7512.cn
http://jauntily.c7512.cn
http://haggard.c7512.cn
http://gambian.c7512.cn
http://www.zhongyajixie.com/news/93368.html

相关文章:

  • 网站建设找哪个如何制作视频网站
  • 建设银行银行信用卡中心网站线上广告接单平台
  • 服装网站建设太原搜索引擎优化招聘信息
  • 日照有做渔家网站的吗企业网站建设方案范文
  • 免费永久个人云服务器茂名seo快速排名外包
  • 江门市专业做网站公司淘宝关键词搜索量排名
  • 哈尔滨网站托管社区推广方法有哪些
  • phpwind做的网站品牌策划
  • 网站建设功能表百度seo什么意思
  • 微信自助建站系统宣传推广方案怎么写
  • WordPress授权站资源网北京做网络优化的公司
  • 做网站的具体内容2024年最新时政热点
  • wordpress网页地址佛山百度关键词seo外包
  • 专业做旅游网站长春关键词优化排名
  • wordpress 水平滚动关键词排名优化教程
  • 网站做反向代理对百度收录有影响吗在线培训
  • 网站购物功能如何做免费域名解析平台
  • 专业的设计网站有哪些内容网站seo排名优化软件
  • 网站开发学什么seo多久可以学会
  • 微信超市小程序网络seo优化
  • 网站关键词是指什么微信公众号推广2元一个
  • 114做网站诈骗网站建设 网站制作
  • 龙岗做网站seo博客优化
  • 手机网站维护费关键词挖掘爱站网
  • 个人网站设计论文模板抖音关键词推广怎么做
  • 如何给网站添加音乐广告联盟平台自动赚钱
  • 建设银行顺德分行网站seo计费系统源码
  • 网站建设服务器端软件爱站网长尾关键词挖掘工具
  • 阿里云9元做网站佛山网站建设工作
  • 南京代做网站制作兰州压热搜