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

Commit d05b02a5 authored by Amin Shaikh's avatar Amin Shaikh Committed by android-build-merger
Browse files

Merge "Set battery paths for each themes." into qt-dev

am: 4e410892

Change-Id: Ia7d4d06cd0c7bea30aedca51852978409fc167cb
parents 2cfb6019 4e410892
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -4006,7 +4006,7 @@
    <string name="config_batterymeterPerimeterPath" translatable="false">
    <string name="config_batterymeterPerimeterPath" translatable="false">
		M3.5,2 v0 H1.33 C0.6,2 0,2.6 0,3.33 V13v5.67 C0,19.4 0.6,20 1.33,20 h9.33 C11.4,20 12,19.4 12,18.67 V13V3.33 C12,2.6 11.4,2 10.67,2 H8.5 V0 H3.5 z M2,18v-7V4h8v9v5H2L2,18z
		M3.5,2 v0 H1.33 C0.6,2 0,2.6 0,3.33 V13v5.67 C0,19.4 0.6,20 1.33,20 h9.33 C11.4,20 12,19.4 12,18.67 V13V3.33 C12,2.6 11.4,2 10.67,2 H8.5 V0 H3.5 z M2,18v-7V4h8v9v5H2L2,18z
    </string>
    </string>

    <string name="config_batterymeterErrorPerimeterPath" translatable="false">@string/config_batterymeterPerimeterPath</string>
    <string name="config_batterymeterFillMask" translatable="false">
    <string name="config_batterymeterFillMask" translatable="false">
        M2,18 v-14 h8 v14 z
        M2,18 v-14 h8 v14 z
    </string>
    </string>
+1 −0
Original line number Original line Diff line number Diff line
@@ -3240,6 +3240,7 @@


  <java-symbol type="string" name="config_icon_mask" />
  <java-symbol type="string" name="config_icon_mask" />
  <java-symbol type="string" name="config_batterymeterPerimeterPath" />
  <java-symbol type="string" name="config_batterymeterPerimeterPath" />
  <java-symbol type="string" name="config_batterymeterErrorPerimeterPath" />
  <java-symbol type="string" name="config_batterymeterFillMask" />
  <java-symbol type="string" name="config_batterymeterFillMask" />
  <java-symbol type="string" name="config_batterymeterBoltPath" />
  <java-symbol type="string" name="config_batterymeterBoltPath" />
  <java-symbol type="string" name="config_batterymeterPowersavePath" />
  <java-symbol type="string" name="config_batterymeterPowersavePath" />
+10 −3
Original line number Original line Diff line number Diff line
@@ -44,6 +44,8 @@ open class ThemedBatteryDrawable(private val context: Context, frameColor: Int)
    //    doesn't touch the walls
    //    doesn't touch the walls
    private val perimeterPath = Path()
    private val perimeterPath = Path()
    private val scaledPerimeter = Path()
    private val scaledPerimeter = Path()
    private val errorPerimeterPath = Path()
    private val scaledErrorPerimeter = Path()
    // Fill will cover the whole bounding rect of the fillMask, and be masked by the path
    // Fill will cover the whole bounding rect of the fillMask, and be masked by the path
    private val fillMask = Path()
    private val fillMask = Path()
    private val scaledFill = Path()
    private val scaledFill = Path()
@@ -242,7 +244,7 @@ open class ThemedBatteryDrawable(private val context: Context, frameColor: Int)
            }
            }
        } else if (powerSaveEnabled) {
        } else if (powerSaveEnabled) {
            // If power save is enabled draw the perimeter path with colorError
            // If power save is enabled draw the perimeter path with colorError
            c.drawPath(scaledPerimeter, errorPaint)
            c.drawPath(scaledErrorPerimeter, errorPaint)
            // And draw the plus sign on top of the fill
            // And draw the plus sign on top of the fill
            c.drawPath(scaledPlus, errorPaint)
            c.drawPath(scaledPlus, errorPaint)
        }
        }
@@ -364,6 +366,7 @@ open class ThemedBatteryDrawable(private val context: Context, frameColor: Int)
        }
        }


        perimeterPath.transform(scaleMatrix, scaledPerimeter)
        perimeterPath.transform(scaleMatrix, scaledPerimeter)
        errorPerimeterPath.transform(scaleMatrix, scaledErrorPerimeter)
        fillMask.transform(scaleMatrix, scaledFill)
        fillMask.transform(scaleMatrix, scaledFill)
        scaledFill.computeBounds(fillRect, true)
        scaledFill.computeBounds(fillRect, true)
        boltPath.transform(scaleMatrix, scaledBolt)
        boltPath.transform(scaleMatrix, scaledBolt)
@@ -382,8 +385,12 @@ open class ThemedBatteryDrawable(private val context: Context, frameColor: Int)
        val pathString = context.resources.getString(
        val pathString = context.resources.getString(
                com.android.internal.R.string.config_batterymeterPerimeterPath)
                com.android.internal.R.string.config_batterymeterPerimeterPath)
        perimeterPath.set(PathParser.createPathFromPathData(pathString))
        perimeterPath.set(PathParser.createPathFromPathData(pathString))
        val b = RectF()
        perimeterPath.computeBounds(RectF(), true)
        perimeterPath.computeBounds(b, true)

        val errorPathString = context.resources.getString(
                com.android.internal.R.string.config_batterymeterErrorPerimeterPath)
        errorPerimeterPath.set(PathParser.createPathFromPathData(errorPathString))
        errorPerimeterPath.computeBounds(RectF(), true)


        val fillMaskString = context.resources.getString(
        val fillMaskString = context.resources.getString(
                com.android.internal.R.string.config_batterymeterFillMask)
                com.android.internal.R.string.config_batterymeterFillMask)
