Browse Source

update style interface & add iOS style BottomMenu.

kongzue 4 years ago
parent
commit
424adcc734
37 changed files with 968 additions and 178 deletions
  1. 0 2
      DialogX/build.gradle
  2. BIN
      DialogX/libs/DialogXInterface.jar
  3. 92 7
      DialogX/src/main/java/com/kongzue/dialogx/dialogs/BottomDialog.java
  4. 7 7
      DialogX/src/main/java/com/kongzue/dialogx/dialogs/BottomMenu.java
  5. 3 3
      DialogX/src/main/java/com/kongzue/dialogx/dialogs/MessageDialog.java
  6. 26 8
      DialogX/src/main/java/com/kongzue/dialogx/style/MaterialStyle.java
  7. 19 0
      DialogX/src/main/java/com/kongzue/dialogx/util/IOSMenuArrayAdapter.java
  8. 22 6
      DialogX/src/main/java/com/kongzue/dialogx/util/NormalMenuArrayAdapter.java
  9. 80 90
      DialogX/src/main/java/com/kongzue/dialogx/util/views/BlurView.java
  10. 1 1
      DialogX/src/main/java/com/kongzue/dialogx/util/views/DialogXBaseRelativeLayout.java
  11. 20 1
      DialogX/src/main/java/com/kongzue/dialogx/util/views/MaxRelativeLayout.java
  12. 56 0
      DialogX/src/main/java/com/kongzue/dialogx/util/views/RoundView.java
  13. 2 2
      DialogX/src/main/res/values/attrs.xml
  14. 1 0
      DialogX/src/main/res/values/colors.xml
  15. BIN
      DialogXIOSStyle/libs/DialogXInterface.jar
  16. 61 2
      DialogXIOSStyle/src/main/java/com/kongzue/dialogx/style/IOSStyle.java
  17. 6 0
      DialogXIOSStyle/src/main/res/drawable/button_dialogx_ios_light.xml
  18. 6 0
      DialogXIOSStyle/src/main/res/drawable/button_dialogx_ios_night.xml
  19. 10 0
      DialogXIOSStyle/src/main/res/drawable/rect_dialogx_ios_light.xml
  20. 10 0
      DialogXIOSStyle/src/main/res/drawable/rect_dialogx_ios_menu_split_divider.xml
  21. 10 0
      DialogXIOSStyle/src/main/res/drawable/rect_dialogx_ios_menu_split_divider_night.xml
  22. 10 0
      DialogXIOSStyle/src/main/res/drawable/rect_dialogx_ios_night.xml
  23. 34 0
      DialogXIOSStyle/src/main/res/layout/item_dialogx_ios_bottom_menu_bottom_dark.xml
  24. 34 0
      DialogXIOSStyle/src/main/res/layout/item_dialogx_ios_bottom_menu_bottom_light.xml
  25. 34 0
      DialogXIOSStyle/src/main/res/layout/item_dialogx_ios_bottom_menu_center_dark.xml
  26. 34 0
      DialogXIOSStyle/src/main/res/layout/item_dialogx_ios_bottom_menu_center_light.xml
  27. 34 0
      DialogXIOSStyle/src/main/res/layout/item_dialogx_ios_bottom_menu_top_dark.xml
  28. 34 0
      DialogXIOSStyle/src/main/res/layout/item_dialogx_ios_bottom_menu_top_light.xml
  29. 129 0
      DialogXIOSStyle/src/main/res/layout/layout_dialogx_bottom_ios.xml
  30. 129 0
      DialogXIOSStyle/src/main/res/layout/layout_dialogx_bottom_ios_dark.xml
  31. 7 3
      DialogXIOSStyle/src/main/res/values/colors.xml
  32. 7 3
      DialogXInterface/src/main/java/com/kongzue/dialogx/interfaces/DialogXStyle.java
  33. BIN
      DialogXKongzueStyle/libs/DialogXInterface.jar
  34. 1 1
      DialogXKongzueStyle/src/main/java/com/kongzue/dialogx/style/KongzueStyle.java
  35. BIN
      DialogXMIUIStyle/libs/DialogXInterface.jar
  36. 1 1
      DialogXMIUIStyle/src/main/java/com/kongzue/dialogx/style/MIUIStyle.java
  37. 48 41
      app/src/main/java/com/kongzue/dialogxdemo/MainActivity.java

+ 0 - 2
DialogX/build.gradle

@@ -27,6 +27,4 @@ dependencies {
     implementation fileTree(dir: "libs", include: ["*.jar"])
     implementation 'androidx.appcompat:appcompat:1.2.0+'
     api files('libs\\DialogXInterface.jar')
-    implementation files('libs\\DialogXInterface.jar')
-    implementation files('libs\\DialogXInterface.jar')
 }

BIN
DialogX/libs/DialogXInterface.jar


+ 92 - 7
DialogX/src/main/java/com/kongzue/dialogx/dialogs/BottomDialog.java

@@ -24,6 +24,7 @@ import com.kongzue.dialogx.interfaces.OnBackPressedListener;
 import com.kongzue.dialogx.interfaces.OnBindView;
 import com.kongzue.dialogx.interfaces.OnMenuItemClickListener;
 import com.kongzue.dialogx.util.BottomDialogTouchEventInterceptor;
+import com.kongzue.dialogx.util.views.BlurView;
 import com.kongzue.dialogx.util.views.DialogXBaseRelativeLayout;
 import com.kongzue.dialogx.util.views.MaxRelativeLayout;
 
@@ -39,9 +40,15 @@ public class BottomDialog extends BaseDialog {
     protected OnBindView<BottomDialog> onBindView;
     protected CharSequence title;
     protected CharSequence message;
-    protected CharSequence cancelText;
+    protected CharSequence cancelText = "取消";
     protected boolean allowInterceptTouch = true;
     
+    /**
+     * 此值用于,当禁用滑动时(style.overrideBottomDialogRes.touchSlide = false时)的最大显示高度。
+     * 0:不限制,最大显示到屏幕可用高度。
+     */
+    protected float bottomDialogMaxHeight = 0.6f;
+    
     protected DialogLifecycleCallback<BottomDialog> dialogLifecycleCallback;
     
     protected BottomDialog me = this;
@@ -120,23 +127,33 @@ public class BottomDialog extends BaseDialog {
         public DialogXBaseRelativeLayout boxRoot;
         public RelativeLayout boxBkg;
         public MaxRelativeLayout bkg;
+        public ViewGroup boxBody;
         public ImageView imgTab;
         public TextView txtDialogTitle;
         public ScrollView scrollView;
         public LinearLayout boxContent;
         public TextView txtDialogTip;
+        public View imgSplit;
         public RelativeLayout boxCustom;
+        public BlurView blurView;
+        public ViewGroup boxCancel;
+        public TextView btnCancel;
         
         public DialogImpl(View convertView) {
             boxRoot = convertView.findViewById(R.id.box_root);
             boxBkg = convertView.findViewById(R.id.box_bkg);
             bkg = convertView.findViewById(R.id.bkg);
+            boxBody = convertView.findViewWithTag("body");
             imgTab = convertView.findViewById(R.id.img_tab);
             txtDialogTitle = convertView.findViewById(R.id.txt_dialog_title);
             scrollView = convertView.findViewById(R.id.scrollView);
             boxContent = convertView.findViewById(R.id.box_content);
             txtDialogTip = convertView.findViewById(R.id.txt_dialog_tip);
+            imgSplit = convertView.findViewWithTag("split");
             boxCustom = convertView.findViewById(R.id.box_custom);
+            blurView = convertView.findViewById(R.id.blurView);
+            boxCancel = convertView.findViewWithTag("cancelBox");
+            btnCancel = convertView.findViewWithTag("cancel");
             init();
             refreshView();
         }
@@ -167,6 +184,29 @@ public class BottomDialog extends BaseDialog {
                     onDialogInit(dialogImpl);
                     
                     if (onBindView != null) onBindView.onBind(me, onBindView.getCustomView());
+                    
+                    if (style.messageDialogBlurSettings() != null && style.messageDialogBlurSettings().blurBackground() && boxBody != null && boxCancel != null) {
+                        int blurFrontColor = getResources().getColor(style.messageDialogBlurSettings().blurForwardColorRes(isLightTheme()));
+                        blurView = new BlurView(bkg.getContext(), null);
+                        RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(bkg.getWidth(), bkg.getHeight());
+                        blurView.setOverlayColor(blurFrontColor);
+                        blurView.setTag("blurView");
+                        blurView.setRadiusPx(style.messageDialogBlurSettings().blurBackgroundRoundRadiusPx());
+                        boxBody.addView(blurView, 0, params);
+                        
+                        BlurView cancelBlurView = new BlurView(boxCancel.getContext(), null);
+                        RelativeLayout.LayoutParams cancelButtonLp = new RelativeLayout.LayoutParams(boxCancel.getWidth(), boxCancel.getHeight());
+                        cancelBlurView.setOverlayColor(blurFrontColor);
+                        cancelBlurView.setTag("blurView");
+                        cancelBlurView.setUseBlur(false);
+                        cancelBlurView.setRadiusPx(style.messageDialogBlurSettings().blurBackgroundRoundRadiusPx());
+                        boxCancel.addView(cancelBlurView, 0, cancelButtonLp);
+                        
+                        int cancelButtonDrawable = style.overrideBottomDialogRes().overrideMenuCancelButtonBackgroundRes(isLightTheme());
+                        if (cancelButtonDrawable != 0) {
+                            btnCancel.setBackgroundResource(cancelButtonDrawable);
+                        }
+                    }
                 }
                 
                 @Override
@@ -176,6 +216,26 @@ public class BottomDialog extends BaseDialog {
                 }
             });
             
