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

Commit 8df6131a authored by Deepanshu Gupta's avatar Deepanshu Gupta Committed by Android Git Automerger
Browse files

am 50e1406a: am f6b08547: Show better error message for color attr not found. [DO NOT MERGE]

* commit '50e1406a':
  Show better error message for color attr not found. [DO NOT MERGE]
parents 59f026e9 50e1406a
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.layoutlib.bridge.impl;

import com.android.SdkConstants;
import com.android.annotations.NonNull;
import com.android.ide.common.rendering.api.DensityBasedResourceValue;
import com.android.ide.common.rendering.api.LayoutLog;
@@ -70,6 +71,10 @@ public final class ResourceHelper {
    public static int getColor(String value) {
        if (value != null) {
            if (!value.startsWith("#")) {
                if (value.startsWith(SdkConstants.PREFIX_THEME_REF)) {
                    throw new NumberFormatException(String.format(
                            "Attribute '%s' not found. Are you using the right theme?", value));
                }
                throw new NumberFormatException(
                        String.format("Color value '%s' must start with #", value));
            }