Commit 8d0f3273 authored by Thomas Krex's avatar Thomas Krex

backup vor neuem versuch

parent 704a4711
# cache for current jar dependency. DO NOT EDIT.
# format is <lastModified> <length> <SHA-1> <path>
# Encoding is UTF-8
package tttclient.activities;
import tttclient.services.DownloadService;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
......@@ -35,7 +36,10 @@ public class MainActivity extends Activity {
public void onClick(View v) {
Intent intent = new Intent(getApplicationContext(),
PlayerActivity.class);
intent.putExtra(DownloadService.FILE_NAME,
"Diskrete_Strukturen_2014_01_09");
intent.putExtra(DownloadService.FILE_PATH,
"/mnt/sdcard/ttt/Diskrete_Strukturen_2014_01_09");
startActivity(intent);
}
......
......@@ -23,7 +23,7 @@ public class PlayerActivity extends Activity {
public ImageView imgV;
Bitmap bitmap;
Button playButton;
Button stopButton;
Button pauseButton;
Recording recording;
@Override
......@@ -36,7 +36,7 @@ public class PlayerActivity extends Activity {
File file = new File(filePath + "/" + fileName + ".ttt");
playButton = (Button) findViewById(R.id.play_btn);
stopButton = (Button) findViewById(R.id.stop_btn);
pauseButton = (Button) findViewById(R.id.stop_btn);
playButton.setOnClickListener(new OnClickListener() {
......@@ -47,7 +47,7 @@ public class PlayerActivity extends Activity {
}
});
stopButton.setOnClickListener(new OnClickListener() {
pauseButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
......
......@@ -60,6 +60,8 @@ public class HextileMessage extends FramebufferUpdateMessage {
throws IOException {
this(timestamp, in.readShort(), in.readShort(), in.readShort(), in
.readShort(), FramebufferUpdateMessage.readBytes(in, size - 8));
Log.d("HextileMessage", " timestamp: " + timestamp);
}
// constructor - reading message from RFB input stream and directly draw
......@@ -311,7 +313,7 @@ public class HextileMessage extends FramebufferUpdateMessage {
int color = graphicsContext.decodeColor(colorField);
Log.d("color", "color = " + color);
// Log.d("color", "color = " + color);
// Paint paint = new Paint(color);
// if (y > 100) {
// Log.d("HextileMessage", " fill Rec : " + x + " , " + y + " , " + w
......
......@@ -32,6 +32,7 @@ import java.util.ArrayList;
import tttclient.ttt.Constants;
import tttclient.ttt.Recording;
import android.util.Log;
public class Messages {
......@@ -108,15 +109,17 @@ public class Messages {
// fix inconsistent timestamps
if (message.getTimestamp() < timestamp) {
if (message.getTimestamp() + 1000 < timestamp)
System.out.println("fixing incosistent timestamp ["
+ Constants.getStringFromTime(message
.getTimestamp())
+ " -> "
+ Constants.getStringFromTime(timestamp)
+ "\tdiff "
+ Constants.getStringFromTime(timestamp
- message.getTimestamp()) + "]\t"
+ message);
Log.d("Messages",
"fixing incosistent timestamp ["
+ Constants.getStringFromTime(message
.getTimestamp())
+ " -> "
+ Constants
.getStringFromTime(timestamp)
+ "\tdiff "
+ Constants.getStringFromTime(timestamp
- message.getTimestamp())
+ "]\t" + message);
message.setTimestamp(timestamp);
}
......
......@@ -10,12 +10,13 @@ import android.graphics.Bitmap.Config;
import android.graphics.Canvas;
import android.graphics.Color;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.widget.ImageView;
@SuppressLint("NewApi")
public class GraphicsContext implements MessageConsumer {
public Handler handler;
public Canvas canvas;
public Canvas scaledCanvas;
public BitmapContainer bitmapContainer;
......@@ -26,7 +27,6 @@ public class GraphicsContext implements MessageConsumer {
public ProtocolPreferences prefs;
public int screenWidth = 1280;
public int screenHeight = 768;
private final Handler uiThreadHandler;
public byte[] hextile_bg_encoded;
public byte[] hextile_fg_encoded;
public int[] pixels;
......@@ -52,12 +52,21 @@ public class GraphicsContext implements MessageConsumer {
Log.d("ImageView", " ScaleX " + imgView.getScaleX() + " , ScaleY "
+ imgView.getScaleY());
updateView(bitmapContainer.getBimap());
uiThreadHandler = new Handler();
// updateView(bitmapContainer.getBimap());
hextile_bg_encoded = new byte[prefs.bytesPerPixel];
hextile_fg_encoded = new byte[prefs.bytesPerPixel];
handler = new Handler(Looper.getMainLooper()) {
@Override
public void handleMessage(android.os.Message inputMessage) {
// Gets the image task from the incoming Message object.
Bitmap bitmap = (Bitmap) inputMessage.obj;
imgView.setImageBitmap(bitmap);
imgView.invalidate();
}
};
}
private final Runnable updateViewTask = new Runnable() {
......@@ -69,31 +78,21 @@ public class GraphicsContext implements MessageConsumer {
}
};
public void updateView() {
uiThreadHandler.post(updateViewTask);
}
// public void updateView() {
// uiThreadHandler.post(updateViewTask);
//
// }
public void updateView(final Bitmap bitmap) {
new Thread(new Runnable() {
@Override
public void run() {
imgView.post(new Runnable() {
@Override
public void run() {
imgView.setImageBitmap(bitmap);
imgView.invalidate();
}
});
}
}).start();
android.os.Message message = handler.obtainMessage(0, bitmap);
message.sendToTarget();
}
public void refresh(int x, int y, int width, int height) {
// TODO
updateView();
}
// public void refresh(int x, int y, int width, int height) {
// // TODO
// updateView();
// }
public int decodeColor(byte[] colorField) {
int color = (colorField[1] & 0xFF) << 8 | (colorField[0] & 0xFF);
......
......@@ -444,8 +444,9 @@ public class Recording extends MessageProducerAdapter implements Runnable {
synchronized (this) {
// wait if pause mode
while (running && (paused || adjusting)) {
System.out.println((paused ? "paused " : "")
+ (adjusting ? "adjusting" : ""));
Log.d("Recording", "paused: " + paused
+ " ,adjusting: " + adjusting);
wait();
}
......@@ -530,7 +531,7 @@ public class Recording extends MessageProducerAdapter implements Runnable {
paused = false;
// if (audioVideoPlayer != null)
// audioVideoPlayer.play();
// interrupt();
interrupt();
}
//
......@@ -614,6 +615,12 @@ public class Recording extends MessageProducerAdapter implements Runnable {
}
// distinguish notify from timeout after wait
synchronized private void interrupt() {
interrupted = true;
notify();
}
// public void setAudioVideoPlayerTime(int time) {
// // synchronize audio/video
// if (audioVideoPlayer != null)
......@@ -743,40 +750,6 @@ public class Recording extends MessageProducerAdapter implements Runnable {
// }
// }
// // //////////////////////////////////////////////////////////////////
// // volume control
// // //////////////////////////////////////////////////////////////////
// public int getVolumeLevel() {
// if (audioVideoPlayer != null)
// return audioVideoPlayer.getVolumeLevel();
// else
// return 0;
// }
//
// public void setVolumeLevel(int volume) {
// if (audioVideoPlayer != null)
// audioVideoPlayer.setVolumeLevel(volume);
// }
//
// public boolean getMute() {
// if (audioVideoPlayer != null)
// return audioVideoPlayer.getMute();
// else
// return true;
// }
//
// public void setMute(boolean mute) {
// if (audioVideoPlayer != null)
// audioVideoPlayer.setMute(mute);
// }
// // //////////////////////////////////////////////////////////////////
// // searching
// // //////////////////////////////////////////////////////////////////
// public void highlightSearchResults(Graphics2D g) {
// index.highlightSearchResultsOfCurrentIndex(g);
// }
/*******************************************************************************************************************
* write to file *
******************************************************************************************************************/
......
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