Java Code Examples for com.android.ide.common.rendering.api.ResourceValue#setValue()
The following examples show how to use
com.android.ide.common.rendering.api.ResourceValue#setValue() .
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: 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 2
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 3
Source File: ResourceItem.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
@NonNull private ResourceValue parseValue(@NonNull ResourceValue value) { String text = getTextNode(mValue.getChildNodes()); value.setValue(ValueXmlHelper.unescapeResourceString(text, false, true)); return value; }
Example 4
Source File: ResourceItem.java From javaide with GNU General Public License v3.0 | 5 votes |
@NonNull private ResourceValue parseValue(@NonNull ResourceValue value) { String text = getTextNode(mValue.getChildNodes()); value.setValue(ValueXmlHelper.unescapeResourceString(text, false, true)); return value; }
Example 5
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 6
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; }