question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Member visibility issues with DragItemAdapter, and other issues

See original GitHub issue
  1. mDragItemId is private, i had to use reflection to get its value
  2. 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:closed
  • Created 4 years ago
  • Comments:20 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
woxblomcommented, Oct 18, 2019

Ah now I understand. I will put it on the todo list 😃

1reaction
Saad-e-Sayedcommented, Feb 15, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found