Skip to content

Commit

Permalink
update 1.7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoqi01 committed Mar 24, 2022
1 parent 4bce007 commit c64b686
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 14 deletions.
6 changes: 6 additions & 0 deletions BackgroundLibrary.xml
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,12 @@
<option name="XML" value="true" />
</context>
</template>
<template name="bl_padding_bottom" value="app:bl_padding_bottom=&quot;$value$&quot;" description="paddingBottom属性" toReformat="true" toShortenFQNames="true">
<variable name="value" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="XML" value="true" />
</context>
</template>
<template name="bl_padding_right" value="app:bl_padding_right=&quot;$value$&quot;" description="paddingRight属性" toReformat="true" toShortenFQNames="true">
<variable name="value" expression="" defaultValue="" alwaysStopAt="true" />
<context>
Expand Down
4 changes: 2 additions & 2 deletions README-EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Add this to your app's build.gradle:
}

implementation "androidx.appcompat:appcompat:$supportVersion"
implementation 'com.github.JavaNoober.BackgroundLibrary:library:1.7.3'
implementation 'com.github.JavaNoober.BackgroundLibrary:library:1.7.4'

if use androidx:

Expand All @@ -26,7 +26,7 @@ if use androidx:
}

implementation "androidx.appcompat:appcompat:$supportVersion"
implementation 'com.github.JavaNoober.BackgroundLibrary:libraryx:1.7.3'
implementation 'com.github.JavaNoober.BackgroundLibrary:libraryx:1.7.4'


## Example effect
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ issue回复不及时,可以添加qq群887686934
}

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

如果项目使用了androidx:

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

implementation "androidx.appcompat:appcompat:$supportVersion"
implementation 'com.github.JavaNoober.BackgroundLibrary:libraryx:1.7.3'
implementation 'com.github.JavaNoober.BackgroundLibrary:libraryx:1.7.4'


## 使用文档
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,16 @@ private static View setViewBackground(String name, Context context, AttributeSet
GradientDrawable drawable = null;
StateListDrawable stateListDrawable = null;
if (buttonTa.getIndexCount() > 0 && view instanceof CompoundButton) {
view.setClickable(true);
//view.setClickable(true);
((CompoundButton) view).setButtonDrawable(DrawableFactory.getButtonDrawable(typedArray, buttonTa));
} else if (selectorTa.getIndexCount() > 0) {
stateListDrawable = DrawableFactory.getSelectorDrawable(typedArray, selectorTa);
view.setClickable(true);
//view.setClickable(true);
setDrawable(stateListDrawable, view, otherTa, typedArray);
} else if (pressTa.getIndexCount() > 0) {
drawable = DrawableFactory.getDrawable(typedArray);
stateListDrawable = DrawableFactory.getPressDrawable(drawable, typedArray, pressTa);
view.setClickable(true);
//view.setClickable(true);
setDrawable(stateListDrawable, view, otherTa, typedArray);
} else if (multiSelTa.getIndexCount() > 0) {
stateListDrawable = DrawableFactory.getMultiSelectorDrawable(context, multiSelTa, typedArray);
Expand Down Expand Up @@ -159,15 +159,15 @@ private static View setViewBackground(String name, Context context, AttributeSet
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Drawable contentDrawable = (stateListDrawable == null ? drawable : stateListDrawable);
RippleDrawable rippleDrawable = new RippleDrawable(ColorStateList.valueOf(color), contentDrawable, contentDrawable);
view.setClickable(true);
//view.setClickable(true);
setBackground(rippleDrawable, view, typedArray);
} else if (stateListDrawable == null) {
StateListDrawable tmpDrawable = new StateListDrawable();
GradientDrawable unPressDrawable = DrawableFactory.getDrawable(typedArray);
unPressDrawable.setColor(color);
tmpDrawable.addState(new int[]{-android.R.attr.state_pressed}, drawable);
tmpDrawable.addState(new int[]{android.R.attr.state_pressed}, unPressDrawable);
view.setClickable(true);
//view.setClickable(true);
setDrawable(tmpDrawable, view, otherTa, typedArray);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,16 @@ private static View setViewBackground(String name, Context context, AttributeSet
GradientDrawable drawable = null;
StateListDrawable stateListDrawable = null;
if (buttonTa.getIndexCount() > 0 && view instanceof CompoundButton) {
view.setClickable(true);
//view.setClickable(true);
((CompoundButton) view).setButtonDrawable(DrawableFactory.getButtonDrawable(typedArray, buttonTa));
} else if (selectorTa.getIndexCount() > 0) {
stateListDrawable = DrawableFactory.getSelectorDrawable(typedArray, selectorTa);
view.setClickable(true);
//view.setClickable(true);
setDrawable(stateListDrawable, view, otherTa, typedArray);
} else if (pressTa.getIndexCount() > 0) {
drawable = DrawableFactory.getDrawable(typedArray);
stateListDrawable = DrawableFactory.getPressDrawable(drawable, typedArray, pressTa);
view.setClickable(true);
//view.setClickable(true);
setDrawable(stateListDrawable, view, otherTa, typedArray);
} else if (multiSelTa.getIndexCount() > 0) {
stateListDrawable = DrawableFactory.getMultiSelectorDrawable(context, multiSelTa, typedArray);
Expand Down Expand Up @@ -161,15 +161,15 @@ private static View setViewBackground(String name, Context context, AttributeSet
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Drawable contentDrawable = (stateListDrawable == null ? drawable : stateListDrawable);
RippleDrawable rippleDrawable = new RippleDrawable(ColorStateList.valueOf(color), contentDrawable, contentDrawable);
view.setClickable(true);
//view.setClickable(true);
setBackground(rippleDrawable, view, typedArray);
} else if (stateListDrawable == null) {
StateListDrawable tmpDrawable = new StateListDrawable();
GradientDrawable unPressDrawable = DrawableFactory.getDrawable(typedArray);
unPressDrawable.setColor(color);
tmpDrawable.addState(new int[]{-android.R.attr.state_pressed}, drawable);
tmpDrawable.addState(new int[]{android.R.attr.state_pressed}, unPressDrawable);
view.setClickable(true);
//view.setClickable(true);
setDrawable(tmpDrawable, view, otherTa, typedArray);
}
}
Expand Down

0 comments on commit c64b686

Please sign in to comment.