Android Open Source - AndroidTouchEditableListView Touch Data






From Project

Back to project page AndroidTouchEditableListView.

License

The source code is released under:

Copyright (c) 2014 Serge Desmedt Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Soft...

If you think the Android project AndroidTouchEditableListView 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 be.trojkasoftware.android.touch;
//  w  w  w .  ja  va  2  s . c om
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class TouchData {
  public TouchData() {
    this(2);
  }
  
  public TouchData(int historySize) {
    historyPosXMove = new ArrayList();
    historyPosYMove = new ArrayList();
    mHistorySize = historySize;
  }
  
  public static int INVALID = Integer.MIN_VALUE;
  
  public int posXDown;
  public int posYDown;
  
  public void pushMove(int X, int Y) {
    historyPosXMove.add(0, X);
    historyPosYMove.add(0, Y);

    if(historyPosXMove.size() > mHistorySize) {
      historyPosXMove.remove(historyPosXMove.size() - 1);
    }
    if(historyPosYMove.size() > mHistorySize) {
      historyPosYMove.remove(historyPosYMove.size() - 1);
    }
  }
  
  public int getMoveX(int index) {
    if (historyPosXMove.size() < index + 1) {
      return historyPosXMove.get(historyPosXMove.size() - 1);
    }
    return historyPosXMove.get(index);
  }
  
  public int getMoveY(int index) {
    if (historyPosYMove.size() < index + 1) {
      return historyPosYMove.get(historyPosYMove.size() - 1);
    }
    return historyPosYMove.get(index);
  }
  
  public boolean isValid() {
    return ((posXUp != INVALID) || (posYUp != INVALID));
  }
  
  public int posXUp = INVALID;
  public int posYUp = INVALID;
  public Map<Integer, Integer> posXOnPointerDown = new HashMap<Integer, Integer>();
  public Map<Integer, Integer> posYOnPointerDown = new HashMap<Integer, Integer>();
  public Map<Integer, Integer> posXOnPointerUp = new HashMap<Integer, Integer>();
  public Map<Integer, Integer> posYOnPointerUp = new HashMap<Integer, Integer>();

  private int mHistorySize;
  //public int lastPosXMove;
  private List<Integer> historyPosXMove;
  //public int lastPosYMove;
  private List<Integer> historyPosYMove;
}




Java Source Code List

be.trojkasoftware.android.obsolete.TouchEditableDividerDrawable.java
be.trojkasoftware.android.obsolete.TouchEditableInsertManager.java
be.trojkasoftware.android.obsolete.TouchEditableListView10.java
be.trojkasoftware.android.obsolete.TouchEditableListView20.java
be.trojkasoftware.android.obsolete.TouchEditableListView2.java
be.trojkasoftware.android.sample.AndroidTouchEditableListViewSampleActivity.java
be.trojkasoftware.android.sample.CustomEditableArrayAdapter.java
be.trojkasoftware.android.touch.TouchDataStore.java
be.trojkasoftware.android.touch.TouchData.java
be.trojkasoftware.android.toucheditablelistview.EditableArrayAdapter.java
be.trojkasoftware.android.toucheditablelistview.TouchEditableActionView.java
be.trojkasoftware.android.toucheditablelistview.TouchEditableItemView.java
be.trojkasoftware.android.toucheditablelistview.TouchEditableListView.java
be.trojkasoftware.android.toucheditablelistview.TouchEditableStateManager.java