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

Commit 1a12b805 authored by Deepanshu Gupta's avatar Deepanshu Gupta
Browse files

LayoutLib: Fix warnings in ResourceHelper.

Fix intelliJ warnings in ResourceHelper. Most of them just change
boolean checks "x == false" with "!x".

Change-Id: I278645e2807affd8b3183a4a6f5e4fa2ab7b3d21
parent 458f2a7b
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -63,11 +63,11 @@ public final class ResourceHelper {
     * Returns the color value represented by the given string value
     * @param value the color value
     * @return the color as an int
     * @throw NumberFormatException if the conversion failed.
     * @throws NumberFormatException if the conversion failed.
     */
    public static int getColor(String value) {
        if (value != null) {
            if (value.startsWith("#") == false) {
            if (!value.startsWith("#")) {
                throw new NumberFormatException(
                        String.format("Color value '%s' must start with #", value));
            }
@@ -113,7 +113,7 @@ public final class ResourceHelper {

    public static ColorStateList getColorStateList(ResourceValue resValue, BridgeContext context) {
        String value = resValue.getValue();
        if (value != null && RenderResources.REFERENCE_NULL.equals(value) == false) {
        if (value != null && !RenderResources.REFERENCE_NULL.equals(value)) {
            // first check if the value is a file (xml most likely)
            File f = new File(value);
            if (f.isFile()) {
@@ -360,7 +360,7 @@ public final class ResourceHelper {
     */
    public static boolean parseFloatAttribute(String attribute, String value,
            TypedValue outValue, boolean requireUnit) {
        assert requireUnit == false || attribute != null;
        assert !requireUnit || attribute != null;

        // remove the space before and after
        value = value.trim();
@@ -411,7 +411,7 @@ public final class ResourceHelper {

            if (end.length() == 0) {
                if (outValue != null) {
                    if (requireUnit == false) {
                    if (!requireUnit) {
                        outValue.type = TypedValue.TYPE_FLOAT;
                        outValue.data = Float.floatToIntBits(f);
                    } else {
@@ -489,6 +489,8 @@ public final class ResourceHelper {

    private static void applyUnit(UnitEntry unit, TypedValue outValue, float[] outScale) {
        outValue.type = unit.type;
        // COMPLEX_UNIT_SHIFT is 0 and hence intelliJ complains about it. Suppress the warning.
        //noinspection PointlessBitwiseExpression
        outValue.data = unit.unit << TypedValue.COMPLEX_UNIT_SHIFT;
        outScale[0] = unit.scale;
    }