Quantcast
Channel: WP快站
Viewing all articles
Browse latest Browse all 233

Android Java Play gifs only once time

$
0
0

I want geese when a user double-clicks on a post a gif is played. For this I used pl.droidsonroids.gif.GifImageView like so:

<pl.droidsonroids.gif.GifImageView            android:layout_width="match_parent"            android:layout_height="303dp"            android:src="@drawable/likepopgif"            android:visibility="invisible"            />

and to get it started I just used visible and invisible when needed:

 holder.imgPost.setOnTouchListener(new View.OnTouchListener() {                    @SuppressLint("ClickableViewAccessibility")                    GestureDetector gestureDetector = new GestureDetector(getApplicationContext(), new GestureDetector.SimpleOnGestureListener(){                        @SuppressLint("ClickableViewAccessibility")                        @Override                        public boolean onDoubleTap(MotionEvent e) {                            Toast.makeText(visualizzaPost.this, "Liked post", Toast.LENGTH_SHORT).show();                            holder.gifLike.setVisibility(View.VISIBLE);                            holder.gifLike.setVisibility(View.INVISIBLE);                            return super.onDoubleTap(e);                        }                    });                    @Override                    public boolean onTouch(View v, MotionEvent event) {                        gestureDetector.onTouchEvent(event);                        return false;                    }                });

obviously, however, the invisible is asynchronous with the seconds of the animation length. I'm looking for an event / property or anything else that tells the app when the animation has played and then I can make it invisible.

if i use app:loopCount="1" remains immoral when the loop ends in this way:

enter image description here


Viewing all articles
Browse latest Browse all 233

Trending Articles