Commit 940db4a5 authored by Thomas Krex's avatar Thomas Krex

stabiler version des players, mit korrekter Skalierung des SurfaceViews

parent 3d2f65ca
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/parentView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
......
......@@ -22,6 +22,7 @@ import android.view.inputmethod.EditorInfo;
import android.widget.LinearLayout;
import android.widget.MediaController;
import android.widget.MediaController.MediaPlayerControl;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.ViewSwitcher;
......@@ -50,6 +51,7 @@ public class PlayerActivity extends SherlockActivity implements
static final int LAYOUT_MODE_EXTENDED = 1;
public String fileName;
public String filePath;
private RelativeLayout parentView;
private LinearLayout container;
public SurfaceView surfaceView;
private SurfaceHolder sHolder;
......@@ -67,10 +69,12 @@ public class PlayerActivity extends SherlockActivity implements
scrollView = (ScrollView) findViewById(R.id.indexScrollView);
// switcher = (ViewSwitcher) findViewById(R.id.viewSwitcher);
// needed as anchor of the MediaController
parentView = (RelativeLayout) findViewById(R.id.parentView);
// default fullscreen
// container of SurfaceView
container = (LinearLayout) findViewById(R.id.container);
surfaceView = (SurfaceView) findViewById(R.id.playerView);
fileName = getIntent().getStringExtra(DownloadService.FILE_NAME);
setTitle(fileName);
......@@ -139,7 +143,7 @@ public class PlayerActivity extends SherlockActivity implements
audioController.setPrevNextListeners(nextListener,
prevListener);
audioController.setAnchorView(surfaceView);
audioController.setAnchorView(parentView);
} catch (IOException e) {
// TODO Auto-generated catch block
......@@ -354,6 +358,13 @@ public class PlayerActivity extends SherlockActivity implements
}
/**
* Scales the Parent Layout of the SurfaceView. The method computes the
* ratio between the actual screen height and the height of the recording.
* Since the height of the layout is automatically set to the screen height,
* only the layout width has to be adjusted.
*
*/
public void scaleView() {
Display display = getWindowManager().getDefaultDisplay();
float aspectRatio = (float) display.getHeight()
......
......@@ -90,6 +90,8 @@ public class Recording extends MessageProducerAdapter implements Runnable {
// read messages + extensions
read(this.tttFile);
// TODO find new place for this
scrollView.post(new Runnable() {
@Override
......@@ -451,10 +453,10 @@ public class Recording extends MessageProducerAdapter implements Runnable {
public void setTime(int time, boolean refresh) {
// refresh determine if display is updated or not
// TODO better performance without stopping loop
// loop is stopped due to performance problems
if (!adjusting)
setAdjusting(true);
// if (!adjusting)
// setAdjusting(true);
// paint offscreen
messages.setTime_full_frame_check(time);
......@@ -470,8 +472,8 @@ public class Recording extends MessageProducerAdapter implements Runnable {
}
// while loop is started again
if (adjusting)
setAdjusting(false);
// if (adjusting)
// setAdjusting(false);
}
......
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