|
19 | 19 | import com.runrev.android.Engine; |
20 | 20 | import com.runrev.android.nativecontrol.NativeControlModule; |
21 | 21 |
|
| 22 | +import android.app.AlertDialog; |
22 | 23 | import android.app.Activity; |
23 | 24 | import android.content.*; |
24 | 25 | import android.content.pm.*; |
@@ -321,10 +322,43 @@ public void onHideCustomView() |
321 | 322 | m_custom_view_callback = null; |
322 | 323 | } |
323 | 324 | } |
| 325 | + |
| 326 | + |
| 327 | + public void showRequestAccessDialog(final String origin, final GeolocationPermissions.Callback callback, String p_title, String p_message, String p_ok_button, String p_cancel_button) |
| 328 | + { |
| 329 | + DialogInterface.OnClickListener t_listener; |
| 330 | + t_listener = new DialogInterface.OnClickListener() { |
| 331 | + public void onClick(DialogInterface p_dialog, int p_which) |
| 332 | + { |
| 333 | + boolean t_remember = true; |
| 334 | + boolean t_allow = true; |
| 335 | + if (p_which == DialogInterface.BUTTON_POSITIVE) |
| 336 | + t_allow = true; |
| 337 | + else if (p_which == DialogInterface.BUTTON_NEGATIVE) |
| 338 | + t_allow = false; |
| 339 | + callback.invoke(origin, t_allow, t_remember); |
| 340 | + } }; |
| 341 | + |
| 342 | + AlertDialog.Builder t_dialog; |
| 343 | + t_dialog = new AlertDialog.Builder(getContext()); |
| 344 | + t_dialog . setTitle(p_title); |
| 345 | + t_dialog . setMessage(p_message); |
| 346 | + t_dialog . setPositiveButton(p_ok_button, t_listener); |
| 347 | + if (p_cancel_button != null) |
| 348 | + t_dialog . setNegativeButton(p_cancel_button, t_listener); |
| 349 | + |
| 350 | + t_dialog . show(); |
| 351 | + } |
| 352 | + |
| 353 | + public void onGeolocationPermissionsShowPrompt( String origin, GeolocationPermissions.Callback callback) { |
| 354 | + showRequestAccessDialog(origin, callback, "Location Access", origin + " would like to use your Current Location", "Allow", "Don't Allow"); |
| 355 | + } |
| 356 | + |
324 | 357 | }; |
325 | 358 |
|
326 | 359 | setWebChromeClient(m_chrome_client); |
327 | 360 | getSettings().setJavaScriptEnabled(true); |
| 361 | + getSettings().setGeolocationEnabled(true); |
328 | 362 | getSettings().setDomStorageEnabled(true); |
329 | 363 | getSettings().setPluginState(WebSettings.PluginState.ON); |
330 | 364 | getSettings().setBuiltInZoomControls(true); |
|
0 commit comments