Exemplo n.º 1
0
 public ReorderableListTouchHelperCallback(IReorderableListAdapter adapter, GridLayoutManager layoutManager)
 {
     _layoutManager         = layoutManager;
     _adapter               = adapter;
     _movementStartPosition = -1;
     _movementEndPosition   = -1;
 }
Exemplo n.º 2
0
        public ReorderableListTouchHelperCallback(Context context, IReorderableListAdapter adapter, GridLayoutManager layoutManager)
        {
            _layoutManager         = layoutManager;
            _adapter               = adapter;
            _movementStartPosition = -1;
            _movementEndPosition   = -1;

            _dragElevation = ViewUtils.DpToPx(context, DragElevationDp);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Calculate height of list field for adapted collection.
        /// </summary>
        /// <param name="adapter">Reorderable list adaptor.</param>
        /// <param name="flags">Optional flags to pass into list field.</param>
        /// <returns>
        /// Required list height in pixels.
        /// </returns>
        public static float CalculateListFieldHeight(IReorderableListAdapter adapter, ReorderableListFlags flags)
        {
            // We need to push/pop flags so that nested controls are properly calculated.
            var restoreFlags = DefaultListControl.Flags;

            try {
                DefaultListControl.Flags = flags;
                return(DefaultListControl.CalculateListHeight(adapter));
            }
            finally {
                DefaultListControl.Flags = restoreFlags;
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of <see cref="ItemMovedEventArgs"/>.
 /// </summary>
 /// <param name="adapter">Reorderable list adaptor.</param>
 /// <param name="buttonPosition">Position of the add menu button.</param>
 public AddMenuClickedEventArgs(IReorderableListAdapter adapter, Rect buttonPosition)
 {
     this.Adapter        = adapter;
     this.ButtonPosition = buttonPosition;
 }
Exemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of <see cref="ItemMovedEventArgs"/>.
 /// </summary>
 /// <param name="adapter">Reorderable list adaptor.</param>
 /// <param name="oldItemIndex">Old zero-based index of item.</param>
 /// <param name="newItemIndex">New zero-based index of item.</param>
 public ItemMovedEventArgs(IReorderableListAdapter adapter, int oldItemIndex, int newItemIndex)
 {
     this.Adapter      = adapter;
     this.OldItemIndex = oldItemIndex;
     this.NewItemIndex = newItemIndex;
 }
Exemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of <see cref="ItemMovingEventArgs"/>.
 /// </summary>
 /// <param name="adapter">Reorderable list adaptor.</param>
 /// <param name="itemIndex">Zero-based index of item.</param>
 /// <param name="destinationItemIndex">Xero-based index of item destination.</param>
 public ItemMovingEventArgs(IReorderableListAdapter adapter, int itemIndex, int destinationItemIndex)
 {
     this.Adapter              = adapter;
     this.ItemIndex            = itemIndex;
     this.DestinationItemIndex = destinationItemIndex;
 }
Exemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of <see cref="ItemRemovingEventArgs"/>.
 /// </summary>
 /// <param name="adapter">Reorderable list adaptor.</param>
 /// <param name="itemIndex">Zero-based index of item.</param>
 public ItemRemovingEventArgs(IReorderableListAdapter adapter, int itemIndex)
 {
     this.Adapter   = adapter;
     this.ItemIndex = itemIndex;
 }
Exemplo n.º 8
0
 /// <inheritdoc cref="CalculateListFieldHeight(IReorderableListAdapter, ReorderableListFlags)"/>
 public static float CalculateListFieldHeight(IReorderableListAdapter adapter)
 {
     return(CalculateListFieldHeight(adapter, 0));
 }
Exemplo n.º 9
0
 /// <inheritdoc cref="DoListField(IReorderableListAdapter, ReorderableListControl.DrawEmpty, ReorderableListFlags)"/>
 public static void ListField(IReorderableListAdapter adapter)
 {
     DoListField(adapter, null, 0);
 }
Exemplo n.º 10
0
 /// <inheritdoc cref="DoListField(IReorderableListAdapter, ReorderableListControl.DrawEmpty, ReorderableListFlags)"/>
 public static void ListField(IReorderableListAdapter adapter, ReorderableListFlags flags)
 {
     DoListField(adapter, null, flags);
 }
Exemplo n.º 11
0
 /// <inheritdoc cref="DoListFieldAbsolute(Rect, IReorderableListAdapter, ReorderableListControl.DrawEmptyAbsolute, ReorderableListFlags)"/>
 public static void ListFieldAbsolute(Rect position, IReorderableListAdapter adapter, ReorderableListControl.DrawEmptyAbsolute drawEmpty)
 {
     DoListFieldAbsolute(position, adapter, drawEmpty, 0);
 }
Exemplo n.º 12
0
 /// <inheritdoc cref="DoListField(IReorderableListAdapter, ReorderableListControl.DrawEmpty, ReorderableListFlags)"/>
 public static void ListField(IReorderableListAdapter adapter, ReorderableListControl.DrawEmpty drawEmpty)
 {
     DoListField(adapter, drawEmpty, 0);
 }
Exemplo n.º 13
0
 /// <summary>
 /// Draw list field control for adapted collection.
 /// </summary>
 /// <param name="position">Position of control.</param>
 /// <param name="adapter">Reorderable list adaptor.</param>
 /// <param name="drawEmpty">Callback to draw custom content for empty list (optional).</param>
 /// <param name="flags">Optional flags to pass into list field.</param>
 private static void DoListFieldAbsolute(Rect position, IReorderableListAdapter adapter, ReorderableListControl.DrawEmptyAbsolute drawEmpty, ReorderableListFlags flags = 0)
 {
     ReorderableListControl.DrawControlFromState(position, adapter, drawEmpty, flags);
 }
Exemplo n.º 14
0
 /// <summary>
 /// Draw list field control for adapted collection.
 /// </summary>
 /// <param name="adapter">Reorderable list adaptor.</param>
 /// <param name="drawEmpty">Callback to draw custom content for empty list (optional).</param>
 /// <param name="flags">Optional flags to pass into list field.</param>
 private static void DoListField(IReorderableListAdapter adapter, ReorderableListControl.DrawEmpty drawEmpty, ReorderableListFlags flags = 0)
 {
     ReorderableListControl.DrawControlFromState(adapter, drawEmpty, flags);
 }
Exemplo n.º 15
0
 /// <summary>
 /// Initializes a new instance of <see cref="ItemInsertedEventArgs"/>.
 /// </summary>
 /// <param name="adapter">Reorderable list adaptor.</param>
 /// <param name="itemIndex">Zero-based index of item.</param>
 /// <param name="wasDuplicated">Indicates if inserted item was duplicated from another item.</param>
 public ItemInsertedEventArgs(IReorderableListAdapter adapter, int itemIndex, bool wasDuplicated)
 {
     this.Adapter       = adapter;
     this.ItemIndex     = itemIndex;
     this.WasDuplicated = wasDuplicated;
 }
Exemplo n.º 16
0
 /// <inheritdoc cref="DoListFieldAbsolute(Rect, IReorderableListAdapter, ReorderableListControl.DrawEmptyAbsolute, ReorderableListFlags)"/>
 public static void ListFieldAbsolute(Rect position, IReorderableListAdapter adapter)
 {
     DoListFieldAbsolute(position, adapter, null, 0);
 }
Exemplo n.º 17
0
 public ReorderableListTouchHelperCallback(IReorderableListAdapter adapter, GridLayoutManager layoutManager)
 {
     _isMoving      = false;
     _layoutManager = layoutManager;
     _adapter       = adapter;
 }