• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java OnDragListener类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中android.view.View.OnDragListener的典型用法代码示例。如果您正苦于以下问题:Java OnDragListener类的具体用法?Java OnDragListener怎么用?Java OnDragListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



OnDragListener类属于android.view.View包,在下文中一共展示了OnDragListener类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: FolderToggleAdapter

import android.view.View.OnDragListener; //导入依赖的package包/类
public FolderToggleAdapter(Context context, SettingsDecoder settingDecoder, int labelColor, OnDragListener dragListener) {
	super(context, R.layout.folder_item, android.R.id.text1);

	mContext = context;
	mShowLabels = !settingDecoder.hasValue(FolderUtils.KEY_HIDE_LABEL);
	mLabelColor = labelColor;
	mInflator = LayoutInflater.from(context);
	mDragListener = dragListener;
	mRenderSettings = new WidgetSetting(context, new AbstractTracker[]{}, settingDecoder, -420, new Bitmap[]{});
	mShortNames = context.getResources().getStringArray(R.array.tracker_names_short);
	mStates = context.getResources().getStringArray(R.array.tracker_states);
}
 
开发者ID:sunnygoyal,项目名称:PowerToggles,代码行数:13,代码来源:FolderToggleAdapter.java


示例2: onDrag

import android.view.View.OnDragListener; //导入依赖的package包/类
public Disposable onDrag(final OnDragListener onNext, final Consumer<? super Exception> onError, final Runnable onComplete) {
    N.requireNonNull(onNext, "onNext");
    N.requireNonNull(onError, "onError");
    N.requireNonNull(onComplete, "onComplete");

    dispatcher.append(new DispatcherBase<Object>(onError, onComplete) {
        @Override
        public void onNext(Object param) {
            final Tuple2<View, DragEvent> tmp = (Tuple2<View, DragEvent>) param;

            if (Fu.isUiThread()) {
                onNext.onDrag(tmp._1, tmp._2);
            } else {
                UIExecutor.execute(new Runnable() {
                    @Override
                    public void run() {
                        onNext.onDrag(tmp._1, tmp._2);
                    }
                });
            }
        }
    });

    _view.setOnDragListener(new OnDragListener() {
        @Override
        public boolean onDrag(View view, DragEvent dragEvent) {
            dispatcher.onNext(Tuple.of(view, dragEvent));
            return true;
        }
    });

    disposeActions.add(new Runnable() {
        @Override
        public void run() {
            _view.setOnDragListener(null);
        }
    });

    return this;
}
 
开发者ID:landawn,项目名称:AbacusUtil,代码行数:41,代码来源:Observer.java


示例3: a

import android.view.View.OnDragListener; //导入依赖的package包/类
private final void a(View.OnDragListener paramOnDragListener)
{
  this.a.setOnDragListener(paramOnDragListener);
  for (int j = 0; j < this.a.getChildCount(); j++) {
    a(this.a.getChildAt(j), paramOnDragListener);
  }
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:8,代码来源:lca.java


示例4: setOnDragListener

import android.view.View.OnDragListener; //导入依赖的package包/类
/**
* @see View#setOnDragListener(OnDragListener)
*/
 public W setOnDragListener(OnDragListener l) {
     mView.setOnDragListener(l);
     return (W)this;
 }
 
开发者ID:AnthZh,项目名称:AndroidViewHelper,代码行数:8,代码来源:ViewWrapper.java


示例5: getView

import android.view.View.OnDragListener; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        int type = getItemViewType(position);
        convertView = createView(parent, type);

        convertView.setOnDragListener(new OnDragListener() {
            @Override
            @SuppressWarnings("unchecked")
            //unavoidable generic type problems -> Reference<View>
            public boolean onDrag(View dstView, DragEvent event) {
                Reference<View> ref = (Reference<View>) event.getLocalState();
                final View srcView = ref.reference;

                switch (event.getAction()) {
                case DragEvent.ACTION_DRAG_ENTERED:
                    srcView.setVisibility(View.VISIBLE);
                    dstView.setVisibility(View.INVISIBLE);

                    move(((Integer) srcView.getTag(R.id.reorder_key)),
                         ((Integer) dstView.getTag(R.id.reorder_key)));
                    ref.reference = dstView;
                    break;

                case DragEvent.ACTION_DRAG_ENDED:
                    srcView.post(new Runnable() {
                        @Override
                        public void run() {
                            srcView.setVisibility(View.VISIBLE);
                        }
                    });
                    break;
                }

                return true;
            }
        });

        convertView.setOnLongClickListener(new OnLongClickListener() {
            @Override
            public boolean onLongClick(final View view) {
                // Force a reset of any states
                notifyDataSetChanged();

                // Start the drag on the main loop to allow
                // the above state reset to settle.
                view.post(new Runnable() {
                    @Override
                    @SuppressWarnings("deprecation")
                    //startDrag() --> suppress deprecation because startDragAndDrop() requires minSdkVersion 24
                    public void run() {
                        ClipData data = ClipData.newPlainText("", "");
                        DragShadowBuilder sb = new View.DragShadowBuilder(view);
                        view.startDrag(data, sb, new Reference<>(view), 0);
                    }
                });

                return true;
            }
        });
    }

    convertView.setTag(R.id.reorder_key, position);
    bindView(convertView, position);
    return convertView;
}
 
