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

Commit 0f5fadcb authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Set the bidi flags on Paints in DonutView" into oc-mr1-dev

parents 1d6cec8c 4fb3e719
Loading
Loading
Loading
Loading
+12 −0
Original line number Original line Diff line number Diff line
@@ -26,11 +26,15 @@ import android.graphics.PorterDuffColorFilter;
import android.graphics.Typeface;
import android.graphics.Typeface;
import android.support.annotation.ColorRes;
import android.support.annotation.ColorRes;
import android.text.TextPaint;
import android.text.TextPaint;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.AttributeSet;
import android.view.View;
import android.view.View;

import com.android.settings.R;
import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.Utils;


import java.util.Locale;

/**
/**
 * DonutView represents a donut graph. It visualizes a certain percentage of fullness with a
 * DonutView represents a donut graph. It visualizes a certain percentage of fullness with a
 * corresponding label with the fullness on the inside (i.e. "50%" inside of the donut).
 * corresponding label with the fullness on the inside (i.e. "50%" inside of the donut).
@@ -101,12 +105,19 @@ public class DonutView extends View {
            mFilledArc.setColorFilter(mAccentColorFilter);
            mFilledArc.setColorFilter(mAccentColorFilter);
        }
        }


        final Locale locale = resources.getConfiguration().locale;
        final int layoutDirection = TextUtils.getLayoutDirectionFromLocale(locale);
        final int bidiFlags = (layoutDirection == LAYOUT_DIRECTION_LTR)
                ? Paint.BIDI_LTR
                : Paint.BIDI_RTL;

        mTextPaint = new TextPaint();
        mTextPaint = new TextPaint();
        mTextPaint.setColor(Utils.getColorAccent(getContext()));
        mTextPaint.setColor(Utils.getColorAccent(getContext()));
        mTextPaint.setAntiAlias(true);
        mTextPaint.setAntiAlias(true);
        mTextPaint.setTextSize(
        mTextPaint.setTextSize(
                resources.getDimension(R.dimen.storage_donut_view_label_text_size));
                resources.getDimension(R.dimen.storage_donut_view_label_text_size));
        mTextPaint.setTextAlign(Paint.Align.CENTER);
        mTextPaint.setTextAlign(Paint.Align.CENTER);
        mTextPaint.setBidiFlags(bidiFlags);


        mBigNumberPaint = new TextPaint();
        mBigNumberPaint = new TextPaint();
        mBigNumberPaint.setColor(Utils.getColorAccent(getContext()));
        mBigNumberPaint.setColor(Utils.getColorAccent(getContext()));
@@ -117,6 +128,7 @@ public class DonutView extends View {
        mBigNumberPaint.setTypeface(Typeface.create(
        mBigNumberPaint.setTypeface(Typeface.create(
                context.getString(com.android.internal.R.string.config_headlineFontFamily),
                context.getString(com.android.internal.R.string.config_headlineFontFamily),
                Typeface.NORMAL));
                Typeface.NORMAL));
        mBigNumberPaint.setBidiFlags(bidiFlags);
    }
    }


    @Override
    @Override