Skip to content

Commit 4d00d73

Browse files
committed
update to 1.6.1 sdk 21以下手机的适配
1 parent f4bd061 commit 4d00d73

6 files changed

Lines changed: 39 additions & 14 deletions

File tree

README-EN.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ A framework for directly generating shape through Tags, no need to write shape.x
77
Add this to your app's build.gradle:
88

99
implementation "com.android.support:appcompat-v7:$supportVersion"
10-
implementation 'com.noober.background:core:1.6.0'
10+
implementation 'com.noober.background:core:1.6.1'
1111

1212
if use androidx:
1313

1414
implementation "androidx.appcompat:appcompat:$supportVersion"
15-
implementation 'com.noober.background:core:1.6.0'
15+
implementation 'com.noober.background:core:1.6.1'
1616

1717

1818
## Example effect

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ A framework for directly generating shape through Tags, no need to write shape.x
1010
依赖方式:
1111

1212
implementation "com.android.support:appcompat-v7:$supportVersion"
13-
implementation 'com.noober.background:core:1.6.0'
13+
implementation 'com.noober.background:core:1.6.1'
1414

1515
如果项目使用了androidx:
1616

1717
implementation "androidx.appcompat:appcompat:$supportVersion"
18-
implementation 'com.noober.background:core:1.6.0'
18+
implementation 'com.noober.background:core:1.6.1'
1919

2020

2121
## 使用文档

app/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ apply plugin: 'kotlin-android'
33
apply plugin: 'kotlin-android-extensions'
44

55
android {
6-
compileSdkVersion 29
6+
compileSdkVersion 28
77
defaultConfig {
88
applicationId "com.noober.backgroudlibrary"
99
minSdkVersion 14
10-
targetSdkVersion 29
10+
targetSdkVersion 28
1111
versionCode 1
1212
versionName "1.0"
1313
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@@ -37,7 +37,7 @@ dependencies {
3737
testImplementation 'junit:junit:4.12'
3838
androidTestImplementation 'com.android.support.test:runner:1.0.2'
3939
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
40-
implementation 'com.noober.background:core:1.6.0'
41-
// implementation project(':library')
40+
// implementation 'com.noober.background:core:1.6.0'
41+
implementation project(':library')
4242
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
4343
}

app/src/main/java/com/noober/backgroudlibrary/MainActivity.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import android.content.res.ColorStateList;
55
import android.graphics.Color;
66
import android.graphics.drawable.Drawable;
7+
import android.graphics.drawable.GradientDrawable;
78
import android.os.Build;
89
import android.os.Bundle;
910
import android.support.annotation.Nullable;
@@ -38,16 +39,24 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
3839
ColorStateList colors = new DrawableCreator.Builder().setPressedTextColor(Color.RED).setUnPressedTextColor(Color.BLUE).buildTextColor();
3940
tvTest1.setTextColor(colors);
4041

41-
Button btnTest2 = findViewById(R.id.btnTest2);
42-
Drawable drawable2 = new DrawableCreator.Builder().setCornersRadius(dip2px(20))
43-
.setGradientAngle(0).setGradientColor(Color.parseColor("#63B8FF"), Color.parseColor("#4F94CD")).build();
42+
TextView btnTest2 = findViewById(R.id.btnTest2);
43+
btnTest2.setEnabled(false);
44+
GradientDrawable drawable2;
45+
drawable2 = new GradientDrawable();
46+
int[][] state = new int[2][];
47+
int[] color = new int[2];
48+
state[0] = new int[]{android.R.attr.state_pressed};
49+
state[1] = new int[]{-android.R.attr.state_pressed};
50+
color[0] = R.color.colorAccent;
51+
color[1] = R.color.colorPrimaryDark;
52+
ColorStateList colorStateList = new ColorStateList(state, color);
53+
// drawable2.setColor(colorStateList);
4454
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN){
4555
btnTest2.setBackground(drawable2);
4656
}else {
4757
btnTest2.setBackgroundDrawable(drawable2);
4858
}
4959

50-
5160
Button btnTest3 = findViewById(R.id.btnTest3);
5261
Drawable drawable3 = new DrawableCreator.Builder().setCornersRadius(dip2px(20))
5362
.setRipple(true, Color.parseColor("#71C671"))

app/src/main/res/layout/activity_main.xml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@
1313
tools:context=".MainActivity"
1414
tools:ignore="MissingPrefix">
1515

16+
<com.noober.background.view.BLButton
17+
android:id="@+id/btn_login"
18+
style="?android:attr/borderlessButtonStyle"
19+
android:layout_width="match_parent"
20+
android:layout_height="wrap_content"
21+
android:text="登录"
22+
android:textColor="@android:color/white"
23+
app:bl_corners_radius="4dp"
24+
app:bl_pressed_solid_color="@color/colorAccent"
25+
app:bl_unPressed_solid_color="@color/colorPrimaryDark" />
26+
1627
<com.noober.background.view.BLTextView
1728
android:layout_width="wrap_content"
1829
android:layout_height="36dp"
@@ -462,13 +473,18 @@
462473
android:text="点击文字变色"
463474
android:textSize="20sp" />
464475

465-
<Button
476+
<TextView
466477
android:id="@+id/btnTest2"
467478
android:layout_width="130dp"
468479
android:layout_height="36dp"
469480
android:layout_marginTop="5dp"
470481
android:gravity="center"
471482
android:padding="0dp"
483+
android:clickable="true"
484+
android:focusable="true"
485+
app:bl_pressed_solid_color="@color/colorAccent"
486+
app:bl_unPressed_solid_color="@color/colorPrimaryDark"
487+
app:bl_corners_radius="5dp"
472488
android:text="背景"
473489
android:textColor="#4F94CD"
474490
android:textSize="20sp" />

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ ext {
3636
userOrg = 'noober'
3737
groupId = 'com.noober.background'
3838
uploadName = 'LibraryForBackground'
39-
publishVersion = '1.6.0'
39+
publishVersion = '1.6.1'
4040
desc = "A framework for directly generating shape through Tags, no need to write shape.xml again(通过标签直接生成shape,无需再写shape.xml)"
4141
website = 'https://github.com/JavaNoober/BackgroundLibrary'
4242
// gradlew clean build bintrayUpload -PbintrayUser=xiaoqiandroid -PbintrayKey=xxxxxxxxxxxxxxxx -PdryRun=false

0 commit comments

Comments
 (0)