U
U
Username2016-06-02 10:22:00
Android
Username, 2016-06-02 10:22:00

How to make a preview imitating 3D touch (as in instagram)?

On Instagram, you can preview a post by holding the block with a photo, we want to implement the same in our application. How can this be implemented?
Who does not use instagram below attached a video with a time code.
https://youtu.be/AasLJJ-JDxQ?t=55s
_
_ when the dialog box is opened, the listener stops firing due to the overlap of the element.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Artem Gapchenko, 2016-06-02
@dalv_happy

Register an OnTouchEventListener for this view and listen for the MotionEvent.ACTION_DOWN and MotionEvent.ACTION_UP events. For the first one, wait 200-300 milliseconds, and if MotionEvent.ACTION_UP has not happened yet, open the dialog. When MotionEvent.ACTION_UP occurs, the dialog collapses.

I
IceJOKER, 2016-06-02
@IceJOKER

3D touch? :D
In my opinion, the usual longClick on the picture and some kind of DialogFragment)) I don’t understand what’s special

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question