From 1ab5a0942981a0572fa2222ecbc7f5f94f662721 Mon Sep 17 00:00:00 2001 From: daniel oeh Date: Tue, 9 Apr 2013 12:47:39 +0200 Subject: [PATCH] Updated header view layout --- res/layout/episodes_fragment.xml | 6 +- res/layout/external_itemlist_item.xml | 101 +++++++++--------- res/layout/feeditemlist_header.xml | 14 ++- .../adapter/ExternalEpisodesListAdapter.java | 20 ++-- 4 files changed, 77 insertions(+), 64 deletions(-) diff --git a/res/layout/episodes_fragment.xml b/res/layout/episodes_fragment.xml index da350af15..5536a5545 100644 --- a/res/layout/episodes_fragment.xml +++ b/res/layout/episodes_fragment.xml @@ -6,11 +6,7 @@ + android:layout_height="match_parent" > \ No newline at end of file diff --git a/res/layout/external_itemlist_item.xml b/res/layout/external_itemlist_item.xml index a2d496128..2d0093641 100644 --- a/res/layout/external_itemlist_item.xml +++ b/res/layout/external_itemlist_item.xml @@ -33,7 +33,7 @@ android:layout_alignParentTop="true" android:layout_marginLeft="8dp" android:layout_marginRight="4dp" - android:layout_marginTop="8dp" + android:layout_marginTop="2dp" android:layout_toLeftOf="@id/butAction" android:layout_toRightOf="@id/imgvFeedimage" android:ellipsize="end" @@ -41,42 +41,59 @@ android:textColor="?android:attr/textColorPrimary" android:textSize="@dimen/text_size_small" /> - - - - - + android:layout_toLeftOf="@id/butAction" + android:layout_toRightOf="@id/imgvFeedimage" + android:orientation="vertical" > + + + + + + + + + + + + - - \ No newline at end of file diff --git a/res/layout/feeditemlist_header.xml b/res/layout/feeditemlist_header.xml index e03f22e4a..31ccb7e96 100644 --- a/res/layout/feeditemlist_header.xml +++ b/res/layout/feeditemlist_header.xml @@ -15,10 +15,10 @@ android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_centerVertical="true" - android:layout_marginBottom="24dp" + android:layout_marginBottom="32dp" android:layout_marginLeft="28dp" android:layout_marginRight="16dp" - android:layout_marginTop="24dp" + android:layout_marginTop="32dp" android:paddingLeft="8dp" android:textAllCaps="true" android:textColor="@color/dark_blue" @@ -40,6 +40,16 @@ android:paddingTop="16dp" android:scaleType="fitEnd" android:src="?attr/spinner_button" /> + + \ No newline at end of file diff --git a/src/de/danoeh/antennapod/adapter/ExternalEpisodesListAdapter.java b/src/de/danoeh/antennapod/adapter/ExternalEpisodesListAdapter.java index cde21895f..916e13469 100644 --- a/src/de/danoeh/antennapod/adapter/ExternalEpisodesListAdapter.java +++ b/src/de/danoeh/antennapod/adapter/ExternalEpisodesListAdapter.java @@ -231,20 +231,26 @@ public class ExternalEpisodesListAdapter extends BaseExpandableListAdapter { TextView headerTitle = (TextView) convertView .findViewById(R.id.txtvHeaderTitle); ImageButton actionButton = (ImageButton) convertView - .findViewById(R.id.butAction); + .findViewById(R.id.butAction); + TextView numItems = (TextView) convertView.findViewById(R.id.txtvNumItems); + String headerString = null; + int childrenCount = 0; + if (groupPosition == 0) { headerString = context.getString(R.string.queue_label); - if (manager.getQueueSize(true) > 0) { - headerString += " (" + getChildrenCount(GROUP_POS_QUEUE) + ")"; - } + childrenCount = getChildrenCount(GROUP_POS_QUEUE); } else { headerString = context.getString(R.string.waiting_list_label); - if (manager.getUnreadItemsSize(true) > 0) { - headerString += " (" + getChildrenCount(GROUP_POS_UNREAD) + ")"; - } + childrenCount = getChildrenCount(GROUP_POS_UNREAD); } headerTitle.setText(headerString); + if (childrenCount <= 0) { + numItems.setVisibility(View.INVISIBLE); + } else { + numItems.setVisibility(View.VISIBLE); + numItems.setText(Integer.toString(childrenCount)); + } actionButton.setFocusable(false); actionButton.setOnClickListener(new OnClickListener() {