diff --git a/entry/src/main/java/com/lcodecore/twinklingrefreshlayout/WebAbility.java b/entry/src/main/java/com/lcodecore/twinklingrefreshlayout/WebAbility.java index b882cae325bbfc776ef9dfbd0d03010480d43faf..a28c0ca30876e0020fbc30ae70dec81154f07abb 100644 --- a/entry/src/main/java/com/lcodecore/twinklingrefreshlayout/WebAbility.java +++ b/entry/src/main/java/com/lcodecore/twinklingrefreshlayout/WebAbility.java @@ -5,6 +5,7 @@ import ohos.aafwk.content.Intent; import ohos.agp.animation.AnimatorProperty; import ohos.agp.components.Component; import ohos.agp.components.StackLayout; +import ohos.agp.components.webengine.BrowserAgent; import ohos.agp.components.webengine.Navigator; import ohos.agp.components.webengine.ResourceError; import ohos.agp.components.webengine.ResourceRequest; @@ -88,6 +89,24 @@ public class WebAbility extends Ability implements Component.TouchEventListener // 发生错误时自定义处理 } }); + + mWebView.setBrowserAgent(new BrowserAgent(this) { + @Override + public void onTitleUpdated(WebView webview, String title) { + super.onTitleUpdated(webview, title); + // 标题变更时自定义处理 + AnimatorProperty animatorProperty = loadingView.createAnimatorProperty(); + animatorProperty.setDuration(500).setDelay(100).scaleX(0).scaleY(0); + animatorProperty.start(); + mWebView.setVisibility(Component.VISIBLE); + } + + @Override + public void onProgressUpdated(WebView webview, int newProgress) { + super.onProgressUpdated(webview, newProgress); + // 加载进度变更时自定义处理 + } + }); } @Override diff --git a/entry/src/main/resources/base/element/string.json b/entry/src/main/resources/base/element/string.json index 80ec7065c88a974dd7081a3691fce0eda5f9dd8f..386478dd1893ba03af3658547db5cfa63cd0eb08 100644 --- a/entry/src/main/resources/base/element/string.json +++ b/entry/src/main/resources/base/element/string.json @@ -122,7 +122,7 @@ }, { "name": "weburl", - "value": "https://developer.huawei.com/cn/" + "value": "https://www.baidu.com/" } ] } \ No newline at end of file