{"id":24183937,"url":"https://github.com/cioccarellia/kite","last_synced_at":"2025-09-04T19:09:15.241Z","repository":{"id":55155292,"uuid":"312936676","full_name":"cioccarellia/kite","owner":"cioccarellia","description":"🪁 Android Resources Wrapper Library","archived":false,"fork":false,"pushed_at":"2021-11-30T19:59:47.000Z","size":511,"stargazers_count":133,"open_issues_count":1,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-01-26T02:01:13.884Z","etag":null,"topics":["android","android-library","color","drawables","kite","kotlin","kotlin-android","kotlin-library","library","resources","strings"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cioccarellia.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-15T01:40:56.000Z","updated_at":"2024-01-04T09:44:23.000Z","dependencies_parsed_at":"2022-08-14T13:40:53.284Z","dependency_job_id":null,"html_url":"https://github.com/cioccarellia/kite","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cioccarellia%2Fkite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cioccarellia%2Fkite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cioccarellia%2Fkite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cioccarellia%2Fkite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cioccarellia","download_url":"https://codeload.github.com/cioccarellia/kite/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233719580,"owners_count":18719398,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","android-library","color","drawables","kite","kotlin","kotlin-android","kotlin-library","library","resources","strings"],"created_at":"2025-01-13T09:32:01.024Z","updated_at":"2025-01-13T09:32:01.118Z","avatar_url":"https://github.com/cioccarellia.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/cioccarellia/kite\" target=\"_blank\"\u003e\u003cimg width=\"100\" src=\"art/icon_dark.png\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003ch1 align=\"center\"\u003eKite\u003c/h1\u003e\n\u003cp align=\"center\"\u003eAndroid Resource Wrapper Library.\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://search.maven.org/artifact/com.github.cioccarellia/kite\"\u003e\u003cimg src=\"https://img.shields.io/maven-central/v/com.github.cioccarellia/kite.svg?label=Maven%20Central\" alt=\"Download from MavenCentral\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://android-arsenal.com/details/1/8194\"\u003e\u003cimg src=\"https://img.shields.io/badge/Android%20Arsenal-kite-brightgreen.svg?style=flat\" alt=\"Android Arsenal\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://app.circleci.com/pipelines/github/cioccarellia/kite\"\u003e\u003cimg src=\"https://circleci.com/gh/cioccarellia/kite.svg?style=svg\" alt=\"CircleCI\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/cioccarellia/kite/actions?query=workflow%3A%22Android+CI%22\"\u003e\u003cimg src=\"https://github.com/cioccarellia/kite/workflows/Android%20CI/badge.svg\" alt=\"Android CI\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.codacy.com/gh/cioccarellia/kite/dashboard\"\u003e\u003cimg src=\"https://app.codacy.com/project/badge/Grade/91fb67a5494d4767b71c7bf99810c1c9\" alt=\"Codacy\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://kotlinlang.org/releases.html\"\u003e\u003cimg src=\"https://img.shields.io/badge/kotlin-1.5.21-orange.svg\" alt=\"Kotlin\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://source.android.com/setup/start/build-numbers\"\u003e\u003cimg src=\"https://img.shields.io/badge/min-14-00e676.svg\" alt=\"Android Min Sdk\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://source.android.com/setup/start/build-numbers\"\u003e\u003cimg src=\"https://img.shields.io/badge/compile-30-00e676.svg\" alt=\"Android Compile Version\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/cioccarellia/kite/blob/master/LICENSE.md\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-Apache%202.0-blue.svg\" alt=\"License\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## TLDR\nFed up with typing `ContextCompat`, `resources` and `context` all over your apps to access your resources? Say no more.\n\n\u003cdetails open\u003e\u003csummary\u003eGradle\u003c/summary\u003e\n\n```gradle\ndependencies {\n    implementation 'com.github.cioccarellia:kite:1.2.1'\n}\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eKotlin DSL\u003c/summary\u003e\n\n```gradle\ndependencies {\n    implementation(\"com.github.cioccarellia:kite:1.2.1\")\n}\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eMaven\u003c/summary\u003e\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.cioccarellia\u003c/groupId\u003e\n    \u003cartifactId\u003ekite\u003c/artifactId\u003e\n    \u003cversion\u003e1.2.1\u003c/version\u003e\n    \u003ctype\u003epom\u003c/type\u003e\n\u003c/dependency\u003e\n```\n\u003c/details\u003e\n\n- :kite: Access all app resources with one unified syntax.\n- :dna: Null safe layer between the Android framework java code and your app.\n- :ice_cube: Transparent and lightweight wrapper.\n- :lock: Extensive built-in checks.\n- :zap: Easy to implement in existing apps.\n- :heart: Kotlin powered, 100%.\n\n\n```kotlin\nval text = Kite.string[R.string.welcome_back]\n```\n\n## Usage\nKite is a handy and lightweight android library which aims at reducing redundancy and decreasing android code complexity.\nIt encloses and simplifies resource access within the Kite domain, and abstracts away the implementation logic needed to fetch the desired value, making interactions with the android framework smooth and frictionless.\nTo get started initialize kite (ideally inside your `Application` class) and pass to it the application context.\n\n```kotlin\nclass App : Application() {\n    override fun onCreate() {\n        super.onCreate()\n        Kite.fly(this)\n    }\n}\n```\n\nYou're all set. You can now import the `Kite` object, select whichever resource category you want to access and fetch it using the resource id and the bracket notation `[]`.\n\nBeware: kite can not and **will not** save you from the mess that is dealing with Android `Context`.\nAfter all, kite is some cleverly placed syntactic sugar over those same android methods you are used to: kite itself holds a reference to `Context`.\nIt will, however, unify and thoroughly uniform your experience with dealing with all android related resource extraction operations, which can turn to be extremely practical.\nIt may also save you from typing again `ContextCompat` in your life. That's the precise reason kite was created.\n\n\n## Samples\n```kotlin\n// 🪁 Kite\nfab.rippleColor =         Kite.color[R.color.md_light_lime]\nfab.backgroundTintList =  Kite.colorStateList[R.color.md_lime]\nfab.text =                Kite.string[R.string.unread_notifications, \"69\"]\nfab.isVisible =           Kite.bools[R.bool.show_fab]\n\n// Standard\nfab.rippleColor =         ContextCompat.getColor(context, R.color.md_light_lime)\nfab.backgroundTintList =  ColorStateList.valueOf(R.color.md_lime)\nfab.text =                appContext.getString(R.string.unread_notifications, \"69\")\nfab.isVisible =           resources.getBoolean(R.bool.show_fab)\n```\n\n## Context Switching\nOne clear disadvantage to using kite with respect to doing things the old way is choosing which context to use.\nThat's why Kite comes packed with extension functions for permanent change / temporary switch the in-use context, so that you have full control over which context is used to do what.\n- `runWith` can be invoked on any `KiteFetcher` object, it is chainable and it temporarily runs the passed lambda in the desired context.\n```kotlin\nKite.color.runWith(this) { color -\u003e\n    button.setBackground(\n        color[R.color.colorAccent]\n    )\n}\n```\n\n## Supported Resources\nKite delegates resource collection to `KiteFetcher`s. Those classes contain a well defined implementation of the actual process of converting the given `id` to the output type.\n\n| Resource Type   \t| AAPT class       \t| Fetcher                \t| Input                                                   \t| Output              \t| Implementation                      \t| API \t| Variants           \t|\n|-----------------\t|------------------\t|-----------------------\t|---------------------------------------------------------\t|---------------------\t|-------------------------------------\t|-----\t|--------------------\t|\n| Strings         \t| `R.string`       \t| `Kite.string`         \t| `@StringRes string: Int`                                \t| `String`            \t| `Context.getString()`               \t| /   \t| `formatArgs`       \t|\n| Plurals         \t| `R.plurals`      \t| `Kite.plural`         \t| `@PluralRes plural: Int`, `quantity: Int`               \t| `String`            \t| `Resources.getQuantityString()`     \t| /   \t| `formatArgs`       \t|\n| Texts           \t| `R.string`       \t| `Kite.text`           \t| `@StringRes text: Int`                                  \t| `CharSequence`      \t| `Context.getText()`                 \t| /   \t| /                  \t|\n| Color           \t| `R.color`        \t| `Kite.color`          \t| `@ColorRes color: Int`                                  \t| `@ColorInt Color`   \t| `ContextCompat.getColor()`          \t| /   \t| /                  \t|\n| ColorStateLists \t| `R.color`        \t| `Kite.colorStateList` \t| `@ColorRes colorStateList: Int`                         \t| `ColorStateList`    \t| `ContextCompat.getColorStateList()` \t| /   \t| /                  \t|\n| Drawables       \t| `R.drawable`     \t| `Kite.drawable`       \t| `@DrawableRes drawable: Int`                            \t| `Drawable`          \t| `ContextCompat.getDrawable()`       \t| /   \t| `Resources.Theme?` \t|\n| Layouts         \t| `R.layout`       \t| `Kite.layout`         \t| `@LayoutRes layout: Int`                                \t| `XmlResourceParser` \t| `Resources.getLayout()`             \t| /   \t| /                  \t|\n| Integer         \t| `R.integer`      \t| `Kite.integer`        \t| `@IntegerRes integer: Int`                              \t| `Int`               \t| `Resources.getInteger()`            \t| /   \t| /                  \t|\n| Booleans        \t| `R.bool`         \t| `Kite.booleans`       \t| `@BoolRes boolean: Int`                                  \t| `Boolean`           \t| `Resources.getBoolean()`            \t| /   \t| /                  \t|\n| Dimensions      \t| `R.dimen`        \t| `Kite.dimension`      \t| `@DimenRes dimensions: Int`                             \t| `Float`             \t| `Resources.getDimensions()`         \t| /   \t| /                  \t|\n| Fractions       \t| `R.fraction`     \t| `Kite.fraction`       \t| `@FractionRes fraction: Int`, `base: Int`, `pbase: Int` \t| `Float`             \t| `Resources.getFraction()`           \t| /   \t| /                  \t|\n| Fonts           \t| `R.font`         \t| `Kite.font`           \t| `@FontRes font: Int`                                    \t| `Typeface`          \t| `Resources.getFont()`               \t| 26  \t| /                  \t|\n| Animations      \t| `R.anim`         \t| `Kite.animation`      \t| `@AnimRes animation: Int`                               \t| `Animation`         \t| `AnimationUtils.loadAnimation()`    \t| /   \t| /                  \t|\n| Interpolators   \t| `R.interpolator` \t| `Kite.interpolation`  \t| `@InterpolatorRes interpolator: Int`                    \t| `Interpolator`      \t| `AnimationUtils.loadInterpolator()` \t| /   \t| /                  \t|\n| IntArray        \t| `R.array`        \t| `Kite.intArray`       \t| `@ArrayRes intArray: Int`                               \t| `IntArray`          \t| `Resources.getIntArray()`           \t| /   \t| /                  \t|\n| StringArray     \t| `R.array`        \t| `Kite.stringArray`    \t| `@ArrayRes stringArray: Int`                            \t| `Array\u003cout String\u003e` \t| `Resources.getStringArray()`        \t| /   \t| /                  \t|\n| TypedArray     \t| `R.array`        \t| `Kite.typedArray`     \t| `@ArrayRes typedArray: Int`                             \t| `TypedArray`        \t| `Resources.obtainTypedArray()`      \t| /   \t| /                  \t|\n| Identifiers     \t| `R.id`           \t| `Kite.identifier`     \t| `name: String`, `defType: String`, `defPackage: String` \t| `Int`               \t| `Resources.getIdentifier()`         \t| /   \t| /                  \t|\n| Xmls            \t| `R.xml`          \t| `Kite.xml`            \t| `@XmlRes xml: Int`                                      \t| `XmlResourceParser` \t| `Resources.getXml()`                \t| /   \t| /                  \t|\n| Raws            \t| `R.raw`          \t| `Kite.raw`            \t| `@RawRes raw: Int`                                      \t| `InputStream`       \t| `Resources.openRawResource()`       \t| /   \t| `TypedValue`       \t|\n\n## :warning: Known Issues\n- Annotation checks over resource function 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 @ google issue tracker [here](https://issuetracker.google.com/issues/173628041). Hope to see it fixed soon, by \u003cs\u003e2020\u003c/s\u003e 2021 Marked as fixed\n\n## Kite Puns\n- A kite usually comes with different *colors*\n- A kite is flown and controlled with *strings*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcioccarellia%2Fkite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcioccarellia%2Fkite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcioccarellia%2Fkite/lists"}