/[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 1618 by torben, Thu Oct 20 20:30:48 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.os.Bundle;  import android.os.Bundle;
8  import android.os.Handler;  import android.os.Handler;
9  import android.os.Message;  import android.os.Message;
# Line 18  import android.webkit.WebChromeClient; Line 19  import android.webkit.WebChromeClient;
19  import android.webkit.WebSettings;  import android.webkit.WebSettings;
20  import android.webkit.WebStorage.QuotaUpdater;  import android.webkit.WebStorage.QuotaUpdater;
21  import android.webkit.WebView;  import android.webkit.WebView;
22    import android.webkit.WebViewClient;
23  import android.widget.Toast;  import android.widget.Toast;
24    
25  public class EKLLauncherActivity extends Activity {  public class EKLLauncherActivity extends Activity {
# Line 75  public class EKLLauncherActivity extends Line 77  public class EKLLauncherActivity extends
77                  }                  }
78                                    
79          }          }
80            
81            class DummyWebViewClient extends WebViewClient {                
82            }
83                    
84          static final String URL = "http://omdeling.info/mobil/ekl/login.php";          static final String URL = "http://omdeling.info/mobil/ekl/login.php";
85                    
86            ConnectivityManager connMgr;
87          TelephonyManager telMgr;          TelephonyManager telMgr;
88          WebView web;          WebView web;
89          String device = "";          String device = "";
# Line 104  public class EKLLauncherActivity extends Line 109  public class EKLLauncherActivity extends
109                          intent.putExtra("state", false);                          intent.putExtra("state", false);
110                          sendBroadcast(intent);                          sendBroadcast(intent);
111                  }                  }
                 Log.d("EKL", "Airplane " +  airplane);  
112          } catch (Settings.SettingNotFoundException e) {          } catch (Settings.SettingNotFoundException e) {
113                  Log.d("EKL", "Exception " + e.getMessage() );                  Log.d("EKL", "Exception " + e.getMessage() );
114          }          }
# Line 113  public class EKLLauncherActivity extends Line 117  public class EKLLauncherActivity extends
117                    
118                    
119          telMgr = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);          telMgr = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);
120            connMgr = (ConnectivityManager) this.getSystemService(Context.CONNECTIVITY_SERVICE);
121            
122          device = telMgr.getLine1Number();          device = telMgr.getLine1Number();
123          if (device == null || device.equals("")) {          if (device == null || device.equals("")) {
124                  device = telMgr.getDeviceId();                  device = telMgr.getDeviceId();
# Line 144  public class EKLLauncherActivity extends Line 150  public class EKLLauncherActivity extends
150          settings.setSupportMultipleWindows(false);          settings.setSupportMultipleWindows(false);
151                    
152          web.setWebChromeClient(new CustomChromeClient() );          web.setWebChromeClient(new CustomChromeClient() );
153          web.setWebViewClient( new DebugWebViewClient() );          web.setWebViewClient( new DummyWebViewClient() ); // skal have en webviewclient for at kunne styre ved forlad tur
154                    
155          if (telMgr.getSimState() == TelephonyManager.SIM_STATE_READY && telMgr.getDataState() == TelephonyManager.DATA_CONNECTED) {          if ( (telMgr.getSimState() == TelephonyManager.SIM_STATE_READY && telMgr.getDataState() == TelephonyManager.DATA_CONNECTED) || connMgr.getActiveNetworkInfo().getType() == ConnectivityManager.TYPE_WIFI) {
156                  web.loadUrl( URL );                  web.loadUrl( URL );
157          } else {          } else {
158                  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.1618

  ViewVC Help
Powered by ViewVC 1.1.20