Fix highlighting

This commit is contained in:
Martin Fietz 2016-03-24 21:05:48 +01:00
parent d249d0f228
commit f43d5636ac
1 changed files with 9 additions and 5 deletions

View File

@ -177,7 +177,7 @@ public class NavListAdapter extends BaseAdapter
} else if (viewType == VIEW_TYPE_SECTION_DIVIDER) { } else if (viewType == VIEW_TYPE_SECTION_DIVIDER) {
v = getSectionDividerView(convertView, parent); v = getSectionDividerView(convertView, parent);
} else { } else {
v = getFeedView(position - getSubscriptionOffset(), convertView, parent); v = getFeedView(position, convertView, parent);
} }
if (v != null && viewType != VIEW_TYPE_SECTION_DIVIDER) { if (v != null && viewType != VIEW_TYPE_SECTION_DIVIDER) {
TextView txtvTitle = (TextView) v.findViewById(R.id.txtvTitle); TextView txtvTitle = (TextView) v.findViewById(R.id.txtvTitle);
@ -267,10 +267,11 @@ public class NavListAdapter extends BaseAdapter
return convertView; return convertView;
} }
private View getFeedView(int feedPos, View convertView, ViewGroup parent) { private View getFeedView(int position, View convertView, ViewGroup parent) {
FeedHolder holder; int feedPos = position - getSubscriptionOffset();
Feed feed = itemAccess.getItem(feedPos); Feed feed = itemAccess.getItem(feedPos);
FeedHolder holder;
if (convertView == null) { if (convertView == null) {
holder = new FeedHolder(); holder = new FeedHolder();
LayoutInflater inflater = (LayoutInflater) context LayoutInflater inflater = (LayoutInflater) context
@ -298,7 +299,6 @@ public class NavListAdapter extends BaseAdapter
holder.title.setText(feed.getTitle()); holder.title.setText(feed.getTitle());
if(feed.hasLastUpdateFailed()) { if(feed.hasLastUpdateFailed()) {
RelativeLayout.LayoutParams p = (RelativeLayout.LayoutParams) holder.title.getLayoutParams(); RelativeLayout.LayoutParams p = (RelativeLayout.LayoutParams) holder.title.getLayoutParams();
p.addRule(RelativeLayout.LEFT_OF, R.id.itxtvFailure); p.addRule(RelativeLayout.LEFT_OF, R.id.itxtvFailure);
@ -312,7 +312,11 @@ public class NavListAdapter extends BaseAdapter
if(counter > 0) { if(counter > 0) {
holder.count.setVisibility(View.VISIBLE); holder.count.setVisibility(View.VISIBLE);
holder.count.setText(String.valueOf(counter)); holder.count.setText(String.valueOf(counter));
holder.count.setTypeface(holder.title.getTypeface()); if (itemAccess.getSelectedItemIndex() == position) {
holder.count.setTypeface(null, Typeface.BOLD);
} else {
holder.count.setTypeface(null, Typeface.NORMAL);
}
} else { } else {
holder.count.setVisibility(View.GONE); holder.count.setVisibility(View.GONE);
} }