|
@@ -4,6 +4,7 @@ import android.animation.ValueAnimator;
|
|
import android.app.Activity;
|
|
import android.app.Activity;
|
|
import android.graphics.Color;
|
|
import android.graphics.Color;
|
|
import android.view.View;
|
|
import android.view.View;
|
|
|
|
+import android.view.ViewGroup;
|
|
import android.view.animation.Animation;
|
|
import android.view.animation.Animation;
|
|
import android.view.animation.AnimationUtils;
|
|
import android.view.animation.AnimationUtils;
|
|
import android.view.animation.DecelerateInterpolator;
|
|
import android.view.animation.DecelerateInterpolator;
|
|
@@ -209,7 +210,7 @@ public class CustomDialog extends BaseDialog {
|
|
maskEnterAnim.setDuration(enterAnimDurationTemp);
|
|
maskEnterAnim.setDuration(enterAnimDurationTemp);
|
|
boxRoot.startAnimation(maskEnterAnim);
|
|
boxRoot.startAnimation(maskEnterAnim);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
ValueAnimator bkgAlpha = ValueAnimator.ofFloat(0f, 1f);
|
|
ValueAnimator bkgAlpha = ValueAnimator.ofFloat(0f, 1f);
|
|
bkgAlpha.setDuration(enterAnimDurationTemp);
|
|
bkgAlpha.setDuration(enterAnimDurationTemp);
|
|
bkgAlpha.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
|
bkgAlpha.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
|
@@ -228,6 +229,9 @@ public class CustomDialog extends BaseDialog {
|
|
public void refreshView() {
|
|
public void refreshView() {
|
|
RelativeLayout.LayoutParams rlp;
|
|
RelativeLayout.LayoutParams rlp;
|
|
rlp = ((RelativeLayout.LayoutParams) boxCustom.getLayoutParams());
|
|
rlp = ((RelativeLayout.LayoutParams) boxCustom.getLayoutParams());
|
|
|
|
+ if (rlp == null) {
|
|
|
|
+ rlp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
|
|
|
+ }
|
|
switch (align) {
|
|
switch (align) {
|
|
case TOP:
|
|
case TOP:
|
|
rlp.removeRule(RelativeLayout.CENTER_IN_PARENT);
|
|
rlp.removeRule(RelativeLayout.CENTER_IN_PARENT);
|
|
@@ -275,7 +279,7 @@ public class CustomDialog extends BaseDialog {
|
|
@Override
|
|
@Override
|
|
public void doDismiss(View v) {
|
|
public void doDismiss(View v) {
|
|
if (v != null) v.setEnabled(false);
|
|
if (v != null) v.setEnabled(false);
|
|
- if (!dismissAnimFlag){
|
|
|
|
|
|
+ if (!dismissAnimFlag) {
|
|
dismissAnimFlag = true;
|
|
dismissAnimFlag = true;
|
|
boxCustom.post(new Runnable() {
|
|
boxCustom.post(new Runnable() {
|
|
@Override
|
|
@Override
|
|
@@ -287,9 +291,9 @@ public class CustomDialog extends BaseDialog {
|
|
if (exitAnimResId != 0) {
|
|
if (exitAnimResId != 0) {
|
|
exitAnimResIdTemp = exitAnimResId;
|
|
exitAnimResIdTemp = exitAnimResId;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
Animation exitAnim = AnimationUtils.loadAnimation(getContext() == null ? boxCustom.getContext() : getContext(), exitAnimResIdTemp);
|
|
Animation exitAnim = AnimationUtils.loadAnimation(getContext() == null ? boxCustom.getContext() : getContext(), exitAnimResIdTemp);
|
|
-
|
|
|
|
|
|
+
|
|
long exitAnimDurationTemp = exitAnim.getDuration();
|
|
long exitAnimDurationTemp = exitAnim.getDuration();
|
|
if (overrideExitDuration >= 0) {
|
|
if (overrideExitDuration >= 0) {
|
|
exitAnimDurationTemp = overrideExitDuration;
|
|
exitAnimDurationTemp = overrideExitDuration;
|
|
@@ -301,28 +305,28 @@ public class CustomDialog extends BaseDialog {
|
|
exitAnim.setAnimationListener(new Animation.AnimationListener() {
|
|
exitAnim.setAnimationListener(new Animation.AnimationListener() {
|
|
@Override
|
|
@Override
|
|
public void onAnimationStart(Animation animation) {
|
|
public void onAnimationStart(Animation animation) {
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void onAnimationEnd(Animation animation) {
|
|
public void onAnimationEnd(Animation animation) {
|
|
dismiss(dialogView);
|
|
dismiss(dialogView);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void onAnimationRepeat(Animation animation) {
|
|
public void onAnimationRepeat(Animation animation) {
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
});
|
|
});
|
|
boxCustom.startAnimation(exitAnim);
|
|
boxCustom.startAnimation(exitAnim);
|
|
-
|
|
|
|
|
|
+
|
|
if (overrideMaskExitAnimRes != 0) {
|
|
if (overrideMaskExitAnimRes != 0) {
|
|
Animation maskExitAnim = AnimationUtils.loadAnimation(getContext(), overrideMaskExitAnimRes);
|
|
Animation maskExitAnim = AnimationUtils.loadAnimation(getContext(), overrideMaskExitAnimRes);
|
|
maskExitAnim.setDuration(exitAnimDurationTemp);
|
|
maskExitAnim.setDuration(exitAnimDurationTemp);
|
|
maskExitAnim.setInterpolator(new DecelerateInterpolator(2f));
|
|
maskExitAnim.setInterpolator(new DecelerateInterpolator(2f));
|
|
boxRoot.startAnimation(maskExitAnim);
|
|
boxRoot.startAnimation(maskExitAnim);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
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() {
|