Warning:
To allow superapps to centrally manage and control image loading, the mini program SDK does not provide a default image loading feature. Instead, it offers a proxy API for superapps to implement image loading. If a superapp does not implement image loading, the following features may display abnormally:
Mini program icons in the capsule panel
Mini program icons in authorization pop-ups
Mini program icons on the loading page
Mini program icons on the About page
The video component cover
The cover-image image
The profile photo
Superapp developers need to customize image loading by overriding the getDrawable method in BaseMiniAppProxyImpl.
API description:
Parameter context: The context of the current mini program process requesting authorization.
Parameter source: The image source, which can be a local or network image.
Parameter width: The width of the image.
Parameter height: The height of the image.
Parameter defaultDrawable: The default image used during loading or on failure.
Return value Drawable: The loaded drawable object.
@Override
public Drawable getDrawable(Context context, String source, int width, int hight, Drawable defaultDrawable)
Example:
@Override
public Drawable getDrawable(Context context, String source, int width, int hight, Drawable defaultDrawable) {
UniversalDrawable drawable = new UniversalDrawable();
if (TextUtils.isEmpty(source)) {
return drawable;
}
drawable.loadImage(context, source);
return drawable;
}