|
@@ -3,13 +3,13 @@ package com.kongzue.dialogx.interfaces;
|
|
|
import android.content.Context;
|
|
|
|
|
|
public abstract class DialogXStyle {
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* DialogXStyle 版本
|
|
|
* 相关文档请参阅:https://github.com/kongzue/DialogX/wiki/%E8%87%AA%E5%AE%9A%E4%B9%89-DialogX-%E4%B8%BB%E9%A2%98
|
|
|
*/
|
|
|
public static final int styleVer = 6;
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 按钮类型常量
|
|
|
*/
|
|
@@ -18,7 +18,7 @@ public abstract class DialogXStyle {
|
|
|
public static final int BUTTON_OTHER = 3;
|
|
|
public static final int SPACE = 4;
|
|
|
public static final int SPLIT = 5;
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 重写基础对话框布局资源
|
|
|
* <p>
|
|
@@ -32,7 +32,7 @@ public abstract class DialogXStyle {
|
|
|
public int layout(boolean light) {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 修改默认对话框启动动画效果
|
|
|
* <p>
|
|
@@ -44,7 +44,7 @@ public abstract class DialogXStyle {
|
|
|
public int enterAnimResId() {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 修改默认对话框关闭动画效果
|
|
|
* <p>
|
|
@@ -56,7 +56,7 @@ public abstract class DialogXStyle {
|
|
|
public int exitAnimResId() {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 修改默认按钮排序(纵向)
|
|
|
* <p>
|
|
@@ -69,7 +69,7 @@ public abstract class DialogXStyle {
|
|
|
public int[] verticalButtonOrder() {
|
|
|
return new int[]{BUTTON_OTHER, SPLIT, BUTTON_CANCEL, BUTTON_OK};
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 修改默认按钮排序(横向)
|
|
|
* <p>
|
|
@@ -82,7 +82,7 @@ public abstract class DialogXStyle {
|
|
|
public int[] horizontalButtonOrder() {
|
|
|
return new int[]{BUTTON_OTHER, BUTTON_CANCEL, BUTTON_OK};
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 按钮分割线宽度
|
|
|
* <p>
|
|
@@ -93,9 +93,7 @@ public abstract class DialogXStyle {
|
|
|
public int splitWidthPx() {
|
|
|
return 1;
|
|
|
}
|
|
|
-
|
|
|
- ;
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 按钮分割线颜色
|
|
|
* <p>
|
|
@@ -106,9 +104,7 @@ public abstract class DialogXStyle {
|
|
|
public int splitColorRes(boolean light) {
|
|
|
return 0x1A000000;
|
|
|
}
|
|
|
-
|
|
|
- ;
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 模糊背景
|
|
|
* <p>
|
|
@@ -119,7 +115,7 @@ public abstract class DialogXStyle {
|
|
|
public BlurBackgroundSetting messageDialogBlurSettings() {
|
|
|
return null;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 自定义按钮样式
|
|
|
* <p>
|
|
@@ -134,11 +130,29 @@ public abstract class DialogXStyle {
|
|
|
public HorizontalButtonRes overrideHorizontalButtonRes() {
|
|
|
return null;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public VerticalButtonRes overrideVerticalButtonRes() {
|
|
|
return null;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 消息对话框正文文本 UI 定义
|
|
|
+ *
|
|
|
+ * @return null 代表使用默认定义
|
|
|
+ */
|
|
|
+ public UIAttributeDefinition messageDialogMessageTextViewUIAD() {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * InputDialog 输入框 UI 定义
|
|
|
+ *
|
|
|
+ * @return null 代表使用默认定义
|
|
|
+ */
|
|
|
+ public UIAttributeDefinition inputEditTextUIAD() {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 修改等待/提示框的样式
|
|
|
* <p>
|
|
@@ -149,7 +163,7 @@ public abstract class DialogXStyle {
|
|
|
public WaitTipRes overrideWaitTipRes() {
|
|
|
return null;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 自定义底部对话框/菜单样式
|
|
|
* <p>
|
|
@@ -161,7 +175,7 @@ public abstract class DialogXStyle {
|
|
|
public BottomDialogRes overrideBottomDialogRes() {
|
|
|
return null;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 自定义 PopTip 样式
|
|
|
*
|
|
@@ -170,7 +184,7 @@ public abstract class DialogXStyle {
|
|
|
public PopTipSettings popTipSettings() {
|
|
|
return null;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 自定义 PopNotificationSettings 样式
|
|
|
*
|
|
@@ -179,7 +193,7 @@ public abstract class DialogXStyle {
|
|
|
public PopNotificationSettings popNotificationSettings() {
|
|
|
return null;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 自定义 PopMenu 样式
|
|
|
*
|
|
@@ -188,7 +202,7 @@ public abstract class DialogXStyle {
|
|
|
public PopMenuSettings popMenuSettings() {
|
|
|
return null;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 模糊背景设置
|
|
|
* <p>
|
|
@@ -200,20 +214,20 @@ public abstract class DialogXStyle {
|
|
|
* blurBackgroundRoundRadiusPx()用于给定模糊效果的圆角半径,单位为像素(Px)。
|
|
|
*/
|
|
|
public abstract class BlurBackgroundSetting {
|
|
|
-
|
|
|
+
|
|
|
public boolean blurBackground() {
|
|
|
return false;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public int blurForwardColorRes(boolean light) {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public int blurBackgroundRoundRadiusPx() {
|
|
|
return 0;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 自定义按钮样式设置
|
|
|
* <p>
|
|
@@ -224,67 +238,67 @@ public abstract class DialogXStyle {
|
|
|
* overrideHorizontalButtonRes和overrideVerticalButtonRes返回值return null时默认不进行样式修改设置。
|
|
|
*/
|
|
|
public abstract class HorizontalButtonRes {
|
|
|
-
|
|
|
+
|
|
|
public int overrideHorizontalOkButtonBackgroundRes(int visibleButtonCount, boolean light) {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public int overrideHorizontalCancelButtonBackgroundRes(int visibleButtonCount, boolean light) {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public int overrideHorizontalOtherButtonBackgroundRes(int visibleButtonCount, boolean light) {
|
|
|
return 0;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public abstract class VerticalButtonRes {
|
|
|
-
|
|
|
+
|
|
|
public int overrideVerticalOkButtonBackgroundRes(int visibleButtonCount, boolean light) {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public int overrideVerticalCancelButtonBackgroundRes(int visibleButtonCount, boolean light) {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public int overrideVerticalOtherButtonBackgroundRes(int visibleButtonCount, boolean light) {
|
|
|
return 0;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 修改等待/提示框的样式设置
|
|
|
* <p>
|
|
|
* 此接口return null时采用默认样式。
|
|
|
*/
|
|
|
public abstract class WaitTipRes {
|
|
|
-
|
|
|
+
|
|
|
//重写布局资源
|
|
|
public int overrideWaitLayout(boolean light) {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//设置圆角像素
|
|
|
public int overrideRadiusPx() {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//判断是否需要模糊背景效果
|
|
|
public boolean blurBackground() {
|
|
|
return false;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//重新设置前景色
|
|
|
public int overrideBackgroundColorRes(boolean light) {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//设置在亮/暗色时的文字颜色,注意,此颜色也将修改进度动画的颜色。
|
|
|
public int overrideTextColorRes(boolean light) {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 自定义等待提示动画组件接口 ProgressViewInterface
|
|
|
* <p>
|
|
@@ -325,7 +339,7 @@ public abstract class DialogXStyle {
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 自定义底部对话框/菜单样式设置
|
|
|
* <p>
|
|
@@ -337,39 +351,39 @@ public abstract class DialogXStyle {
|
|
|
* overrideSelectionImage(boolean light, boolean isSelected)用于
|
|
|
*/
|
|
|
public abstract class BottomDialogRes {
|
|
|
-
|
|
|
+
|
|
|
//定义是否支持滑动关闭操作。
|
|
|
public boolean touchSlide() {
|
|
|
return false;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//用于设置底部对话框的布局,如需修改布局样式,请参照 底部对话框默认亮色布局 和 底部对话框默认暗色布局,请参照 Demo 布局的格式进行布局设计,不建议修改或去掉布局中的含有 id 的组件,当return 0时使用默认实现。
|
|
|
public int overrideDialogLayout(boolean light) {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//用于修改默认分隔线的粗细,单位像素。
|
|
|
public int overrideMenuDividerDrawableRes(boolean light) {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//修改默认分隔线的粗细,单位像素。
|
|
|
public int overrideMenuDividerHeight(boolean light) {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//修改默认菜单文字的颜色,值采用为 color 的资源 ID。
|
|
|
public int overrideMenuTextColor(boolean light) {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//设置默认情况下,当底部对话框内容大于屏幕可显示高度时,
|
|
|
//默认启动后显示的高度比例,值为浮点型,例如设置为 0.6f 时,则当内容大于可显示高度时,启动后对话框只从屏幕底部弹出 0.6×屏幕高度的大小,需要再次向上拖拽才能展开全部对话框,
|
|
|
//此功能需要和 touchSlide() 配合使用。
|
|
|
public float overrideBottomDialogMaxHeight() {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 定义菜单条目的布局样式。
|
|
|
* 例如当使用 iOS 样式时,第一条菜单默认采用左上角和右上角都为圆角的样式,当显示菜单标题、正文或自定义布局时,
|
|
@@ -387,49 +401,49 @@ public abstract class DialogXStyle {
|
|
|
public int overrideMenuItemLayout(boolean light, int index, int count, boolean isContentVisibility) {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//定义已选中的菜单默认背景颜色,
|
|
|
// 例如在使用 MIUI 主题样式且开启了单选模式时,默认打开菜单后会选中上次已选择的条目,此接口用预设定已选中菜单的背景颜色。
|
|
|
public int overrideSelectionMenuBackgroundColor(boolean light) {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//用于确定使用此主题时,默认会不会重定义图标的颜色,
|
|
|
// 若开启,那么所有菜单图标会根据主题的亮/暗色的文字颜色重新覆盖颜色,若关闭,则使用图标原本的颜色。
|
|
|
public boolean selectionImageTint(boolean light) {
|
|
|
return false;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//设置默认单选菜单已选择/未选择时的图标资源,可使用 mipmap 图像或者 drawable 资源。
|
|
|
public int overrideSelectionImage(boolean light, boolean isSelected) {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//设置默认多选菜单已选择/未选择时的图标资源,可使用 mipmap 图像或者 drawable 资源。
|
|
|
public int overrideMultiSelectionImage(boolean light, boolean isSelected) {
|
|
|
return 0;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 自定义 PopTip 样式设置
|
|
|
* <p>
|
|
|
* 当return null 时使用默认样式。
|
|
|
*/
|
|
|
public abstract static class PopTipSettings {
|
|
|
-
|
|
|
+
|
|
|
//PopTip 的默认布局样式,请参考具体布局实现:PopTip 默认亮色布局 和 PopTip 默认暗色布局
|
|
|
public int layout(boolean light) {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* align()接口用于判断 PopTip 的弹出规则,支持的值如下:
|
|
|
*/
|
|
|
public ALIGN align() {
|
|
|
return ALIGN.CENTER;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public enum ALIGN {
|
|
|
CENTER, //屏幕中央弹出
|
|
|
TOP, //屏幕顶端弹出(非安全区)
|
|
@@ -437,73 +451,73 @@ public abstract class DialogXStyle {
|
|
|
TOP_INSIDE, //屏幕顶端安全区内弹出
|
|
|
BOTTOM_INSIDE //屏幕底部安全区内弹出
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//设置启动动画效果。
|
|
|
public int enterAnimResId(boolean light) {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//设置关闭动画效果。
|
|
|
public int exitAnimResId(boolean light) {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//使图标颜色和文字保持一致
|
|
|
- public boolean tintIcon(){
|
|
|
+ public boolean tintIcon() {
|
|
|
return true;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//默认完成图标
|
|
|
- public int defaultIconSuccess(){
|
|
|
+ public int defaultIconSuccess() {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//默认警告图标
|
|
|
- public int defaultIconWarning(){
|
|
|
+ public int defaultIconWarning() {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//默认错误图标
|
|
|
- public int defaultIconError(){
|
|
|
+ public int defaultIconError() {
|
|
|
return 0;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public abstract class PopMenuSettings {
|
|
|
-
|
|
|
+
|
|
|
//PopMenu 的默认布局样式,请参考具体布局实现:PopMenu 默认亮色布局 和 PopMenu 默认暗色布局
|
|
|
public int layout(boolean light) {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public BlurBackgroundSetting blurBackgroundSettings() {
|
|
|
return null;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public int backgroundMaskColorRes() {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//用于修改默认分隔线的粗细,单位像素。
|
|
|
public int overrideMenuDividerDrawableRes(boolean light) {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//修改默认分隔线的粗细,单位像素。
|
|
|
public int overrideMenuDividerHeight(boolean light) {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//修改默认菜单文字的颜色,值采用为 color 的资源 ID。
|
|
|
public int overrideMenuTextColor(boolean light) {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//自定义菜单的布局资源 ID。
|
|
|
public int overrideMenuItemLayoutRes(boolean light) {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 定义菜单条目的布局背景资源。
|
|
|
* 例如当使用 iOS 样式时,第一条菜单默认采用左上角和右上角都为圆角的样式,当显示菜单标题、正文或自定义布局时,
|
|
@@ -521,44 +535,44 @@ public abstract class DialogXStyle {
|
|
|
public int overrideMenuItemBackgroundRes(boolean light, int index, int count, boolean isContentVisibility) {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//定义已选中的菜单默认背景颜色,
|
|
|
// 例如在使用 MIUI 主题样式且开启了单选模式时,默认打开菜单后会选中上次已选择的条目,此接口用预设定已选中菜单的背景颜色。
|
|
|
public int overrideSelectionMenuBackgroundColor(boolean light) {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//用于确定使用此主题时,默认会不会重定义图标的颜色,
|
|
|
// 若开启,那么所有菜单图标会根据主题的亮/暗色的文字颜色重新覆盖颜色,若关闭,则使用图标原本的颜色。
|
|
|
public boolean selectionImageTint(boolean light) {
|
|
|
return false;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//PopMenu 的顶部和底部的额外 padding
|
|
|
public int paddingVertical() {
|
|
|
return 0;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 自定义 PopNotificationSettings 样式设置
|
|
|
* <p>
|
|
|
* 当return null 时使用默认样式。
|
|
|
*/
|
|
|
public abstract static class PopNotificationSettings {
|
|
|
-
|
|
|
+
|
|
|
//PopNotificationSettings 的默认布局样式,请参考具体布局实现:PopNotificationSettings 默认亮色布局 和 PopNotificationSettings 默认暗色布局
|
|
|
public int layout(boolean light) {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* align()接口用于判断 PopNotificationSettings 的弹出规则,支持的值如下:
|
|
|
*/
|
|
|
public ALIGN align() {
|
|
|
return ALIGN.CENTER;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public enum ALIGN {
|
|
|
CENTER, //屏幕中央弹出
|
|
|
TOP, //屏幕顶端弹出(非安全区)
|
|
@@ -566,37 +580,37 @@ public abstract class DialogXStyle {
|
|
|
TOP_INSIDE, //屏幕顶端安全区内弹出
|
|
|
BOTTOM_INSIDE //屏幕底部安全区内弹出
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//设置启动动画效果。
|
|
|
public int enterAnimResId(boolean light) {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//设置关闭动画效果。
|
|
|
public int exitAnimResId(boolean light) {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//使图标颜色和文字保持一致
|
|
|
- public boolean tintIcon(){
|
|
|
+ public boolean tintIcon() {
|
|
|
return true;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//默认完成图标
|
|
|
- public int defaultIconSuccess(){
|
|
|
+ public int defaultIconSuccess() {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//默认警告图标
|
|
|
- public int defaultIconWarning(){
|
|
|
+ public int defaultIconWarning() {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//默认错误图标
|
|
|
- public int defaultIconError(){
|
|
|
+ public int defaultIconError() {
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public BlurBackgroundSetting blurBackgroundSettings() {
|
|
|
return null;
|
|
|
}
|
|
@@ -604,7 +618,10 @@ public abstract class DialogXStyle {
|
|
|
|
|
|
/**
|
|
|
* 是否需要在设置对话框背景色时对按钮背景也进行染色
|
|
|
+ *
|
|
|
* @return false 不进行染色
|
|
|
*/
|
|
|
- public boolean tintButtonBackground(){return false;}
|
|
|
+ public boolean tintButtonBackground() {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|