Commit 8012d716 authored by Thomas Krex's avatar Thomas Krex
Browse files

some code cleaning

parent 7b19ed58
......@@ -25,7 +25,7 @@ import android.os.Handler;
* Main class of the TTT-Recorder Android app. Manages interaction between
* front- and backend and handles the application logic (control flow).
*
* @author Dominik Schinner
* @author Dominik Schinner, Thomas Krex
*
*/
public class TTTRecorderAndroid implements Runnable {
......@@ -153,33 +153,6 @@ public class TTTRecorderAndroid implements Runnable {
}
}
/**
* runnable which ist posted to the main ui-thread for updating the view
*/
private final Runnable updateViewTask = new Runnable() {
@Override
public void run() {
imgv.invalidate();
}
};
/**
* runnable which ist posted to the main ui-thread for updating the
* annotation-view
*/
private final Runnable updateAnnotationTask = new Runnable() {
@Override
public void run() {
annotationView.invalidate();
}
};
public TTTRecorderAndroid(AnnotationView annotationView,
ScaleAwareImageView imgv, Handler levelHandler,
Handler uiThreadHandler, Context context) {
......@@ -240,7 +213,6 @@ public class TTTRecorderAndroid implements Runnable {
*/
public void updateView(final Bitmap bmp) {
// uiThreadHandler.post(new Runnable() {
uiThreadHandler.post(new Runnable() {
@Override
......
......@@ -3,7 +3,6 @@ package tttrec.core;
import java.util.Observable;
import tttrec.customviews.AnnotationView;
import tttrec.messages.Annotation;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.Canvas;
......@@ -144,11 +143,6 @@ public abstract class GraphicsContext extends Observable {
return color;
}
public void addAnnotation(Annotation annotation) {
// TODO Auto-generated method stub Android
}
public void scaleView(int screenWidth, int framebufferWidth) {
float scaleRatio = screenWidth / (float) framebufferWidth;
......
......@@ -30,6 +30,14 @@ public class AnnotationView extends View {
private Paint mPaint;
private float scaleRatio;
public void setScaleRatio(float scaleRatio) {
this.scaleRatio = scaleRatio;
}
public float getScaleRatio() {
return scaleRatio;
}
@Override
public void getHitRect(Rect outRect) {
super.getHitRect(outRect);
......@@ -95,14 +103,27 @@ public class AnnotationView extends View {
return whiteboardPage > 0;
}
// set whiteboard page and corresponding annotion buffer
/**
* Sets the number of the current white board page. This number determines
* if a white board is drawn. All current annotations are deleted and the
* redraw process is triggered.
*
* @param whiteboardPage
* Number of the current whiteboard page
*/
public void setWhiteboardPage(int whiteboardPage) {
this.whiteboardPage = whiteboardPage;
clearAnnotations();
invalidate();
}
// fill the canvas with white color and set the page number
/**
* Fills the canvas with white color. Draws the whiteboard number in the top
* right corner.
*
* @param canvas
* Canvas of the View
*/
public void paintWhiteboard(Canvas canvas) {
canvas.drawColor(Color.WHITE);
......@@ -110,13 +131,4 @@ public class AnnotationView extends View {
p.setTextSize(20);
canvas.drawText("#" + whiteboardPage, canvas.getWidth() - 30, 20, p);
}
public void setScaleRatio(float scaleRatio) {
this.scaleRatio = scaleRatio;
}
public float getScaleRatio() {
return scaleRatio;
}
}
......@@ -5,6 +5,7 @@ import tttrec.customviews.ScaleAwareImageView;
import tttrec.messages.FreehandAnnotation;
import tttrec.messages.HighlightAnnotation;
import android.graphics.Rect;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
......@@ -125,6 +126,8 @@ public class AnnotationCanvasTouchListener implements OnTouchListener {
case FREEHAND_MODE:
freehandAnno.addPoint((int) x, (int) y);
Log.d("AnnotationCanvasTouchListener: ",
"Annotation at x: " + x + " ,y: " + y);
break;
case HIGHLIGHT_MODE:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment