Commit 7a504f44 authored by Thomas Krex's avatar Thomas Krex
Browse files

When stopping recording, the whiteboard is deactivated and the page number is reset.

parent 8012d716
......@@ -119,6 +119,7 @@ public class TTTRecorderAndroid implements Runnable {
whiteboardEnabled = false;
annotationView.setWhiteboardPage(0);
} else {
// prevents overflow of white board page number
if (page > 127) {
page = 127;
}
......@@ -143,14 +144,11 @@ public class TTTRecorderAndroid implements Runnable {
setWhiteboardPage(currentWhiteboardPage - 1);
}
public void stopRecording() {
try {
recorder.stopRec();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
public void resetWhiteboard() {
setWhiteboardPage(0);
currentWhiteboardPage = 0;
nextFreeWhiteboardNumber = 1;
updateAnnotationView();
}
public TTTRecorderAndroid(AnnotationView annotationView,
......@@ -264,13 +262,21 @@ public class TTTRecorderAndroid implements Runnable {
@Override
public void run() {
rfbProtocol = new RfbProtocol(rfbCon, imgv, annotationView, this,
context);
Thread t = new Thread(rfbProtocol);
t.start();
}
public void stopRecording() {
try {
recorder.stopRec();
resetWhiteboard();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void scaleView(int screenWidth) {
......
......@@ -7,7 +7,6 @@ import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.Canvas;
import android.graphics.Color;
import android.util.Log;
import android.view.ViewGroup.LayoutParams;
import android.widget.ImageView;
......@@ -37,9 +36,7 @@ public abstract class GraphicsContext extends Observable {
public Canvas mainVNCCanvas;
public void updateScaledBitmap() {
tttrec.updateImageView();
}
public ImageView imgView;
......@@ -70,8 +67,6 @@ public abstract class GraphicsContext extends Observable {
this.imgView = imgView;
this.annotationView = annV;
this.pixels = new int[prefs.framebufferWidth * prefs.framebufferHeight];
// currentAnnotations = new LinkedList<Annotation>();
}
public byte[] hextile_bg_encoded;
......@@ -88,15 +83,12 @@ public abstract class GraphicsContext extends Observable {
}
public void handleUpdatedPixels(int x, int y, int w, int h) {
mainVNCBitmap.setPixels(pixels, x + y * prefs.framebufferWidth,
prefs.framebufferWidth, x, y, w, h);
}
public void refresh(int x, int y, int w, int h) {
updateScaledBitmap();
}
public int decodeColor(byte[] colorField) {
......@@ -139,7 +131,6 @@ public abstract class GraphicsContext extends Observable {
| (color >> 16 & 0xFF) << 8 | color >> 24 & 0xFF;
}
}
return color;
}
......@@ -148,16 +139,12 @@ public abstract class GraphicsContext extends Observable {
float scaleRatio = screenWidth / (float) framebufferWidth;
annotationView.setScaleRatio(scaleRatio);
Log.d("Ratio", ": " + scaleRatio);
LayoutParams lp = imgView.getLayoutParams();
lp.height = (int) (scaleRatio * prefs.framebufferHeight);
imgView.setLayoutParams(lp);
imgView.postInvalidate();
LayoutParams alp = annotationView.getLayoutParams();
alp.height = lp.height;
alp.width = LayoutParams.MATCH_PARENT;
......@@ -165,6 +152,5 @@ public abstract class GraphicsContext extends Observable {
annotationView.getWidth();
annotationView.getHeight();
annotationView.postInvalidate();
}
}
This diff is collapsed.
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