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

surfaceview bei dem der scrollview darüber gelegt wird.

Vollbildmodus möglich, jedoch ohne seitenverhätnisse zu erhalten.
parent 92800a58
......@@ -4,6 +4,7 @@
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="lib" path="libs/commons-io-2.4.jar"/>
<classpathentry kind="lib" path="libs/feedback_v6.jar"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="output" path="bin/classes"/>
......
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- The main content view -->
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent">
<SurfaceView
android:id="@+id/playerView_fullscreen"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"/>
</FrameLayout>
<!-- The navigation drawer -->
<!-- <ListView android:id="@+id/left_drawer" -->
<!-- android:layout_width="240dp" -->
<!-- android:layout_height="match_parent" -->
<!-- android:layout_gravity="start" -->
<!-- android:choiceMode="singleChoice" -->
<!-- android:divider="@android:color/transparent" -->
<!-- android:dividerHeight="0dp" -->
<!-- android:background="#111"/> -->
<ScrollView
android:id="@+id/indexScrollView"
android:layout_gravity="start"
android:layout_width="240dp"
android:layout_height="match_parent"
android:background="@drawable/my_border"
android:fillViewport="false" />
</android.support.v4.widget.DrawerLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
>
<SurfaceView
android:id="@+id/playerView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerInParent="true"
/>
<ScrollView
android:id="@+id/indexScrollView"
android:layout_width="240dp"
android:layout_height="match_parent"
android:visibility="gone"
android:background="@android:color/transparent"
android:fillViewport="false"
/>
</RelativeLayout>
\ No newline at end of file
......@@ -12,6 +12,7 @@ import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.view.View.OnClickListener;
......@@ -47,6 +48,7 @@ public class PlayerActivity extends SherlockActivity implements
public String fileName;
public String filePath;
public SurfaceView surfaceView;
private SurfaceHolder sHolder;
private ViewSwitcher switcher;
private ScrollView scrollView;
private Recording recording;
......@@ -57,16 +59,14 @@ public class PlayerActivity extends SherlockActivity implements
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_player_extended);
setContentView(R.layout.activity_player_overlapping);
scrollView = (ScrollView) findViewById(R.id.indexScrollView);
// switcher = (ViewSwitcher) findViewById(R.id.viewSwitcher);
// default fullscreen
surfaceView = (SurfaceView) findViewById(R.id.playerView_extended);
// surfaceView.setZOrderOnTop(false);
surfaceView = (SurfaceView) findViewById(R.id.playerView);
fileName = getIntent().getStringExtra(DownloadService.FILE_NAME);
setTitle(fileName);
filePath = getIntent().getStringExtra(DownloadService.FILE_PATH);
......@@ -294,14 +294,16 @@ public class PlayerActivity extends SherlockActivity implements
// handle layout switch
case R.id.extend:
if (!isExtendend) {
switchLayout(LAYOUT_MODE_EXTENDED);
item.setIcon(getResources().getDrawable(
R.drawable.ic_action_full_screen));
// switchLayout(LAYOUT_MODE_EXTENDED);
// item.setIcon(getResources().getDrawable(
// R.drawable.ic_action_full_screen));
scrollView.setVisibility(View.VISIBLE);
isExtendend = true;
} else if (isExtendend) {
switchLayout(LAYOUT_MODE_FULL);
item.setIcon(getResources().getDrawable(
R.drawable.ic_action_return_from_full_screen));
// switchLayout(LAYOUT_MODE_FULL);
// item.setIcon(getResources().getDrawable(
// R.drawable.ic_action_return_from_full_screen));
scrollView.setVisibility(View.GONE);
isExtendend = false;
}
......
......@@ -15,7 +15,6 @@ import android.graphics.Color;
import android.graphics.Paint;
import android.view.SurfaceHolder;
/**
* paint the messages to the bitmap. Bitmap shown in imageview. Annotations and
* Whiteboard parts are adopted from TTT
......@@ -39,18 +38,17 @@ public class GraphicsContext implements MessageConsumer {
private final int[] pixels;
public GraphicsContext(SurfaceHolder holder, Recording record) {
this.holder=holder;
this.holder = holder;
this.producer = record;
this.recording = record;
producer.addMessageConsumer(this);
this.prefs = record.getProtocolPreferences();
this.bitmapContainer = new BitmapContainer(Bitmap.createBitmap(
prefs.framebufferWidth, prefs.framebufferHeight,
Config.ARGB_4444));
this.pixels = bitmapContainer.getPixels();
this.pixels = bitmapContainer.getPixels();
hextile_bg_encoded = new byte[prefs.bytesPerPixel];
hextile_fg_encoded = new byte[prefs.bytesPerPixel];
......@@ -64,7 +62,6 @@ public class GraphicsContext implements MessageConsumer {
return refreshEnabled;
}
public int[] getPixels() {
return this.pixels;
}
......@@ -84,10 +81,10 @@ public class GraphicsContext implements MessageConsumer {
public byte[] getHextile_fg_encoded() {
return hextile_fg_encoded;
}
public void setHolder(SurfaceHolder holder){
this.holder=null;
this.holder=holder;
public void setHolder(SurfaceHolder holder) {
this.holder = null;
this.holder = holder;
}
/**
......@@ -104,18 +101,19 @@ public class GraphicsContext implements MessageConsumer {
*
*/
public void updateView(boolean setBitmap) {
Canvas canvas = holder.lockCanvas();
Canvas canvas = holder.lockCanvas();
int savecount = 0;
if (canvas != null) {
// if (setBitmap) {
canvas.drawBitmap(pixels, 0,
recording.getProtocolPreferences().framebufferWidth, 0, 0,
recording.getProtocolPreferences().framebufferWidth,
recording.getProtocolPreferences().framebufferHeight,
false, null);
// savecount = canvas.save();
// } else
// canvas.restoreToCount(savecount);
if (isWhiteboardEnabled())
paintWhiteboard(canvas);
paintAnnotations(canvas);
......@@ -170,7 +168,7 @@ public class GraphicsContext implements MessageConsumer {
*/
@Override
public void handleMessage(Message message) {
message.paint(this);
updateView(false);
......@@ -189,15 +187,15 @@ public class GraphicsContext implements MessageConsumer {
* @param h
* height of rectangle
*/
// public void handleUpdatedPixels(int x, int y, int w, int h) {
//
// // if recording is adjusting, messages are not painted one by one but
// // only the final image
// if (!recording.adjusting) {
//
// updateView(false);
// }
// }
// public void handleUpdatedPixels(int x, int y, int w, int h) {
//
// // if recording is adjusting, messages are not painted one by one but
// // only the final image
// if (!recording.adjusting) {
//
// updateView(false);
// }
// }
/*******************************************************************************************************************
* Annotations *
......
......@@ -74,6 +74,7 @@ public class Index {
private final ScrollView indexViewer;
private final Handler scrollHandler;
public int scrollPos;
int getWidth() {
return recording.getProtocolPreferences().framebufferWidth;
}
......@@ -96,8 +97,7 @@ public class Index {
IndexEntry entry = get(indexNumber - 1);
entry.setBackgroundColor(color);
LinearLayout parent = (LinearLayout) entry.getParent();
scrollPos=parent.getTop() - parent.getHeight()
/ 2;
scrollPos = parent.getTop() - parent.getHeight() / 2;
indexViewer.scrollTo(0, scrollPos);
}
......@@ -362,8 +362,6 @@ public class Index {
// read message
Message message = recording.getMessages().get(message_nr);
int start = message.getTimestamp();
// delete flag
boolean marked_to_be_deleted = false;
......@@ -410,7 +408,8 @@ public class Index {
// set collected annotations
recording.getIndex().get(i).setAnnotations(annotations);
Log.d("Index annotations", "index "+i+" start "+start+" end" +end+" annotations " +annotations.size());
Log.d("Index annotations", "index " + i + " start " + start
+ " end" + end + " annotations " + annotations.size());
// clear buffer if index ended with a delete event, which was not
// performed yet
......@@ -476,7 +475,7 @@ public class Index {
layout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.WRAP_CONTENT));
layout.setOrientation(LinearLayout.VERTICAL);
layout.setBackgroundColor(Color.WHITE);
layout.setBackgroundColor(Color.TRANSPARENT);
int length = size();
......@@ -486,14 +485,13 @@ public class Index {
layout.addView(insertEntry(entry));
}
indexViewer.post(new Runnable() {
@Override
public void run() {
indexViewer.addView(layout);
}
});
}
......@@ -514,6 +512,7 @@ public class Index {
title.setText(String.valueOf(number + 1));
title.setTextAppearance(context, android.R.style.TextAppearance_Large);
title.setTextColor(Color.BLACK);
title.setBackgroundColor(Color.TRANSPARENT);
return title;
}
......@@ -623,6 +622,7 @@ public class Index {
// ///////////////////////////////////////////////////////////////////////////////////
private int lastIndexFired = -1;
public int getLastIndexFired() {
return lastIndexFired;
}
......@@ -636,7 +636,7 @@ public class Index {
*/
public void fireIndexChangedEvent(int indexNumber) {
if (lastIndexFired != indexNumber) {
Log.d("Index Update","index number: "+indexNumber);
Log.d("Index Update", "index number: " + indexNumber);
// highlighting of index entry and scrolling has to be done in ui
// thread
if (lastIndexFired > 0) {
......
......@@ -39,8 +39,6 @@ import android.content.Context;
import android.graphics.Canvas;
import android.media.MediaPlayer;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.widget.ImageView;
import android.widget.ScrollView;
/**
......@@ -62,7 +60,7 @@ public class Recording extends MessageProducerAdapter implements Runnable {
private final Messages messages;
private final Index index;
private File tttFile;
private final File tttFile;
public Messages getMessages() {
return messages;
......@@ -81,7 +79,8 @@ public class Recording extends MessageProducerAdapter implements Runnable {
}
public Recording(Context context, File tttFile, MediaPlayer audioPlayer,
SurfaceHolder holder, ScrollView scrollView) throws IOException {
final SurfaceHolder holder, ScrollView scrollView)
throws IOException {
this.tttFile = tttFile;
// read
messages = new Messages(this);
......@@ -91,7 +90,15 @@ public class Recording extends MessageProducerAdapter implements Runnable {
// read messages + extensions
read(this.tttFile);
scrollView.post(new Runnable() {
@Override
public void run() {
holder.setFixedSize(prefs.framebufferWidth,
prefs.framebufferHeight);
}
});
graphicsContext = new GraphicsContext(holder, this);
// compute Index if not available in extensions
......@@ -532,7 +539,7 @@ public class Recording extends MessageProducerAdapter implements Runnable {
setTime(pos, true);
}
/*******************************************************************************************************************
* Delegating Search *
******************************************************************************************************************/
......@@ -540,14 +547,12 @@ public class Recording extends MessageProducerAdapter implements Runnable {
public void search(String word) {
if (index != null)
index.search(word);
// update thumbnail to mark new search results
index.updateThumbnails();
// updates the image after searching
graphicsContext.updateView(false);
}
}
\ No newline at end of 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