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

Commit 54b610f3 authored by Jason Monk's avatar Jason Monk
Browse files

Fix RTL for SignalDrawable

Test: visual
Change-Id: I685125dff96829159d78983ad4b7c7f91d095c5c
Fixes: 38487767
parent b80cffad
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import android.graphics.Path.Op;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.util.LayoutDirection;
import android.util.Log;

import com.android.settingslib.R;
@@ -192,6 +193,13 @@ public class SignalDrawable extends Drawable {

    @Override
    public void draw(@NonNull Canvas canvas) {
        boolean isRtl = getLayoutDirection() == LayoutDirection.RTL;
        if (isRtl) {
            canvas.save();
            // Mirror the drawable
            canvas.translate(canvas.getWidth(), 0);
            canvas.scale(-1.0f, 1.0f);
        }
        mFullPath.reset();
        mFullPath.setFillType(FillType.WINDING);
        float width = getBounds().width();
@@ -250,6 +258,9 @@ public class SignalDrawable extends Drawable {
            }
            canvas.drawPath(mXPath, mForegroundPaint);
        }
        if (isRtl) {
            canvas.restore();
        }
    }

    private void drawDot(Path fullPath, Path foregroundPath, float x, float y, float dotSize,