From 512175fd510394322eb1588c026993fd9efb1fcd Mon Sep 17 00:00:00 2001 From: wanghualei Date: Mon, 10 Apr 2023 11:23:11 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E8=87=AA=E5=AE=9A=E4=B9=89=E7=9A=84loadi?= =?UTF-8?q?ng=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mop_example/CustomLoadingPage.java | 38 +++++++++++++++++++ example/ios/Runner.xcodeproj/project.pbxproj | 6 +++ example/ios/Runner/LoadingView.h | 16 ++++++++ example/ios/Runner/LoadingView.m | 30 +++++++++++++++ example/lib/main.dart | 2 + 5 files changed, 92 insertions(+) create mode 100644 example/android/app/src/main/java/com/finogeeks/mop_example/CustomLoadingPage.java create mode 100644 example/ios/Runner/LoadingView.h create mode 100644 example/ios/Runner/LoadingView.m 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 new file mode 100644 index 0000000..7b549c7 --- /dev/null +++ b/example/android/app/src/main/java/com/finogeeks/mop_example/CustomLoadingPage.java @@ -0,0 +1,38 @@ +package com.finogeeks.mop_example; + +import android.content.Context; + +import com.finogeeks.lib.applet.modules.appletloadinglayout.IFinAppletLoadingPage; + +import androidx.annotation.NonNull; + +public class CustomLoadingPage extends IFinAppletLoadingPage { + public CustomLoadingPage(@NonNull Context context) { + super(context); + } + + @Override + public int getFailureLayoutRes() { + return 0; + } + + @Override + public int getLoadingLayoutRes() { + return 0; + } + + @Override + public void onLoadingFailure(@NonNull String s) { + + } + + @Override + public void onLoadingFailure(@NonNull String s, @NonNull String s1) { + + } + + @Override + public void onUpdate(@NonNull String s, @NonNull String s1) { + + } +} diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index eaf0ffd..c122f435 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -14,6 +14,7 @@ 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; + A8C6E1F329E2FFEC00E3B446 /* LoadingView.m in Sources */ = {isa = PBXBuildFile; fileRef = A8C6E1F229E2FFEC00E3B446 /* LoadingView.m */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -46,6 +47,8 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + A8C6E1F129E2FFEC00E3B446 /* LoadingView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LoadingView.h; sourceTree = ""; }; + A8C6E1F229E2FFEC00E3B446 /* LoadingView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LoadingView.m; sourceTree = ""; }; B691CF78BE1464D3451E07AF /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ @@ -120,6 +123,8 @@ 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, + A8C6E1F129E2FFEC00E3B446 /* LoadingView.h */, + A8C6E1F229E2FFEC00E3B446 /* LoadingView.m */, ); path = Runner; sourceTree = ""; @@ -272,6 +277,7 @@ buildActionMask = 2147483647; files = ( 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, + A8C6E1F329E2FFEC00E3B446 /* LoadingView.m in Sources */, 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/example/ios/Runner/LoadingView.h b/example/ios/Runner/LoadingView.h new file mode 100644 index 0000000..450ec8e --- /dev/null +++ b/example/ios/Runner/LoadingView.h @@ -0,0 +1,16 @@ +// +// LoadingView.h +// Runner +// +// Created by Haley on 2023/4/9. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface LoadingView : FATBaseLoadingView + +@end + +NS_ASSUME_NONNULL_END diff --git a/example/ios/Runner/LoadingView.m b/example/ios/Runner/LoadingView.m new file mode 100644 index 0000000..4d98f07 --- /dev/null +++ b/example/ios/Runner/LoadingView.m @@ -0,0 +1,30 @@ +// +// LoadingView.m +// Runner +// +// Created by Haley on 2023/4/9. +// + +#import "LoadingView.h" + +@implementation LoadingView + +- (instancetype)initWithFrame:(CGRect)frame { + if ([super initWithFrame:frame]) { + self.loadingView.padding = 20; + self.loadingView.dotView.backgroundColor = [UIColor blackColor]; + self.loadingView.animation.duration = 5; + self.titleLabel.textColor = [UIColor redColor]; + } + return self; +} +- (void)layoutSubviews +{ + [super layoutSubviews]; + + // 如果要改logo,必须在这里修改。 + // 修改小程序logo应该是从管理后台上传新的小程序图标,因为更多面板、关于页面也会展示小程序logo,只改这里只是loding页面生效 + self.bottomImageView.hidden = YES; +} + +@end diff --git a/example/lib/main.dart b/example/lib/main.dart index 17d8685..87196cc 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -41,6 +41,7 @@ class _MyAppState extends State { List storeConfigs = [storeConfigA]; Config config = Config(storeConfigs); config.language = LanguageType.English; + config.baseLoadingViewClass = "LoadingView"; UIConfig uiconfig = UIConfig(); uiconfig.isAlwaysShowBackInDefaultNavigationBar = false; @@ -54,6 +55,7 @@ class _MyAppState extends State { // capsuleConfig.capsuleRightMargin = 25; uiconfig.capsuleConfig = capsuleConfig; uiconfig.appletText = "applet"; + uiconfig.loadingLayoutCls = "LoadingView"; // if (Platform.isIOS) { // final res = await Mop.instance.initialize(