Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
android.content.res.Resources Maven / Gradle / Ivy
Go to download
provide android hidden api definition ,helper for android super framework development
package android.content.res;
import android.animation.Animator;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.pm.ActivityInfo;
import android.graphics.Movie;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable.ConstantState;
import android.graphics.drawable.DrawableInflater;
import android.os.Bundle;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.LongSparseArray;
import android.util.TypedValue;
import android.view.DisplayAdjustments;
import android.view.ViewHierarchyEncoder;
import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
import java.io.InputStream;
public class Resources {
/**
* Returns the most appropriate default theme for the specified target SDK version.
*
* Below API 11: Gingerbread
* APIs 12 thru 14: Holo
* APIs 15 thru 23: Device default dark
* APIs 24 and above: Device default light with dark action bar
*
*
* @param curTheme The current theme, or 0 if not specified.
* @param targetSdkVersion The target SDK version.
* @return A theme resource identifier
* @hide
*/
public static int selectDefaultTheme(int curTheme, int targetSdkVersion) {
throw new UnsupportedOperationException("STUB");
}
/** @hide */
public static int selectSystemTheme(int curTheme, int targetSdkVersion, int orig, int holo,
int dark, int deviceDefault) {
throw new UnsupportedOperationException("STUB");
}
/**
* Return a global shared Resources object that provides access to only
* system resources (no application resources), and is not configured for
* the current screen (can not use dimension units, does not change based
* on orientation, etc).
*/
public static Resources getSystem() {
throw new UnsupportedOperationException("STUB");
}
/**
* This exception is thrown by the resource APIs when a requested resource
* can not be found.
*/
public static class NotFoundException extends RuntimeException {
public NotFoundException() {
}
public NotFoundException(String name) {
super(name);
}
public NotFoundException(String name, Exception cause) {
super(name, cause);
}
}
/**
* Create a new Resources object on top of an existing set of assets in an
* AssetManager.
*
* @deprecated Resources should not be constructed by apps.
* See {@link android.content.Context#createConfigurationContext(Configuration)}.
*
* @param assets Previously created AssetManager.
* @param metrics Current display metrics to consider when
* selecting/computing resource values.
* @param config Desired device configuration to consider when
* selecting/computing resource values (optional).
*/
@Deprecated
public Resources(AssetManager assets, DisplayMetrics metrics, Configuration config) {
throw new UnsupportedOperationException("STUB");
}
/**
* Creates a new Resources object with CompatibilityInfo.
*
* @param classLoader class loader for the package used to load custom
* resource classes, may be {@code null} to use system
* class loader
* @hide
*/
public Resources(@Nullable ClassLoader classLoader) {
throw new UnsupportedOperationException("STUB");
}
/**
* Set the underlying implementation (containing all the resources and caches)
* and updates all Theme references to new implementations as well.
* @hide
*/
public void setImpl(ResourcesImpl impl) {
throw new UnsupportedOperationException("STUB");
}
/**
* @hide
*/
public ResourcesImpl getImpl() {
throw new UnsupportedOperationException("STUB");
}
/**
* @hide
*/
public ClassLoader getClassLoader() {
throw new UnsupportedOperationException("STUB");
}
/**
* @return the inflater used to create drawable objects
* @hide Pending API finalization.
*/
public final DrawableInflater getDrawableInflater() {
throw new UnsupportedOperationException("STUB");
}
/**
* Used by AnimatorInflater.
*
* @hide
*/
public ConfigurationBoundResourceCache getAnimatorCache() {
throw new UnsupportedOperationException("STUB");
}
/**
* Used by AnimatorInflater.
*
* @hide
*/
public ConfigurationBoundResourceCache getStateListAnimatorCache() {
throw new UnsupportedOperationException("STUB");
}
/**
* Return the string value associated with a particular resource ID. The
* returned object will be a String if this is a plain string; it will be
* some other type of CharSequence if it is styled.
* {@more}
*
* @param id The desired resource identifier, as generated by the aapt
* tool. This integer encodes the package, type, and resource
* entry. The value 0 is an invalid identifier.
*
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*
* @return CharSequence The string data associated with the resource, plus
* possibly styled text information.
*/
@NonNull public CharSequence getText(int id) throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* Return the Typeface value associated with a particular resource ID.
* {@more}
*
* @param id The desired resource identifier, as generated by the aapt
* tool. This integer encodes the package, type, and resource
* entry. The value 0 is an invalid identifier.
*
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*
* @return Typeface The Typeface data associated with the resource.
*/
@NonNull public Typeface getFont(int id) throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* @hide
*/
public void preloadFonts(int id) {
throw new UnsupportedOperationException("STUB");
}
/**
* Returns the character sequence necessary for grammatically correct pluralization
* of the given resource ID for the given quantity.
* Note that the character sequence is selected based solely on grammatical necessity,
* and that such rules differ between languages. Do not assume you know which string
* will be returned for a given quantity. See
* String Resources
* for more detail.
*
* @param id The desired resource identifier, as generated by the aapt
* tool. This integer encodes the package, type, and resource
* entry. The value 0 is an invalid identifier.
* @param quantity The number used to get the correct string for the current language's
* plural rules.
*
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*
* @return CharSequence The string data associated with the resource, plus
* possibly styled text information.
*/
@NonNull
public CharSequence getQuantityText(int id, int quantity)
throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* Return the string value associated with a particular resource ID. It
* will be stripped of any styled text information.
* {@more}
*
* @param id The desired resource identifier, as generated by the aapt
* tool. This integer encodes the package, type, and resource
* entry. The value 0 is an invalid identifier.
*
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*
* @return String The string data associated with the resource,
* stripped of styled text information.
*/
@NonNull
public String getString(int id) throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* Return the string value associated with a particular resource ID,
* substituting the format arguments as defined in {@link java.util.Formatter}
* and {@link java.lang.String#format}. It will be stripped of any styled text
* information.
* {@more}
*
* @param id The desired resource identifier, as generated by the aapt
* tool. This integer encodes the package, type, and resource
* entry. The value 0 is an invalid identifier.
*
* @param formatArgs The format arguments that will be used for substitution.
*
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*
* @return String The string data associated with the resource,
* stripped of styled text information.
*/
@NonNull
public String getString(int id, Object... formatArgs) throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* Formats the string necessary for grammatically correct pluralization
* of the given resource ID for the given quantity, using the given arguments.
* Note that the string is selected based solely on grammatical necessity,
* and that such rules differ between languages. Do not assume you know which string
* will be returned for a given quantity. See
* String Resources
* for more detail.
*
* Substitution of format arguments works as if using
* {@link java.util.Formatter} and {@link java.lang.String#format}.
* The resulting string will be stripped of any styled text information.
*
* @param id The desired resource identifier, as generated by the aapt
* tool. This integer encodes the package, type, and resource
* entry. The value 0 is an invalid identifier.
* @param quantity The number used to get the correct string for the current language's
* plural rules.
* @param formatArgs The format arguments that will be used for substitution.
*
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*
* @return String The string data associated with the resource,
* stripped of styled text information.
*/
@NonNull
public String getQuantityString(int id, int quantity, Object... formatArgs)
throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* Returns the string necessary for grammatically correct pluralization
* of the given resource ID for the given quantity.
* Note that the string is selected based solely on grammatical necessity,
* and that such rules differ between languages. Do not assume you know which string
* will be returned for a given quantity. See
* String Resources
* for more detail.
*
* @param id The desired resource identifier, as generated by the aapt
* tool. This integer encodes the package, type, and resource
* entry. The value 0 is an invalid identifier.
* @param quantity The number used to get the correct string for the current language's
* plural rules.
*
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*
* @return String The string data associated with the resource,
* stripped of styled text information.
*/
@NonNull
public String getQuantityString(int id, int quantity) throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* Return the string value associated with a particular resource ID. The
* returned object will be a String if this is a plain string; it will be
* some other type of CharSequence if it is styled.
*
* @param id The desired resource identifier, as generated by the aapt
* tool. This integer encodes the package, type, and resource
* entry. The value 0 is an invalid identifier.
*
* @param def The default CharSequence to return.
*
* @return CharSequence The string data associated with the resource, plus
* possibly styled text information, or def if id is 0 or not found.
*/
public CharSequence getText(int id, CharSequence def) {
throw new UnsupportedOperationException("STUB");
}
/**
* Return the styled text array associated with a particular resource ID.
*
* @param id The desired resource identifier, as generated by the aapt
* tool. This integer encodes the package, type, and resource
* entry. The value 0 is an invalid identifier.
*
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*
* @return The styled text array associated with the resource.
*/
@NonNull
public CharSequence[] getTextArray(int id) throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* Return the string array associated with a particular resource ID.
*
* @param id The desired resource identifier, as generated by the aapt
* tool. This integer encodes the package, type, and resource
* entry. The value 0 is an invalid identifier.
*
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*
* @return The string array associated with the resource.
*/
@NonNull
public String[] getStringArray(int id)
throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* Return the int array associated with a particular resource ID.
*
* @param id The desired resource identifier, as generated by the aapt
* tool. This integer encodes the package, type, and resource
* entry. The value 0 is an invalid identifier.
*
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*
* @return The int array associated with the resource.
*/
@NonNull
public int[] getIntArray(int id) throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* Return an array of heterogeneous values.
*
* @param id The desired resource identifier, as generated by the aapt
* tool. This integer encodes the package, type, and resource
* entry. The value 0 is an invalid identifier.
*
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*
* @return Returns a TypedArray holding an array of the array values.
* Be sure to call {@link TypedArray#recycle() TypedArray.recycle()}
* when done with it.
*/
@NonNull
public TypedArray obtainTypedArray(int id) throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* Retrieve a dimensional for a particular resource ID. Unit
* conversions are based on the current {@link DisplayMetrics} associated
* with the resources.
*
* @param id The desired resource identifier, as generated by the aapt
* tool. This integer encodes the package, type, and resource
* entry. The value 0 is an invalid identifier.
*
* @return Resource dimension value multiplied by the appropriate
* metric.
*
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*
* @see #getDimensionPixelOffset
* @see #getDimensionPixelSize
*/
public float getDimension(int id) throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* Retrieve a dimensional for a particular resource ID for use
* as an offset in raw pixels. This is the same as
* {@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 id The desired resource identifier, as generated by the aapt
* tool. This integer encodes the package, type, and resource
* entry. The value 0 is an invalid identifier.
*
* @return Resource dimension value multiplied by the appropriate
* metric and truncated to integer pixels.
*
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*
* @see #getDimension
* @see #getDimensionPixelSize
*/
public int getDimensionPixelOffset(int id) throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* Retrieve a dimensional for a particular resource ID for use
* as a size in raw pixels. This is the same as
* {@link #getDimension}, 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.
*
* @param id The desired resource identifier, as generated by the aapt
* tool. This integer encodes the package, type, and resource
* entry. The value 0 is an invalid identifier.
*
* @return Resource dimension value multiplied by the appropriate
* metric and truncated to integer pixels.
*
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*
* @see #getDimension
* @see #getDimensionPixelOffset
*/
public int getDimensionPixelSize(int id) throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* Retrieve a fractional unit for a particular resource ID.
*
* @param id The desired resource identifier, as generated by the aapt
* tool. This integer encodes the package, type, and resource
* entry. The value 0 is an invalid identifier.
* @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
* words, a parent fraction (nn%p) is multiplied by this
* value.
*
* @return Attribute fractional value multiplied by the appropriate
* base value.
*
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*/
public float getFraction(int id, int base, int pbase) {
throw new UnsupportedOperationException("STUB");
}
/**
* Return a drawable object associated with a particular resource ID.
* Various types of objects will be returned depending on the underlying
* resource -- for example, a solid color, PNG image, scalable image, etc.
* The Drawable API hides these implementation details.
*
*
Note: Prior to
* {@link android.os.Build.VERSION_CODES#JELLY_BEAN}, this function
* would not correctly retrieve the final configuration density when
* the resource ID passed here is an alias to another Drawable resource.
* This means that if the density configuration of the alias resource
* is different than the actual resource, the density of the returned
* Drawable would be incorrect, resulting in bad scaling. To work
* around this, you can instead manually resolve the aliased reference
* by using {@link #getValue(int, TypedValue, boolean)} and passing
* {@code true} for {@code resolveRefs}. The resulting
* {@link TypedValue#resourceId} value may be passed to this method.
*
* Note: To obtain a themed drawable, use
* {@link android.content.Context#getDrawable(int) Context.getDrawable(int)}
* or {@link #getDrawable(int, Theme)} passing the desired theme.
*
* @param id The desired resource identifier, as generated by the aapt
* tool. This integer encodes the package, type, and resource
* entry. The value 0 is an invalid identifier.
* @return Drawable An object that can be used to draw this resource.
* @throws NotFoundException Throws NotFoundException if the given ID does
* not exist.
* @see #getDrawable(int, Theme)
* @deprecated Use {@link #getDrawable(int, Theme)} instead.
*/
@Deprecated
public Drawable getDrawable(int id) throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* Return a drawable object associated with a particular resource ID and
* styled for the specified theme. Various types of objects will be
* returned depending on the underlying resource -- for example, a solid
* color, PNG image, scalable image, etc.
*
* @param id The desired resource identifier, as generated by the aapt
* tool. This integer encodes the package, type, and resource
* entry. The value 0 is an invalid identifier.
* @param theme The theme used to style the drawable attributes, may be {@code null}.
* @return Drawable An object that can be used to draw this resource.
* @throws NotFoundException Throws NotFoundException if the given ID does
* not exist.
*/
public Drawable getDrawable(int id, @Nullable Theme theme)
throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* Return a drawable object associated with a particular resource ID for the
* given screen density in DPI. This will set the drawable's density to be
* the device's density multiplied by the ratio of actual drawable density
* to requested density. This allows the drawable to be scaled up to the
* correct size if needed. Various types of objects will be returned
* depending on the underlying resource -- for example, a solid color, PNG
* image, scalable image, etc. The Drawable API hides these implementation
* details.
*
* Note: To obtain a themed drawable, use
* {@link android.content.Context#getDrawable(int) Context.getDrawable(int)}
* or {@link #getDrawableForDensity(int, int, Theme)} passing the desired
* theme.
*
* @param id The desired resource identifier, as generated by the aapt tool.
* This integer encodes the package, type, and resource entry.
* The value 0 is an invalid identifier.
* @param density the desired screen density indicated by the resource as
* found in {@link DisplayMetrics}. A value of 0 means to use the
* density returned from {@link #getConfiguration()}.
* This is equivalent to calling {@link #getDrawable(int)}.
* @return Drawable An object that can be used to draw this resource.
* @throws NotFoundException Throws NotFoundException if the given ID does
* not exist.
* @see #getDrawableForDensity(int, int, Theme)
* @deprecated Use {@link #getDrawableForDensity(int, int, Theme)} instead.
*/
@Deprecated
public Drawable getDrawableForDensity(int id, int density)
throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* Return a drawable object associated with a particular resource ID for the
* given screen density in DPI and styled for the specified theme.
*
* @param id The desired resource identifier, as generated by the aapt tool.
* This integer encodes the package, type, and resource entry.
* The value 0 is an invalid identifier.
* @param density The desired screen density indicated by the resource as
* found in {@link DisplayMetrics}. A value of 0 means to use the
* density returned from {@link #getConfiguration()}.
* This is equivalent to calling {@link #getDrawable(int, Theme)}.
* @param theme The theme used to style the drawable attributes, may be {@code null}.
* @return Drawable An object that can be used to draw this resource.
* @throws NotFoundException Throws NotFoundException if the given ID does
* not exist.
*/
public Drawable getDrawableForDensity(int id, int density, @Nullable Theme theme) {
throw new UnsupportedOperationException("STUB");
}
@NonNull
Drawable loadDrawable(@NonNull TypedValue value, int id, int density, @Nullable Theme theme)
throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* Return a movie object associated with the particular resource ID.
* @param id The desired resource identifier, as generated by the aapt
* tool. This integer encodes the package, type, and resource
* entry. The value 0 is an invalid identifier.
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*
*/
public Movie getMovie(int id) throws NotFoundException {
final InputStream is = openRawResource(id);
final Movie movie = Movie.decodeStream(is);
try {
is.close();
} catch (IOException e) {
// No one cares.
}
return movie;
}
/**
* Returns a color integer associated with a particular resource ID. If the
* resource holds a complex {@link ColorStateList}, then the default color
* from the set is returned.
*
* @param id The desired resource identifier, as generated by the aapt
* tool. This integer encodes the package, type, and resource
* entry. The value 0 is an invalid identifier.
*
* @throws NotFoundException Throws NotFoundException if the given ID does
* not exist.
*
* @return A single color value in the form 0xAARRGGBB.
* @deprecated Use {@link #getColor(int, Theme)} instead.
*/
@Deprecated
public int getColor(int id) throws NotFoundException {
return getColor(id, null);
}
/**
* Returns a themed color integer associated with a particular resource ID.
* If the resource holds a complex {@link ColorStateList}, then the default
* color from the set is returned.
*
* @param id The desired resource identifier, as generated by the aapt
* tool. This integer encodes the package, type, and resource
* entry. The value 0 is an invalid identifier.
* @param theme The theme used to style the color attributes, may be
* {@code null}.
*
* @throws NotFoundException Throws NotFoundException if the given ID does
* not exist.
*
* @return A single color value in the form 0xAARRGGBB.
*/
public int getColor(int id, @Nullable Theme theme) throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* Returns a color state list associated with a particular resource ID. The
* resource may contain either a single raw color value or a complex
* {@link ColorStateList} holding multiple possible colors.
*
* @param id The desired resource identifier of a {@link ColorStateList},
* as generated by the aapt tool. This integer encodes the
* package, type, and resource entry. The value 0 is an invalid
* identifier.
*
* @throws NotFoundException Throws NotFoundException if the given ID does
* not exist.
*
* @return A ColorStateList object containing either a single solid color
* or multiple colors that can be selected based on a state.
* @deprecated Use {@link #getColorStateList(int, Theme)} instead.
*/
@Nullable
@Deprecated
public ColorStateList getColorStateList(int id) throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* Returns a themed color state list associated with a particular resource
* ID. The resource may contain either a single raw color value or a
* complex {@link ColorStateList} holding multiple possible colors.
*
* @param id The desired resource identifier of a {@link ColorStateList},
* as generated by the aapt tool. This integer encodes the
* package, type, and resource entry. The value 0 is an invalid
* identifier.
* @param theme The theme used to style the color attributes, may be
* {@code null}.
*
* @throws NotFoundException Throws NotFoundException if the given ID does
* not exist.
*
* @return A themed ColorStateList object containing either a single solid
* color or multiple colors that can be selected based on a state.
*/
@Nullable
public ColorStateList getColorStateList(int id, @Nullable Theme theme)
throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
@Nullable
ColorStateList loadColorStateList(@NonNull TypedValue value, int id, @Nullable Theme theme)
throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* @hide
*/
@Nullable
public ComplexColor loadComplexColor(@NonNull TypedValue value, int id, @Nullable Theme theme) {
throw new UnsupportedOperationException("STUB");
}
/**
* Return a boolean associated with a particular resource ID. This can be
* used with any integral resource value, and will return true if it is
* non-zero.
*
* @param id The desired resource identifier, as generated by the aapt
* tool. This integer encodes the package, type, and resource
* entry. The value 0 is an invalid identifier.
*
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*
* @return Returns the boolean value contained in the resource.
*/
public boolean getBoolean(int id) throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* Return an integer associated with a particular resource ID.
*
* @param id The desired resource identifier, as generated by the aapt
* tool. This integer encodes the package, type, and resource
* entry. The value 0 is an invalid identifier.
*
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*
* @return Returns the integer value contained in the resource.
*/
public int getInteger(int id) throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* Retrieve a floating-point value for a particular resource ID.
*
* @param id The desired resource identifier, as generated by the aapt
* tool. This integer encodes the package, type, and resource
* entry. The value 0 is an invalid identifier.
*
* @return Returns the floating-point value contained in the resource.
*
* @throws NotFoundException Throws NotFoundException if the given ID does
* not exist or is not a floating-point value.
* @hide Pending API council approval.
*/
public float getFloat(int id) {
throw new UnsupportedOperationException("STUB");
}
/**
* Return an XmlResourceParser through which you can read a view layout
* description for the given resource ID. This parser has limited
* functionality -- in particular, you can't change its input, and only
* the high-level events are available.
*
* This function is really a simple wrapper for calling
* {@link #getXml} with a layout resource.
*
* @param id The desired resource identifier, as generated by the aapt
* tool. This integer encodes the package, type, and resource
* entry. The value 0 is an invalid identifier.
*
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*
* @return A new parser object through which you can read
* the XML data.
*
* @see #getXml
*/
public XmlResourceParser getLayout(int id) throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* Return an XmlResourceParser through which you can read an animation
* description for the given resource ID. This parser has limited
* functionality -- in particular, you can't change its input, and only
* the high-level events are available.
*
*
This function is really a simple wrapper for calling
* {@link #getXml} with an animation resource.
*
* @param id The desired resource identifier, as generated by the aapt
* tool. This integer encodes the package, type, and resource
* entry. The value 0 is an invalid identifier.
*
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*
* @return A new parser object through which you can read
* the XML data.
*
* @see #getXml
*/
public XmlResourceParser getAnimation(int id) throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* Return an XmlResourceParser through which you can read a generic XML
* resource for the given resource ID.
*
*
The XmlPullParser implementation returned here has some limited
* functionality. In particular, you can't change its input, and only
* high-level parsing events are available (since the document was
* pre-parsed for you at build time, which involved merging text and
* stripping comments).
*
* @param id The desired resource identifier, as generated by the aapt
* tool. This integer encodes the package, type, and resource
* entry. The value 0 is an invalid identifier.
*
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*
* @return A new parser object through which you can read
* the XML data.
*
* @see android.util.AttributeSet
*/
public XmlResourceParser getXml(int id) throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* Open a data stream for reading a raw resource. This can only be used
* with resources whose value is the name of an asset files -- that is, it can be
* used to open drawable, sound, and raw resources; it will fail on string
* and color resources.
*
* @param id The resource identifier to open, as generated by the aapt tool.
*
* @return InputStream Access to the resource data.
*
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*
*/
public InputStream openRawResource(int id) throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* Returns a TypedValue suitable for temporary use. The obtained TypedValue
* should be released using {@link #releaseTempTypedValue(TypedValue)}.
*
* @return a typed value suitable for temporary use
*/
private TypedValue obtainTempTypedValue() {
throw new UnsupportedOperationException("STUB");
}
/**
* Returns a TypedValue to the pool. After calling this method, the
* specified TypedValue should no longer be accessed.
*
* @param value the typed value to return to the pool
*/
private void releaseTempTypedValue(TypedValue value) {
throw new UnsupportedOperationException("STUB");
}
/**
* Open a data stream for reading a raw resource. This can only be used
* with resources whose value is the name of an asset file -- that is, it can be
* used to open drawable, sound, and raw resources; it will fail on string
* and color resources.
*
* @param id The resource identifier to open, as generated by the aapt tool.
* @param value The TypedValue object to hold the resource information.
*
* @return InputStream Access to the resource data.
*
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*/
public InputStream openRawResource(int id, TypedValue value)
throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* Open a file descriptor for reading a raw resource. This can only be used
* with resources whose value is the name of an asset files -- that is, it can be
* used to open drawable, sound, and raw resources; it will fail on string
* and color resources.
*
*
This function only works for resources that are stored in the package
* as uncompressed data, which typically includes things like mp3 files
* and png images.
*
* @param id The resource identifier to open, as generated by the aapt tool.
*
* @return AssetFileDescriptor A new file descriptor you can use to read
* the resource. This includes the file descriptor itself, as well as the
* offset and length of data where the resource appears in the file. A
* null is returned if the file exists but is compressed.
*
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*
*/
public AssetFileDescriptor openRawResourceFd(int id)
throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* Return the raw data associated with a particular resource ID.
*
* @param id The desired resource identifier, as generated by the aapt
* tool. This integer encodes the package, type, and resource
* entry. The value 0 is an invalid identifier.
* @param outValue Object in which to place the resource data.
* @param resolveRefs If true, a resource that is a reference to another
* resource will be followed so that you receive the
* actual final resource data. If false, the TypedValue
* will be filled in with the reference itself.
*
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*
*/
public void getValue(int id, TypedValue outValue, boolean resolveRefs)
throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* Get the raw value associated with a resource with associated density.
*
* @param id resource identifier
* @param density density in DPI
* @param resolveRefs If true, a resource that is a reference to another
* resource will be followed so that you receive the actual final
* resource data. If false, the TypedValue will be filled in with
* the reference itself.
* @throws NotFoundException Throws NotFoundException if the given ID does
* not exist.
* @see #getValue(String, TypedValue, boolean)
*/
public void getValueForDensity(int id, int density, TypedValue outValue,
boolean resolveRefs) throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* Return the raw data associated with a particular resource ID.
* See getIdentifier() for information on how names are mapped to resource
* IDs, and getString(int) for information on how string resources are
* retrieved.
*
*
Note: use of this function is discouraged. It is much more
* efficient to retrieve resources by identifier than by name.
*
* @param name The name of the desired resource. This is passed to
* getIdentifier() with a default type of "string".
* @param outValue Object in which to place the resource data.
* @param resolveRefs If true, a resource that is a reference to another
* resource will be followed so that you receive the
* actual final resource data. If false, the TypedValue
* will be filled in with the reference itself.
*
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*
*/
public void getValue(String name, TypedValue outValue, boolean resolveRefs)
throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* This class holds the current attribute values for a particular theme.
* In other words, a Theme is a set of values for resource attributes;
* these are used in conjunction with {@link TypedArray}
* to resolve the final value for an attribute.
*
*
The Theme's attributes come into play in two ways: (1) a styled
* attribute can explicit reference a value in the theme through the
* "?themeAttribute" syntax; (2) if no value has been defined for a
* particular styled attribute, as a last resort we will try to find that
* attribute's value in the Theme.
*
*
You will normally use the {@link #obtainStyledAttributes} APIs to
* retrieve XML attributes with style and theme information applied.
*/
public final class Theme {
/**
* Place new attribute values into the theme. The style resource
* specified by resid will be retrieved from this Theme's
* resources, its values placed into the Theme object.
*
*
The semantics of this function depends on the force
* argument: If false, only values that are not already defined in
* the theme will be copied from the system resource; otherwise, if
* any of the style's attributes are already defined in the theme, the
* current values in the theme will be overwritten.
*
* @param resId The resource ID of a style resource from which to
* obtain attribute values.
* @param force If true, values in the style resource will always be
* used in the theme; otherwise, they will only be used
* if not already defined in the theme.
*/
public void applyStyle(int resId, boolean force) {
throw new UnsupportedOperationException("STUB");
}
/**
* Set this theme to hold the same contents as the theme
* other . If both of these themes are from the same
* Resources object, they will be identical after this function
* returns. If they are from different Resources, only the resources
* they have in common will be set in this theme.
*
* @param other The existing Theme to copy from.
*/
public void setTo(Theme other) {
throw new UnsupportedOperationException("STUB");
}
/**
* Return a TypedArray holding the values defined by
* Theme which are listed in attrs .
*
*
Be sure to call {@link TypedArray#recycle() TypedArray.recycle()} when you are done
* with the array.
*
* @param attrs The desired attributes. These attribute IDs must be sorted in ascending
* order.
*
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*
* @return Returns a TypedArray holding an array of the attribute values.
* Be sure to call {@link TypedArray#recycle() TypedArray.recycle()}
* when done with it.
*
* @see Resources#obtainAttributes
* @see #obtainStyledAttributes(int, int[])
* @see #obtainStyledAttributes(AttributeSet, int[], int, int)
*/
public TypedArray obtainStyledAttributes(int[] attrs) {
throw new UnsupportedOperationException("STUB");
}
/**
* Return a TypedArray holding the values defined by the style
* resource resid which are listed in attrs .
*
*
Be sure to call {@link TypedArray#recycle() TypedArray.recycle()} when you are done
* with the array.
*
* @param resId The desired style resource.
* @param attrs The desired attributes in the style. These attribute IDs must be sorted in
* ascending order.
*
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*
* @return Returns a TypedArray holding an array of the attribute values.
* Be sure to call {@link TypedArray#recycle() TypedArray.recycle()}
* when done with it.
*
* @see Resources#obtainAttributes
* @see #obtainStyledAttributes(int[])
* @see #obtainStyledAttributes(AttributeSet, int[], int, int)
*/
public TypedArray obtainStyledAttributes(int resId, int[] attrs)
throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* Return a TypedArray holding the attribute values in
* set
* that are listed in attrs . In addition, if the given
* AttributeSet specifies a style class (through the "style" attribute),
* that style will be applied on top of the base attributes it defines.
*
*
Be sure to call {@link TypedArray#recycle() TypedArray.recycle()} when you are done
* with the array.
*
*
When determining the final value of a particular attribute, there
* are four inputs that come into play:
*
*
* Any attribute values in the given AttributeSet.
* The style resource specified in the AttributeSet (named
* "style").
* The default style specified by defStyleAttr and
* defStyleRes
* The base values in this theme.
*
*
* Each of these inputs is considered in-order, with the first listed
* taking precedence over the following ones. In other words, if in the
* AttributeSet you have supplied <Button
* textColor="#ff000000">
, then the button's text will
* always be black, regardless of what is specified in any of
* the styles.
*
* @param set The base set of attribute values. May be null.
* @param attrs The desired attributes to be retrieved. These attribute IDs must be sorted
* in ascending order.
* @param defStyleAttr An attribute in the current theme that contains a
* reference to a style resource that supplies
* defaults values for the TypedArray. Can be
* 0 to not look for defaults.
* @param defStyleRes A resource identifier of a style resource that
* supplies default values for the TypedArray,
* used only if defStyleAttr is 0 or can not be found
* in the theme. Can be 0 to not look for defaults.
*
* @return Returns a TypedArray holding an array of the attribute values.
* Be sure to call {@link TypedArray#recycle() TypedArray.recycle()}
* when done with it.
*
* @see Resources#obtainAttributes
* @see #obtainStyledAttributes(int[])
* @see #obtainStyledAttributes(int, int[])
*/
public TypedArray obtainStyledAttributes(AttributeSet set,
int[] attrs, int defStyleAttr, int defStyleRes) {
throw new UnsupportedOperationException("STUB");
}
/**
* Retrieve the values for a set of attributes in the Theme. The
* contents of the typed array are ultimately filled in by
* {@link Resources#getValue}.
*
* @param values The base set of attribute values, must be equal in
* length to {@code attrs}. All values must be of type
* {@link TypedValue#TYPE_ATTRIBUTE}.
* @param attrs The desired attributes to be retrieved. These attribute IDs must be sorted
* in ascending order.
* @return Returns a TypedArray holding an array of the attribute
* values. Be sure to call {@link TypedArray#recycle()}
* when done with it.
* @hide
*/
@NonNull
public TypedArray resolveAttributes(@NonNull int[] values, @NonNull int[] attrs) {
throw new UnsupportedOperationException("STUB");
}
/**
* Retrieve the value of an attribute in the Theme. The contents of
* outValue are ultimately filled in by
* {@link Resources#getValue}.
*
* @param resid The resource identifier of the desired theme
* attribute.
* @param outValue Filled in with the ultimate resource value supplied
* by the attribute.
* @param resolveRefs If true, resource references will be walked; if
* false, outValue may be a
* TYPE_REFERENCE. In either case, it will never
* be a TYPE_ATTRIBUTE.
*
* @return boolean Returns true if the attribute was found and
* outValue is valid, else false.
*/
public boolean resolveAttribute(int resid, TypedValue outValue, boolean resolveRefs) {
throw new UnsupportedOperationException("STUB");
}
/**
* Gets all of the attribute ids associated with this {@link Theme}. For debugging only.
*
* @return The int array containing attribute ids associated with this {@link Theme}.
* @hide
*/
public int[] getAllAttributes() {
throw new UnsupportedOperationException("STUB");
}
/**
* Returns the resources to which this theme belongs.
*
* @return Resources to which this theme belongs.
*/
public Resources getResources() {
throw new UnsupportedOperationException("STUB");
}
/**
* Return a drawable object associated with a particular resource ID
* and styled for the Theme.
*
* @param id The desired resource identifier, as generated by the aapt
* tool. This integer encodes the package, type, and resource
* entry. The value 0 is an invalid identifier.
* @return Drawable An object that can be used to draw this resource.
* @throws NotFoundException Throws NotFoundException if the given ID
* does not exist.
*/
public Drawable getDrawable(int id) throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* Returns a bit mask of configuration changes that will impact this
* theme (and thus require completely reloading it).
*
* @return a bit mask of configuration changes, as defined by
* {@link ActivityInfo}
* @see ActivityInfo
*/
public int getChangingConfigurations() {
throw new UnsupportedOperationException("STUB");
}
/**
* Print contents of this theme out to the log. For debugging only.
*
* @param priority The log priority to use.
* @param tag The log tag to use.
* @param prefix Text to prefix each line printed.
*/
public void dump(int priority, String tag, String prefix) {
throw new UnsupportedOperationException("STUB");
}
/**
* @hide
*/
public ThemeKey getKey() {
throw new UnsupportedOperationException("STUB");
}
/**
* Parses {@link #getKey()} and returns a String array that holds pairs of
* adjacent Theme data: resource name followed by whether or not it was
* forced, as specified by {@link #applyStyle(int, boolean)}.
*
* @hide
*/
//@ViewDebug.ExportedProperty(category = "theme", hasAdjacentMapping = true)
public String[] getTheme() {
throw new UnsupportedOperationException("STUB");
}
/** @hide */
public void encode(@NonNull ViewHierarchyEncoder encoder) {
throw new UnsupportedOperationException("STUB");
}
/**
* Rebases the theme against the parent Resource object's current
* configuration by re-applying the styles passed to
* {@link #applyStyle(int, boolean)}.
*
* @hide
*/
public void rebase() {
throw new UnsupportedOperationException("STUB");
}
}
static class ThemeKey implements Cloneable {
int[] mResId;
boolean[] mForce;
int mCount;
private int mHashCode = 0;
public void append(int resId, boolean force) {
throw new UnsupportedOperationException("STUB");
}
/**
* Sets up this key as a deep copy of another key.
*
* @param other the key to deep copy into this key
*/
public void setTo(ThemeKey other) {
throw new UnsupportedOperationException("STUB");
}
}
/**
* Generate a new Theme object for this set of Resources. It initially
* starts out empty.
*
* @return Theme The newly created Theme container.
*/
public final Theme newTheme() {
throw new UnsupportedOperationException("STUB");
}
/**
* Retrieve a set of basic attribute values from an AttributeSet, not
* performing styling of them using a theme and/or style resources.
*
* @param set The current attribute values to retrieve.
* @param attrs The specific attributes to be retrieved. These attribute IDs must be sorted in
* ascending order.
* @return Returns a TypedArray holding an array of the attribute values.
* Be sure to call {@link TypedArray#recycle() TypedArray.recycle()}
* when done with it.
*
* @see Theme#obtainStyledAttributes(AttributeSet, int[], int, int)
*/
public TypedArray obtainAttributes(AttributeSet set, int[] attrs) {
throw new UnsupportedOperationException("STUB");
}
/**
* Store the newly updated configuration.
*
* @deprecated See {@link android.content.Context#createConfigurationContext(Configuration)}.
*/
@Deprecated
public void updateConfiguration(Configuration config, DisplayMetrics metrics) {
throw new UnsupportedOperationException("STUB");
}
/**
* @hide
*/
public void updateConfiguration(Configuration config, DisplayMetrics metrics,
CompatibilityInfo compat) {
throw new UnsupportedOperationException("STUB");
}
/**
* Update the system resources configuration if they have previously
* been initialized.
*
* @hide
*/
public static void updateSystemConfiguration(Configuration config, DisplayMetrics metrics,
CompatibilityInfo compat) {
throw new UnsupportedOperationException("STUB");
}
/**
* Return the current display metrics that are in effect for this resource
* object. The returned object should be treated as read-only.
*
* @return The resource's current display metrics.
*/
public DisplayMetrics getDisplayMetrics() {
throw new UnsupportedOperationException("STUB");
}
/** @hide */
public DisplayAdjustments getDisplayAdjustments() {
throw new UnsupportedOperationException("STUB");
}
/**
* Return the current configuration that is in effect for this resource
* object. The returned object should be treated as read-only.
*
* @return The resource's current configuration.
*/
public Configuration getConfiguration() {
throw new UnsupportedOperationException("STUB");
}
/** @hide */
public Configuration[] getSizeConfigurations() {
throw new UnsupportedOperationException("STUB");
}
/**
* Return the compatibility mode information for the application.
* The returned object should be treated as read-only.
*
* @return compatibility info.
* @hide
*/
public CompatibilityInfo getCompatibilityInfo() {
throw new UnsupportedOperationException("STUB");
}
/**
* This is just for testing.
* @hide
*/
public void setCompatibilityInfo(CompatibilityInfo ci) {
throw new UnsupportedOperationException("STUB");
}
/**
* Return a resource identifier for the given resource name. A fully
* qualified resource name is of the form "package:type/entry". The first
* two components (package and type) are optional if defType and
* defPackage, respectively, are specified here.
*
*
Note: use of this function is discouraged. It is much more
* efficient to retrieve resources by identifier than by name.
*
* @param name The name of the desired resource.
* @param defType Optional default resource type to find, if "type/" is
* not included in the name. Can be null to require an
* explicit type.
* @param defPackage Optional default package to find, if "package:" is
* not included in the name. Can be null to require an
* explicit package.
*
* @return int The associated resource identifier. Returns 0 if no such
* resource was found. (0 is not a valid resource ID.)
*/
public int getIdentifier(String name, String defType, String defPackage) {
throw new UnsupportedOperationException("STUB");
}
/**
* Return true if given resource identifier includes a package.
*
* @hide
*/
public static boolean resourceHasPackage(int resid) {
throw new UnsupportedOperationException("STUB");
}
/**
* Return the full name for a given resource identifier. This name is
* a single string of the form "package:type/entry".
*
* @param resid The resource identifier whose name is to be retrieved.
*
* @return A string holding the name of the resource.
*
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*
* @see #getResourcePackageName
* @see #getResourceTypeName
* @see #getResourceEntryName
*/
public String getResourceName(int resid) throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* Return the package name for a given resource identifier.
*
* @param resid The resource identifier whose package name is to be
* retrieved.
*
* @return A string holding the package name of the resource.
*
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*
* @see #getResourceName
*/
public String getResourcePackageName(int resid) throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* Return the type name for a given resource identifier.
*
* @param resid The resource identifier whose type name is to be
* retrieved.
*
* @return A string holding the type name of the resource.
*
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*
* @see #getResourceName
*/
public String getResourceTypeName(int resid) throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* Return the entry name for a given resource identifier.
*
* @param resid The resource identifier whose entry name is to be
* retrieved.
*
* @return A string holding the entry name of the resource.
*
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*
* @see #getResourceName
*/
public String getResourceEntryName(int resid) throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* Parse a series of {@link android.R.styleable#Extra <extra>} tags from
* an XML file. You call this when you are at the parent tag of the
* extra tags, and it will return once all of the child tags have been parsed.
* This will call {@link #parseBundleExtra} for each extra tag encountered.
*
* @param parser The parser from which to retrieve the extras.
* @param outBundle A Bundle in which to place all parsed extras.
* @throws XmlPullParserException
* @throws IOException
*/
public void parseBundleExtras(XmlResourceParser parser, Bundle outBundle)
throws XmlPullParserException, IOException {
throw new UnsupportedOperationException("STUB");
}
/**
* Parse a name/value pair out of an XML tag holding that data. The
* AttributeSet must be holding the data defined by
* {@link android.R.styleable#Extra}. The following value types are supported:
*
* {@link TypedValue#TYPE_STRING}:
* {@link Bundle#putCharSequence Bundle.putCharSequence()}
* {@link TypedValue#TYPE_INT_BOOLEAN}:
* {@link Bundle#putCharSequence Bundle.putBoolean()}
* {@link TypedValue#TYPE_FIRST_INT}-{@link TypedValue#TYPE_LAST_INT}:
* {@link Bundle#putCharSequence Bundle.putBoolean()}
* {@link TypedValue#TYPE_FLOAT}:
* {@link Bundle#putCharSequence Bundle.putFloat()}
*
*
* @param tagName The name of the tag these attributes come from; this is
* only used for reporting error messages.
* @param attrs The attributes from which to retrieve the name/value pair.
* @param outBundle The Bundle in which to place the parsed value.
* @throws XmlPullParserException If the attributes are not valid.
*/
public void parseBundleExtra(String tagName, AttributeSet attrs,
Bundle outBundle) throws XmlPullParserException {
throw new UnsupportedOperationException("STUB");
}
/**
* Retrieve underlying AssetManager storage for these resources.
*/
public final AssetManager getAssets() {
throw new UnsupportedOperationException("STUB");
}
/**
* Call this to remove all cached loaded layout resources from the
* Resources object. Only intended for use with performance testing
* tools.
*/
public final void flushLayoutCache() {
throw new UnsupportedOperationException("STUB");
}
/**
* Start preloading of resource data using this Resources object. Only
* for use by the zygote process for loading common system resources.
* {@hide}
*/
public final void startPreloading() {
throw new UnsupportedOperationException("STUB");
}
/**
* Called by zygote when it is done preloading resources, to change back
* to normal Resources operation.
*/
public final void finishPreloading() {
throw new UnsupportedOperationException("STUB");
}
/**
* @hide
*/
public LongSparseArray getPreloadedDrawables() {
throw new UnsupportedOperationException("STUB");
}
/**
* Loads an XML parser for the specified file.
*
* @param id the resource identifier for the file
* @param type the type of resource (used for logging)
* @return a parser for the specified XML file
* @throws NotFoundException if the file could not be loaded
*/
@NonNull
XmlResourceParser loadXmlResourceParser(int id, @NonNull String type)
throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* Loads an XML parser for the specified file.
*
* @param file the path for the XML file to parse
* @param id the resource identifier for the file
* @param assetCookie the asset cookie for the file
* @param type the type of resource (used for logging)
* @return a parser for the specified XML file
* @throws NotFoundException if the file could not be loaded
*/
@NonNull
XmlResourceParser loadXmlResourceParser(String file, int id, int assetCookie,
String type) throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/**
* Called by ConfigurationBoundResourceCacheTest.
* @hide
*/
public int calcConfigChanges(Configuration config) {
throw new UnsupportedOperationException("STUB");
}
/**
* Obtains styled attributes from the theme, if available, or unstyled
* resources if the theme is null.
*
* @hide
*/
public static TypedArray obtainAttributes(
Resources res, Theme theme, AttributeSet set, int[] attrs) {
throw new UnsupportedOperationException("STUB");
}
/**
* 下面两个来源Xposed源码
* 没有去查看对应版本的源码了
* 最新的源码已经没有这两个方法了
* 使用需注意,仅仅是给xposed模块使用
*/
/** Since SDK21, CM12 */
public Drawable getDrawable(int id, Theme theme, boolean supportComposedIcons) throws NotFoundException {
throw new UnsupportedOperationException("STUB");
}
/** Since SDK21, CM12 */
public Drawable getDrawableForDensity(int id, int density, Theme theme, boolean supportComposedIcons) {
throw new UnsupportedOperationException("STUB");
}
}