The Android Arsenal – Utils

Android Resource Wrapper Library.


Fed up with typing ContextCompact, resources and context all over your apps to access your resources? Say no more.

implementation 'com.cioccarellia:kite:1.0.0'
  • ???? Access all app resources with one unified syntax.
  • ? Null safe layer between the Android framework java code and your app.
  • ???? Transparent and lightweight wrapper.
  • ? Extensive built-in checks.
  • Easy to implement in existing apps.
  • ❤️ Kotlin powered, 100%.


Initialize the kite global object (ideally inside your Application class) and pass to it the application context.

class App : Application() {

    companion object {
        lateinit var appContext: Context
        val kite by lazy { }

    override fun onCreate() {
        appContext = this

You’re all set. Simply import the kite object, select what you want to use and access it with the bracket notation [].

// Kite
fab.rippleColor =         kite.color[R.color.md_light_lime]
fab.backgroundTintList =  kite.colorStateList[R.color.md_lime]
fab.text =                kite.string[R.string.ride]

// Standard
fab.rippleColor =         ContextCompact.getColor(appContext, R.color.md_light_lime)
fab.backgroundTintList =  ColorStateList.valueOf(R.color.md_lime)
fab.text =                appContext.getString(R.string.ride)

Supported Resources

Resource Type AAPT class Namespace Input Output Implementation API Variants
Strings R.string Kite.string @StringRes string: Int String Context.getString() / formatArgs
Plurals R.plurals Kite.plural @PluralRes plural: Int, quantity: Int String Resources.getQuantityString() / formatArgs
Texts R.string Kite.text @StringRes text: Int CharSequence Context.getText() / /
Color R.color Kite.color @ColorRes color: Int @ColorInt Color ContextCompat.getColor() / /
ColorStateLists R.color Kite.colorStateList @ColorRes colorStateList: Int ColorStateList ContextCompat.getColorStateList() / /
Drawables R.drawable Kite.drawable @DrawableRes drawable: Int Drawable ContextCompat.getDrawable() / Resources.Theme?
Layouts R.layout Kite.layout @LayoutRes layout: Int XmlResourceParser Resources.getLayout() / /
Integer R.integer Kite.integer @IntegerRes integer: Int Int Resources.getInteger() / /
Booleans R.bool Kite.booleans @BoolRes boolean: Int Boolean Resources.getBoolean() / /
Dimensions R.dimen Kite.dimension @DimenRes dimensions: Int Float Resources.getDimensions() / /
Fractions R.fraction Kite.fraction @FractionRes fraction: Int, base: Int, pbase: Int Float Resources.getFraction() / /
Fonts R.font Kite.font @FontRes font: Int Typeface Resources.getFont() 26 /
Animations R.anim Kite.animation @AnimRes animation: Int Animation AnimationUtils.loadAnimation() / /
Interpolators R.interpolator Kite.interpolation @InterpolatorRes interpolator: Int Interpolator AnimationUtils.loadInterpolator() / /
IntArray R.array Kite.intArray @ArrayRes intArray: Int IntArray Resources.getIntArray() / /
StringArray R.array Kite.stringArray @ArrayRes stringArray: Int Array<out String> Resources.getStringArray() / /
TypedArray R.array Kite.typedArray @ArrayRes typedArray: Int TypedArray Resources.obtainTypedArray() / /
Identifiers Kite.identifier name: String, defType: String, defPackage: String Int Resources.getIdentifier() / /
Xmls R.xml Kite.xml @XmlRes xml: Int XmlResourceParser Resources.getXml() / /
Raws R.raw Kite.raw @RawRes raw: Int InputStream Resources.openRawResource() / TypedValue

? Known Issues

  • Annotation checks over resource parameters (functions which take as argument some annotated value, like @ColorRes, @StringRes) are not extensively performed by Android Studio, when using kotlin operator functions: I created a bug report at google issue tracker here. Hope to see it fixed soon.
  • After {@link Build.VERSION_CODES#R}, {@link Resources} must be obtained by {@link} or {@link android.content.Context} created with {@link android.content.Context#createWindowContext(int, Bundle)}. {@link Application#getResources()} may report wrong values in multi-window or on secondary displays.

Enable registration in settings - general
Compare items
  • Total (0)