Loading src/com/android/settings/widget/DonutView.java +12 −0 Original line number Original line Diff line number Diff line Loading @@ -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). Loading Loading @@ -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())); Loading @@ -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 Loading Loading
src/com/android/settings/widget/DonutView.java +12 −0 Original line number Original line Diff line number Diff line Loading @@ -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). Loading Loading @@ -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())); Loading @@ -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 Loading