Skip to content

Commit

Permalink
FixBug#118#121
Browse files Browse the repository at this point in the history
  • Loading branch information
RuffianZhong committed May 8, 2023
1 parent db644dc commit ed07302
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
defaultConfig {
minSdkVersion 14
targetSdkVersion 31
versionCode 37
versionName "support.v0.0.13"
versionCode 38
versionName "support.v0.0.14"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,27 +373,27 @@ private void setupDefaultValue(boolean init) {
if (mBackgroundColorNormalArray != null && mBackgroundColorNormalArray.length > 0) {
mBackgroundNormal = setColors(mBackgroundNormal, mBackgroundColorNormalArray);
} else {
mBackgroundNormal.setColor(mBackgroundColorNormal);
mBackgroundNormal = setColors(mBackgroundNormal, new int[]{mBackgroundColorNormal, mBackgroundColorNormal});
}
if (mBackgroundColorPressedArray != null && mBackgroundColorPressedArray.length > 0) {
mBackgroundPressed = setColors(mBackgroundPressed, mBackgroundColorPressedArray);
} else {
mBackgroundPressed.setColor(mBackgroundColorPressed);
mBackgroundPressed = setColors(mBackgroundPressed, new int[]{mBackgroundColorPressed, mBackgroundColorPressed});
}
if (mBackgroundColorUnableArray != null && mBackgroundColorUnableArray.length > 0) {
mBackgroundUnable = setColors(mBackgroundUnable, mBackgroundColorUnableArray);
} else {
mBackgroundUnable.setColor(mBackgroundColorUnable);
mBackgroundUnable = setColors(mBackgroundUnable, new int[]{mBackgroundColorUnable, mBackgroundColorUnable});
}
if (mBackgroundColorCheckedArray != null && mBackgroundColorCheckedArray.length > 0) {
mBackgroundChecked = setColors(mBackgroundChecked, mBackgroundColorCheckedArray);
} else {
mBackgroundChecked.setColor(mBackgroundColorChecked);
mBackgroundChecked = setColors(mBackgroundChecked, new int[]{mBackgroundColorChecked, mBackgroundColorChecked});
}
if (mBackgroundColorSelectedArray != null && mBackgroundColorSelectedArray.length > 0) {
mBackgroundSelected = setColors(mBackgroundSelected, mBackgroundColorSelectedArray);
} else {
mBackgroundSelected.setColor(mBackgroundColorSelected);
mBackgroundSelected = setColors(mBackgroundSelected, new int[]{mBackgroundColorSelected, mBackgroundColorSelected});
}

//设置边框默认值
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,7 @@ private void setSingleIconWithText() {
if (translateX < 0) translateX = 0;
//垂直方向计算
float textHeight = TextViewUtils.get().getTextHeight(mView, drawableHeight, mPaddingTop, mPaddingBottom, drawablePaddingVertical);
textHeight = Math.max(textHeight, Math.max(mIconHeightLeft, mIconHeightRight));//交叉轴存在icon时高度重新计算
float bodyHeight = textHeight + drawableHeight + drawablePaddingVertical;//内容高度
float actualHeight = mView.getHeight() - (mPaddingTop + mPaddingBottom);//实际可用高度
int translateY = (int) (actualHeight - bodyHeight) / 2;
Expand Down Expand Up @@ -931,6 +932,7 @@ private void setMultipleIconWithText() {
if (translateX < 0) translateX = 0;
//垂直方向计算
float textHeight = TextViewUtils.get().getTextHeight(mView, drawableHeightFinal, mPaddingTop, mPaddingBottom, drawablePaddingVerticalFinal);
textHeight = Math.max(textHeight, Math.max(mIconHeightLeft, mIconHeightRight));//交叉轴存在icon时高度重新计算
float bodyHeight = textHeight + drawableHeightFinal + drawablePaddingVerticalFinal;//内容高度
float actualHeight = mView.getHeight() - (mPaddingTop + mPaddingBottom);//实际可用高度
int translateY = (int) (actualHeight - bodyHeight) / 2;
Expand Down

0 comments on commit ed07302

Please sign in to comment.