Skip to content

Commit

Permalink
Merge branch 'fling-or-slide-remove'
Browse files Browse the repository at this point in the history
Conflicts:
	library/src/com/mobeta/android/dslv/DragSortListView.java
  • Loading branch information
bauerca committed Feb 9, 2013
2 parents ef48c2a + ebc4ea7 commit 739f317
Show file tree
Hide file tree
Showing 13 changed files with 480 additions and 385 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
Changelog
=========

0.6.0
-----

* Remove modes are now `fling_remove` and `click_remove`.

0.5.0
-----

* Multiple-choice and single-choice selections handled.

0.4.0
-----

Expand Down
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ DragSortListView
News
----

**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.
Expand Down Expand Up @@ -152,16 +157,16 @@ of 1 means items snap from position to position without animation.
* `remove_mode`: (enum, "flingRight") Sets the gesture for removing the
dragged item.
+ "clickRemove": Click on item child View with id `click_remove_id`.
+ "flingRight": Fling to the right; get outta here!
+ "flingLeft": Fling to the left; sayonara sucker!
+ "slideRight": Floating View fades as you slide your finger
to the right; lifting while faded removes item.
+ "slideLeft": Floating View fades as you slide your finger
to the right; lifting while faded removes item.
+ "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 by
DragSortController.

### Listeners

Expand Down Expand Up @@ -355,7 +360,7 @@ dependency to your pom.xml:
<dependency>
<groupId>com.mobeta.android.dslv</groupId>
<artifactId>drag-sort-listview</artifactId>
<version>0.3.0-SNAPSHOT</version>
<version>0.6.0-SNAPSHOT</version>
<type>apklib</type>
</dependency>
```
Expand Down
4 changes: 2 additions & 2 deletions demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ Copyright 2012 Andreas Schildbach
<parent>
<groupId>com.mobeta.android.dslv</groupId>
<artifactId>parent</artifactId>
<version>0.5.0-SNAPSHOT</version>
<version>0.6.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<groupId>com.mobeta.android.demodslv</groupId>
<artifactId>drag-sort-listview-demo</artifactId>
<packaging>apk</packaging>
<version>0.5.0-SNAPSHOT</version>
<version>0.6.0-SNAPSHOT</version>

<dependencies>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion demo/res/layout/hetero_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
dslv:sort_enabled="true"
dslv:remove_enabled="true"
dslv:drag_start_mode="onDown"
dslv:remove_mode="flingLeft" />
dslv:remove_mode="flingRemove" />
5 changes: 1 addition & 4 deletions demo/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,7 @@
<string name="add_footer">Add footer</string>
<string-array name="remove_mode_labels">
<item>Click remove</item>
<item>Fling right</item>
<item>Fling left</item>
<item>Slide right</item>
<item>Slide left</item>
<item>Fling remove</item>
</string-array>
<string-array name="drag_init_mode_labels">
<item>On down</item>
Expand Down
7 changes: 4 additions & 3 deletions demo/src/com/mobeta/android/demodslv/DSLVFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ protected int getLayout() {
* Return list item layout resource passed to the ArrayAdapter.
*/
protected int getItemLayout() {
if (removeMode == DragSortController.FLING_LEFT_REMOVE || removeMode == DragSortController.SLIDE_LEFT_REMOVE) {
/*if (removeMode == DragSortController.FLING_LEFT_REMOVE || removeMode == DragSortController.SLIDE_LEFT_REMOVE) {
return R.layout.list_item_handle_right;
} else if (removeMode == DragSortController.CLICK_REMOVE) {
} else */
if (removeMode == DragSortController.CLICK_REMOVE) {
return R.layout.list_item_click_remove;
} else {
return R.layout.list_item_handle_left;
Expand All @@ -67,7 +68,7 @@ protected int getItemLayout() {

public int dragStartMode = DragSortController.ON_DOWN;
public boolean removeEnabled = false;
public int removeMode = DragSortController.FLING_RIGHT_REMOVE;
public int removeMode = DragSortController.FLING_REMOVE;
public boolean sortEnabled = true;
public boolean dragEnabled = true;

Expand Down
2 changes: 1 addition & 1 deletion demo/src/com/mobeta/android/demodslv/RemoveModeDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class RemoveModeDialog extends DialogFragment {

public RemoveModeDialog() {
super();
mRemoveMode = DragSortController.FLING_RIGHT_REMOVE;
mRemoveMode = DragSortController.FLING_REMOVE;
}

public RemoveModeDialog(int inRemoveMode) {
Expand Down
6 changes: 3 additions & 3 deletions demo/src/com/mobeta/android/demodslv/TestBedDSLV.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ public class TestBedDSLV extends FragmentActivity implements
private int mNumHeaders = 0;
private int mNumFooters = 0;

private int mDragStartMode = DragSortController.ON_DOWN;
private boolean mRemoveEnabled = false;
private int mRemoveMode = DragSortController.FLING_RIGHT_REMOVE;
private int mDragStartMode = DragSortController.ON_DRAG;
private boolean mRemoveEnabled = true;
private int mRemoveMode = DragSortController.FLING_REMOVE;
private boolean mSortEnabled = true;
private boolean mDragEnabled = true;

Expand Down
4 changes: 2 additions & 2 deletions library/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ Copyright 2012 Andreas Schildbach
<groupId>com.mobeta.android.dslv</groupId>
<artifactId>drag-sort-listview</artifactId>
<packaging>apklib</packaging>
<version>0.5.0-SNAPSHOT</version>
<version>0.6.0-SNAPSHOT</version>

<parent>
<groupId>com.mobeta.android.dslv</groupId>
<artifactId>parent</artifactId>
<version>0.5.0-SNAPSHOT</version>
<version>0.6.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
6 changes: 2 additions & 4 deletions library/res/values/dslv_attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
<attr name="float_background_color" format="color" />
<attr name="remove_mode">
<enum name="clickRemove" value="0" />
<enum name="flingRight" value="1" />
<enum name="flingLeft" value="2" />
<enum name="slideRight" value="3" />
<enum name="slideLeft" value="4" />
<enum name="flingRemove" value="1" />
</attr>
<attr name="track_drag_sort" format="boolean"/>
<attr name="float_alpha" format="float"/>
Expand All @@ -26,6 +23,7 @@
<enum name="onLongPress" value="2"/>
</attr>
<attr name="drag_handle_id" format="integer" />
<attr name="fling_handle_id" format="integer" />
<attr name="click_remove_id" format="integer" />
<attr name="use_default_controller" format="boolean" />
</declare-styleable>
Expand Down
Loading

0 comments on commit 739f317

Please sign in to comment.