Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mohitsoni48/aDp
This library is used in jetpack compose to overcome UI differences in different android devices for same code.
https://github.com/mohitsoni48/aDp
android android-library jetpack-compose kotlin-android kotlin-library ui
Last synced: about 1 month ago
JSON representation
This library is used in jetpack compose to overcome UI differences in different android devices for same code.
- Host: GitHub
- URL: https://github.com/mohitsoni48/aDp
- Owner: mohitsoni48
- Created: 2024-08-22T12:27:25.000Z (6 months ago)
- Default Branch: master
- Last Pushed: 2024-08-30T11:37:28.000Z (5 months ago)
- Last Synced: 2024-09-01T21:04:38.434Z (5 months ago)
- Topics: android, android-library, jetpack-compose, kotlin-android, kotlin-library, ui
- Language: Kotlin
- Homepage: https://medium.com/@mohitsoni48/creating-pixel-perfect-ui-with-jetpack-compose-17376455f16b
- Size: 1010 KB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-list - mohitsoni48/aDp - This library is used in jetpack compose to overcome UI differences in different android devices for same code. (Kotlin)
README
# aDp
[![](https://jitpack.io/v/mohitsoni48/aDp.svg)](https://jitpack.io/#mohitsoni48/aDp)See here why you need this: https://medium.com/@mohitsoni48/creating-pixel-perfect-ui-with-jetpack-compose-17376455f16b
## How to Install
Add it in your root build.gradle at the end of repositories:
```
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
```Add the dependency
```
dependencies {
implementation 'com.github.mohitsoni48:aDp:'
}
```## How to Use
Initialize ADp in you application class/ Launching Activity like this
```
ADp.initializeAdp(this.resources, )
```Replace `dp` with `aDp` and `sp` with `aSp` in your Jetpcak Compose
```
Text(
text = "This text uses aSp\nDimensions to box are in aDp",
fontSize = 16.aSp,
modifier = Modifier
.background(
Color.LightGray
)
.padding(vertical = 20.aDp)
.width(300.aDp)
)
```## Liked my work?
[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/L3L612MBTA)
### Note: This library is not optimized for foldable phones and tablets. Also If your device supports configuration changes, you will need to initialize again on each configuration change