Thanks for your contribution. The text size should be passed in as a dimension resource rather than a pixel size. This allows the text size to adjust according to the user's text preferences, and doesn't restrict developers to providing a pixel size only.
app:fastScrollPopupTextSize="56sp"
as opposed to
app:fastScrollPopupTextSize="56"
The value would be retrieved with:
typedArray.getDimensionPixelSize(R.styleable.FastScrollRecyclerView_fastScrollPopupTextSize, 56);
as opposed to
typedArray.getInt(R.styleable.FastScrollRecyclerView_fastScrollPopupTextSize, 56);
And set with:
mTextPaint.setTextSize(TypedValue.COMPLEX_UNIT_PX, size));
as opposed to
mTextPaint.setTextSize(Utils.toPixels(mRes, size));
Also, rather than hardcoding the background size to textSize + 32, we should probably just provide a setter for background size that defaults to textSize+32. That way, someone could potentially use a very small text size without resulting in a very small fast scroll popup.
Thanks for your contribution. The text size should be passed in as a dimension resource rather than a pixel size. This allows the text size to adjust according to the user's text preferences, and doesn't restrict developers to providing a pixel size only.
app:fastScrollPopupTextSize="56sp"
as opposed toapp:fastScrollPopupTextSize="56"
The value would be retrieved with:
typedArray.getDimensionPixelSize(R.styleable.FastScrollRecyclerView_fastScrollPopupTextSize, 56);
as opposed totypedArray.getInt(R.styleable.FastScrollRecyclerView_fastScrollPopupTextSize, 56);
And set with:
mTextPaint.setTextSize(TypedValue.COMPLEX_UNIT_PX, size));
as opposed tomTextPaint.setTextSize(Utils.toPixels(mRes, size));
Also, rather than hardcoding the background size to textSize + 32, we should probably just provide a setter for background size that defaults to textSize+32. That way, someone could potentially use a very small text size without resulting in a very small fast scroll popup.