IT. Expert System.

Android Reference

BridgeTypedArray


android.content.res

Class BridgeTypedArray



  • public final class BridgeTypedArray
    extends TypedArray
    Custom implementation of TypedArray to handle non compiled resources.
    • Constructor Detail

      • BridgeTypedArray

        public BridgeTypedArray(BridgeResources resources,
                        com.android.layoutlib.bridge.android.BridgeContext context,
                        int len,
                        boolean platformFile)
    • Method Detail

      • bridgeSetValue

        public void bridgeSetValue(int index,
                          String name,
                          boolean isFramework,
                          ResourceValue value)
        A bridge-specific method that sets a value in the type array
        Parameters:
        index - the index of the value in the TypedArray
        name - the name of the attribute
        isFramework - whether the attribute is in the android namespace.
        value - the value of the attribute
      • sealArray

        public void sealArray()
        Seals the array after all calls to #bridgeSetValue(int, String, ResourceValue) have been done.

        This allows to compute the list of non default values, permitting TypedArray.getIndexCount() to return the proper value.

      • length

        public int length()
        Return the number of values in this array.
        Overrides:
        length in class TypedArray
      • getText

        public CharSequence getText(int index)
        Retrieve the styled string value for the attribute at index.
        Overrides:
        getText in class TypedArray
        Parameters:
        index - Index of attribute to retrieve.
        Returns:
        CharSequence holding string data. May be styled. Returns null if the attribute is not defined.
      • getString

        public String getString(int index)
        Retrieve the string value for the attribute at index.
        Overrides:
        getString in class TypedArray
        Parameters:
        index - Index of attribute to retrieve.
        Returns:
        String holding string data. Any styling information is removed. Returns null if the attribute is not defined.
      • getBoolean

        public boolean getBoolean(int index,
                         boolean defValue)
        Retrieve the boolean value for the attribute at index.
        Overrides:
        getBoolean in class TypedArray
        Parameters:
        index - Index of attribute to retrieve.
        defValue - Value to return if the attribute is not defined.
        Returns:
        Attribute boolean value, or defValue if not defined.
      • getInt

        public int getInt(int index,
                 int defValue)
        Retrieve the integer value for the attribute at index.
        Overrides:
        getInt in class TypedArray
        Parameters:
        index - Index of attribute to retrieve.
        defValue - Value to return if the attribute is not defined.
        Returns:
        Attribute int value, or defValue if not defined.
      • getFloat

        public float getFloat(int index,
                     float defValue)
        Retrieve the float value for the attribute at index.
        Overrides:
        getFloat in class TypedArray
        Parameters:
        index - Index of attribute to retrieve.
        Returns:
        Attribute float value, or defValue if not defined..
      • getColor

        public int getColor(int index,
                   int defValue)
        Retrieve the color value for the attribute at index. If the attribute references a color resource holding a complex ColorStateList, then the default color from the set is returned.
        Overrides:
        getColor in class TypedArray
        Parameters:
        index - Index of attribute to retrieve.
        defValue - Value to return if the attribute is not defined or not a resource.
        Returns:
        Attribute color value, or defValue if not defined.
      • getColorStateList

        public ColorStateList getColorStateList(int index)
        Retrieve the ColorStateList for the attribute at index. The value may be either a single solid color or a reference to a color or complex ColorStateList description.
        Overrides:
        getColorStateList in class TypedArray
        Parameters:
        index - Index of attribute to retrieve.
        Returns:
        ColorStateList for the attribute, or null if not defined.
      • getInteger

        public int getInteger(int index,
                     int defValue)
        Retrieve the integer value for the attribute at index.
        Overrides:
        getInteger in class TypedArray
        Parameters:
        index - Index of attribute to retrieve.
        defValue - Value to return if the attribute is not defined or not a resource.
        Returns:
        Attribute integer value, or defValue if not defined.
      • getDimension

        public float getDimension(int index,
                         float defValue)
        Retrieve a dimensional unit attribute at index. Unit conversions are based on the current DisplayMetrics associated with the resources this TypedArray object came from.
        Overrides:
        getDimension in class TypedArray
        Parameters:
        index - Index of attribute to retrieve.
        defValue - Value to return if the attribute is not defined or not a resource.
        Returns:
        Attribute dimension value multiplied by the appropriate metric, or defValue if not defined.
        See Also:
        getDimensionPixelOffset(int, int), getDimensionPixelSize(int, int)
      • getDimensionPixelOffset

        public int getDimensionPixelOffset(int index,
                                  int defValue)
        Retrieve a dimensional unit attribute at index for use as an offset in raw pixels. This is the same as getDimension(int, float), except the returned value is converted to integer pixels for you. An offset conversion involves simply truncating the base value to an integer.
        Overrides:
        getDimensionPixelOffset in class TypedArray
        Parameters:
        index - Index of attribute to retrieve.
        defValue - Value to return if the attribute is not defined or not a resource.
        Returns:
        Attribute dimension value multiplied by the appropriate metric and truncated to integer pixels, or defValue if not defined.
        See Also:
        getDimension(int, float), getDimensionPixelSize(int, int)
      • getDimensionPixelSize

        public int getDimensionPixelSize(int index,
                                int defValue)
        Retrieve a dimensional unit attribute at index for use as a size in raw pixels. This is the same as getDimension(int, float), except the returned value is converted to 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.
        Overrides:
        getDimensionPixelSize in class TypedArray
        Parameters:
        index - Index of attribute to retrieve.
        defValue - Value to return if the attribute is not defined or not a resource.
        Returns:
        Attribute dimension value multiplied by the appropriate metric and truncated to integer pixels, or defValue if not defined.
        See Also:
        getDimension(int, float), getDimensionPixelOffset(int, int)
      • getLayoutDimension

        public int getLayoutDimension(int index,
                             String name)
        Special version of getDimensionPixelSize(int, int) for retrieving ViewGroup's layout_width and layout_height attributes. This is only here for performance reasons; applications should use getDimensionPixelSize(int, int).
        Overrides:
        getLayoutDimension in class TypedArray
        Parameters:
        index - Index of the attribute to retrieve.
        name - Textual name of attribute for error reporting.
        Returns:
        Attribute dimension value multiplied by the appropriate metric and truncated to integer pixels.
      • getLayoutDimension

        public int getLayoutDimension(int index,
                             int defValue)
        Description copied from class: TypedArray
        Special version of TypedArray.getDimensionPixelSize(int, int) for retrieving ViewGroup's layout_width and layout_height attributes. This is only here for performance reasons; applications should use TypedArray.getDimensionPixelSize(int, int).
        Overrides:
        getLayoutDimension in class TypedArray
        Parameters:
        index - Index of the attribute to retrieve.
        defValue - The default value to return if this attribute is not default or contains the wrong type of data.
        Returns:
        Attribute dimension value multiplied by the appropriate metric and truncated to integer pixels.
      • getFraction

        public float getFraction(int index,
                        int base,
                        int pbase,
                        float defValue)
        Retrieve a fractional unit attribute at index.
        Overrides:
        getFraction in class TypedArray
        Parameters:
        index - Index of attribute to retrieve.
        base - The base value of this fraction. In other words, a standard fraction is multiplied by this value.
        pbase - The parent base value of this fraction. In other words, a parent fraction (nn%p) is multiplied by this value.
        defValue - Value to return if the attribute is not defined or not a resource.
        Returns:
        Attribute fractional value multiplied by the appropriate base value, or defValue if not defined.
      • getResourceId

        public int getResourceId(int index,
                        int defValue)
        Retrieve the resource identifier for the attribute at index. Note that attribute resource as resolved when the overall TypedArray object is retrieved. As a result, this function will return the resource identifier of the final resource value that was found, not necessarily the original resource that was specified by the attribute.
        Overrides:
        getResourceId in class TypedArray
        Parameters:
        index - Index of attribute to retrieve.
        defValue - Value to return if the attribute is not defined or not a resource.
        Returns:
        Attribute resource identifier, or defValue if not defined.
      • getDrawable

        public Drawable getDrawable(int index)
        Retrieve the Drawable for the attribute at index. This gets the resource ID of the selected attribute, and uses Resources.getDrawable of the owning Resources object to retrieve its Drawable.
        Overrides:
        getDrawable in class TypedArray
        Parameters:
        index - Index of attribute to retrieve.
        Returns:
        Drawable for the attribute, or null if not defined.
      • getTextArray

        public CharSequence[] getTextArray(int index)
        Retrieve the CharSequence[] for the attribute at index. This gets the resource ID of the selected attribute, and uses Resources.getTextArray of the owning Resources object to retrieve its String[].
        Overrides:
        getTextArray in class TypedArray
        Parameters:
        index - Index of attribute to retrieve.
        Returns:
        CharSequence[] for the attribute, or null if not defined.
      • getValue

        public boolean getValue(int index,
                       TypedValue outValue)
        Retrieve the raw TypedValue for the attribute at index.
        Overrides:
        getValue in class TypedArray
        Parameters:
        index - Index of attribute to retrieve.
        outValue - TypedValue object in which to place the attribute's data.
        Returns:
        Returns true if the value was retrieved, else false.
      • hasValue

        public boolean hasValue(int index)
        Determines whether there is an attribute at index.
        Overrides:
        hasValue in class TypedArray
        Parameters:
        index - Index of attribute to retrieve.
        Returns:
        True if the attribute has a value, false otherwise.
      • peekValue

        public TypedValue peekValue(int index)
        Retrieve the raw TypedValue for the attribute at index and return a temporary object holding its data. This object is only valid until the next call on to TypedArray.
        Overrides:
        peekValue in class TypedArray
        Parameters:
        index - Index of attribute to retrieve.
        Returns:
        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.)
      • getPositionDescription

        public String getPositionDescription()
        Returns a message about the parser state suitable for printing error messages.
        Overrides:
        getPositionDescription in class TypedArray
      • recycle

        public void recycle()
        Give back a previously retrieved StyledAttributes, for later re-use.
        Overrides:
        recycle in class TypedArray
      • toString

        public String toString()
        Description copied from class: Object
        Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:
           getClass().getName() + '@' + Integer.toHexString(hashCode())

        See Writing a useful toString method if you intend implementing your own toString method.

        Overrides:
        toString in class TypedArray
        Returns:
        a printable representation of this object.


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 3 / 158855337. Delta: 2.00455 с