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

Unverified Commit 49936e12 authored by d34d's avatar d34d Committed by Michael Bestas
Browse files

SystemUI: Add VectorDrawable battery styles

The current implementation of BatteryMeterView uses arrays of points
that are drawn programmatically.  This limits the ability to overlay
or theme the battery. By utilizing VectorDrawables and
AnimatedVectorDrawables we can achieve the same look and feel of
stock while allowing for more unique battery meters.

Implement portrait, landscape and circle AVD battery styles.
The various dimensions adjustments are to accommodate the
slightly different sizes of the AVD battery styles.

Forward port the AVD battery commits from CM 13.0:
db5cf5dc SysUI: Use VectorDrawable's for rendering battery
d37a5aa5 SysUI: Fix coloring of frame and bolt
2b21b18e SysUI: Use linear interpolator for battery level
5953be01 SysUI: Allow styling of battery text/charge blend mode
e3ddac3a SysUI: Adjust battery dimensions for better look
1530ec9e SystemUI: Set circle battery path as untranslatable

Change-Id: I91b4f5229774c979a7aa9ab771ffcb95ceb71b84
parent af7d8cf9
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -31,7 +31,8 @@ LOCAL_STATIC_JAVA_LIBRARIES := \
    android-support-v4 \
    framework-protos \
    SystemUI-proto-tags \
    org.cyanogenmod.platform.internal
    org.cyanogenmod.platform.internal \
    uicommon

LOCAL_JAVA_LIBRARIES := telephony-common telephony-ext
LOCAL_FULL_LIBS_MANIFEST_FILES := $(LOCAL_PATH)/AndroidManifest_cm.xml
+23 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright (C) 2016 The CyanogenMod 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.
-->
<objectAnimator
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:interpolator="@android:interpolator/linear"
  android:propertyName="trimPathEnd"
  android:valueFrom="0"
  android:valueTo="1"
  android:valueType="floatType" />
+23 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright (C) 2016 The CyanogenMod 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.
-->
<objectAnimator
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:interpolator="@android:interpolator/linear"
  android:propertyName="pathData"
  android:valueFrom="@string/battery_landscape_path_empty"
  android:valueTo="@string/battery_landscape_path_full"
  android:valueType="pathType" />
+23 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright (C) 2016 The CyanogenMod 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.
-->
<objectAnimator
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:interpolator="@android:interpolator/linear"
  android:propertyName="pathData"
  android:valueFrom="@string/battery_portrait_path_empty"
  android:valueTo="@string/battery_portrait_path_full"
  android:valueType="pathType" />
+27 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright (C) 2016 The CyanogenMod 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24"
    android:viewportHeight="24"
    android:tint="@color/batterymeter_bolt_color">

    <path
        android:fillColor="#000000"
        android:pathData="M10.5,7h5l-2,4h3l-7,6l2-5H8.5L10.5,7z" />
</vector>
Loading