Skip to content

Commit

Permalink
update to 1.5.7
Browse files Browse the repository at this point in the history
  • Loading branch information
JavaNoober committed Sep 4, 2019
1 parent 99a8655 commit 397bd47
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 18 deletions.
4 changes: 2 additions & 2 deletions README-EN.md
Expand Up @@ -7,12 +7,12 @@ A framework for directly generating shape through Tags, no need to write shape.x
Add this to your app's build.gradle:

implementation "com.android.support:appcompat-v7:$supportVersion"
implementation 'com.noober.background:core:1.5.6'
implementation 'com.noober.background:core:1.5.7'

if use androidx:

implementation "androidx.appcompat:appcompat:$supportVersion"
implementation 'com.noober.background:core:1.5.6'
implementation 'com.noober.background:core:1.5.7'


## Example effect
Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -10,12 +10,12 @@ A framework for directly generating shape through Tags, no need to write shape.x
依赖方式:

implementation "com.android.support:appcompat-v7:$supportVersion"
implementation 'com.noober.background:core:1.5.6'
implementation 'com.noober.background:core:1.5.7'

如果项目使用了androidx:

implementation "androidx.appcompat:appcompat:$supportVersion"
implementation 'com.noober.background:core:1.5.6'
implementation 'com.noober.background:core:1.5.7'


## 使用文档
Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle
Expand Up @@ -37,7 +37,7 @@ dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.noober.background:core:1.5.6'
implementation 'com.noober.background:core:1.5.7'
// implementation project(':library')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
15 changes: 9 additions & 6 deletions app/src/main/res/layout/activity_main.xml
Expand Up @@ -13,7 +13,6 @@
tools:context=".MainActivity"
tools:ignore="MissingPrefix">


<com.noober.background.view.BLTextView
android:layout_width="wrap_content"
android:layout_height="36dp"
Expand All @@ -32,6 +31,10 @@
android:layout_width="wrap_content"
android:layout_height="36dp"
android:layout_marginTop="5dp"
app:bl_padding_left= "15dp"
app:bl_padding_top= "15dp"
app:bl_padding_bottom= "5dp"
app:bl_padding_right= "5dp"
android:gravity="center"
android:text="虚线圆角边框以及填充"
android:textColor="#8c6822"
Expand Down Expand Up @@ -494,10 +497,10 @@

</FrameLayout>

<!--<fragment-->
<!--android:id="@+id/fragmentTest"-->
<!--android:name="com.noober.backgroudlibrary.BlankFragment"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="match_parent" />-->
<!-- <fragment-->
<!-- android:id="@+id/fragmentTest"-->
<!-- android:name="com.noober.backgroudlibrary.BlankFragment"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent" />-->
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
2 changes: 1 addition & 1 deletion build.gradle
Expand Up @@ -36,7 +36,7 @@ ext {
userOrg = 'noober'
groupId = 'com.noober.background'
uploadName = 'LibraryForBackground'
publishVersion = '1.5.6'
publishVersion = '1.5.7'
desc = "A framework for directly generating shape through Tags, no need to write shape.xml again(通过标签直接生成shape,无需再写shape.xml)"
website = 'https://github.com/JavaNoober/BackgroundLibrary'
// gradlew clean build bintrayUpload -PbintrayUser=xiaoqiandroid -PbintrayKey=xxxxxxxxxxxxxxxx -PdryRun=false
Expand Down
Expand Up @@ -131,6 +131,9 @@ public static class Builder {

private boolean hasSelectDrawable = false;

private GradientDrawable baseGradientDrawable = null;
private StateListDrawable baseStateListDrawable = null;

public Builder setShape(Shape shape) {
this.shape = shape;
return this;
Expand Down Expand Up @@ -481,6 +484,17 @@ public Builder setUnFocusedTextColor(int unFocusedTextColor) {
return this;
}

public Builder setBaseGradientDrawable(GradientDrawable baseGradientDrawable) {
this.baseGradientDrawable = baseGradientDrawable;
return this;
}

public Builder setBaseStateListDrawable(StateListDrawable baseStateListDrawable) {
this.baseStateListDrawable = baseStateListDrawable;
return this;
}


public Drawable build() {
GradientDrawable drawable = null;
StateListDrawable stateListDrawable = null;
Expand Down Expand Up @@ -581,7 +595,7 @@ private ColorStateList getColorStateList() {
}

private StateListDrawable getStateListDrawable() {
StateListDrawable stateListDrawable = null;
StateListDrawable stateListDrawable = baseStateListDrawable;
if (checkableDrawable != null) {
stateListDrawable = getStateListDrawable(stateListDrawable);
stateListDrawable.addState(new int[]{android.R.attr.state_checkable}, checkableDrawable);
Expand Down Expand Up @@ -651,7 +665,10 @@ private StateListDrawable getStateListDrawable() {

@NonNull
private GradientDrawable getGradientDrawable() {
GradientDrawable drawable = new GradientDrawable();
GradientDrawable drawable = baseGradientDrawable;
if (drawable == null) {
drawable = new GradientDrawable();
}
drawable.setShape(shape.value);

if (cornersRadius != null) {
Expand Down
Expand Up @@ -132,6 +132,9 @@ public static class Builder {

private boolean hasSelectDrawable = false;

private GradientDrawable baseGradientDrawable = null;
private StateListDrawable baseStateListDrawable = null;

public Builder setShape(Shape shape) {
this.shape = shape;
return this;
Expand Down Expand Up @@ -482,6 +485,17 @@ public Builder setUnFocusedTextColor(int unFocusedTextColor) {
return this;
}

public Builder setBaseGradientDrawable(GradientDrawable baseGradientDrawable) {
this.baseGradientDrawable = baseGradientDrawable;
return this;
}

public Builder setBaseStateListDrawable(StateListDrawable baseStateListDrawable) {
this.baseStateListDrawable = baseStateListDrawable;
return this;
}


public Drawable build() {
GradientDrawable drawable = null;
StateListDrawable stateListDrawable = null;
Expand Down Expand Up @@ -582,7 +596,7 @@ private ColorStateList getColorStateList() {
}

private StateListDrawable getStateListDrawable() {
StateListDrawable stateListDrawable = null;
StateListDrawable stateListDrawable = baseStateListDrawable;
if (checkableDrawable != null) {
stateListDrawable = getStateListDrawable(stateListDrawable);
stateListDrawable.addState(new int[]{android.R.attr.state_checkable}, checkableDrawable);
Expand Down Expand Up @@ -652,7 +666,10 @@ private StateListDrawable getStateListDrawable() {

@NonNull
private GradientDrawable getGradientDrawable() {
GradientDrawable drawable = new GradientDrawable();
GradientDrawable drawable = baseGradientDrawable;
if (drawable == null) {
drawable = new GradientDrawable();
}
drawable.setShape(shape.value);

if (cornersRadius != null) {
Expand Down Expand Up @@ -735,7 +752,6 @@ private GradientDrawable getGradientDrawable() {
drawable.setGradientType(gradient.value);
drawable.setUseLevel(useLevel);
if (!padding.isEmpty()) {

if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
drawable.setPadding(padding.left, padding.top, padding.right, padding.bottom);
} else {
Expand All @@ -749,7 +765,6 @@ private GradientDrawable getGradientDrawable() {
e.printStackTrace();
}
}

}
if (sizeWidth != null && sizeHeight != null) {
drawable.setSize(sizeWidth.intValue(), sizeHeight.intValue());
Expand Down

0 comments on commit 397bd47

Please sign in to comment.