Implemented FeedInfoActivity

This commit is contained in:
daniel oeh 2012-07-04 10:29:17 +02:00
parent 2ba267cb21
commit 0c60b8edf0
10 changed files with 129 additions and 2 deletions

View File

@ -15,7 +15,7 @@
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.Sherlock.Light.ForceOverflow"
android:name="de.podfetcher.PodcastApp">
android:name="de.podfetcher.PodcastApp" android:logo="@drawable/ic_launcher">
<activity
android:label="@string/app_name"
android:name="de.podfetcher.activity.PodfetcherActivity" android:theme="@style/StyledIndicators">
@ -42,5 +42,6 @@
<action android:name="android.intent.action.MEDIA_BUTTON"/>
</intent-filter>
</receiver>
<activity android:name=".activity.FeedInfoActivity"></activity>
</application>
</manifest>

BIN
ic_launcher-web.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

56
res/layout/feedinfo.xml Normal file
View File

@ -0,0 +1,56 @@
<?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="vertical" >
<RelativeLayout
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical" >
<ImageView
android:id="@+id/imgvCover"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_margin="4dp" />
<TextView
android:id="@+id/txtvTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_margin="4dp"
android:layout_toRightOf="@id/imgvCover"
android:textSize="20dp"
android:textStyle="bold" />
<View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@id/imgvCover"
android:background="@color/bright_blue" />
</RelativeLayout>
<ScrollView
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/txtvDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</ScrollView>
</LinearLayout>

View File

@ -17,5 +17,6 @@
<color name="blue">#0000FF</color>
<color name="navy">#000080</color>
<color name="black">#000000</color>
<color name="bright_blue">#33B5E5</color>
</resources>

View File

@ -0,0 +1,63 @@
package de.podfetcher.activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.ImageView;
import android.widget.TextView;
import com.actionbarsherlock.app.SherlockActivity;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import de.podfetcher.R;
import de.podfetcher.feed.Feed;
import de.podfetcher.feed.FeedManager;
/** Displays information about a feed. */
public class FeedInfoActivity extends SherlockActivity {
private static final String TAG = "FeedInfoActivity";
public static final String EXTRA_FEED_ID = "de.podfetcher.extra.feedId";
private ImageView imgvCover;
private TextView txtvTitle;
private TextView txtvDescription;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.feedinfo);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
long feedId = getIntent().getLongExtra(EXTRA_FEED_ID, -1);
FeedManager manager = FeedManager.getInstance();
Feed feed = manager.getFeed(feedId);
if (feed != null) {
imgvCover = (ImageView) findViewById(R.id.imgvCover);
txtvTitle = (TextView) findViewById(R.id.txtvTitle);
txtvDescription = (TextView) findViewById(R.id.txtvDescription);
imgvCover.setImageBitmap(feed.getImage().getImageBitmap());
txtvTitle.setText(feed.getTitle());
txtvDescription.setText(feed.getDescription());
} else {
Log.e(TAG, "Activity was started with invalid arguments");
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
return true;
default:
return false;
}
}
}

View File

@ -10,6 +10,7 @@ import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
import de.podfetcher.R;
import de.podfetcher.activity.FeedInfoActivity;
import de.podfetcher.feed.Feed;
import de.podfetcher.feed.FeedItem;
import de.podfetcher.feed.FeedManager;
@ -34,6 +35,11 @@ public class FeedMenuHandler {
Feed selectedFeed) {
FeedManager manager = FeedManager.getInstance();
switch (item.getItemId()) {
case R.id.show_info_item:
Intent startIntent = new Intent(context, FeedInfoActivity.class);
startIntent.putExtra(FeedInfoActivity.EXTRA_FEED_ID, selectedFeed.getId());
context.startActivity(startIntent);
break;
case R.id.mark_all_read_item:
manager.markFeedRead(context, selectedFeed);
break;