/[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 1925 by torben, Mon Feb 25 08:39:29 2013 UTC revision 1926 by torben, Mon Feb 25 10:16:25 2013 UTC
# Line 1  Line 1 
1  package dk.thoerup.ekllauncher;  package dk.thoerup.ekllauncher;
2    
3    import android.annotation.SuppressLint;
4  import android.app.Activity;  import android.app.Activity;
5  import android.app.AlertDialog;  import android.app.AlertDialog;
6  import android.content.Context;  import android.content.Context;
# Line 109  public class EKLLauncherActivity extends Line 110  public class EKLLauncherActivity extends
110          class DummyWebViewClient extends WebViewClient {                          class DummyWebViewClient extends WebViewClient {                
111          }          }
112                    
113            static final String LOGTAG = "EklLauncher";
114          static final String URL = "http://omdeling.info/mobil_gpstrack/ekl/login.php";          static final String URL = "http://omdeling.info/mobil_gpstrack/ekl/login.php";
115                    
116          LocationManager locMgr;          LocationManager locMgr;
# Line 122  public class EKLLauncherActivity extends Line 124  public class EKLLauncherActivity extends
124          SimHandler simHandler = new SimHandler();          SimHandler simHandler = new SimHandler();
125                    
126      /** Called when the activity is first created. */      /** Called when the activity is first created. */
127      @Override      @SuppressLint("SetJavaScriptEnabled")
128            @Override
129      public void onCreate(Bundle savedInstanceState) {      public void onCreate(Bundle savedInstanceState) {
130          super.onCreate(savedInstanceState);          super.onCreate(savedInstanceState);
131                    
132            Log.e(LOGTAG, "Starting");
133            
134          getWindow().requestFeature(Window.FEATURE_PROGRESS);          getWindow().requestFeature(Window.FEATURE_PROGRESS);
135                    
136                    
137          try {          try {
138                  int airplane = Settings.System.getInt(this.getContentResolver(), Settings.System.AIRPLANE_MODE_ON);                  int airplane = Settings.System.getInt(this.getContentResolver(), Settings.System.AIRPLANE_MODE_ON);
139                    
140                  if (airplane > 0) {                  if (airplane > 0) {
141                          Settings.System.putInt(this.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0);                          Settings.System.putInt(this.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0);
142                          Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);                          Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
# Line 159  public class EKLLauncherActivity extends Line 165  public class EKLLauncherActivity extends
165                          device = "";                                                      device = "";                            
166          }          }
167                    
168          Toast.makeText(EKLLauncherActivity.this, "Device:"+device, Toast.LENGTH_SHORT).show();          Toast.makeText(EKLLauncherActivity.this, "Device: "+device, Toast.LENGTH_SHORT).show();
169                    
170    
171                    
# Line 188  public class EKLLauncherActivity extends Line 194  public class EKLLauncherActivity extends
194          web.setWebChromeClient(new CustomChromeClient() );          web.setWebChromeClient(new CustomChromeClient() );
195          web.setWebViewClient( new DummyWebViewClient() ); // skal have en webviewclient for at kunne styre ved forlad tur          web.setWebViewClient( new DummyWebViewClient() ); // skal have en webviewclient for at kunne styre ved forlad tur
196    
197                    //Hvis at tlf rebooter mit i et område uden dækning er det ikke smart at vi skal vente på data
198          simHandler.sendEmptyMessage(0);          //simHandler.sendEmptyMessage(0);
199                    web.loadUrl( URL );
           
200                    
201                    
202          if (!locMgr.isProviderEnabled(LocationManager.GPS_PROVIDER )) {          if (!locMgr.isProviderEnabled(LocationManager.GPS_PROVIDER )) {
# Line 201  public class EKLLauncherActivity extends Line 206  public class EKLLauncherActivity extends
206                  builder.setMessage("GPS er slået fra på telefonen!\nSæt et flueben ved GPS i næste vindue og tryk derefter på tilbage knappen (nederst på telefonen)")                  builder.setMessage("GPS er slået fra på telefonen!\nSæt et flueben ved GPS i næste vindue og tryk derefter på tilbage knappen (nederst på telefonen)")
207              .setPositiveButton("OK", new DialogInterface.OnClickListener() {              .setPositiveButton("OK", new DialogInterface.OnClickListener() {
208                  public void onClick(DialogInterface dialog, int id) {                  public void onClick(DialogInterface dialog, int id) {
209                          Intent myIntent = new Intent( Settings.ACTION_SECURITY_SETTINGS );                          Intent myIntent = new Intent( Settings.ACTION_LOCATION_SOURCE_SETTINGS );                      
210                      startActivity(myIntent);                            startActivity(myIntent);      
211                  }                  }
212              })              })
213              .create()              .create()
214              .show();                    .show();      
215          }          }
216            
217        }
218        
219        void showMessage(String msg) {
220            AlertDialog.Builder builder = new AlertDialog.Builder(this);
221            builder.setMessage(msg)
222            .setPositiveButton("OK", new DialogInterface.OnClickListener() {
223                public void onClick(DialogInterface dialog, int id) {
224                    dialog.dismiss();
225                }
226            })
227            .create()
228            .show();      
229            
230      }      }
231    
232          @Override          @Override

Legend:
Removed from v.1925  
changed lines
  Added in v.1926

  ViewVC Help
Powered by ViewVC 1.1.20