Skip to content

Commit c64b686

Browse files
author
xiaoqi01
committed
update 1.7.4
1 parent 4bce007 commit c64b686

File tree

5 files changed

+20
-14
lines changed

5 files changed

+20
-14
lines changed

BackgroundLibrary.xml

+6
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,12 @@
797797
<option name="XML" value="true" />
798798
</context>
799799
</template>
800+
<template name="bl_padding_bottom" value="app:bl_padding_bottom=&quot;$value$&quot;" description="paddingBottom属性" toReformat="true" toShortenFQNames="true">
801+
<variable name="value" expression="" defaultValue="" alwaysStopAt="true" />
802+
<context>
803+
<option name="XML" value="true" />
804+
</context>
805+
</template>
800806
<template name="bl_padding_right" value="app:bl_padding_right=&quot;$value$&quot;" description="paddingRight属性" toReformat="true" toShortenFQNames="true">
801807
<variable name="value" expression="" defaultValue="" alwaysStopAt="true" />
802808
<context>

README-EN.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Add this to your app's build.gradle:
1414
}
1515

1616
implementation "androidx.appcompat:appcompat:$supportVersion"
17-
implementation 'com.github.JavaNoober.BackgroundLibrary:library:1.7.3'
17+
implementation 'com.github.JavaNoober.BackgroundLibrary:library:1.7.4'
1818

1919
if use androidx:
2020

@@ -26,7 +26,7 @@ if use androidx:
2626
}
2727

2828
implementation "androidx.appcompat:appcompat:$supportVersion"
29-
implementation 'com.github.JavaNoober.BackgroundLibrary:libraryx:1.7.3'
29+
implementation 'com.github.JavaNoober.BackgroundLibrary:libraryx:1.7.4'
3030

3131

3232
## Example effect

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ issue回复不及时,可以添加qq群887686934
1919
}
2020

2121
implementation "com.android.support:appcompat-v7:$supportVersion"
22-
implementation 'com.github.JavaNoober.BackgroundLibrary:library:1.7.3'
22+
implementation 'com.github.JavaNoober.BackgroundLibrary:library:1.7.4'
2323

2424
如果项目使用了androidx:
2525

@@ -31,7 +31,7 @@ issue回复不及时,可以添加qq群887686934
3131
}
3232

3333
implementation "androidx.appcompat:appcompat:$supportVersion"
34-
implementation 'com.github.JavaNoober.BackgroundLibrary:libraryx:1.7.3'
34+
implementation 'com.github.JavaNoober.BackgroundLibrary:libraryx:1.7.4'
3535

3636

3737
## 使用文档

library/src/main/java/com/noober/background/BackgroundFactory.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -112,16 +112,16 @@ private static View setViewBackground(String name, Context context, AttributeSet
112112
GradientDrawable drawable = null;
113113
StateListDrawable stateListDrawable = null;
114114
if (buttonTa.getIndexCount() > 0 && view instanceof CompoundButton) {
115-
view.setClickable(true);
115+
//view.setClickable(true);
116116
((CompoundButton) view).setButtonDrawable(DrawableFactory.getButtonDrawable(typedArray, buttonTa));
117117
} else if (selectorTa.getIndexCount() > 0) {
118118
stateListDrawable = DrawableFactory.getSelectorDrawable(typedArray, selectorTa);
119-
view.setClickable(true);
119+
//view.setClickable(true);
120120
setDrawable(stateListDrawable, view, otherTa, typedArray);
121121
} else if (pressTa.getIndexCount() > 0) {
122122
drawable = DrawableFactory.getDrawable(typedArray);
123123
stateListDrawable = DrawableFactory.getPressDrawable(drawable, typedArray, pressTa);
124-
view.setClickable(true);
124+
//view.setClickable(true);
125125
setDrawable(stateListDrawable, view, otherTa, typedArray);
126126
} else if (multiSelTa.getIndexCount() > 0) {
127127
stateListDrawable = DrawableFactory.getMultiSelectorDrawable(context, multiSelTa, typedArray);
@@ -159,15 +159,15 @@ private static View setViewBackground(String name, Context context, AttributeSet
159159
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
160160
Drawable contentDrawable = (stateListDrawable == null ? drawable : stateListDrawable);
161161
RippleDrawable rippleDrawable = new RippleDrawable(ColorStateList.valueOf(color), contentDrawable, contentDrawable);
162-
view.setClickable(true);
162+
//view.setClickable(true);
163163
setBackground(rippleDrawable, view, typedArray);
164164
} else if (stateListDrawable == null) {
165165
StateListDrawable tmpDrawable = new StateListDrawable();
166166
GradientDrawable unPressDrawable = DrawableFactory.getDrawable(typedArray);
167167
unPressDrawable.setColor(color);
168168
tmpDrawable.addState(new int[]{-android.R.attr.state_pressed}, drawable);
169169
tmpDrawable.addState(new int[]{android.R.attr.state_pressed}, unPressDrawable);
170-
view.setClickable(true);
170+
//view.setClickable(true);
171171
setDrawable(tmpDrawable, view, otherTa, typedArray);
172172
}
173173
}

libraryx/src/main/java/com/noober/background/BackgroundFactory.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,16 @@ private static View setViewBackground(String name, Context context, AttributeSet
114114
GradientDrawable drawable = null;
115115
StateListDrawable stateListDrawable = null;
116116
if (buttonTa.getIndexCount() > 0 && view instanceof CompoundButton) {
117-
view.setClickable(true);
117+
//view.setClickable(true);
118118
((CompoundButton) view).setButtonDrawable(DrawableFactory.getButtonDrawable(typedArray, buttonTa));
119119
} else if (selectorTa.getIndexCount() > 0) {
120120
stateListDrawable = DrawableFactory.getSelectorDrawable(typedArray, selectorTa);
121-
view.setClickable(true);
121+
//view.setClickable(true);
122122
setDrawable(stateListDrawable, view, otherTa, typedArray);
123123
} else if (pressTa.getIndexCount() > 0) {
124124
drawable = DrawableFactory.getDrawable(typedArray);
125125
stateListDrawable = DrawableFactory.getPressDrawable(drawable, typedArray, pressTa);
126-
view.setClickable(true);
126+
//view.setClickable(true);
127127
setDrawable(stateListDrawable, view, otherTa, typedArray);
128128
} else if (multiSelTa.getIndexCount() > 0) {
129129
stateListDrawable = DrawableFactory.getMultiSelectorDrawable(context, multiSelTa, typedArray);
@@ -161,15 +161,15 @@ private static View setViewBackground(String name, Context context, AttributeSet
161161
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
162162
Drawable contentDrawable = (stateListDrawable == null ? drawable : stateListDrawable);
163163
RippleDrawable rippleDrawable = new RippleDrawable(ColorStateList.valueOf(color), contentDrawable, contentDrawable);
164-
view.setClickable(true);
164+
//view.setClickable(true);
165165
setBackground(rippleDrawable, view, typedArray);
166166
} else if (stateListDrawable == null) {
167167
StateListDrawable tmpDrawable = new StateListDrawable();
168168
GradientDrawable unPressDrawable = DrawableFactory.getDrawable(typedArray);
169169
unPressDrawable.setColor(color);
170170
tmpDrawable.addState(new int[]{-android.R.attr.state_pressed}, drawable);
171171
tmpDrawable.addState(new int[]{android.R.attr.state_pressed}, unPressDrawable);
172-
view.setClickable(true);
172+
//view.setClickable(true);
173173
setDrawable(tmpDrawable, view, otherTa, typedArray);
174174
}
175175
}

0 commit comments

Comments
 (0)