Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
appinventor-sources
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
appinventor-sources
Commits
323ab909
Commit
323ab909
authored
Dec 04, 2019
by
ellelili2025
Committed by
Evan W. Patton
Dec 04, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added PageLoaded event for WebViewer
Fixes #1235 Change-Id: Ia697085337cf3aa286f69d3eeba3ccedb7ae643f
parent
fbd75360
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
35 additions
and
6 deletions
+35
-6
appinventor/appengine/src/com/google/appinventor/client/youngandroid/YoungAndroidFormUpgrader.java
...nventor/client/youngandroid/YoungAndroidFormUpgrader.java
+3
-2
appinventor/blocklyeditor/src/versioning.js
appinventor/blocklyeditor/src/versioning.js
+4
-1
appinventor/components/src/com/google/appinventor/components/common/YaVersion.java
...c/com/google/appinventor/components/common/YaVersion.java
+6
-2
appinventor/components/src/com/google/appinventor/components/runtime/WebViewer.java
.../com/google/appinventor/components/runtime/WebViewer.java
+11
-1
appinventor/components/src/com/google/appinventor/components/runtime/util/FroyoUtil.java
...google/appinventor/components/runtime/util/FroyoUtil.java
+7
-0
appinventor/docs/reference/components/userinterface.html
appinventor/docs/reference/components/userinterface.html
+4
-0
No files found.
appinventor/appengine/src/com/google/appinventor/client/youngandroid/YoungAndroidFormUpgrader.java
View file @
323ab909
...
...
@@ -1591,7 +1591,7 @@ public final class YoungAndroidFormUpgrader {
private
static
int
upgradeWebViewerProperties
(
Map
<
String
,
JSONValue
>
componentProperties
,
int
srcCompVersion
)
{
if
(
srcCompVersion
<
7
)
{
if
(
srcCompVersion
<
8
)
{
// The CanGoForward and CanGoBack methods were added.
// No properties need to be modified to upgrade to version 2.
// UsesLocation property added.
...
...
@@ -1601,7 +1601,8 @@ public final class YoungAndroidFormUpgrader {
// IgnoreSslError property added (version 5)
// ClearCaches method was added (version 6)
// WebViewStringChange event was added (version 7)
srcCompVersion
=
7
;
// PageLoaded event was added (version 8)
srcCompVersion
=
8
;
}
return
srcCompVersion
;
}
...
...
appinventor/blocklyeditor/src/versioning.js
View file @
323ab909
...
...
@@ -2649,7 +2649,10 @@ Blockly.Versioning.AllUpgradeMaps =
6
:
"
noUpgrade
"
,
// AI2: Added WebViewStringChange
7
:
"
noUpgrade
"
7
:
"
noUpgrade
"
,
//AI2: Added PageLoaded
8
:
"
noUpgrade
"
},
// End WebViewer upgraders
...
...
appinventor/components/src/com/google/appinventor/components/common/YaVersion.java
View file @
323ab909
...
...
@@ -486,8 +486,10 @@ public class YaVersion {
// - TEXTBOX_COMPONENT_VERSION was incremented to 6
// For YOUNG_ANDROID_VERSION 195:
// - PEDOMETER_COMPONENT_VERSION was incremented to 2
// For YOUNG_ANDROID_VERSION 196:
// - WEBVIEWER_COMPONENT_VERSION was incremented to 8
public
static
final
int
YOUNG_ANDROID_VERSION
=
19
5
;
public
static
final
int
YOUNG_ANDROID_VERSION
=
19
6
;
// ............................... Blocks Language Version Number ...............................
...
...
@@ -1272,7 +1274,9 @@ public class YaVersion {
// - ClearCaches method was added
// For WEBVIEWER_COMPONENT_VERSiON 7:
// - Added WebViewStringChange event
public
static
final
int
WEBVIEWER_COMPONENT_VERSION
=
7
;
//For WEBVIEWER_COMPONENT_VERSION 8:
// - Added PageLoaded event
public
static
final
int
WEBVIEWER_COMPONENT_VERSION
=
8
;
// For MEDIASTORE_COMPONENT_VERSION 1:
// - Initial Version.
...
...
appinventor/components/src/com/google/appinventor/components/runtime/WebViewer.java
View file @
323ab909
...
...
@@ -164,7 +164,7 @@ public final class WebViewer extends AndroidViewComponent {
// Create a class so we can override the default link following behavior.
// The handler doesn't do anything on its own. But returning true means that
// this do nothing will override the default WebVew behavior. Returning
// this do nothing will override the default WebV
i
ew behavior. Returning
// false means to let the WebView handle the Url. In other words, returning
// true will not follow the link, and returning false will follow the link.
private
class
WebViewerClient
extends
WebViewClient
{
...
...
@@ -172,6 +172,11 @@ public final class WebViewer extends AndroidViewComponent {
public
boolean
shouldOverrideUrlLoading
(
WebView
view
,
String
url
)
{
return
!
followLinks
;
}
@Override
public
void
onPageFinished
(
WebView
view
,
String
url
)
{
PageLoaded
(
url
);
}
}
// Components don't normally override Width and Height, but we do it here so that
...
...
@@ -447,6 +452,11 @@ public final class WebViewer extends AndroidViewComponent {
EventDispatcher
.
dispatchEvent
(
this
,
"WebViewStringChange"
,
value
);
}
@SimpleEvent
(
description
=
"When a page is finished loading this event is run."
)
public
void
PageLoaded
(
String
url
)
{
EventDispatcher
.
dispatchEvent
(
this
,
"PageLoaded"
,
url
);
}
private
void
loadUrl
(
final
String
caller
,
final
String
url
)
{
if
(!
havePermission
&&
MediaUtil
.
isExternalFileUrl
(
url
))
{
container
.
$form
().
askPermission
(
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
,
...
...
appinventor/components/src/com/google/appinventor/components/runtime/util/FroyoUtil.java
View file @
323ab909
...
...
@@ -16,6 +16,7 @@ import android.webkit.WebView;
import
android.webkit.WebViewClient
;
import
com.google.appinventor.components.runtime.Component
;
import
com.google.appinventor.components.runtime.EventDispatcher
;
import
com.google.appinventor.components.runtime.Form
;
import
com.google.appinventor.components.runtime.Player
;
...
...
@@ -141,6 +142,12 @@ public class FroyoUtil {
ErrorMessages
.
ERROR_WEBVIEW_SSL_ERROR
);
}
}
@Override
public
void
onPageFinished
(
WebView
view
,
String
url
)
{
EventDispatcher
.
dispatchEvent
(
component
,
"PageLoaded"
,
url
);
}
};
}
...
...
appinventor/docs/reference/components/userinterface.html
View file @
323ab909
...
...
@@ -1424,6 +1424,10 @@ none
</dl>
<h3>
Events
</h3>
<dl>
<dt><code>
PageLoaded(text url)
</code></dt>
<dd>
Event that runs when a page finishes loading.
</dd>
</dl>
<dl>
<dt><code>
WebViewStringChange(text value)
</code></dt>
<dd>
Event that runs when the AppInventor.setWebViewString method is called from JavaScript. The new WebViewString is given by the value parameter.
</dd>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment