Methods Summary |
---|
public void | addViewKey(android.view.View view, java.lang.Object viewKey)
mViewKeyMap.put(view, viewKey);
|
public boolean | bindService(android.content.Intent arg0, android.content.ServiceConnection arg1, int arg2)
// TODO Auto-generated method stub
return false;
|
public int | checkCallingOrSelfPermission(java.lang.String arg0)
// TODO Auto-generated method stub
return 0;
|
public int | checkCallingOrSelfUriPermission(android.net.Uri arg0, int arg1)
// TODO Auto-generated method stub
return 0;
|
public int | checkCallingPermission(java.lang.String arg0)
// TODO Auto-generated method stub
return 0;
|
public int | checkCallingUriPermission(android.net.Uri arg0, int arg1)
// TODO Auto-generated method stub
return 0;
|
public int | checkPermission(java.lang.String arg0, int arg1, int arg2)
// TODO Auto-generated method stub
return 0;
|
public int | checkUriPermission(android.net.Uri arg0, int arg1, int arg2, int arg3)
// TODO Auto-generated method stub
return 0;
|
public int | checkUriPermission(android.net.Uri arg0, java.lang.String arg1, java.lang.String arg2, int arg3, int arg4, int arg5)
// TODO Auto-generated method stub
return 0;
|
public void | clearWallpaper()
// TODO Auto-generated method stub
|
public android.content.Context | createPackageContext(java.lang.String arg0, int arg1)
// TODO Auto-generated method stub
return null;
|
private BridgeTypedArray | createStyleBasedTypedArray(com.android.layoutlib.api.IStyleResourceValue style, int[] attrs)Creates a {@link BridgeTypedArray} by filling the values defined by the int[] with the
values found in the given style.
TreeMap<Integer, String> styleNameMap = searchAttrs(attrs, null);
BridgeTypedArray ta = ((BridgeResources) mResources).newTypeArray(attrs.length,
false /* platformResourceFlag */);
// loop through all the values in the style map, and init the TypedArray with
// the style we got from the dynamic id
for (Entry<Integer, String> styleAttribute : styleNameMap.entrySet()) {
int index = styleAttribute.getKey().intValue();
String name = styleAttribute.getValue();
// get the value from the style, or its parent styles.
IResourceValue resValue = findItemInStyle(style, name);
// resolve it to make sure there are no references left.
ta.bridgeSetValue(index, name, resolveResValue(resValue));
}
ta.sealArray();
return ta;
|
public java.lang.String[] | databaseList()
// TODO Auto-generated method stub
return null;
|
public boolean | deleteDatabase(java.lang.String arg0)
// TODO Auto-generated method stub
return false;
|
public boolean | deleteFile(java.lang.String arg0)
// TODO Auto-generated method stub
return false;
|
public void | enforceCallingOrSelfPermission(java.lang.String arg0, java.lang.String arg1)
// TODO Auto-generated method stub
|
public void | enforceCallingOrSelfUriPermission(android.net.Uri arg0, int arg1, java.lang.String arg2)
// TODO Auto-generated method stub
|
public void | enforceCallingPermission(java.lang.String arg0, java.lang.String arg1)
// TODO Auto-generated method stub
|
public void | enforceCallingUriPermission(android.net.Uri arg0, int arg1, java.lang.String arg2)
// TODO Auto-generated method stub
|
public void | enforcePermission(java.lang.String arg0, int arg1, int arg2, java.lang.String arg3)
// TODO Auto-generated method stub
|
public void | enforceUriPermission(android.net.Uri arg0, int arg1, int arg2, int arg3, java.lang.String arg4)
// TODO Auto-generated method stub
|
public void | enforceUriPermission(android.net.Uri arg0, java.lang.String arg1, java.lang.String arg2, int arg3, int arg4, int arg5, java.lang.String arg6)
// TODO Auto-generated method stub
|
public java.lang.String[] | fileList()
// TODO Auto-generated method stub
return null;
|
com.android.layoutlib.api.IResourceValue | findItemInStyle(com.android.layoutlib.api.IStyleResourceValue style, java.lang.String itemName)Returns the {@link IResourceValue} matching a given name in a given style. If the
item is not directly available in the style, the method looks in its parent style.
IResourceValue item = style.findItem(itemName);
// if we didn't find it, we look in the parent style (if applicable)
if (item == null && mStyleInheritanceMap != null) {
IStyleResourceValue parentStyle = mStyleInheritanceMap.get(style);
if (parentStyle != null) {
return findItemInStyle(parentStyle, itemName);
}
}
return item;
|
com.android.layoutlib.api.IResourceValue | findResValue(java.lang.String reference)Searches for, and returns a {@link IResourceValue} by its reference.
The reference format can be:
@resType/resName
@android:resType/resName
@resType/android:resName
?resType/resName
?android:resType/resName
?resType/android:resName
Any other string format will return null .
The actual format of a reference is @[namespace:]resType/resName but this method
only support the android namespace.
if (reference == null) {
return null;
}
if (reference.startsWith(BridgeConstants.PREFIX_THEME_REF)) {
// no theme? no need to go further!
if (mThemeValues == null) {
return null;
}
boolean frameworkOnly = false;
// eleminate the prefix from the string
if (reference.startsWith(BridgeConstants.PREFIX_ANDROID_THEME_REF)) {
frameworkOnly = true;
reference = reference.substring(BridgeConstants.PREFIX_ANDROID_THEME_REF.length());
} else {
reference = reference.substring(BridgeConstants.PREFIX_THEME_REF.length());
}
// at this point, value can contain type/name (drawable/foo for instance).
// split it to make sure.
String[] segments = reference.split("\\/");
// we look for the referenced item name.
String referenceName = null;
if (segments.length == 2) {
// there was a resType in the reference. If it's attr, we ignore it
// else, we assert for now.
if (BridgeConstants.RES_ATTR.equals(segments[0])) {
referenceName = segments[1];
} else {
// At this time, no support for ?type/name where type is not "attr"
return null;
}
} else {
// it's just an item name.
referenceName = segments[0];
}
// now we look for android: in the referenceName in order to support format
// such as: ?attr/android:name
if (referenceName.startsWith(BridgeConstants.PREFIX_ANDROID)) {
frameworkOnly = true;
referenceName = referenceName.substring(BridgeConstants.PREFIX_ANDROID.length());
}
// Now look for the item in the theme, starting with the current one.
if (frameworkOnly) {
// FIXME for now we do the same as if it didn't specify android:
return findItemInStyle(mThemeValues, referenceName);
}
return findItemInStyle(mThemeValues, referenceName);
} else if (reference.startsWith(BridgeConstants.PREFIX_RESOURCE_REF)) {
boolean frameworkOnly = false;
// check for the specific null reference value.
if (BridgeConstants.REFERENCE_NULL.equals(reference)) {
return null;
}
// Eliminate the prefix from the string.
if (reference.startsWith(BridgeConstants.PREFIX_ANDROID_RESOURCE_REF)) {
frameworkOnly = true;
reference = reference.substring(
BridgeConstants.PREFIX_ANDROID_RESOURCE_REF.length());
} else {
reference = reference.substring(BridgeConstants.PREFIX_RESOURCE_REF.length());
}
// at this point, value contains type/[android:]name (drawable/foo for instance)
String[] segments = reference.split("\\/");
// now we look for android: in the resource name in order to support format
// such as: @drawable/android:name
if (segments[1].startsWith(BridgeConstants.PREFIX_ANDROID)) {
frameworkOnly = true;
segments[1] = segments[1].substring(BridgeConstants.PREFIX_ANDROID.length());
}
return findResValue(segments[0], segments[1], frameworkOnly);
}
// Looks like the value didn't reference anything. Return null.
return null;
|
private com.android.layoutlib.api.IResourceValue | findResValue(java.lang.String resType, java.lang.String resName, boolean frameworkOnly)Searches for, and returns a {@link IResourceValue} by its name, and type.
// map of IResouceValue for the given type
Map<String, IResourceValue> typeMap;
// if allowed, search in the project resources first.
if (frameworkOnly == false) {
typeMap = mProjectResources.get(resType);
if (typeMap != null) {
IResourceValue item = typeMap.get(resName);
if (item != null) {
return item;
}
}
}
// now search in the framework resources.
typeMap = mFrameworkResources.get(resType);
if (typeMap != null) {
IResourceValue item = typeMap.get(resName);
if (item != null) {
return item;
}
}
// didn't find the resource anywhere.
return null;
|
public android.content.Context | getApplicationContext()
throw new UnsupportedOperationException();
|
public android.content.res.AssetManager | getAssets()
// TODO Auto-generated method stub
return null;
|
public java.io.File | getCacheDir()
// TODO Auto-generated method stub
return null;
|
public java.lang.ClassLoader | getClassLoader()
return this.getClass().getClassLoader();
|
public android.content.ContentResolver | getContentResolver()
if (mContentResolver == null) {
mContentResolver = new BridgeContentResolver(this);
}
return mContentResolver;
|
public java.io.File | getDatabasePath(java.lang.String arg0)
// TODO Auto-generated method stub
return null;
|
public java.io.File | getDir(java.lang.String arg0, int arg1)
// TODO Auto-generated method stub
return null;
|
int | getDynamicIdByStyle(com.android.layoutlib.api.IStyleResourceValue resValue)
if (mDynamicIdToStyleMap == null) {
// create the maps.
mDynamicIdToStyleMap = new HashMap<Integer, IStyleResourceValue>();
mStyleToDynamicIdMap = new HashMap<IStyleResourceValue, Integer>();
}
// look for an existing id
Integer id = mStyleToDynamicIdMap.get(resValue);
if (id == null) {
// generate a new id
id = Integer.valueOf(++mDynamicIdGenerator);
// and add it to the maps.
mDynamicIdToStyleMap.put(id, resValue);
mStyleToDynamicIdMap.put(resValue, id);
}
return id;
|
public java.io.File | getFileStreamPath(java.lang.String arg0)
// TODO Auto-generated method stub
return null;
|
public java.io.File | getFilesDir()
// TODO Auto-generated method stub
return null;
|
int | getFrameworkIdValue(java.lang.String idName, int defValue)
Integer value = Bridge.getResourceValue(BridgeConstants.RES_ID, idName);
if (value != null) {
return value.intValue();
}
return defValue;
|
public com.android.layoutlib.api.IResourceValue | getFrameworkResource(java.lang.String resourceType, java.lang.String resourceName)Returns a framework resource by type and name. The returned resource is resolved.
return getResource(resourceType, resourceName, mFrameworkResources);
|
public com.android.layoutlib.api.ILayoutLog | getLogger()
return mLogger;
|
public android.os.Looper | getMainLooper()
throw new UnsupportedOperationException();
|
public java.lang.String | getPackageCodePath()
// TODO Auto-generated method stub
return null;
|
public android.content.pm.PackageManager | getPackageManager()
// TODO Auto-generated method stub
return null;
|
public java.lang.String | getPackageName()
// TODO Auto-generated method stub
return null;
|
public java.lang.String | getPackageResourcePath()
// TODO Auto-generated method stub
return null;
|
public com.android.layoutlib.api.IProjectCallback | getProjectCallback()
return mProjectCallback;
|
int | getProjectIdValue(java.lang.String idName, int defValue)
if (mProjectCallback != null) {
Integer value = mProjectCallback.getResourceValue(BridgeConstants.RES_ID, idName);
if (value != null) {
return value.intValue();
}
}
return defValue;
|
public java.lang.Object | getProjectKey()
return mProjectKey;
|
public com.android.layoutlib.api.IResourceValue | getProjectResource(java.lang.String resourceType, java.lang.String resourceName)Returns a project resource by type and name. The returned resource is resolved.
return getResource(resourceType, resourceName, mProjectResources);
|
com.android.layoutlib.api.IResourceValue | getResource(java.lang.String resourceType, java.lang.String resourceName, java.util.Map resourceRepository)
Map<String, IResourceValue> typeMap = resourceRepository.get(resourceType);
if (typeMap != null) {
IResourceValue item = typeMap.get(resourceName);
if (item != null) {
item = resolveResValue(item);
return item;
}
}
// didn't find the resource anywhere.
return null;
|
public android.content.res.Resources | getResources()
return mResources;
|
public android.content.SharedPreferences | getSharedPreferences(java.lang.String arg0, int arg1)
// TODO Auto-generated method stub
return null;
|
private com.android.layoutlib.api.IStyleResourceValue | getStyleByDynamicId(int i)
if (mDynamicIdToStyleMap != null) {
return mDynamicIdToStyleMap.get(i);
}
return null;
|
public java.lang.Object | getSystemService(java.lang.String service)
if (LAYOUT_INFLATER_SERVICE.equals(service)) {
return mInflater;
}
// AutoCompleteTextView and MultiAutoCompleteTextView want a window
// service. We don't have any but it's not worth an exception.
if (WINDOW_SERVICE.equals(service)) {
return null;
}
throw new UnsupportedOperationException("Unsupported Service: " + service);
|
public android.content.res.Resources.Theme | getTheme()
return mTheme;
|
public java.lang.Object | getViewKey(android.view.View view)
return mViewKeyMap.get(view);
|
public android.graphics.drawable.Drawable | getWallpaper()
// TODO Auto-generated method stub
return null;
|
public int | getWallpaperDesiredMinimumHeight()
return -1;
|
public int | getWallpaperDesiredMinimumWidth()
return -1;
|
public void | grantUriPermission(java.lang.String arg0, android.net.Uri arg1, int arg2)
// TODO Auto-generated method stub
|
public final android.content.res.TypedArray | obtainStyledAttributes(int[] attrs)
return createStyleBasedTypedArray(mThemeValues, attrs);
|
public final android.content.res.TypedArray | obtainStyledAttributes(int resid, int[] attrs)
// get the IStyleResourceValue based on the resId;
IStyleResourceValue style = getStyleByDynamicId(resid);
if (style == null) {
throw new Resources.NotFoundException();
}
if (mTypedArrayCache == null) {
mTypedArrayCache = new HashMap<int[], Map<Integer,TypedArray>>();
Map<Integer, TypedArray> map = new HashMap<Integer, TypedArray>();
mTypedArrayCache.put(attrs, map);
BridgeTypedArray ta = createStyleBasedTypedArray(style, attrs);
map.put(resid, ta);
return ta;
}
// get the 2nd map
Map<Integer, TypedArray> map = mTypedArrayCache.get(attrs);
if (map == null) {
map = new HashMap<Integer, TypedArray>();
mTypedArrayCache.put(attrs, map);
}
// get the array from the 2nd map
TypedArray ta = map.get(resid);
if (ta == null) {
ta = createStyleBasedTypedArray(style, attrs);
map.put(resid, ta);
}
return ta;
|
public final android.content.res.TypedArray | obtainStyledAttributes(android.util.AttributeSet set, int[] attrs)
return obtainStyledAttributes(set, attrs, 0, 0);
|
public android.content.res.TypedArray | obtainStyledAttributes(android.util.AttributeSet set, int[] attrs, int defStyleAttr, int defStyleRes)
// Hint: for XmlPullParser, attach source //DEVICE_SRC/dalvik/libcore/xml/src/java
BridgeXmlBlockParser parser = null;
if (set instanceof BridgeXmlBlockParser) {
parser = (BridgeXmlBlockParser)set;
} else {
// reall this should not be happening since its instantiated in Bridge
mLogger.error("Parser is not a BridgeXmlBlockParser!");
return null;
}
boolean[] frameworkAttributes = new boolean[1];
TreeMap<Integer, String> styleNameMap = searchAttrs(attrs, frameworkAttributes);
BridgeTypedArray ta = ((BridgeResources) mResources).newTypeArray(attrs.length,
parser.isPlatformFile());
// resolve the defStyleAttr value into a IStyleResourceValue
IStyleResourceValue defStyleValues = null;
if (defStyleAttr != 0) {
// get the name from the int.
String defStyleName = searchAttr(defStyleAttr);
// look for the style in the current theme, and its parent:
if (mThemeValues != null) {
IResourceValue item = findItemInStyle(mThemeValues, defStyleName);
if (item != null) {
// item is a reference to a style entry. Search for it.
item = findResValue(item.getValue());
if (item instanceof IStyleResourceValue) {
defStyleValues = (IStyleResourceValue)item;
}
} else {
// TODO: log the error properly
System.out.println("Failed to find defStyle: " + defStyleName);
}
}
}
if (defStyleRes != 0) {
// FIXME: See what we need to do with this.
throw new UnsupportedOperationException();
}
String namespace = BridgeConstants.NS_RESOURCES;
if (frameworkAttributes[0] == false) {
// need to use the application namespace
namespace = mProjectCallback.getNamespace();
}
if (styleNameMap != null) {
for (Entry<Integer, String> styleAttribute : styleNameMap.entrySet()) {
int index = styleAttribute.getKey().intValue();
String name = styleAttribute.getValue();
String value = parser.getAttributeValue(namespace, name);
// if there's no direct value for this attribute in the XML, we look for default
// values in the widget defStyle, and then in the theme.
if (value == null) {
IResourceValue resValue = null;
// look for the value in the defStyle first (and its parent if needed)
if (defStyleValues != null) {
resValue = findItemInStyle(defStyleValues, name);
}
// if the item is not present in the defStyle, we look in the main theme (and
// its parent themes)
if (resValue == null && mThemeValues != null) {
resValue = findItemInStyle(mThemeValues, name);
}
// if we found a value, we make sure this doesn't reference another value.
// So we resolve it.
if (resValue != null) {
resValue = resolveResValue(resValue);
}
ta.bridgeSetValue(index, name, resValue);
} else {
// there is a value in the XML, but we need to resolve it in case it's
// referencing another resource or a theme value.
ta.bridgeSetValue(index, name, resolveValue(null, name, value));
}
}
}
ta.sealArray();
return ta;
|
public java.io.FileInputStream | openFileInput(java.lang.String arg0)
// TODO Auto-generated method stub
return null;
|
public java.io.FileOutputStream | openFileOutput(java.lang.String arg0, int arg1)
// TODO Auto-generated method stub
return null;
|
public android.database.sqlite.SQLiteDatabase | openOrCreateDatabase(java.lang.String arg0, int arg1, android.database.sqlite.SQLiteDatabase.CursorFactory arg2)
// TODO Auto-generated method stub
return null;
|
public android.graphics.drawable.Drawable | peekWallpaper()
// TODO Auto-generated method stub
return null;
|
public android.content.Intent | registerReceiver(android.content.BroadcastReceiver arg0, android.content.IntentFilter arg1)
// TODO Auto-generated method stub
return null;
|
public android.content.Intent | registerReceiver(android.content.BroadcastReceiver arg0, android.content.IntentFilter arg1, java.lang.String arg2, android.os.Handler arg3)
// TODO Auto-generated method stub
return null;
|
public void | removeStickyBroadcast(android.content.Intent arg0)
// TODO Auto-generated method stub
|
com.android.layoutlib.api.IResourceValue | resolveResValue(com.android.layoutlib.api.IResourceValue value)Returns the {@link IResourceValue} referenced by the value of value.
This method ensures that it returns a {@link IResourceValue} object that does not
reference another resource.
If the resource cannot be resolved, it returns null .
If a value that does not need to be resolved is given, the method will return the input
value.
if (value == null) {
return null;
}
// if the resource value is a style, we simply return it.
if (value instanceof IStyleResourceValue) {
return value;
}
// else attempt to find another IResourceValue referenced by this one.
IResourceValue resolvedValue = findResValue(value.getValue());
// if the value did not reference anything, then we simply return the input value
if (resolvedValue == null) {
return value;
}
// otherwise, we attempt to resolve this new value as well
return resolveResValue(resolvedValue);
|
private com.android.layoutlib.api.IResourceValue | resolveValue(java.lang.String type, java.lang.String name, java.lang.String value)Resolves the value of a resource, if the value references a theme or resource value.
This method ensures that it returns a {@link IResourceValue} object that does not
reference another resource.
If the resource cannot be resolved, it returns null .
If a value that does not need to be resolved is given, the method will return a new
instance of IResourceValue that contains the input value.
if (value == null) {
return null;
}
// get the IResourceValue referenced by this value
IResourceValue resValue = findResValue(value);
// if resValue is null, but value is not null, this means it was not a reference.
// we return the name/value wrapper in a IResourceValue
if (resValue == null) {
return new ResourceValue(type, name, value);
}
// we resolved a first reference, but we need to make sure this isn't a reference also.
return resolveResValue(resValue);
|
public void | revokeUriPermission(android.net.Uri arg0, int arg1)
// TODO Auto-generated method stub
|
public java.lang.String | searchAttr(int attr)Searches for the attribute referenced by its internal id.
String[] info = Bridge.resolveResourceValue(attr);
if (info != null) {
return info[0];
}
info = mProjectCallback.resolveResourceValue(attr);
if (info != null) {
return info[0];
}
return null;
|
private java.util.TreeMap | searchAttrs(int[] attrs, boolean[] outFrameworkFlag)The input int[] attrs is one of com.android.internal.R.styleable fields where the name
of the field is the style being referenced and the array contains one index per attribute.
searchAttrs() finds all the names of the attributes referenced so for example if
attrs == com.android.internal.R.styleable.View, this returns the list of the "xyz" where
there's a field com.android.internal.R.styleable.View_xyz and the field value is the index
that is used to reference the attribute later in the TypedArray.
// get the name of the array from the framework resources
String arrayName = Bridge.resolveResourceValue(attrs);
if (arrayName != null) {
// if we found it, get the name of each of the int in the array.
TreeMap<Integer,String> attributes = new TreeMap<Integer, String>();
for (int i = 0 ; i < attrs.length ; i++) {
String[] info = Bridge.resolveResourceValue(attrs[i]);
if (info != null) {
attributes.put(i, info[0]);
} else {
// FIXME Not sure what we should be doing here...
attributes.put(i, null);
}
}
if (outFrameworkFlag != null) {
outFrameworkFlag[0] = true;
}
return attributes;
}
// if the name was not found in the framework resources, look in the project
// resources
arrayName = mProjectCallback.resolveResourceValue(attrs);
if (arrayName != null) {
TreeMap<Integer,String> attributes = new TreeMap<Integer, String>();
for (int i = 0 ; i < attrs.length ; i++) {
String[] info = mProjectCallback.resolveResourceValue(attrs[i]);
if (info != null) {
attributes.put(i, info[0]);
} else {
// FIXME Not sure what we should be doing here...
attributes.put(i, null);
}
}
if (outFrameworkFlag != null) {
outFrameworkFlag[0] = false;
}
return attributes;
}
return null;
|
public void | sendBroadcast(android.content.Intent arg0)
// TODO Auto-generated method stub
|
public void | sendBroadcast(android.content.Intent arg0, java.lang.String arg1)
// TODO Auto-generated method stub
|
public void | sendOrderedBroadcast(android.content.Intent arg0, java.lang.String arg1)
// TODO Auto-generated method stub
|
public void | sendOrderedBroadcast(android.content.Intent arg0, java.lang.String arg1, android.content.BroadcastReceiver arg2, android.os.Handler arg3, int arg4, java.lang.String arg5, android.os.Bundle arg6)
// TODO Auto-generated method stub
|
public void | sendStickyBroadcast(android.content.Intent arg0)
// TODO Auto-generated method stub
|
public void | setBridgeInflater(android.view.BridgeInflater inflater)
mInflater = inflater;
|
public void | setTheme(int arg0)
// TODO Auto-generated method stub
|
public void | setWallpaper(android.graphics.Bitmap arg0)
// TODO Auto-generated method stub
|
public void | setWallpaper(java.io.InputStream arg0)
// TODO Auto-generated method stub
|
public void | startActivity(android.content.Intent arg0)
// TODO Auto-generated method stub
|
public boolean | startInstrumentation(android.content.ComponentName arg0, java.lang.String arg1, android.os.Bundle arg2)
// TODO Auto-generated method stub
return false;
|
public android.content.ComponentName | startService(android.content.Intent arg0)
// TODO Auto-generated method stub
return null;
|
public boolean | stopService(android.content.Intent arg0)
// TODO Auto-generated method stub
return false;
|
public void | unbindService(android.content.ServiceConnection arg0)
// TODO Auto-generated method stub
|
public void | unregisterReceiver(android.content.BroadcastReceiver arg0)
// TODO Auto-generated method stub
|