Package com.transifex.txnative
Class TxResources
java.lang.Object
android.content.res.Resources
com.transifex.txnative.TxResources
Resources wrapper that enables TxNative functionality by overriding specific String related
methods.
We override some of the calls that return strings. The rest of the string methods, call
internally the ones we have overridden. The remaining methods are delegated to the
base Resources object.
All resource method calls made programmatically by the user will reach here. String resources
used during the view inflation process will also be read from here, after having the process
intercepted by TxInterceptor and having the view transformed by the respective
ViewTransformer class.
-
Nested Class Summary
Nested classes/interfaces inherited from class android.content.res.Resources
Resources.NotFoundException, Resources.Theme -
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionTxResources(Resources baseResources, NativeCore nativeCore) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptiongetAnimation(int id) Returns theResourcesobject that is being wrapped.booleangetBoolean(int id) intgetColor(int id) intgetColor(int id, Resources.Theme theme) getColorStateList(int id) getColorStateList(int id, Resources.Theme theme) floatgetDimension(int id) intgetDimensionPixelOffset(int id) intgetDimensionPixelSize(int id) getDrawable(int id) getDrawable(int id, Resources.Theme theme) getDrawableForDensity(int id, int density) getDrawableForDensity(int id, int density, Resources.Theme theme) floatgetFloat(int id) getFont(int id) floatgetFraction(int id, int base, int pbase) intgetIdentifier(String name, String defType, String defPackage) int[]getIntArray(int id) intgetInteger(int id) getLayout(int id) getMovie(int id) getQuantityText(int id, int quantity) getResourceEntryName(int resid) getResourceName(int resid) getResourcePackageName(int resid) getResourceTypeName(int resid) String[]getStringArray(int id) getText(int id) getText(int id, CharSequence def) getTextArray(int id) voidgetValue(int id, TypedValue outValue, boolean resolveRefs) voidgetValue(String name, TypedValue outValue, boolean resolveRefs) voidgetValueForDensity(int id, int density, TypedValue outValue, boolean resolveRefs) getXml(int id) obtainAttributes(AttributeSet set, int[] attrs) obtainTypedArray(int id) openRawResource(int id) openRawResource(int id, TypedValue value) openRawResourceFd(int id) voidparseBundleExtra(String tagName, AttributeSet attrs, Bundle outBundle) voidparseBundleExtras(XmlResourceParser parser, Bundle outBundle) voidupdateConfiguration(Configuration config, DisplayMetrics metrics) Methods inherited from class android.content.res.Resources
addLoaders, finishPreloading, flushLayoutCache, getAssets, getAttributeSetSourceResId, getQuantityString, getQuantityString, getString, getString, getSystem, newTheme, removeLoaders
-
Constructor Details
-
TxResources
Creates a new instance.- Parameters:
baseResources- TheResourcesobject to wrap.nativeCore- ANativeCoreinstance.
-
-
Method Details
-
getText
- Overrides:
getTextin classResources- Throws:
Resources.NotFoundException
-
getText
-
getQuantityText
@NonNull public CharSequence getQuantityText(@StringRes int id, int quantity) throws Resources.NotFoundException - Overrides:
getQuantityTextin classResources- Throws:
Resources.NotFoundException
-
getTextArray
- Overrides:
getTextArrayin classResources- Throws:
Resources.NotFoundException
-
getStringArray
- Overrides:
getStringArrayin classResources- Throws:
Resources.NotFoundException
-
getBaseResources
Returns theResourcesobject that is being wrapped.- Returns:
- The
Resourcesobject that is being wrapped.
-
getFont
- Overrides:
getFontin classResources- Throws:
Resources.NotFoundException
-
getIntArray
- Overrides:
getIntArrayin classResources- Throws:
Resources.NotFoundException
-
obtainTypedArray
- Overrides:
obtainTypedArrayin classResources- Throws:
Resources.NotFoundException
-
getDimension
- Overrides:
getDimensionin classResources- Throws:
Resources.NotFoundException
-
getDimensionPixelOffset
- Overrides:
getDimensionPixelOffsetin classResources- Throws:
Resources.NotFoundException
-
getDimensionPixelSize
- Overrides:
getDimensionPixelSizein classResources- Throws:
Resources.NotFoundException
-
getFraction
public float getFraction(int id, int base, int pbase) - Overrides:
getFractionin classResources
-
getDrawable
- Overrides:
getDrawablein classResources- Throws:
Resources.NotFoundException
-
getDrawable
@RequiresApi(21) public Drawable getDrawable(int id, Resources.Theme theme) throws Resources.NotFoundException - Overrides:
getDrawablein classResources- Throws:
Resources.NotFoundException
-
getDrawableForDensity
@RequiresApi(15) public Drawable getDrawableForDensity(int id, int density) throws Resources.NotFoundException - Overrides:
getDrawableForDensityin classResources- Throws:
Resources.NotFoundException
-
getDrawableForDensity
- Overrides:
getDrawableForDensityin classResources
-
getMovie
- Overrides:
getMoviein classResources- Throws:
Resources.NotFoundException
-
getColor
- Overrides:
getColorin classResources- Throws:
Resources.NotFoundException
-
getColor
@RequiresApi(api=23) public int getColor(int id, Resources.Theme theme) throws Resources.NotFoundException - Overrides:
getColorin classResources- Throws:
Resources.NotFoundException
-
getColorStateList
- Overrides:
getColorStateListin classResources- Throws:
Resources.NotFoundException
-
getColorStateList
@NonNull @RequiresApi(api=23) public ColorStateList getColorStateList(int id, Resources.Theme theme) - Overrides:
getColorStateListin classResources
-
getBoolean
- Overrides:
getBooleanin classResources- Throws:
Resources.NotFoundException
-
getInteger
- Overrides:
getIntegerin classResources- Throws:
Resources.NotFoundException
-
getFloat
-
getLayout
- Overrides:
getLayoutin classResources- Throws:
Resources.NotFoundException
-
getAnimation
- Overrides:
getAnimationin classResources- Throws:
Resources.NotFoundException
-
getXml
- Overrides:
getXmlin classResources- Throws:
Resources.NotFoundException
-
openRawResource
- Overrides:
openRawResourcein classResources- Throws:
Resources.NotFoundException
-
openRawResource
@NonNull public InputStream openRawResource(int id, TypedValue value) throws Resources.NotFoundException - Overrides:
openRawResourcein classResources- Throws:
Resources.NotFoundException
-
openRawResourceFd
- Overrides:
openRawResourceFdin classResources- Throws:
Resources.NotFoundException
-
getValue
public void getValue(int id, TypedValue outValue, boolean resolveRefs) throws Resources.NotFoundException - Overrides:
getValuein classResources- Throws:
Resources.NotFoundException
-
getValueForDensity
@RequiresApi(15) public void getValueForDensity(int id, int density, TypedValue outValue, boolean resolveRefs) throws Resources.NotFoundException - Overrides:
getValueForDensityin classResources- Throws:
Resources.NotFoundException
-
getValue
public void getValue(String name, TypedValue outValue, boolean resolveRefs) throws Resources.NotFoundException - Overrides:
getValuein classResources- Throws:
Resources.NotFoundException
-
obtainAttributes
- Overrides:
obtainAttributesin classResources
-
updateConfiguration
- Overrides:
updateConfigurationin classResources
-
getDisplayMetrics
- Overrides:
getDisplayMetricsin classResources
-
getConfiguration
- Overrides:
getConfigurationin classResources
-
getIdentifier
- Overrides:
getIdentifierin classResources
-
getResourceName
- Overrides:
getResourceNamein classResources- Throws:
Resources.NotFoundException
-
getResourcePackageName
- Overrides:
getResourcePackageNamein classResources- Throws:
Resources.NotFoundException
-
getResourceTypeName
- Overrides:
getResourceTypeNamein classResources- Throws:
Resources.NotFoundException
-
getResourceEntryName
- Overrides:
getResourceEntryNamein classResources- Throws:
Resources.NotFoundException
-
parseBundleExtras
public void parseBundleExtras(XmlResourceParser parser, Bundle outBundle) throws XmlPullParserException, IOException - Overrides:
parseBundleExtrasin classResources- Throws:
XmlPullParserExceptionIOException
-
parseBundleExtra
public void parseBundleExtra(String tagName, AttributeSet attrs, Bundle outBundle) throws XmlPullParserException - Overrides:
parseBundleExtrain classResources- Throws:
XmlPullParserException
-