Added ability to show the title of the feed in itemlistadapter
This commit is contained in:
parent
764ef2b1d6
commit
5920c96ae7
|
@ -20,7 +20,6 @@
|
|||
android:scaleType="fitXY"
|
||||
android:src="@drawable/navigation_expand" />
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
|
@ -34,6 +33,12 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:textSize="16dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtvFeedname"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtvPublished"
|
||||
android:layout_width="fill_parent"
|
||||
|
@ -70,7 +75,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:src="@drawable/av_download"
|
||||
android:visibility="gone" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imgvDownloading"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
@ -22,11 +22,13 @@ import android.graphics.Typeface;
|
|||
|
||||
public class FeedItemlistAdapter extends ArrayAdapter<FeedItem> {
|
||||
private OnClickListener onButActionClicked;
|
||||
|
||||
private boolean showFeedtitle;
|
||||
|
||||
public FeedItemlistAdapter(Context context, int textViewResourceId,
|
||||
List<FeedItem> objects, OnClickListener onButActionClicked) {
|
||||
List<FeedItem> objects, OnClickListener onButActionClicked, boolean showFeedtitle) {
|
||||
super(context, textViewResourceId, objects);
|
||||
this.onButActionClicked = onButActionClicked;
|
||||
this.showFeedtitle = showFeedtitle;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -54,13 +56,20 @@ public class FeedItemlistAdapter extends ArrayAdapter<FeedItem> {
|
|||
.findViewById(R.id.imgvDownloading);
|
||||
holder.encInfo = (RelativeLayout) convertView
|
||||
.findViewById(R.id.enc_info);
|
||||
|
||||
if (showFeedtitle) {
|
||||
holder.feedtitle = (TextView) convertView.findViewById(R.id.txtvFeedname);
|
||||
}
|
||||
|
||||
convertView.setTag(holder);
|
||||
} else {
|
||||
holder = (Holder) convertView.getTag();
|
||||
}
|
||||
|
||||
holder.title.setText(item.getTitle());
|
||||
if (showFeedtitle) {
|
||||
holder.feedtitle.setVisibility(View.VISIBLE);
|
||||
holder.feedtitle.setText(item.getFeed().getTitle());
|
||||
}
|
||||
if (!item.isRead()) {
|
||||
holder.title.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
} else {
|
||||
|
@ -111,6 +120,7 @@ public class FeedItemlistAdapter extends ArrayAdapter<FeedItem> {
|
|||
|
||||
static class Holder {
|
||||
TextView title;
|
||||
TextView feedtitle;
|
||||
TextView published;
|
||||
TextView lenSize;
|
||||
ImageView downloaded;
|
||||
|
|
|
@ -42,10 +42,14 @@ public class ItemlistFragment extends SherlockListFragment {
|
|||
|
||||
protected FeedItem selectedItem;
|
||||
protected ActionMode mActionMode;
|
||||
|
||||
/** Argument for FeeditemlistAdapter */
|
||||
protected boolean showFeedtitle;
|
||||
|
||||
public ItemlistFragment(ArrayList<FeedItem> items) {
|
||||
public ItemlistFragment(ArrayList<FeedItem> items, boolean showFeedtitle) {
|
||||
super();
|
||||
this.items = items;
|
||||
this.showFeedtitle = showFeedtitle;
|
||||
manager = FeedManager.getInstance();
|
||||
requester = DownloadRequester.getInstance();
|
||||
}
|
||||
|
@ -53,8 +57,14 @@ public class ItemlistFragment extends SherlockListFragment {
|
|||
public ItemlistFragment() {
|
||||
}
|
||||
|
||||
/** Creates new ItemlistFragment which shows the Feeditems of a specific feed.
|
||||
* Sets 'showFeedtitle' to false
|
||||
* @param feedId The id of the feed to show
|
||||
* @return the newly created instance of an ItemlistFragment
|
||||
*/
|
||||
public static ItemlistFragment newInstance(long feedId) {
|
||||
ItemlistFragment i = new ItemlistFragment();
|
||||
i.showFeedtitle = false;
|
||||
Bundle b = new Bundle();
|
||||
b.putLong(ARGUMENT_FEED_ID, feedId);
|
||||
i.setArguments(b);
|
||||
|
@ -69,7 +79,7 @@ public class ItemlistFragment extends SherlockListFragment {
|
|||
items = FeedManager.getInstance().getFeed(feedId).getItems();
|
||||
}
|
||||
fila = new FeedItemlistAdapter(getActivity(), 0, items,
|
||||
onButActionClicked);
|
||||
onButActionClicked, showFeedtitle);
|
||||
setListAdapter(fila);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import de.podfetcher.feed.FeedManager;
|
|||
public class QueueFragment extends ItemlistFragment {
|
||||
|
||||
public QueueFragment() {
|
||||
super(FeedManager.getInstance().getQueue());
|
||||
super(FeedManager.getInstance().getQueue(), true);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import de.podfetcher.feed.FeedManager;
|
|||
public class UnreadItemlistFragment extends ItemlistFragment {
|
||||
|
||||
public UnreadItemlistFragment() {
|
||||
super(FeedManager.getInstance().getUnreadItems());
|
||||
super(FeedManager.getInstance().getUnreadItems(), true);
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue