/[projects]/android/EKLLauncher/src/dk/thoerup/ekllauncher/EKLLauncherActivity.java
ViewVC logotype

Diff of /android/EKLLauncher/src/dk/thoerup/ekllauncher/EKLLauncherActivity.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1616 by torben, Thu Oct 20 18:39:19 2011 UTC revision 1619 by torben, Thu Oct 20 20:48:28 2011 UTC
# Line 3  package dk.thoerup.ekllauncher; Line 3  package dk.thoerup.ekllauncher;
3  import android.app.Activity;  import android.app.Activity;
4  import android.content.Context;  import android.content.Context;
5  import android.content.Intent;  import android.content.Intent;
6    import android.net.ConnectivityManager;
7    import android.net.NetworkInfo;
8  import android.os.Bundle;  import android.os.Bundle;
9  import android.os.Handler;  import android.os.Handler;
10  import android.os.Message;  import android.os.Message;
# Line 18  import android.webkit.WebChromeClient; Line 20  import android.webkit.WebChromeClient;
20  import android.webkit.WebSettings;  import android.webkit.WebSettings;
21  import android.webkit.WebStorage.QuotaUpdater;  import android.webkit.WebStorage.QuotaUpdater;
22  import android.webkit.WebView;  import android.webkit.WebView;
23    import android.webkit.WebViewClient;
24  import android.widget.Toast;  import android.widget.Toast;
25    
26  public class EKLLauncherActivity extends Activity {  public class EKLLauncherActivity extends Activity {
# Line 75  public class EKLLauncherActivity extends Line 78  public class EKLLauncherActivity extends
78                  }                  }
79                                    
80          }          }
81            
82            class DummyWebViewClient extends WebViewClient {                
83            }
84                    
85          static final String URL = "http://omdeling.info/mobil/ekl/login.php";          static final String URL = "http://omdeling.info/mobil/ekl/login.php";
86                    
87            ConnectivityManager connMgr;
88          TelephonyManager telMgr;          TelephonyManager telMgr;
89          WebView web;          WebView web;
90          String device = "";          String device = "";
# Line 104  public class EKLLauncherActivity extends Line 110  public class EKLLauncherActivity extends
110                          intent.putExtra("state", false);                          intent.putExtra("state", false);
111                          sendBroadcast(intent);                          sendBroadcast(intent);
112                  }                  }
                 Log.d("EKL", "Airplane " +  airplane);  
113          } catch (Settings.SettingNotFoundException e) {          } catch (Settings.SettingNotFoundException e) {
114                  Log.d("EKL", "Exception " + e.getMessage() );                  Log.d("EKL", "Exception " + e.getMessage() );
115          }          }
# Line 113  public class EKLLauncherActivity extends Line 118  public class EKLLauncherActivity extends
118                    
119                    
120          telMgr = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);          telMgr = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);
121            connMgr = (ConnectivityManager) this.getSystemService(Context.CONNECTIVITY_SERVICE);
122            
123          device = telMgr.getLine1Number();          device = telMgr.getLine1Number();
124          if (device == null || device.equals("")) {          if (device == null || device.equals("")) {
125                  device = telMgr.getDeviceId();                  device = telMgr.getDeviceId();
# Line 144  public class EKLLauncherActivity extends Line 151  public class EKLLauncherActivity extends
151          settings.setSupportMultipleWindows(false);          settings.setSupportMultipleWindows(false);
152                    
153          web.setWebChromeClient(new CustomChromeClient() );          web.setWebChromeClient(new CustomChromeClient() );
154          web.setWebViewClient( new DebugWebViewClient() );          web.setWebViewClient( new DummyWebViewClient() ); // skal have en webviewclient for at kunne styre ved forlad tur
155            
156          if (telMgr.getSimState() == TelephonyManager.SIM_STATE_READY && telMgr.getDataState() == TelephonyManager.DATA_CONNECTED) {          NetworkInfo network = connMgr.getActiveNetworkInfo();
157            if ( (telMgr.getSimState() == TelephonyManager.SIM_STATE_READY && telMgr.getDataState() == TelephonyManager.DATA_CONNECTED) || ( network != null && network.getType() == ConnectivityManager.TYPE_WIFI) ) {
158                  web.loadUrl( URL );                  web.loadUrl( URL );
159          } else {          } else {
160                  web.loadData("<html><body><h2>afventer netv&aelig;rksforbindelse</h2></body></html>", "text/html", "iso-8859-1");                  web.loadData("<html><body><h2>afventer netv&aelig;rksforbindelse</h2></body></html>", "text/html", "iso-8859-1");

Legend:
Removed from v.1616  
changed lines
  Added in v.1619

  ViewVC Help
Powered by ViewVC 1.1.20