Skip to content

Commit

Permalink
修改了右滑的错误动画
Browse files Browse the repository at this point in the history
  • Loading branch information
zzz40500 committed Jan 30, 2015
1 parent b654013 commit 38e4168
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 17 deletions.
Binary file modified Demo.apk
Binary file not shown.
11 changes: 0 additions & 11 deletions app/src/main/java/com/mingle/headsupdemo/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,6 @@ public class MainActivity extends ActionBarActivity {














@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand Down
12 changes: 6 additions & 6 deletions library/src/main/java/com/mingle/headsUp/FloatView.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import android.content.Context;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.VelocityTracker;
Expand Down Expand Up @@ -138,8 +139,7 @@ public boolean onTouchEvent(MotionEvent event) {
break;
case MotionEvent.ACTION_UP:
velocityTracker.computeCurrentVelocity(1000,maxVelocity);
int velocity= (int) velocityTracker.getYVelocity(pointerId);
double dis=distance.getSplineFlingDistance(velocity);
int dis= (int) velocityTracker.getYVelocity(pointerId);
if(scrollOrientationEnum==ScrollOrientationEnum.NONE){
if(headsUp.getNotification().contentIntent!=null){

Expand All @@ -160,12 +160,12 @@ public boolean onTouchEvent(MotionEvent event) {
}else{
toX= (int) (preLeft-Math.abs(dis));
}

if (toX < -validWidth) {
Log.e("toX"," "+toX);
if (toX <= -validWidth) {
float preAlpha=1-Math.abs(preLeft)/validWidth;
preAlpha=preAlpha>=0?preAlpha:0;
translationX(preLeft,validWidth+10,preAlpha,0);
} else if (toX < validWidth) {
translationX(preLeft,-(validWidth+10),preAlpha,0);
} else if (toX <= validWidth) {
float preAlpha=1-Math.abs(preLeft)/validWidth;
preAlpha=preAlpha>=0?preAlpha:0;
translationX(preLeft,0,preAlpha,1);
Expand Down

0 comments on commit 38e4168

Please sign in to comment.