summaryrefslogtreecommitdiff
path: root/vdrmanager/src/de/bjusystems
diff options
context:
space:
mode:
Diffstat (limited to 'vdrmanager/src/de/bjusystems')
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java4
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/data/Timer.java54
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java3
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelListActivity.java19
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java2
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingListActivity.java78
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerDetailsActivity.java209
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/ChannelClient.java10
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpAsyncTask.java3
9 files changed, 350 insertions, 32 deletions
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java
index 88156cd..a846596 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java
@@ -4,16 +4,12 @@ import java.util.List;
import java.util.Locale;
import android.content.Context;
-import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.text.TextUtils;
-import android.widget.Toast;
import de.bjusystems.vdrmanager.R;
import de.bjusystems.vdrmanager.StringUtils;
-import de.bjusystems.vdrmanager.app.Intents;
import de.bjusystems.vdrmanager.data.db.OrmDatabaseHelper;
-import de.bjusystems.vdrmanager.gui.VdrListActivity;
/**
* Class for all preferences
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/Timer.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/Timer.java
index 0c8ce4e..929165c 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/data/Timer.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/data/Timer.java
@@ -15,8 +15,14 @@ import de.bjusystems.vdrmanager.gui.Utils;
* @author bju
*/
public class Timer extends Event implements Timerable{
-
- private static final int ENABLED = 1;
+
+
+// tfActive = 0x0001,
+// tfInstant = 0x0002,
+// tfVps = 0x0004,
+// tfRecording = 0x0008,
+// tfAll = 0xFFFF,
+ private static final int ACTIVE = 1;
private static final int INSTANT = 2;
private static final int VPS = 4;
private static final int RECORDING = 8;
@@ -25,6 +31,27 @@ public class Timer extends Event implements Timerable{
private int flags;
private int priority;
private int lifetime;
+ private String weekdays = "-------";
+
+ public void setPriority(int priority) {
+ this.priority = priority;
+ }
+
+
+ public void setLifetime(int lifetime) {
+ this.lifetime = lifetime;
+ }
+
+
+ public String getWeekdays() {
+ return weekdays;
+ }
+
+
+ public void setWeekdays(String weekdays) {
+ this.weekdays = weekdays;
+ }
+
/**
* Constructs a timer from SvdrpHelper result line
@@ -72,6 +99,10 @@ public class Timer extends Event implements Timerable{
this.channelId = values[12];
}
+ if(values.length > 13) {
+ this.weekdays = values[13];
+ }
+
description = Utils.mapSpecialChars(description);
}
@@ -86,6 +117,7 @@ public class Timer extends Event implements Timerable{
t.start = new Date(start.getTime());
t.stop = new Date(stop.getTime());
t.title = title;
+ t.weekdays = weekdays;
return t;
}
@@ -93,7 +125,7 @@ public class Timer extends Event implements Timerable{
final Preferences prefs = Preferences.getPreferences();
this.number = 0;
- this.flags = ENABLED;
+ this.flags = ACTIVE;
this.channelNumber = event.getChannelNumber();
this.channelName = event.getChannelName();
this.channelId = event.getChannelId();
@@ -119,7 +151,7 @@ public class Timer extends Event implements Timerable{
final Calendar cal = new GregorianCalendar();
cal.setTime(start);
- line.append(String.format("%04d-%02d-%02d:", cal.get(Calendar.YEAR),
+ line.append((weekdays.equals("-------") == false ? weekdays + "@" : "") + String.format("%04d-%02d-%02d:", cal.get(Calendar.YEAR),
cal.get(Calendar.MONTH) + 1, cal.get(Calendar.DAY_OF_MONTH)));
line.append(String.format("%02d%02d:", cal.get(Calendar.HOUR_OF_DAY),
cal.get(Calendar.MINUTE)));
@@ -157,7 +189,7 @@ public class Timer extends Event implements Timerable{
}
public boolean isEnabled() {
- return (flags & ENABLED) == ENABLED;
+ return (flags & ACTIVE) == ACTIVE;
}
public boolean isInstant() {
@@ -180,11 +212,19 @@ public class Timer extends Event implements Timerable{
this.stop = stop;
}
+ public void setVps(boolean useVps){
+ if(useVps){
+ flags = flags | VPS;
+ } else {
+ flags = flags & ~VPS;
+ }
+ }
+
public void setEnabled(final boolean enabled) {
if (enabled) {
- flags = flags | ENABLED;
+ flags = flags | ACTIVE;
} else {
- flags = flags & ~ENABLED;
+ flags = flags & ~ACTIVE;
}
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java
index 39f03b3..2da2a67 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java
@@ -227,6 +227,9 @@ public abstract class BaseActivity<Result, T extends ListView> extends ICSBaseAc
}
protected void alert(String msg) {
+ if(isFinishing()){
+ return;
+ }
new AlertDialog.Builder(this)//
.setMessage(msg)//
.setPositiveButton(android.R.string.ok, null)//
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelListActivity.java
index ee67b90..08a1956 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelListActivity.java
@@ -35,6 +35,7 @@ import de.bjusystems.vdrmanager.tasks.VoidAsyncTask;
import de.bjusystems.vdrmanager.utils.svdrp.ChannelClient;
import de.bjusystems.vdrmanager.utils.svdrp.SvdrpAsyncTask;
import de.bjusystems.vdrmanager.utils.svdrp.SvdrpClient;
+import de.bjusystems.vdrmanager.utils.svdrp.SvdrpEvent;
/**
* This class is used for showing what's current running on all channels
@@ -60,6 +61,8 @@ public class ChannelListActivity extends
public static final int MENU_NAME = 2;
private int groupBy = MENU_GROUP;
+
+ private int groupByInverse = 0;
final static ArrayList<String> ALL_CHANNELS_GROUP = new ArrayList<String>(1);
@@ -106,8 +109,16 @@ public class ChannelListActivity extends
return;
}
- // get channel task
- channelClient = new ChannelClient(useCache);
+ if(channelClient == null){
+ // get channel task
+ channelClient = new ChannelClient();
+ } else {
+ channelClient.removeSvdrpListener(this);
+ }
+
+ if(useCache == false){
+ ChannelClient.clearCache();
+ }
// create background task
final SvdrpAsyncTask<Channel, SvdrpClient<Channel>> task = new SvdrpAsyncTask<Channel, SvdrpClient<Channel>>(
@@ -504,5 +515,9 @@ public class ChannelListActivity extends
protected SvdrpClient<Channel> getClient() {
return channelClient;
}
+
+ public void svdrpEvent(SvdrpEvent event, Channel result){
+ super.svdrpEvent(event, result);
+ }
} \ No newline at end of file
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java
index 14273c2..eedcc76 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java
@@ -107,7 +107,7 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> implements
}
private void startQuery() {
- new ChannelsTask(this, new ChannelClient(true)) {
+ new ChannelsTask(this, new ChannelClient()) {
public void finished(SvdrpEvent event) {
if (event == SvdrpEvent.CACHE_HIT
|| event == SvdrpEvent.FINISHED_SUCCESS) {
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingListActivity.java
index 64faf73..0b1cda7 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingListActivity.java
@@ -1,12 +1,16 @@
package de.bjusystems.vdrmanager.gui;
+import java.util.ArrayList;
import java.util.Calendar;
-import android.content.ClipData.Item;
+import android.app.AlertDialog;
+import android.content.DialogInterface;
+
import android.os.Bundle;
-import android.util.Log;
+
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
+import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
@@ -37,6 +41,18 @@ public class RecordingListActivity extends BaseEventListActivity<Recording>
RecordingClient recordingClient;
+ public static final int MENU_DATE = 0;
+ public static final int MENU_NAME = 1;
+ public static final int MENU_CHANNEL = 2;
+
+ public static final int ASC = 0;
+
+ public static final int DESC = 1;
+
+ private int groupBy = MENU_DATE;
+
+ private int ASC_DESC = ASC;
+
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -61,6 +77,64 @@ public class RecordingListActivity extends BaseEventListActivity<Recording>
}
+ private String[] getAvailableGroupByEntries() {
+ ArrayList<String> entries = new ArrayList<String>(2);
+ entries.add(getString(R.string.groupby_date));
+ entries.add(getString(R.string.groupby_name));
+ entries.add(getString(R.string.groupby_channel));
+ return entries.toArray(Utils.EMPTY);
+ }
+
+ AlertDialog groupByDialog = null;
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+
+ switch (item.getItemId()) {
+ case R.id.menu_groupby:
+ // case MENU_PROVIDER:
+ // case MENU_NAME:
+ if (groupByDialog == null) {
+ groupByDialog = new AlertDialog.Builder(this)
+ .setTitle(R.string.menu_groupby)
+ .setIcon(android.R.drawable.ic_menu_sort_alphabetically)
+ .setSingleChoiceItems(getAvailableGroupByEntries(),
+ groupBy, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog,
+ int which) {
+ if(groupBy == which){
+ ASC_DESC = ASC_DESC == ASC ? DESC : ASC;
+ } else {
+ groupBy = which;
+ ASC_DESC = ASC;
+ }
+ //fillAdapter();
+ groupByDialog.dismiss();
+ }
+ }).create();
+ }
+
+ groupByDialog.show();
+
+ return true;
+ default:
+ return super.onOptionsItemSelected(item);
+ }
+ }
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * de.bjusystems.vdrmanager.gui.BaseActivity#onCreateOptionsMenu(android
+ * .view.Menu)
+ */
+ @Override
+ public boolean onCreateOptionsMenu(final Menu menu) {
+ final MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.recording_list_menu, menu);
+ return super.onCreateOptionsMenu(menu);
+ }
+
@Override
protected SvdrpClient<Recording> getClient() {
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerDetailsActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerDetailsActivity.java
index 599d18d..14ca7a1 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerDetailsActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerDetailsActivity.java
@@ -1,19 +1,26 @@
package de.bjusystems.vdrmanager.gui;
+import java.text.DateFormatSymbols;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import android.app.Activity;
+import android.app.AlertDialog;
import android.app.DatePickerDialog;
import android.app.DatePickerDialog.OnDateSetListener;
import android.app.TimePickerDialog;
import android.app.TimePickerDialog.OnTimeSetListener;
+import android.content.Context;
+import android.content.DialogInterface;
import android.os.Bundle;
+import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
+import android.widget.CheckBox;
import android.widget.DatePicker;
+import android.widget.EditText;
import android.widget.TextView;
import android.widget.TimePicker;
import android.widget.Toast;
@@ -30,36 +37,44 @@ import de.bjusystems.vdrmanager.utils.svdrp.SvdrpEvent;
public class TimerDetailsActivity extends Activity implements OnClickListener,
OnDateSetListener, OnTimeSetListener {
-
public static final int REQUEST_CODE_TIMER_MODIFIED = 34;
public static final int REQUEST_CODE_TIMER_EDIT = 35;
-
+
public static final int REQUEST_CODE_TIMER_ADD = 36;
-
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
-
View view = getLayoutInflater().inflate(R.layout.timer_detail, null);
tView = new EditTimerViewHolder();
tView.view = view;
tView.title = (TextView) view.findViewById(R.id.timer_detail_title);
tView.channel = (TextView) view.findViewById(R.id.timer_detail_channel);
tView.dateField = (Button) view.findViewById(R.id.timer_detail_day);
- tView.startField = (Button) view
- .findViewById(R.id.timer_detail_start);
+ tView.startField = (Button) view.findViewById(R.id.timer_detail_start);
tView.endField = (Button) view.findViewById(R.id.timer_detail_end);
tView.saveButton = (Button) view.findViewById(R.id.timer_details_save);
tView.modifyButton = (Button) view
.findViewById(R.id.timer_details_modify);
+ tView.repeat = (Button) view.findViewById(R.id.timer_detail_repeat);
+
+ tView.vps = (CheckBox) view.findViewById(R.id.timer_detail_vps);
+
+ tView.priority = (EditText) view
+ .findViewById(R.id.timer_detail_priority);
+
+ tView.lifecycle = (EditText) view
+ .findViewById(R.id.timer_detail_lifetime);
+
view.findViewById(R.id.timer_details_cancel).setOnClickListener(this);
tView.dateField.setOnClickListener(this);
tView.startField.setOnClickListener(this);
tView.endField.setOnClickListener(this);
tView.saveButton.setOnClickListener(this);
tView.modifyButton.setOnClickListener(this);
+ tView.repeat.setOnClickListener(this);
setContentView(view);
timer = getApp().getCurrentTimer();
original = timer.copy();
@@ -89,6 +104,10 @@ public class TimerDetailsActivity extends Activity implements OnClickListener,
Button endField;
Button saveButton;
Button modifyButton;
+ CheckBox vps;
+ Button repeat;
+ EditText priority;
+ EditText lifecycle;
}
EditTimerViewHolder tView = null;
@@ -98,7 +117,7 @@ public class TimerDetailsActivity extends Activity implements OnClickListener,
// SetTimerClient setTimerClient;
Timer timer;
-
+
Timer original;
private void updateDisplay(TimerOperation op) {
@@ -122,10 +141,17 @@ public class TimerDetailsActivity extends Activity implements OnClickListener,
EventFormatter f = new EventFormatter(timer, true);
tView.channel.setText(timer.getChannelNumber() + " "
+ timer.getChannelName());
+ // tView.title.setText(timer.isVps() ?
+ // getString(R.string.timer_detail_title_vps, f.getTitle()) :
+ // f.getTitle());
tView.title.setText(f.getTitle());
tView.dateField.setText(f.getDate());
tView.startField.setText(f.getTime());
tView.endField.setText(f.getStop());
+ tView.vps.setChecked(timer.isVps());
+ tView.priority.setText(String.valueOf(timer.getPriority()));
+ tView.lifecycle.setText(String.valueOf(timer.getLifetime()));
+ tView.repeat.setText(getSelectedItems().toString(this, true));
}
protected VdrManagerApp getApp() {
@@ -173,26 +199,96 @@ public class TimerDetailsActivity extends Activity implements OnClickListener,
break;
}
case R.id.timer_details_cancel: {
-// finishActivity(REQUEST_CODE_TIMER_EDIT);
+ // finishActivity(REQUEST_CODE_TIMER_EDIT);
finish();
break;
}
case R.id.timer_details_modify:
timer.setTitle(tView.title.getText().toString());
+ timer.setVps(tView.vps.isChecked());
+ timer.setPriority(getIntOr0(tView.priority));
+ timer.setLifetime(getIntOr0(tView.lifecycle));
+
modifyTimer(timer);
- //say(R.string.done);
+ // say(R.string.done);
break;
case R.id.timer_details_save: {
timer.setTitle(tView.title.getText().toString());
+
createTimer(timer);
- //say(R.string.done);
+ // say(R.string.done);
break;
}
-
+
+ case R.id.timer_detail_repeat: {
+
+ String[] weekdays = new DateFormatSymbols().getWeekdays();
+ String[] values = new String[] { weekdays[Calendar.MONDAY],
+ weekdays[Calendar.TUESDAY], weekdays[Calendar.WEDNESDAY],
+ weekdays[Calendar.THURSDAY], weekdays[Calendar.FRIDAY],
+ weekdays[Calendar.SATURDAY], weekdays[Calendar.SUNDAY], };
+
+ final DaysOfWeek mNewDaysOfWeek = new DaysOfWeek(0);
+
+ final AlertDialog b = new AlertDialog.Builder(this)
+ .setMultiChoiceItems(values, getSelectedItems().getBooleanArray(),
+ new DialogInterface.OnMultiChoiceClickListener() {
+ public void onClick(DialogInterface dialog,
+ int which, boolean isChecked) {
+ mNewDaysOfWeek.set(which, isChecked);
+ }
+ })
+ .setNegativeButton(android.R.string.cancel, null)
+ .setPositiveButton(android.R.string.ok,
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog,
+ int which) {
+ StringBuilder sb = new StringBuilder(7);
+ sb.append(mNewDaysOfWeek.isSet(0) ? 'M' : '-');
+ sb.append(mNewDaysOfWeek.isSet(1) ? 'T' : '-');
+ sb.append(mNewDaysOfWeek.isSet(2) ? 'W' : '-');
+ sb.append(mNewDaysOfWeek.isSet(3) ? 'T' : '-');
+ sb.append(mNewDaysOfWeek.isSet(4) ? 'F' : '-');
+ sb.append(mNewDaysOfWeek.isSet(5) ? 'S' : '-');
+ sb.append(mNewDaysOfWeek.isSet(6) ? 'S' : '-');
+ timer.setWeekdays(sb.toString());
+ tView.repeat.setText(mNewDaysOfWeek.toString(TimerDetailsActivity.this, true));
+ }
+ }).create();
+
+ b.show();
+ }
}
}
+ DaysOfWeek getSelectedItems() {
+ String str = timer.getWeekdays();
+
+ DaysOfWeek dow = new DaysOfWeek(0);
+ if (str.length() != 7) {
+ return dow;
+ }
+
+
+ dow.set(0, str.charAt(0) == 'M');
+ dow.set(1, str.charAt(1) == 'T');
+ dow.set(2, str.charAt(2) == 'W');
+ dow.set(3, str.charAt(3) == 'T');
+ dow.set(4, str.charAt(4) == 'F');
+ dow.set(5, str.charAt(5) == 'S');
+ dow.set(6, str.charAt(6) == 'S');
+
+ return dow;
+ }
+
+ private int getIntOr0(EditText text) {
+ if (TextUtils.isEmpty(text.getText().toString())) {
+ return 0;
+ }
+ return Integer.valueOf(text.getText().toString());
+ }
+
protected void say(int res) {
Toast.makeText(this, res, Toast.LENGTH_SHORT).show();
}
@@ -273,4 +369,95 @@ public class TimerDetailsActivity extends Activity implements OnClickListener,
task.start();
}
+ /*
+ * Days of week code as a single int. 0x00: no day 0x01: Monday 0x02:
+ * Tuesday 0x04: Wednesday 0x08: Thursday 0x10: Friday 0x20: Saturday 0x40:
+ * Sunday
+ */
+ static final class DaysOfWeek {
+
+ private static int[] DAY_MAP = new int[] { Calendar.MONDAY,
+ Calendar.TUESDAY, Calendar.WEDNESDAY, Calendar.THURSDAY,
+ Calendar.FRIDAY, Calendar.SATURDAY, Calendar.SUNDAY, };
+
+ // Bitmask of all repeating days
+ private int mDays;
+
+ DaysOfWeek(int days) {
+ mDays = days;
+ }
+
+ public String toString(Context context, boolean showNever) {
+ StringBuilder ret = new StringBuilder();
+
+ // no days
+ if (mDays == 0) {
+ return showNever ? context.getText(R.string.never).toString()
+ : "";
+ }
+
+ // every day
+ if (mDays == 0x7f) {
+ return context.getText(R.string.every_day).toString();
+ }
+
+ // count selected days
+ int dayCount = 0, days = mDays;
+ while (days > 0) {
+ if ((days & 1) == 1)
+ dayCount++;
+ days >>= 1;
+ }
+
+ // short or long form?
+ DateFormatSymbols dfs = new DateFormatSymbols();
+ String[] dayList = (dayCount > 1) ? dfs.getShortWeekdays() : dfs
+ .getWeekdays();
+
+ // selected days
+ for (int i = 0; i < 7; i++) {
+ if ((mDays & (1 << i)) != 0) {
+ ret.append(dayList[DAY_MAP[i]]);
+ dayCount -= 1;
+ if (dayCount > 0)
+ ret.append(context.getText(R.string.day_concat));
+ }
+ }
+ return ret.toString();
+ }
+
+ private boolean isSet(int day) {
+ return ((mDays & (1 << day)) > 0);
+ }
+
+ public void set(int day, boolean set) {
+ if (set) {
+ mDays |= (1 << day);
+ } else {
+ mDays &= ~(1 << day);
+ }
+ }
+
+ public void set(DaysOfWeek dow) {
+ mDays = dow.mDays;
+ }
+
+ public int getCoded() {
+ return mDays;
+ }
+
+ // Returns days of week encoded in an array of booleans.
+ public boolean[] getBooleanArray() {
+ boolean[] ret = new boolean[7];
+ for (int i = 0; i < 7; i++) {
+ ret[i] = isSet(i);
+ }
+ return ret;
+ }
+
+ public boolean isRepeatSet() {
+ return mDays != 0;
+ }
+
+ }
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/ChannelClient.java b/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/ChannelClient.java
index 8f60124..ecbed98 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/ChannelClient.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/ChannelClient.java
@@ -28,11 +28,11 @@ public class ChannelClient extends SvdrpClient<Channel> implements
private static boolean inited = false;
- public ChannelClient(boolean useCache) {
+ public ChannelClient() {
super();
- if (useCache == false) {
- clearCache();
- }
+// if (useCache == false) {
+// clearCache();
+// }
addSvdrpListener(this);
}
@@ -86,7 +86,7 @@ public class ChannelClient extends SvdrpClient<Channel> implements
if (inited == true) {
informListener(SvdrpEvent.CACHE_HIT, null);
} else {
- runCommand("channels " + Preferences.getPreferences().getChannels());
+ runCommand("channels " + Preferences.get().getChannels());
}
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpAsyncTask.java b/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpAsyncTask.java
index fd4c63b..743fca6 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpAsyncTask.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpAsyncTask.java
@@ -42,6 +42,9 @@ public class SvdrpAsyncTask<Result, Client extends SvdrpClient<Result>>
public void svdrpEvent(final SvdrpEvent event, final Result result) {
publishProgress(event, result);
+ if(event == SvdrpEvent.FINISHED_SUCCESS || event == SvdrpEvent.FINISHED_ABNORMALY || event == SvdrpEvent.ABORTED || event == SvdrpEvent.ERROR || event == SvdrpEvent.CACHE_HIT){
+ client.removeSvdrpListener(this);
+ }
}
@SuppressWarnings("unchecked")