Java Code Examples for com.android.ide.common.rendering.api.ResourceValue#getResourceType()
The following examples show how to use
com.android.ide.common.rendering.api.ResourceValue#getResourceType() .
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: MultiResourceFile.java From java-n-IDE-for-Android with Apache License 2.0 | 6 votes |
/** * Adds a resource item to the list * @param value The value of the resource. */ @Override public void addResourceValue(ResourceValue value) { ResourceType resType = value.getResourceType(); Map<String, ResourceValue> list = mResourceItems.get(resType); // if the list does not exist, create it. if (list == null) { list = new HashMap<String, ResourceValue>(); mResourceItems.put(resType, list); } else { // look for a possible value already existing. ResourceValue oldValue = list.get(value.getName()); if (oldValue != null) { oldValue.replaceWith(value); return; } } // empty list or no match found? add the given resource list.put(value.getName(), value); }
Example 2
Source File: ResourceResolver.java From java-n-IDE-for-Android with Apache License 2.0 | 6 votes |
@Override public ResourceValue findResValue(String reference, boolean forceFrameworkOnly) { if (!mLookupChain.isEmpty() && reference.startsWith(PREFIX_RESOURCE_REF)) { ResourceValue prev = mLookupChain.get(mLookupChain.size() - 1); if (!reference.equals(prev.getValue())) { ResourceValue next = new ResourceValue(prev.getResourceType(), prev.getName(), prev.isFramework()); next.setValue(reference); mLookupChain.add(next); } } ResourceValue resValue = super.findResValue(reference, forceFrameworkOnly); if (resValue != null) { mLookupChain.add(resValue); } return resValue; }
Example 3
Source File: MultiResourceFile.java From javaide with GNU General Public License v3.0 | 6 votes |
/** * Adds a resource item to the list * @param value The value of the resource. */ @Override public void addResourceValue(ResourceValue value) { ResourceType resType = value.getResourceType(); Map<String, ResourceValue> list = mResourceItems.get(resType); // if the list does not exist, create it. if (list == null) { list = new HashMap<String, ResourceValue>(); mResourceItems.put(resType, list); } else { // look for a possible value already existing. ResourceValue oldValue = list.get(value.getName()); if (oldValue != null) { oldValue.replaceWith(value); return; } } // empty list or no match found? add the given resource list.put(value.getName(), value); }
Example 4
Source File: ResourceResolver.java From javaide with GNU General Public License v3.0 | 6 votes |
@Override public ResourceValue findResValue(String reference, boolean forceFrameworkOnly) { if (!mLookupChain.isEmpty() && reference.startsWith(PREFIX_RESOURCE_REF)) { ResourceValue prev = mLookupChain.get(mLookupChain.size() - 1); if (!reference.equals(prev.getValue())) { ResourceValue next = new ResourceValue(prev.getResourceType(), prev.getName(), prev.isFramework()); next.setValue(reference); mLookupChain.add(next); } } ResourceValue resValue = super.findResValue(reference, forceFrameworkOnly); if (resValue != null) { mLookupChain.add(resValue); } return resValue; }
Example 5
Source File: MultiResourceFile.java From NBANDROID-V2 with Apache License 2.0 | 6 votes |
/** * Adds a resource item to the list * @param value The value of the resource. */ @Override public void addResourceValue(ResourceValue value) { ResourceType resType = value.getResourceType(); ResourceValueMap list = mResourceItems.get(resType); // if the list does not exist, create it. if (list == null) { list = ResourceValueMap.create(); mResourceItems.put(resType, list); } else { // look for a possible value already existing. ResourceValue oldValue = list.get(value.getName()); if (oldValue != null) { oldValue.replaceWith(value); return; } } // empty list or no match found? add the given resource list.put(value.getName(), value); }
Example 6
Source File: ResourceItemResolver.java From java-n-IDE-for-Android with Apache License 2.0 | 4 votes |
@Override @Nullable public ResourceValue findResValue(@Nullable String reference, boolean inFramework) { if (mResolver != null) { return mResolver.findResValue(reference, inFramework); } if (reference == null) { return null; } if (mLookupChain != null && !mLookupChain.isEmpty() && reference.startsWith(PREFIX_RESOURCE_REF)) { ResourceValue prev = mLookupChain.get(mLookupChain.size() - 1); if (!reference.equals(prev.getValue())) { ResourceValue next = new ResourceValue(prev.getResourceType(), prev.getName(), prev.isFramework()); next.setValue(reference); mLookupChain.add(next); } } ResourceUrl resource = ResourceUrl.parse(reference); if (resource != null && resource.hasValidName()) { if (resource.theme) { // Do theme lookup? We can't do that here; requires full global analysis, so just use // a real resource resolver ResourceResolver resolver = getFullResolver(); if (resolver != null) { return resolver.findResValue(reference, inFramework); } else { return null; } } else if (reference.startsWith(PREFIX_RESOURCE_REF)) { return findResValue(resource.type, resource.name, inFramework || resource.framework); } } // Looks like the value didn't reference anything. Return null. return null; }
Example 7
Source File: ResourceItemResolver.java From javaide with GNU General Public License v3.0 | 4 votes |
@Override @Nullable public ResourceValue findResValue(@Nullable String reference, boolean inFramework) { if (mResolver != null) { return mResolver.findResValue(reference, inFramework); } if (reference == null) { return null; } if (mLookupChain != null && !mLookupChain.isEmpty() && reference.startsWith(PREFIX_RESOURCE_REF)) { ResourceValue prev = mLookupChain.get(mLookupChain.size() - 1); if (!reference.equals(prev.getValue())) { ResourceValue next = new ResourceValue(prev.getResourceType(), prev.getName(), prev.isFramework()); next.setValue(reference); mLookupChain.add(next); } } ResourceUrl resource = ResourceUrl.parse(reference); if (resource != null && resource.hasValidName()) { if (resource.theme) { // Do theme lookup? We can't do that here; requires full global analysis, so just use // a real resource resolver ResourceResolver resolver = getFullResolver(); if (resolver != null) { return resolver.findResValue(reference, inFramework); } else { return null; } } else if (reference.startsWith(PREFIX_RESOURCE_REF)) { return findResValue(resource.type, resource.name, inFramework || resource.framework); } } // Looks like the value didn't reference anything. Return null. return null; }