Android Open Source - 5th Change Gesture Detector






From Project

Back to project page 5th.

License

The source code is released under:

GNU General Public License

If you think the Android project 5th listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

?
package com.zhanglin.practice;
/*from   w  w  w  . java 2  s  .  co m*/
import android.view.MotionEvent;
import android.view.GestureDetector.SimpleOnGestureListener;

public class ChangeGestureDetector extends SimpleOnGestureListener
{
  PlayingActivity activity;

  public ChangeGestureDetector(PlayingActivity activity)
  {
    this.activity=activity;
  }

  @Override
  public boolean onFling(MotionEvent e1,MotionEvent e2,float velocityX,float velocityY)
  {
    final int FLING_MIN_DISTANCE=100;// X??y????????(???)
    final int FLING_MIN_VELOCITY=200;// x??y???????(???/?)
    if((e1.getX()-e2.getX())>FLING_MIN_DISTANCE&&Math.abs(velocityX)>FLING_MIN_VELOCITY)
    {
      //activity.last();//?????????activity??????????
    }
    else if((e2.getX()-e1.getX())>FLING_MIN_DISTANCE&&Math.abs(velocityX)>FLING_MIN_VELOCITY)
    {
      //activity.next();//??????
    }
    PlayingActivity.gesture="true";
    return super.onFling(e1,e2,velocityX,velocityY);
  }

}




Java Source Code List

.AlbumActivity.java
.MainActivity.java
.PlayListActivity.java
.alb.java
.art.java
com.zhanglin.practice.About.java
com.zhanglin.practice.ArtistActivity.java
com.zhanglin.practice.ChangeGestureDetector.java
com.zhanglin.practice.DataBase.java
com.zhanglin.practice.MusicListAdapter.java
com.zhanglin.practice.PlayerServices.java
com.zhanglin.practice.PlayingActivity.java
com.zhanglin.practice.PublicList.java
com.zhanglin.practice.SetModeActivity.java
com.zhanglin.practice.SongsActivity.java
.formatTime.java