Skip to content

Commit

Permalink
Added animation type to library.
Browse files Browse the repository at this point in the history
  • Loading branch information
fevziomurtekin committed Jul 1, 2019
1 parent 27550ba commit 0d18d69
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 12 deletions.
8 changes: 8 additions & 0 deletions .idea/markdown-exported-files.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/markdown-navigator.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ dependencies {

## Features

- [ ] Horizontal/vertical Animation.
- [x] Horizontal/vertical Animation.
- [ ] Card design programmatically will changed.

## License
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
app:cardYearTextSize="13"
app:cardNameTextSize="15"
app:cardMonthTextSize="13"
app:cardAnimationType="vertical"
/>

</RelativeLayout>
32 changes: 26 additions & 6 deletions payview/src/main/java/com/fevziomurtekin/payview/Payview.kt
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class Payview : NestedScrollView, View.OnFocusChangeListener {

private var cardType : CardType = CardType.MASTERCARD


private var cardAnimationType:Int = AnimationType.HORIZONTAL

constructor(context:Context) : super(context) { init(context,null,0,0) }

Expand Down Expand Up @@ -122,7 +122,7 @@ class Payview : NestedScrollView, View.OnFocusChangeListener {
cardYearTextSize=it.getInt(R.styleable.Payview_cardYearTextSize,13)
cardMonthTextSize=it.getInt(R.styleable.Payview_cardMonthTextSize,13)
cardCvTextSize=it.getInt(R.styleable.Payview_cardCvTextSize,14)
animationType = it.getInteger(R.styleable.Payview_cardAnimationType,AnimationType.HORIZONTAL)
cardAnimationType=it.getInt(R.styleable.Payview_cardAnimationType,AnimationType.HORIZONTAL)
initViews()
initData()
}
Expand Down Expand Up @@ -360,11 +360,21 @@ class Payview : NestedScrollView, View.OnFocusChangeListener {
private fun showAnimation(mood: Char){
System.gc()
if(mood == 'o' && mood != lastMood){
val set = AnimatorInflater.loadAnimator(this@Payview.context, R.animator.front_horizontal_in) as AnimatorSet
val set = AnimatorInflater.loadAnimator(this@Payview.context,
if(cardAnimationType == AnimationType.HORIZONTAL)
R.animator.front_horizontal_in
else
R.animator.front_vertical_in
) as AnimatorSet
set.apply {
setTarget(rl_front)
}
val set1 = AnimatorInflater.loadAnimator(this@Payview.context, R.animator.front_horizontal_out) as AnimatorSet
val set1 = AnimatorInflater.loadAnimator(this@Payview.context,
if(cardAnimationType == AnimationType.HORIZONTAL)
R.animator.front_horizontal_out
else
R.animator.front_vertical_out
) as AnimatorSet
set1.apply {
setTarget(rl_back)
}
Expand All @@ -374,11 +384,21 @@ class Payview : NestedScrollView, View.OnFocusChangeListener {
animator.start()

}else if (mood == 'i' && mood!=lastMood){
val set = AnimatorInflater.loadAnimator(this@Payview.context, R.animator.back_horizontal_in) as AnimatorSet
val set = AnimatorInflater.loadAnimator(this@Payview.context,
if(cardAnimationType == AnimationType.HORIZONTAL)
R.animator.back_horizontal_in
else
R.animator.back_vertical_in
) as AnimatorSet
set.apply {
setTarget(rl_front)
}
val set1 = AnimatorInflater.loadAnimator(this@Payview.context, R.animator.back_horizontal_out) as AnimatorSet
val set1 = AnimatorInflater.loadAnimator(this@Payview.context,
if(cardAnimationType == AnimationType.HORIZONTAL)
R.animator.back_horizontal_out
else
R.animator.back_vertical_out
) as AnimatorSet
set1.apply {
setTarget(rl_back)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.fevziomurtekin.payview.commons

enum class AnimationType {
HORIZONTAL,
VERTICAL
}
annotation class AnimationType {
companion object {
val HORIZONTAL=0
val VERTICAL=1
}
}

0 comments on commit 0d18d69

Please sign in to comment.