@Override protected void onMeasure(int widthSpec, int heightSpec) { super.onMeasure(widthSpec, heightSpec); if (mSticky != null) { measureChild(getHeader(), widthSpec, heightSpec); } }
@Override public void onClick(View view) { if (mListener != null) { if (view == getBackButton()) { mListener.onNavigateBack(); } else if (view == getNextButton()) { mListener.onNavigateNext(); } } } }
private void checkScroll() { if (mListener != null) { if (getScrollY() >= mScrollThreshold) { mListener.onScrolledToBottom(); } else if (!mRequiringScroll) { mRequiringScroll = true; mListener.onRequiresScroll(); } } }
private void tintDrawables() { final ColorStateList textColors = getTextColors(); if (textColors != null) { for (Drawable drawable : getAllCompoundDrawables()) { if (drawable instanceof TintedDrawable) { ((TintedDrawable) drawable).setTintListCompat(textColors); } } invalidate(); } }
@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(); } updateStickyHeaderPosition(); }
private void init() { // Unfortunately, drawableStart and drawableEnd set through XML does not call the setter, // so manually getting it and wrapping it in the compat drawable. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { Drawable[] drawables = getCompoundDrawablesRelative(); for (int i = 0; i < drawables.length; i++) { if (drawables[i] != null) { drawables[i] = TintedDrawable.wrap(drawables[i]); } } setCompoundDrawablesRelativeWithIntrinsicBounds(drawables[0], drawables[1], drawables[2], drawables[3]); } }
public void setStatusBarBackground(Drawable background) { mStatusBarBackground = background; if (Build.VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { setWillNotDraw(background == null); setFitsSystemWindows(background != null); invalidate(); } }
@Override public void setCompoundDrawablesRelative(Drawable start, Drawable top, Drawable end, Drawable bottom) { if (start != null) start = TintedDrawable.wrap(start); if (top != null) top = TintedDrawable.wrap(top); if (end != null) end = TintedDrawable.wrap(end); if (bottom != null) bottom = TintedDrawable.wrap(bottom); super.setCompoundDrawablesRelative(start, top, end, bottom); tintDrawables(); }
@Override protected void onScrollChanged(int l, int t, int oldl, int oldt) { super.onScrollChanged(l, t, oldl, oldt); updateStickyHeaderPosition(); }
/** * Sets the drawable used as the illustration. The drawable is expected to have intrinsic * width and height defined and will be scaled to fit the width of the view. */ public void setIllustration(Drawable illustration) { if (illustration == mIllustration) { return; } mIllustration = illustration; invalidate(); requestLayout(); }
public void setTintListCompat(ColorStateList colors) { mTintList = colors; if (updateState()) { invalidateSelf(); } }
public HeaderRecyclerView(Context context, AttributeSet attrs) { super(context, attrs); init(attrs, 0); }
protected void notifyRequiresScroll() { if (!mScrollNeeded && !mScrollNotified) { mNavigationBar.post(new Runnable() { @Override public void run() { mNavigationBar.getNextButton().setVisibility(View.GONE); mNavigationBar.getMoreButton().setVisibility(View.VISIBLE); } }); mScrollNeeded = true; } }
@Override public void onItemRangeMoved(int fromPosition, int toPosition, int itemCount) { // Why is there no notifyItemRangeMoved? notifyDataSetChanged(); }
@Override public void onItemRangeRemoved(int positionStart, int itemCount) { notifyItemRangeRemoved(positionStart, itemCount); } };
public StatusBarBackgroundLayout(Context context, AttributeSet attrs) { super(context, attrs); init(context, attrs, 0); }
public StickyHeaderListView(Context context, AttributeSet attrs) { super(context, attrs); init(attrs, android.R.attr.listViewStyle); }
public NavigationBarButton(Context context, AttributeSet attrs) { super(context, attrs); init(); }
@Override public void setCompoundDrawables(Drawable left, Drawable top, Drawable right, Drawable bottom) { if (left != null) left = TintedDrawable.wrap(left); if (top != null) top = TintedDrawable.wrap(top); if (right != null) right = TintedDrawable.wrap(right); if (bottom != null) bottom = TintedDrawable.wrap(bottom); super.setCompoundDrawables(left, top, right, bottom); tintDrawables(); }
public HeaderRecyclerView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(attrs, defStyleAttr); }