开发者ID:freeotp,项目名称:freeotp-android,代码行数:67,代码来源:BaseReorderableAdapter.java


示例6: getView

import android.view.View.OnDragListener; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        int type = getItemViewType(position);
        convertView = createView(parent, type);

        convertView.setOnDragListener(new OnDragListener() {
            @Override
            public boolean onDrag(View dstView, DragEvent event) {
                Reference<View> ref = (Reference<View>) event.getLocalState();
                final View srcView = ref.reference;

                switch (event.getAction()) {
                case DragEvent.ACTION_DRAG_ENTERED:
                    srcView.setVisibility(View.VISIBLE);
                    dstView.setVisibility(View.INVISIBLE);

                    move(((Integer) srcView.getTag(R.id.reorder_key)).intValue(),
                         ((Integer) dstView.getTag(R.id.reorder_key)).intValue());
                    ref.reference = dstView;
                    break;

                case DragEvent.ACTION_DRAG_ENDED:
                    srcView.post(new Runnable() {
                        @Override
                        public void run() {
                            srcView.setVisibility(View.VISIBLE);
                        }
                    });
                    break;
                }

                return true;
            }
        });

        convertView.setOnLongClickListener(new OnLongClickListener() {
            @Override
            public boolean onLongClick(final View view) {
                // Force a reset of any states
                notifyDataSetChanged();

                // Start the drag on the main loop to allow
                // the above state reset to settle.
                view.post(new Runnable() {
                    @Override
                    public void run() {
                        ClipData data = ClipData.newPlainText("", "");
                        DragShadowBuilder sb = new View.DragShadowBuilder(view);
                        view.startDrag(data, sb, new Reference<View>(view), 0);
                    }
                });

                return true;
            }
        });
    }

    convertView.setTag(R.id.reorder_key, Integer.valueOf(position));
    bindView(convertView, position);
    return convertView;
}
 
开发者ID:Dazzozo,项目名称:freeotp,代码行数:63,代码来源:BaseReorderableAdapter.java


示例7: getView

import android.view.View.OnDragListener; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        int type = getItemViewType(position);
        convertView = createView(parent, type);

        convertView.setOnDragListener(new OnDragListener() {
            @Override
            public boolean onDrag(View dstView, DragEvent event) {
                Reference<View> ref = (Reference<View>) event.getLocalState();
                final View srcView = ref.reference;

                switch (event.getAction()) {
                case DragEvent.ACTION_DRAG_ENTERED:
                    srcView.setVisibility(View.VISIBLE);
                    dstView.setVisibility(View.INVISIBLE);

                    move(((Integer) srcView.getTag(KEY)).intValue(),
                         ((Integer) dstView.getTag(KEY)).intValue());
                    ref.reference = dstView;
                    break;

                case DragEvent.ACTION_DRAG_ENDED:
                    srcView.post(new Runnable() {
                        @Override
                        public void run() {
                            srcView.setVisibility(View.VISIBLE);
                        }
                    });
                    break;
                }

                return true;
            }
        });

        convertView.setOnLongClickListener(new OnLongClickListener() {
            @Override
            public boolean onLongClick(final View view) {
                // Force a reset of any states
                notifyDataSetChanged();

                // Start the drag on the main loop to allow
                // the above state reset to settle.
                view.post(new Runnable() {
                    @Override
                    public void run() {
                        ClipData data = ClipData.newPlainText("", "");
                        DragShadowBuilder sb = new View.DragShadowBuilder(view);
                        view.startDrag(data, sb, new Reference<View>(view), 0);
                    }
                });

                return true;
            }
        });
    }

    convertView.setTag(KEY, Integer.valueOf(position));
    bindView(convertView, position);
    return convertView;
}
 
开发者ID:codemonkey85,项目名称:FreeOTP-Android,代码行数:63,代码来源:ReorderableBaseAdapter.java



注:本文中的android.view.View.OnDragListener类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Reader类代码示例发布时间:2022-05-21
下一篇:
Java SetACLResponse类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap