Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jonas Gehring
committed
Feb 23, 2017
1 parent
940d6e5
commit 3ae8a21
Showing
7 changed files
with
96 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.jjoe64.graphview; | ||
|
||
import android.graphics.Canvas; | ||
import android.graphics.Color; | ||
import android.graphics.Paint; | ||
import android.support.v4.view.ViewCompat; | ||
import android.util.Log; | ||
import android.view.MotionEvent; | ||
|
||
/** | ||
* Created by jonas on 22/02/2017. | ||
*/ | ||
|
||
public class CursorMode { | ||
protected final Paint mPaintLine; | ||
protected final GraphView mGraphView; | ||
protected float mPosX; | ||
protected boolean mVisible; | ||
|
||
public CursorMode(GraphView graphView) { | ||
mGraphView = graphView; | ||
mPaintLine = new Paint(); | ||
mPaintLine.setColor(Color.argb(128, 180, 180, 180)); | ||
mPaintLine.setStrokeWidth(10f); | ||
} | ||
|
||
public void onDown(MotionEvent e) { | ||
mPosX = e.getX(); | ||
mVisible = true; | ||
mGraphView.invalidate(); | ||
} | ||
|
||
public void onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { | ||
} | ||
|
||
public void draw(Canvas canvas) { | ||
if (!mVisible) return; | ||
|
||
canvas.drawLine(mPosX, 0, mPosX, canvas.getHeight(), mPaintLine); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters