Skip to content

Commit

Permalink
Provide a default shadow for the pinned header...
Browse files Browse the repository at this point in the history
Unfortunately I haven't been able to get the 'shadowDrawable' attribute
working in the dependent project - this was the config...


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              xmlns:phl="com.madgag.android.listviews.pinnedheader"
	android:layout_width="fill_parent"
	android:layout_height="fill_parent">

    <com.madgag.android.listviews.pinnedheader.PinnedHeaderLayout
            phl:shadowDrawable="@drawable/black_white_gradient"
		android:layout_width="fill_parent"
		android:layout_height="fill_parent">
  • Loading branch information
rtyley committed May 29, 2011
1 parent c646ef1 commit 5de49b5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
8 changes: 8 additions & 0 deletions res/drawable/shadow.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<gradient
android:startColor= "#00ffffff"
android:centerColor="#88d3d7cf"
android:endColor= "#ff2e3436"
android:angle="90"/>
</shape>
1 change: 0 additions & 1 deletion res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,3 @@
<attr name="shadowDrawable" format="reference"/>
</declare-styleable>
</resources>

Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,12 @@
import android.view.ViewGroup;
import android.widget.ExpandableListView;

import static com.madgag.android.listviews.pinnedheader.R.drawable.shadow;
import static com.madgag.android.listviews.pinnedheader.R.styleable.PinnedHeaderLayout_shadowDrawable;

public class PinnedHeaderLayout extends ViewGroup implements PinnedHeaderTrait.HeaderViewGroupAttacher {

private Drawable shadowDrawable; // getResources().getDrawable(R.drawable.black_white_gradient);
private Drawable shadowDrawable;
private static final String TAG = "PHL";

private PinnedHeaderTrait pinnedHeaderTrait;
Expand All @@ -45,7 +48,10 @@ public PinnedHeaderLayout(Context context, AttributeSet attrs) {
super(context, attrs);

TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.PinnedHeaderLayout);
shadowDrawable=typedArray.getDrawable(R.styleable.PinnedHeaderLayout_shadowDrawable);
shadowDrawable=typedArray.getDrawable(PinnedHeaderLayout_shadowDrawable);
if (shadowDrawable==null) {
shadowDrawable = getResources().getDrawable(shadow);
}
}

@Override
Expand Down

0 comments on commit 5de49b5

Please sign in to comment.