All Products
Search
Document Center

Image dialog

Last Updated: May 25, 2021

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

Dependency

See Quick start.

API description

 
  1. public interface OnItemClickListener {
  2. void onItemClick(int index);
  3. }
  4. /**
  5. * Obtain an AUImageDialog instance.
  6. *
  7. * @param context The context object.
  8. * @return Return an AUImageDialog instance.
  9. */
  10. public static AUImageDialog getInstance(Context context)
  11. /**
  12. * Disable the listener.
  13. *
  14. * @param mCloseBtnClickListener
  15. */
  16. public void setCloseBtnClickListener(View.OnClickListener mCloseBtnClickListener)
  17. /**
  18. * Set the first-level title text.
  19. */
  20. public void setTitle(CharSequence title)
  21. /**
  22. * Set the font size (in sp) of the first-level title.
  23. *
  24. * @param size
  25. */
  26. public void setTitleTextSize(float size)
  27. /**
  28. * Set the visibility of the first-level title.
  29. *
  30. * @param visibility
  31. */
  32. public void setTitleTextVisibility(int visibility)
  33. }
  34. /**
  35. * Set the visibility of the second-level title.
  36. *
  37. * @param visibility
  38. */
  39. public void setSubTitleTextVisibility(int visibility)
  40. /**
  41. * Set the color of the first-level title.
  42. *
  43. * @param color
  44. */
  45. public void setTitleTextColor(int color)
  46. /**
  47. * Set the second-level title text.
  48. *
  49. * @param title
  50. */
  51. public void setSubTitle(CharSequence title)
  52. /**
  53. * Set the font size (in sp) of the second-level title.
  54. *
  55. * @param size
  56. */
  57. public void setSubTitleTextSize(float size)
  58. /**
  59. * Set the color of the second-level title.
  60. *
  61. * @param color
  62. */
  63. public void setSubTitleTextColor(int color)
  64. /**
  65. * Set the third-level title text.
  66. *
  67. * @param text
  68. */
  69. public void setThirdTitleText(String text)
  70. /**
  71. * Set the color of the third-level title.
  72. *
  73. * @param color
  74. */
  75. public void setThirdTitleTextColor(int color)
  76. /**
  77. * Set the background of ImageView.
  78. *
  79. * @param drawable
  80. */
  81. public void setLogoBackground(Drawable drawable)
  82. /**
  83. * Set the background of ImageView.
  84. *
  85. * @param resid
  86. */
  87. public void setLogoBackgroundResource(int resid)
  88. /**
  89. * Set the background color of ImageView.
  90. *
  91. * @param color
  92. */
  93. public void setLogoBackgroundColor(int color)
  94. /**
  95. * Set the background transparency of the dialog box.
  96. *
  97. * @param alpha
  98. */
  99. public void setBackgroundTransparency(float alpha)
  100. /**
  101. * Indicates whether to return animation.
  102. */
  103. public boolean isUsdAnim()
  104. /**
  105. * Indicates whether to display animation when a dialog box is displayed or disappears. This parameter is set to true by default.
  106. *
  107. * @param usdAnim
  108. */
  109. public void setUsdAnim(boolean usdAnim)
  110. /**
  111. * Set the visibility of the Close button.
  112. *
  113. * @param visibility
  114. */
  115. public void setCloseButtonVisibility(int visibility)
  116. /**
  117. * Set the text of the Confirm button.
  118. *
  119. * @param text
  120. */
  121. public void setConfirmBtnText(String text)
  122. /**
  123. * Return the Confirm button.
  124. */
  125. public Button getConfirmBtn()
  126. /**
  127. * Set the Confirm button tapping listener.
  128. *
  129. * @param clickListener
  130. */
  131. public void setOnConfirmBtnClickListener(View.OnClickListener clickListener)
  132. /**
  133. * Display a dialog box without animation.
  134. */
  135. public void showWithoutAnim()
  136. /**
  137. * Set the countdown.
  138. * @param seconds Countdown seconds.
  139. * @param tickColor
  140. * @param action
  141. * @param clickListener
  142. * @param timerListener
  143. */
  144. public void showWithTimer(int seconds, String tickColor, String action, View.OnClickListener clickListener, TimerListener timerListener)
  145. public void showWithTimer(int seconds, View.OnClickListener clickListener, TimerListener timerListener)
  146. /**
  147. * Obtain the default countdown color.
  148. * @return
  149. */
  150. public String getDefaultTimeColorStr()
  151. /**
  152. * Dismiss a dialog box without animation.
  153. */
  154. public void dismissWithoutAnim()
  155. @Override
  156. public void dismiss()
  157. public boolean isCanceledOnTouch() {
  158. return canceledOnTouch;
  159. }
  160. /**
  161. * Indicates whether a dialog box is automatically canceled when a user taps the middle image.
  162. *
  163. * @param canceledOnTouch
  164. */
  165. public void setCanceledOnTouch(boolean canceledOnTouch)
  166. /**
  167. * Set the list button.
  168. * @param buttonListInfo
  169. * @param listener
  170. */
  171. public void setButtonListInfo(List<String> buttonListInfo, OnItemClickListener listener)
  172. public ImageView getLogoImageView() {
  173. return bgImageView;
  174. }
  175. public TextView getTitleTextView() {
  176. return titleTextView_1;
  177. }
  178. public TextView getSubTitleTextView() {
  179. return titleTextView_2;
  180. }
  181. public TextView getThirdTitleTextView() {
  182. return titleTextView_3;
  183. }
  184. public ImageView getBottomLine() {
  185. return bottomLine;
  186. }

Sample code

 
  1. AUImageDialog dialog = AUImageDialog.getInstance(this);
  2. dialog.showWithTimer(5, null, null);

 
  1. AUImageDialog dialog = AUImageDialog.getInstance(this);
  2. dialog.setCanceledOnTouch(true);
  3. dialog.setTitle("标题单行");
  4. dialog.setSubTitle("说明当前状态、提示用户解决方案,最好不要超过两行。");
  5. dialog.setConfirmBtnText("行动按钮");
  6. dialog.showWithoutAnim();

 
  1. AUImageDialog dialog = AUImageDialog.getInstance(this);
  2. dialog.setCanceledOnTouch(true);
  3. dialog.setTitle("一级文案二级文案二级文案二级文案二级文案");
  4. dialog.setSubTitle("二级文案二级文案二级文案二级文案二级文案二级文案");
  5. dialog.setThirdTitleText("同意xxx协同意xxx协议同意xxx协议同意xxx协议同意xxx协议同意xxx协议同意xxx协议议");
  6. dialog.setConfirmBtnText("行动按钮");
  7. dialog.showWithoutAnim();

 
  1. AUImageDialog dialog = AUImageDialog.getInstance(this);
  2. dialog.setTitle("标题单行");
  3. dialog.setSubTitle("描述文字的字数尽量控制在三行内,并且单行最右侧尽量不要是标点符号。");
  4. dialog.setButtonListInfo(getData(), new AUImageDialog.OnItemClickListener() {
  5. @Override
  6. public void onItemClick(int index) {
  7. }
  8. });
  9. dialog.showWithoutAnim();