Commit 92800a58 authored by Thomas Krex's avatar Thomas Krex

wiedergabe läuft auf surfaceview, vild noch nicht skaliert, Probleme beim...

wiedergabe läuft auf surfaceview, vild noch nicht skaliert, Probleme beim layoutwechsel --> test eines navigation drawers anstatt dem gesonderten scrollview
parent b91efdfc
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="3"
android:layout_gravity="center_horizontal">
<ScrollView
android:id="@+id/indexScrollView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/my_border"
android:fillViewport="false"
android:paddingLeft="5dip"
android:paddingRight="5dip" >
</ScrollView>
<LinearLayout
android:id="@+id/surfaceContainer"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="@android:color/black"
android:gravity="center" >
<SurfaceView
android:id="@+id/playerView_extended"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
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"
/>
</LinearLayout>
......@@ -11,15 +11,15 @@
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center" >
<SurfaceView
android:id="@+id/playerView_fullscreen"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@android:color/black"
android:scaleType="centerInside" />
/>
</LinearLayout>
<LinearLayout
......@@ -37,16 +37,17 @@
android:fillViewport="false"
android:paddingLeft="5dip" >
</ScrollView>
<SurfaceView
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2">
<SurfaceView
android:id="@+id/playerView_extended"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="@drawable/my_border"
android:padding="10dip"
android:scaleType="centerInside"
android:src="@drawable/ic_launcher" />
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
</LinearLayout>
</ViewSwitcher>
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
android:orientation="horizontal"
android:weightSum="3" >
<ScrollView
android:id="@+id/indexScrollView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:fillViewport="false"
android:paddingLeft="5dip" >
</ScrollView>
<SurfaceView
android:id="@+id/playerView_extended"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="@drawable/my_border"
android:padding="10dip"
android:scaleType="centerInside"
android:src="@drawable/ic_launcher" />
</LinearLayout>
......@@ -13,7 +13,7 @@
android:showAsAction="always"/>
<item
android:id="@+id/extend"
android:icon="@drawable/ic_action_return_from_full_screen"
android:icon="@drawable/ic_action_full_screen"
android:showAsAction="always"/>
</menu>
\ No newline at end of file
......@@ -192,7 +192,6 @@ public class FeedDetailActivity extends SherlockActivity implements
boolean state=false;
// insert month separator
if(view.getId()==R.id.listHeader){
Log.d("VIew Binder", "found header view");
TextView tx = (TextView) view;
Date currDate= Utils.stringToDate(cursor.getString(cursor.getColumnIndex(FeedItemDbManager.COLUMN_DATE)));
......
......@@ -12,12 +12,10 @@ import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.SurfaceView;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.inputmethod.EditorInfo;
import android.widget.MediaController;
import android.widget.MediaController.MediaPlayerControl;
import android.widget.ScrollView;
......@@ -59,17 +57,16 @@ public class PlayerActivity extends SherlockActivity implements
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_player_main);
setContentView(R.layout.activity_player_extended);
scrollView = (ScrollView) findViewById(R.id.indexScrollView);
switcher = (ViewSwitcher) findViewById(R.id.viewSwitcher);
// switcher = (ViewSwitcher) findViewById(R.id.viewSwitcher);
// default fullscreen
surfaceView= (SurfaceView) findViewById(R.id.playerView_fullscreen);
surfaceView.setZOrderOnTop(false);
surfaceView = (SurfaceView) findViewById(R.id.playerView_extended);
// surfaceView.setZOrderOnTop(false);
fileName = getIntent().getStringExtra(DownloadService.FILE_NAME);
setTitle(fileName);
filePath = getIntent().getStringExtra(DownloadService.FILE_PATH);
......@@ -108,7 +105,7 @@ public class PlayerActivity extends SherlockActivity implements
protected Void doInBackground(Void... params) {
try {
recording = new Recording(getApplicationContext(), tttFile,
audioPlayer,surfaceView.getHolder(), scrollView);
audioPlayer, surfaceView.getHolder(), scrollView);
/*
* create listeners for prev/next buttons of mediaController
......@@ -138,7 +135,7 @@ public class PlayerActivity extends SherlockActivity implements
prevListener);
audioController.setAnchorView(surfaceView);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
......@@ -183,18 +180,6 @@ public class PlayerActivity extends SherlockActivity implements
audioPlayer.release();
}
/*******************************************************************************************************************
* Delegating Search *
******************************************************************************************************************/
// delegates search to index and updates the view
public void search(String word) {
if (recording.getIndex() != null)
recording.getIndex().search(word);
// updates the image after searching
recording.graphicsContext().updateView(false);
}
/*******************************************************************************************************************
* Methods of MediaPlayerControl *
******************************************************************************************************************/
......@@ -292,9 +277,7 @@ public class PlayerActivity extends SherlockActivity implements
@Override
public boolean onQueryTextChange(String newText) {
// search after String during the input
search(newText);
// update thumbnail to mark new search results
recording.getIndex().updateThumbnails();
recording.search(newText);
return true;
}
});
......@@ -338,19 +321,25 @@ public class PlayerActivity extends SherlockActivity implements
// switch to fullscreen
if (mode == LAYOUT_MODE_FULL) {
setContentView(R.layout.activity_player_full);
surfaceView = (SurfaceView) findViewById(R.id.playerView_fullscreen);
// recording.graphicsContext().setImageView(imgV);
recording.graphicsContext().setHolder(surfaceView.getHolder());
recording.graphicsContext().updateView(true);
switcher.setDisplayedChild(LAYOUT_MODE_FULL);
// switcher.setDisplayedChild(LAYOUT_MODE_FULL);
}
// switch to extended View
if (mode == LAYOUT_MODE_EXTENDED) {
setContentView(R.layout.activity_player_extended);
surfaceView = (SurfaceView) findViewById(R.id.playerView_extended);
recording.graphicsContext().setHolder(surfaceView.getHolder());
surfaceView= (SurfaceView) findViewById(R.id.playerView_extended);
// recording.graphicsContext().setImageView(imgV);
recording.graphicsContext().updateView(true);
switcher.setDisplayedChild(LAYOUT_MODE_EXTENDED);
// switcher.setDisplayedChild(LAYOUT_MODE_EXTENDED);
scrollView.scrollTo(0, recording.getIndex().scrollPos);
}
......
......@@ -27,7 +27,7 @@ import android.view.SurfaceHolder;
public class GraphicsContext implements MessageConsumer {
private final BitmapContainer bitmapContainer;
private SurfaceHolder holder;;
private SurfaceHolder holder;
private boolean refreshEnabled = false;
private final MessageProducer producer;
......@@ -40,7 +40,7 @@ public class GraphicsContext implements MessageConsumer {
public GraphicsContext(SurfaceHolder holder, Recording record) {
this.holder=holder;
holder.setSizeFromLayout();
this.producer = record;
this.recording = record;
producer.addMessageConsumer(this);
......@@ -51,7 +51,6 @@ public class GraphicsContext implements MessageConsumer {
Config.ARGB_4444));
this.pixels = bitmapContainer.getPixels();
hextile_bg_encoded = new byte[prefs.bytesPerPixel];
hextile_fg_encoded = new byte[prefs.bytesPerPixel];
......@@ -85,6 +84,11 @@ 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;
}
/**
* Painting of the bitmap is done here. After getting Bitmap from Bitmap
......@@ -106,6 +110,7 @@ public class GraphicsContext implements MessageConsumer {
if (canvas != null) {
canvas.drawBitmap(pixels, 0,
recording.getProtocolPreferences().framebufferWidth, 0, 0,
recording.getProtocolPreferences().framebufferWidth,
......@@ -301,14 +306,4 @@ public class GraphicsContext implements MessageConsumer {
}
// public void setBitmap() {
// imgView.post(new Runnable() {
//
// @Override
// public void run() {
// imgView.setImageBitmap(bitmapContainer.getBitmap());
//
// }
// });
// }
}
\ No newline at end of file
......@@ -472,7 +472,7 @@ public class Index {
public void initIndexView() {
// needed because scrollview can only have one direct child
LinearLayout layout = new LinearLayout(context);
final LinearLayout layout = new LinearLayout(context);
layout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.WRAP_CONTENT));
layout.setOrientation(LinearLayout.VERTICAL);
......@@ -485,8 +485,15 @@ public class Index {
layout.addView(addTitle(i));
layout.addView(insertEntry(entry));
}
indexViewer.addView(layout);
indexViewer.post(new Runnable() {
@Override
public void run() {
indexViewer.addView(layout);
}
});
}
......
......@@ -532,5 +532,22 @@ public class Recording extends MessageProducerAdapter implements Runnable {
setTime(pos, true);
}
/*******************************************************************************************************************
* Delegating Search *
******************************************************************************************************************/
// delegates search to index and updates the view
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