File tree 3 files changed +19
-8
lines changed
blendedbackground/src/main/java/com/alxgrk/blendedbackground
3 files changed +19
-8
lines changed Original file line number Diff line number Diff line change @@ -27,23 +27,27 @@ Demo:
27
27
## How to use
28
28
29
29
### Gradle
30
- // TODO gradle integration
30
+ To use this library in your own project, simply add the following line to your module ` build.gradle ` :
31
+
32
+ ```
33
+ compile 'com.github.alxgrk.blendedbackground:blendedbackground:1.0.1'
34
+ ```
31
35
32
36
### Referencing a View
33
- To reference a View, simply add ` android:tag="@string/ref_tag" ` to your View. // TODO replace with custom attribute
37
+ To reference a View, simply add ` android:tag="@string/ref_tag" ` to your View.
34
38
35
39
### Defining Attributes
36
40
You can use the following attributes to define behaviour:
37
41
38
- ` android:upper_color="\ <color\ >" ` - sets the upper color to a fixed value
42
+ ` android:upper_color="<color>" ` - sets the upper color to a fixed value
39
43
40
- ` android:lower_color="\ <color\ >" ` - sets the lower color to a fixed value
44
+ ` android:lower_color="<color>" ` - sets the lower color to a fixed value
41
45
42
- ` android:upper_blend_in="\ <boolean\ >" ` - set to true, if fixed upper color and dominating color should be blended together; default is false
46
+ ` android:upper_blend_in="<boolean>" ` - set to true, if fixed upper color and dominating color should be blended together; default is false
43
47
44
- ` android:lower_blend_in="\ <boolean\ >" ` - set to true, if fixed lower color and dominating color should be blended together; default is false
48
+ ` android:lower_blend_in="<boolean>" ` - set to true, if fixed lower color and dominating color should be blended together; default is false
45
49
46
- ` android:invert="\ <boolean\ >" ` - set to true, if upper and lower color should change position; default is false
50
+ ` android:invert="<boolean>" ` - set to true, if upper and lower color should change position; default is false
47
51
48
52
## Support
49
53
Original file line number Diff line number Diff line change 7
7
import android .graphics .Color ;
8
8
import android .graphics .drawable .BitmapDrawable ;
9
9
import android .graphics .drawable .Drawable ;
10
+ import android .os .Build ;
10
11
import android .support .annotation .NonNull ;
11
12
import android .util .AttributeSet ;
12
13
import android .util .Log ;
@@ -133,7 +134,13 @@ private void update() {
133
134
applyUserDefinitions (colors );
134
135
135
136
Gradient gradient = new Gradient (this , colors .getUpper (), colors .getLower ());
136
- this .setBackground (gradient .get ());
137
+
138
+ if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .JELLY_BEAN ) {
139
+ this .setBackground (gradient .get ());
140
+ } else {
141
+ this .setBackgroundDrawable (gradient .get ());
142
+ }
143
+
137
144
this .invalidate ();
138
145
}
139
146
You can’t perform that action at this time.
0 commit comments