@ProxyService(proxy = IMiniUiProxy.class)public class MiniUiProxyImpl extends AbsMiniUiProxy
@ProxyService(proxy = IMiniUiProxy.class)注解自定义 UI。
/*** 自定义导航栏返回按钮icon, 尺寸要求=24x43* 调用环境:子进程** @param mode 导航栏标题颜色, 1:black 0:white* @return*/@DrawableResint navBarBackRes(int mode);
@Override public int navBarBackRes(int mode) { if(mode == 0) {//black return R.drawable.back_icon;//your black icon res }else {//white return R.drawable.white_icon;//your white icon res } }

/*** 导航栏返回home按钮icon, 尺寸要求=48x48* 调用环境:子进程** @param mode 导航栏标题颜色, 1:black 0:white* @return*/@DrawableResint homeButtonRes(int mode);
@Override public int homeButtonRes(int mode) { if(mode == 0) {//black return R.drawable.home_black_icon; }else { return R.drawable.home_white_icon; } }

/*** 导航栏更多按钮icon, 尺寸要求=80x59* 调用环境:子进程** @param mode 导航栏标题颜色, 1:black 0:white* @return*/@DrawableResint moreButtonRes(int mode);
@Override public int moreButtonRes(int mode) { if(mode == 0) {//black return R.drawable.more_black_icon; }else { return R.drawable.more_white_icon; } }

/*** 导航栏关闭按钮icon, 尺寸要求=80x59* 调用环境:子进程** @param mode 导航栏标题颜色, 1:black 0:white* @return*/@DrawableResint closeButtonRes(int mode);
@Override public int closeButtonRes(int mode) { if(mode == 0) {//black return R.drawable.close_black_icon; }else { return R.drawable.close_white_icon; } }

/*** 胶囊按钮中间分割线背景颜色* 调用环境:子进程** @return*/@DrawableResint lineSplitBackgroundColor();
@Override public int lineSplitBackgroundColor() {return Color.RED; }

/*** 自定义授权弹窗view* 调用环境:子进程** @param context* @param authInfo* @param authView* @return true:自定义授权view;false:使用内置*/@Overridepublic boolean authView(Context context, MiniAuthInfo authInfo, IAuthView authView)
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="16dp" android:paddingTop="16dp" android:paddingRight="16dp" android:paddingBottom="15dp" android:background="@android:color/white"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="custom auth view" android:layout_centerHorizontal="true"/> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="150dp"> <Button android:id="@+id/mini_auth_btn_refuse" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1.0" android:text="@string/applet_mini_reject" /> <Button android:id="@+id/mini_auth_btn_grant" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1.0" android:text="@string/applet_mini_auth" /> </LinearLayout> </RelativeLayout>
@Override public boolean authView(Context context, MiniAuthInfo authInfo, IAuthView authView) { boolean isCustom = true; if (isCustom) { View view = LayoutInflater.from(context).inflate(R.layout.mini_auth_view, null); //必须设置 view.findViewById(R.id.mini_auth_btn_refuse).setOnClickListener(authInfo.refuseListener); //必须设置 view.findViewById(R.id.mini_auth_btn_grant).setOnClickListener(authInfo.grantListener); //返回自定义View authView.getView(view); } return isCustom; }


/*** 自定义小程序检查更新loading页面* 调用环境:主进程** @param context* @return*/public abstract IMiniLoading updateLoadingView(Context context);
@Overridepublic IMiniLoading updateLoadingView(Context context) {return new IMiniLoading() {@Overridepublic View create() {return LayoutInflater.from(context).inflate(R.layout.applet_activity_custom_update_loading, null);}@Overridepublic void show(View v) {}@Overridepublic void stop(View v) {}};}

/*** 自定义小程序加载loading页面* 调用环境:子进程** @param activityWeakRef Activity引用* @param app 小程序信息* @return 返回小程序loading UI*/public abstract IMiniLoading startLoadingView(WeakReference<Activity> activityWeakRef, MiniAppLoading app);
@Overridepublic IMiniLoading startLoadingView(Context context) {return new IMiniLoading() {@Overridepublic View create() {return LayoutInflater.from(context).inflate(R.layout.applet_activity_custom_start_loading, null);}@Overridepublic void show(View v) {}@Overridepublic void stop(View v) {}};}

/** * 是否隐藏小程序加载loading页面右上角胶囊 * * @return true:隐藏;false:不隐藏(默认值) */ boolean hideLoadingCapsule();

/*** 是否隐藏webview组件进度条* @return true:隐藏;false:不隐藏(默认值)*/boolean hideWebViewProgressBar();
/*** 设置webview组件进度条颜色(已完成进度颜色),返回空使用默认值* @return 进度条颜色值,例如:Color.GREEN*/Integer webviewProgressBarColor();/*** webview组件进度条背景色(未完成进度颜色),返回空使用默认值,webviewProgressBarColor返回非空值时生效* @return 进度条背景颜色值,例如:Color.GREEN*/Integer webviewProgressBarBgColor();
/*** 通用对话框定制接口* @param context 对话框上下* @param dialogInfo 对话框信息* @return 返回自定义的对话框*/Dialog createCommonDialog(Context context, DialogInfo dialogInfo);
@Overridepublic Dialog createCommonDialog(Context context, DialogInfo dialogInfo) {AlertDialog dialog = new AlertDialog.Builder(context).setView(com.tencent.tmfmini.sdk.R.layout.mini_sdk_custom_dialog_temp).create();dialog.setTitle(dialogInfo.getTitle());dialog.setMessage(dialogInfo.getMessage());if (dialogInfo.getPositiveButtonColor() != null) {dialog.setButton(DialogInterface.BUTTON_POSITIVE, dialogInfo.getPositiveButtonText(), dialogInfo.getPositiveButtonListener());}if (dialogInfo.getNegativeButtonColor() != null) {dialog.setButton(DialogInterface.BUTTON_NEGATIVE, dialogInfo.getNegativeButtonText(), dialogInfo.getNegativeButtonListener());}dialog.setCancelable(dialogInfo.isCancelable());dialog.setOnCancelListener(dialogInfo.getCancelListener());dialog.setOnDismissListener(dialogInfo.getDismissListener());return dialog;}
文档反馈