Member visibility issues with DragItemAdapter, and other issues
See original GitHub issue- mDragItemId is private, i had to use reflection to get its value
- setDragStartCallback in ViewHolder is public, but its argument is package private, so i can not override that method anyway
I bumped in this issue because i needed to implement a custom drawing for an empty space, it was achieved by alternating item appearance during binding of view holder and it was troublesome. Also I had to directly manipulate a view tree to achieve the same behavior for columns.
Also i had to use the trick below to achieve visually appealing jump for column when it’s ready to be dragged
override fun onStartDragAnimation(dragView: View) {
// ATTENTION: dirty hacky games with reflection
try {
val method = this.javaClass.superclass.getDeclaredMethod(
"setAnimationDY",
Float::class.java
)
method.isAccessible = true
method.invoke(this, targetElevation)
} catch (ex: Throwable) {
// Just ignore if no success
Timber.e(ex)
}
val container = dragView as ConstraintLayout
ObjectAnimator.ofFloat(container, ELEVATION, targetElevation).apply {
interpolator = DecelerateInterpolator()
duration = ANIMATION_DURATION
start()
}
}
In conclusion, the library is great, but lacks flexibility
Issue Analytics
- State:
- Created 4 years ago
- Comments:20 (9 by maintainers)
Top Results From Across the Web
Member visibility issues with DragItemAdapter, and other issues
1) mDragItemId is private, i had to use reflection to get its value2) setDragStartCallback in ViewHolder is public, but...
Read more >Member visibility issues with DragItemAdapter, and other issues
1) mDragItemId is private, i had to use reflection to get its value 2) setDragStartCallback in ViewHolder is public, but its argument is...
Read more >unable to drag normally · Issue #88 · woxblom/DragListView
After adding holder.itemView.setVisibility(View.VISIBLE); after super() in onBindViewHolder() it works as it should. Why library is messing with ...
Read more >Cannot change project visibility from Private (even when owner)
Summary. Despite being Owner, I cannot change the visibility of the project, but can change it via the API...which to me seems like...
Read more >Drag and drop to reorder items in a list, grid or board for Android ...
Drag and drop to reorder items in a list, grid or board for Android. Based on RecyclerView. Also supports swiping items in a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ah now I understand. I will put it on the todo list 😃
Thank you sir. It finally worked! I can’t wait until I do it in my main project. And I will watch out for that small mistake in the next times for sure.