DragSortListView
================
# NOTICE: No longer maintained.
I do not have much time to devote to this project so I am
dropping support for the time being. Sorry everybody!
News
----
**April 2, 2013**: Hey all. If you want to send a pull request,
please read the [Contributing](https://github.com/bauerca/drag-sort-listview#contributing) section first. Thanks!
**Feb. 9, 2013**: Version 0.6.0. Consolidated remove modes to
`click_remove` and `fling_remove`. No more fling remove while
dragging; fling anywhere on item to remove it.
[Leszek Mzyk](https://github.com/imbryk) is a bona fide code-slanger.
**Jan. 10, 2013**: Version 0.5.0 is released. Supports ListView
multi-choice and single-choice modes thanks to the hard work of
[Mattias Flodin](https://github.com/mattiasflodin)! Awesome-sauce.
Check out the new demos.
**Nov. 23, 2012**: Hmmm, what's this? → [Gittip](https://www.gittip.com/bauerca) :)
**Nov. 17, 2012**: [Drag-Sort Demos](https://play.google.com/store/apps/details?id=com.mobeta.android.demodslv)
app in Google Play Store!
**Nov. 15, 2012**: Smooth operation! Drops and removals are animated.
Also, DragSortController now provides a convenience
click-to-remove feature (see [XML attrs](https://github.com/bauerca/drag-sort-listview#xml-layout-declaration)
and [RemoveListener](https://github.com/bauerca/drag-sort-listview#dragsortlistviewremovelistener)
sections).
**Nov. 11, 2012**: Mavenized.
Thanks to [Andreas Schildbach (Goonie)](https://github.com/Goonie)!
**Oct. 30, 2012**: DragSortCursorAdapter class helps you reorder
a Cursor-backed ListAdapter. Look at ResourceDragSortCursorAdapter
and SimpleDragSortCursorAdapter as well in [the API](
http://bauerca.github.com/drag-sort-listview).
**Oct. 19, 2012**: Public API documentation is up at
http://bauerca.github.com/drag-sort-listview.
**Oct. 19, 2012**: Refactoring rampage. Backward compatibility is slightly
broken. New features make it worthwhile :) and include: total floating
View customization, total control over drag start/stop,
and a helper class implementing common patterns (long-press to drag,
fling-to-remove, etc.). Thanks to
[Dan Hulme (orac)](https://github.com/orac)
for getting all this rolling!
Check out the extensively updated demos and usage section below.
**Sept. 26, 2012**: Drag-sorting is now animated! (optional, of course)
Items slide around underneath the floating (dragged) View.
Overview
--------
DragSortListView (DSLV) is an extension of the Android ListView that enables
drag-and-drop reordering of list items. It is a ~~major overhaul~~ complete
rewrite of
the [TouchInterceptor](https://github.com/android/platform_packages_apps_music/blob/master/src/com/android/music/TouchInterceptor.java) (TI)
meant to give drag-sorting a polished feel. Some key features are:
1. Clean drag and drop (no visual glitches; I hope!)
2. Intuitive and smooth scrolling while dragging.
3. Support for heterogeneous item heights.
4. Public `startDrag()` and `stopDrag()` methods.
5. Public interface for customizing the floating View.
DragSortListView is useful for all kinds of prioritized lists:
favorites, playlists, checklists, etc. Would love to hear about
your use case or app by email.
I hope you find it useful; and please, help me improve the thing!
Widget usage
------------
Three major elements define the drag-sort process. Roughly, in
order of importance, they are:
1. **Data reordering**. Drag-sorts reorder the data
underlying your list. Since DSLV
cannot know how you organize your data, the reordering must be
performed by you using the provided Listener interfaces.
2. **Drag start/stop**. Drags are started and stopped by
calling `startDrag()` and
`stopDrag()` on your DSLV instance; but some help that is.
The convenience class, DragSortController, provides all kinds of
boiler-plate for common start/stop/remove drag patterns.
3. **Floating View**. The floating View appearance and behavior is
controlled by an
implementation of the FloatViewManager interface. With this, you
can display any View you like as the floating View, and update its
appearance/location on every touch event. The DragSortController
helper class also implements this interface for convenience.
Number 1 is essential. As mentioned above, 2 and 3 can
be handled by the DragSortController helper class. Keep reading,
then head to the
demo and start studying some examples.
### XML layout declaration
DragSortListView can be declared in an XML layout file just like
the ListView. Several example layout files are
[provided in the demo](https://github.com/bauerca/drag-sort-listview/blob/master/demo/res/layout/).
The available attributes (in addition to the usual
ListView attributes) are given below. Read each bullet as
* `<xml attr>`: (`<datatype>`, `<default value>`) `<description>`.
#### XML attributes
* `collapsed_height`: (dimension, 1px) Height of placeholder at original
drag position. Cannot be zero.
* `drag_scroll_start`: (float, 0.3) Start of drag-scroll regions
(defined by a
fraction of the total DSLV height; i.e. between 0 and 1).
* `max_drag_scroll_speed`: (float, 0.5) Maximum drag-scroll speed for
default linear drag-scroll profile. Units of pixels/millisecond.
* `float_alpha`: (float, 1.0) Transparency of floating View. Value from
0 to 1 where 1 is opaque.
* `slide_shuffle_speed`: (float, 0.7) Speed of shuffle animations
underneath floating View. A value
of 0 means a shuffle animation is always in progress, whereas a value
of 1 means items snap from position to position without animation.
* `drop_animation_duration`: (int, 150) Drop animation smoothly centers
the floating View over the drop slot before destroying it. Duration
in milliseconds.
* `remove_animation_duration`: (int, 150) Remove animation smoothly
collapses the empty slot when an item is removed. Duration
in milliseconds.
* `track_drag_sort`: (bool, false) Debugging option; explained below.
* `use_default_controller`: (bool, true) Have DSLV create a
DragSortController instance and pass the following xml attributes
to it. If you set this to false, ignore the following attributes.
* `float_background_color`: (color, BLACK) Set the background
color of the floating View when using the default
DragSortController. Floating View in this case is a snapshot of
the list item to be dragged.
* `drag_handle_id`: (id, 0) Android resource id that points to a
child View of a list item (or the root View of the list item
layout). This identifies the "drag handle," or the View within a
list item that must
be touched to start a drag-sort of that item.
Required if drags are to be enabled using the default
DragSortController.
* `sort_enabled`: (bool, true) Enable sorting of dragged item (disabling
is useful when you only want item removal).
* `drag_start_mode`: (enum, "onDown") Sets the gesture for starting
a drag.
+ "onDown": Drag starts when finger touches down
on the drag handle.
+ "onDrag": Drag starts when finger touches down on drag handle
and then drags (allows item clicks and long clicks).
+ "onLongPress": Drag starts on drag handle long press (allows
item clicks).
* `remove_enabled`: (bool, false) Enable dragged item removal by one
of the `remove_mode` options below.
* `remove_mode`: (enum, "flingRight") Sets the gesture for removing the
dragged item.
+ "clickRemove": Click on item child View with id `click_remove_id`.
+ "flingRemove": Fling horizontal anywhere on item.
* `click_remove_id`: (id, 0) Android resource id that points to a
child View of a list item. When `remove_mode="clickRemove"` and
`remove_enabled="true"`, a click on this child View removes the
containing item. This attr is used by DragSortController.
* `fling_handle_id`: (id, 0) Android resource id that points to a
child View of a list item. When `remove_mode="flingRemove"` and
`remove_enabled="true"`, a fling that originates on this child
View removes the containing item. This attr is used
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
Android应用源码之上下拖动的listview-IT计算机-毕业设计.zip (231个子文件)
resources.ap_ 49KB
Launcher.apk 223KB
jarlist.cache 120B
jarlist.cache 120B
DragSortListView.class 34KB
DragSortController.class 9KB
DSLVFragment.class 6KB
SimpleDragSortCursorAdapter.class 6KB
TestBedDSLV.class 5KB
DragSortCursorAdapter.class 5KB
DragSortListView$DragSortTracker.class 4KB
Sections$SectionAdapter.class 4KB
Sections$SectionController.class 4KB
DragSortListView$DragScroller.class 4KB
DragSortListView$RemoveAnimator.class 4KB
DragSortListView$AdapterWrapper.class 3KB
Launcher.class 3KB
ArbItemSizeDSLV.class 3KB
WarpDSLV.class 3KB
MultipleChoiceListView.class 3KB
DragInitModeDialog.class 3KB
EnablesDialog.class 3KB
DragSortListView$DropAnimator.class 3KB
RemoveModeDialog.class 3KB
SimpleFloatViewManager.class 3KB
Sections.class 2KB
SingleChoiceListView.class 2KB
ArbItemSizeDSLV$JazzAdapter.class 2KB
DragSortItemView.class 2KB
ResourceDragSortCursorAdapter.class 2KB
CursorDSLV.class 2KB
DSLVFragmentBGHandle$MyDSController.class 2KB
DSLVFragmentClicks.class 2KB
DragSortListView$SmoothAnimator.class 2KB
DSLVFragmentBGHandle.class 2KB
CursorDSLV$MAdapter.class 2KB
SingleChoiceListView$1.class 2KB
R$styleable.class 2KB
R$styleable.class 2KB
DSLVFragmentClicks$3.class 2KB
R$styleable.class 2KB
DSLVFragmentClicks$2.class 2KB
DSLVFragmentClicks$1.class 2KB
DragSortController$1.class 2KB
DragSortListView$HeightCache.class 2KB
DragSortListView$LiftAnimator.class 2KB
DSLVFragmentBGHandle$MyAdapter.class 1KB
Launcher$MyAdapter.class 1KB
MultipleChoiceListView$1.class 1KB
ArbItemSizeDSLV$1.class 1KB
DragInitModeDialog$2.class 1KB
RemoveModeDialog$2.class 1KB
R$attr.class 1KB
EnablesDialog$2.class 1KB
MultipleChoiceListView$2.class 1KB
CursorDSLV$MAdapter$1.class 1KB
ArbItemSizeDSLV$2.class 1KB
WarpDSLV$1.class 1KB
R$layout.class 1KB
DSLVFragment$1.class 1KB
CheckableLinearLayout.class 1KB
R$attr.class 1KB
R$attr.class 1KB
R$id.class 1KB
EnablesDialog$1.class 1KB
DragSortItemViewCheckable.class 1KB
DragInitModeDialog$1.class 1KB
DragSortListView$AdapterWrapper$1.class 1KB
RemoveModeDialog$1.class 1KB
DragSortListView$2.class 1015B
WarpDSLV$2.class 1014B
WarpDSLV$3.class 1010B
DSLVFragment$2.class 997B
DragInitModeDialog$3.class 956B
RemoveModeDialog$3.class 944B
EnablesDialog$3.class 926B
ArbItemSizeDSLV$JazzArtist.class 899B
R.class 885B
DragSortListView$1.class 843B
ArbItemSizeDSLV$ViewHolder.class 790B
R$drawable.class 750B
R$array.class 708B
R$string.class 674B
R$id.class 627B
R$color.class 611B
BGHandle.class 542B
R$id.class 534B
DragSortListView$DragSortListener.class 506B
R$dimen.class 467B
R.class 458B
R.class 458B
DragSortListView$FloatViewManager.class 456B
R$menu.class 420B
SimpleDragSortCursorAdapter$CursorToStringConverter.class 377B
BuildConfig.class 363B
BuildConfig.class 355B
SimpleDragSortCursorAdapter$ViewBinder.class 345B
DragInitModeDialog$DragOkListener.class 291B
RemoveModeDialog$RemoveOkListener.class 291B
EnablesDialog$EnabledOkListener.class 287B
共 231 条
- 1
- 2
- 3
资源评论
- shizixin0318152023-05-13资源太好了,解决了我当下遇到的难题,抱紧大佬的大腿~
芝麻粒儿
- 粉丝: 5w+
- 资源: 2万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功