|
@@ -3,10 +3,13 @@ package com.kongzue.dialogx.dialogs;
|
|
import android.animation.ObjectAnimator;
|
|
import android.animation.ObjectAnimator;
|
|
import android.animation.ValueAnimator;
|
|
import android.animation.ValueAnimator;
|
|
import android.app.Activity;
|
|
import android.app.Activity;
|
|
|
|
+import android.graphics.Outline;
|
|
import android.graphics.Rect;
|
|
import android.graphics.Rect;
|
|
|
|
+import android.graphics.drawable.GradientDrawable;
|
|
import android.os.Handler;
|
|
import android.os.Handler;
|
|
import android.os.Looper;
|
|
import android.os.Looper;
|
|
import android.view.View;
|
|
import android.view.View;
|
|
|
|
+import android.view.ViewOutlineProvider;
|
|
import android.view.animation.DecelerateInterpolator;
|
|
import android.view.animation.DecelerateInterpolator;
|
|
import android.widget.RelativeLayout;
|
|
import android.widget.RelativeLayout;
|
|
|
|
|
|
@@ -45,6 +48,7 @@ public class FullScreenDialog extends BaseDialog {
|
|
protected OnBindView<FullScreenDialog> onBindView;
|
|
protected OnBindView<FullScreenDialog> onBindView;
|
|
protected BOOLEAN privateCancelable;
|
|
protected BOOLEAN privateCancelable;
|
|
protected boolean hideZoomBackground;
|
|
protected boolean hideZoomBackground;
|
|
|
|
+ protected float backgroundRadius = -1;
|
|
|
|
|
|
protected DialogLifecycleCallback<FullScreenDialog> dialogLifecycleCallback;
|
|
protected DialogLifecycleCallback<FullScreenDialog> dialogLifecycleCallback;
|
|
protected OnBackgroundMaskClickListener<FullScreenDialog> onBackgroundMaskClickListener;
|
|
protected OnBackgroundMaskClickListener<FullScreenDialog> onBackgroundMaskClickListener;
|
|
@@ -75,7 +79,7 @@ public class FullScreenDialog extends BaseDialog {
|
|
return fullScreenDialog;
|
|
return fullScreenDialog;
|
|
}
|
|
}
|
|
|
|
|
|
- public void show() {
|
|
|
|
|
|
+ public FullScreenDialog show() {
|
|
super.beforeShow();
|
|
super.beforeShow();
|
|
if (getDialogView() == null) {
|
|
if (getDialogView() == null) {
|
|
dialogView = createView(isLightTheme() ? R.layout.layout_dialogx_fullscreen : R.layout.layout_dialogx_fullscreen_dark);
|
|
dialogView = createView(isLightTheme() ? R.layout.layout_dialogx_fullscreen : R.layout.layout_dialogx_fullscreen_dark);
|
|
@@ -83,6 +87,7 @@ public class FullScreenDialog extends BaseDialog {
|
|
if (dialogView != null) dialogView.setTag(me);
|
|
if (dialogView != null) dialogView.setTag(me);
|
|
}
|
|
}
|
|
show(dialogView);
|
|
show(dialogView);
|
|
|
|
+ return this;
|
|
}
|
|
}
|
|
|
|
|
|
public void show(Activity activity) {
|
|
public void show(Activity activity) {
|
|
@@ -107,12 +112,12 @@ public class FullScreenDialog extends BaseDialog {
|
|
public MaxRelativeLayout bkg;
|
|
public MaxRelativeLayout bkg;
|
|
public RelativeLayout boxCustom;
|
|
public RelativeLayout boxCustom;
|
|
public ScrollController scrollView;
|
|
public ScrollController scrollView;
|
|
-
|
|
|
|
|
|
+
|
|
public DialogImpl setScrollView(ScrollController scrollView) {
|
|
public DialogImpl setScrollView(ScrollController scrollView) {
|
|
this.scrollView = scrollView;
|
|
this.scrollView = scrollView;
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public DialogImpl(View convertView) {
|
|
public DialogImpl(View convertView) {
|
|
if (convertView == null) return;
|
|
if (convertView == null) return;
|
|
imgZoomActivity = convertView.findViewById(R.id.img_zoom_activity);
|
|
imgZoomActivity = convertView.findViewById(R.id.img_zoom_activity);
|
|
@@ -272,6 +277,21 @@ public class FullScreenDialog extends BaseDialog {
|
|
} else {
|
|
} else {
|
|
boxRoot.setOnClickListener(null);
|
|
boxRoot.setOnClickListener(null);
|
|
}
|
|
}
|
|
|
|
+ if (backgroundRadius > -1) {
|
|
|
|
+ GradientDrawable gradientDrawable = (GradientDrawable) bkg.getBackground();
|
|
|
|
+ if (gradientDrawable != null) gradientDrawable.setCornerRadii(new float[]{
|
|
|
|
+ backgroundRadius, backgroundRadius, backgroundRadius, backgroundRadius, 0, 0, 0, 0
|
|
|
|
+ });
|
|
|
|
+ if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
|
|
|
|
+ bkg.setOutlineProvider(new ViewOutlineProvider() {
|
|
|
|
+ @Override
|
|
|
|
+ public void getOutline(View view, Outline outline) {
|
|
|
|
+ outline.setRoundRect(0, 0, view.getWidth(), (int) (view.getHeight() + backgroundRadius), backgroundRadius);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ bkg.setClipToOutline(true);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
if (onBindView != null) {
|
|
if (onBindView != null) {
|
|
onBindView.bindParent(boxCustom, me);
|
|
onBindView.bindParent(boxCustom, me);
|
|
@@ -540,4 +560,14 @@ public class FullScreenDialog extends BaseDialog {
|
|
this.onBackgroundMaskClickListener = onBackgroundMaskClickListener;
|
|
this.onBackgroundMaskClickListener = onBackgroundMaskClickListener;
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public FullScreenDialog setBackgroundRadius(float radiusPx) {
|
|
|
|
+ backgroundRadius = radiusPx;
|
|
|
|
+ refreshUI();
|
|
|
|
+ return this;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public float getBackgroundRadius() {
|
|
|
|
+ return backgroundRadius;
|
|
|
|
+ }
|
|
}
|
|
}
|