summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDeepanshu Gupta <deepanshu@google.com>2014-08-27 11:27:13 -0700
committerDeepanshu Gupta <deepanshu@google.com>2014-09-03 11:59:33 -0700
commit1a12b805698c7cba9c2daa78c76c055afbdfa9fc (patch)
treedd2f3f8804ebba1270655cf83d8f54bc598d5ef5 /tools
parent458f2a7bbbcc45d12b575fe9f3b2f8e1a20f9b1c (diff)
downloadframeworks_base-1a12b805698c7cba9c2daa78c76c055afbdfa9fc.zip
frameworks_base-1a12b805698c7cba9c2daa78c76c055afbdfa9fc.tar.gz
frameworks_base-1a12b805698c7cba9c2daa78c76c055afbdfa9fc.tar.bz2
LayoutLib: Fix warnings in ResourceHelper.
Fix intelliJ warnings in ResourceHelper. Most of them just change boolean checks "x == false" with "!x". Change-Id: I278645e2807affd8b3183a4a6f5e4fa2ab7b3d21
Diffstat (limited to 'tools')
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
index 335016e..99ae7c9 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
@@ -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;
}