Commit f17f63ef by Thomas Krex

versuch die ganze geschichte zu publizieren

parent 2ebf2bec
......@@ -33,7 +33,25 @@
</activity>
<activity
android:name="tttclient.activities.FeedActivity"
android:label="Feeds" >
android:configChanges="orientation|screenSize"
android:label="Feeds"
android:launchMode="singleTask" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="ttt.in.tum.de"
android:pathPattern="/lectures/rss\\.php\\\?.*"
android:scheme="http" />
</intent-filter>
</activity>
<activity
android:name="tttclient.activities.FeedDetailActivity"
......
......@@ -33,7 +33,25 @@
</activity>
<activity
android:name="tttclient.activities.FeedActivity"
android:label="Feeds" >
android:configChanges="orientation|screenSize"
android:label="Feeds"
android:launchMode="singleTask" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="ttt.in.tum.de"
android:pathPattern="/lectures/rss\\.php\\\?.*"
android:scheme="http" />
</intent-filter>
</activity>
<activity
android:name="tttclient.activities.FeedDetailActivity"
......
......@@ -6,6 +6,7 @@ import tttclient.models.FeedItemDbManager;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
......@@ -35,6 +36,9 @@ public class FeedActivity extends SherlockActivity implements
private SimpleCursorAdapter adapter;
private String feedUrl;
private String feedName;
private Dialog addDialog;
EditText urlTxt;
EditText nameTxt;
private int feedId;
private Vibrator myVib;
......@@ -59,6 +63,75 @@ public class FeedActivity extends SherlockActivity implements
feedList.setOnItemClickListener(this);
feedList.setOnItemLongClickListener(this);
addDialog = new Dialog(this);
addDialog.setContentView(R.layout.dialog_feeds);
urlTxt = (EditText) addDialog.findViewById(R.id.tx_url);
nameTxt = (EditText) addDialog.findViewById(R.id.tx_name);
addDialog.setTitle(R.string.add_feed);
addDialog.setOnCancelListener(new OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
urlTxt.setText("");
nameTxt.setText("");
}
});
Button saveButton = (Button) addDialog.findViewById(R.id.button_save);
saveButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
String name = nameTxt.getText().toString();
if (name.isEmpty()) {
Toast.makeText(getApplicationContext(),
"Please insert a name for this feed",
Toast.LENGTH_LONG).show();
return;
}
// TODO validate url
String url = urlTxt.getText().toString();
if (!URLUtil.isValidUrl(url)) {
Toast.makeText(getApplicationContext(),
"Please insert a valid Url", Toast.LENGTH_LONG)
.show();
return;
}
url.replaceAll("\\s+", "");
Feed feed = new Feed(name, url);
FeedDbManager fm = new FeedDbManager(getParent());
try {
fm.insertintoDB(feed);
} catch (Exception e) {
Log.e("FeedActivitity", "DB insert failure");
e.printStackTrace();
}
// refresh list
adapter.changeCursor(fm.getAllFromDB());
nameTxt.setText("");
urlTxt.setText("");
addDialog.dismiss();
}
});
Intent intent = getIntent();
String action = intent.getAction();
if (Intent.ACTION_VIEW.equals(action)) {
Log.d("IntentFIlter", intent.getDataString());
urlTxt.setText(intent.getDataString());
addDialog.show();
}
}
@Override
......@@ -72,58 +145,8 @@ public class FeedActivity extends SherlockActivity implements
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.add) {
final Dialog dialog = new Dialog(this);
dialog.setContentView(R.layout.dialog_feeds);
dialog.setTitle(R.string.add_feed);
Button saveButton = (Button) dialog.findViewById(R.id.button_save);
saveButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
EditText nameTxt = (EditText) dialog
.findViewById(R.id.tx_name);
EditText urlTxt = (EditText) dialog
.findViewById(R.id.tx_url);
String name = nameTxt.getText().toString();
if (name.isEmpty()) {
Toast.makeText(getApplicationContext(),
"Please insert a name for this feed",
Toast.LENGTH_LONG).show();
return;
}
// TODO validate url
String url = urlTxt.getText().toString();
if (!URLUtil.isValidUrl(url)) {
Toast.makeText(getApplicationContext(),
"Please insert a valid Url", Toast.LENGTH_LONG)
.show();
return;
}
url.replaceAll("\\s+", "");
Feed feed = new Feed(name, url);
FeedDbManager fm = new FeedDbManager(getParent());
try {
fm.insertintoDB(feed);
} catch (Exception e) {
Log.e("FeedActivitity", "DB insert failure");
e.printStackTrace();
}
// refresh list
adapter.changeCursor(fm.getAllFromDB());
nameTxt.setText("");
urlTxt.setText("");
dialog.dismiss();
}
});
dialog.show();
addDialog.show();
}
......
......@@ -98,7 +98,6 @@ public class FeedDetailActivity extends SherlockActivity implements
};
@SuppressWarnings("deprecation")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
......
package tttclient.activities;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import com.actionbarsherlock.app.SherlockActivity;
import de.tum.in.tttclient.R;
public class MainActivity extends Activity {
public class MainActivity extends SherlockActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
......
......@@ -33,7 +33,8 @@ import de.tum.in.tttclient.R;
public class PlayerActivity extends SherlockActivity implements
MediaPlayerControl {
static final int LAYOUT_MODE_FULL = 0;
static final int LAYOUT_MODE_EXTENDED = 1;
public String fileName;
public String filePath;
public ImageView imgV;
......@@ -142,7 +143,7 @@ public class PlayerActivity extends SherlockActivity implements
// update display if recording is not playing
// if (!recording.isPlaying())
recording.graphicsContext().updateView();
recording.graphicsContext().updateView(false);
}
......@@ -281,13 +282,12 @@ public class PlayerActivity extends SherlockActivity implements
// handle layout switch
case R.id.extend:
if (!isExtendend) {
switchLayout(1);
switchLayout(LAYOUT_MODE_EXTENDED);
item.setIcon(getResources().getDrawable(
R.drawable.ic_action_full_screen));
isExtendend = true;
} else if (isExtendend) {
switchLayout(0);
// switchSurface(0);
switchLayout(LAYOUT_MODE_FULL);
item.setIcon(getResources().getDrawable(
R.drawable.ic_action_return_from_full_screen));
isExtendend = false;
......@@ -309,18 +309,20 @@ public class PlayerActivity extends SherlockActivity implements
void switchLayout(int index) {
// switch to fullscreen
if (index == 0) {
if (index == LAYOUT_MODE_FULL) {
imgV = (ImageView) findViewById(R.id.playerView_fullscreen);
recording.graphicsContext().setImageView(imgV);
switcher.setDisplayedChild(0);
recording.graphicsContext().updateView(true);
switcher.setDisplayedChild(LAYOUT_MODE_FULL);
}
// switch to extended View
if (index == 1) {
if (index == LAYOUT_MODE_EXTENDED) {
imgV = (ImageView) findViewById(R.id.playerView_extended);
recording.graphicsContext().setImageView(imgV);
recording.graphicsContext().updateView();
switcher.setDisplayedChild(1);
recording.graphicsContext().updateView(true);
switcher.setDisplayedChild(LAYOUT_MODE_EXTENDED);
}
......
......@@ -116,19 +116,33 @@ public class GraphicsContext implements MessageConsumer {
return hextile_fg_encoded;
}
// painting is done here
public void updateView() {
/*
* There are two different modes for the painting, if the setBitmap=true,
* after the painting, the bitmap is assigned to the imageview this has to
* be made when the layout and so the imageview is changing if
* setBitmap=false, imgView only get invalidated
*/
public void updateView(boolean setBitmap) {
if (refreshEnabled) {
Bitmap bitmap = bitmapContainer.getBitmap();
final Bitmap bitmap = bitmapContainer.getBitmap();
Canvas canvas = new Canvas(bitmap);
if (isWhiteboardEnabled())
paintWhiteboard(canvas);
paintAnnotations(canvas);
recording.highlightSearchResults(canvas);
android.os.Message message = viewHandler.obtainMessage(0, bitmap);
message.sendToTarget();
if (setBitmap)
imgView.post(new Runnable() {
@Override
public void run() {
imgView.setImageBitmap(bitmap);
}
});
else
imgView.postInvalidate();
}
}
......@@ -168,7 +182,7 @@ public class GraphicsContext implements MessageConsumer {
message.paint(this);
// TODO hier zeichnen oder wo anders???
if (message instanceof Annotation)
updateView();
updateView(false);
}
......@@ -178,7 +192,7 @@ public class GraphicsContext implements MessageConsumer {
// only the final image
if (!recording.adjusting) {
updateView();
updateView(false);
}
}
......@@ -288,7 +302,7 @@ public class GraphicsContext implements MessageConsumer {
public void setWhiteboardPage(int whiteboardPage) {
this.whiteboardPage = whiteboardPage;
clearAnnotations();
updateView();
updateView(false);
}
// updates for late comers and recorders
......@@ -308,4 +322,14 @@ 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
......@@ -13,7 +13,6 @@ import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.Log;
import android.view.View;
import android.widget.ImageButton;
import android.widget.LinearLayout;
......@@ -79,9 +78,8 @@ public class IndexEntry extends ImageButton {
hasThumbnail = true;
}
Canvas canvas = new Canvas(thumbnail);
paintAnnotations(canvas);
setImageBitmap(thumbnail);
setImageBitmap(bitmapContainer.getBitmap());
updateThumbail();
}
......@@ -92,7 +90,8 @@ public class IndexEntry extends ImageButton {
highlightSearchResultsOnThumbail(canvas);
paintAnnotations(canvas);
setImageBitmap(bitmap);
// setImageBitmap(bitmap);
invalidate();
}
......@@ -225,7 +224,6 @@ public class IndexEntry extends ImageButton {
Annotation annotation = annotations.get(i);
if (paintHighlightAnnotations
|| !(annotation instanceof HighlightAnnotation)) {
Log.d("IndexEntry", "annotaion to thumbnail");
annotation.paintToThumbnail(canvas);
}
}
......
......@@ -479,7 +479,7 @@ public class Recording extends MessageProducerAdapter implements Runnable {
// refresh determine if display is updated or not
// while loop is stopped due to performance problems
// loop is stopped due to performance problems
if (!adjusting)
setAdjusting(true);
......@@ -497,8 +497,11 @@ public class Recording extends MessageProducerAdapter implements Runnable {
// focusCurrentIndexEntry(time);
index.setCorrespondingIndex(time);
graphicsContext.updateView();
setAudioPlayerTime(time);
if (time == 0)
graphicsContext.updateView(true);
else
graphicsContext.updateView(false);
}
// while loop is started again
......@@ -515,6 +518,7 @@ public class Recording extends MessageProducerAdapter implements Runnable {
synchronized void setAdjusting(boolean state) {
adjusting = state;
notify();
}
......@@ -524,7 +528,7 @@ public class Recording extends MessageProducerAdapter implements Runnable {
audioPlayer.seekTo(time);
// notify playback loop
interrupt();
// interrupt();
}
//
......
......@@ -51,7 +51,7 @@ public class DeleteAnnotation extends Annotation {
@Override
public void paint(GraphicsContext graphicsContext) {
graphicsContext.removeAnnotationsAt(x, y);
graphicsContext.updateView();
graphicsContext.updateView(false);
}
@Override
......
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 sign in to comment