Through the following configurations, the host can customize certain features of the Mini Program UI.
@ProxyService(proxy = IMiniUiProxy.class)
public class MiniUiProxyImpl extends AbsMiniUiProxy
Define an implementation class and inherit AbsMiniUiProxy, and decorate it with the aforementioned annotations.
Capsule UI
@DrawableRes
int navBarBackRes(int mode);
@DrawableRes
int homeButtonRes(int mode);
@DrawableRes
int moreButtonRes(int mode);
@DrawableRes
int closeButtonRes(int mode);
@DrawableRes
int lineSplitBackgroundColor();
Mini Program Authorization UI
When the Mini Program API requires authorization, the SDK provides the following authorization UI style by default. Developers can also customize the authorization UI style using the following methods.
@Override
public boolean authView(Context context, MiniAuthInfo authInfo, IAuthView authView) {
return true;
}
UI of Authorized User Information
You can customize user nickname and avatar in user authorization information.
@Override
public void getUserInfo(String appId, AsyncResult result) {
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("nickName", "userInfo Test");
jsonObject.put("avatarUrl", "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.daimg.com%2Fuploads%2Fallimg%2F210114%2F1-210114151951.jpg&refer=http%3A%2F%2Fimg.daimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1673852149&t=e2a830d9fabd7e0818059d92c3883017");
result.onReceiveResult(true, jsonObject);
} catch (JSONException e) {
e.printStackTrace();
}
}
public Drawable getDrawable(Context context, String source, int width, int hight, Drawable defaultDrawable)
Mini Program Loading
During the opening process of the Mini Program, there are update checks and startup loading. The loading can be customized in the following manner.
public abstract IMiniLoading updateLoadingView(Context context);
public abstract IMiniLoading startLoadingView(WeakReference<Activity> activityWeakRef, MiniAppLoading app);
Example:
@Override
public IMiniLoading updateLoadingView(Context context) {
return new IMiniLoading() {
@Override
public View create() {
return LayoutInflater.from(context).inflate(R.layout.applet_activity_custom_update_loading, null);
}
@Override
public void show(View v) {
}
@Override
public void stop(View v) {
}
};
}
Mini program loading capsule in the upper right corner of the loading page
/**
* Whether to hide the capsule in the upper right corner of the loading page of the mini program
*
* @return true: hidden; false: not hidden (default value)
*/
boolean hideLoadingCapsule();
Was this page helpful?