Skip to content

Commit

Permalink
添加动画支持包
Browse files Browse the repository at this point in the history
  • Loading branch information
chiemy committed Aug 31, 2014
1 parent 59c2bc3 commit 796f6e0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 22 deletions.
2 changes: 1 addition & 1 deletion AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
android:versionName="1.0" >

<uses-sdk
android:minSdkVersion="14"
android:minSdkVersion="8"
android:targetSdkVersion="21" />

<application
Expand Down
Binary file added libs/nineoldandroids-2.4.0.jar
Binary file not shown.
13 changes: 0 additions & 13 deletions src/com/example/cviewpager/JellyPagerAdapter.java

This file was deleted.

17 changes: 9 additions & 8 deletions src/com/example/cviewpager/JellyViewPager.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.facebook.rebound.BaseSpringSystem;
import com.facebook.rebound.SimpleSpringListener;
import com.facebook.rebound.Spring;
import com.nineoldandroids.view.ViewHelper;

public class JellyViewPager extends ViewPager {
/**
Expand Down Expand Up @@ -220,8 +221,8 @@ protected void onLayout(boolean arg0, int arg1, int arg2, int arg3, int arg4) {
super.onLayout(arg0, arg1, arg2, arg3, arg4);
if(currentView == null){
currentView = getCurrentView();
currentView.setScaleX(MAX_SCALE);
currentView.setScaleY(MAX_SCALE);
ViewHelper.setScaleX(currentView, MAX_SCALE);
ViewHelper.setScaleY(currentView, MAX_SCALE);
currentView.getHitRect(currentViewRect);
}
mHeight = getHeight();
Expand Down Expand Up @@ -288,7 +289,7 @@ public void onSpringUpdate(Spring spring) {
float value = (float) spring.getCurrentValue();
String springId = spring.getId();
if (springId.equals(tranSpring.getId())) {
currentView.setTranslationY(value);
ViewHelper.setTranslationY(currentView, value);
if (spring.isAtRest()) {
if (value >= mHeight) {
nextPage();
Expand All @@ -297,10 +298,10 @@ public void onSpringUpdate(Spring spring) {
}
}
} else if (springId.equals(mScaleSpring.getId())) {
currentView.setScaleX(value);
currentView.setScaleY(value);
ViewHelper.setScaleX(currentView,value);
ViewHelper.setScaleY(currentView,value);
} else if (springId.equals(rotateSpring.getId())) {
currentView.setRotation(value);
ViewHelper.setRotation(currentView,value);
}
}
}
Expand All @@ -320,8 +321,8 @@ public void onPageSelected(int position) {
pageChangeListener.onPageSelected(position);
}
if (currentView != null) {
currentView.setTranslationY(0);
currentView.setRotation(0);
ViewHelper.setTranslationY(currentView,0);
ViewHelper.setRotation(currentView,0);
}
mScaleSpring.setCurrentValue(MIN_SCALE);
mScaleSpring.setEndValue(MAX_SCALE);
Expand Down

0 comments on commit 796f6e0

Please sign in to comment.