Share My Creation Drag and Drop GridView

Looking for bugs and suggestions for a new library I ported, the DynamicGridView.
Allows dragging and dropping.

It can be used as a usual gridview and also has the ability to move around objects (try long clicking an item).

This borrows heavily from the work others have done: Erel's B4A, warwounds' BaseAdapter, Informatix's ULV, and askerov for the DynamicGridView.
 

Attachments

  • SGV.apk
    437.5 KB · Views: 761

Dave O

Well-Known Member
Licensed User
The DnD gridview is exactly what I'm looking for, for my prototyping app, so the user can navigate (and optionally reorder) the pages of the prototype.

Both the gridview and listview work smoothly on a Galaxy S3 (Android 4.3), Galaxy Note 8 tablet (Android 4.4.2), and Nexus 7 (2012) tablet (Android 5.1).

One suggestion - on long-click, it would be useful for the user to know that drag-and-drop is now active. Currently the selected item de-selects, and it's not clear what the state is until you start dragging (and then it's obvious from the item itself moving). If this is under your control, perhaps some other kind of highlight? (e.g. bright border color?)

Happy to test and send feedback on a pre-release version. Thanks!
 

Dave O

Well-Known Member
Licensed User
Argh, spoke too soon - I'm seeing weird behaviour on my Nexus 7 with Android 5.1.

In the grid view, when dragging an item over another item, the second item does not "get out of the way". It stays where it is until the item moves past it, then it disappears. If I keep dragging the first item around, I can eventually "black out" the whole grid this way.

Let me know if you need screenshots of this. Works fine on my other devices (which are all Android 4.x).
 

thedesolatesoul

Expert
Licensed User
In the grid view, when dragging an item over another item, the second item does not "get out of the way". It stays where it is until the item moves past it, then it disappears. If I keep dragging the first item around, I can eventually "black out" the whole grid this way.
Can you try this version: https://www.dropbox.com/s/rgyr7xs7vh5q0zd/MSDynamicGridView.apk?dl=0
I believe I fixed the Android5 issue a while back.

One suggestion - on long-click, it would be useful for the user to know that drag-and-drop is now active. Currently the selected item de-selects, and it's not clear what the state is until you start dragging (and then it's obvious from the item itself moving). If this is under your control, perhaps some other kind of highlight? (e.g. bright border color?)
I'm not sure if I understand you 100%. It is possible to add a 'wobble' animation when drag-drop is active. But all the items on the screen will wobble (with varying intensities). Are you saying you want just that particular item to change color for e.g.?
 

Dave O

Well-Known Member
Licensed User
Yep, that did the trick. Working fine on Android 5.1 now.

It is possible to add a 'wobble' animation when drag-drop is active. But all the items on the screen will wobble (with varying intensities). Are you saying you want just that particular item to change color for e.g.?
I think making everything react (e.g. wobble) might be OK (like iOS does), but I'd prefer to see some kind of effect just on the selected item.

For example, on the stock Android desktop, the item gets slightly bigger (as if it's "lifted off" the desktop). On Samsung's TouchWiz launcher, the background gets smaller (but gives a similar overall effect).

This isn't critical, but small touches like this do make the view feel more refined, IMO.

Is the library available for downloading? If it does what I want (and I think it does), I'm happy to donate.

(I think the only question left for me is if it handles item captions somehow, or if that's just part of a cell's internal layout.)
 
Last edited:

Dave O

Well-Known Member
Licensed User
Noticed a slightly confusing thing while playing with it a bit more:

If I try to drag an item to the end (where there's room left empty in the bottom row), it drops the item a slot above (based on its X position).

The only way to actually drop an item at the end is to drop it on the last item, rather than just to the right of the last item (which is where I was aiming originally).

Took me a few tries to figure out how to do this, so perhaps it would be useful to recognise any drop to the right of the last item to be put at the end?

Hope this helps.
 

thedesolatesoul

Expert
Licensed User
For example, on the stock Android desktop, the item gets slightly bigger (as if it's "lifted off" the desktop). On Samsung's TouchWiz launcher, the background gets smaller (but gives a similar overall effect).
It will be tricky to alter the size of the Hover view. This will cause issues in the cell switching/drag drop behaviour as it alters the calculations.
It is an interesting thought though, I might experiment with it at some point.

I will probably have to go back and revisit to see if it is even possible to add an indicator to the Hoverview. (Its a bitmap snapshot taken at the time of selection).

(I think the only question left for me is if it handles item captions somehow, or if that's just part of a cell's internal layout.)
That should be part of the cell's layout.

If I try to drag an item to the end (where there's room left empty in the bottom row), it drops the item a slot above (based on its X position).

The only way to actually drop an item at the end is to drop it on the last item, rather than just to the right of the last item (which is where I was aiming originally).

Took me a few tries to figure out how to do this, so perhaps it would be useful to recognise any drop to the right of the last item to be put at the end?
I wouldnt be able to do this (easily). The drag/drop essentially works as a cell switcher. It checks the bounds of each cell and replaces them with one another.
Dragging an item to the end of the grid where there are no other items, it ends up in an invalid position. For e.g. if you added 50 items, but drag the item onto location 53, it immediately thinks this location does not exist.
I have an idea though, I might give it a shot and see what happens.

Is the library available for downloading? If it does what I want (and I think it does), I'm happy to donate.
Again this is a tricky question (and you have many ;)). The library mainly does what is in the sample, there may be things you assumed were already there, but they arent.
There may even be bugs.
If you want to test it hard, I can send it to you, and then you could give me your feedback, and I will see what I can fix.
 

walterf25

Expert
Licensed User
Looking for bugs and suggestions for a new library I ported, the DynamicGridView.
Allows dragging and dropping.

It can be used as a usual gridview and also has the ability to move around objects (try long clicking an item).

This borrows heavily from the work others have done: Erel's B4A, warwounds' BaseAdapter, Informatix's ULV, and askerov for the DynamicGridView.
Are the tiles or grids suppose to re-arrange themselves when you scroll down then back up?

o_O
 

Dave O

Well-Known Member
Licensed User
Do you have sample source code for the drag-and-drop app?

I'm playing with your gridview this week, and it would be great to have some sample code to copy and learn from.
 

thedesolatesoul

Expert
Licensed User
Do you have sample source code for the drag-and-drop app?

I'm playing with your gridview this week, and it would be great to have some sample code to copy and learn from.
The link I sent you contained a sample as well (I hope). Or are you looking for another sample?
I'll try to clean up another sample I have lying around that would be helpful.
 

Dave O

Well-Known Member
Licensed User
Oops, you're right, I missed the sample in the original link. Got it.

And got your puzzle sample too. I did a similar demo using DraggableView a few years ago, so will be fun to compare the code.

Thanks!
 
Top