@Override
    protected void onBoundsChange(Rect bounds) {
        super.onBoundsChange(bounds);
        if (bounds.left == 0 && bounds.top == 0 && bounds.right == 0 && bounds.bottom == 0) {
            return;
        }

        mStartX = bounds.left;
        mEndX = bounds.right;

        mCenterY = bounds.centerY();

        mMaxForegroundLine = (mEndX - mStartX) * 0.5f;

        // in this we update the progress
        if (mProgress != 0) {
            onProgressChange(mProgress);
        }
    }
A drawable to draw loading form Line Type
caprice/ui/src/main/java/net/qiujuer/genius/ui/drawable/LoadingLineDrawable.java