/[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 1623 by torben, Wed Oct 26 08:49:04 2011 UTC revision 1625 by torben, Wed Oct 26 12:15:52 2011 UTC
# Line 1  Line 1 
1  package dk.thoerup.ekllauncher;  package dk.thoerup.ekllauncher;
2    
3  import android.app.Activity;  import android.app.Activity;
4    import android.app.AlertDialog;
5  import android.content.Context;  import android.content.Context;
6    import android.content.DialogInterface;
7  import android.content.Intent;  import android.content.Intent;
8  import android.location.LocationManager;  import android.location.LocationManager;
9  import android.net.ConnectivityManager;  import android.net.ConnectivityManager;
# Line 11  import android.os.Handler; Line 13  import android.os.Handler;
13  import android.os.Message;  import android.os.Message;
14  import android.provider.Settings;  import android.provider.Settings;
15  import android.telephony.TelephonyManager;  import android.telephony.TelephonyManager;
16    import android.text.InputType;
17  import android.util.Log;  import android.util.Log;
18  import android.view.Menu;  import android.view.Menu;
19  import android.view.MenuItem;  import android.view.MenuItem;
# Line 23  import android.webkit.WebStorage; Line 26  import android.webkit.WebStorage;
26  import android.webkit.WebStorage.QuotaUpdater;  import android.webkit.WebStorage.QuotaUpdater;
27  import android.webkit.WebView;  import android.webkit.WebView;
28  import android.webkit.WebViewClient;  import android.webkit.WebViewClient;
29  import android.widget.Toast;  import android.widget.EditText;
30    
31  public class EKLLauncherActivity extends Activity {  public class EKLLauncherActivity extends Activity {
32                    
# Line 67  public class EKLLauncherActivity extends Line 70  public class EKLLauncherActivity extends
70                  }*/                  }*/
71    
72                  @Override                  @Override
73                  public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, JsPromptResult result) {                  public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, final JsPromptResult result) {
74                          if (message.trim().toLowerCase().equals("pda identifikation mangler")) {                          String msg = message.trim().toLowerCase();
75    
76                            if (msg.equals("pda identifikation mangler")) {
77                                  result.confirm(device);                                  result.confirm(device);
78                                    
79                                  timeoutHandler.sendEmptyMessageDelayed(1, 500); //efter pdaID er sendt til app'en skal vi genindlæse siden for at tvinge den til at hente data                                  timeoutHandler.sendEmptyMessageDelayed(1, 500); //efter pdaID er sendt til app'en skal vi genindlæse siden for at tvinge den til at hente data
80                                  return true;                                  return true;
81                            } else if (msg.startsWith("indtast retur antal")) {
82    
83                                    AlertDialog.Builder alert = new AlertDialog.Builder(EKLLauncherActivity.this);
84    
85                                    //alert.setTitle("Title");
86                                    alert.setMessage(message);
87    
88                                    // Set an EditText view to get user input
89                                    final EditText input = new EditText(EKLLauncherActivity.this);
90                                    input.setInputType(InputType.TYPE_CLASS_NUMBER);
91                                    alert.setView(input);
92    
93                                    alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
94                                            public void onClick(DialogInterface dialog, int whichButton) {
95                                                    result.confirm(input.getText().toString());
96                                            }
97                                    });
98                                    alert.show();
99    
100                                    return true;                            
101                          } else {                          } else {
102                                  return super.onJsPrompt(view, url, message, defaultValue, result);                                  return super.onJsPrompt(view, url, message, defaultValue, result);
103                          }                                                                                                }                                                                      
104                  }                  }
105                    
106          }          }
107    
108          class DummyWebViewClient extends WebViewClient {                          class DummyWebViewClient extends WebViewClient {                
# Line 127  public class EKLLauncherActivity extends Line 152  public class EKLLauncherActivity extends
152                          device = "";                          device = "";
153          }          }
154                    
155          if (!locMgr.isProviderEnabled(LocationManager.GPS_PROVIDER )) {  
                 //Settings.Secure.putString(getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, "network,gps");  
                 Toast.makeText(this, "GPS er slået fra på telefonen!", Toast.LENGTH_LONG);              
         }  
156                    
157          setContentView(R.layout.main);          setContentView(R.layout.main);
158          web = (WebView) findViewById(R.id.web);          web = (WebView) findViewById(R.id.web);
# Line 160  public class EKLLauncherActivity extends Line 182  public class EKLLauncherActivity extends
182                    
183          simHandler.sendEmptyMessage(0);          simHandler.sendEmptyMessage(0);
184                    
185            
186            
187            
188            if (!locMgr.isProviderEnabled(LocationManager.GPS_PROVIDER )) {
189                    //Settings.Secure.putString(getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, "network,gps");
190                    
191                    AlertDialog.Builder builder = new AlertDialog.Builder(this);
192                    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)")
193                .setPositiveButton("OK", new DialogInterface.OnClickListener() {
194                    public void onClick(DialogInterface dialog, int id) {
195                            Intent myIntent = new Intent( Settings.ACTION_SECURITY_SETTINGS );
196                        startActivity(myIntent);      
197                    }
198                })
199                .create()
200                .show();      
201            }
202      }      }
203    
204          @Override          @Override

Legend:
Removed from v.1623  
changed lines
  Added in v.1625

  ViewVC Help
Powered by ViewVC 1.1.20