Skip to content

Commit 38b3aa0

Browse files
committed
Support set background drawable dynamically
1 parent 1f6cc95 commit 38b3aa0

File tree

4 files changed

+11
-112
lines changed

4 files changed

+11
-112
lines changed

text-button/bintrayv1.gradle

Lines changed: 0 additions & 61 deletions
This file was deleted.

text-button/build.gradle

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,15 @@ ext {
55
bintrayName = 'text-button'
66

77
publishedGroupId = 'com.github.duanhong169'
8-
libraryName = 'TextButton'
98
artifact = 'text-button'
109

10+
libraryName = 'TextButton'
1111
libraryDescription = 'Use textview as button easily'
12+
libraryVersion = '1.0.5'
1213

1314
siteUrl = 'https://github.com/duanhong169/TextButton'
1415
gitUrl = 'https://github.com/duanhong169/TextButton.git'
1516

16-
libraryVersion = '1.0.4'
17-
18-
developerId = 'duanhong169'
19-
developerName = 'Hong Duan'
20-
developerEmail = 'duanhong169@gmail.com'
21-
2217
licenseName = 'The MIT License, Version 2.0'
2318
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
2419
allLicenses = ["Apache-2.0"]
@@ -55,5 +50,4 @@ dependencies {
5550
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
5651
}
5752

58-
apply from: 'installv1.gradle'
59-
apply from: 'bintrayv1.gradle'
53+
apply from: 'https://raw.githubusercontent.com/duanhong169/bintray-gradle/master/bintray.gradle'

text-button/installv1.gradle

Lines changed: 0 additions & 41 deletions
This file was deleted.

text-button/src/main/java/top/defaults/view/TextButton.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,13 @@ public Map<String, Object> getSettings() {
133133
return settings;
134134
}
135135

136+
@Override
137+
public void setBackgroundDrawable(Drawable background) {
138+
super.setBackgroundDrawable(background);
139+
instinctBackground = background;
140+
apply();
141+
}
142+
136143
/**
137144
* Set custom {@link TextButtonEffect}s, which will override the xml settings
138145
*
@@ -258,7 +265,7 @@ public LayerDrawableProxy getBackgroundProxy() {
258265

259266
public void setBackgroundWithProxy(LayerDrawableProxy backgroundProxy) {
260267
this.backgroundProxy = backgroundProxy;
261-
setBackgroundDrawable(backgroundProxy.get());
268+
super.setBackgroundDrawable(backgroundProxy.get());
262269
}
263270

264271
@SuppressLint("ClickableViewAccessibility")

0 commit comments

Comments
 (0)