完善Android自定义加载页
parent
512175fd51
commit
e8da56b290
|
@ -1,6 +1,7 @@
|
||||||
package com.finogeeks.mop_example;
|
package com.finogeeks.mop_example;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.finogeeks.lib.applet.modules.appletloadinglayout.IFinAppletLoadingPage;
|
import com.finogeeks.lib.applet.modules.appletloadinglayout.IFinAppletLoadingPage;
|
||||||
|
|
||||||
|
@ -13,26 +14,27 @@ public class CustomLoadingPage extends IFinAppletLoadingPage {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getFailureLayoutRes() {
|
public int getFailureLayoutRes() {
|
||||||
return 0;
|
return R.layout.layout_custom_loading_page_failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLoadingLayoutRes() {
|
public int getLoadingLayoutRes() {
|
||||||
return 0;
|
return R.layout.layout_custom_loading_page;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoadingFailure(@NonNull String s) {
|
public void onLoadingFailure(@NonNull String s) {
|
||||||
|
((TextView)getFailureLayout().findViewById(R.id.failMsg)).setText(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoadingFailure(@NonNull String s, @NonNull String s1) {
|
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
|
@Override
|
||||||
public void onUpdate(@NonNull String s, @NonNull String s1) {
|
public void onUpdate(@NonNull String s, @NonNull String s1) {
|
||||||
|
((TextView)getLoadingLayout().findViewById(R.id.loadingTitle)).setText(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:gravity="center">
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/loadingWaiting"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/Widget.AppCompat.ProgressBar"
|
||||||
|
/>
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/loadingTitle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:gravity="center"
|
||||||
|
android:padding="24dp">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/failTitle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
||||||
|
/>
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/failMsg"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Caption"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
|
@ -55,7 +55,7 @@ class _MyAppState extends State<MyApp> {
|
||||||
// capsuleConfig.capsuleRightMargin = 25;
|
// capsuleConfig.capsuleRightMargin = 25;
|
||||||
uiconfig.capsuleConfig = capsuleConfig;
|
uiconfig.capsuleConfig = capsuleConfig;
|
||||||
uiconfig.appletText = "applet";
|
uiconfig.appletText = "applet";
|
||||||
uiconfig.loadingLayoutCls = "LoadingView";
|
uiconfig.loadingLayoutCls = "com.finogeeks.mop_example.CustomLoadingPage";
|
||||||
|
|
||||||
// if (Platform.isIOS) {
|
// if (Platform.isIOS) {
|
||||||
// final res = await Mop.instance.initialize(
|
// final res = await Mop.instance.initialize(
|
||||||
|
|
Loading…
Reference in New Issue