diff options
Diffstat (limited to 'vdrmanager/src')
3 files changed, 53 insertions, 27 deletions
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventAdapter.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventAdapter.java index dde92d0..0d23964 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventAdapter.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventAdapter.java @@ -158,32 +158,9 @@ abstract class BaseEventAdapter<T extends EventListItem> extends return itemHolder; } - public void fillEventViewHolder(EventListItemHolder itemHolder, + protected void handleState(EventListItemHolder itemHolder, EventListItem item) { - - itemHolder.state.setVisibility(View.VISIBLE); - - if (item.getEvent() instanceof Recording) { - Recording r = (Recording) item.getEvent(); - if (r.getTimerStopTime() != null) { - itemHolder.state.setImageResource(R.drawable.timer_recording); - } else { - itemHolder.state.setImageResource(R.drawable.timer_none); - itemHolder.other.setVisibility(View.GONE); - if (r.isNeww() == true) { - itemHolder.state.setImageResource(R.drawable.newrecording); - if (r.isCut()) { - itemHolder.other.setVisibility(View.VISIBLE); - itemHolder.other.setImageResource(R.drawable.schere); - } else { - itemHolder.other.setVisibility(View.GONE); - } - } else if (r.isCut()) { - itemHolder.state.setImageResource(R.drawable.schere); - } - } - - } else if (item.getEvent() instanceof Timerable) { + if (item.getEvent() instanceof Timerable) { TimerMatch match = ((Timerable) item.getEvent()).getTimerMatch(); switch (((Timerable) item.getEvent()).getTimerState()) { case Active: @@ -215,6 +192,15 @@ abstract class BaseEventAdapter<T extends EventListItem> extends itemHolder.state.setImageResource(R.drawable.timer_none); } + } + + public void fillEventViewHolder(EventListItemHolder itemHolder, + EventListItem item) { + + itemHolder.state.setVisibility(View.VISIBLE); + + handleState(itemHolder, item); + final EventFormatter formatter = getEventFormatter(item); itemHolder.time.setText(formatter.getTime()); if (hideChannelName) { diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingAdapter.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingAdapter.java index 892e857..b664276 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingAdapter.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingAdapter.java @@ -8,6 +8,7 @@ import de.bjusystems.vdrmanager.R; import de.bjusystems.vdrmanager.data.Event; import de.bjusystems.vdrmanager.data.EventFormatter; import de.bjusystems.vdrmanager.data.EventListItem; +import de.bjusystems.vdrmanager.data.Recording; import de.bjusystems.vdrmanager.data.RecordingListItem; class RecordingAdapter extends BaseEventAdapter<EventListItem> { @@ -100,6 +101,7 @@ class RecordingAdapter extends BaseEventAdapter<EventListItem> { public RecordingListItem getItem(int position) { return (RecordingListItem) super.getItem(position); } + // // protected void addSuper(RecordingListItem item) { // super.addSuper(item); @@ -108,5 +110,28 @@ class RecordingAdapter extends BaseEventAdapter<EventListItem> { // protected void clearSuper() { // super.clear(); // } + protected void handleState(EventListItemHolder itemHolder, + EventListItem item) { + + Recording r = (Recording) item.getEvent(); + if (r.getTimerStopTime() != null) { + itemHolder.state.setImageResource(R.drawable.timer_recording); + } else { + itemHolder.state.setImageResource(R.drawable.timer_none); + itemHolder.other.setVisibility(View.GONE); + if (r.isNeww() == true) { + itemHolder.state.setImageResource(R.drawable.newrecording); + if (r.isCut()) { + itemHolder.other.setVisibility(View.VISIBLE); + itemHolder.other.setImageResource(R.drawable.schere); + } else { + itemHolder.other.setVisibility(View.GONE); + } + } else if (r.isCut()) { + itemHolder.state.setImageResource(R.drawable.schere); + } + } + + } }
\ No newline at end of file diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimeEventAdapter.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimeEventAdapter.java index f5cca64..b577e11 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimeEventAdapter.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimeEventAdapter.java @@ -1,10 +1,12 @@ package de.bjusystems.vdrmanager.gui; import android.content.Context; +import android.view.View; import de.bjusystems.vdrmanager.R; import de.bjusystems.vdrmanager.data.Event; import de.bjusystems.vdrmanager.data.EventFormatter; import de.bjusystems.vdrmanager.data.EventListItem; +import de.bjusystems.vdrmanager.data.Timer; public class TimeEventAdapter extends BaseEventAdapter<EventListItem> { @@ -13,11 +15,24 @@ public class TimeEventAdapter extends BaseEventAdapter<EventListItem> { } public void sortItems() { - // sortItemsByChannel(); + // sortItemsByChannel(); } @Override protected EventFormatter getEventFormatter(Event event) { - return new EventFormatter(event,true); + return new EventFormatter(event, true); + } + + @Override + protected void handleState(EventListItemHolder itemHolder, + EventListItem item) { + super.handleState(itemHolder, item); + Timer r = (Timer) item.getEvent(); + if (r.isVps()) { + itemHolder.other.setVisibility(View.VISIBLE); + itemHolder.other.setImageResource(R.drawable.timer_vps); + } else { + itemHolder.other.setVisibility(View.GONE); + } } }
\ No newline at end of file |