justasm / DragLinearLayout

Android LinearLayout with drag and drop to reorder.
MIT License
453 stars 121 forks source link

Adding to project using gradle doesn't work #13

Closed Virthuss closed 9 years ago

Virthuss commented 9 years ago

Hi,

I'm trying to use your project using gradle.

However using compile 'com.jmedeisis:draglinearlayout:1.1.0' in gradle doesn't work. Is that normal? Thanks in advance.

EDIT: my bad, succeed with adding allprojects { repositories { jcenter() } }

justasm commented 9 years ago

Glad you managed to solve the issue :+1:, sorry I didn't respond sooner.

Virthuss commented 9 years ago

No problem, and thanks for this amazing library! However I noticed some troubles while I'm using it in a scrollview. The library then work once every ten click, like if the scrollview was stealing the focus. Am I missing something? It working fine without the scrollview. I can open a new issue if needed.

justasm commented 9 years ago

That shouldn't be happening, but it's difficult to say what's up without seeing your code / layout. Perhaps your touch targets are too small.

The sample includes a demo of the DragLinearLayout inside of a ScrollView, might be a good place to look at for reference. You're of course welcome to open an issue if you don't manage to resolve it.

Virthuss commented 9 years ago

I will try to fix it by myself and will open a new issue thread about that with more technical informations if needed. As a beginner may I ask you if it's possible to override some features of your library quite easily? I would like to activate your feature on a longclick only and be able to change the background color as well.

meesec commented 9 years ago

for long tap check out my fork. i have been meaning to merge back the changes to justas' code but haven't gotten to it yet. it might even have code related to changing the background in it - i remember playing around with that as well.

justasm commented 9 years ago

You can customize the background just like you would for any other View in Android, most commonly through the android:background property.

And for long-press, as always, I can depend on @meesec jumping in :) Check out the fork here.

Virthuss commented 9 years ago

I'll check the fork thanks :)

However for the view it's possible to do so, but my aim is to 'highlight' the element touched by the user after a long click ( since the 'quick' onclick open a new fragment ) while his finger is pressing the screen. On release the color must return to an original value. I did it easily with a ontouchlistener but it seems that in this case, the listener in charge of the drag and sort is not working anymore.

:(

meesec commented 9 years ago

yes, that's the kind of change i did in the fork (changing the elevation / shadow of the item and i think it also slightly translates the views position). i think it is working in the current state, it's mainly the documentation that i haven't updated that keeps me from creating a pull request.

justasm commented 9 years ago

Yes, the library overrides the View's existing OnTouchListener. You may want to consider whether it's all necessary; as you can see in the sample, clickable buttons can happily coexist with the drag feature without resorting to long press. If it is, @meesec's fork or your own modifications may be your best bet.

The library would definitely be improved if it delegated events to any existing OnTouchListener, and / or had additional callbacks for drag start / stop.

Virthuss commented 9 years ago

Just another beginner question: How to get the fork version instead of the main branch's one?

meesec commented 9 years ago

as far as i know you can't because i haven't published the fork to maven central or sth like that. you'd have to manually download it.

The reason i'm not publishing it is that i'd rather have the changes merged to the main lib at some point - although that might create issues with existing users of the lib as the behavior of components would change.

Virthuss commented 9 years ago

I'll try with the zip file then. Thanks :+1:

Virthuss commented 9 years ago

Sadly I didn't success to import your lib as a zip file... That was the problem I encountered before finding a solution with my edit on the first post... which is not applicable on this new case

justasm commented 9 years ago

Haven't reviewed all the additions / changes @meesec made to the library, but it may be sufficient to just drop in the main class file (DragLinearLayout.java) to your project, it is largely self-contained.

On Fri, Sep 18, 2015 at 11:18 AM, Virthuss notifications@github.com wrote:

Sadly I didn't success to import your lib as a zip file... That was the problem I encountered before finding a solution with my edit on the first post... which is not applicable on this new case

— Reply to this email directly or view it on GitHub https://github.com/justasm/DragLinearLayout/issues/13#issuecomment-141412016 .

Justas Medeisis

Virthuss commented 9 years ago

Error:Cannot access first() element from an empty List

Is returned every time...

justasm commented 9 years ago

Sorry @Virthuss but I'm closing this issue as it has diverged too far from its original intent.

The information you have provided about your error is not detailed enough. Please post a new issue with the full stack trace, and we may be able to help.