Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force clickable value to false #104

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Force clickable value to false #104

wants to merge 1 commit into from

Conversation

julesanchez
Copy link

Hi,

First of all, I want to thank you for your hard work on this library, which is really useful and fills the drag/drop pattern gap on Android Sdk.

Days ago, I encountered an issue, using the drag-sort-listview :
I made and set a custom adapter for a DragSortListView with a ayout file which was something like :

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/wrapProg"
        style="@style/button"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
         android:padding="4dp" >

         [.....]

     </RelativeLayout>

The drag/drop did not work, and I started to search why. I found that in my file styles.xml, the class "button" has a parent attribute set to "@android:style/Widget.Button"; which set clickable property to "true".
And that's why my code was not working as expected, so I set the clickable value of "button" class to false, and all work perfectly.

It's seems, that having dragSortListView with an item clickable, is pretty useless. That's why a made a fix, to set it programmatically on the library.

I hope my use case will help,

Julien

@bauerca
Copy link
Owner

bauerca commented Apr 25, 2013

You can have a clickable list item if you set your dslv:drag_start_mode to "onDrag" or "onLongPress".

@julesanchez
Copy link
Author

When I set drag_start_mode to onLongPress it's not working (drag not enable). And when I set to onDrag, i got this error Error: String types not allowed (at 'drag_start_mode' with value 'onDrag'). Here my xml :

 <?xml version="1.0" encoding="utf-8"?>
 <com.mobeta.android.dslv.DragSortListView
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:dslv="http://schemas.android.com/apk/res/com.instant_tv"
     android:id="@+id/list_meschaines"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:padding="3dp"
     android:layout_margin="3dp"
     android:dividerHeight="2dp"
     dslv:drag_enabled="true"
     dslv:collapsed_height="2dp"
     dslv:drag_scroll_start="0.33"
     dslv:max_drag_scroll_speed="0.5"
     dslv:float_alpha="0.6"
     dslv:slide_shuffle_speed="0.3"
     dslv:track_drag_sort="false"
     dslv:use_default_controller="false" />

@bauerca
Copy link
Owner

bauerca commented May 3, 2013

I think I know the problem, but unfortunately do not have much time to fix it. One (possible, untested) solution is for you to use the standard method of detecting list item clicks by using your DSLV in a ListActivity or ListFragment or by registering an OnItemClickListener with your DSLV instance.

The problem is that DragSortController only listens in on the ListView onTouchEvent() method (b/c it's an OnTouchListener). When your list items are clickable, they consume the onTouchEvent() calls, and the controller goes deaf to further touch events.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants