Search in sources :

Example 1 with GenerateVectorIconModel

use of com.android.tools.idea.npw.assetstudio.wizard.GenerateVectorIconModel in project android by JetBrains.

the class NewVectorAssetAction method createWizard.

@Nullable
@Override
protected ModelWizard createWizard(@NotNull AndroidFacet facet) {
    Module module = facet.getModule();
    Project project = module.getProject();
    AndroidModuleModel androidModel = AndroidModuleModel.get(module);
    if (androidModel != null) {
        AndroidVersion minSdkVersion = androidModel.getMinSdkVersion();
        String version = androidModel.getAndroidProject().getModelVersion();
        GradleVersion revision = GradleVersion.parse(version);
        if (revision.compareIgnoringQualifiers(VECTOR_ASSET_GENERATION_REVISION) < 0 && (minSdkVersion == null || minSdkVersion.getApiLevel() < VECTOR_DRAWABLE_API_LEVEL)) {
            Messages.showErrorDialog(project, ERROR_MESSAGE, ERROR_TITLE);
            return null;
        }
    }
    ModelWizard.Builder wizardBuilder = new ModelWizard.Builder();
    wizardBuilder.addStep(new NewVectorAssetStep(new GenerateVectorIconModel(facet), facet));
    return wizardBuilder.build();
}
Also used : Project(com.intellij.openapi.project.Project) NewVectorAssetStep(com.android.tools.idea.npw.assetstudio.wizard.NewVectorAssetStep) AndroidModuleModel(com.android.tools.idea.gradle.project.model.AndroidModuleModel) GenerateVectorIconModel(com.android.tools.idea.npw.assetstudio.wizard.GenerateVectorIconModel) Module(com.intellij.openapi.module.Module) AndroidVersion(com.android.sdklib.AndroidVersion) GradleVersion(com.android.ide.common.repository.GradleVersion) ModelWizard(com.android.tools.idea.wizard.model.ModelWizard) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

GradleVersion (com.android.ide.common.repository.GradleVersion)1 AndroidVersion (com.android.sdklib.AndroidVersion)1 AndroidModuleModel (com.android.tools.idea.gradle.project.model.AndroidModuleModel)1 GenerateVectorIconModel (com.android.tools.idea.npw.assetstudio.wizard.GenerateVectorIconModel)1 NewVectorAssetStep (com.android.tools.idea.npw.assetstudio.wizard.NewVectorAssetStep)1 ModelWizard (com.android.tools.idea.wizard.model.ModelWizard)1 Module (com.intellij.openapi.module.Module)1 Project (com.intellij.openapi.project.Project)1 Nullable (org.jetbrains.annotations.Nullable)1