summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlado <herrlado@gmail.com>2011-11-06 23:47:22 +0100
committerlado <herrlado@gmail.com>2011-11-06 23:47:22 +0100
commitc4d9751ca5994c75d78bca41c8ea02ddb591ba33 (patch)
tree330b102fed95d5123c9bf3e78aaaef5984bc2b04
parent005d16d6635fc1e1ff2e68ac3dc4933bb2a3dae5 (diff)
downloadvdr-manager-c4d9751ca5994c75d78bca41c8ea02ddb591ba33.tar.gz
vdr-manager-c4d9751ca5994c75d78bca41c8ea02ddb591ba33.tar.bz2
no data connection
-rw-r--r--vdrmanager/res/values-de/common.xml2
-rw-r--r--vdrmanager/res/values/common.xml1
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java64
3 files changed, 35 insertions, 32 deletions
diff --git a/vdrmanager/res/values-de/common.xml b/vdrmanager/res/values-de/common.xml
index 1ab991a..d7d0b5e 100644
--- a/vdrmanager/res/values-de/common.xml
+++ b/vdrmanager/res/values-de/common.xml
@@ -22,5 +22,5 @@
herrlado&lt;herrlado@gmail.com&gt;
</string>
<string name="about_title">Über</string>
-
+ <string name="no_internet_connection">Keine Datenverbindung</string>
</resources>
diff --git a/vdrmanager/res/values/common.xml b/vdrmanager/res/values/common.xml
index 5ecb78a..5f38379 100644
--- a/vdrmanager/res/values/common.xml
+++ b/vdrmanager/res/values/common.xml
@@ -24,4 +24,5 @@
</string>
<string name="about_title">About</string>
+ <string name="no_internet_connection">No data connection</string>
</resources> \ No newline at end of file
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java
index 57017f7..269ace9 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java
@@ -40,21 +40,22 @@ 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 noInternetConnection() {
+ alert(R.string.no_internet_connection);
}
+ abstract protected boolean displayingResults();
+
protected void switchNoConnection() {
if (flipper == null) {
return;
}
- //TODO check if we are displaying something (results
- // say("can not connect...");
- // flipper.setDisplayedChild(1);
+
+ if (displayingResults()) {
+ say(R.string.no_connection);
+ } else {
+ flipper.setDisplayedChild(1);
+ }
}
protected void initFlipper() {
@@ -68,23 +69,24 @@ public abstract class BaseActivity<Result, T extends ListView> extends Activity
retry();
}
}
-//
-// protected void updateWindowTitle(int topic, int subtopic) {
-// String title;
-// title = getString(topic);
-// if (subtopic != -1) {
-// title += " > " + getString(subtopic);
-// }
-// setTitle(title);
-// }
-//
-// protected void updateWindowTitle(String topic, String subtopic) {
-// String title = topic;
-// if (subtopic != null) {
-// title += " > " + subtopic;
-// }
-// setTitle(title);
-// }
+
+ //
+ // protected void updateWindowTitle(int topic, int subtopic) {
+ // String title;
+ // title = getString(topic);
+ // if (subtopic != -1) {
+ // title += " > " + getString(subtopic);
+ // }
+ // setTitle(title);
+ // }
+ //
+ // protected void updateWindowTitle(String topic, String subtopic) {
+ // String title = topic;
+ // if (subtopic != null) {
+ // title += " > " + subtopic;
+ // }
+ // setTitle(title);
+ // }
@Override
public boolean onCreateOptionsMenu(final Menu menu) {
@@ -180,13 +182,10 @@ public abstract class BaseActivity<Result, T extends ListView> extends Activity
int top;
protected boolean checkInternetConnection() {
- ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
- // test for connection
- if (cm.getActiveNetworkInfo() != null
- && cm.getActiveNetworkInfo().isAvailable()
- && cm.getActiveNetworkInfo().isConnected()) {
+ if(Utils.checkInternetConnection(this)){
return true;
}
+ noInternetConnection();
return false;
}
@@ -217,6 +216,7 @@ public abstract class BaseActivity<Result, T extends ListView> extends Activity
return;
case FINISHED_SUCCESS:
if (finishedSuccess()) {
+ finishedSuccess = true;
restoreViewSelection();
} else {
say(R.string.epg_no_items);
@@ -228,6 +228,8 @@ public abstract class BaseActivity<Result, T extends ListView> extends Activity
}
}
+ protected boolean finishedSuccess = false;
+
protected void cacheHit() {
}