+            if (btnCancel != null) {
+                btnCancel.setOnClickListener(new View.OnClickListener() {
+                    @Override
+                    public void onClick(View v) {
+                        dismiss();
+                    }
+                });
+            }
+            
+            if (imgSplit != null) {
+                int dividerRes = style.overrideBottomDialogRes().overrideMenuDividerDrawableRes(isLightTheme());
+                int dividerHeight = style.overrideBottomDialogRes().overrideMenuDividerHeight(isLightTheme());
+                if (dividerRes != 0) imgSplit.setBackgroundResource(dividerRes);
+                if (dividerHeight != 0) {
+                    ViewGroup.LayoutParams lp = imgSplit.getLayoutParams();
+                    lp.height = dividerHeight;
+                    imgSplit.setLayoutParams(lp);
+                }
+            }
+            
             boxRoot.setOnBackPressedListener(new OnBackPressedListener() {
                 @Override
                 public boolean onBackPressed() {
@@ -196,15 +256,20 @@ public class BottomDialog extends BaseDialog {
                 @Override
                 public void run() {
                     bkg.setY(boxBkg.getHeight());
-                    if (bkg.isChildScrollViewCanScroll()) {
-                        bkgEnterAimY = boxBkg.getHeight() - bkg.getHeight() * 0.6f;
+                    if (bkg.isChildScrollViewCanScroll() && bottomDialogMaxHeight != 0) {
+                        if (bottomDialogMaxHeight <= 1) {
+                            bkgEnterAimY = boxBkg.getHeight() - bkg.getHeight() * bottomDialogMaxHeight;
+                        } else {
+                            bkgEnterAimY = boxBkg.getHeight() - bottomDialogMaxHeight;
+                        }
                     } else {
                         bkgEnterAimY = boxBkg.getHeight() - bkg.getHeight();
                     }
                     ObjectAnimator enterAnim = ObjectAnimator.ofFloat(bkg, "y", boxBkg.getHeight(), bkgEnterAimY);
-                    enterAnim.setDuration(300);
+                    enterAnim.setInterpolator(new DecelerateInterpolator(2f));
+                    enterAnim.setDuration(500);
                     enterAnim.start();
-                    boxRoot.animate().setDuration(enterAnim.getDuration()).alpha(1f).setInterpolator(new DecelerateInterpolator()).setDuration(300).setListener(null);
+                    boxRoot.animate().setDuration(enterAnim.getDuration()).alpha(1f).setInterpolator(new DecelerateInterpolator()).setDuration(100).setListener(null);
                 }
             });
         }
@@ -214,8 +279,12 @@ public class BottomDialog extends BaseDialog {
             public void onGlobalLayout() {
                 if (boxContent != null) {
                     float oldY = bkgEnterAimY;
-                    if (bkg.isChildScrollViewCanScroll()) {
-                        bkgEnterAimY = boxBkg.getHeight() - bkg.getHeight() * 0.6f;
+                    if (bkg.isChildScrollViewCanScroll() && bottomDialogMaxHeight != 0) {
+                        if (bottomDialogMaxHeight <= 1) {
+                            bkgEnterAimY = boxBkg.getHeight() - bkg.getHeight() * bottomDialogMaxHeight;
+                        } else {
+                            bkgEnterAimY = boxBkg.getHeight() - bottomDialogMaxHeight;
+                        }
                     } else {
                         bkgEnterAimY = boxBkg.getHeight() - bkg.getHeight();
                     }
@@ -264,6 +333,22 @@ public class BottomDialog extends BaseDialog {
             }
             
             bottomDialogTouchEventInterceptor.refresh(me, this);
+            
+            if (imgSplit != null) {
+                if (txtDialogTitle.getVisibility() == View.VISIBLE || txtDialogTip.getVisibility() == View.VISIBLE) {
+                    imgSplit.setVisibility(View.VISIBLE);
+                } else {
+                    imgSplit.setVisibility(View.GONE);
+                }
+            }
+            
+            if (boxCancel != null) {
+                if (isNull(cancelText)) {
+                    boxCancel.setVisibility(View.GONE);
+                } else {
+                    boxCancel.setVisibility(View.VISIBLE);
+                }
+            }
         }
         
         @Override

+ 7 - 7
DialogX/src/main/java/com/kongzue/dialogx/dialogs/BottomMenu.java

@@ -35,11 +35,6 @@ public class BottomMenu extends BottomDialog {
     protected BottomMenu me = this;
     
     protected OnMenuItemClickListener<BottomMenu> onMenuItemClickListener;
-    /**
-     * 此值用于,当禁用滑动时(style.overrideBottomDialogRes.touchSlide = false时)的最大显示高度。
-     * 0:不限制,最大显示到屏幕可用高度。
-     */
-    protected float bottomDialogMaxHeight = 0.6f;
     
     public static BottomMenu build() {
         return new BottomMenu();
@@ -47,7 +42,7 @@ public class BottomMenu extends BottomDialog {
     
     protected BottomMenu() {
         super();
-        if (style.overrideBottomDialogRes()!=null && style.overrideBottomDialogRes().overrideBottomDialogMaxHeight() != 0) {
+        if (style.overrideBottomDialogRes() != null) {
             bottomDialogMaxHeight = style.overrideBottomDialogRes().overrideBottomDialogMaxHeight();
         }
         if (bottomDialogMaxHeight <= 1 && bottomDialogMaxHeight > 0f) {
@@ -123,6 +118,11 @@ public class BottomMenu extends BottomDialog {
                     }
                 }
             });
+            if (style.overrideBottomDialogRes() != null) {
+                if (style.overrideBottomDialogRes().overrideMenuItemLayout(true, 0, 1) != 0) {
+                    listView.setSelector(R.color.empty);
+                }
+            }
             
             RelativeLayout.LayoutParams listViewLp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
             dialog.boxCustom.addView(listView, listViewLp);
@@ -136,7 +136,7 @@ public class BottomMenu extends BottomDialog {
         super.refreshUI();
         if (listView != null) {
             if (menuListAdapter == null) {
-                menuListAdapter = new NormalMenuArrayAdapter(me, getContext(), R.layout.item_dialogx_material_bottom_menu_normal_text, menuList);
+                menuListAdapter = new NormalMenuArrayAdapter(me, getContext(), menuList);
             }
             if (listView.getAdapter() == null) {
                 listView.setAdapter(menuListAdapter);

+ 3 - 3
DialogX/src/main/java/com/kongzue/dialogx/dialogs/MessageDialog.java

@@ -185,17 +185,17 @@ public class MessageDialog extends BaseDialog {
                     
                     getDialogLifecycleCallback().onShow(me);
                     
-                    if (style.blurSettings() != null && style.blurSettings().blurBackground()) {
+                    if (style.messageDialogBlurSettings() != null && style.messageDialogBlurSettings().blurBackground()) {
                         bkg.post(new Runnable() {
                             @Override
                             public void run() {
-                                int blurFrontColor = getResources().getColor(style.blurSettings().blurForwardColorRes(isLightTheme()));
+                                int blurFrontColor = getResources().getColor(style.messageDialogBlurSettings().blurForwardColorRes(isLightTheme()));
                                 blurView = new BlurView(bkg.getContext(), null);
                                 RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(bkg.getWidth(), bkg.getHeight());
                                 params.addRule(RelativeLayout.CENTER_IN_PARENT);
                                 blurView.setOverlayColor(blurFrontColor);
                                 blurView.setTag("blurView");
-                                blurView.setRadiusPx(style.blurSettings().blurBackgroundRoundRadiusPx());
+                                blurView.setRadiusPx(style.messageDialogBlurSettings().blurBackgroundRoundRadiusPx());
                                 bkg.addView(blurView, 0, params);
                             }
                         });

+ 26 - 8
DialogX/src/main/java/com/kongzue/dialogx/style/MaterialStyle.java

@@ -1,5 +1,7 @@
 package com.kongzue.dialogx.style;
 
+import android.content.res.Resources;
+
 import com.kongzue.dialogx.R;
 import com.kongzue.dialogx.interfaces.DialogXStyle;
 
@@ -53,9 +55,9 @@ public class MaterialStyle implements DialogXStyle {
     public int splitColorRes(boolean light) {
         return 0;
     }
-    
+
     @Override
-    public BlurBackgroundSetting blurSettings() {
+    public BlurBackgroundSetting messageDialogBlurSettings() {
         return null;
     }
     
@@ -118,40 +120,56 @@ public class MaterialStyle implements DialogXStyle {
             }
         };
     }
-    
+
     @Override
     public BottomDialogRes overrideBottomDialogRes() {
         return new BottomDialogRes() {
+
             @Override
             public boolean touchSlide() {
                 return true;
             }
-            
+
             @Override
             public int overrideDialogLayout(boolean light) {
                 return light ? R.layout.layout_dialogx_bottom_material : R.layout.layout_dialogx_bottom_material_dark;
             }
-            
+
             @Override
             public int overrideMenuDividerDrawableRes(boolean light) {
                 return light ? R.drawable.rect_dialogx_material_menu_split_divider : R.drawable.rect_dialogx_material_menu_split_divider_night;
             }
-            
+
             @Override
             public int overrideMenuDividerHeight(boolean light) {
                 return 1;
             }
-    
+
             @Override
             public int overrideMenuTextColor(boolean light) {
                 return light?R.color.black90:R.color.white90;
             }
-    
+
             @Override
             public float overrideBottomDialogMaxHeight() {
                 return 0.6f;
             }
     
+            @Override
+            public int overrideMenuCancelButtonBackgroundRes(boolean b) {
+                return 0;
+            }
+    
+            @Override
+            public int overrideMenuItemLayout(boolean b, int i, int i1) {
+                return R.layout.item_dialogx_material_bottom_menu_normal_text;
+            }
+    
         };
     }
+    
+    private int dip2px(float dpValue) {
+        final float scale = Resources.getSystem().getDisplayMetrics().density;
+        return (int) (dpValue * scale + 0.5f);
+    }
 }

+ 19 - 0
DialogX/src/main/java/com/kongzue/dialogx/util/IOSMenuArrayAdapter.java

@@ -0,0 +1,19 @@
+package com.kongzue.dialogx.util;
+
+import android.content.Context;
+import android.widget.ArrayAdapter;
+
+import androidx.annotation.NonNull;
+
+/**
+ * @author: Kongzue
+ * @github: https://github.com/kongzue/
+ * @homepage: http://kongzue.com/
+ * @mail: myzcxhh@live.cn
+ * @createTime: 2020/10/10 19:56
+ */
+public class IOSMenuArrayAdapter extends ArrayAdapter<CharSequence> {
+    public IOSMenuArrayAdapter(@NonNull Context context, int resource) {
+        super(context, resource);
+    }
+}

+ 22 - 6
DialogX/src/main/java/com/kongzue/dialogx/util/NormalMenuArrayAdapter.java

@@ -6,7 +6,9 @@ import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.ArrayAdapter;
+import android.widget.BaseAdapter;
 import android.widget.ImageView;
+import android.widget.SimpleAdapter;
 import android.widget.TextView;
 
 import com.kongzue.dialogx.R;
@@ -21,17 +23,14 @@ import java.util.List;
  * @mail: myzcxhh@live.cn
  * @createTime: 2020/10/7 0:00
  */
-public class NormalMenuArrayAdapter extends ArrayAdapter<CharSequence> {
+public class NormalMenuArrayAdapter extends BaseAdapter {
     
     private BottomMenu bottomMenu;
-    public int resoureId;
     public List<CharSequence> objects;
     public Context context;
     
-    public NormalMenuArrayAdapter(BottomMenu bottomMenu, Context context, int resourceId, List<CharSequence> objects) {
-        super(context, resourceId, objects);
+    public NormalMenuArrayAdapter(BottomMenu bottomMenu, Context context, List<CharSequence> objects) {
         this.objects = objects;
-        this.resoureId = resourceId;
         this.context = context;
         this.bottomMenu = bottomMenu;
     }
@@ -62,7 +61,24 @@ public class NormalMenuArrayAdapter extends ArrayAdapter<CharSequence> {
         if (convertView == null) {
             viewHolder = new ViewHolder();
             LayoutInflater mInflater = LayoutInflater.from(context);
-            convertView = mInflater.inflate(resoureId, null);
+            
+            int resourceId = R.layout.item_dialogx_material_bottom_menu_normal_text;
+            if (bottomMenu.getStyle().overrideBottomDialogRes() != null) {
+                resourceId = bottomMenu.getStyle().overrideBottomDialogRes().overrideMenuItemLayout(bottomMenu.isLightTheme(), position, getCount());
+                if (resourceId == 0) {
+                    resourceId = R.layout.item_dialogx_material_bottom_menu_normal_text;
+                } else {
+                    if (bottomMenu.getDialogImpl().txtDialogTitle.getVisibility() == View.VISIBLE ||
+                            bottomMenu.getDialogImpl().txtDialogTip.getVisibility() == View.VISIBLE||
+                            bottomMenu.getCustomView()!=null) {
+                        if (position == 0) {
+                            //有显示 title、tip 或自定义布局时第一个 item 按钮显示为 center 部分的样式
+                            resourceId = bottomMenu.getStyle().overrideBottomDialogRes().overrideMenuItemLayout(bottomMenu.isLightTheme(), 1, getCount() + 1);
+                        }
+                    }
+                }
+            }
+            convertView = mInflater.inflate(resourceId, null);
             
             viewHolder.imgDialogxMenuIcon = convertView.findViewById(R.id.img_dialogx_menu_icon);
             viewHolder.txtDialogxMenuText = convertView.findViewById(R.id.txt_dialogx_menu_text);

+ 80 - 90
DialogX/src/main/java/com/kongzue/dialogx/util/views/BlurView.java

@@ -5,13 +5,16 @@ import android.content.Context;
 import android.content.ContextWrapper;
 import android.content.res.TypedArray;
 import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
 import android.graphics.Canvas;
 import android.graphics.Color;
 import android.graphics.Paint;
+import android.graphics.Path;
 import android.graphics.PorterDuff;
 import android.graphics.PorterDuffXfermode;
 import android.graphics.Rect;
 import android.graphics.RectF;
+import android.graphics.Xfermode;
 import android.util.AttributeSet;
 import android.util.Log;
 import android.util.TypedValue;
@@ -19,6 +22,7 @@ import android.view.View;
 import android.view.ViewTreeObserver;
 
 import androidx.annotation.ColorInt;
+import androidx.annotation.Nullable;
 import androidx.renderscript.Allocation;
 import androidx.renderscript.Element;
 import androidx.renderscript.RenderScript;
@@ -29,9 +33,12 @@ import com.kongzue.dialogx.R;
 import com.kongzue.dialogx.interfaces.BaseDialog;
 
 public class BlurView extends View {
-    private float mDownsampleFactor; // default 4
-    private int mOverlayColor; // default #aaffffff
-    private float mBlurRadius; // default 10dp (0 < r <= 25)
+    private float mDownsampleFactor = 4;
+    private int mOverlayColor = Color.WHITE;
+    private float mBlurRadius = 35;
+    
+    private float mRadius = 0;
+    private Path mBoundPath = null;
     
     private boolean mDirty;
     private Bitmap mBitmapToBlur, mBlurredBitmap;
@@ -50,8 +57,6 @@ public class BlurView extends View {
     
     private Paint mPaint;
     private RectF mRectF;
-    private float mXRadius;
-    private float mYRadius;
     
     private Bitmap mRoundBitmap;
     private Canvas mTmpCanvas;
@@ -59,45 +64,62 @@ public class BlurView extends View {
     public BlurView(Context context, AttributeSet attrs) {
         super(context, attrs);
         
-        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RealtimeBlurView);
-        mBlurRadius = a.getDimension(
-                R.styleable.RealtimeBlurView_realtimeBlurRadius,
-                TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 35, context.getResources().getDisplayMetrics())
-        );
-        mDownsampleFactor = a.getFloat(R.styleable.RealtimeBlurView_realtimeDownsampleFactor, 4);
-        mOverlayColor = a.getColor(R.styleable.RealtimeBlurView_realtimeOverlayColor, 0x00ffffff);
+        init(context, attrs);
+    }
+    
+    public BlurView(Context context) {
+        super(context);
         
-        //ready rounded corner
-        mPaint = new Paint();
-        mPaint.setAntiAlias(true);
-        mRectF = new RectF();
+        init(context, null);
+    }
+    
+    public BlurView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
         
-        mXRadius = a.getDimension(R.styleable.RealtimeBlurView_xRadius, TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 15, context.getResources().getDisplayMetrics()));
-        mYRadius = a.getDimension(R.styleable.RealtimeBlurView_yRadius, TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 15, context.getResources().getDisplayMetrics()));
-        a.recycle();
+        init(context, attrs);
     }
     
-    public void setBlurRadius(float radius) {
-        if (mBlurRadius != radius) {
-            mBlurRadius = radius;
-            mDirty = true;
-            invalidate();
+    public BlurView(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+        super(context, attrs, defStyleAttr, defStyleRes);
+        
+        init(context, attrs);
+    }
+    
+    private boolean isInit = false;
+    
+    private void init(Context context, AttributeSet attrs) {
+        if (!isInit) {
+            TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RealtimeBlurView);
+            mBlurRadius = a.getDimension(
+                    R.styleable.RealtimeBlurView_realtimeBlurRadius,
+                    TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 35, context.getResources().getDisplayMetrics())
+            );
+            mDownsampleFactor = a.getFloat(R.styleable.RealtimeBlurView_realtimeDownsampleFactor, 4);
+            mOverlayColor = a.getColor(R.styleable.RealtimeBlurView_realtimeOverlayColor, 0x00ffffff);
+            
+            //ready rounded corner
+            mPaint = new Paint();
+            mPaint.setAntiAlias(true);
+            mRectF = new RectF();
+            
+            mRadius = a.getDimension(R.styleable.RealtimeBlurView_radius, TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 15, context.getResources().getDisplayMetrics()));
+            a.recycle();
+            
+            isInit = true;
         }
     }
     
-    public void setRadius(float x, float y) {
-        if (mXRadius != x || mYRadius != y) {
-            mXRadius = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, x, getContext().getResources().getDisplayMetrics());
-            mYRadius = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, y, getContext().getResources().getDisplayMetrics());
+    public void setBlurRadius(float radius) {
+        if (mBlurRadius != radius) {
+            mBlurRadius = radius;
             mDirty = true;
             invalidate();
         }
     }
     
     public void setRadiusPx(float r) {
-        if (mXRadius != r || mYRadius != r) {
-            mXRadius = r;
-            mYRadius = r;
+        if (mRadius != r) {
+            mRadius = r;
             mDirty = true;
             invalidate();
         }
@@ -240,7 +262,6 @@ public class BlurView extends View {
     private final ViewTreeObserver.OnPreDrawListener preDrawListener = new ViewTreeObserver.OnPreDrawListener() {
         @Override
         public boolean onPreDraw() {
-            clean();
             final int[] locations = new int[2];
             Bitmap oldBmp = mBlurredBitmap;
             View decor = mDecorView;
@@ -278,7 +299,6 @@ public class BlurView extends View {
                 
                 blur(mBitmapToBlur, mBlurredBitmap);
                 
-                cleanFlag = false;
                 if (redrawBitmap || mDifferentRoot) {
                     invalidate();
                 }
@@ -288,29 +308,21 @@ public class BlurView extends View {
         }
     };
     
-    protected View getActivityDecorView() {
-        Context ctx = getContext();
-        for (int i = 0; i < 4 && ctx != null && !(ctx instanceof Activity) && ctx instanceof ContextWrapper; i++) {
-            ctx = ((ContextWrapper) ctx).getBaseContext();
-        }
-        if (ctx instanceof Activity) {
-            return ((Activity) ctx).getWindow().getDecorView();
-        } else {
-            return null;
-        }
-    }
-    
     @Override
     protected void onAttachedToWindow() {
         super.onAttachedToWindow();
-        mDecorView = ((Activity) BaseDialog.getContext()).getWindow().getDecorView();
+        if (BaseDialog.getRootFrameLayout() != null && BaseDialog.getRootFrameLayout().getChildCount() >= 1) {
+            mDecorView = BaseDialog.getRootFrameLayout().getChildAt(0);
+        }
         if (mDecorView != null) {
+            log("mDecorView is ok.");
             mDecorView.getViewTreeObserver().addOnPreDrawListener(preDrawListener);
             mDifferentRoot = mDecorView.getRootView() != getRootView();
             if (mDifferentRoot) {
                 mDecorView.postInvalidate();
             }
         } else {
+            log("mDecorView is NULL.");
             mDifferentRoot = false;
         }
     }
@@ -332,7 +344,7 @@ public class BlurView extends View {
             cutPaint.setColor(removeAlphaColor(mOverlayColor));
             mRectF.right = getWidth();
             mRectF.bottom = getHeight();
-            canvas.drawRoundRect(mRectF, mXRadius, mYRadius, cutPaint);
+            canvas.drawRoundRect(mRectF, mRadius, mRadius, cutPaint);
         } else {
             if (mIsRendering) {
                 // Quit here, don't draw views above me
@@ -340,27 +352,29 @@ public class BlurView extends View {
             } else if (RENDERING_COUNT > 0) {
                 // Doesn't support blurview overlap on another blurview
             } else {
+                if (mRadius != 0) {
+                    Rect rect = new Rect();
+                    getLocalVisibleRect(rect);
+                    mBoundPath = caculateRoundRectPath(rect);
+                    canvas.clipPath(mBoundPath);
+                }
                 super.draw(canvas);
             }
         }
-        
     }
     
-    private boolean cleanFlag = false;
-    
-    private void clean() {
-        cleanFlag = true;
-        invalidate();
+    private Path caculateRoundRectPath(Rect r) {
+        Path path = new Path();
+        float radius = mRadius;
+        float elevation = 0;
+        path.addRoundRect(new RectF(r.left + elevation, r.top + elevation, r.right - elevation, r.bottom - elevation), radius, radius, Path.Direction.CW);
+        return path;
     }
     
     @Override
     protected void onDraw(Canvas canvas) {
         super.onDraw(canvas);
-        if (cleanFlag) {
-            canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
-        } else {
-            drawBlurredBitmap(canvas, mBlurredBitmap, mOverlayColor);
-        }
+        drawBlurredBitmap(canvas, mBlurredBitmap, mOverlayColor);
     }
     
     /**
@@ -371,38 +385,14 @@ public class BlurView extends View {
      * @param overlayColor
      */
     protected void drawBlurredBitmap(Canvas canvas, Bitmap blurredBitmap, int overlayColor) {
-        if (getWidth() > 0 && getHeight() > 0) {
-            Bitmap output = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);
-            Canvas cacheCanvas = new Canvas(output);
-            if (blurredBitmap != null) {
-                mRectSrc.right = blurredBitmap.getWidth();
-                mRectSrc.bottom = blurredBitmap.getHeight();
-                mRectDst.right = getWidth();
-                mRectDst.bottom = getHeight();
-                cacheCanvas.drawBitmap(blurredBitmap, mRectSrc, mRectDst, null);
-            }
-            cacheCanvas.drawColor((supportRenderScript && useBlur) ? overlayColor : removeAlphaColor(overlayColor));
-            
-            //Rounded corner
-            mRectF.right = getWidth();
-            mRectF.bottom = getHeight();
-            
-            mRoundBitmap = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);
-            mTmpCanvas = new Canvas(mRoundBitmap);
-            Paint cutPaint = new Paint();
-            cutPaint.setAntiAlias(true);
-            cutPaint.setColor(Color.WHITE);
-            mTmpCanvas.drawRoundRect(mRectF, mXRadius, mYRadius, cutPaint);
-            
-            mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
-            if (mRoundBitmap != null && !mRoundBitmap.isRecycled()) {
-                cacheCanvas.drawBitmap(mRoundBitmap, 0, 0, mPaint);
-            }
-            canvas.drawBitmap(output, 0, 0, null);
+        if (blurredBitmap != null) {
+            mRectSrc.right = blurredBitmap.getWidth();
+            mRectSrc.bottom = blurredBitmap.getHeight();
+            mRectDst.right = getWidth();
+            mRectDst.bottom = getHeight();
+            canvas.drawBitmap(blurredBitmap, mRectSrc, mRectDst, null);
         }
-    }
-    
-    private static class StopException extends RuntimeException {
+        canvas.drawColor((supportRenderScript && useBlur) ? overlayColor : removeAlphaColor(overlayColor));
     }
     
     private static boolean supportRenderScript = false;
@@ -445,7 +435,7 @@ public class BlurView extends View {
         }.start();
     }
     
-    private static boolean DEBUGMODE = false;
+    private static boolean DEBUGMODE = true;
     
     static boolean isDebug() {
         return DEBUGMODE && DialogX.DEBUGMODE;

+ 1 - 1
DialogX/src/main/java/com/kongzue/dialogx/util/views/DialogXBaseRelativeLayout.java

@@ -161,7 +161,7 @@ public class DialogXBaseRelativeLayout extends RelativeLayout {
     
     private void paddingView(int left, int top, int right, int bottom) {
         MaxRelativeLayout bkgView = findViewById(R.id.bkg);
-        if (bkgView != null) {
+        if (bkgView != null &&  bkgView.getLayoutParams() instanceof LayoutParams) {
             LayoutParams bkgLp = (LayoutParams) bkgView.getLayoutParams();
             if (bkgLp.getRules()[ALIGN_PARENT_BOTTOM] == RelativeLayout.TRUE) {
                 bkgView.setPadding(0, 0, 0, bottom);

+ 20 - 1
DialogX/src/main/java/com/kongzue/dialogx/util/views/MaxRelativeLayout.java

@@ -22,6 +22,7 @@ public class MaxRelativeLayout extends RelativeLayout {
     
     private int maxWidth;
     private int maxHeight;
+    private boolean lockWidth;
     
     public MaxRelativeLayout(Context context) {
         super(context);
@@ -43,6 +44,7 @@ public class MaxRelativeLayout extends RelativeLayout {
             TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MaxRelativeLayout);
             maxWidth = a.getDimensionPixelSize(R.styleable.MaxRelativeLayout_maxLayoutWidth, 0);
             maxHeight = a.getDimensionPixelSize(R.styleable.MaxRelativeLayout_maxLayoutHeight, 0);
+            lockWidth = a.getBoolean(R.styleable.MaxRelativeLayout_lockWidth, false);
             
             a.recycle();
         }
@@ -60,6 +62,8 @@ public class MaxRelativeLayout extends RelativeLayout {
         return this;
     }
     
+    private int preWidth = -1;
+    
     @Override
     protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
         int heightMode = MeasureSpec.getMode(heightMeasureSpec);
@@ -68,6 +72,12 @@ public class MaxRelativeLayout extends RelativeLayout {
         int heightSize = MeasureSpec.getSize(heightMeasureSpec);
         int widthSize = MeasureSpec.getSize(widthMeasureSpec);
         
+        if (preWidth == -1 && widthSize != 0) {
+            preWidth = widthSize;
+        }
+        if (lockWidth) {
+            maxWidth = Math.min(widthSize, preWidth);
+        }
         if (maxHeight > 0) {
             heightSize = Math.min(heightSize, maxHeight);
         }
@@ -134,7 +144,7 @@ public class MaxRelativeLayout extends RelativeLayout {
     
     public boolean isChildScrollViewCanScroll() {
         if (childScrollView == null) return false;
-        if (!childScrollView.isEnabled()){
+        if (!childScrollView.isEnabled()) {
             return false;
         }
         View child = childScrollView.getChildAt(0);
@@ -156,4 +166,13 @@ public class MaxRelativeLayout extends RelativeLayout {
         final float scale = getResources().getDisplayMetrics().density;
         return (int) (dpValue * scale + 0.5f);
     }
+    
+    public boolean isLockWidth() {
+        return lockWidth;
+    }
+    
+    public MaxRelativeLayout setLockWidth(boolean lockWidth) {
+        this.lockWidth = lockWidth;
+        return this;
+    }
 }

+ 56 - 0
DialogX/src/main/java/com/kongzue/dialogx/util/views/RoundView.java

@@ -0,0 +1,56 @@
+package com.kongzue.dialogx.util.views;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Path;
+import android.graphics.Rect;
+import android.graphics.RectF;
+import android.util.AttributeSet;
+import android.widget.RelativeLayout;
+
+public class RoundView extends RelativeLayout {
+    
+    private float mRadius = 0;
+    private Path mBoundPath = null;
+    
+    public RoundView(Context context) {
+        this(context, null);
+    }
+    
+    public RoundView(Context context, AttributeSet attrs) {
+        this(context, attrs, 0);
+    }
+    
+    public RoundView(Context context, AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+        setWillNotDraw(false);
+        mRadius = 50;
+    }
+    
+    public void setRadius(float radius) {
+        if (mRadius == radius)
+            return;
+        this.mRadius = radius;
+        postInvalidate();
+    }
+    
+    public float getRadius() {
+        return mRadius;
+    }
+    
+    public void draw(Canvas canvas) {
+        Rect rect = new Rect();
+        getLocalVisibleRect(rect);
+        mBoundPath = caculateRoundRectPath(rect);
+        canvas.clipPath(mBoundPath);
+        super.draw(canvas);
+    }
+    
+    private Path caculateRoundRectPath(Rect r) {
+        Path path = new Path();
+        float radius = getRadius();
+        float elevation = 0;
+        path.addRoundRect(new RectF(r.left + elevation, r.top + elevation, r.right - elevation, r.bottom - elevation), radius, radius, Path.Direction.CW);
+        return path;
+    }
+}

+ 2 - 2
DialogX/src/main/res/values/attrs.xml

@@ -4,14 +4,14 @@
     <declare-styleable name="MaxRelativeLayout">
         <attr name="maxLayoutWidth" format="dimension"/>
         <attr name="maxLayoutHeight" format="dimension"/>
+        <attr name="lockWidth" format="boolean"/>
     </declare-styleable>
 
     <declare-styleable name="RealtimeBlurView">
         <attr name="realtimeBlurRadius" format="dimension"/>
         <attr name="realtimeDownsampleFactor" format="float"/>
         <attr name="realtimeOverlayColor" format="color"/>
-        <attr name="xRadius" format="dimension"/>
-        <attr name="yRadius" format="dimension"/>
+        <attr name="radius" format="dimension"/>
     </declare-styleable>
 
     <declare-styleable name="ProgressView">

+ 1 - 0
DialogX/src/main/res/values/colors.xml

@@ -33,4 +33,5 @@
     <color name="dialogxMaterialDarkDialogBkgColor">#343434</color>
     <color name="dialogxWaitBkgLight">#CCF4F5F6</color>
     <color name="dialogxWaitBkgDark">#D1161616</color>
+
 </resources>

BIN
DialogXIOSStyle/libs/DialogXInterface.jar


+ 61 - 2
DialogXIOSStyle/src/main/java/com/kongzue/dialogx/style/IOSStyle.java

@@ -59,7 +59,7 @@ public class IOSStyle implements DialogXStyle {
     }
     
     @Override
-    public BlurBackgroundSetting blurSettings() {
+    public BlurBackgroundSetting messageDialogBlurSettings() {
         return new BlurBackgroundSetting() {
             @Override
             public boolean blurBackground() {
@@ -149,6 +149,65 @@ public class IOSStyle implements DialogXStyle {
     
     @Override
     public BottomDialogRes overrideBottomDialogRes() {
-        return null;
+        return new BottomDialogRes() {
+            
+            @Override
+            public boolean touchSlide() {
+                return false;
+            }
+            
+            @Override
+            public int overrideDialogLayout(boolean light) {
+                //return light ? R.layout.layout_dialogx_bottom_material : R.layout.layout_dialogx_bottom_material_dark;
+                return light ? R.layout.layout_dialogx_bottom_ios : R.layout.layout_dialogx_bottom_ios_dark;
+            }
+            
+            @Override
+            public int overrideMenuDividerDrawableRes(boolean light) {
+                return light ? R.drawable.rect_dialogx_ios_menu_split_divider : R.drawable.rect_dialogx_ios_menu_split_divider_night;
+            }
+            
+            @Override
+            public int overrideMenuDividerHeight(boolean light) {
+                return 1;
+            }
+            
+            @Override
+            public int overrideMenuTextColor(boolean light) {
+                return light ? R.color.dialogxIOSBlue : R.color.dialogxIOSBlueDark;
+            }
+            
+            @Override
+            public float overrideBottomDialogMaxHeight() {
+                return 0f;
+            }
+            
+            @Override
+            public int overrideMenuCancelButtonBackgroundRes(boolean light) {
+                return light ? R.drawable.button_dialogx_ios_light : R.drawable.button_dialogx_ios_night;
+            }
+            
+            @Override
+            public int overrideMenuItemLayout(boolean light, int index, int count) {
+                if (light) {
+                    if (index == 0) {
+                        return R.layout.item_dialogx_ios_bottom_menu_top_light;
+                    } else if (index == count - 1) {
+                        return R.layout.item_dialogx_ios_bottom_menu_bottom_light;
+                    } else {
+                        return R.layout.item_dialogx_ios_bottom_menu_center_light;
+                    }
+                } else {
+                    if (index == 0) {
+                        return R.layout.item_dialogx_ios_bottom_menu_top_dark;
+                    } else if (index == count - 1) {
+                        return R.layout.item_dialogx_ios_bottom_menu_bottom_dark;
+                    } else {
+                        return R.layout.item_dialogx_ios_bottom_menu_center_dark;
+                    }
+                }
+            }
+            
+        };
     }
 }

+ 6 - 0
DialogXIOSStyle/src/main/res/drawable/button_dialogx_ios_light.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_pressed="true" android:drawable="@drawable/rect_dialogx_ios_light" />
+    <item android:state_focused="true" android:drawable="@color/empty" />
+    <item android:drawable="@color/empty"/>
+</selector>

+ 6 - 0
DialogXIOSStyle/src/main/res/drawable/button_dialogx_ios_night.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_pressed="true" android:drawable="@drawable/rect_dialogx_ios_night" />
+    <item android:state_focused="true" android:drawable="@color/empty" />
+    <item android:drawable="@color/empty"/>
+</selector>

+ 10 - 0
DialogXIOSStyle/src/main/res/drawable/rect_dialogx_ios_light.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+
+    <solid android:color="@color/dialogxButtonIOSLightPress"/>
+
+    <corners
+        android:radius="15dp"/>
+
+</shape>

+ 10 - 0
DialogXIOSStyle/src/main/res/drawable/rect_dialogx_ios_menu_split_divider.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
+
+    <item>
+        <shape android:shape="rectangle" >
+            <solid android:color="@color/dialogxIOSSplitLight" />
+        </shape>
+    </item>
+
+</layer-list>

+ 10 - 0
DialogXIOSStyle/src/main/res/drawable/rect_dialogx_ios_menu_split_divider_night.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
+
+    <item>
+        <shape android:shape="rectangle" >
+            <solid android:color="@color/dialogxIOSSplitDark" />
+        </shape>
+    </item>
+
+</layer-list>

+ 10 - 0
DialogXIOSStyle/src/main/res/drawable/rect_dialogx_ios_night.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+
+    <solid android:color="@color/white10"/>
+
+    <corners
+        android:radius="15dp"/>
+
+</shape>

+ 34 - 0
DialogXIOSStyle/src/main/res/layout/item_dialogx_ios_bottom_menu_bottom_dark.xml

@@ -0,0 +1,34 @@
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:background="@drawable/button_dialogx_ios_bottom_night">
+
+    <RelativeLayout
+        android:layout_width="match_parent"
+        android:layout_height="55dp"
+        android:paddingLeft="20dp"
+        android:paddingRight="20dp">
+
+        <ImageView
+            android:id="@+id/img_dialogx_menu_icon"
+            android:layout_width="35dp"
+            android:layout_height="35dp"
+            android:layout_centerVertical="true"
+            android:layout_marginLeft="-5dp"
+            android:layout_marginRight="10dp"
+            android:padding="5dp" />
+
+        <TextView
+            android:id="@+id/txt_dialogx_menu_text"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_centerInParent="true"
+            android:gravity="center"
+            android:singleLine="true"
+            android:text="asdadasda"
+            android:textColor="@color/dialogxIOSBlue"
+            android:textSize="19dp" />
+
+    </RelativeLayout>
+
+</RelativeLayout>

+ 34 - 0
DialogXIOSStyle/src/main/res/layout/item_dialogx_ios_bottom_menu_bottom_light.xml

@@ -0,0 +1,34 @@
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:background="@drawable/button_dialogx_ios_bottom_light">
+
+    <RelativeLayout
+        android:layout_width="match_parent"
+        android:layout_height="55dp"
+        android:paddingLeft="20dp"
+        android:paddingRight="20dp">
+
+        <ImageView
+            android:id="@+id/img_dialogx_menu_icon"
+            android:layout_width="35dp"
+            android:layout_height="35dp"
+            android:layout_centerVertical="true"
+            android:layout_marginLeft="-5dp"
+            android:layout_marginRight="10dp"
+            android:padding="5dp" />
+
+        <TextView
+            android:id="@+id/txt_dialogx_menu_text"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_centerInParent="true"
+            android:gravity="center"
+            android:singleLine="true"
+            android:text="asdadasda"
+            android:textColor="@color/dialogxIOSBlue"
+            android:textSize="19dp" />
+
+    </RelativeLayout>
+
+</RelativeLayout>

+ 34 - 0
DialogXIOSStyle/src/main/res/layout/item_dialogx_ios_bottom_menu_center_dark.xml

@@ -0,0 +1,34 @@
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:background="@drawable/button_dialogx_ios_center_night">
+
+    <RelativeLayout
+        android:layout_width="match_parent"
+        android:layout_height="55dp"
+        android:paddingLeft="20dp"
+        android:paddingRight="20dp">
+
+        <ImageView
+            android:id="@+id/img_dialogx_menu_icon"
+            android:layout_width="35dp"
+            android:layout_height="35dp"
+            android:layout_centerVertical="true"
+            android:layout_marginRight="10dp"
+            android:layout_marginLeft="-5dp"
+            android:padding="5dp"/>
+
+        <TextView
+            android:id="@+id/txt_dialogx_menu_text"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_centerInParent="true"
+            android:gravity="center"
+            android:textColor="@color/dialogxIOSBlue"
+            android:singleLine="true"
+            android:text="asdadasda"
+            android:textSize="19dp" />
+
+    </RelativeLayout>
+
+</RelativeLayout>

+ 34 - 0
DialogXIOSStyle/src/main/res/layout/item_dialogx_ios_bottom_menu_center_light.xml

@@ -0,0 +1,34 @@
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:background="@drawable/button_dialogx_ios_center_light">
+
+    <RelativeLayout
+        android:layout_width="match_parent"
+        android:layout_height="55dp"
+        android:paddingLeft="20dp"
+        android:paddingRight="20dp">
+
+        <ImageView
+            android:id="@+id/img_dialogx_menu_icon"
+            android:layout_width="35dp"
+            android:layout_height="35dp"
+            android:layout_centerVertical="true"
+            android:layout_marginRight="10dp"
+            android:layout_marginLeft="-5dp"
+            android:padding="5dp"/>
+
+        <TextView
+            android:id="@+id/txt_dialogx_menu_text"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_centerInParent="true"
+            android:gravity="center"
+            android:textColor="@color/dialogxIOSBlue"
+            android:singleLine="true"
+            android:text="asdadasda"
+            android:textSize="19dp" />
+
+    </RelativeLayout>
+
+</RelativeLayout>

+ 34 - 0
DialogXIOSStyle/src/main/res/layout/item_dialogx_ios_bottom_menu_top_dark.xml

@@ -0,0 +1,34 @@
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:background="@drawable/button_dialogx_ios_top_night">
+
+    <RelativeLayout
+        android:layout_width="match_parent"
+        android:layout_height="55dp"
+        android:paddingLeft="20dp"
+        android:paddingRight="20dp">
+
+        <ImageView
+            android:id="@+id/img_dialogx_menu_icon"
+            android:layout_width="35dp"
+            android:layout_height="35dp"
+            android:layout_centerVertical="true"
+            android:layout_marginRight="10dp"
+            android:layout_marginLeft="-5dp"
+            android:padding="5dp"/>
+
+        <TextView
+            android:id="@+id/txt_dialogx_menu_text"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_centerInParent="true"
+            android:gravity="center"
+            android:textColor="@color/dialogxIOSBlue"
+            android:singleLine="true"
+            android:text="asdadasda"
+            android:textSize="19dp" />
+
+    </RelativeLayout>
+
+</RelativeLayout>

+ 34 - 0
DialogXIOSStyle/src/main/res/layout/item_dialogx_ios_bottom_menu_top_light.xml

@@ -0,0 +1,34 @@
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:background="@drawable/button_dialogx_ios_top_light">
+
+    <RelativeLayout
+        android:layout_width="match_parent"
+        android:layout_height="55dp"
+        android:paddingLeft="20dp"
+        android:paddingRight="20dp">
+
+        <ImageView
+            android:id="@+id/img_dialogx_menu_icon"
+            android:layout_width="35dp"
+            android:layout_height="35dp"
+            android:layout_centerVertical="true"
+            android:layout_marginRight="10dp"
+            android:layout_marginLeft="-5dp"
+            android:padding="5dp"/>
+
+        <TextView
+            android:id="@+id/txt_dialogx_menu_text"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_centerInParent="true"
+            android:gravity="center"
+            android:textColor="@color/dialogxIOSBlue"
+            android:singleLine="true"
+            android:text="asdadasda"
+            android:textSize="19dp" />
+
+    </RelativeLayout>
+
+</RelativeLayout>

+ 129 - 0
DialogXIOSStyle/src/main/res/layout/layout_dialogx_bottom_ios.xml

@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="utf-8"?>
+<com.kongzue.dialogx.util.views.DialogXBaseRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:id="@+id/box_root"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="@color/black30"
+    android:orientation="vertical">
+
+    <RelativeLayout
+        android:id="@+id/box_bkg"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_weight="1">
+
+        <com.kongzue.dialogx.util.views.MaxRelativeLayout
+            android:id="@+id/bkg"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignParentBottom="true"
+            android:layout_marginHorizontal="10dp"
+            android:focusableInTouchMode="true"
+            app:lockWidth="true">
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="vertical">
+
+                <com.kongzue.dialogx.util.views.MaxRelativeLayout
+                    android:tag="body"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="1">
+
+                    <LinearLayout
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:clickable="true"
+                        android:orientation="vertical">
+
+                        <TextView
+                            android:id="@+id/txt_dialog_title"
+                            android:layout_width="match_parent"
+                            android:layout_height="wrap_content"
+                            android:layout_gravity="center_horizontal"
+                            android:gravity="center_horizontal"
+                            android:paddingHorizontal="20dp"
+                            android:paddingTop="13dp"
+                            android:text="Title"
+                            android:textColor="@color/dialogxIOSTipTextLight"
+                            android:textSize="12dp"
+                            android:textStyle="bold" />
+
+                        <ScrollView
+                            android:id="@+id/scrollView"
+                            android:layout_width="match_parent"
+                            android:layout_height="wrap_content"
+                            android:layout_weight="1"
+                            android:overScrollMode="never"
+                            android:scrollbarSize="7dp"
+                            android:scrollbarThumbVertical="@drawable/scrollbar_dialogx_vertical"
+                            android:scrollbars="vertical">
+
+                            <LinearLayout
+                                android:id="@+id/box_content"
+                                android:layout_width="match_parent"
+                                android:layout_height="wrap_content"
+                                android:orientation="vertical">
+
+                                <TextView
+                                    android:id="@+id/txt_dialog_tip"
+                                    android:layout_width="match_parent"
+                                    android:layout_height="wrap_content"
+                                    android:layout_marginHorizontal="20dp"
+                                    android:gravity="center_horizontal"
+                                    android:paddingVertical="13dp"
+                                    android:text="This is content text."
+                                    android:textColor="@color/dialogxIOSTipTextLight"
+                                    android:textSize="12dp" />
+
+                                <ImageView
+                                    android:tag="split"
+                                    android:layout_width="match_parent"
+                                    android:layout_height="1px"
+                                    android:visibility="gone" />
+
+                                <RelativeLayout
+                                    android:id="@+id/box_custom"
+                                    android:layout_width="match_parent"
+                                    android:layout_height="wrap_content" />
+
+                            </LinearLayout>
+
+                        </ScrollView>
+
+                    </LinearLayout>
+
+                </com.kongzue.dialogx.util.views.MaxRelativeLayout>
+
+                <com.kongzue.dialogx.util.views.MaxRelativeLayout
+                    android:tag="cancelBox"
+                    android:layout_width="match_parent"
+                    android:layout_height="53dp"
+                    android:layout_marginTop="7dp"
+                    android:layout_marginBottom="10dp">
+
+                    <TextView
+                        android:tag="cancel"
+                        android:layout_width="match_parent"
+                        android:layout_height="match_parent"
+                        android:gravity="center"
+                        android:paddingLeft="15dp"
+                        android:paddingRight="15dp"
+                        android:singleLine="true"
+                        android:text="取消"
+                        android:textColor="@color/dialogxIOSBlue"
+                        android:textSize="19dp"
+                        android:textStyle="bold" />
+
+                </com.kongzue.dialogx.util.views.MaxRelativeLayout>
+
+            </LinearLayout>
+
+        </com.kongzue.dialogx.util.views.MaxRelativeLayout>
+
+    </RelativeLayout>
+
+</com.kongzue.dialogx.util.views.DialogXBaseRelativeLayout>

+ 129 - 0
DialogXIOSStyle/src/main/res/layout/layout_dialogx_bottom_ios_dark.xml

@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="utf-8"?>
+<com.kongzue.dialogx.util.views.DialogXBaseRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:id="@+id/box_root"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="@color/black50"
+    android:orientation="vertical">
+
+    <RelativeLayout
+        android:id="@+id/box_bkg"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_weight="1">
+
+        <com.kongzue.dialogx.util.views.MaxRelativeLayout
+            android:id="@+id/bkg"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignParentBottom="true"
+            android:layout_marginHorizontal="10dp"
+            android:focusableInTouchMode="true"
+            app:lockWidth="true">
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="vertical">
+
+                <com.kongzue.dialogx.util.views.MaxRelativeLayout
+                    android:tag="body"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="1">
+
+                    <LinearLayout
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:clickable="true"
+                        android:orientation="vertical">
+
+                        <TextView
+                            android:id="@+id/txt_dialog_title"
+                            android:layout_width="match_parent"
+                            android:layout_height="wrap_content"
+                            android:layout_gravity="center_horizontal"
+                            android:gravity="center"
+                            android:paddingHorizontal="20dp"
+                            android:paddingTop="13dp"
+                            android:text="Title"
+                            android:textColor="@color/dialogxIOSTipTextDark"
+                            android:textSize="12dp"
+                            android:textStyle="bold"/>
+
+                        <ScrollView
+                            android:id="@+id/scrollView"
+                            android:layout_width="match_parent"
+                            android:layout_height="wrap_content"
+                            android:layout_weight="1"
+                            android:scrollbarThumbVertical="@drawable/scrollbar_dialogx_vertical_dark"
+                            android:overScrollMode="never"
+                            android:scrollbarSize="7dp"
+                            android:scrollbars="vertical">
+
+                            <LinearLayout
+                                android:id="@+id/box_content"
+                                android:layout_width="match_parent"
+                                android:layout_height="wrap_content"
+                                android:orientation="vertical">
+
+                                <TextView
+                                    android:id="@+id/txt_dialog_tip"
+                                    android:layout_width="match_parent"
+                                    android:layout_height="wrap_content"
+                                    android:layout_marginHorizontal="20dp"
+                                    android:gravity="center"
+                                    android:paddingVertical="13dp"
+                                    android:textColor="@color/dialogxIOSTipTextDark"
+                                    android:textSize="12dp"
+                                    android:text="This is content text." />
+
+                                <ImageView
+                                    android:tag="split"
+                                    android:layout_width="match_parent"
+                                    android:layout_height="1px"
+                                    android:visibility="gone" />
+
+                                <RelativeLayout
+                                    android:id="@+id/box_custom"
+                                    android:layout_width="match_parent"
+                                    android:layout_height="wrap_content" />
+
+                            </LinearLayout>
+
+                        </ScrollView>
+
+                    </LinearLayout>
+
+                </com.kongzue.dialogx.util.views.MaxRelativeLayout>
+
+                <com.kongzue.dialogx.util.views.MaxRelativeLayout
+                    android:tag="cancelBox"
+                    android:layout_width="match_parent"
+                    android:layout_height="53dp"
+                    android:layout_marginTop="7dp"
+                    android:layout_marginBottom="10dp">
+
+                    <TextView
+                        android:tag="cancel"
+                        android:layout_width="match_parent"
+                        android:layout_height="match_parent"
+                        android:gravity="center"
+                        android:paddingLeft="15dp"
+                        android:paddingRight="15dp"
+                        android:singleLine="true"
+                        android:textColor="@color/dialogxIOSBlueDark"
+                        android:text="取消"
+                        android:textSize="19dp"
+                        android:textStyle="bold" />
+
+                </com.kongzue.dialogx.util.views.MaxRelativeLayout>
+
+            </LinearLayout>
+
+        </com.kongzue.dialogx.util.views.MaxRelativeLayout>
+
+    </RelativeLayout>
+
+</com.kongzue.dialogx.util.views.DialogXBaseRelativeLayout>

+ 7 - 3
DialogXIOSStyle/src/main/res/values/colors.xml

@@ -32,10 +32,14 @@
 
     <color name="dialogxColorBlue">#2196F3</color>
 
+    <color name="dialogxButtonIOSLightPress">#0f000000</color>
+
     <color name="dialogxIOSSplitLight">#2c000000</color>
-    <color name="dialogxIOSSplitDark">#4e4e50</color>
+    <color name="dialogxIOSSplitDark">#99777878</color>
     <color name="dialogxIOSBlue">#007aff</color>
-    <color name="dialogxButtonIOSLightPress">#0f000000</color>
     <color name="dialogxIOSBkgLight">#CCF4F5F6</color>
-    <color name="dialogxIOSBkgDark">#D1161616</color>
+    <color name="dialogxIOSBkgDark">#E62C2C2D</color>
+    <color name="dialogxIOSTipTextLight">#8f8f8f</color>
+    <color name="dialogxIOSTipTextDark">#9AA8B9</color>
+    <color name="dialogxIOSBlueDark">#8AB4F8</color>
 </resources>

+ 7 - 3
DialogXInterface/src/main/java/com/kongzue/dialogx/interfaces/DialogXStyle.java

@@ -24,7 +24,7 @@ public interface DialogXStyle {
     
     int splitColorRes(boolean light);
     
-    BlurBackgroundSetting blurSettings();
+    BlurBackgroundSetting messageDialogBlurSettings();
     
     HorizontalButtonRes overrideHorizontalButtonRes();
     
@@ -77,11 +77,15 @@ public interface DialogXStyle {
         int overrideDialogLayout(boolean light);
         
         int overrideMenuDividerDrawableRes(boolean light);
-    
+        
         int overrideMenuDividerHeight(boolean light);
-    
+        
         int overrideMenuTextColor(boolean light);
         
         float overrideBottomDialogMaxHeight();
+        
+        int overrideMenuCancelButtonBackgroundRes(boolean light);
+        
+        int overrideMenuItemLayout(boolean light, int index, int count);
     }
 }

BIN
DialogXKongzueStyle/libs/DialogXInterface.jar


+ 1 - 1
DialogXKongzueStyle/src/main/java/com/kongzue/dialogx/style/KongzueStyle.java

@@ -55,7 +55,7 @@ public class KongzueStyle implements DialogXStyle {
     }
     
     @Override
-    public BlurBackgroundSetting blurSettings() {
+    public BlurBackgroundSetting messageDialogBlurSettings() {
         return null;
     }
     

BIN
DialogXMIUIStyle/libs/DialogXInterface.jar


+ 1 - 1
DialogXMIUIStyle/src/main/java/com/kongzue/dialogx/style/MIUIStyle.java

@@ -55,7 +55,7 @@ public class MIUIStyle implements DialogXStyle {
     }
     
     @Override
-    public BlurBackgroundSetting blurSettings() {
+    public BlurBackgroundSetting messageDialogBlurSettings() {
         return null;
     }
     

+ 48 - 41
app/src/main/java/com/kongzue/dialogxdemo/MainActivity.java

@@ -307,48 +307,55 @@ public class MainActivity extends BaseActivity {
         btnBottomMenu.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
-                BottomMenu.show(new String[]{"添加", "查看", "编辑", "删除", "分享", "评论", "下载", "收藏", "赞!", "不喜欢", "所属专辑", "复制链接", "类似推荐", "添加", "查看", "编辑", "删除", "分享", "评论", "下载", "收藏", "赞!", "不喜欢", "所属专辑", "复制链接", "类似推荐"})
-                        .setOnIconChangeCallBack(new OnIconChangeCallBack(true) {
-                            @Override
-                            public int getIcon(BottomMenu bottomMenu, int index, String menuText) {
-                                switch (menuText) {
-                                    case "添加":
-                                        return R.mipmap.img_dialogx_demo_add;
-                                    case "查看":
-                                        return R.mipmap.img_dialogx_demo_view;
-                                    case "编辑":
-                                        return R.mipmap.img_dialogx_demo_edit;
-                                    case "删除":
-                                        return R.mipmap.img_dialogx_demo_delete;
-                                    case "分享":
-                                        return R.mipmap.img_dialogx_demo_share;
-                                    case "评论":
-                                        return R.mipmap.img_dialogx_demo_comment;
-                                    case "下载":
-                                        return R.mipmap.img_dialogx_demo_download;
-                                    case "收藏":
-                                        return R.mipmap.img_dialogx_demo_favorite;
-                                    case "赞!":
-                                        return R.mipmap.img_dialogx_demo_good;
-                                    case "不喜欢":
-                                        return R.mipmap.img_dialogx_demo_dislike;
-                                    case "所属专辑":
-                                        return R.mipmap.img_dialogx_demo_album;
-                                    case "复制链接":
-                                        return R.mipmap.img_dialogx_demo_link;
-                                    case "类似推荐":
-                                        return R.mipmap.img_dialogx_demo_recommend;
+                if (rdoMaterial.isChecked()) {
+                    //Material 可滑动展开 BottomMenu 演示
+                    BottomMenu.show(new String[]{"添加", "查看", "编辑", "删除", "分享", "评论", "下载", "收藏", "赞!", "不喜欢", "所属专辑", "复制链接", "类似推荐", "添加", "查看", "编辑", "删除", "分享", "评论", "下载", "收藏", "赞!", "不喜欢", "所属专辑", "复制链接", "类似推荐"})
+                            .setOnIconChangeCallBack(new OnIconChangeCallBack(true) {
+                                @Override
+                                public int getIcon(BottomMenu bottomMenu, int index, String menuText) {
+                                    switch (menuText) {
+                                        case "添加":
+                                            return R.mipmap.img_dialogx_demo_add;
+                                        case "查看":
+                                            return R.mipmap.img_dialogx_demo_view;
+                                        case "编辑":
+                                            return R.mipmap.img_dialogx_demo_edit;
+                                        case "删除":
+                                            return R.mipmap.img_dialogx_demo_delete;
+                                        case "分享":
+                                            return R.mipmap.img_dialogx_demo_share;
+                                        case "评论":
+                                            return R.mipmap.img_dialogx_demo_comment;
+                                        case "下载":
+                                            return R.mipmap.img_dialogx_demo_download;
+                                        case "收藏":
+                                            return R.mipmap.img_dialogx_demo_favorite;
+                                        case "赞!":
+                                            return R.mipmap.img_dialogx_demo_good;
+                                        case "不喜欢":
+                                            return R.mipmap.img_dialogx_demo_dislike;
+                                        case "所属专辑":
+                                            return R.mipmap.img_dialogx_demo_album;
+                                        case "复制链接":
+                                            return R.mipmap.img_dialogx_demo_link;
+                                        case "类似推荐":
+                                            return R.mipmap.img_dialogx_demo_recommend;
+                                    }
+                                    return 0;
                                 }
-                                return 0;
-                            }
-                        })
-                        .setOnMenuItemClickListener(new OnMenuItemClickListener<BottomMenu>() {
-                            @Override
-                            public boolean onClick(BottomMenu dialog, CharSequence text, int index) {
-                                toast(text);
-                                return false;
-                            }
-                        });
+                            })
+                            .setOnMenuItemClickListener(new OnMenuItemClickListener<BottomMenu>() {
+                                @Override
+                                public boolean onClick(BottomMenu dialog, CharSequence text, int index) {
+                                    toast(text);
+                                    return false;
+                                }
+                            });
+                }
+                if (rdoIos.isChecked()) {
+                    BottomMenu.show(new String[]{"新标签页中打开","稍后阅读","复制链接网址"})
+                            .setMessage("http://www.kongzue.com/DialogX");
+                }
             }
         });