summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlado <herrlado@gmail.com>2011-11-06 22:49:57 +0100
committerlado <herrlado@gmail.com>2011-11-06 22:49:57 +0100
commit6c5214ab7b3be338ee4679334a54e4ad3e00bcff (patch)
tree7d2804319884800307e09acde0a9c42663707a9d
parentca346ae6ba6b36e8ceee0ef17bfbfc5c590ef308 (diff)
downloadvdr-manager-6c5214ab7b3be338ee4679334a54e4ad3e00bcff.tar.gz
vdr-manager-6c5214ab7b3be338ee4679334a54e4ad3e00bcff.tar.bz2
alert if no connection
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventListActivity.java5
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelListActivity.java5
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchListActivity.java1
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java92
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/TimeEpgListActivity.java1
5 files changed, 20 insertions, 84 deletions
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventListActivity.java
index a5679c6..454ae17 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventListActivity.java
@@ -344,5 +344,10 @@ public abstract class BaseEventListActivity<T extends Event> extends
results.size()));
return finishedSuccessImpl();
}
+
+ @Override
+ protected boolean displayingResults() {
+ return results.isEmpty() == false;
+ }
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelListActivity.java
index 77ec58b..bf21408 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelListActivity.java
@@ -92,7 +92,6 @@ public class ChannelListActivity extends
private void startChannelQuery(boolean useCache) {
if (checkInternetConnection() == false) {
- switchNoConnection();
return;
}
@@ -365,5 +364,9 @@ public class ChannelListActivity extends
protected String getWindowTitle() {
return resolveWindowTitle();
}
+
+ protected boolean displayingResults(){
+ return ChannelClient.getChannels().isEmpty() == false;
+ }
} \ No newline at end of file
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchListActivity.java
index b7fb8bc..31774ae 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchListActivity.java
@@ -84,7 +84,6 @@ public class EpgSearchListActivity extends BaseTimerEditActivity<Epg> implements
private void startEpgQuery() {
if (checkInternetConnection() == false) {
- switchNoConnection();
return;
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java
index 70128cb..f99e7b4 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java
@@ -6,7 +6,6 @@ import java.util.Date;
import android.content.Intent;
import android.os.Bundle;
-import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
@@ -28,8 +27,6 @@ import de.bjusystems.vdrmanager.utils.svdrp.EpgClient;
import de.bjusystems.vdrmanager.utils.svdrp.SvdrpAsyncTask;
import de.bjusystems.vdrmanager.utils.svdrp.SvdrpClient;
import de.bjusystems.vdrmanager.utils.svdrp.SvdrpEvent;
-import de.bjusystems.vdrmanager.utils.svdrp.SvdrpException;
-import de.bjusystems.vdrmanager.utils.svdrp.SvdrpListener;
/**
* This class is used for showing what's current running on all channels
@@ -76,6 +73,7 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> implements
adapter = new ChannelEventAdapter(this);
+
// if (currentChannel != null) {
// }
@@ -92,8 +90,16 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> implements
// register EPG item click
listView.setOnItemClickListener(this);
+
+ if(checkInternetConnection() == false){
+ return;
+ }
+ startQuery();
+ }
+
+ private void startQuery(){
new ChannelsTask(this, new ChannelClient()){
public void finished(SvdrpEvent event) {
if (event == SvdrpEvent.CACHE_HIT
@@ -111,10 +117,8 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> implements
noConnection(event);
}
}}.start();
-
- }
- // private void ensureChannelList() {
+ }
@Override
protected void onPause() {
@@ -124,50 +128,21 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> implements
@Override
protected void onResume() {
super.onResume();
- Log.d(TAG, "onResume()");
- //backupViewSelection();
- //startEpgQuery();
- //
}
public void onItemSelected(final AdapterView<?> parent, final View view,
final int position, final long id) {
- Log.d(TAG, "onItemSelected()");
// get spinner value
final Channel channel = (Channel) channelSpinner.getSelectedItem();
currentChannel = channel;
setCurrent(channel);
// setAsCurrent(channel);
// update search
- startEpgQueryImpl(false);
+ startEpgQuery(false);
}
- // class LoadChannelsTask extends AsyncProgressTask<Channel> {
- //
- // boolean f;
- // Channel c;
- //
- // public LoadChannelsTask(Channel channel, boolean force,
- // Activity activity, ChannelClient client) {
- // super(activity, client);
- // this.f = force;
- // this.c = channel;
- // }
- //
- // @Override
- // public void finished(SvdrpEvent event) {
- // if (noConnection(event)) {
- // return;
- // }
- // ArrayList<Channel> channels = ChannelClient.getChannels();
- // for (final Channel c : channels) {
- // channelSpinnerAdapter.add(c);
- // }
- // }
- // }
public void onNothingSelected(final AdapterView<?> arg0) {
- Log.d(TAG, "onNothingSelected()");
// startTimeEpgQuery(((EpgTimeSpinnerValue)timeSpinner.getAdapter().getItem(0)).getValue());
}
@@ -207,50 +182,6 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> implements
}
private void startEpgQuery(final boolean force) {
- if(true){
- startEpgQueryImpl(force);
- }
- Log.d(TAG, "startEpgQuery, " + force);
- try {
- ChannelClient client = new ChannelClient();
-
- client.addSvdrpListener(new SvdrpListener<Channel>() {
- public void svdrpEvent(SvdrpEvent event, Channel result) {
- if (event == SvdrpEvent.CACHE_HIT
- || event == SvdrpEvent.FINISHED_SUCCESS) {
- channelSpinnerAdapter.clear();
- ArrayList<Channel> channels = ChannelClient.getChannels();
- for (final Channel c : channels) {
- channelSpinnerAdapter.add(c);
- }
- // startEpgQueryImpl(force);
- } else {
- noConnection(event);
- }
-
- }
- });
- client.run();
- } catch (SvdrpException ex) {
- svdrpException(ex);
- return;
- }
-
- //if(currentChannel == null && ChannelClient.getChannels().isEmpty() == false){
- //currentChannel = ChannelClient.getChannels().get(0);
- //setCurrent(currentChannel);
- //}
-
- //if(currentChannel != null){
-
- //}
-
-
- }
-
- private void startEpgQueryImpl(boolean force) {
- Log.d(TAG,"startEpgQueryImpl");
-
if (useCache() && !force) {
Calendar cal = Calendar.getInstance();
int day = -1;
@@ -269,7 +200,6 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> implements
}
if (checkInternetConnection() == false) {
- switchNoConnection();
return;
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimeEpgListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimeEpgListActivity.java
index 72c2fb0..d9c0b6e 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimeEpgListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimeEpgListActivity.java
@@ -235,7 +235,6 @@ public class TimeEpgListActivity extends BaseTimerEditActivity<Epg> implements
}
if (checkInternetConnection() == false) {
- switchNoConnection();
return;
}