Skip to content

Commit

Permalink
0.0.50.beta24 pre
Browse files Browse the repository at this point in the history
- 修复PopMenu在未绑定baseView而指定setAlignGravity会出现的空指针异常;
- 修复DialogListBuilder可能存在的空指针风险;
- PopMenu 增加 setBackgroundColor 和 setBackgroundColorRes 方法;
  • Loading branch information
kongzue committed Nov 26, 2024
1 parent 9630fcf commit a29d2e9
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions DialogX/src/main/java/com/kongzue/dialogx/dialogs/PopMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.annotation.ColorInt;
import androidx.annotation.ColorRes;
import androidx.annotation.Nullable;
import androidx.lifecycle.Lifecycle;

Expand Down Expand Up @@ -616,6 +618,9 @@ public void onClick(View v) {
} else {
boxRoot.setClickable(false);
}
if (backgroundColor != null) {
tintColor(boxBody, backgroundColor);
}

if (backgroundRadius > -1) {
if (boxBody.getBackground() instanceof GradientDrawable) {
Expand Down Expand Up @@ -1508,4 +1513,20 @@ public boolean isMenuItemEnable(int index) {
}
return enabled;
}

public int getBackgroundColor() {
return backgroundColor;
}

public PopMenu setBackgroundColor(@ColorInt int backgroundColor) {
this.backgroundColor = backgroundColor;
refreshUI();
return this;
}

public PopMenu setBackgroundColorRes(@ColorRes int backgroundColorResId) {
this.backgroundColor = getColor(backgroundColorResId);
refreshUI();
return this;
}
}

0 comments on commit a29d2e9

Please sign in to comment.