IDEA-86892 android-dom: add "rotate" element

This commit is contained in:
Eugene Kudelevsky
2012-06-05 21:21:42 +04:00
parent 264e7c8b46
commit fa185d9485
9 changed files with 50 additions and 3 deletions
@@ -31,7 +31,7 @@ public class AndroidDrawableDomUtil {
public static final Map<String, String> SPECIAL_STYLEABLE_NAMES = new HashMap<String, String>();
private static final String[] POSSIBLE_DRAWABLE_ROOTS =
new String[]{"selector", "bitmap", "nine-patch", "layer-list", "level-list", "transition", "inset", "clip", "scale", "shape",
"animation-list", "animated-rotate"};
"animation-list", "animated-rotate", "rotate"};
static {
SPECIAL_STYLEABLE_NAMES.put("selector", "StateListDrawable");
@@ -42,6 +42,7 @@ public class AndroidDrawableDomUtil {
SPECIAL_STYLEABLE_NAMES.put("clip", "ClipDrawable");
SPECIAL_STYLEABLE_NAMES.put("scale", "ScaleDrawable");
SPECIAL_STYLEABLE_NAMES.put("animation-list", "AnimationDrawable");
SPECIAL_STYLEABLE_NAMES.put("rotate", "RotateDrawable");
SPECIAL_STYLEABLE_NAMES.put("animated-rotate", "AnimatedRotateDrawable");
SPECIAL_STYLEABLE_NAMES.put("shape", "GradientDrawable");
@@ -29,7 +29,7 @@ import org.jetbrains.annotations.Nullable;
*/
public class InsetOrClipOrScaleDomFileDescription extends AndroidResourceDomFileDescription<InsetOrClipOrScale> {
@NonNls private static final String[] ROOT_TAGS = new String[] {"inset", "clip", "scale", "animated-rotate"};
@NonNls private static final String[] ROOT_TAGS = new String[] {"inset", "clip", "scale", "animated-rotate", "rotate"};
public InsetOrClipOrScaleDomFileDescription() {
super(InsetOrClipOrScale.class, ROOT_TAGS[0], "drawable");
@@ -29,4 +29,6 @@ public interface ListItemBase extends DrawableDomElement {
List<InsetOrClipOrScale> getInsets();
List<InsetOrClipOrScale> getAnimatedRotates();
List<InsetOrClipOrScale> getRotates();
}
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDeg<caret>/>
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees=""/>
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@<caret>"/>
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:pivotX="50%"
android:pivotY="50%"
android:fromDegrees="0"
android:toDegrees="360"
android:visible="<error>0</error>"
android:drawable="<error>@drawable/ababa</error>"/>
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<rotate android:drawable="@drawable/myDrawable"/>
</item>
</layer-list>
@@ -265,13 +265,29 @@ public class AndroidDrawableResourcesDomTest extends AndroidDomTest {
doTestHighlighting();
}
public void testRotateCompletion1() throws Throwable {
doTestCompletion();
}
public void testRotateCompletion2() throws Throwable {
doTestOnlyDrawableReferences();
}
public void testRotateHighlighting1() throws Throwable {
doTestHighlighting();
}
public void testRotateHighlighting2() throws Throwable {
doTestHighlighting();
}
public void testIncorrectRootTag() throws Throwable {
doTestHighlighting();
}
public void testRootTagCompletion() throws Throwable {
doTestCompletionVariants(getTestName(true) + ".xml", "selector", "bitmap", "nine-patch", "layer-list", "level-list", "transition",
"inset", "clip", "scale", "shape", "animation-list", "animated-rotate");
"inset", "clip", "scale", "shape", "animation-list", "animated-rotate", "rotate");
}
public void testInlineClip() throws Throwable {