public void updateStickyView() { mSticky = findViewWithTag("sticky"); mStickyContainer = findViewWithTag("stickyContainer"); }
public StickyHeaderListView(Context context, AttributeSet attrs) { super(context, attrs); init(attrs, android.R.attr.listViewStyle); }
private void init(AttributeSet attrs, int defStyleAttr) { final TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.SuwStickyHeaderListView, defStyleAttr, 0); int headerResId = a.getResourceId(R.styleable.SuwStickyHeaderListView_suwHeader, 0); if (headerResId != 0) { LayoutInflater inflater = LayoutInflater.from(getContext()); View header = inflater.inflate(headerResId, this, false); addHeaderView(header, null, false); } a.recycle(); }
@Override protected void onLayout(boolean changed, int l, int t, int r, int b) { super.onLayout(changed, l, t, r, b); if (mSticky == null) { updateStickyView(); } }
@Override @TargetApi(Build.VERSION_CODES.LOLLIPOP) public WindowInsets onApplyWindowInsets(WindowInsets insets) { if (getFitsSystemWindows()) { mStatusBarInset = insets.getSystemWindowInsetTop(); insets.replaceSystemWindowInsets( insets.getSystemWindowInsetLeft(), 0, /* top */ insets.getSystemWindowInsetRight(), insets.getSystemWindowInsetBottom() ); } return insets; }
public StickyHeaderListView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(attrs, defStyleAttr); }
public StickyHeaderListView(Context context) { super(context); init(null, android.R.attr.listViewStyle); }