All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.android.builder.core.DefaultVectorDrawablesOptions Maven / Gradle / Ivy

There is a newer version: 2.3.0
Show newest version
/*
 * Copyright (C) 2016 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.builder.core;

import com.android.annotations.NonNull;
import com.android.annotations.Nullable;
import com.android.builder.model.VectorDrawablesOptions;
import com.google.common.base.Objects;
import com.google.common.collect.Sets;

import java.io.Serializable;
import java.util.Set;

/**
 * Default implementation of {@link VectorDrawablesOptions}.
 */
public class DefaultVectorDrawablesOptions implements VectorDrawablesOptions, Serializable {

    @Nullable
    private Set mGeneratedDensities;

    @Nullable
    private Boolean mUseSupportLibrary;

    @NonNull
    public static DefaultVectorDrawablesOptions copyOf(@NonNull VectorDrawablesOptions original) {
        DefaultVectorDrawablesOptions options = new DefaultVectorDrawablesOptions();

        options.setGeneratedDensities(original.getGeneratedDensities());
        options.setUseSupportLibrary(original.getUseSupportLibrary());

        return options;
    }

    /**
     * Densities used when generating PNGs from vector drawables at build time. For the PNGs to be
     * generated, minimum SDK has to be below 21.
     *
     * 

If set to an empty collection, all special handling of vector drawables will be * disabled. * *

See * Supporting Multiple Screens. */ @Nullable @Override public Set getGeneratedDensities() { return mGeneratedDensities; } public void setGeneratedDensities(@Nullable Iterable densities) { if (densities == null) { mGeneratedDensities = null; } else { mGeneratedDensities = Sets.newHashSet(densities); } } @Override @Nullable public Boolean getUseSupportLibrary() { return mUseSupportLibrary; } public void useSupportLibrary(@Nullable Boolean useSupportLibrary) { setUseSupportLibrary(useSupportLibrary); } public void setUseSupportLibrary(@Nullable Boolean useSupportLibrary) { mUseSupportLibrary = useSupportLibrary; } @Override public String toString() { return Objects.toStringHelper(this) .add("mGeneratedDensities", mGeneratedDensities) .add("mUseSupportLibrary", mUseSupportLibrary) .toString(); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy