diff options
author | lado <herrlado@gmail.com> | 2011-11-06 23:47:22 +0100 |
---|---|---|
committer | lado <herrlado@gmail.com> | 2011-11-06 23:47:22 +0100 |
commit | c4d9751ca5994c75d78bca41c8ea02ddb591ba33 (patch) | |
tree | 330b102fed95d5123c9bf3e78aaaef5984bc2b04 /vdrmanager/src/de | |
parent | 005d16d6635fc1e1ff2e68ac3dc4933bb2a3dae5 (diff) | |
download | vdr-manager-c4d9751ca5994c75d78bca41c8ea02ddb591ba33.tar.gz vdr-manager-c4d9751ca5994c75d78bca41c8ea02ddb591ba33.tar.bz2 |
no data connection
Diffstat (limited to 'vdrmanager/src/de')
-rw-r--r-- | vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java | 64 |
1 files changed, 33 insertions, 31 deletions
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() { } |