Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2a557970 authored by Danesh Mondegarian's avatar Danesh Mondegarian Committed by Steve Kondik
Browse files

CircleBattery : Add RTL support

Use paddingStart for rtl compatibility

Change-Id: I6c61dfe460eb31c25013c68928935c54dc18baff
parent 891a597b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -160,7 +160,7 @@
                android:layout_height="match_parent"
                android:singleLine="true"
                android:paddingStart="6dip"
                android:gravity="center_vertical|left"
                android:gravity="center_vertical|start"
                android:clickable="false"
                />
        </LinearLayout>
+5 −5
Original line number Diff line number Diff line
@@ -207,7 +207,7 @@ public class CircleBattery extends ImageView implements BatteryController.Batter
            initSizeMeasureIconHeight();
        }

        setMeasuredDimension(mCircleSize + getPaddingLeft(), mCircleSize);
        setMeasuredDimension(mCircleSize + getPaddingStart(), mCircleSize);
    }

    protected int getBatteryLevel() {
@@ -310,14 +310,14 @@ public class CircleBattery extends ImageView implements BatteryController.Batter
        mPaintGray.setStrokeWidth(strokeWidth / 3.5f);

        // calculate rectangle for drawArc calls
        int pLeft = getPaddingLeft();
        mRectLeft = new RectF(pLeft + strokeWidth / 2.0f, 0 + strokeWidth / 2.0f, mCircleSize
                - strokeWidth / 2.0f + pLeft, mCircleSize - strokeWidth / 2.0f);
        int pLeft = getPaddingStart();
        mRectLeft = new RectF(pLeft/2 + strokeWidth / 2.0f, 0 + strokeWidth / 2.0f, mCircleSize
                - strokeWidth / 2.0f + pLeft/2, mCircleSize - strokeWidth / 2.0f);

        // calculate Y position for text
        Rect bounds = new Rect();
        mPaintFont.getTextBounds("99", 0, "99".length(), bounds);
        mTextLeftX = mCircleSize / 2.0f + getPaddingLeft();
        mTextLeftX = mCircleSize / 2.0f + getPaddingStart();
        // the +1 at end of formular balances out rounding issues. works out on all resolutions
        mTextY = mCircleSize / 2.0f + (bounds.bottom - bounds.top) / 2.0f - strokeWidth / 2.0f + 1;