aaronbond / Swipe-Deck

A Tinder style Swipeable deck view for Android
MIT License
797 stars 158 forks source link

Swiping left changing color value #67

Closed IOException722 closed 7 years ago

IOException722 commented 7 years ago

Swiping left or right giving mixed effect of like and dislike even I am swiping right continuously or left continuously.

Even I changed this source code with constrains like if alpha < 0 then dislike else like still it showing some blink(it is because alpha getting zero at some point of time while swiping continuously either side)??

IOException722 commented 7 years ago

fixed it by Changing these code in swipeListener.java

Instead of // rightView.setAlpha(alpha); // leftView.setAlpha(-alpha);

use below

                Log.e("Abhay","posx "+posX + " "+alpha);
                if(!Float.isNaN(alpha) && alpha<-1.0f)
                    alpha=-0.99f;
                if(!Float.isNaN(alpha) && alpha>1.0f)
                    alpha =0.99f;
                leftView.setAlpha(alpha < 0 ? -alpha : 0);
            rightView.setAlpha(alpha > 0 ? alpha : 0);