{"id":20474021,"url":"https://github.com/drewhamilton/inlinedimens","last_synced_at":"2025-04-13T11:32:35.275Z","repository":{"id":49862121,"uuid":"193558277","full_name":"drewhamilton/InlineDimens","owner":"drewhamilton","description":"Android dimension types as inline classes with easy conversions.","archived":false,"fork":false,"pushed_at":"2021-06-09T18:25:17.000Z","size":547,"stargazers_count":55,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T02:43:13.067Z","etag":null,"topics":["android","conversion","dimensions"],"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/drewhamilton.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-24T18:28:17.000Z","updated_at":"2023-09-08T17:55:10.000Z","dependencies_parsed_at":"2022-09-26T22:01:47.786Z","dependency_job_id":null,"html_url":"https://github.com/drewhamilton/InlineDimens","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/drewhamilton%2FInlineDimens","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drewhamilton%2FInlineDimens/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drewhamilton%2FInlineDimens/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drewhamilton%2FInlineDimens/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/drewhamilton","download_url":"https://codeload.github.com/drewhamilton/InlineDimens/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248705921,"owners_count":21148618,"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","conversion","dimensions"],"created_at":"2024-11-15T14:27:36.379Z","updated_at":"2025-04-13T11:32:35.240Z","avatar_url":"https://github.com/drewhamilton.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Inline Dimens\n[![](https://github.com/drewhamilton/InlineDimens/workflows/CI/badge.svg?branch=main)](https://github.com/drewhamilton/InlineDimens/actions?query=workflow%3ACI+branch%3Amain)\n\nNever confuse px, dp, and sp at runtime again. Inline Dimens offers a separate inline class for each\ndimen type, ensuring compile-time unit confidence without any runtime cost. Extension functions\nprovide the ability to interact with the Android framework directly with these unit-safe types, and\nto convert between them easily.\n\n## Download\n\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/dev.drewhamilton.inlinedimens/inlinedimens/badge.svg)](https://maven-badges.herokuapp.com/maven-central/dev.drewhamilton.inlinedimens/inlinedimens)\n\nInline Dimens is available on Maven Central. It is experimental, and the API may undergo breaking\nchanges before version 1.0.0.\n\nTo use Inline Dimens, include the following in your Gradle dependencies:\n```groovy\nimplementation \"dev.drewhamilton.inlinedimens:inlinedimens:$version\"\n```\n\n## Usage\n\nEnsure inline classes are enabled in your build.gradle file:\n```groovy\nandroid {\n    // ...\n    kotlinOptions {\n        // ...\n        freeCompilerArgs += [\"-XXLanguage:+InlineClasses\"]\n    }\n}\n```\n\nThen, work directly with unit-safe types in your code. For example, get a `TextView`'s text size in\nthe unit of your choice:\n```kotlin\nval scaledTextSize = textView.textSizeSp\n```\n\nAnd convert between different units at will:\n```kotlin\nval textSizePx = scaledTextSize.toPx()\n```\n\n**Note:** Inline classes don't play nicely with Java source code, so this library is unusable in\nJava source.\n\n## License\n```\nCopyright 2019 Drew Hamilton\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrewhamilton%2Finlinedimens","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrewhamilton%2Finlinedimens","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrewhamilton%2Finlinedimens/lists"}