Repository: ibotpeaches/apktool
Issue: APKTool 2.2.2 - ClassCastException ResColorValue -> ResAttr

https://github.com/iBotPeaches/Apktool/issues/1060
It is almost the same issue with above.
Apktook tried to cast ResStringValue to ResAttr and it got an exception.
Only this time it is ResColorValue.
I personally modified the source as above and rebuilt the apktool, and it decompiled the apk without a problem.
I'd like to report here just in case it is a bug.

```
10:36 $ git diff
diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResStyleValue.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResStyleValue.java
index cc96e65..acba323 100644
--- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResStyleValue.java
+++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResStyleValue.java
@@ -68,7 +68,7 @@ public class ResStyleValue extends ResBagValue implements
             if (resource.contains("ResReferenceValue@")) {
                 continue;
             } else if (resource.contains("ResStringValue@") || resource.contains("ResStyleValue@") ||
-                    resource.contains("ResBoolValue@")) {
+                    resource.contains("ResBoolValue@") || resource.contains("ResColorValue@")) {
                 name = "@" + spec.getFullName(res.getResSpec().getPackage(), false);
             } else {
                 ResAttr attr = (ResAttr) spec.getDefaultResource().getValue();
```


### Information
1. **Apktool Version (`apktool -version`)** - 2.2.2
2. **Operating System (Mac, Linux, Windows)** - Windows
3. **APK From? (Playstore, ROM, Other)** - Playstore

### Stacktrace/Logcat

```
$ java -jar ../apktool_2.2.2.jar d -f xxx.apk
I: Using Apktool 2.2.2 on xxx.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: C:\\Users\\yyy\\AppData\\Local\\apktool\\framework\\1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
Exception in thread "main" java.lang.ClassCastException: brut.androlib.res.data.value.ResColorValue cannot be cast to brut.androlib.res.data.value.ResAttr
        at brut.androlib.res.data.value.ResStyleValue.serializeToResValuesXml(ResStyleValue.java:74)
        at brut.androlib.res.AndrolibResources.generateValuesFile(AndrolibResources.java:517)
        at brut.androlib.res.AndrolibResources.decode(AndrolibResources.java:267)
        at brut.androlib.Androlib.decodeResourcesFull(Androlib.java:131)
        at brut.androlib.ApkDecoder.decode(ApkDecoder.java:108)
        at brut.apktool.Main.cmdDecode(Main.java:166)
        at brut.apktool.Main.main(Main.java:81)
```

### Steps to Reproduce
1. java -jar ../apktool_2.2.2.jar d -f xxx.apk


Changed files:
brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResStyleValue.java

diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResStyleValue.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResStyleValue.java
index 297d3d51..d6df9629 100644
--- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResStyleValue.java
+++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/value/ResStyleValue.java
@@ -63,17 +63,15 @@ public class ResStyleValue extends ResBagValue implements
             String name = null;
             String value = null;
 
-            String resource = spec.getDefaultResource().getValue().toString();
-            // hacky-fix remove bad ReferenceVars
-            if (resource.contains("ResReferenceValue@")) {
+            ResValue resource = spec.getDefaultResource().getValue();
+            if (resource instanceof ResReferenceValue) {
                 continue;
-            } else if (resource.contains("ResStringValue@") || resource.contains("ResStyleValue@") ||
-                    resource.contains("ResBoolValue@")) {
-                name = "@" + spec.getFullName(res.getResSpec().getPackage(), false);
-            } else {
-                ResAttr attr = (ResAttr) spec.getDefaultResource().getValue();
+            } else if (resource instanceof ResAttr) {
+                ResAttr attr = (ResAttr) resource;
                 value = attr.convertToResXmlFormat(mItems[i].m2);
                 name = spec.getFullName(res.getResSpec().getPackage(), true);
+            } else {
+                name = "@" + spec.getFullName(res.getResSpec().getPackage(), false);
             }
 
             if (value == null) {