From 9ec1a03caba363c6b8d06aac89b02607c352a007 Mon Sep 17 00:00:00 2001 From: lado Date: Mon, 8 Apr 2013 00:06:46 +0200 Subject: Fixed recording Folder searching --- .../src/de/bjusystems/vdrmanager/data/Event.java | 2 +- .../vdrmanager/data/RecordingListItem.java | 8 ++++++ .../vdrmanager/gui/BaseEventAdapter.java | 6 ++++- .../vdrmanager/gui/RecordingAdapter.java | 30 ++++++++++++++++------ 4 files changed, 36 insertions(+), 10 deletions(-) (limited to 'vdrmanager/src/de') diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/Event.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/Event.java index dcfb010..ef3fe0e 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/data/Event.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/data/Event.java @@ -111,7 +111,7 @@ public abstract class Event { } return TextUtils.substring(description, 0, 30) + "…"; } - return shortText; + return ""; } public String getDescription() { diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/RecordingListItem.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/RecordingListItem.java index 486b1a3..58d798c 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/data/RecordingListItem.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/data/RecordingListItem.java @@ -17,6 +17,14 @@ public class RecordingListItem extends EventListItem { + @Override + public String getTitle() { + if(isFolder()){ + return folder; + } + return super.getTitle(); + } + public boolean isFolder() { return folder != null; diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventAdapter.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventAdapter.java index 2f5dce5..b022311 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventAdapter.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventAdapter.java @@ -277,6 +277,10 @@ abstract class BaseEventAdapter extends ArrayAdapter public void setHideChannelName(boolean hideChannelName) { this.hideChannelName = hideChannelName; } + + protected boolean isHeader(EventListItem item){ + return item.isHeader(); + } // TODO implement locking in performFiltering, check the parent class // http://stackoverflow.com/questions/5846385/how-to-update-android-listview-with-dynamic-data-in-real-time @@ -292,7 +296,7 @@ abstract class BaseEventAdapter extends ArrayAdapter highlight = arg0.toString().toLowerCase(); ArrayList result = new ArrayList(); for (EventListItem event : items) { - if (event.isHeader()) { + if (isHeader(event)) { prevHead = event; // result.add(event); continue; diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingAdapter.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingAdapter.java index ff69795..9d537c1 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingAdapter.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingAdapter.java @@ -29,16 +29,21 @@ class RecordingAdapter extends BaseEventAdapter { public int getViewTypeCount() { return 3; } - + @Override - public void add(EventListItem object) { - items.add(object); - // if (object.isHeader()) { - // sections.add(object.getHeader()); - // } - super.add(object); + protected boolean isHeader(EventListItem item) { + if(item instanceof RecordingListItem == false){ + return item.isHeader(); + } + + if(((RecordingListItem)item).isFolder() ){ + return false; + } + + return item.isHeader(); } + @Override public int getItemViewType(int position) { @@ -89,7 +94,7 @@ class RecordingAdapter extends BaseEventAdapter { holder = (EventListItemFolderHolder) convertView.getTag(); } - holder.folder.setText(item.folder); + holder.folder.setText(Utils.highlight(item.folder, highlight)); holder.count.setText(String.valueOf(item.count)); return convertView; } @@ -98,4 +103,13 @@ class RecordingAdapter extends BaseEventAdapter { public RecordingListItem getItem(int position) { return (RecordingListItem) super.getItem(position); } +// +// protected void addSuper(RecordingListItem item) { +// super.addSuper(item); +// } +// +// protected void clearSuper() { +// super.clear(); +// } + } \ No newline at end of file -- cgit v1.2.3