|
@@ -38,7 +38,7 @@ import com.kongzue.dialogx.util.views.MaxRelativeLayout;
|
|
* @createTime: 2020/10/20 11:59
|
|
* @createTime: 2020/10/20 11:59
|
|
*/
|
|
*/
|
|
public class CustomDialog extends BaseDialog {
|
|
public class CustomDialog extends BaseDialog {
|
|
-
|
|
|
|
|
|
+
|
|
public static int overrideEnterDuration = -1;
|
|
public static int overrideEnterDuration = -1;
|
|
public static int overrideExitDuration = -1;
|
|
public static int overrideExitDuration = -1;
|
|
public static int overrideEnterAnimRes = 0;
|
|
public static int overrideEnterAnimRes = 0;
|
|
@@ -59,14 +59,14 @@ public class CustomDialog extends BaseDialog {
|
|
protected boolean bkgInterceptTouch = true;
|
|
protected boolean bkgInterceptTouch = true;
|
|
protected OnBackgroundMaskClickListener<CustomDialog> onBackgroundMaskClickListener;
|
|
protected OnBackgroundMaskClickListener<CustomDialog> onBackgroundMaskClickListener;
|
|
protected DialogXAnimInterface<CustomDialog> dialogXAnimImpl;
|
|
protected DialogXAnimInterface<CustomDialog> dialogXAnimImpl;
|
|
-
|
|
|
|
|
|
+
|
|
protected View baseView;
|
|
protected View baseView;
|
|
protected int alignViewGravity = -1; //指定菜单相对 baseView 的位置
|
|
protected int alignViewGravity = -1; //指定菜单相对 baseView 的位置
|
|
protected int width = -1; //指定菜单宽度
|
|
protected int width = -1; //指定菜单宽度
|
|
protected int height = -1; //指定菜单高度
|
|
protected int height = -1; //指定菜单高度
|
|
protected int[] baseViewLoc;
|
|
protected int[] baseViewLoc;
|
|
protected int[] marginRelativeBaseView = new int[4];
|
|
protected int[] marginRelativeBaseView = new int[4];
|
|
-
|
|
|
|
|
|
+
|
|
public enum ALIGN {
|
|
public enum ALIGN {
|
|
CENTER,
|
|
CENTER,
|
|
TOP,
|
|
TOP,
|
|
@@ -86,36 +86,36 @@ public class CustomDialog extends BaseDialog {
|
|
RIGHT_TOP,
|
|
RIGHT_TOP,
|
|
RIGHT_BOTTOM
|
|
RIGHT_BOTTOM
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
protected CustomDialog() {
|
|
protected CustomDialog() {
|
|
super();
|
|
super();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public static CustomDialog build() {
|
|
public static CustomDialog build() {
|
|
return new CustomDialog();
|
|
return new CustomDialog();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public static CustomDialog build(OnBindView<CustomDialog> onBindView) {
|
|
public static CustomDialog build(OnBindView<CustomDialog> onBindView) {
|
|
return new CustomDialog().setCustomView(onBindView);
|
|
return new CustomDialog().setCustomView(onBindView);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public CustomDialog(OnBindView<CustomDialog> onBindView) {
|
|
public CustomDialog(OnBindView<CustomDialog> onBindView) {
|
|
this.onBindView = onBindView;
|
|
this.onBindView = onBindView;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public static CustomDialog show(OnBindView<CustomDialog> onBindView) {
|
|
public static CustomDialog show(OnBindView<CustomDialog> onBindView) {
|
|
CustomDialog customDialog = new CustomDialog(onBindView);
|
|
CustomDialog customDialog = new CustomDialog(onBindView);
|
|
customDialog.show();
|
|
customDialog.show();
|
|
return customDialog;
|
|
return customDialog;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public static CustomDialog show(OnBindView<CustomDialog> onBindView, ALIGN align) {
|
|
public static CustomDialog show(OnBindView<CustomDialog> onBindView, ALIGN align) {
|
|
CustomDialog customDialog = new CustomDialog(onBindView);
|
|
CustomDialog customDialog = new CustomDialog(onBindView);
|
|
customDialog.align = align;
|
|
customDialog.align = align;
|
|
customDialog.show();
|
|
customDialog.show();
|
|
return customDialog;
|
|
return customDialog;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public CustomDialog show() {
|
|
public CustomDialog show() {
|
|
if (isHide && getDialogView() != null && isShow) {
|
|
if (isHide && getDialogView() != null && isShow) {
|
|
if (hideWithExitAnim && getDialogImpl() != null && getDialogImpl().boxCustom != null) {
|
|
if (hideWithExitAnim && getDialogImpl() != null && getDialogImpl().boxCustom != null) {
|
|
@@ -143,7 +143,7 @@ public class CustomDialog extends BaseDialog {
|
|
show(dialogView);
|
|
show(dialogView);
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public CustomDialog show(Activity activity) {
|
|
public CustomDialog show(Activity activity) {
|
|
super.beforeShow();
|
|
super.beforeShow();
|
|
if (getDialogView() == null) {
|
|
if (getDialogView() == null) {
|
|
@@ -154,30 +154,32 @@ public class CustomDialog extends BaseDialog {
|
|
show(activity, dialogView);
|
|
show(activity, dialogView);
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
private ViewTreeObserver viewTreeObserver;
|
|
private ViewTreeObserver viewTreeObserver;
|
|
private ViewTreeObserver.OnDrawListener baseViewDrawListener;
|
|
private ViewTreeObserver.OnDrawListener baseViewDrawListener;
|
|
-
|
|
|
|
|
|
+
|
|
public class DialogImpl implements DialogConvertViewInterface {
|
|
public class DialogImpl implements DialogConvertViewInterface {
|
|
-
|
|
|
|
|
|
+
|
|
public DialogXBaseRelativeLayout boxRoot;
|
|
public DialogXBaseRelativeLayout boxRoot;
|
|
public MaxRelativeLayout boxCustom;
|
|
public MaxRelativeLayout boxCustom;
|
|
-
|
|
|
|
|
|
+
|
|
public DialogImpl(View convertView) {
|
|
public DialogImpl(View convertView) {
|
|
if (convertView == null) return;
|
|
if (convertView == null) return;
|
|
boxRoot = convertView.findViewById(R.id.box_root);
|
|
boxRoot = convertView.findViewById(R.id.box_root);
|
|
boxCustom = convertView.findViewById(R.id.box_custom);
|
|
boxCustom = convertView.findViewById(R.id.box_custom);
|
|
-
|
|
|
|
|
|
+
|
|
init();
|
|
init();
|
|
dialogImpl = this;
|
|
dialogImpl = this;
|
|
refreshView();
|
|
refreshView();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void init() {
|
|
public void init() {
|
|
if (baseViewLoc == null && baseView != null) {
|
|
if (baseViewLoc == null && baseView != null) {
|
|
baseViewLoc = new int[4];
|
|
baseViewLoc = new int[4];
|
|
baseView.getLocationOnScreen(baseViewLoc);
|
|
baseView.getLocationOnScreen(baseViewLoc);
|
|
|
|
+ baseViewLoc[2] = baseView.getWidth();
|
|
|
|
+ baseViewLoc[3] = baseView.getHeight();
|
|
}
|
|
}
|
|
boxRoot.setParentDialog(me);
|
|
boxRoot.setParentDialog(me);
|
|
boxRoot.setOnLifecycleCallBack(new DialogXBaseRelativeLayout.OnLifecycleCallBack() {
|
|
boxRoot.setOnLifecycleCallBack(new DialogXBaseRelativeLayout.OnLifecycleCallBack() {
|
|
@@ -185,16 +187,16 @@ public class CustomDialog extends BaseDialog {
|
|
public void onShow() {
|
|
public void onShow() {
|
|
isShow = true;
|
|
isShow = true;
|
|
preShow = false;
|
|
preShow = false;
|
|
-
|
|
|
|
|
|
+
|
|
lifecycle.setCurrentState(Lifecycle.State.CREATED);
|
|
lifecycle.setCurrentState(Lifecycle.State.CREATED);
|
|
-
|
|
|
|
|
|
+
|
|
getDialogLifecycleCallback().onShow(me);
|
|
getDialogLifecycleCallback().onShow(me);
|
|
CustomDialog.this.onShow(me);
|
|
CustomDialog.this.onShow(me);
|
|
onDialogShow();
|
|
onDialogShow();
|
|
-
|
|
|
|
|
|
+
|
|
boxCustom.setVisibility(View.GONE);
|
|
boxCustom.setVisibility(View.GONE);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void onDismiss() {
|
|
public void onDismiss() {
|
|
isShow = false;
|
|
isShow = false;
|
|
@@ -206,7 +208,7 @@ public class CustomDialog extends BaseDialog {
|
|
System.gc();
|
|
System.gc();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
-
|
|
|
|
|
|
+
|
|
boxRoot.setOnBackPressedListener(new DialogXBaseRelativeLayout.PrivateBackPressedListener() {
|
|
boxRoot.setOnBackPressedListener(new DialogXBaseRelativeLayout.PrivateBackPressedListener() {
|
|
@Override
|
|
@Override
|
|
public boolean onBackPressed() {
|
|
public boolean onBackPressed() {
|
|
@@ -222,7 +224,7 @@ public class CustomDialog extends BaseDialog {
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
-
|
|
|
|
|
|
+
|
|
boxRoot.post(new Runnable() {
|
|
boxRoot.post(new Runnable() {
|
|
@Override
|
|
@Override
|
|
public void run() {
|
|
public void run() {
|
|
@@ -238,17 +240,17 @@ public class CustomDialog extends BaseDialog {
|
|
if (getDialogImpl().boxCustom != null) {
|
|
if (getDialogImpl().boxCustom != null) {
|
|
getDialogImpl().boxCustom.setVisibility(View.VISIBLE);
|
|
getDialogImpl().boxCustom.setVisibility(View.VISIBLE);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
lifecycle.setCurrentState(Lifecycle.State.RESUMED);
|
|
lifecycle.setCurrentState(Lifecycle.State.RESUMED);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
-
|
|
|
|
|
|
+
|
|
onDialogInit();
|
|
onDialogInit();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
boolean initSetCustomViewLayoutListener = false;
|
|
boolean initSetCustomViewLayoutListener = false;
|
|
ALIGN alignCache;
|
|
ALIGN alignCache;
|
|
-
|
|
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void refreshView() {
|
|
public void refreshView() {
|
|
if (boxRoot == null || getTopActivity() == null) {
|
|
if (boxRoot == null || getTopActivity() == null) {
|
|
@@ -262,7 +264,7 @@ public class CustomDialog extends BaseDialog {
|
|
rlp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
|
rlp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
|
boxCustom.setLayoutParams(rlp);
|
|
boxCustom.setLayoutParams(rlp);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
Runnable onLayoutChangeRunnable = new Runnable() {
|
|
Runnable onLayoutChangeRunnable = new Runnable() {
|
|
@Override
|
|
@Override
|
|
public void run() {
|
|
public void run() {
|
|
@@ -280,7 +282,7 @@ public class CustomDialog extends BaseDialog {
|
|
calX = (baseViewLeft + baseView.getMeasuredWidth() / 2 - boxCustom.getWidth() / 2);
|
|
calX = (baseViewLeft + baseView.getMeasuredWidth() / 2 - boxCustom.getWidth() / 2);
|
|
calY = (baseViewTop + baseView.getMeasuredHeight() / 2 - boxCustom.getHeight() / 2);
|
|
calY = (baseViewTop + baseView.getMeasuredHeight() / 2 - boxCustom.getHeight() / 2);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
if (isAlignBaseViewGravity(Gravity.TOP)) {
|
|
if (isAlignBaseViewGravity(Gravity.TOP)) {
|
|
calY = baseViewTop - boxCustom.getHeight() - marginRelativeBaseView[3];
|
|
calY = baseViewTop - boxCustom.getHeight() - marginRelativeBaseView[3];
|
|
}
|
|
}
|
|
@@ -293,17 +295,19 @@ public class CustomDialog extends BaseDialog {
|
|
if (isAlignBaseViewGravity(Gravity.BOTTOM)) {
|
|
if (isAlignBaseViewGravity(Gravity.BOTTOM)) {
|
|
calY = baseViewTop + baseView.getHeight() + marginRelativeBaseView[1];
|
|
calY = baseViewTop + baseView.getHeight() + marginRelativeBaseView[1];
|
|
}
|
|
}
|
|
- baseViewLoc[2] = width == 0 ? baseView.getWidth() : width;
|
|
|
|
- baseViewLoc[3] = height == 0 ? baseView.getHeight() : height;
|
|
|
|
-
|
|
|
|
- if (calX != 0) boxCustom.setX(calX);
|
|
|
|
- if (calY != 0) boxCustom.setY(calY);
|
|
|
|
-
|
|
|
|
|
|
+ int widthCache = width == 0 ? baseView.getWidth() : width;
|
|
|
|
+ int heightCache = height == 0 ? baseView.getHeight() : height;
|
|
|
|
+ baseViewLoc[2] = widthCache > 0 ? widthCache : baseViewLoc[2];
|
|
|
|
+ baseViewLoc[3] = heightCache > 0 ? heightCache : baseViewLoc[3];
|
|
|
|
+
|
|
|
|
+ if (calX != 0 && calX != boxCustom.getX()) boxCustom.setX(calX);
|
|
|
|
+ if (calY != 0 && calY != boxCustom.getY()) boxCustom.setY(calY);
|
|
|
|
+
|
|
onGetBaseViewLoc(baseViewLoc);
|
|
onGetBaseViewLoc(baseViewLoc);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
-
|
|
|
|
|
|
+
|
|
viewTreeObserver = boxCustom.getViewTreeObserver();
|
|
viewTreeObserver = boxCustom.getViewTreeObserver();
|
|
viewTreeObserver.addOnDrawListener(baseViewDrawListener = new ViewTreeObserver.OnDrawListener() {
|
|
viewTreeObserver.addOnDrawListener(baseViewDrawListener = new ViewTreeObserver.OnDrawListener() {
|
|
@Override
|
|
@Override
|
|
@@ -311,18 +315,15 @@ public class CustomDialog extends BaseDialog {
|
|
int[] baseViewLocCache = new int[2];
|
|
int[] baseViewLocCache = new int[2];
|
|
if (baseView != null) {
|
|
if (baseView != null) {
|
|
baseView.getLocationOnScreen(baseViewLocCache);
|
|
baseView.getLocationOnScreen(baseViewLocCache);
|
|
- if (baseViewLoc == null || baseViewLocCache[0] != baseViewLoc[0] || baseViewLocCache[1] != baseViewLoc[1]) {
|
|
|
|
- baseViewLoc = baseViewLocCache;
|
|
|
|
- if (getDialogImpl() != null) {
|
|
|
|
- onLayoutChangeRunnable.run();
|
|
|
|
- }
|
|
|
|
|
|
+ if (getDialogImpl() != null && isShow) {
|
|
|
|
+ baseViewLoc[0] = baseViewLocCache[0];
|
|
|
|
+ baseViewLoc[1] = baseViewLocCache[1];
|
|
|
|
+ onLayoutChangeRunnable.run();
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- if (viewTreeObserver != null) {
|
|
|
|
- viewTreeObserver.removeOnDrawListener(this);
|
|
|
|
- viewTreeObserver = null;
|
|
|
|
- baseViewDrawListener = null;
|
|
|
|
- }
|
|
|
|
|
|
+ removeDrawListener(viewTreeObserver, this);
|
|
|
|
+ viewTreeObserver = null;
|
|
|
|
+ baseViewDrawListener = null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -393,7 +394,7 @@ public class CustomDialog extends BaseDialog {
|
|
boxCustom.setLayoutParams(rlp);
|
|
boxCustom.setLayoutParams(rlp);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
boxRoot.setAutoUnsafePlacePadding(autoUnsafePlacePadding);
|
|
boxRoot.setAutoUnsafePlacePadding(autoUnsafePlacePadding);
|
|
if (bkgInterceptTouch) {
|
|
if (bkgInterceptTouch) {
|
|
if (isCancelable()) {
|
|
if (isCancelable()) {
|
|
@@ -411,30 +412,30 @@ public class CustomDialog extends BaseDialog {
|
|
} else {
|
|
} else {
|
|
boxRoot.setClickable(false);
|
|
boxRoot.setClickable(false);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
if (onBindView != null && onBindView.getCustomView() != null && boxCustom != null) {
|
|
if (onBindView != null && onBindView.getCustomView() != null && boxCustom != null) {
|
|
onBindView.bindParent(boxCustom, me);
|
|
onBindView.bindParent(boxCustom, me);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
if (boxCustom != null) {
|
|
if (boxCustom != null) {
|
|
if (width != -1) {
|
|
if (width != -1) {
|
|
boxCustom.setMaxWidth(width);
|
|
boxCustom.setMaxWidth(width);
|
|
boxCustom.setMinimumWidth(width);
|
|
boxCustom.setMinimumWidth(width);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
if (height != -1) {
|
|
if (height != -1) {
|
|
boxCustom.setMaxHeight(height);
|
|
boxCustom.setMaxHeight(height);
|
|
boxCustom.setMinimumHeight(height);
|
|
boxCustom.setMinimumHeight(height);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
boxRoot.setBackgroundColor(getMaskColor());
|
|
boxRoot.setBackgroundColor(getMaskColor());
|
|
-
|
|
|
|
|
|
+
|
|
onDialogRefreshUI();
|
|
onDialogRefreshUI();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
long exitAnimDurationTemp = -1;
|
|
long exitAnimDurationTemp = -1;
|
|
-
|
|
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void doDismiss(View v) {
|
|
public void doDismiss(View v) {
|
|
if (v != null) v.setEnabled(false);
|
|
if (v != null) v.setEnabled(false);
|
|
@@ -444,7 +445,7 @@ public class CustomDialog extends BaseDialog {
|
|
@Override
|
|
@Override
|
|
public void run() {
|
|
public void run() {
|
|
getDialogXAnimImpl().doExitAnim(CustomDialog.this, new ObjectRunnable<Float>() {
|
|
getDialogXAnimImpl().doExitAnim(CustomDialog.this, new ObjectRunnable<Float>() {
|
|
-
|
|
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void run(Float animProgress) {
|
|
public void run(Float animProgress) {
|
|
float value = animProgress;
|
|
float value = animProgress;
|
|
@@ -472,7 +473,7 @@ public class CustomDialog extends BaseDialog {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
protected DialogXAnimInterface<CustomDialog> getDialogXAnimImpl() {
|
|
protected DialogXAnimInterface<CustomDialog> getDialogXAnimImpl() {
|
|
if (dialogXAnimImpl == null) {
|
|
if (dialogXAnimImpl == null) {
|
|
dialogXAnimImpl = new DialogXAnimInterface<CustomDialog>() {
|
|
dialogXAnimImpl = new DialogXAnimInterface<CustomDialog>() {
|
|
@@ -486,9 +487,9 @@ public class CustomDialog extends BaseDialog {
|
|
boxCustom.setVisibility(View.VISIBLE);
|
|
boxCustom.setVisibility(View.VISIBLE);
|
|
boxCustom.startAnimation(enterAnim);
|
|
boxCustom.startAnimation(enterAnim);
|
|
}
|
|
}
|
|
-
|
|
|
|
- boxRoot.setBackgroundColor(maskColor);
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ if (maskColor != Color.TRANSPARENT) boxRoot.setBackgroundColor(maskColor);
|
|
|
|
+
|
|
ValueAnimator bkgAlpha = ValueAnimator.ofFloat(0f, 1f);
|
|
ValueAnimator bkgAlpha = ValueAnimator.ofFloat(0f, 1f);
|
|
bkgAlpha.setDuration(enterAnim.getDuration());
|
|
bkgAlpha.setDuration(enterAnim.getDuration());
|
|
bkgAlpha.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
|
bkgAlpha.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
|
@@ -499,7 +500,7 @@ public class CustomDialog extends BaseDialog {
|
|
});
|
|
});
|
|
bkgAlpha.start();
|
|
bkgAlpha.start();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void doExitAnim(CustomDialog customDialog, ObjectRunnable<Float> animProgress) {
|
|
public void doExitAnim(CustomDialog customDialog, ObjectRunnable<Float> animProgress) {
|
|
if (getDialogImpl() == null || getDialogImpl().boxCustom == null) {
|
|
if (getDialogImpl() == null || getDialogImpl().boxCustom == null) {
|
|
@@ -512,7 +513,7 @@ public class CustomDialog extends BaseDialog {
|
|
if (exitAnimResId != 0) {
|
|
if (exitAnimResId != 0) {
|
|
exitAnimResIdTemp = exitAnimResId;
|
|
exitAnimResIdTemp = exitAnimResId;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
if (boxCustom != null) {
|
|
if (boxCustom != null) {
|
|
Animation exitAnim = AnimationUtils.loadAnimation(getTopActivity() == null ? boxCustom.getContext() : getTopActivity(), exitAnimResIdTemp);
|
|
Animation exitAnim = AnimationUtils.loadAnimation(getTopActivity() == null ? boxCustom.getContext() : getTopActivity(), exitAnimResIdTemp);
|
|
exitAnimDurationTemp = exitAnim.getDuration();
|
|
exitAnimDurationTemp = exitAnim.getDuration();
|
|
@@ -525,7 +526,7 @@ public class CustomDialog extends BaseDialog {
|
|
exitAnim.setDuration(exitAnimDurationTemp);
|
|
exitAnim.setDuration(exitAnimDurationTemp);
|
|
boxCustom.startAnimation(exitAnim);
|
|
boxCustom.startAnimation(exitAnim);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
ValueAnimator bkgAlpha = ValueAnimator.ofFloat(1f, 0f);
|
|
ValueAnimator bkgAlpha = ValueAnimator.ofFloat(1f, 0f);
|
|
bkgAlpha.setDuration(exitAnimDurationTemp);
|
|
bkgAlpha.setDuration(exitAnimDurationTemp);
|
|
bkgAlpha.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
|
bkgAlpha.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
|
@@ -541,7 +542,7 @@ public class CustomDialog extends BaseDialog {
|
|
return dialogXAnimImpl;
|
|
return dialogXAnimImpl;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
private void removeDrawListener(ViewTreeObserver viewTreeObserver, ViewTreeObserver.OnDrawListener listener) {
|
|
private void removeDrawListener(ViewTreeObserver viewTreeObserver, ViewTreeObserver.OnDrawListener listener) {
|
|
if (viewTreeObserver == null || listener == null || !viewTreeObserver.isAlive()) {
|
|
if (viewTreeObserver == null || listener == null || !viewTreeObserver.isAlive()) {
|
|
return;
|
|
return;
|
|
@@ -551,7 +552,7 @@ public class CustomDialog extends BaseDialog {
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
private Animation getEnterAnimation() {
|
|
private Animation getEnterAnimation() {
|
|
Animation enterAnim;
|
|
Animation enterAnim;
|
|
if (enterAnimResId == R.anim.anim_dialogx_default_enter &&
|
|
if (enterAnimResId == R.anim.anim_dialogx_default_enter &&
|
|
@@ -609,15 +610,15 @@ public class CustomDialog extends BaseDialog {
|
|
enterAnim.setDuration(enterAnimDurationTemp);
|
|
enterAnim.setDuration(enterAnimDurationTemp);
|
|
return enterAnim;
|
|
return enterAnim;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
protected void onGetBaseViewLoc(int[] baseViewLoc) {
|
|
protected void onGetBaseViewLoc(int[] baseViewLoc) {
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public String dialogKey() {
|
|
public String dialogKey() {
|
|
return getClass().getSimpleName() + "(" + Integer.toHexString(hashCode()) + ")";
|
|
return getClass().getSimpleName() + "(" + Integer.toHexString(hashCode()) + ")";
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public void refreshUI() {
|
|
public void refreshUI() {
|
|
if (getDialogImpl() == null) return;
|
|
if (getDialogImpl() == null) return;
|
|
runOnMain(new Runnable() {
|
|
runOnMain(new Runnable() {
|
|
@@ -627,7 +628,7 @@ public class CustomDialog extends BaseDialog {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public void dismiss() {
|
|
public void dismiss() {
|
|
runOnMain(new Runnable() {
|
|
runOnMain(new Runnable() {
|
|
@Override
|
|
@Override
|
|
@@ -637,38 +638,38 @@ public class CustomDialog extends BaseDialog {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public DialogLifecycleCallback<CustomDialog> getDialogLifecycleCallback() {
|
|
public DialogLifecycleCallback<CustomDialog> getDialogLifecycleCallback() {
|
|
return dialogLifecycleCallback == null ? new DialogLifecycleCallback<CustomDialog>() {
|
|
return dialogLifecycleCallback == null ? new DialogLifecycleCallback<CustomDialog>() {
|
|
} : dialogLifecycleCallback;
|
|
} : dialogLifecycleCallback;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public CustomDialog setDialogLifecycleCallback(DialogLifecycleCallback<CustomDialog> dialogLifecycleCallback) {
|
|
public CustomDialog setDialogLifecycleCallback(DialogLifecycleCallback<CustomDialog> dialogLifecycleCallback) {
|
|
this.dialogLifecycleCallback = dialogLifecycleCallback;
|
|
this.dialogLifecycleCallback = dialogLifecycleCallback;
|
|
if (isShow) dialogLifecycleCallback.onShow(me);
|
|
if (isShow) dialogLifecycleCallback.onShow(me);
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public OnBackPressedListener<CustomDialog> getOnBackPressedListener() {
|
|
public OnBackPressedListener<CustomDialog> getOnBackPressedListener() {
|
|
return (OnBackPressedListener<CustomDialog>) onBackPressedListener;
|
|
return (OnBackPressedListener<CustomDialog>) onBackPressedListener;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public CustomDialog setOnBackPressedListener(OnBackPressedListener<CustomDialog> onBackPressedListener) {
|
|
public CustomDialog setOnBackPressedListener(OnBackPressedListener<CustomDialog> onBackPressedListener) {
|
|
this.onBackPressedListener = onBackPressedListener;
|
|
this.onBackPressedListener = onBackPressedListener;
|
|
refreshUI();
|
|
refreshUI();
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public CustomDialog setStyle(DialogXStyle style) {
|
|
public CustomDialog setStyle(DialogXStyle style) {
|
|
this.style = style;
|
|
this.style = style;
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public CustomDialog setTheme(DialogX.THEME theme) {
|
|
public CustomDialog setTheme(DialogX.THEME theme) {
|
|
this.theme = theme;
|
|
this.theme = theme;
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public boolean isCancelable() {
|
|
public boolean isCancelable() {
|
|
if (privateCancelable != null) {
|
|
if (privateCancelable != null) {
|
|
return privateCancelable == BOOLEAN.TRUE;
|
|
return privateCancelable == BOOLEAN.TRUE;
|
|
@@ -678,112 +679,112 @@ public class CustomDialog extends BaseDialog {
|
|
}
|
|
}
|
|
return cancelable;
|
|
return cancelable;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public CustomDialog setCancelable(boolean cancelable) {
|
|
public CustomDialog setCancelable(boolean cancelable) {
|
|
this.privateCancelable = cancelable ? BOOLEAN.TRUE : BOOLEAN.FALSE;
|
|
this.privateCancelable = cancelable ? BOOLEAN.TRUE : BOOLEAN.FALSE;
|
|
refreshUI();
|
|
refreshUI();
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public CustomDialog.DialogImpl getDialogImpl() {
|
|
public CustomDialog.DialogImpl getDialogImpl() {
|
|
return dialogImpl;
|
|
return dialogImpl;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public CustomDialog setCustomView(OnBindView<CustomDialog> onBindView) {
|
|
public CustomDialog setCustomView(OnBindView<CustomDialog> onBindView) {
|
|
this.onBindView = onBindView;
|
|
this.onBindView = onBindView;
|
|
refreshUI();
|
|
refreshUI();
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public View getCustomView() {
|
|
public View getCustomView() {
|
|
if (onBindView == null) return null;
|
|
if (onBindView == null) return null;
|
|
return onBindView.getCustomView();
|
|
return onBindView.getCustomView();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public CustomDialog removeCustomView() {
|
|
public CustomDialog removeCustomView() {
|
|
this.onBindView.clean();
|
|
this.onBindView.clean();
|
|
refreshUI();
|
|
refreshUI();
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public int getEnterAnimResId() {
|
|
public int getEnterAnimResId() {
|
|
return enterAnimResId;
|
|
return enterAnimResId;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public CustomDialog setEnterAnimResId(int enterAnimResId) {
|
|
public CustomDialog setEnterAnimResId(int enterAnimResId) {
|
|
this.enterAnimResId = enterAnimResId;
|
|
this.enterAnimResId = enterAnimResId;
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public int getExitAnimResId() {
|
|
public int getExitAnimResId() {
|
|
return exitAnimResId;
|
|
return exitAnimResId;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public CustomDialog setExitAnimResId(int exitAnimResId) {
|
|
public CustomDialog setExitAnimResId(int exitAnimResId) {
|
|
this.exitAnimResId = exitAnimResId;
|
|
this.exitAnimResId = exitAnimResId;
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public CustomDialog setAnimResId(int enterAnimResId, int exitAnimResId) {
|
|
public CustomDialog setAnimResId(int enterAnimResId, int exitAnimResId) {
|
|
this.enterAnimResId = enterAnimResId;
|
|
this.enterAnimResId = enterAnimResId;
|
|
this.exitAnimResId = exitAnimResId;
|
|
this.exitAnimResId = exitAnimResId;
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public ALIGN getAlign() {
|
|
public ALIGN getAlign() {
|
|
return align;
|
|
return align;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public CustomDialog setAlign(ALIGN align) {
|
|
public CustomDialog setAlign(ALIGN align) {
|
|
this.align = align;
|
|
this.align = align;
|
|
refreshUI();
|
|
refreshUI();
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public boolean isAutoUnsafePlacePadding() {
|
|
public boolean isAutoUnsafePlacePadding() {
|
|
return autoUnsafePlacePadding;
|
|
return autoUnsafePlacePadding;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public CustomDialog setAutoUnsafePlacePadding(boolean autoUnsafePlacePadding) {
|
|
public CustomDialog setAutoUnsafePlacePadding(boolean autoUnsafePlacePadding) {
|
|
this.autoUnsafePlacePadding = autoUnsafePlacePadding;
|
|
this.autoUnsafePlacePadding = autoUnsafePlacePadding;
|
|
refreshUI();
|
|
refreshUI();
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public CustomDialog setFullScreen(boolean fullscreen) {
|
|
public CustomDialog setFullScreen(boolean fullscreen) {
|
|
this.autoUnsafePlacePadding = !autoUnsafePlacePadding;
|
|
this.autoUnsafePlacePadding = !autoUnsafePlacePadding;
|
|
refreshUI();
|
|
refreshUI();
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public CustomDialog setMaskColor(@ColorInt int maskColor) {
|
|
public CustomDialog setMaskColor(@ColorInt int maskColor) {
|
|
this.maskColor = maskColor;
|
|
this.maskColor = maskColor;
|
|
refreshUI();
|
|
refreshUI();
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public int getMaskColor() {
|
|
public int getMaskColor() {
|
|
return maskColor;
|
|
return maskColor;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public long getEnterAnimDuration() {
|
|
public long getEnterAnimDuration() {
|
|
return enterAnimDuration;
|
|
return enterAnimDuration;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public CustomDialog setEnterAnimDuration(long enterAnimDuration) {
|
|
public CustomDialog setEnterAnimDuration(long enterAnimDuration) {
|
|
this.enterAnimDuration = enterAnimDuration;
|
|
this.enterAnimDuration = enterAnimDuration;
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public long getExitAnimDuration() {
|
|
public long getExitAnimDuration() {
|
|
return exitAnimDuration;
|
|
return exitAnimDuration;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public CustomDialog setExitAnimDuration(long exitAnimDuration) {
|
|
public CustomDialog setExitAnimDuration(long exitAnimDuration) {
|
|
this.exitAnimDuration = exitAnimDuration;
|
|
this.exitAnimDuration = exitAnimDuration;
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void restartDialog() {
|
|
public void restartDialog() {
|
|
if (dialogView != null) {
|
|
if (dialogView != null) {
|
|
@@ -806,16 +807,16 @@ public class CustomDialog extends BaseDialog {
|
|
if (getDialogImpl() != null && getDialogImpl().boxCustom != null) {
|
|
if (getDialogImpl() != null && getDialogImpl().boxCustom != null) {
|
|
getDialogImpl().boxCustom.removeAllViews();
|
|
getDialogImpl().boxCustom.removeAllViews();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
enterAnimDuration = 0;
|
|
enterAnimDuration = 0;
|
|
dialogView = createView(R.layout.layout_dialogx_custom);
|
|
dialogView = createView(R.layout.layout_dialogx_custom);
|
|
dialogImpl = new DialogImpl(dialogView);
|
|
dialogImpl = new DialogImpl(dialogView);
|
|
if (dialogView != null) dialogView.setTag(me);
|
|
if (dialogView != null) dialogView.setTag(me);
|
|
show(dialogView);
|
|
show(dialogView);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
private boolean isHide;
|
|
private boolean isHide;
|
|
-
|
|
|
|
|
|
+
|
|
public void hide() {
|
|
public void hide() {
|
|
isHide = true;
|
|
isHide = true;
|
|
hideWithExitAnim = false;
|
|
hideWithExitAnim = false;
|
|
@@ -823,9 +824,9 @@ public class CustomDialog extends BaseDialog {
|
|
getDialogView().setVisibility(View.GONE);
|
|
getDialogView().setVisibility(View.GONE);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
protected boolean hideWithExitAnim;
|
|
protected boolean hideWithExitAnim;
|
|
-
|
|
|
|
|
|
+
|
|
public void hideWithExitAnim() {
|
|
public void hideWithExitAnim() {
|
|
hideWithExitAnim = true;
|
|
hideWithExitAnim = true;
|
|
isHide = true;
|
|
isHide = true;
|
|
@@ -846,31 +847,31 @@ public class CustomDialog extends BaseDialog {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
protected void shutdown() {
|
|
protected void shutdown() {
|
|
dismiss();
|
|
dismiss();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public CustomDialog setDialogImplMode(DialogX.IMPL_MODE dialogImplMode) {
|
|
public CustomDialog setDialogImplMode(DialogX.IMPL_MODE dialogImplMode) {
|
|
this.dialogImplMode = dialogImplMode;
|
|
this.dialogImplMode = dialogImplMode;
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public boolean isBkgInterceptTouch() {
|
|
public boolean isBkgInterceptTouch() {
|
|
return bkgInterceptTouch;
|
|
return bkgInterceptTouch;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public CustomDialog setBkgInterceptTouch(boolean bkgInterceptTouch) {
|
|
public CustomDialog setBkgInterceptTouch(boolean bkgInterceptTouch) {
|
|
this.bkgInterceptTouch = bkgInterceptTouch;
|
|
this.bkgInterceptTouch = bkgInterceptTouch;
|
|
refreshUI();
|
|
refreshUI();
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public int getAlignBaseViewGravity() {
|
|
public int getAlignBaseViewGravity() {
|
|
return alignViewGravity;
|
|
return alignViewGravity;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 判断是否有设置对应的位置关系
|
|
* 判断是否有设置对应的位置关系
|
|
*
|
|
*
|
|
@@ -880,7 +881,7 @@ public class CustomDialog extends BaseDialog {
|
|
public boolean isAlignBaseViewGravity(int gravity) {
|
|
public boolean isAlignBaseViewGravity(int gravity) {
|
|
return (alignViewGravity & gravity) == gravity;
|
|
return (alignViewGravity & gravity) == gravity;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public CustomDialog setAlignBaseViewGravity(View baseView, int alignGravity) {
|
|
public CustomDialog setAlignBaseViewGravity(View baseView, int alignGravity) {
|
|
this.baseView = baseView;
|
|
this.baseView = baseView;
|
|
this.alignViewGravity = alignGravity;
|
|
this.alignViewGravity = alignGravity;
|
|
@@ -889,7 +890,7 @@ public class CustomDialog extends BaseDialog {
|
|
setFullScreen(true);
|
|
setFullScreen(true);
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public CustomDialog setAlignBaseView(View baseView) {
|
|
public CustomDialog setAlignBaseView(View baseView) {
|
|
this.baseView = baseView;
|
|
this.baseView = baseView;
|
|
baseViewLoc = new int[4];
|
|
baseViewLoc = new int[4];
|
|
@@ -897,7 +898,7 @@ public class CustomDialog extends BaseDialog {
|
|
setFullScreen(true);
|
|
setFullScreen(true);
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public CustomDialog setAlignBaseViewGravity(int alignGravity) {
|
|
public CustomDialog setAlignBaseViewGravity(int alignGravity) {
|
|
this.alignViewGravity = alignGravity;
|
|
this.alignViewGravity = alignGravity;
|
|
if (baseView != null) {
|
|
if (baseView != null) {
|
|
@@ -907,79 +908,79 @@ public class CustomDialog extends BaseDialog {
|
|
setFullScreen(true);
|
|
setFullScreen(true);
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public CustomDialog setAlignBaseViewGravity(View baseView, int alignGravity, int marginLeft,
|
|
public CustomDialog setAlignBaseViewGravity(View baseView, int alignGravity, int marginLeft,
|
|
int marginTop, int marginRight, int marginBottom) {
|
|
int marginTop, int marginRight, int marginBottom) {
|
|
this.marginRelativeBaseView = new int[]{marginLeft, marginTop, marginRight, marginBottom};
|
|
this.marginRelativeBaseView = new int[]{marginLeft, marginTop, marginRight, marginBottom};
|
|
refreshUI();
|
|
refreshUI();
|
|
return setAlignBaseViewGravity(baseView, alignGravity);
|
|
return setAlignBaseViewGravity(baseView, alignGravity);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public int[] getBaseViewMargin() {
|
|
public int[] getBaseViewMargin() {
|
|
return marginRelativeBaseView;
|
|
return marginRelativeBaseView;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public CustomDialog setBaseViewMargin(int[] marginRelativeBaseView) {
|
|
public CustomDialog setBaseViewMargin(int[] marginRelativeBaseView) {
|
|
this.marginRelativeBaseView = marginRelativeBaseView;
|
|
this.marginRelativeBaseView = marginRelativeBaseView;
|
|
refreshUI();
|
|
refreshUI();
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public CustomDialog setBaseViewMargin(int marginLeft, int marginTop,
|
|
public CustomDialog setBaseViewMargin(int marginLeft, int marginTop,
|
|
int marginRight, int marginBottom) {
|
|
int marginRight, int marginBottom) {
|
|
this.marginRelativeBaseView = new int[]{marginLeft, marginTop, marginRight, marginBottom};
|
|
this.marginRelativeBaseView = new int[]{marginLeft, marginTop, marginRight, marginBottom};
|
|
refreshUI();
|
|
refreshUI();
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public CustomDialog setBaseViewMarginLeft(int marginLeft) {
|
|
public CustomDialog setBaseViewMarginLeft(int marginLeft) {
|
|
this.marginRelativeBaseView[0] = marginLeft;
|
|
this.marginRelativeBaseView[0] = marginLeft;
|
|
refreshUI();
|
|
refreshUI();
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public CustomDialog setBaseViewMarginTop(int marginTop) {
|
|
public CustomDialog setBaseViewMarginTop(int marginTop) {
|
|
this.marginRelativeBaseView[1] = marginTop;
|
|
this.marginRelativeBaseView[1] = marginTop;
|
|
refreshUI();
|
|
refreshUI();
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public CustomDialog setBaseViewMarginRight(int marginRight) {
|
|
public CustomDialog setBaseViewMarginRight(int marginRight) {
|
|
this.marginRelativeBaseView[2] = marginRight;
|
|
this.marginRelativeBaseView[2] = marginRight;
|
|
refreshUI();
|
|
refreshUI();
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public CustomDialog setBaseViewMarginBottom(int marginBottom) {
|
|
public CustomDialog setBaseViewMarginBottom(int marginBottom) {
|
|
this.marginRelativeBaseView[3] = marginBottom;
|
|
this.marginRelativeBaseView[3] = marginBottom;
|
|
refreshUI();
|
|
refreshUI();
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public int getBaseViewMarginLeft(int marginLeft) {
|
|
public int getBaseViewMarginLeft(int marginLeft) {
|
|
return this.marginRelativeBaseView[0];
|
|
return this.marginRelativeBaseView[0];
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public int getBaseViewMarginTop(int marginLeft) {
|
|
public int getBaseViewMarginTop(int marginLeft) {
|
|
return this.marginRelativeBaseView[1];
|
|
return this.marginRelativeBaseView[1];
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public int getBaseViewMarginRight(int marginLeft) {
|
|
public int getBaseViewMarginRight(int marginLeft) {
|
|
return this.marginRelativeBaseView[2];
|
|
return this.marginRelativeBaseView[2];
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public int getBaseViewMarginBottom(int marginLeft) {
|
|
public int getBaseViewMarginBottom(int marginLeft) {
|
|
return this.marginRelativeBaseView[3];
|
|
return this.marginRelativeBaseView[3];
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public View getBaseView() {
|
|
public View getBaseView() {
|
|
return baseView;
|
|
return baseView;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public int getWidth() {
|
|
public int getWidth() {
|
|
return width;
|
|
return width;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 设置对话框 UI 宽度(单位:像素)
|
|
* 设置对话框 UI 宽度(单位:像素)
|
|
*
|
|
*
|
|
@@ -991,11 +992,11 @@ public class CustomDialog extends BaseDialog {
|
|
refreshUI();
|
|
refreshUI();
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public int getHeight() {
|
|
public int getHeight() {
|
|
return height;
|
|
return height;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 设置对话框 UI 高度(单位:像素)
|
|
* 设置对话框 UI 高度(单位:像素)
|
|
*
|
|
*
|
|
@@ -1007,37 +1008,37 @@ public class CustomDialog extends BaseDialog {
|
|
refreshUI();
|
|
refreshUI();
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public OnBackgroundMaskClickListener<CustomDialog> getOnBackgroundMaskClickListener() {
|
|
public OnBackgroundMaskClickListener<CustomDialog> getOnBackgroundMaskClickListener() {
|
|
return onBackgroundMaskClickListener;
|
|
return onBackgroundMaskClickListener;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public CustomDialog setOnBackgroundMaskClickListener(OnBackgroundMaskClickListener<CustomDialog> onBackgroundMaskClickListener) {
|
|
public CustomDialog setOnBackgroundMaskClickListener(OnBackgroundMaskClickListener<CustomDialog> onBackgroundMaskClickListener) {
|
|
this.onBackgroundMaskClickListener = onBackgroundMaskClickListener;
|
|
this.onBackgroundMaskClickListener = onBackgroundMaskClickListener;
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public DialogXAnimInterface<CustomDialog> getDialogXAnimImpl() {
|
|
public DialogXAnimInterface<CustomDialog> getDialogXAnimImpl() {
|
|
return dialogXAnimImpl;
|
|
return dialogXAnimImpl;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public CustomDialog setDialogXAnimImpl(DialogXAnimInterface<CustomDialog> dialogXAnimImpl) {
|
|
public CustomDialog setDialogXAnimImpl(DialogXAnimInterface<CustomDialog> dialogXAnimImpl) {
|
|
this.dialogXAnimImpl = dialogXAnimImpl;
|
|
this.dialogXAnimImpl = dialogXAnimImpl;
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public CustomDialog setRootPadding(int padding) {
|
|
public CustomDialog setRootPadding(int padding) {
|
|
this.screenPaddings = new int[]{padding, padding, padding, padding};
|
|
this.screenPaddings = new int[]{padding, padding, padding, padding};
|
|
refreshUI();
|
|
refreshUI();
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public CustomDialog setRootPadding(int paddingLeft, int paddingTop, int paddingRight, int paddingBottom) {
|
|
public CustomDialog setRootPadding(int paddingLeft, int paddingTop, int paddingRight, int paddingBottom) {
|
|
this.screenPaddings = new int[]{paddingLeft, paddingTop, paddingRight, paddingBottom};
|
|
this.screenPaddings = new int[]{paddingLeft, paddingTop, paddingRight, paddingBottom};
|
|
refreshUI();
|
|
refreshUI();
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 用于使用 new 构建实例时,override 的生命周期事件
|
|
* 用于使用 new 构建实例时,override 的生命周期事件
|
|
* 例如:
|
|
* 例如:
|
|
@@ -1050,9 +1051,9 @@ public class CustomDialog extends BaseDialog {
|
|
* }
|
|
* }
|
|
*/
|
|
*/
|
|
public void onShow(CustomDialog dialog) {
|
|
public void onShow(CustomDialog dialog) {
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 用于使用 new 构建实例时,override 的生命周期事件
|
|
* 用于使用 new 构建实例时,override 的生命周期事件
|
|
* 例如:
|
|
* 例如:
|
|
@@ -1074,6 +1075,6 @@ public class CustomDialog extends BaseDialog {
|
|
*/
|
|
*/
|
|
//用于使用 new 构建实例时,override 的生命周期事件
|
|
//用于使用 new 构建实例时,override 的生命周期事件
|
|
public void onDismiss(CustomDialog dialog) {
|
|
public void onDismiss(CustomDialog dialog) {
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|