swipe icon indicating copy to clipboard operation
swipe copied to clipboard

Animatons with Swipe up and Down

Open MickeyT1997 opened this issue 6 years ago • 0 comments

Hi there,

Ive been using this library for navigation and a little animation with a WebView but currently I am trying to add a animation to shrink and expand the toolbar. It does shrink and expand, but say the toolbar is visible then it shouldn't re run the animation to show it. And vice-versa. Ive been with this issue for over a week now and am looking for others for help to figure this out. the code Im using is as follows:

 WebSwipe = new Swipe(350, 700);
   WebSwipe.setListener(new SwipeListener() {
            int vis = 0;
            @Override
            public void onSwipingLeft(final MotionEvent event) {
            }
            @Override
            public void onSwipedLeft(final MotionEvent event) {
            }
            @Override
            public void onSwipingRight(final MotionEvent event) {
            }
            @Override
            public void onSwipedRight(final MotionEvent event) {
            }
            @Override
            public void onSwipingUp(final MotionEvent event) {
            }
            @Override
            public void onSwipedUp(final MotionEvent event) {
                if(m_Toolbar.getVisibility() == View.VISIBLE){
                    Animation ToolbarGone = AnimationUtils.loadAnimation(CoreActivity.this, R.anim.m_toolbar_gone);
                    m_Toolbar.startAnimation(ToolbarGone);
                    vis = 1;
                }
                else {
                }
            }
            @Override
            public void onSwipingDown(final MotionEvent event) {
            }
            @Override
            public void onSwipedDown(final MotionEvent event) {
                if(m_Toolbar.getVisibility() == View.GONE
                        ||m_Toolbar.getVisibility() == View.INVISIBLE || vis ==1) {
                    Animation ToolbarVisible = AnimationUtils.loadAnimation(CoreActivity.this, R.anim.m_toolbar_visible);
                    m_Toolbar.startAnimation(ToolbarVisible);
                    vis = 2;
                }
                else{
                    if(vis == 2){
                        ToolbarVisible.setRepeatMode(Animation.INFINITE);
                    }
                }
 }

Ive asked around StackOverflow for help but they advised I use a if statement or a variable but this doesn't solve the problem. Im pretty well trying to not rerun the same code if the toolbar is there but can't find a way around it to do it

MickeyT1997 avatar Jan 18 '18 16:01 MickeyT1997