AUToast is the page pop-up indicator, and the AUProgressDialog is a progress indicator.
When the Toast methods of BaseFragmentActivity and BaseActivity are used, the mPaaS framework modifies the pop-ups in a unified manner.
For activity developed based on BaseFragmentActivity and BaseActivity, the system uses AUToast by default.
Dependency
See Quick start.
API description
/**
* Instantiate Toast.
*
* @param context The context. Use activities on the current page.
* @param drawableId Image resources.
* @param tipSrcId The text prompt ID.
* @param duration Display duration Toast.Long/Toast.Short.
* @return Toast
*/
public static Toast makeToast(Context context, int drawableId, int tipSrcId, int duration) {
CharSequence tipSrc = context.getResources().getText(tipSrcId);
return makeToast(context, drawableId, tipSrc, duration);
}
/**
* Create Toast.
*
* @param context The context. Use activities on the current page.
* @param tipSrcId The prompt information.
* @param duration The duration.
* @return toast
*/
public static Toast makeToast(Context context, int tipSrcId, int duration) {
CharSequence tipSrc = context.getResources().getText(tipSrcId);
return makeToast(context, 0, tipSrc, duration);
}
/**
* Make a toast that just contains a image view and a text view.
*
* @param context The context. Use activities on the current page.
* @param drawableId The image resourceid.
* @param tipSrc The text to show. Can be formatted text.
* @param duration How long to display the message. Either or
* @return
*/
public static Toast makeToast(Context context, int drawableId, CharSequence tipSrc, int duration)
Code sample
// Success.
AUToast.makeToast(ToastActivity.this, com.alipay.mobile.antui.R.drawable.toast_ok, "Success prompt", Toast.LENGTH_SHORT).show();
// Failure.
AUToast.makeToast(ToastActivity.this, com.alipay.mobile.antui.R.drawable.toast_false, "Failure prompt", Toast.LENGTH_SHORT).show();
}
// Warning.
AUToast.makeToast(ToastActivity.this, com.alipay.mobile.antui.R.drawable.toast_warn, "Warning prompt", Toast.LENGTH_SHORT).show();
}
// Text.
AUToast.showToastWithSuper(ToastActivity.this, 0, "The text contains up to 14 words", Toast.LENGTH_SHORT);
// Loading.
AUProgressDialog dialog = new AUProgressDialog(this);
dialog.setMessage("Loading");
dialog.show();
}