package com.android.ide.eclipse.adt.internal.editors.layout.gle2;
import static com.android.ide.eclipse.adt.AndroidConstants.WS_SEP;
-import static com.android.sdklib.SdkConstants.FD_ANIM;
+import static com.android.sdklib.SdkConstants.FD_ANIMATOR;
import static com.android.sdklib.SdkConstants.FD_RESOURCES;
import com.android.ide.common.rendering.api.Capability;
import com.android.ide.common.rendering.api.IAnimationListener;
import com.android.ide.common.rendering.api.RenderSession;
import com.android.ide.common.rendering.api.Result;
+import com.android.ide.eclipse.adt.AdtPlugin;
import com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditor;
import com.android.ide.eclipse.adt.internal.resources.ResourceType;
import com.android.ide.eclipse.adt.internal.wizards.newxmlfile.NewXmlFileWizard;
// List of animations
Collection<String> animationNames = graphicalEditor.getResourceNames(mFramework,
- ResourceType.ANIM);
+ ResourceType.ANIMATOR);
if (animationNames.size() > 0) {
if (!mFramework) {
new Separator().fill(menu, -1);
if (viewObject != null) {
ViewHierarchy viewHierarchy = mCanvas.getViewHierarchy();
RenderSession session = viewHierarchy.getSession();
- session.animate(viewObject, mAnimationName, mIsFrameworkAnim,
+ Result r = session.animate(viewObject, mAnimationName, mIsFrameworkAnim,
new IAnimationListener() {
private boolean mPendingDrawing = false;
});
}
});
+
+ if (!r.isSuccess()) {
+ if (r.getErrorMessage() != null) {
+ AdtPlugin.log(r.getException(), r.getErrorMessage());
+ }
+ }
}
}
}
LayoutEditor editor = mCanvas.getLayoutEditor();
IWorkbenchWindow workbenchWindow = editor.getEditorSite().getWorkbenchWindow();
IWorkbench workbench = workbenchWindow.getWorkbench();
- String animationDir = FD_RESOURCES + WS_SEP + FD_ANIM;
+ String animationDir = FD_RESOURCES + WS_SEP + FD_ANIMATOR;
Pair<IProject, String> pair = Pair.of(editor.getProject(), animationDir);
IStructuredSelection selection = new StructuredSelection(pair);
wizard.init(workbench, selection);
}
}
+ // For now, treat a selection of /res/animator as /res/anim/,
+ // though we need to handle this better
+ // TODO: Properly support ANIMATOR templates!
+ if (!selected && folderName.equals(SdkConstants.FD_ANIMATOR)) {
+ for (TypeInfo type : sTypes) {
+ if (type.getResFolderType() == ResourceFolderType.ANIM) {
+ matches.add(type);
+ selected |= type.getWidget().getSelection();
+ break;
+ }
+ }
+ }
+
if (matches.size() == 1) {
// If there's only one match, select it if it's not already selected
if (!selected) {