Skip to content

Commit ab53bc1

Browse files
Merge pull request #37 from wajahatkarim3/flipType_flipDirection_issue_fix
Adds setter/getter for flipType and flipDirection and fixes issue #35
2 parents 9d118e2 + 83f094f commit ab53bc1

File tree

3 files changed

+94
-0
lines changed

3 files changed

+94
-0
lines changed

EasyFlipView/src/main/java/com/wajahatkarim3/easyflipview/EasyFlipView.java

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,92 @@ public void setAnimFlipInId(@AnimatorRes int animFlipInId) {
580580
}
581581
*/
582582

583+
/**
584+
* Returns true if the Flip Type of animation is Horizontal?
585+
*/
586+
public boolean isHorizontalType()
587+
{
588+
return flipType.equals("horizontal");
589+
}
590+
591+
/**
592+
* Returns true if the Flip Type of animation is Vertical?
593+
*/
594+
public boolean isVerticalType()
595+
{
596+
return flipType.equals("vertical");
597+
}
598+
599+
/**
600+
* Sets the Flip Type of animation to Horizontal
601+
*/
602+
public void setToHorizontalType()
603+
{
604+
flipType = "horizontal";
605+
loadAnimations();
606+
}
607+
608+
/**
609+
* Sets the Flip Type of animation to Vertical
610+
*/
611+
public void setToVerticalType()
612+
{
613+
flipType = "vertical";
614+
loadAnimations();
615+
}
616+
617+
/**
618+
* Sets the flip type from direction to right
619+
*/
620+
public void setFlipTypeFromRight()
621+
{
622+
if (flipType.equals("horizontal"))
623+
flipTypeFrom = "right";
624+
else flipTypeFrom = "front";
625+
loadAnimations();
626+
}
627+
628+
/**
629+
* Sets the flip type from direction to left
630+
*/
631+
public void setFlipTypeFromLeft()
632+
{
633+
if (flipType.equals("horizontal"))
634+
flipTypeFrom = "left";
635+
else flipTypeFrom = "back";
636+
loadAnimations();
637+
}
638+
639+
/**
640+
* Sets the flip type from direction to front
641+
*/
642+
public void setFlipTypeFromFront()
643+
{
644+
if (flipType.equals("vertical"))
645+
flipTypeFrom = "front";
646+
else flipTypeFrom = "right";
647+
loadAnimations();
648+
}
649+
650+
/**
651+
* Sets the flip type from direction to back
652+
*/
653+
public void setFlipTypeFromBack()
654+
{
655+
if (flipType.equals("vertical"))
656+
flipTypeFrom = "back";
657+
else flipTypeFrom = "left";
658+
loadAnimations();
659+
}
660+
661+
/**
662+
* Returns the flip type from direction. For horizontal, it will be either right or left and for vertical, it will be front or back.
663+
*/
664+
public String getFlipTypeFrom()
665+
{
666+
return flipTypeFrom;
667+
}
668+
583669
/**
584670
* The Flip Animation Listener for animations and flipping complete listeners
585671
*/

app/src/main/java/com/wajahatkarim3/easyflipview/demo/SimpleViewFlipActivity.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,13 @@ public void onViewFlipCompleted(EasyFlipView easyFlipView, EasyFlipView.FlipStat
4444
"Flip Completed! New Side is: " + newCurrentSide, Toast.LENGTH_LONG).show();
4545
}
4646
});
47+
48+
49+
50+
final EasyFlipView easyFlipView2 = (EasyFlipView) findViewById(R.id.easyFlipView2);
51+
easyFlipView2.setToHorizontalType();
52+
easyFlipView2.setFlipTypeFromLeft();
53+
54+
4755
}
4856
}
298 KB
Loading

0 commit comments

Comments
 (0)