summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlado <herrlado@gmail.com>2011-11-02 21:46:14 +0100
committerlado <herrlado@gmail.com>2011-11-02 21:46:14 +0100
commit4ca0811ef7ae37ee4dcd6fd6601cb8b44a6e9322 (patch)
tree81588018cdae68f324d7a0a34795012679edc9e1
parent46cb0a5344b9d50d1dcefe946d95d1cedf7df3cc (diff)
downloadvdr-manager-4ca0811ef7ae37ee4dcd6fd6601cb8b44a6e9322.tar.gz
vdr-manager-4ca0811ef7ae37ee4dcd6fd6601cb8b44a6e9322.tar.bz2
some doc + refactoring
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java10
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventListActivity.java8
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseTimerEditActivity.java33
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java2
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchListActivity.java2
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java2
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingListActivity.java2
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/TimeEpgListActivity.java2
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerListActivity.java20
9 files changed, 62 insertions, 19 deletions
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java
index b1569f4..ce27368 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java
@@ -40,12 +40,20 @@ public abstract class BaseActivity<Result, T extends ListView> extends Activity
abstract protected int getMainLayout();
+ protected void switchNothinFound() {
+ if (flipper == null) {
+ return;
+ }
+ //say("can not connect...");
+ //flipper.setDisplayedChild(1);
+ }
protected void switchNoConnection() {
if (flipper == null) {
return;
}
- flipper.setDisplayedChild(1);
+ //say("can not connect...");
+ //flipper.setDisplayedChild(1);
}
protected void initFlipper() {
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventListActivity.java
index c6d3e77..22be292 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventListActivity.java
@@ -105,7 +105,11 @@ public abstract class BaseEventListActivity<T extends Event> extends
return true;
}
- protected void prepareTimer(EventListItem event) {
+ /**
+ * Prepare the current event and the chained events for
+ * @param event
+ */
+ protected void prepareDetailsViewData(EventListItem event) {
}
@@ -202,7 +206,7 @@ public abstract class BaseEventListActivity<T extends Event> extends
// find and remember item
final EventListItem item = adapter.getItem(position);
- prepareTimer(item);
+ prepareDetailsViewData(item);
// show details
final Intent intent = new Intent();
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseTimerEditActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseTimerEditActivity.java
index 4c379c3..b4f17b7 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseTimerEditActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseTimerEditActivity.java
@@ -18,6 +18,14 @@ import de.bjusystems.vdrmanager.tasks.DeleteTimerTask;
import de.bjusystems.vdrmanager.tasks.ToggleTimerTask;
import de.bjusystems.vdrmanager.utils.svdrp.SvdrpEvent;
+/**
+ *
+ * This class is a base class for all the listings, which can deal with timers
+ *
+ * @author lado
+ *
+ * @param <T> Class extending Event
+ */
public abstract class BaseTimerEditActivity<T extends Event> extends
BaseEventListActivity<T> implements OnClickListener // SvdrpAsyncListener<Timer>,
{
@@ -37,8 +45,6 @@ public abstract class BaseTimerEditActivity<T extends Event> extends
switch (item.getItemId()) {
case R.id.epg_item_menu_timer_add: {
getApp().setCurrentTimer(event.createTimer());
- // updateDisplay(TimerOperation.CREATE);
- // tDialog.show();
final Intent intent = new Intent();
intent.setClass(this, TimerDetailsActivity.class);
intent.putExtra(Intents.TIMER_OP, Intents.ADD_TIMER);
@@ -47,8 +53,6 @@ public abstract class BaseTimerEditActivity<T extends Event> extends
break;
case R.id.epg_item_menu_timer_modify: {
getApp().setCurrentTimer(getTimer(event));
- // updateDisplay(TimerOperation.MODIFY);
- // tDialog.show();
final Intent intent = new Intent();
intent.setClass(this, TimerDetailsActivity.class);
intent.putExtra(Intents.TIMER_OP, Intents.EDIT_TIMER);
@@ -106,11 +110,14 @@ public abstract class BaseTimerEditActivity<T extends Event> extends
}
super.onCreateContextMenu(menu, v, menuInfo);
-
- // }
-
}
+ /**
+ * Extract a Timer from a given {@link EventListItem}
+ *
+ * @param item
+ * @return Timer if any on the event
+ */
protected Timer getTimer(EventListItem item) {
return item.getTimer();
}
@@ -126,6 +133,11 @@ public abstract class BaseTimerEditActivity<T extends Event> extends
task.start();
}
+ /**
+ * Delete a given timer
+ *
+ * @param timer
+ */
protected void deleteTimer(final Timer timer) {
// backupViewSelection();
final DeleteTimerTask task = new DeleteTimerTask(this, timer) {
@@ -138,11 +150,18 @@ public abstract class BaseTimerEditActivity<T extends Event> extends
task.start();
}
+ /**
+ * Is called, if a timer has been changed and so update of the list is required
+ */
protected void timerModified() {
backupViewSelection();
refresh();
}
+ /* (non-Javadoc)
+ * @see android.app.Activity#onActivityResult(int, int, android.content.Intent)
+ *
+ */
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java
index 4886f9e..f0622be 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java
@@ -99,7 +99,7 @@ public class EpgDetailsActivity extends Activity implements OnClickListener,
counter = 0;
for (Event e : epgs) {
- if (epg == e) {
+ if (epg.equals(e)) {
break;
}
counter++;
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchListActivity.java
index 0410007..b59b3d3 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchListActivity.java
@@ -141,7 +141,7 @@ public class EpgSearchListActivity extends BaseTimerEditActivity<Epg> implements
}
- protected void prepareTimer(final EventListItem item) {
+ protected void prepareDetailsViewData(final EventListItem item) {
final VdrManagerApp app = (VdrManagerApp) getApplication();
app.setCurrentEvent(item.getEvent());
app.setCurrentEpgList(results);
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java
index cb936bd..c99a8ed 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java
@@ -302,7 +302,7 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> implements
return results.isEmpty() == false;
}
- protected void prepareTimer(final EventListItem item) {
+ protected void prepareDetailsViewData(final EventListItem item) {
final VdrManagerApp app = (VdrManagerApp) getApplication();
app.setCurrentEvent(item.getEvent());
app.setCurrentEpgList(CACHE);
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingListActivity.java
index 06272fd..9974721 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingListActivity.java
@@ -63,7 +63,7 @@ public class RecordingListActivity extends BaseEventListActivity<Recording>
}
@Override
- protected void prepareTimer(EventListItem event) {
+ protected void prepareDetailsViewData(EventListItem event) {
getApp().setCurrentEvent(event.getEvent());
getApp().setCurrentEpgList(results);
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimeEpgListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimeEpgListActivity.java
index 2d32dc5..5746170 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimeEpgListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimeEpgListActivity.java
@@ -278,7 +278,7 @@ public class TimeEpgListActivity extends BaseTimerEditActivity<Epg> implements
}
- protected void prepareTimer(final EventListItem item) {
+ protected void prepareDetailsViewData(final EventListItem item) {
final VdrManagerApp app = (VdrManagerApp) getApplication();
// remember event for details view and timer things
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerListActivity.java
index 04732c4..e9510ac 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerListActivity.java
@@ -17,18 +17,22 @@ import de.bjusystems.vdrmanager.utils.svdrp.SvdrpClient;
import de.bjusystems.vdrmanager.utils.svdrp.TimerClient;
/**
- * This class is used for showing what's current running on all channels
+ * This class is used for showing all the existing timers
*
* @author bju
*/
public class TimerListActivity extends BaseTimerEditActivity<Timer> implements
OnItemClickListener, SvdrpAsyncListener<Timer> {
+ /**
+ *
+ */
TimerClient timerClient;
-
-
+ /* (non-Javadoc)
+ * @see de.bjusystems.vdrmanager.gui.BaseEventListActivity#onCreate(android.os.Bundle)
+ */
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -85,11 +89,19 @@ public class TimerListActivity extends BaseTimerEditActivity<Timer> implements
task.run();
}
+ /* (non-Javadoc)
+ * @see de.bjusystems.vdrmanager.gui.BaseTimerEditActivity#getTimer(de.bjusystems.vdrmanager.data.EventListItem)
+ */
@Override
protected Timer getTimer(EventListItem item) {
return (Timer)item.getEvent();
}
- protected void prepareTimer(final EventListItem item) {
+
+
+ /* (non-Javadoc)
+ * @see de.bjusystems.vdrmanager.gui.BaseEventListActivity#prepareTimer(de.bjusystems.vdrmanager.data.EventListItem)
+ */
+ protected void prepareDetailsViewData(final EventListItem item) {
final VdrManagerApp app = (VdrManagerApp) getApplication();
// remember event for details view and timer things
app.setCurrentEvent(item.getEvent());