diff options
-rw-r--r-- | packages/SystemUI/res/layout/system_icons.xml | 1 | ||||
-rw-r--r-- | packages/SystemUI/res/values-hdpi/dimens.xml | 7 | ||||
-rw-r--r-- | packages/SystemUI/res/values-mdpi/dimens.xml | 7 | ||||
-rw-r--r-- | packages/SystemUI/res/values-tvdpi/dimens.xml | 7 | ||||
-rw-r--r-- | packages/SystemUI/res/values-xhdpi/dimens.xml | 27 | ||||
-rw-r--r-- | packages/SystemUI/res/values-xxhdpi/dimens.xml | 25 | ||||
-rw-r--r-- | packages/SystemUI/res/values/dimens.xml | 7 | ||||
-rwxr-xr-x | packages/SystemUI/src/com/android/systemui/BatteryMeterView.java | 25 |
8 files changed, 96 insertions, 10 deletions
diff --git a/packages/SystemUI/res/layout/system_icons.xml b/packages/SystemUI/res/layout/system_icons.xml index c4b8794..8f25d99 100644 --- a/packages/SystemUI/res/layout/system_icons.xml +++ b/packages/SystemUI/res/layout/system_icons.xml @@ -36,5 +36,6 @@ <com.android.systemui.BatteryMeterView android:id="@+id/battery" android:layout_height="14.5dp" android:layout_width="9.5dp" + android:layout_marginBottom="@dimen/battery_margin_bottom" android:layout_marginStart="7dp"/> </LinearLayout>
\ No newline at end of file diff --git a/packages/SystemUI/res/values-hdpi/dimens.xml b/packages/SystemUI/res/values-hdpi/dimens.xml index 799619f..10b00eb 100644 --- a/packages/SystemUI/res/values-hdpi/dimens.xml +++ b/packages/SystemUI/res/values-hdpi/dimens.xml @@ -18,4 +18,11 @@ <resources> <!-- Margin on the right side of the system icon group on Keyguard. --> <fraction name="battery_button_height_fraction">10.5%</fraction> + + <!-- Fraction value to smooth the edges of the battery icon. The path will be inset by this + fraction of a pixel.--> + <fraction name="battery_subpixel_smoothing_left">20%</fraction> + <fraction name="battery_subpixel_smoothing_right">12%</fraction> + + <dimen name="battery_margin_bottom">1px</dimen> </resources> diff --git a/packages/SystemUI/res/values-mdpi/dimens.xml b/packages/SystemUI/res/values-mdpi/dimens.xml index 7667f3e..aa85d69 100644 --- a/packages/SystemUI/res/values-mdpi/dimens.xml +++ b/packages/SystemUI/res/values-mdpi/dimens.xml @@ -17,4 +17,11 @@ <resources> <!-- Margin on the right side of the system icon group on Keyguard. --> <fraction name="battery_button_height_fraction">12%</fraction> + + <!-- Fraction value to smooth the edges of the battery icon. The path will be inset by this + fraction of a pixel.--> + <fraction name="battery_subpixel_smoothing_left">10%</fraction> + <fraction name="battery_subpixel_smoothing_right">10%</fraction> + + <dimen name="battery_margin_bottom">1px</dimen> </resources> diff --git a/packages/SystemUI/res/values-tvdpi/dimens.xml b/packages/SystemUI/res/values-tvdpi/dimens.xml index 7667f3e..5327cee 100644 --- a/packages/SystemUI/res/values-tvdpi/dimens.xml +++ b/packages/SystemUI/res/values-tvdpi/dimens.xml @@ -17,4 +17,11 @@ <resources> <!-- Margin on the right side of the system icon group on Keyguard. --> <fraction name="battery_button_height_fraction">12%</fraction> + + <!-- Fraction value to smooth the edges of the battery icon. The path will be inset by this + fraction of a pixel.--> + <fraction name="battery_subpixel_smoothing_left">10%</fraction> + <fraction name="battery_subpixel_smoothing_right">10%</fraction> + + <dimen name="battery_margin_bottom">1px</dimen> </resources> diff --git a/packages/SystemUI/res/values-xhdpi/dimens.xml b/packages/SystemUI/res/values-xhdpi/dimens.xml new file mode 100644 index 0000000..144b225 --- /dev/null +++ b/packages/SystemUI/res/values-xhdpi/dimens.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> + +<!-- + ~ Copyright (C) 2014 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> + +<resources> + + <!-- Fraction value to smooth the edges of the battery icon. The path will be inset by this + fraction of a pixel.--> + <fraction name="battery_subpixel_smoothing_left">25%</fraction> + <fraction name="battery_subpixel_smoothing_right">12.5%</fraction> + + <dimen name="battery_margin_bottom">0dp</dimen> +</resources> diff --git a/packages/SystemUI/res/values-xxhdpi/dimens.xml b/packages/SystemUI/res/values-xxhdpi/dimens.xml new file mode 100644 index 0000000..26c8437 --- /dev/null +++ b/packages/SystemUI/res/values-xxhdpi/dimens.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> + +<!-- + ~ Copyright (C) 2014 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> + +<resources> + + <!-- Fraction value to smooth the edges of the battery icon. The path will be inset by this + fraction of a pixel.--> + <fraction name="battery_subpixel_smoothing_left">33%</fraction> + <fraction name="battery_subpixel_smoothing_right">33%</fraction> +</resources> diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 122a728..946914b 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -469,4 +469,11 @@ <!-- Margin on the right side of the system icon group on Keyguard. --> <fraction name="battery_button_height_fraction">10.5%</fraction> + + <!-- Fraction value to smooth the edges of the battery icon. The path will be inset by this + fraction of a pixel.--> + <fraction name="battery_subpixel_smoothing_left">0%</fraction> + <fraction name="battery_subpixel_smoothing_right">0%</fraction> + + <dimen name="battery_margin_bottom">0dp</dimen> </resources> diff --git a/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java b/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java index d24ec66..7bdbd0a 100755 --- a/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java +++ b/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java @@ -46,13 +46,14 @@ public class BatteryMeterView extends View implements DemoMode, private static final int FULL = 96; - private static final float SUBPIXEL = 0.33f; // inset rects for softer edges private static final float BOLT_LEVEL_THRESHOLD = 0.3f; // opaque bolt below this fraction private final int[] mColors; boolean mShowPercent = true; private float mButtonHeightFraction; + private float mSubpixelSmoothingLeft; + private float mSubpixelSmoothingRight; private final Paint mFramePaint, mBatteryPaint, mWarningTextPaint, mTextPaint, mBoltPaint; private float mTextHeight, mWarningTextHeight; @@ -208,6 +209,10 @@ public class BatteryMeterView extends View implements DemoMode, com.android.internal.R.integer.config_criticalBatteryWarningLevel); mButtonHeightFraction = context.getResources().getFraction( R.fraction.battery_button_height_fraction, 1, 1); + mSubpixelSmoothingLeft = context.getResources().getFraction( + R.fraction.battery_subpixel_smoothing_left, 1, 1); + mSubpixelSmoothingRight = context.getResources().getFraction( + R.fraction.battery_subpixel_smoothing_right, 1, 1); mFramePaint = new Paint(Paint.ANTI_ALIAS_FLAG); mFramePaint.setColor(frameColor); @@ -314,21 +319,21 @@ public class BatteryMeterView extends View implements DemoMode, // button-frame: area above the battery body mButtonFrame.set( - mFrame.left + width * 0.25f, + mFrame.left + Math.round(width * 0.25f), mFrame.top, - mFrame.right - width * 0.25f, + mFrame.right - Math.round(width * 0.25f), mFrame.top + buttonHeight); - mButtonFrame.top += SUBPIXEL; - mButtonFrame.left += SUBPIXEL; - mButtonFrame.right -= SUBPIXEL; + mButtonFrame.top += mSubpixelSmoothingLeft; + mButtonFrame.left += mSubpixelSmoothingLeft; + mButtonFrame.right -= mSubpixelSmoothingRight; // frame: battery body area mFrame.top += buttonHeight; - mFrame.left += SUBPIXEL; - mFrame.top += SUBPIXEL; - mFrame.right -= SUBPIXEL; - mFrame.bottom -= SUBPIXEL; + mFrame.left += mSubpixelSmoothingLeft; + mFrame.top += mSubpixelSmoothingLeft; + mFrame.right -= mSubpixelSmoothingRight; + mFrame.bottom -= mSubpixelSmoothingRight; // set the battery charging color mBatteryPaint.setColor(tracker.plugged ? mChargeColor : getColorForLevel(level)); |