Browse Source

0.0.48.beta11

kongzue 2 years ago
parent
commit
193d2f5163

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

@@ -19,6 +19,7 @@ import com.kongzue.dialogx.interfaces.BottomMenuListViewTouchEvent;
 import com.kongzue.dialogx.interfaces.DialogLifecycleCallback;
 import com.kongzue.dialogx.interfaces.DialogXAnimInterface;
 import com.kongzue.dialogx.interfaces.DialogXStyle;
+import com.kongzue.dialogx.interfaces.MenuItemLayoutRefreshCallback;
 import com.kongzue.dialogx.interfaces.MenuItemTextInfoInterceptor;
 import com.kongzue.dialogx.interfaces.OnBackPressedListener;
 import com.kongzue.dialogx.interfaces.OnBackgroundMaskClickListener;
@@ -57,6 +58,7 @@ public class BottomMenu extends BottomDialog {
     protected SELECT_MODE selectMode = SELECT_MODE.NONE;
     protected ArrayList<Integer> selectionItems;
     protected boolean showSelectedBackgroundTips = true;
+    protected MenuItemLayoutRefreshCallback<BottomMenu> menuMenuItemLayoutRefreshCallback;
     
     protected OnMenuItemClickListener<BottomMenu> onMenuItemClickListener;
     
@@ -1239,4 +1241,13 @@ public class BottomMenu extends BottomDialog {
     public CharSequence[] getSelectTextArray() {
         return selectTextArray;
     }
+    
+    public MenuItemLayoutRefreshCallback<BottomMenu> getMenuMenuItemLayoutRefreshCallback() {
+        return menuMenuItemLayoutRefreshCallback;
+    }
+    
+    public BottomMenu setMenuMenuItemLayoutRefreshCallback(MenuItemLayoutRefreshCallback<BottomMenu> menuMenuItemLayoutRefreshCallback) {
+        this.menuMenuItemLayoutRefreshCallback = menuMenuItemLayoutRefreshCallback;
+        return this;
+    }
 }

+ 0 - 1
DialogX/src/main/java/com/kongzue/dialogx/dialogs/GuideDialog.java

@@ -575,7 +575,6 @@ public class GuideDialog extends CustomDialog {
         if (Arrays.equals(baseViewLoc, baseViewLocCache)) {
             return;
         }
-        log("a:" + baseViewLoc[0]);
         if (getDialogImpl() == null) {
             return;
         }

+ 11 - 0
DialogX/src/main/java/com/kongzue/dialogx/dialogs/PopMenu.java

@@ -32,6 +32,7 @@ import com.kongzue.dialogx.interfaces.DialogConvertViewInterface;
 import com.kongzue.dialogx.interfaces.DialogLifecycleCallback;
 import com.kongzue.dialogx.interfaces.DialogXAnimInterface;
 import com.kongzue.dialogx.interfaces.DialogXStyle;
+import com.kongzue.dialogx.interfaces.MenuItemLayoutRefreshCallback;
 import com.kongzue.dialogx.interfaces.OnBackPressedListener;
 import com.kongzue.dialogx.interfaces.OnBackgroundMaskClickListener;
 import com.kongzue.dialogx.interfaces.OnBindView;
@@ -81,6 +82,7 @@ public class PopMenu extends BaseDialog {
     protected float backgroundRadius = -1;
     protected DialogXAnimInterface<PopMenu> dialogXAnimImpl;
     protected OnBackPressedListener<PopMenu> onBackPressedListener;
+    protected MenuItemLayoutRefreshCallback<PopMenu> menuMenuItemLayoutRefreshCallback;
     protected int pressedIndex = -1;
 
     protected int alignGravity = -1;                                        //指定菜单相对 baseView 的位置
@@ -1253,4 +1255,13 @@ public class PopMenu extends BaseDialog {
     public void onDismiss(PopMenu dialog) {
 
     }
+    
+    public MenuItemLayoutRefreshCallback<PopMenu> getMenuMenuItemLayoutRefreshCallback() {
+        return menuMenuItemLayoutRefreshCallback;
+    }
+    
+    public PopMenu setMenuMenuItemLayoutRefreshCallback(MenuItemLayoutRefreshCallback<PopMenu> menuMenuItemLayoutRefreshCallback) {
+        this.menuMenuItemLayoutRefreshCallback = menuMenuItemLayoutRefreshCallback;
+        return this;
+    }
 }

+ 16 - 0
DialogX/src/main/java/com/kongzue/dialogx/interfaces/MenuItemLayoutRefreshCallback.java

@@ -0,0 +1,16 @@
+package com.kongzue.dialogx.interfaces;
+
+import android.view.View;
+import android.view.ViewGroup;
+
+/**
+ * @author: Kongzue
+ * @github: https://github.com/kongzue/
+ * @homepage: http://kongzue.com/
+ * @mail: myzcxhh@live.cn
+ * @createTime: 2023/2/22 16:47
+ */
+public interface MenuItemLayoutRefreshCallback<D> {
+    
+    void getView(D dialog, int position, View convertView, ViewGroup parent);
+}

+ 3 - 1
DialogX/src/main/java/com/kongzue/dialogx/util/BottomMenuArrayAdapter.java

@@ -221,7 +221,9 @@ public class BottomMenuArrayAdapter extends BaseAdapter {
                 }
             }
         }
-        
+        if (bottomMenu.getMenuMenuItemLayoutRefreshCallback() != null) {
+            bottomMenu.getMenuMenuItemLayoutRefreshCallback().getView(bottomMenu, position, convertView, parent);
+        }
         return convertView;
     }
     

+ 5 - 2
DialogX/src/main/java/com/kongzue/dialogx/util/PopMenuArrayAdapter.java

@@ -147,6 +147,11 @@ public class PopMenuArrayAdapter extends BaseAdapter {
                 viewHolder.spaceDialogxRightPadding.setVisibility(View.GONE);
             }
         }
+        
+        if (popMenu.getMenuMenuItemLayoutRefreshCallback() != null) {
+            popMenu.getMenuMenuItemLayoutRefreshCallback().getView(popMenu, position, convertView, parent);
+        }
+        
         return convertView;
     }
     
@@ -159,7 +164,5 @@ public class PopMenuArrayAdapter extends BaseAdapter {
         ImageView imgDialogxMenuIcon;
         TextView txtDialogxMenuText;
         Space spaceDialogxRightPadding;
-        
-        
     }
 }

+ 1 - 1
gradle.properties

@@ -19,6 +19,6 @@ android.useAndroidX=true
 # Automatically convert third-party libraries to use AndroidX
 android.enableJetifier=true
 
-BUILD_VERSION=0.0.48.beta9
+BUILD_VERSION=0.0.48.beta11
 BUILD_VERSION_INT=47
 DIALOGX_STYLE_VERSION=5