Skip to content

Commit b34ce17

Browse files
committed
minSdkVersion is now 15 + revised README
1 parent ad525ed commit b34ce17

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

README.md

+11-7
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,27 @@ Demo:
2727
## How to use
2828

2929
### 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+
```
3135

3236
### 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.
3438

3539
### Defining Attributes
3640
You can use the following attributes to define behaviour:
3741

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
3943

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
4145

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
4347

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
4549

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
4751

4852
## Support
4953

blendedbackground/src/main/java/com/alxgrk/blendedbackground/BlendedBackgroundLayout.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import android.graphics.Color;
88
import android.graphics.drawable.BitmapDrawable;
99
import android.graphics.drawable.Drawable;
10+
import android.os.Build;
1011
import android.support.annotation.NonNull;
1112
import android.util.AttributeSet;
1213
import android.util.Log;
@@ -133,7 +134,13 @@ private void update() {
133134
applyUserDefinitions(colors);
134135

135136
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+
137144
this.invalidate();
138145
}
139146

preview/Screenshot_Spotify.png

-524 KB
Loading

0 commit comments

Comments
 (0)