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; |
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; |
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 |
|
|
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 { |
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); |
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 |