Shifting touch focus from one recycle view to another - android

I am new to android development and got stuck with this.
I have implemented drag and drop for recycle view using ItemTouchHelper.Callback. Now drag and drop is working perfectly within the recycler view. But in my case, i have two recycler views and i want to drag item from one recycler view to another. Is there any ways to achieve this using ItemTouchHelper.Callback?
Thanks in advance.

Related

Recyclerview grid layout: Drag outside incompatible with scrolling?

I am building an android app with two recyclerviews, one with horizontal LinearLayoutManager and the other one with GridLayoutManager.
I want to allow the items recyclerviews to be dragged and dropped over a trash icon outside of the recyclerviews, obviously to delete the dragged item.
What I have done is:
Apply android:clipChildren in the parent of the two recyclerviews
Apply android:clipToPadding in the recyclerviews
This works perfectly in recyclerview with LinearLayoutManager. I can drag an item and drop it over an icon that is outside of the recylcerview.
I also works in the recyclerview with GridLayoutManager, but with a side effect. When I scroll in the grid recyclerview the scrolled items come out of the recyclerview.
At the ende of this GIF you can see the scrolling issue
So, Is there any way to allow dragging a recyclerview item outside of the recyclerview boundaries but preventing items comeout when scrolling?
Lots of thanks for your help and suggestions in advance
I tried putting the recyclerview with LinearLayoutManager on top of the recyclerview with GridLayoutManager, to hide the items which came out of the boundaries, but this make a strange behaivour when I drag an item, because the items are there yet, even they are hidden. I could make a GIF if needed
My last option is putting the trash icon inside of the recyclerview, as a header that appears when dragging an item, but I would prefer not do it that way
Finally what I have learnt is that you have two main options when face a drag and drop problem:
Easy way: Using the Android helper ItemTouchHelper
Hard way: Not using the helper and type all the code, using startDragAndDrop()
A scenario like this only can be solved by the hard way.

How can I animate individual elements in recycler view simultaneously

I have been working on recycler view animations and I stumbled upon a great app (Relay) animation example (video link below) which I have been trying to replicate.
I want to animate each layout item simultaneously inside the recycler view but am not able to figure out the approach for this.
Should I create a custom LayoutManager that animates the views whenever the item layout is changed or use RecyclerView.ItemAnimator is there some better approach to achieve something similar?
https://imgur.com/a/GsM8kO5

How do I dynamically add a background view to Recycler list view item?

I'm using cards to show a list in a recycler view and have implemented Swipe-To-Show-Background feature. But I'm struggling to figure out how to dynamically add a view underneath the card which doesn't get moved but gets displayed when the top view item gets moved?
I can't obviously have the back-view and front-view in the same card, as they both will get swiped.
Edit:
So, I've a card view that has swipe left/right feature. I want to show a view in its background when swiped right. My biggest issue here is I'm not able to dynamically add a view and make it visible when the card is swiped.
I don't have enough reputation to comment so i am posting this as answer.
Firstly, please elaborate your question properly it is a bit vague. Meanwhile, to change background dynamically you can try setBackgroundResource(R.drawable.xxx)

Darggable Grid View using pageViewer

I have developed Darggable grid view,In this Grid View I have Implemented Darg and Drop Functionality It's Working fine.But As per my requirement I need to integrate this code into
ViewPager.BUt I couldnot drag the icons from one view to another view.I can Drag the icons only one view.Can You PLease solve this if any one knows.
I have implemeted darg&drop functionality using this article:https://github.com/thquinn/DraggableGridView
DraggableGridView only supports rearranging within one instance. You would need to implement custom events to give your activity information about the currently selected view. You'd have another problem: by default, views don't draw outside of their parent ViewGroup. You might want to try Android's Drag and Drop framework to develop your own custom behavior.
http://developer.android.com/guide/topics/ui/drag-drop.html

how to make image view drag and drop on gridview android

i want to Override the onTouch event and get the image view from the gridview
and drag it to new place on the grid ?
I'm not sure if this is the kind of thing you're looking for, but here's a drag-and-drop grid I developed that might help you:
https://github.com/thquinn/DraggableGridView
It allows you to long press a child view and drag it to another position in the grid. It's animated, too!

Categories

Resources