Android Open Source - NotATop Track






From Project

Back to project page NotATop.

License

The source code is released under:

GNU General Public License

If you think the Android project NotATop 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.gg.util;
//from   w  w  w.  j  av  a  2  s  .c o m
import java.util.ArrayList;
import android.view.MotionEvent;

public class Track {
  ArrayList<TrackPoint> list;
  ArrayList<TrackPoint> drawList;
  private Boolean touchFlag;
  private long startTime;
  
  public Track() {
    touchFlag = false;

    list = new ArrayList<TrackPoint>();
    drawList = new ArrayList<TrackPoint>();
  }
  
  public ArrayList<TrackPoint> getDrawList() {
    return drawList;
  }
  
  public ArrayList<TrackPoint> getList(){
    return list;
  }
  
  public void onTouchDown(MotionEvent e) {
    list.clear();
    touchFlag = true;
    startTime = System.currentTimeMillis();
    TrackPoint point = new TrackPoint(e.getX() , e.getY() , System.currentTimeMillis());
    list.add(point);
  }
  
  public void onTouchMove(MotionEvent e) {
    if((System.currentTimeMillis() - startTime) > 300){
      touchFlag = false;
//      list.clear();
      return;
    }else{
      TrackPoint point = new TrackPoint(e.getX() , e.getY() , System.currentTimeMillis());
      list.add(point);
      setPoint(list, drawList);
    }
  }
  
  public void onTouchUp(MotionEvent e) {
    TrackPoint point = new TrackPoint(e.getX() , e.getY() , System.currentTimeMillis());
    list.add(point);
    touchFlag = false;
  }
  
  public void setPoint(ArrayList<TrackPoint> list, ArrayList<TrackPoint> drawList) {
    drawList.clear();
    long currentTime = System.currentTimeMillis();
    //????????????????
    for(int i = 0; i < list.size(); i ++){            
      if((currentTime - list.get(i).birth) > 300){
        for(int j = list.size() -1 ; j > i ; j--){
          list.remove(j);
        }
        i = list.size();
      }
    }
    
    drawList.add(list.get(0));
    for(int i = 0; i < list.size() - 2; i ++){
      drawList.add(list.get(i).leftPoint(list.get(i), list.get(i + 1), list.get(i + 1).birth, list.get(list.size() - 1).birth));
      drawList.add(list.get(i).rightPoint(list.get(i), list.get(i + 1), list.get(i + 1).birth, list.get(list.size() - 1).birth));
    }
    drawList.add(list.get(list.size() - 1));
  }
}




Java Source Code List

com.gg.game.ClassicGame.java
com.gg.game.ClassicGame.java
com.gg.game.GameFrame.java
com.gg.game.GameFrame.java
com.gg.game.TimeGame.java
com.gg.game.TimeGame.java
com.gg.module.DrawBackground.java
com.gg.module.DrawBackground.java
com.gg.module.DrawScore.java
com.gg.module.DrawScore.java
com.gg.module.DrawTrack.java
com.gg.module.DrawTrack.java
com.gg.module.SelectControl.java
com.gg.module.SelectControl.java
com.gg.module.SoundControl.java
com.gg.module.SoundControl.java
com.gg.module.VoiceControl.java
com.gg.module.VoiceControl.java
com.gg.top.BasicTop.java
com.gg.top.BasicTop.java
com.gg.top.DrawCircle.java
com.gg.top.DrawCircle.java
com.gg.top.DrawCone.java
com.gg.top.DrawCone.java
com.gg.top.DrawCylinder.java
com.gg.top.DrawCylinder.java
com.gg.top.DrawTop.java
com.gg.top.DrawTop.java
com.gg.util.Circle.java
com.gg.util.Circle.java
com.gg.util.Constant.java
com.gg.util.Constant.java
com.gg.util.DateUtil.java
com.gg.util.DateUtil.java
com.gg.util.Direction.java
com.gg.util.Direction.java
com.gg.util.Line.java
com.gg.util.Line.java
com.gg.util.Point.java
com.gg.util.Point.java
com.gg.util.TextureRect.java
com.gg.util.TextureRect.java
com.gg.util.TrackPoint.java
com.gg.util.TrackPoint.java
com.gg.util.Track.java
com.gg.util.Track.java
com.gg.util.Utils.java
com.gg.util.Utils.java
com.gg.view.ClassicGameSurfaceView.java
com.gg.view.ClassicGameSurfaceView.java
com.gg.view.EndSurfaceView.java
com.gg.view.EndSurfaceView.java
com.gg.view.FirstTimeSurfaceView.java
com.gg.view.FirstTimeSurfaceView.java
com.gg.view.GameModeSurfaceView.java
com.gg.view.GameModeSurfaceView.java
com.gg.view.HelpSurfaceView.java
com.gg.view.HelpSurfaceView.java
com.gg.view.MainActivity.java
com.gg.view.MainActivity.java
com.gg.view.MainMenuSurfaceView.java
com.gg.view.MainMenuSurfaceView.java
com.gg.view.ScoreSurfaceView.java
com.gg.view.ScoreSurfaceView.java
com.gg.view.SelectSurfaceView.java
com.gg.view.SelectSurfaceView.java
com.gg.view.SurfaceViewFactory.java
com.gg.view.SurfaceViewFactory.java
com.gg.view.TimeGameSurfaceView.java
com.gg.view.TimeGameSurfaceView.java
com.gg.view.WelcomeSurfaceView.java
com.gg.view.WelcomeSurfaceView.java