+33 −0
Original line number Original line Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
 * Copyright 2019, 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 xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
    <string name="config_batterymeterPerimeterPath" translatable="false">
        M 8,1 C 8,0.45 7.55,0 7,0 H 5 C 4.45,0 4,0.45 4,1 H 3 C 1.34,1 0,2.34 0,4 V 17 C 0,18.66 1.34,20 3,20 H 9 C 10.66,20 12,18.66 12,17 V 4 C 12,2.34 10.66,1 9,1 Z M 10.5,4 V 17 C 10.5,17.83 9.83,18.5 9,18.5 H 3 C 2.17,18.5 1.5,17.83 1.5,17 V 4 C 1.5,3.17 2.17,2.5 3,2.5 H 9 C 9.83,2.5 10.5,3.17 10.5,4 Z
    </string>
    <string name="config_batterymeterFillMask" translatable="false">
        M 10.5,4 V 17 C 10.5,17.83 9.83,18.5 9,18.5 H 3 C 2.17,18.5 1.5,17.83 1.5,17 V 4 C 1.5,3.17 2.17,2.5 3,2.5 H 9 C 9.83,2.5 10.5,3.17 10.5,4 Z
    </string>
    <string name="config_batterymeterBoltPath" translatable="false">
        M 8.08,9.5 H 7 V 5.99 C 7,5.73 6.65,5.64 6.53,5.87 L 3.7,11.13 C 3.61,11.3 3.73,11.5 3.92,11.5 H 5 V 15.01 C 5,15.27 5.35,15.36 5.47,15.13 L 8.3,9.87 C 8.39,9.7 8.27,9.5 8.08,9.5 Z
    </string>
    <string name="config_batterymeterPowersavePath" translatable="false">
        M 3.75,11.25 H 5.25 V 12.75 C 5.25,13.16 5.59,13.5 6,13.5 6.41,13.5 6.75,13.16 6.75,12.75 V 11.25 H 8.25 C 8.66,11.25 9,10.91 9,10.5 9,10.09 8.6601,9.75 8.25,9.75 H 6.75 V 8.25 C 6.75,7.84 6.41,7.5 6,7.5 5.59,7.5 5.25,7.84 5.25,8.25 V 9.75 H 3.75 C 3.34,9.75 3,10.09 3,10.5 3,10.91 3.34,11.25 3.75,11.25 Z
    </string>
</resources>
+36 −0
Original line number Original line Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
/**
 * Copyright (c) 2019, 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 xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
    <string name="config_batterymeterPerimeterPath" translatable="false">
        M 4,0 V 2 H 2.33 C 1.6,2 1,2.6 1,3.33 V 18.66 C 1,19.4 1.6,20 2.33,20 H 9.66 C 10.4,20 11,19.4 11,18.67 V 3.33 C 11,2.6 10.4,2 9.67,2 H 8 V 0 Z
    </string>
    <string name="config_batterymeterErrorPerimeterPath" translatable="false">
        M 3.5,0 V 0.5 1.5 H 2.3301 C 1.3261,1.5 0.5,2.3261 0.5,3.3301 V 18.16 C 0.5,19.17 1.3261,20 2.3301,20 H 9.6602 C 10.67,20 11.5,19.174 11.5,18.17 V 3.3301 C 11.5,2.3261 10.674,1.5 9.6699,1.5 H 8.5 V 0 Z M 9.1698,2.9999 C 9.6259,2.9999 9.9999,3.374 9.9999,3.83 V 17.67 C 9.9999,18.126 9.6299,18.5 9.1601,18.5 H 2.83 C 2.3741,18.5 2,18.13 2,17.66 V 3.83 C 2,3.374 2.3741,2.9999 2.83,2.9999 Z
    </string>
    <string name="config_batterymeterFillMask" translatable="false">
        M 4,0 V 2 H 2.33 C 1.6,2 1,2.6 1,3.33 V 18.66 C 1,19.4 1.6,20 2.33,20 H 9.66 C 10.4,20 11,19.4 11,18.67 V 3.33 C 11,2.6 10.4,2 9.67,2 H 8 V 0 Z
    </string>
    <string name="config_batterymeterBoltPath" translatable="false">
        M 8.58,10 C 8.77,10 8.89,10.2 8.8,10.37 L 5.94,15.74 C 5.7,16.19 5,16.02 5,15.5 V 12 H 3.42 C 3.23,12 3.11,11.8 3.2,11.63 L 6.06,6.26 C 6.3,5.81 7,5.98 7,6.5 V 10 Z
    </string>
    <string name="config_batterymeterPowersavePath" translatable="false">
        M 9,11 C 9,11.55 8.55,12 8,12 H 7 V 13 C 7,13.55 6.55,14 6,14 5.45,14 5,13.55 5,13 V 12 H 4 C 3.45,12 3,11.55 3,11 3,10.45 3.45,10.005 4,10 H 5 V 9 C 5,8.45 5.45,8 6,8 6.55,8 7,8.45 7,9 V 10 H 8 C 8.55,10 9,10.45 9,11 Z
    </string>
    <bool name="config_batterymeterDualTone">true</bool>
</resources>
Loading