All Products
Search
Document Center

Mobile Platform as a Service:Image dialog

Last Updated:Mar 03, 2023

AUImageDialog (formerly SalesPromotionLimitDialog) provides a dialog box containing a title, three-level text, one confirm button or two buttons (left and right) at the bottom, and an ImageView in the middle. This component can be used to display message in throttling scenarios.

Sample image

65

Dependency

See Quick start.

API description

public interface OnItemClickListener {
    void onItemClick(int index);
}

/**
 * Obtain an AUImageDialog instance.
 *
 * @param context The context object.
 * @return Return an AUImageDialog instance.
 */
public static AUImageDialog getInstance(Context context)

/**
 * Disable the listener.
 *
 * @param mCloseBtnClickListener
 */
public void setCloseBtnClickListener(View.OnClickListener mCloseBtnClickListener) 


/**
 * Set the first-level title text.
 */
public void setTitle(CharSequence title) 

/**
 * Set the font size (in sp) of the first-level title.
 *
 * @param size
 */
public void setTitleTextSize(float size)

/**
 * Set the visibility of the first-level title.
 *
 * @param visibility
 */
public void setTitleTextVisibility(int visibility)
}

/**
 * Set the visibility of the second-level title.
 *
 * @param visibility
 */
public void setSubTitleTextVisibility(int visibility)

/**
 * Set the color of the first-level title.
 *
 * @param color
 */
public void setTitleTextColor(int color)

/**
 * Set the second-level title text.
 *
 * @param title
 */
public void setSubTitle(CharSequence title) 

/**
 * Set the font size (in sp) of the second-level title.
 *
 * @param size
 */
public void setSubTitleTextSize(float size)

/**
 * Set the color of the second-level title.
 *
 * @param color
 */
public void setSubTitleTextColor(int color) 

/**
 * Set the third-level title text.
 *
 * @param text
 */
public void setThirdTitleText(String text)

/**
 * Set the color of the third-level title.
 *
 * @param color
 */
public void setThirdTitleTextColor(int color)

/**
 * Set the background of ImageView.
 *
 * @param drawable
 */
public void setLogoBackground(Drawable drawable)

/**
 * Set the background of ImageView.
 *
 * @param resid
 */
public void setLogoBackgroundResource(int resid) 

/**
 * Set the background color of ImageView.
 *
 * @param color
 */
public void setLogoBackgroundColor(int color) 

/**
 * Set the background transparency of the dialog box.
 *
 * @param alpha
 */
public void setBackgroundTransparency(float alpha)

/**
 * Indicates whether to return animation.
 */
public boolean isUsdAnim() 

/**
 * Indicates whether to display animation when a dialog box is displayed or disappears. This parameter is set to true by default.
 *
 * @param usdAnim
 */
public void setUsdAnim(boolean usdAnim)

/**
 * Set the visibility of the Close button.
 *
 * @param visibility
 */
public void setCloseButtonVisibility(int visibility) 

/**
 * Set the text of the Confirm button.
 *
 * @param text
 */
public void setConfirmBtnText(String text)


/**
 * Return the Confirm button.
 */
public Button getConfirmBtn() 

/**
 * Set the Confirm button tapping listener.
 *
 * @param clickListener
 */
public void setOnConfirmBtnClickListener(View.OnClickListener clickListener)


/**
 * Display a dialog box without animation.
 */
public void showWithoutAnim() 

/**
 * Set the countdown.
 * @param seconds Countdown seconds.
 * @param tickColor
 * @param action
 * @param clickListener
 * @param timerListener
 */
public void showWithTimer(int seconds, String tickColor, String action, View.OnClickListener clickListener, TimerListener timerListener) 

public void showWithTimer(int seconds, View.OnClickListener clickListener, TimerListener timerListener)

/**
 * Obtain the default countdown color.
 * @return
 */
public String getDefaultTimeColorStr()

/**
 * Dismiss a dialog box without animation.
 */
public void dismissWithoutAnim()

@Override
public void dismiss() 


public boolean isCanceledOnTouch() {
    return canceledOnTouch;
}

/**
 * Indicates whether a dialog box is automatically canceled when a user taps the middle image.
 *
 * @param canceledOnTouch
 */
public void setCanceledOnTouch(boolean canceledOnTouch)


/**
 * Set the list button.
 * @param buttonListInfo
 * @param listener
 */
public void setButtonListInfo(List<String> buttonListInfo, OnItemClickListener listener)

public ImageView getLogoImageView() {
    return bgImageView;
}

public TextView getTitleTextView() {
    return titleTextView_1;
}

public TextView getSubTitleTextView() {
    return titleTextView_2;
}

public TextView getThirdTitleTextView() {
    return titleTextView_3;
}

public ImageView getBottomLine() {
    return bottomLine;
}

Sample code

66
AUImageDialog dialog = AUImageDialog.getInstance(this);
dialog.showWithTimer(5, null, null);
67
AUImageDialog dialog = AUImageDialog.getInstance(this);
dialog.setCanceledOnTouch(true);
dialog.setTitle("Single-line Title");
dialog.setSubTitle("Describe the current state and prompt the solution in two rows.");
dialog.setConfirmBtnText("Action Button");
dialog.showWithoutAnim();
68
AUImageDialog dialog = AUImageDialog.getInstance(this);
dialog.setCanceledOnTouch(true);
dialog.setTitle("Level-1 textLevel-2 textLevel-2 textLevel-2 textLevel-2 text");
dialog.setSubTitle("Level-2 textLevel-2 textLevel-2 textLevel-2 textLevel-2 textLevel-2 text");
dialog.setThirdTitleText("Accept xxx agreementAccept xxx agreementAccept xxx agreementAccept xxx agreementAccept xxx agreementAccept xxx agreementAccept xxx agreement");
dialog.setConfirmBtnText("Action Button");
dialog.showWithoutAnim();
69
AUImageDialog dialog = AUImageDialog.getInstance(this);
dialog.setTitle("Single-line Title");
dialog.setSubTitle("The description should not exceed 3 rows, and no ending mark is needed at the end of the last sentence.");
dialog.setButtonListInfo(getData(), new AUImageDialog.OnItemClickListener() {
    @Override
    public void onItemClick(int index) {

    }
});
dialog.showWithoutAnim();