Exemple #1
0
    public bool OnLongClick(View view)
    {
      ClipData data = ClipData.NewPlainText("DragData", "");
      view.StartDrag(data, 
                     new Android.Views.View.DragShadowBuilder(view), 
                     (Object)new MoveDragData{ draggedView=view, dragHandler=this}, 0);

      return true;
    }
    public bool OnLongClick(View v)
    {
        View.DragShadowBuilder shadowBuilder = new ToolShadowBuilder(v);

        ClipData clipData = ClipData.NewPlainText(v.Id.ToString(), "Outil");

        v.StartDrag(clipData, shadowBuilder, v, 0);

        return true;
    }
 public bool OnTouch(View view, MotionEvent ev)
 {
   //if (inDrag == false)
   //{
     inDrag = true;
     ClipData data = ClipData.NewPlainText("SpeechDragData", "");
     view.StartDrag(data,
                    new Android.Views.View.DragShadowBuilder(view),
                    (Object)new SpeechDragData { draggedView = view, dragHandler = this }, 0);
   //}
   return true;
 }
Exemple #4
0
 public bool OnTouch(View view, MotionEvent ev)
 {
   //if (ev.Action == MotionEvent.ACTION_MOVE)
   {
     ClipData data = ClipData.NewPlainText("DragData", "");
     view.StartDrag(data,
                    new Android.Views.View.DragShadowBuilder(view),
                    (Object)new MoveDragData { draggedView = view, dragHandler = this }, 0);
     
   }
   return true;
 }
    public bool OnTouch(View v, MotionEvent e)
    {
        if (e.Action == MotionEventActions.Down)
        {
            View.DragShadowBuilder shadowBuilder = new ToolShadowBuilder(v);

            ClipData clipData = ClipData.NewPlainText(v.Id.ToString(), "Outil");

            v.StartDrag(clipData, shadowBuilder, v, 0);

            return true;
        }
        else
        {
            return false;
        }
    }
        /// <summary>
        /// Handler for Long Click event from <paramref name="view"/>
        /// </summary>
        /// <param name="parent">
        /// The parent list view .
        /// </param>
        /// <param name="view">
        /// The view that triggered the long click event
        /// </param>
        /// <param name="position">
        /// The position of the view in the list (has to be normalized, includes headers).
        /// </param>
        /// <param name="id">
        /// The id of the item that triggered the event (must be bigger than 0 under normal circumstances).
        /// </param>
        /// <returns>
        /// The <see cref="bool"/> flag that identifies whether the event is handled.
        /// </returns>
        public bool OnItemLongClick(AWidget.AdapterView parent, AViews.View view, int position, long id)
        {
            var selectedItem = ((IList)_element.ItemsSource)[(int)id];

            DragItem dragItem = new DragItem(NormalizeListPosition(position), view, selectedItem);

            var data = ClipData.NewPlainText(string.Empty, string.Empty);

            AViews.View.DragShadowBuilder shadowBuilder = new AViews.View.DragShadowBuilder(view);

            view.Visibility = ViewStates.Invisible;

            if (Build.VERSION.SdkInt >= BuildVersionCodes.N)
            {
                view.StartDragAndDrop(data, shadowBuilder, dragItem, 0);
            }
            else
            {
                view.StartDrag(data, shadowBuilder, id, 0);
            }

            return(true);
        }