UI improvements in ItemviewActivity and FeeditemlistActivity

This commit is contained in:
daniel oeh 2012-06-25 13:58:40 +02:00
parent a66580bfc6
commit fc88223779
5 changed files with 22 additions and 13 deletions

View File

@ -20,21 +20,12 @@
android:scaleType="fitXY"
android:src="@drawable/navigation_expand" />
<ImageView
android:id="@+id/divider"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_toLeftOf="@id/butAction"
android:focusable="false"
android:scaleType="fitXY"
android:src="@drawable/vertical_divider" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@id/divider"
android:layout_toLeftOf="@id/butAction"
android:orientation="vertical" >
<TextView

View File

@ -1,6 +1,7 @@
package de.podfetcher.activity;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
@ -33,13 +34,15 @@ public class FeedItemlistActivity extends SherlockFragmentActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(R.layout.feeditemlist_activity);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setContentView(R.layout.feeditemlist_activity);
manager = FeedManager.getInstance();
long feedId = getIntent().getLongExtra(FeedlistFragment.EXTRA_SELECTED_FEED, -1);
if(feedId == -1) Log.e(TAG, "Received invalid feed selection.");
feed = manager.getFeed(feedId);
getSupportActionBar().setLogo(new BitmapDrawable(feed.getImage().getImageBitmap()));
setTitle(feed.getTitle());
FragmentManager fragmentManager = getSupportFragmentManager();
@ -77,6 +80,8 @@ public class FeedItemlistActivity extends SherlockFragmentActivity {
};
remover.execute(feed);
break;
case android.R.id.home:
finish();
}
}
return true;

View File

@ -7,6 +7,7 @@ import java.text.DateFormat;
import org.apache.commons.lang3.StringEscapeUtils;
import android.content.Intent;
import android.graphics.drawable.BitmapDrawable;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.format.DateUtils;
@ -79,7 +80,9 @@ public class ItemviewActivity extends SherlockActivity {
}
private void populateUI() {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setContentView(R.layout.feeditemview);
getSupportActionBar().setLogo(new BitmapDrawable(item.getFeed().getImage().getImageBitmap()));
txtvTitle = (TextView) findViewById(R.id.txtvItemname);
txtvPublished = (TextView) findViewById(R.id.txtvPublished);
webvDescription = (WebView) findViewById(R.id.webvDescription);
@ -113,7 +116,13 @@ public class ItemviewActivity extends SherlockActivity {
@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
FeedItemMenuHandler.onMenuItemClicked(this, menuItem, item);
if (!FeedItemMenuHandler.onMenuItemClicked(this, menuItem, item)) {
switch(menuItem.getItemId()) {
case android.R.id.home:
finish();
break;
}
}
invalidateOptionsMenu();
return true;
}

View File

@ -155,6 +155,7 @@ public class ItemlistFragment extends SherlockListFragment {
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
mode.setTitle(selectedItem.getTitle());
return FeedItemMenuHandler.onCreateMenu(mode.getMenuInflater(), menu);
}

View File

@ -81,6 +81,9 @@ public class FeedItemMenuHandler {
case R.id.stream_item:
manager.playMedia(context, selectedItem.getMedia(), true, true,
true);
break;
default:
return false;
}
// Refresh menu state