From e8da56b290dd2ce9b2b815f4c8824818c9bea996 Mon Sep 17 00:00:00 2001 From: gaoyunfei Date: Mon, 10 Apr 2023 12:20:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84Android=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E5=8A=A0=E8=BD=BD=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mop_example/CustomLoadingPage.java | 12 ++++++---- .../res/layout/layout_custom_loading_page.xml | 21 +++++++++++++++++ .../layout_custom_loading_page_failure.xml | 23 +++++++++++++++++++ example/lib/main.dart | 2 +- 4 files changed, 52 insertions(+), 6 deletions(-) create mode 100644 example/android/app/src/main/res/layout/layout_custom_loading_page.xml create mode 100644 example/android/app/src/main/res/layout/layout_custom_loading_page_failure.xml diff --git a/example/android/app/src/main/java/com/finogeeks/mop_example/CustomLoadingPage.java b/example/android/app/src/main/java/com/finogeeks/mop_example/CustomLoadingPage.java index 7b549c7..3ce5f7f 100644 --- a/example/android/app/src/main/java/com/finogeeks/mop_example/CustomLoadingPage.java +++ b/example/android/app/src/main/java/com/finogeeks/mop_example/CustomLoadingPage.java @@ -1,6 +1,7 @@ package com.finogeeks.mop_example; import android.content.Context; +import android.widget.TextView; import com.finogeeks.lib.applet.modules.appletloadinglayout.IFinAppletLoadingPage; @@ -13,26 +14,27 @@ public class CustomLoadingPage extends IFinAppletLoadingPage { @Override public int getFailureLayoutRes() { - return 0; + return R.layout.layout_custom_loading_page_failure; } @Override public int getLoadingLayoutRes() { - return 0; + return R.layout.layout_custom_loading_page; } @Override public void onLoadingFailure(@NonNull String s) { - + ((TextView)getFailureLayout().findViewById(R.id.failMsg)).setText(s); } @Override public void onLoadingFailure(@NonNull String s, @NonNull String s1) { - + ((TextView)getFailureLayout().findViewById(R.id.failTitle)).setText(s); + ((TextView)getFailureLayout().findViewById(R.id.failMsg)).setText(s1); } @Override public void onUpdate(@NonNull String s, @NonNull String s1) { - + ((TextView)getLoadingLayout().findViewById(R.id.loadingTitle)).setText(s); } } diff --git a/example/android/app/src/main/res/layout/layout_custom_loading_page.xml b/example/android/app/src/main/res/layout/layout_custom_loading_page.xml new file mode 100644 index 0000000..d25e23b --- /dev/null +++ b/example/android/app/src/main/res/layout/layout_custom_loading_page.xml @@ -0,0 +1,21 @@ + + + + + \ No newline at end of file diff --git a/example/android/app/src/main/res/layout/layout_custom_loading_page_failure.xml b/example/android/app/src/main/res/layout/layout_custom_loading_page_failure.xml new file mode 100644 index 0000000..6722426 --- /dev/null +++ b/example/android/app/src/main/res/layout/layout_custom_loading_page_failure.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/example/lib/main.dart b/example/lib/main.dart index 87196cc..a9e85a1 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -55,7 +55,7 @@ class _MyAppState extends State { // capsuleConfig.capsuleRightMargin = 25; uiconfig.capsuleConfig = capsuleConfig; uiconfig.appletText = "applet"; - uiconfig.loadingLayoutCls = "LoadingView"; + uiconfig.loadingLayoutCls = "com.finogeeks.mop_example.CustomLoadingPage"; // if (Platform.isIOS) { // final res = await Mop.instance.initialize(