Skip to content

Commit

Permalink
v 1.0.3
Browse files Browse the repository at this point in the history
- Fixed #7 Shadow doesn't change size when child view gets smaller.
  • Loading branch information
dmytrodanylyk committed Mar 30, 2015
1 parent fa0516c commit ef473f3
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 23 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 1.0.3
* Fixed #7 Shadow doesn't change size when child view gets smaller.

## 1.0.2

* Switched bitmap config from `Bitmap.Config.ARGB_8888` to `Bitmap.Config.ALPHA_8` to reduce generated shadow bitmap memory (x4 times)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The lib is available on Maven Central, you can find it with [Gradle, please]

```
dependencies {
compile 'com.github.dmytrodanylyk.shadow-layout:library:1.0.2'
compile 'com.github.dmytrodanylyk.shadow-layout:library:1.0.3'
}
```

Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
VERSION_NAME=1.0.2
VERSION_CODE=3
VERSION_NAME=1.0.3
VERSION_CODE=4

GROUP=com.github.dmytrodanylyk.shadow-layout

Expand Down
41 changes: 21 additions & 20 deletions library/src/main/java/com/dd/ShadowLayout.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ public ShadowLayout(Context context, AttributeSet attrs, int defStyleAttr) {
initView(context, attrs);
}

@Override
protected int getSuggestedMinimumWidth() {
return 0;
}

@Override
protected int getSuggestedMinimumHeight() {
return 0;
}

@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
Expand All @@ -49,10 +59,20 @@ protected void onLayout(boolean changed, int left, int top, int right, int botto
super.onLayout(changed, left, top, right, bottom);
if (mForceInvalidateShadow) {
mForceInvalidateShadow = false;
setBackgroundCompat(right-left, bottom-top);
setBackgroundCompat(right - left, bottom - top);
}
}

public void setInvalidateShadowOnSizeChanged(boolean invalidateShadowOnSizeChanged) {
mInvalidateShadowOnSizeChanged = invalidateShadowOnSizeChanged;
}

public void invalidateShadow() {
mForceInvalidateShadow = true;
requestLayout();
invalidate();
}

private void initView(Context context, AttributeSet attrs) {
initAttributes(context, attrs);

Expand Down Expand Up @@ -136,23 +156,4 @@ private Bitmap createShadowBitmap(int shadowWidth, int shadowHeight, float corne
return output;
}

@Override
protected int getSuggestedMinimumWidth() {
return 0;
}

@Override
protected int getSuggestedMinimumHeight() {
return 0;
}

public void setInvalidateShadowOnSizeChanged(boolean invalidateShadowOnSizeChanged) {
this.mInvalidateShadowOnSizeChanged = invalidateShadowOnSizeChanged;
}

public void invalidateShadow() {
this.mForceInvalidateShadow = true;
requestLayout();
invalidate();
}
}

0 comments on commit ef473f3

Please sign in to comment.