public ReorderableListTouchHelperCallback(IReorderableListAdapter adapter, GridLayoutManager layoutManager) { _layoutManager = layoutManager; _adapter = adapter; _movementStartPosition = -1; _movementEndPosition = -1; }
public ReorderableListTouchHelperCallback(Context context, IReorderableListAdapter adapter, GridLayoutManager layoutManager) { _layoutManager = layoutManager; _adapter = adapter; _movementStartPosition = -1; _movementEndPosition = -1; _dragElevation = ViewUtils.DpToPx(context, DragElevationDp); }
/// <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; } }
/// <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; }
/// <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; }
/// <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; }
/// <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; }
/// <inheritdoc cref="CalculateListFieldHeight(IReorderableListAdapter, ReorderableListFlags)"/> public static float CalculateListFieldHeight(IReorderableListAdapter adapter) { return(CalculateListFieldHeight(adapter, 0)); }
/// <inheritdoc cref="DoListField(IReorderableListAdapter, ReorderableListControl.DrawEmpty, ReorderableListFlags)"/> public static void ListField(IReorderableListAdapter adapter) { DoListField(adapter, null, 0); }
/// <inheritdoc cref="DoListField(IReorderableListAdapter, ReorderableListControl.DrawEmpty, ReorderableListFlags)"/> public static void ListField(IReorderableListAdapter adapter, ReorderableListFlags flags) { DoListField(adapter, null, flags); }
/// <inheritdoc cref="DoListFieldAbsolute(Rect, IReorderableListAdapter, ReorderableListControl.DrawEmptyAbsolute, ReorderableListFlags)"/> public static void ListFieldAbsolute(Rect position, IReorderableListAdapter adapter, ReorderableListControl.DrawEmptyAbsolute drawEmpty) { DoListFieldAbsolute(position, adapter, drawEmpty, 0); }
/// <inheritdoc cref="DoListField(IReorderableListAdapter, ReorderableListControl.DrawEmpty, ReorderableListFlags)"/> public static void ListField(IReorderableListAdapter adapter, ReorderableListControl.DrawEmpty drawEmpty) { DoListField(adapter, drawEmpty, 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); }
/// <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); }
/// <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; }
/// <inheritdoc cref="DoListFieldAbsolute(Rect, IReorderableListAdapter, ReorderableListControl.DrawEmptyAbsolute, ReorderableListFlags)"/> public static void ListFieldAbsolute(Rect position, IReorderableListAdapter adapter) { DoListFieldAbsolute(position, adapter, null, 0); }
public ReorderableListTouchHelperCallback(IReorderableListAdapter adapter, GridLayoutManager layoutManager) { _isMoving = false; _layoutManager = layoutManager; _adapter = adapter; }