6 package com.google.appinventor.components.runtime.util;
10 import android.app.Activity;
11 import android.app.AlertDialog;
12 import android.content.Context;
13 import android.content.DialogInterface;
15 import android.text.InputType;
16 import android.view.MotionEvent;
17 import android.view.View;
18 import android.webkit.GeolocationPermissions;
19 import android.webkit.GeolocationPermissions.Callback;
20 import android.webkit.WebView;
21 import android.webkit.WebViewClient;
22 import android.webkit.WebChromeClient;
23 import android.widget.EditText;
45 activity.overridePendingTransition(enterAnim, exitAnim);
57 webview.getSettings().setGeolocationDatabasePath(activity.getFilesDir().getAbsolutePath());
58 webview.getSettings().setDatabaseEnabled(
true);
59 webview.setWebChromeClient(
new WebChromeClient() {
61 public void onGeolocationPermissionsShowPrompt(String origin,
63 final Callback theCallback = callback;
64 final String theOrigin = origin;
66 callback.invoke(origin,
true,
true);
69 AlertDialog alertDialog =
new AlertDialog.Builder(activity).create();
70 alertDialog.setTitle(
"Permission Request");
71 if (origin.equals(
"file://"))
72 origin =
"This Application";
73 alertDialog.setMessage(origin +
" would like to access your location.");
74 alertDialog.setButton(AlertDialog.BUTTON_POSITIVE,
"Allow",
75 new DialogInterface.OnClickListener() {
76 public void onClick(DialogInterface dialog,
int which) {
77 theCallback.invoke(theOrigin,
true,
true);
80 alertDialog.setButton(AlertDialog.BUTTON_NEGATIVE,
"Refuse",
81 new DialogInterface.OnClickListener() {
82 public void onClick(DialogInterface dialog,
int which) {
83 theCallback.invoke(theOrigin,
false,
true);
101 GeolocationPermissions permissions = GeolocationPermissions.getInstance();
102 permissions.clearAll();
106 return form.getPackageManager().getInstallerPackageName(pname);
118 textview.setInputType(textview.getInputType() | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);