diff options
Diffstat (limited to 'vdrmanager')
5 files changed, 50 insertions, 23 deletions
diff --git a/vdrmanager/res/layout/folder_item.xml b/vdrmanager/res/layout/folder_item.xml index fa2f8ab..432fa13 100644 --- a/vdrmanager/res/layout/folder_item.xml +++ b/vdrmanager/res/layout/folder_item.xml @@ -16,7 +16,17 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="5dip" + android:layout_weight="1" android:layout_gravity="center_vertical" android:text="House of Cards" /> + + <TextView + android:id="@+id/count" + android:textAppearance="?android:textAppearanceMedium" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:text="3" /> + </LinearLayout>
\ No newline at end of file diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/RecordingListItem.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/RecordingListItem.java index b3137e3..486b1a3 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/data/RecordingListItem.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/data/RecordingListItem.java @@ -5,6 +5,8 @@ public class RecordingListItem extends EventListItem { public String folder; + public Integer count = 0; + public RecordingListItem(Recording rec) { super(rec); } diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventAdapter.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventAdapter.java index 82ac575..2f5dce5 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventAdapter.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventAdapter.java @@ -166,6 +166,8 @@ abstract class BaseEventAdapter<T extends EventListItem> extends ArrayAdapter<T> Recording r = (Recording) item.getEvent(); if (r.getTimerStopTime() != null) { itemHolder.state.setImageResource(R.drawable.timer_recording); + } else { + itemHolder.state.setImageResource(R.drawable.timer_none); } } else if (item.getEvent() instanceof Timerable == true) { TimerMatch match = ((Timerable) item.getEvent()).getTimerMatch(); diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingAdapter.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingAdapter.java index bbc784c..ff69795 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingAdapter.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingAdapter.java @@ -57,12 +57,14 @@ class RecordingAdapter extends BaseEventAdapter<EventListItem> { class EventListItemFolderHolder { public TextView folder; + public TextView count; } protected EventListItemFolderHolder getFolderViewHolder(EventListItem item, View view) { EventListItemFolderHolder itemHolder = new EventListItemFolderHolder(); itemHolder.folder = (TextView) view.findViewById(R.id.header_item); + itemHolder.count = (TextView) view.findViewById(R.id.count); return itemHolder; } @@ -78,16 +80,17 @@ class RecordingAdapter extends BaseEventAdapter<EventListItem> { return super.getView(position, convertView, parent); } - Object holder = null; + EventListItemFolderHolder holder = null; if (convertView == null || (convertView != null && convertView.getTag() instanceof EventListItemFolderHolder) == false) { convertView = inflater.inflate(R.layout.folder_item, null); holder = getFolderViewHolder(item, convertView); convertView.setTag(holder); } else { - holder = convertView.getTag(); + holder = (EventListItemFolderHolder) convertView.getTag(); } - ((EventListItemFolderHolder) holder).folder.setText(item.folder); + holder.folder.setText(item.folder); + holder.count.setText(String.valueOf(item.count)); return convertView; } diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingListActivity.java index d3cb81a..c19e7ae 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingListActivity.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingListActivity.java @@ -3,6 +3,7 @@ package de.bjusystems.vdrmanager.gui; import java.util.ArrayList; import java.util.Calendar; import java.util.Collections; +import java.util.Comparator; import java.util.List; import java.util.Map; import java.util.Set; @@ -26,7 +27,6 @@ import de.bjusystems.vdrmanager.data.EventListItem; import de.bjusystems.vdrmanager.data.Preferences; import de.bjusystems.vdrmanager.data.Recording; import de.bjusystems.vdrmanager.data.RecordingListItem; -import de.bjusystems.vdrmanager.data.Recording.Folder; import de.bjusystems.vdrmanager.tasks.DeleteRecordingTask; import de.bjusystems.vdrmanager.utils.date.DateFormatter; import de.bjusystems.vdrmanager.utils.svdrp.RecordingClient; @@ -68,7 +68,6 @@ public class RecordingListActivity extends BaseEventListActivity<Recording> protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); - adapter = new RecordingAdapter(this); // attach adapter to ListView @@ -138,10 +137,11 @@ public class RecordingListActivity extends BaseEventListActivity<Recording> final RecordingListItem item = (RecordingListItem) adapter .getItem(position); if (item.isFolder()) { - if(currentFolder.equals(Recording.ROOT_FOLDER)){ + if (currentFolder.equals(Recording.ROOT_FOLDER)) { currentFolder = item.folder; } else { - currentFolder = currentFolder + Recording.FOLDERDELIMCHAR + item.folder; + currentFolder = currentFolder + Recording.FOLDERDELIMCHAR + + item.folder; } stack.push(currentFolder); fillAdapter(); @@ -315,6 +315,11 @@ public class RecordingListActivity extends BaseEventListActivity<Recording> for (String f : folders) { RecordingListItem recordingListItem = new RecordingListItem(f); recordingListItem.folder = f; + String sf = currentFolder.length() > 0 ? currentFolder + Recording.FOLDERDELIMCHAR + f : f; + List<Recording> list2 = CACHE.get(sf); + if (list2 != null) { + recordingListItem.count = list2.size(); + } adapter.add(recordingListItem); } } @@ -358,34 +363,39 @@ public class RecordingListActivity extends BaseEventListActivity<Recording> String[] split = folder.split(Recording.FOLDERDELIMCHAR); String key = null; String value = null; - if(split.length == 1){ - key = Recording.ROOT_FOLDER ; + if (split.length == 1) { + key = Recording.ROOT_FOLDER; value = split[0]; } else { value = split[split.length - 1]; - //StringBuilder sb = new StringBuilder(); - //String sep = ""; - //for(int i = 0; i < split.length - 1; ++i){ - //sb.append(sep).append(split[i]); - //sep = Recording.FOLDERDELIMCHAR; - //} - key = folder.subSequence(0, folder.length() - (value.length()+1) ).toString(); + // StringBuilder sb = new StringBuilder(); + // String sep = ""; + // for(int i = 0; i < split.length - 1; ++i){ + // sb.append(sep).append(split[i]); + // sep = Recording.FOLDERDELIMCHAR; + // } + key = folder.subSequence(0, + folder.length() - (value.length() + 1)).toString(); } Set<String> list = FOLDERS.get(key); - if(list == null){ - list = new TreeSet<String>(); + if (list == null) { + list = new TreeSet<String>(new Comparator<String>() { + @Override + public int compare(String lhs, String rhs) { + return lhs.compareToIgnoreCase(rhs); + } + }); FOLDERS.put(key, list); } list.add(value); - //a b - //a - //c - //a~b > k - + // a b + // a + // c + // a~b > k } List<Recording> list = CACHE.get(folder); |