Java Code Examples for com.android.ide.common.resources.configuration.DensityQualifier#getValue()
The following examples show how to use
com.android.ide.common.resources.configuration.DensityQualifier#getValue() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SingleResourceFile.java From java-n-IDE-for-Android with Apache License 2.0 | 6 votes |
public SingleResourceFile(IAbstractFile file, ResourceFolder folder) { super(file, folder); // we need to infer the type of the resource from the folder type. // This is easy since this is a single Resource file. List<ResourceType> types = FolderTypeRelationship.getRelatedResourceTypes(folder.getType()); mType = types.get(0); // compute the resource name mResourceName = getResourceName(mType); // test if there's a density qualifier associated with the resource DensityQualifier qualifier = folder.getConfiguration().getDensityQualifier(); if (qualifier == null) { mValue = new ResourceValue(mType, getResourceName(mType), file.getOsLocation(), isFramework()); } else { mValue = new DensityBasedResourceValue( mType, getResourceName(mType), file.getOsLocation(), qualifier.getValue(), isFramework()); } }
Example 2
Source File: SingleResourceFile.java From javaide with GNU General Public License v3.0 | 6 votes |
public SingleResourceFile(IAbstractFile file, ResourceFolder folder) { super(file, folder); // we need to infer the type of the resource from the folder type. // This is easy since this is a single Resource file. List<ResourceType> types = FolderTypeRelationship.getRelatedResourceTypes(folder.getType()); mType = types.get(0); // compute the resource name mResourceName = getResourceName(mType); // test if there's a density qualifier associated with the resource DensityQualifier qualifier = folder.getConfiguration().getDensityQualifier(); if (qualifier == null) { mValue = new ResourceValue(mType, getResourceName(mType), file.getOsLocation(), isFramework()); } else { mValue = new DensityBasedResourceValue( mType, getResourceName(mType), file.getOsLocation(), qualifier.getValue(), isFramework()); } }
Example 3
Source File: IdGeneratingResourceFile.java From NBANDROID-V2 with Apache License 2.0 | 6 votes |
/** * Returns the resource value associated with this whole file as a layout resource * @param file the file handler that represents this file * @param folder the folder this file is under * @return a resource value associated with this layout */ private ResourceValue getFileValue(IAbstractFile file, ResourceFolder folder) { // test if there's a density qualifier associated with the resource DensityQualifier qualifier = folder.getConfiguration().getDensityQualifier(); ResourceValue value; if (!ResourceQualifier.isValid(qualifier)) { value = new ResourceValueImpl( new ResourceReference(mFileType, mFileName, isFramework()), file.getOsLocation()); } else { value = new DensityBasedResourceValueImpl( new ResourceReference(mFileType, mFileName, isFramework()), file.getOsLocation(), qualifier.getValue()); } return value; }
Example 4
Source File: ResourceItem.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
@Nullable private Density getFolderDensity() { String qualifiers = getQualifiers(); if (!qualifiers.isEmpty() && qualifiers.contains("dpi")) { Iterable<String> segments = Splitter.on('-').split(qualifiers); FolderConfiguration config = FolderConfiguration.getConfigFromQualifiers(segments); if (config != null) { DensityQualifier densityQualifier = config.getDensityQualifier(); if (densityQualifier != null) { return densityQualifier.getValue(); } } } return null; }
Example 5
Source File: ResourceItem.java From javaide with GNU General Public License v3.0 | 5 votes |
@Nullable private Density getFolderDensity() { String qualifiers = getQualifiers(); if (!qualifiers.isEmpty() && qualifiers.contains("dpi")) { Iterable<String> segments = Splitter.on('-').split(qualifiers); FolderConfiguration config = FolderConfiguration.getConfigFromQualifiers(segments); if (config != null) { DensityQualifier densityQualifier = config.getDensityQualifier(); if (densityQualifier != null) { return densityQualifier.getValue(); } } } return null; }
Example 6
Source File: SingleResourceFile.java From NBANDROID-V2 with Apache License 2.0 | 5 votes |
public SingleResourceFile(IAbstractFile file, ResourceFolder folder) { super(file, folder); // we need to infer the type of the resource from the folder type. // This is easy since this is a single Resource file. List<ResourceType> types = FolderTypeRelationship.getRelatedResourceTypes(folder.getType()); mType = types.get(0); // compute the resource name mResourceName = getResourceName(mType); // test if there's a density qualifier associated with the resource DensityQualifier qualifier = folder.getConfiguration().getDensityQualifier(); if (!ResourceQualifier.isValid(qualifier)) { mValue = new ResourceValueImpl( new ResourceReference(mType, getResourceName(mType), isFramework()), file.getOsLocation()); } else { mValue = new DensityBasedResourceValueImpl( new ResourceReference(mType, getResourceName(mType), isFramework()), file.getOsLocation(), qualifier.getValue()); } }