Removed unused code from Itemview

This commit is contained in:
daniel oeh 2012-06-22 14:30:31 +02:00
parent 426df3f49f
commit 55f33875a4
2 changed files with 29 additions and 128 deletions

View File

@ -1,56 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/imgvFeedimage"
android:layout_height="90dip"
android:layout_width="90dip"
android:layout_alignParentLeft="true"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:orientation="vertical">
<TextView
android:id="@+id/txtvItemname"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/txtvPublished"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:orientation="horizontal">
<Button
android:id="@+id/butPlay"
android:text="@string/play_label"
android:layout_weight="1"
android:layout_width="0px"
android:layout_height="wrap_content"/>
<Button
android:id="@+id/butDownload"
android:text="@string/download_label"
android:layout_weight="1"
android:layout_width="0px"
android:layout_height="wrap_content"/>
<Button
android:id="@+id/butRemove"
android:text="@string/remove_label"
android:layout_weight="1"
android:layout_width="0px"
android:layout_height="wrap_content"/>
</LinearLayout>
<WebView
android:id="@+id/webvDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/txtvItemname"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/txtvPublished"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<WebView
android:id="@+id/webvDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>

View File

@ -35,16 +35,11 @@ public class ItemviewActivity extends SherlockActivity {
private static final String TAG = "ItemviewActivity";
private FeedManager manager;
private DownloadRequester requester;
private FeedItem item;
// Widgets
private ImageView imgvImage;
private TextView txtvTitle;
private TextView txtvPublished;
private Button butPlay;
private Button butDownload;
private Button butRemove;
private WebView webvDescription;
@Override
@ -54,39 +49,12 @@ public class ItemviewActivity extends SherlockActivity {
extractFeeditem();
populateUI();
butDownload.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
requester = DownloadRequester.getInstance();
requester.downloadMedia(v.getContext(), item.getMedia());
//getDownloadStatus();
}
});
butPlay.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//manager.playMedia(v.getContext(), item.getMedia());
}
});
butRemove.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (manager.deleteFeedMedia(v.getContext(), item.getMedia())) {
//setNotDownloadedState();
}
}
});
}
@Override
public void onStop() {
super.onStop();
Log.d(TAG, "Stopping Activity");
downloadObserver.cancel(true);
}
/** Extracts FeedItem object the activity is supposed to display */
@ -108,10 +76,6 @@ public class ItemviewActivity extends SherlockActivity {
setContentView(R.layout.feeditemview);
txtvTitle = (TextView) findViewById(R.id.txtvItemname);
txtvPublished = (TextView) findViewById(R.id.txtvPublished);
imgvImage = (ImageView) findViewById(R.id.imgvFeedimage);
butPlay = (Button) findViewById(R.id.butPlay);
butDownload = (Button) findViewById(R.id.butDownload);
butRemove = (Button) findViewById(R.id.butRemove);
webvDescription = (WebView) findViewById(R.id.webvDescription);
setTitle(item.getFeed().getTitle());
@ -119,26 +83,10 @@ public class ItemviewActivity extends SherlockActivity {
.getTime(), System.currentTimeMillis(), DateFormat.MEDIUM,
DateFormat.SHORT));
txtvTitle.setText(item.getTitle());
if (item.getFeed().getImage() != null) {
imgvImage
.setImageBitmap(item.getFeed().getImage().getImageBitmap());
}
webvDescription.loadData(item.getDescription(), "text/html", null);
}
private void getDownloadStatus(Menu menu) {
FeedMedia media = item.getMedia();
if (media.getFile_url() == null) {
setNotDownloadedState(menu);
} else if (media.isDownloaded()) {
setDownloadedState(menu);
} else {
// observe
setDownloadingState(menu);
//downloadObserver.execute(media);
}
}
/* TODO implement
final DownloadObserver downloadObserver = new DownloadObserver(this) {
@Override
protected void onProgressUpdate(
@ -156,7 +104,7 @@ public class ItemviewActivity extends SherlockActivity {
}
}
};
*/
@Override
public boolean onCreateOptionsMenu(Menu menu) {
return FeedItemMenuHandler.onCreateMenu(new MenuInflater(this), menu);
@ -175,23 +123,4 @@ public class ItemviewActivity extends SherlockActivity {
public boolean onPrepareOptionsMenu(Menu menu) {
return FeedItemMenuHandler.onPrepareMenu(menu, item);
}
private void setDownloadingState(Menu menu) {
butDownload.setEnabled(false);
butPlay.setEnabled(false);
butRemove.setEnabled(false);
}
private void setDownloadedState(Menu menu) {
butDownload.setEnabled(false);
butPlay.setEnabled(true);
butRemove.setEnabled(true);
}
private void setNotDownloadedState(Menu menu) {
butPlay.setEnabled(false);
butDownload.setEnabled(true);
butRemove.setEnabled(false);
}
}