Commit 6d90ee31 authored by Thomas Krex's avatar Thomas Krex

anpassung des layouts für alle displaygrößen

(layout_weight)
-problem mit höhe der imagebuttons gelöst
-sklaierung wird nun vollständig von android übernommen
parent c5e680f4
# cache for current jar dependency. DO NOT EDIT.
# format is <lastModified> <length> <SHA-1> <path>
# Encoding is UTF-8
......@@ -18,30 +18,29 @@
android:id="@+id/playerView_fullscreen"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" />
android:scaleType="centerInside" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
android:orientation="horizontal"
android:weightSum="3" >
<ScrollView
android:id="@+id/indexScrollView"
android:layout_width="300dp"
android:layout_height="fill_parent"
android:layout_weight="3"
android:fillViewport="true"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:fillViewport="false"
android:paddingLeft="5dip" >
</ScrollView>
<ImageView
android:id="@+id/playerView_extended"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_toRightOf="@+id/scrollView1"
android:layout_weight="5"
android:layout_weight="2"
android:background="@drawable/my_border"
android:padding="10dip"
android:scaleType="centerInside"
......
......@@ -151,8 +151,8 @@ public class PlayerActivity extends Activity implements MediaPlayerControl {
recording.getIndex().search(word);
// update display if recording is not playing
if (!recording.isPlaying())
recording.graphicsContext().updateCanvas();
// if (!recording.isPlaying())
recording.graphicsContext().updateCanvas();
}
......@@ -308,7 +308,6 @@ public class PlayerActivity extends Activity implements MediaPlayerControl {
if (index == 1) {
imgV = (ImageView) findViewById(R.id.playerView_extended);
recording.graphicsContext().setImageView(imgV);
recording.graphicsContext().setImageView(imgV);
recording.graphicsContext().refresh();
switcher.setDisplayedChild(1);
......
......@@ -25,7 +25,6 @@
package tttclient.messages;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import tttclient.ttt.Constants;
......@@ -76,16 +75,6 @@ public class CopyRectMessage extends FramebufferUpdateMessage {
******************************************************************************************************************/
// write message to TTT output stream
@Override
public void write(DataOutputStream out, int writeTimestamp)
throws IOException {
// header
writeHeader(out, writeTimestamp);
out.writeShort(x);
out.writeShort(y);
out.writeShort(width);
out.writeShort(height);
};
// return size of message in bytes (if written to stream)
@Override
......
......@@ -293,21 +293,6 @@ public class CursorMessage extends FramebufferUpdateMessage {
* write message
******************************************************************************************************************/
// write message to TTT output stream
@Override
public void write(DataOutputStream out, int writeTimestamp)
throws IOException {
// header
writeHeader(out, writeTimestamp);
out.writeShort(x);
out.writeShort(y);
out.writeShort(width);
out.writeShort(height);
// encoded data
out.write(data);
};
// return size of message in bytes (if written to stream)
@Override
public int getSize() {
......
......@@ -25,7 +25,6 @@
package tttclient.messages;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import tttclient.ttt.Constants;
......@@ -68,15 +67,6 @@ public class CursorPositionMessage extends FramebufferUpdateMessage {
* write message
******************************************************************************************************************/
// write message to TTT output stream
@Override
public void write(DataOutputStream out, int writeTimestamp)
throws IOException {
writeHeader(out, writeTimestamp);
out.writeShort(x);
out.writeShort(y);
};
// return size of message in bytes (if written to stream)
@Override
public int getSize() {
......
......@@ -25,7 +25,6 @@
package tttclient.messages;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import tttclient.ttt.Constants;
......@@ -78,19 +77,6 @@ public abstract class FramebufferUpdateMessage extends Message {
******************************************************************************************************************/
// write message to TTT output stream
@Override
public void write(DataOutputStream out, int writeTimestamp)
throws IOException {
// header
// writeHeader(out, writeTimestamp);
out.writeShort(x);
out.writeShort(y);
out.writeShort(width);
out.writeShort(height);
// encoded data
out.write(data);
};
// return size of message in bytes (if written to stream)
@Override
......
......@@ -24,12 +24,14 @@
package tttclient.messages;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import tttclient.messages.annotations.DeleteAllAnnotation;
import tttclient.messages.annotations.DeleteAnnotation;
import tttclient.messages.annotations.FreehandAnnotation;
import tttclient.messages.annotations.HighlightAnnotation;
import tttclient.messages.annotations.LineAnnotation;
import tttclient.messages.annotations.RectangleAnnotation;
import tttclient.ttt.Constants;
import tttclient.ttt.GraphicsContext;
import tttclient.ttt.ProtocolPreferences;
......@@ -84,39 +86,39 @@ public abstract class Message {
static final public int TIMESTAMP_OF_MESSAGE = -2;
// write message to TTT output stream
abstract public void write(DataOutputStream out, int writeTimestamp)
throws IOException;
// helper method to write message header, because it's the same for all
// messages
final void writeHeader(DataOutputStream out, int writeTimestamp)
throws IOException {
switch (writeTimestamp) {
case NO_TIMESTAMP:
// size of message
out.writeInt(getSize());
// encoding without timestamp
out.writeByte(getEncoding());
break;
case TIMESTAMP_OF_MESSAGE:
// size of message
out.writeInt(getSize() + 4);
// encoding and timestamp
out.writeByte(getEncoding() | Constants.EncodingFlagTimestamp);
out.writeInt(getTimestamp());
break;
default:
// size of message
out.writeInt(getSize() + 4);
// encoding and timestamp
out.writeByte(getEncoding() | Constants.EncodingFlagTimestamp);
out.writeInt(writeTimestamp);
break;
}
}
// abstract public void write(DataOutputStream out, int writeTimestamp)
// throws IOException;
//
// // helper method to write message header, because it's the same for all
// // messages
// final void writeHeader(DataOutputStream out, int writeTimestamp)
// throws IOException {
// switch (writeTimestamp) {
// case NO_TIMESTAMP:
// // size of message
// out.writeInt(getSize());
// // encoding without timestamp
// out.writeByte(getEncoding());
// break;
//
// case TIMESTAMP_OF_MESSAGE:
// // size of message
// out.writeInt(getSize() + 4);
// // encoding and timestamp
// out.writeByte(getEncoding() | Constants.EncodingFlagTimestamp);
// out.writeInt(getTimestamp());
// break;
//
// default:
// // size of message
// out.writeInt(getSize() + 4);
// // encoding and timestamp
// out.writeByte(getEncoding() | Constants.EncodingFlagTimestamp);
// out.writeInt(writeTimestamp);
//
// break;
// }
// }
// return size of message in bytes (if written to stream)
abstract public int getSize();
......@@ -169,17 +171,17 @@ public abstract class Message {
// read body
switch (encoding) {
// case Constants.AnnotationRectangle:
// message = new RectangleAnnotation(timestamp, in);
// break;
case Constants.AnnotationRectangle:
message = new RectangleAnnotation(timestamp, in);
break;
//
case Constants.AnnotationHighlight:
message = new HighlightAnnotation(timestamp, in);
break;
//
// case Constants.AnnotationLine:
// message = new LineAnnotation(timestamp, in);
// break;
case Constants.AnnotationLine:
message = new LineAnnotation(timestamp, in);
break;
//
case Constants.AnnotationFreehand:
message = new FreehandAnnotation(timestamp, in);
......@@ -193,9 +195,9 @@ public abstract class Message {
// message = new TextAnnotation(timestamp, in); // MODMSG
// break;
//
// case Constants.AnnotationDelete:
// message = new DeleteAnnotation(timestamp, in);
// break;
case Constants.AnnotationDelete:
message = new DeleteAnnotation(timestamp, in);
break;
//
case Constants.AnnotationDeleteAll:
message = new DeleteAllAnnotation(timestamp);
......
......@@ -25,7 +25,6 @@
package tttclient.messages;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.EOFException;
import java.io.IOException;
import java.util.ArrayList;
......@@ -181,36 +180,6 @@ public class Messages {
return total;
}
/*******************************************************************************************************************
* write messages
******************************************************************************************************************/
public void writeMessages(DataOutputStream out) throws IOException {
// write all messages
System.out.print("writing ");
int lastTimestamp = -1; // causes first message including timestamp
for (int i = 0; i < messages.size(); i++) {
Message message = messages.get(i);
// write message (with timestamp if needed)
int timestamp = message.getTimestamp();
if (timestamp == lastTimestamp)
message.write(out, Message.NO_TIMESTAMP);
else
message.write(out, timestamp);
lastTimestamp = timestamp;
if (i % 1000 == 0)
System.out.print(".");
}
out.close();
System.out.println(" done.");
}
/*******************************************************************************************************************
* keyframes *
******************************************************************************************************************/
......
......@@ -183,21 +183,6 @@ public class RawMessage extends FramebufferUpdateMessage {
* write message
******************************************************************************************************************/
// write message to TTT output stream
@Override
public void write(DataOutputStream out, int writeTimestamp)
throws IOException {
// header
writeHeader(out, writeTimestamp);
out.writeShort(x);
out.writeShort(y);
out.writeShort(width);
out.writeShort(height);
// encoded data
out.write(data);
};
// return size of message in bytes (if written to stream)
@Override
public int getSize() {
......
......@@ -24,9 +24,6 @@
*/
package tttclient.messages;
import java.io.DataOutputStream;
import java.io.IOException;
import tttclient.ttt.Constants;
import tttclient.ttt.GraphicsContext;
import tttclient.ttt.ProtocolPreferences;
......@@ -77,14 +74,6 @@ public class WhiteboardMessage extends FramebufferUpdateMessage {
* write message
******************************************************************************************************************/
// write message to TTT output stream
@Override
public void write(DataOutputStream out, int writeTimestamp)
throws IOException {
writeHeader(out, writeTimestamp);
out.writeByte(pageNumber);
};
// return size of message in bytes (if written to stream)
@Override
public int getSize() {
......
......@@ -24,9 +24,6 @@
*/
package tttclient.messages.annotations;
import java.io.DataOutputStream;
import java.io.IOException;
import tttclient.ttt.Constants;
import tttclient.ttt.GraphicsContext;
import android.graphics.Bitmap;
......@@ -75,11 +72,6 @@ public class DeleteAllAnnotation extends Annotation {
******************************************************************************************************************/
// write message to TTT output stream
@Override
public void write(DataOutputStream out, int writeTimestamp)
throws IOException {
};
// return size of message in bytes (if written to stream)
@Override
......
// TeleTeachingTool - Presentation Recording With Automated Indexing
//
// Copyright (C) 2003-2008 Peter Ziewer - Technische Universit?t M?nchen
//
// This file is part of TeleTeachingTool.
//
// TeleTeachingTool is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// TeleTeachingTool is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with TeleTeachingTool. If not, see <http://www.gnu.org/licenses/>.
/*
* Created on 13.01.2006
*
* Author: Peter Ziewer, TU Munich, Germany - ziewer@in.tum.de
*/
package tttclient.messages.annotations;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.OutputStream;
import tttclient.ttt.Constants;
import tttclient.ttt.GraphicsContext;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Rect;
public class DeleteAnnotation extends Annotation {
private final int x, y;
public DeleteAnnotation(int timestamp, int x, int y) {
this.timestamp = timestamp;
this.x = x;
this.y = y;
}
public DeleteAnnotation(int timestamp, DataInputStream in)
throws IOException {
this(timestamp, in.readUnsignedShort(), in.readUnsignedShort());
}
@Override
public void paint(GraphicsContext graphicsContext) {
graphicsContext.removeAnnotationsAt(x, y);
graphicsContext.refresh();
}
@Override
public void paint(Canvas canvas) {
// should never be called for Delete
}
public void paint(Canvas canvas, double scale) {
paint(canvas);
}
@Override
public Rect getBounds() {
return null;
}
@Override
public boolean contains(int x, int y) {
return false;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
@Override
public int getEncoding() {
return Constants.AnnotationDelete;
}
public void write(OutputStream outputStream) throws IOException {
}
/*******************************************************************************************************************
* write message
******************************************************************************************************************/
// return size of message in bytes (if written to stream)
@Override
public int getSize() {
return 5;
}
@Override
public void paintToThumbnail(Bitmap bitmap) {
// TODO Auto-generated method stub
}
}
......@@ -25,7 +25,6 @@
package tttclient.messages.annotations;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import tttclient.ttt.Constants;
......@@ -157,24 +156,6 @@ public class FreehandAnnotation extends Annotation {
* write message
******************************************************************************************************************/
// write message to TTT output stream
@Override
public void write(DataOutputStream out, int writeTimestamp)
throws IOException {
// writeHeader(out, writeTimestamp);
// out.writeByte(color);
// out.writeShort(count);
//
// PathIterator iterator = path.getPathIterator(null);
// double[] point = new double[6];
// for (int i = 0; i < count; i++) {
// iterator.currentSegment(point);
// out.writeShort((int) point[0]);
// out.writeShort((int) point[1]);
// iterator.next();
// }
}
// return size of message in bytes (if written to stream)
@Override
public int getSize() {
......
......@@ -25,7 +25,6 @@
package tttclient.messages.annotations;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import tttclient.ttt.Constants;
......@@ -155,13 +154,6 @@ public class HighlightAnnotation extends SimpleAnnotation {
canvas.drawRect(rect, borderPaint);
}
@Override
public void write(DataOutputStream out, int writeTimestamp)
throws IOException {
// TODO Auto-generated method stub
}
@Override
public int getSize() {
// TODO Auto-generated method stub
......
......@@ -25,7 +25,6 @@
package tttclient.messages.annotations;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import tttclient.ttt.Constants;
......@@ -91,13 +90,6 @@ public class LineAnnotation extends SimpleAnnotation {
+ endx + "," + endy + ")]";
}
@Override
public void write(DataOutputStream out, int writeTimestamp)
throws IOException {
// TODO Auto-generated method stub
}
@Override
public int getSize() {
// TODO Auto-generated method stub
......
......@@ -25,7 +25,6 @@
package tttclient.messages.annotations;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import tttclient.ttt.Constants;
......@@ -139,13 +138,6 @@ public class RectangleAnnotation extends SimpleAnnotation {
+ bounds.top + ")]" : "");
}
@Override
public void write(DataOutputStream out, int writeTimestamp)
throws IOException {
// TODO Auto-generated method stub
}
@Override
public int getSize() {
// TODO Auto-generated method stub
......
......@@ -34,7 +34,7 @@ public class GraphicsContext implements MessageConsumer {
static float SCALE_Y_EXTENDED;
private final Handler viewHandler;
public Handler sizeHandler;
private final Handler scrollHandler;
private final BitmapContainer bitmapContainer;
private final Canvas canvas;
......@@ -101,10 +101,22 @@ public class GraphicsContext implements MessageConsumer {
paintAnnotations(canvas);
recording.highlightSearchResults(canvas);
imgView.setImageBitmap(bitmap);
}
};
scrollHandler = new Handler(Looper.getMainLooper()) {
@Override
public void handleMessage(android.os.Message inputMessage) {
// Gets the image task from the incoming Message object.
int indexNumber = inputMessage.arg1;
int color = inputMessage.arg2;
recording.getIndex().get(indexNumber - 1)
.setBackgroundColor(color);
}
};
}
public void setSurfaceView(SurfaceView surfaceView) {
......@@ -196,6 +208,10 @@ public class GraphicsContext implements MessageConsumer {
return hextile_fg_encoded;
}
public Handler getScrollHandler() {
return this.scrollHandler;
}
// draw Canvas on current Bitmap
public void updateCanvas() {
if (refreshEnabled) {
......@@ -272,6 +288,7 @@ public class GraphicsContext implements MessageConsumer {
bitmapContainer.getBimap().setPixels(pixels,
x + y * prefs.framebufferWidth, prefs.framebufferWidth, x,
y, w, h);
Rect change = new Rect(x, y, x + w, y + h);
// bitmapContainer.getBimap().setPixels(pixels, 0,
// prefs.framebufferWidth, 0, 0, prefs.framebufferWidth,
......
......@@ -463,7 +463,7 @@ public class Index {
Bitmap scaled = Bitmap.createScaledBitmap(screenshot, scaledWidth,
scaledHeight, true);
indexEntry.setThumbnail(scaled);
indexEntry.setThumbnail(screenshot);
}
......
......@@ -9,10 +9,10 @@ import tttclient.messages.annotations.HighlightAnnotation;
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.os.Build;
import android.view.View;
import android.widget.ImageButton;
......@@ -37,7 +37,13 @@ public class IndexEntry extends ImageButton {
this.searchbase_of_page = searchableText;
this.thumbnail = thumbnail;
this.setBackgroundColor(Color.WHITE);
// this.setLayoutParams(new LinearLayout.LayoutParams(
// LinearLayout.LayoutParams.WRAP_CONTENT,
// LinearLayout.LayoutParams.WRAP_CONTENT));
this.setScaleType(ScaleType.CENTER_INSIDE);
// needed to get correct height
this.setAdjustViewBounds(true);
this.setOnClickListener(new OnClickListener() {
@Override
......@@ -216,16 +222,21 @@ public class IndexEntry extends ImageButton {