{"id":18735149,"url":"https://github.com/irontec/inkspannable","last_synced_at":"2025-11-15T10:30:18.799Z","repository":{"id":142235197,"uuid":"202684867","full_name":"irontec/InkSpannable","owner":"irontec","description":"Better spannable creation.","archived":false,"fork":false,"pushed_at":"2021-09-14T15:04:21.000Z","size":182,"stargazers_count":1,"open_issues_count":2,"forks_count":1,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-01-31T04:53:53.301Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/irontec.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-16T07:58:48.000Z","updated_at":"2021-09-14T15:04:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"8ba40ef6-5407-4ab5-9e02-eedce65d980d","html_url":"https://github.com/irontec/InkSpannable","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irontec%2FInkSpannable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irontec%2FInkSpannable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irontec%2FInkSpannable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irontec%2FInkSpannable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/irontec","download_url":"https://codeload.github.com/irontec/InkSpannable/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239607530,"owners_count":19667431,"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":[],"created_at":"2024-11-07T15:15:52.949Z","updated_at":"2025-11-15T10:30:18.768Z","avatar_url":"https://github.com/irontec.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# InkSpannable\n[![](https://jitpack.io/v/irontec/InkSpannable.svg)](https://jitpack.io/#irontec/InkSpannable)\n\nBetter spannable creation.\n\n## Configuration\n\nFirst of all you need to pass the Application context to the InkSpannableConfig (as a WeakReference, do not fear):\n\n```kt\nclass AppCtrl : Application() {\n\n\toverride fun onCreate() {\n\t\tsuper.onCreate()\n\n\t\t// initialize the singleton\n\t\tinstance = this\n\t\t\n\t\tInkSpannableConfig.context = WeakReference(this)\n\t}\n\n\tcompanion object {\n\n\t\t/**\n\t\t * A singleton instance of the application class for easy access in other places\n\t\t */\n\t\tlateinit var instance: AppCtrl\n\t\t\tprivate set\n\t}\n}\n```\n\nThen you can create an InkSpannable with some text or empty, and modify it. It has methods available to add text (styled if you want, string or string resource id) or to modify current text style. Then you build it and assign it to a TextView or some other text holder which supports SpannableStringBuilder.\n\n## Example\n\nBuild some long text:\n```kt\ntextview.text = InkSpannableBuilder().addText(\"long\")\n\t.addBlank().addTextItalic(\"long\")\n\t.addBlank().addTextBoldItalic(\"complex\")\n\t.addBlank().addTextColor(\"text\", getColorCompat(R.color.basic_red))\n\t.addBlank().addTextColor(\"I\", getColorCompat(R.color.basic_green))\n\t.addBlank().addTextColor(\"am\", getColorCompat(R.color.basic_blue))\n\t.addBlank().addTextUnderline(\"testing\")\n\t.build()\n```\n\nCreate with text and then modify it:\n```kt\ntextview.text = InkSpannableBuilder(R.string.long_text_1)\n\t.boldText(AppCtrl.instance.resources.getStringArray(R.array.long_text_1_bold).toList())\n\t.build()\n```\n\nWith resources from strings.xml:\n```xml\n\u003cstring name=\"long_text_1\"\u003eWe define some words to bold on an array in Strings.xml, like this one or this other one\u003c/string\u003e\n\n\u003cstring-array name=\"long_text_1_bold\"\u003e\n\t\u003citem\u003eStrings.xml\u003c/item\u003e\n\t\u003citem\u003ethis one\u003c/item\u003e\n\t\u003citem\u003ethis other one\u003c/item\u003e\n\u003c/string-array\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firontec%2Finkspannable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Firontec%2Finkspannable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firontec%2Finkspannable/lists"}