Merge change 8262 into donut
* changes:
Implement the device ConfigurationInfo.reqGlEsVersion field.
diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java
index 0380c90..26b5b7a 100644
--- a/core/java/android/app/SearchDialog.java
+++ b/core/java/android/app/SearchDialog.java
@@ -541,6 +541,8 @@
mSearchAutoComplete.setDropDownAlwaysVisible(false);
}
+ mSearchAutoComplete.setForceIgnoreOutsideTouch(true);
+
// attach the suggestions adapter, if suggestions are available
// The existence of a suggestions authority is the proxy for "suggestions available here"
if (mSearchable.getSuggestAuthority() != null) {
diff --git a/core/java/android/app/SuggestionsAdapter.java b/core/java/android/app/SuggestionsAdapter.java
index 4cd35a4..54061ae 100644
--- a/core/java/android/app/SuggestionsAdapter.java
+++ b/core/java/android/app/SuggestionsAdapter.java
@@ -360,10 +360,6 @@
newBg.addState(new int[]{android.R.attr.state_selected}, transparent);
newBg.addState(new int[]{android.R.attr.state_pressed}, transparent);
newBg.addState(new int[]{}, background);
- // Workaround for the fact that StateListDrawable.getPadding(Rect) always returns
- // true, and thus sets the padding of any view that has it as a background.
- ((DrawableContainer.DrawableContainerState) newBg.getConstantState())
- .setVariablePadding(true);
mBackgroundsCache.put(backgroundColor, newBg.getConstantState());
return newBg;
}
diff --git a/core/java/android/database/MatrixCursor.java b/core/java/android/database/MatrixCursor.java
index cf5a573..d5c3a32 100644
--- a/core/java/android/database/MatrixCursor.java
+++ b/core/java/android/database/MatrixCursor.java
@@ -214,53 +214,64 @@
// AbstractCursor implementation.
+ @Override
public int getCount() {
return rowCount;
}
+ @Override
public String[] getColumnNames() {
return columnNames;
}
+ @Override
public String getString(int column) {
- return String.valueOf(get(column));
+ Object value = get(column);
+ if (value == null) return null;
+ return value.toString();
}
+ @Override
public short getShort(int column) {
Object value = get(column);
- return (value instanceof String)
- ? Short.valueOf((String) value)
- : ((Number) value).shortValue();
+ if (value == null) return 0;
+ if (value instanceof Number) return ((Number) value).shortValue();
+ return Short.parseShort(value.toString());
}
+ @Override
public int getInt(int column) {
Object value = get(column);
- return (value instanceof String)
- ? Integer.valueOf((String) value)
- : ((Number) value).intValue();
+ if (value == null) return 0;
+ if (value instanceof Number) return ((Number) value).intValue();
+ return Integer.parseInt(value.toString());
}
+ @Override
public long getLong(int column) {
Object value = get(column);
- return (value instanceof String)
- ? Long.valueOf((String) value)
- : ((Number) value).longValue();
+ if (value == null) return 0;
+ if (value instanceof Number) return ((Number) value).longValue();
+ return Long.parseLong(value.toString());
}
+ @Override
public float getFloat(int column) {
Object value = get(column);
- return (value instanceof String)
- ? Float.valueOf((String) value)
- : ((Number) value).floatValue();
+ if (value == null) return 0.0f;
+ if (value instanceof Number) return ((Number) value).floatValue();
+ return Float.parseFloat(value.toString());
}
+ @Override
public double getDouble(int column) {
Object value = get(column);
- return (value instanceof String)
- ? Double.valueOf((String) value)
- : ((Number) value).doubleValue();
+ if (value == null) return 0.0d;
+ if (value instanceof Number) return ((Number) value).doubleValue();
+ return Double.parseDouble(value.toString());
}
+ @Override
public boolean isNull(int column) {
return get(column) == null;
}
diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java
index 95bba97..c73d29e 100644
--- a/core/java/android/view/SurfaceView.java
+++ b/core/java/android/view/SurfaceView.java
@@ -140,7 +140,14 @@
int mType = -1;
final Rect mSurfaceFrame = new Rect();
private Translator mTranslator;
-
+
+ // A flag to indicate that the Canvas has to be scaled
+ private boolean mScaleCanvas = false;
+ // A flag to indicate that the Canvas is in use and being scaled.
+ // This may remain to be false even if mScaleCanvas is true if the applicatio
+ // does not use the canvas (such as GLSurfaceView, VideoView).
+ private boolean mCanvasScaled = false;
+
public SurfaceView(Context context) {
super(context);
setWillNotDraw(true);
@@ -254,18 +261,21 @@
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
- // SurfaceView uses pre-scaled size unless fixed size is requested. This hook
- // scales the event back to the pre-scaled coordinates for such surface.
- if (mScaled) {
+ if (mTranslator == null || mCanvasScaled) {
+ // Use the event as is if no scaling is required, or the surface's canvas
+ // is scaled too.
+ return super.dispatchTouchEvent(event);
+ } else {
+ // The surface is in native size, so we need to scale the event
+ // back to native location.
MotionEvent scaledBack = MotionEvent.obtain(event);
- mTranslator.translateEventInScreenToAppWindow(event);
+ // scale back to original
+ scaledBack.scale(mTranslator.applicationScale);
try {
return super.dispatchTouchEvent(scaledBack);
} finally {
scaledBack.recycle();
}
- } else {
- return super.dispatchTouchEvent(event);
}
}
@@ -291,8 +301,6 @@
mWindowType = type;
}
- boolean mScaled = false;
-
private void updateWindow(boolean force) {
if (!mHaveFrame) {
return;
@@ -301,7 +309,7 @@
mTranslator = viewRoot.mTranslator;
float appScale = mTranslator == null ? 1.0f : mTranslator.applicationScale;
-
+
Resources res = getContext().getResources();
if (mTranslator != null || !res.getCompatibilityInfo().supportsScreen()) {
mSurface.setCompatibleDisplayMetrics(res.getDisplayMetrics());
@@ -312,14 +320,15 @@
int myHeight = mRequestedHeight;
if (myHeight <= 0) myHeight = getHeight();
- // Use original size if the app specified the size of the view,
- // and let the flinger to scale up.
+ // Use requested size if the app specified the size of the view
+ // and let the flinger to scale up. Otherwise, use the native size
+ // (* appScale) and assume the application can handle it.
if (mRequestedWidth <= 0 && mTranslator != null) {
myWidth = (int) (myWidth * appScale + 0.5f);
myHeight = (int) (myHeight * appScale + 0.5f);
- mScaled = true;
+ mScaleCanvas = true;
} else {
- mScaled = false;
+ mScaleCanvas = false;
}
getLocationInWindow(mLocation);
@@ -641,7 +650,9 @@
if (localLOGV) Log.i(TAG, "Returned canvas: " + c);
if (c != null) {
mLastLockTime = SystemClock.uptimeMillis();
- if (mScaled) {
+ if (mScaleCanvas) {
+ // When the canvas is scaled, don't scale back the event's location.
+ mCanvasScaled = true;
mSaveCount = c.save();
mTranslator.translateCanvas(c);
}
@@ -667,7 +678,7 @@
}
public void unlockCanvasAndPost(Canvas canvas) {
- if (mScaled) {
+ if (mCanvasScaled) {
canvas.restoreToCount(mSaveCount);
}
mSurface.unlockCanvasAndPost(canvas);
diff --git a/core/java/android/widget/AutoCompleteTextView.java b/core/java/android/widget/AutoCompleteTextView.java
index 47798a4..6848a55 100644
--- a/core/java/android/widget/AutoCompleteTextView.java
+++ b/core/java/android/widget/AutoCompleteTextView.java
@@ -116,6 +116,8 @@
private boolean mDropDownAlwaysVisible = false;
private boolean mDropDownDismissedOnCompletion = true;
+
+ private boolean mForceIgnoreOutsideTouch = false;
private int mLastKeyCode = KeyEvent.KEYCODE_UNKNOWN;
private boolean mOpenBefore;
@@ -1142,6 +1144,8 @@
heightSpec = mDropDownHeight;
}
+ mPopup.setOutsideTouchable(mForceIgnoreOutsideTouch ? false : !mDropDownAlwaysVisible);
+
mPopup.update(getDropDownAnchorView(), mDropDownHorizontalOffset,
mDropDownVerticalOffset, widthSpec, heightSpec);
} else {
@@ -1170,7 +1174,7 @@
// use outside touchable to dismiss drop down when touching outside of it, so
// only set this if the dropdown is not always visible
- mPopup.setOutsideTouchable(!mDropDownAlwaysVisible);
+ mPopup.setOutsideTouchable(mForceIgnoreOutsideTouch ? false : !mDropDownAlwaysVisible);
mPopup.setTouchInterceptor(new PopupTouchIntercepter());
mPopup.showAsDropDown(getDropDownAnchorView(),
mDropDownHorizontalOffset, mDropDownVerticalOffset);
@@ -1179,6 +1183,17 @@
post(mHideSelector);
}
}
+
+ /**
+ * Forces outside touches to be ignored. Normally if {@link #isDropDownAlwaysVisible()} is
+ * false, we allow outside touch to dismiss the dropdown. If this is set to true, then we
+ * ignore outside touch even when the drop down is not set to always visible.
+ *
+ * @hide used only by SearchDialog
+ */
+ public void setForceIgnoreOutsideTouch(boolean forceIgnoreOutsideTouch) {
+ mForceIgnoreOutsideTouch = forceIgnoreOutsideTouch;
+ }
/**
* <p>Builds the popup window's content and returns the height the popup
diff --git a/media/jni/soundpool/SoundPool.cpp b/media/jni/soundpool/SoundPool.cpp
index ce80f92..1fdecdd 100644
--- a/media/jni/soundpool/SoundPool.cpp
+++ b/media/jni/soundpool/SoundPool.cpp
@@ -18,8 +18,7 @@
#define LOG_TAG "SoundPool"
#include <utils/Log.h>
-//
-#define USE_SHARED_MEM_BUFFER
+//#define USE_SHARED_MEM_BUFFER
// XXX needed for timing latency
#include <utils/Timers.h>
diff --git a/tests/CoreTests/android/database/MatrixCursorTest.java b/tests/CoreTests/android/database/MatrixCursorTest.java
index fb8a12f..cddc6c4 100644
--- a/tests/CoreTests/android/database/MatrixCursorTest.java
+++ b/tests/CoreTests/android/database/MatrixCursorTest.java
@@ -32,6 +32,12 @@
cursor.newRow().add(null);
cursor.moveToNext();
assertTrue(cursor.isNull(0));
+ assertNull(cursor.getString(0));
+ assertEquals(0, cursor.getShort(0));
+ assertEquals(0, cursor.getInt(0));
+ assertEquals(0L, cursor.getLong(0));
+ assertEquals(0.0f, cursor.getFloat(0));
+ assertEquals(0.0d, cursor.getDouble(0));
}
public void testMatrixCursor() {
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeTypedArray.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeTypedArray.java
index 48998db..10421de 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeTypedArray.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeTypedArray.java
@@ -39,7 +39,7 @@
* TODO: describe.
*/
public final class BridgeTypedArray extends TypedArray {
-
+
@SuppressWarnings("hiding")
private BridgeResources mResources;
private BridgeContext mContext;
@@ -47,7 +47,7 @@
private IResourceValue[] mData;
private String[] mNames;
private final boolean mPlatformFile;
-
+
public BridgeTypedArray(BridgeResources resources, BridgeContext context, int len,
boolean platformFile) {
super(null, null, null, 0);
@@ -58,12 +58,12 @@
mNames = new String[len];
}
- /** A bridge-specific method that sets a value in the type array */
+ /** A bridge-specific method that sets a value in the type array */
public void bridgeSetValue(int index, String name, IResourceValue value) {
mData[index] = value;
mNames[index] = name;
}
-
+
/**
* Seals the array after all calls to {@link #bridgeSetValue(int, String, IResourceValue)} have
* been done.
@@ -79,11 +79,11 @@
count++;
}
}
-
+
// allocate the table with an extra to store the size
mIndices = new int[count+1];
mIndices[0] = count;
-
+
// fill the array with the indices.
int index = 1;
for (int i = 0 ; i < mData.length ; i++) {
@@ -100,7 +100,7 @@
public int length() {
return mData.length;
}
-
+
/**
* Return the Resources object this array was loaded from.
*/
@@ -108,13 +108,13 @@
public Resources getResources() {
return mResources;
}
-
+
/**
* Retrieve the styled string value for the attribute at <var>index</var>.
- *
+ *
* @param index Index of attribute to retrieve.
- *
- * @return CharSequence holding string data. May be styled. Returns
+ *
+ * @return CharSequence holding string data. May be styled. Returns
* null if the attribute is not defined.
*/
@Override
@@ -129,9 +129,9 @@
/**
* Retrieve the string value for the attribute at <var>index</var>.
- *
+ *
* @param index Index of attribute to retrieve.
- *
+ *
* @return String holding string data. Any styling information is
* removed. Returns null if the attribute is not defined.
*/
@@ -140,16 +140,16 @@
if (mData[index] != null) {
return mData[index].getValue();
}
-
+
return null;
}
/**
* Retrieve the boolean value for the attribute at <var>index</var>.
- *
+ *
* @param index Index of attribute to retrieve.
* @param defValue Value to return if the attribute is not defined.
- *
+ *
* @return Attribute boolean value, or defValue if not defined.
*/
@Override
@@ -162,16 +162,16 @@
if (s != null) {
return XmlUtils.convertValueToBoolean(s, defValue);
}
-
+
return defValue;
}
/**
* Retrieve the integer value for the attribute at <var>index</var>.
- *
+ *
* @param index Index of attribute to retrieve.
* @param defValue Value to return if the attribute is not defined.
- *
+ *
* @return Attribute int value, or defValue if not defined.
*/
@Override
@@ -181,7 +181,7 @@
}
String s = mData[index].getValue();
-
+
try {
return (s == null) ? defValue : XmlUtils.convertValueToInt(s, defValue);
} catch (NumberFormatException e) {
@@ -192,11 +192,11 @@
// Check for possible constants and try to find them.
// Get the map of attribute-constant -> IntegerValue
Map<String, Integer> map = Bridge.getEnumValues(mNames[index]);
-
+
if (map != null) {
// accumulator to store the value of the 1+ constants.
int result = 0;
-
+
// split the value in case this is a mix of several flags.
String[] keywords = s.split("\\|");
for (String keyword : keywords) {
@@ -217,9 +217,9 @@
/**
* Retrieve the float value for the attribute at <var>index</var>.
- *
+ *
* @param index Index of attribute to retrieve.
- *
+ *
* @return Attribute float value, or defValue if not defined..
*/
@Override
@@ -237,23 +237,23 @@
mContext.getLogger().warning(String.format(
"Unable to convert \"%s\" into a float in attribute \"%2$s\"",
s, mNames[index]));
-
+
// we'll return the default value below.
}
}
return defValue;
}
-
+
/**
* Retrieve the color value for the attribute at <var>index</var>. If
* the attribute references a color resource holding a complex
* {@link android.content.res.ColorStateList}, then the default color from
* the set is returned.
- *
+ *
* @param index Index of attribute to retrieve.
* @param defValue Value to return if the attribute is not defined or
* not a resource.
- *
+ *
* @return Attribute color value, or defValue if not defined.
*/
@Override
@@ -261,7 +261,7 @@
if (mData[index] == null) {
return defValue;
}
-
+
String s = mData[index].getValue();
try {
return ResourceHelper.getColor(s);
@@ -280,9 +280,9 @@
* Retrieve the ColorStateList for the attribute at <var>index</var>.
* The value may be either a single solid color or a reference to
* a color or complex {@link android.content.res.ColorStateList} description.
- *
+ *
* @param index Index of attribute to retrieve.
- *
+ *
* @return ColorStateList for the attribute, or null if not defined.
*/
@Override
@@ -296,14 +296,14 @@
if (value == null) {
return null;
}
-
+
try {
int color = ResourceHelper.getColor(value);
return ColorStateList.valueOf(color);
} catch (NumberFormatException e) {
// if it's not a color value, we'll attempt to read the xml based color below.
}
-
+
// let the framework inflate the ColorStateList from the XML file.
try {
File f = new File(value);
@@ -311,7 +311,7 @@
KXmlParser parser = new KXmlParser();
parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
parser.setInput(new FileReader(f));
-
+
ColorStateList colorStateList = ColorStateList.createFromXml(
mContext.getResources(),
// FIXME: we need to know if this resource is platform or not
@@ -325,22 +325,22 @@
// return null below.
}
-
+
// looks like were unable to resolve the color value.
mContext.getLogger().warning(String.format(
"Unable to resolve color value \"%1$s\" in attribute \"%2$s\"",
value, mNames[index]));
-
+
return null;
}
-
+
/**
* Retrieve the integer value for the attribute at <var>index</var>.
- *
+ *
* @param index Index of attribute to retrieve.
* @param defValue Value to return if the attribute is not defined or
* not a resource.
- *
+ *
* @return Attribute integer value, or defValue if not defined.
*/
@Override
@@ -362,23 +362,23 @@
// The default value is returned below.
}
}
-
+
return defValue;
}
/**
- * Retrieve a dimensional unit attribute at <var>index</var>. Unit
- * conversions are based on the current {@link DisplayMetrics}
- * associated with the resources this {@link TypedArray} object
- * came from.
- *
+ * Retrieve a dimensional unit attribute at <var>index</var>. Unit
+ * conversions are based on the current {@link DisplayMetrics}
+ * associated with the resources this {@link TypedArray} object
+ * came from.
+ *
* @param index Index of attribute to retrieve.
* @param defValue Value to return if the attribute is not defined or
* not a resource.
- *
- * @return Attribute dimension value multiplied by the appropriate
+ *
+ * @return Attribute dimension value multiplied by the appropriate
* metric, or defValue if not defined.
- *
+ *
* @see #getDimensionPixelOffset
* @see #getDimensionPixelSize
*/
@@ -397,11 +397,11 @@
} else if (s.equals(BridgeConstants.WRAP_CONTENT)) {
return LayoutParams.WRAP_CONTENT;
}
-
+
if (ResourceHelper.stringToFloat(s, mValue)) {
return mValue.getDimension(mResources.mMetrics);
}
-
+
// looks like we were unable to resolve the dimension value
mContext.getLogger().warning(String.format(
"Unable to resolve dimension value \"%1$s\" in attribute \"%2$s\"",
@@ -416,14 +416,14 @@
* {@link #getDimension}, except the returned value is converted to
* integer pixels for you. An offset conversion involves simply
* truncating the base value to an integer.
- *
+ *
* @param index Index of attribute to retrieve.
* @param defValue Value to return if the attribute is not defined or
* not a resource.
- *
- * @return Attribute dimension value multiplied by the appropriate
+ *
+ * @return Attribute dimension value multiplied by the appropriate
* metric and truncated to integer pixels, or defValue if not defined.
- *
+ *
* @see #getDimension
* @see #getDimensionPixelSize
*/
@@ -439,14 +439,14 @@
* integer pixels for use as a size. A size conversion involves
* rounding the base value, and ensuring that a non-zero base value
* is at least one pixel in size.
- *
+ *
* @param index Index of attribute to retrieve.
* @param defValue Value to return if the attribute is not defined or
* not a resource.
- *
- * @return Attribute dimension value multiplied by the appropriate
+ *
+ * @return Attribute dimension value multiplied by the appropriate
* metric and truncated to integer pixels, or defValue if not defined.
- *
+ *
* @see #getDimension
* @see #getDimensionPixelOffset
*/
@@ -465,7 +465,7 @@
} else if (s.equals(BridgeConstants.WRAP_CONTENT)) {
return LayoutParams.WRAP_CONTENT;
}
-
+
// FIXME huh?
float f = getDimension(index, defValue);
@@ -483,11 +483,11 @@
* {@link android.view.ViewGroup}'s layout_width and layout_height
* attributes. This is only here for performance reasons; applications
* should use {@link #getDimensionPixelSize}.
- *
+ *
* @param index Index of the attribute to retrieve.
* @param name Textual name of attribute for error reporting.
- *
- * @return Attribute dimension value multiplied by the appropriate
+ *
+ * @return Attribute dimension value multiplied by the appropriate
* metric and truncated to integer pixels.
*/
@Override
@@ -495,20 +495,25 @@
return getDimensionPixelSize(index, 0);
}
+ @Override
+ public int getLayoutDimension(int index, int defValue) {
+ return getDimensionPixelSize(index, defValue);
+ }
+
/**
* Retrieve a fractional unit attribute at <var>index</var>.
- *
- * @param index Index of attribute to retrieve.
- * @param base The base value of this fraction. In other words, a
+ *
+ * @param index Index of attribute to retrieve.
+ * @param base The base value of this fraction. In other words, a
* standard fraction is multiplied by this value.
- * @param pbase The parent base value of this fraction. In other
+ * @param pbase The parent base value of this fraction. In other
* words, a parent fraction (nn%p) is multiplied by this
* value.
* @param defValue Value to return if the attribute is not defined or
* not a resource.
- *
- * @return Attribute fractional value multiplied by the appropriate
- * base value, or defValue if not defined.
+ *
+ * @return Attribute fractional value multiplied by the appropriate
+ * base value, or defValue if not defined.
*/
@Override
public float getFraction(int index, int base, int pbase, float defValue) {
@@ -520,7 +525,7 @@
if (value == null) {
return defValue;
}
-
+
if (ResourceHelper.stringToFloat(value, mValue)) {
return mValue.getFraction(base, pbase);
}
@@ -529,29 +534,29 @@
mContext.getLogger().warning(String.format(
"Unable to resolve fraction value \"%1$s\" in attribute \"%2$s\"",
value, mNames[index]));
-
+
return defValue;
}
/**
* Retrieve the resource identifier for the attribute at
- * <var>index</var>. Note that attribute resource as resolved when
- * the overall {@link TypedArray} object is retrieved. As a
- * result, this function will return the resource identifier of the
- * final resource value that was found, <em>not</em> necessarily the
- * original resource that was specified by the attribute.
- *
+ * <var>index</var>. Note that attribute resource as resolved when
+ * the overall {@link TypedArray} object is retrieved. As a
+ * result, this function will return the resource identifier of the
+ * final resource value that was found, <em>not</em> necessarily the
+ * original resource that was specified by the attribute.
+ *
* @param index Index of attribute to retrieve.
* @param defValue Value to return if the attribute is not defined or
* not a resource.
- *
+ *
* @return Attribute resource identifier, or defValue if not defined.
*/
@Override
public int getResourceId(int index, int defValue) {
// get the IResource for this index
IResourceValue resValue = mData[index];
-
+
// no data, return the default value.
if (resValue == null) {
return defValue;
@@ -562,7 +567,7 @@
// get the id that will represent this style.
return mContext.getDynamicIdByStyle((IStyleResourceValue)resValue);
}
-
+
// if the attribute was a reference to an id, and not a declaration of an id (@+id), then
// the xml attribute value was "resolved" which leads us to a IResourceValue with
// getType() returning "id" and getName() returning the id name
@@ -583,7 +588,7 @@
if (value == null) {
return defValue;
}
-
+
// if the value is just an integer, return it.
try {
int i = Integer.parseInt(value);
@@ -601,14 +606,14 @@
// fact in the android.R and com.android.internal.R classes.
// The field mPlatformFile will indicate that all IDs are to be looked up in the android R
// classes exclusively.
-
+
// if this is a reference to an id, find it.
if (value.startsWith("@id/") || value.startsWith("@+") ||
value.startsWith("@android:id/")) {
-
+
int pos = value.indexOf('/');
String idName = value.substring(pos + 1);
-
+
// if this is a framework id
if (mPlatformFile || value.startsWith("@android") || value.startsWith("@+android")) {
// look for idName in the android R classes
@@ -621,7 +626,7 @@
// not a direct id valid reference? resolve it
Integer idValue = null;
-
+
if (resValue.isFramework()) {
idValue = Bridge.getResourceValue(resValue.getType(), resValue.getName());
} else {
@@ -632,7 +637,7 @@
if (idValue != null) {
return idValue.intValue();
}
-
+
mContext.getLogger().warning(String.format(
"Unable to resolve id \"%1$s\" for attribute \"%2$s\"", value, mNames[index]));
return defValue;
@@ -643,9 +648,9 @@
* gets the resource ID of the selected attribute, and uses
* {@link Resources#getDrawable Resources.getDrawable} of the owning
* Resources object to retrieve its Drawable.
- *
+ *
* @param index Index of attribute to retrieve.
- *
+ *
* @return Drawable for the attribute, or null if not defined.
*/
@Override
@@ -658,13 +663,13 @@
if (value == null || BridgeConstants.REFERENCE_NULL.equals(value)) {
return null;
}
-
+
Drawable d = ResourceHelper.getDrawable(value, mContext, mData[index].isFramework());
-
+
if (d != null) {
return d;
}
-
+
// looks like we were unable to resolve the drawable
mContext.getLogger().warning(String.format(
"Unable to resolve drawable \"%1$s\" in attribute \"%2$s\"", value, mNames[index]));
@@ -678,9 +683,9 @@
* This gets the resource ID of the selected attribute, and uses
* {@link Resources#getTextArray Resources.getTextArray} of the owning
* Resources object to retrieve its String[].
- *
+ *
* @param index Index of attribute to retrieve.
- *
+ *
* @return CharSequence[] for the attribute, or null if not defined.
*/
@Override
@@ -693,7 +698,7 @@
if (value != null) {
return new CharSequence[] { value };
}
-
+
mContext.getLogger().warning(String.format(
String.format("Unknown value for getTextArray(%d) => %s", //DEBUG
index, mData[index].getName())));
@@ -703,44 +708,44 @@
/**
* Retrieve the raw TypedValue for the attribute at <var>index</var>.
- *
+ *
* @param index Index of attribute to retrieve.
* @param outValue TypedValue object in which to place the attribute's
* data.
- *
- * @return Returns true if the value was retrieved, else false.
+ *
+ * @return Returns true if the value was retrieved, else false.
*/
@Override
public boolean getValue(int index, TypedValue outValue) {
if (mData[index] == null) {
return false;
}
-
+
String s = mData[index].getValue();
-
+
return ResourceHelper.stringToFloat(s, outValue);
}
/**
* Determines whether there is an attribute at <var>index</var>.
- *
+ *
* @param index Index of attribute to retrieve.
- *
+ *
* @return True if the attribute has a value, false otherwise.
*/
@Override
public boolean hasValue(int index) {
return mData[index] != null;
}
-
+
/**
- * Retrieve the raw TypedValue for the attribute at <var>index</var>
- * and return a temporary object holding its data. This object is only
- * valid until the next call on to {@link TypedArray}.
- *
+ * Retrieve the raw TypedValue for the attribute at <var>index</var>
+ * and return a temporary object holding its data. This object is only
+ * valid until the next call on to {@link TypedArray}.
+ *
* @param index Index of attribute to retrieve.
- *
- * @return Returns a TypedValue object if the attribute is defined,
+ *
+ * @return Returns a TypedValue object if the attribute is defined,
* containing its data; otherwise returns null. (You will not
* receive a TypedValue whose type is TYPE_NULL.)
*/
@@ -749,7 +754,7 @@
if (getValue(index, mValue)) {
return mValue;
}
-
+
return null;
}