cdp - A Composable Scalable Size Unit

Related tags

Time View Widget cdp
Overview

issues Forks Stars License

cdp - A Composable Scalable Size Unit

An android lib that provides a new size unit - cdp (compose dp). This size unit scales with the screen size for Jetpack Compose Structure. It can help Android developers with supporting multiple screens for Compose structure.

for text views please refer to csp which is based on the sp size unit for texts.

Attention

Use it carefully! for example, in most cases you still need to design a different layout for tablets.

Example

Here is a single layout built using cdp:

cdp example

And Here is the same layout built using dp:

dp example

You can see that cdp scales with the screen size and the dp stays with the same size on all screen sizes.

Getting Started

To add cdp to your project (Using Android Studio and Gradle):

Step 1. Add it in your root build.gradle at the end of repositories:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Step 2. Add the dependency

dependencies {
    implementation 'com.github.mbpatel6245:cdp:ReleaseVersion'
}

Step 3. Provide type to your composable theme

ProvideDimens(dimensions = getDimensType()) {
    MaterialTheme(
        ...
    )
}

Step 4. Use on Widget

Spacer(modifier = Modifier.height(CDP.dimens._15cdp))

Note

The cdp size unit calculation includes some approximation due to some performance and usability constraints.

You might also like...
AutosizeEditText for Android is an extension of native EditText that offer a smooth auto scale text size.
AutosizeEditText for Android is an extension of native EditText that offer a smooth auto scale text size.

AutoscaleEditText AutosizeEditText for Android is an extension of native EditText that offer a smooth auto scale text size. Latest Version How to use

A simple utility to remove unused resources in your Android app to lower the size of the APK. It's based on the Android lint tool output.

android-resource-remover android-resource-remover is utility that removes unused resources reported by Android Lint from your project. The goal is to

Simple View to change Brush Size, Alpha and Color
Simple View to change Brush Size, Alpha and Color

BrushView Simple View to change Brush Size, Alpha and Color Screenshots How to install In your build.gradle project allprojects { repositories {

A TextView that automatically fit its font and line count based on its available size and content
A TextView that automatically fit its font and line count based on its available size and content

AutoFitTextView A TextView that automatically fit its font and line count based on its available size and content This code is heavily based on this S

A TextView library that allows the user to increase/decrease font size with a two finger gesture by the user.
A TextView library that allows the user to increase/decrease font size with a two finger gesture by the user.

PinchZoomTextView Library This library allows you to have a TextView that will grow/shrink the font size using gestures from the user. Usage To have a

A RatingBar library for android, you can customize size, spacing, color and image easily, and support right to left.
A RatingBar library for android, you can customize size, spacing, color and image easily, and support right to left.

A RatingBar library for android, you can customize size, spacing, color and image easily, and support right to left.

Gradle plugin which helps you analyze the size of your Android apps.
Gradle plugin which helps you analyze the size of your Android apps.

Ruler Ruler is a Gradle plugin which helps you analyze the size of your Android apps. Motivation App size is an important metric which directly correl

Added support to modify text size and indicator width based on the original TabLayout.
Added support to modify text size and indicator width based on the original TabLayout.

XTabLayout——可修改选中项字体大小和指示器长度的TabLayout XTabLayout是基于design包中的TabLayout进行了功能的扩展,在保留原有功能的基础上,增加了修改选中项字体大小、修改指示器长度以及限制屏幕显示范围内显示的Tab个数。 集成步骤: 1.添加XTabLayo

ConstraintLayout is an Android layout component which allows you to position and size widgets in a flexible way

ConstraintLayout is a layout manager for Android which allows you to position and size widgets in a flexible way. It's available for both the Android view system and Jetpack Compose.

TinyDamage - A Minecraft Mod that changes your Player size based on your Damage

Fabric Example Mod Setup For setup instructions please see the fabric wiki page

Gradle plugin which analyzes the size of your Android apps

Scope is a Gradle plugin which helps you analyze the size of your Android apps. Motivation App size is an important metric which directly correlates w

An Android Image compress library, reduce's the size of the image by 90% without losing any of its pixels.
An Android Image compress library, reduce's the size of the image by 90% without losing any of its pixels.

Image Compressor An Android image compress library, image compressor, is small and effective. With very little or no image quality degradation, a comp

🚀📒📍 Indicators for Horizontal or Vertical Pager with different orientation, color, size options and optional touch feature.

Compose Pager Indicator Indicators for Horizontal or Vertical pager with different orientation, color, size options and optional touch feature. indica

Simple view which allow you to customise your pizza's toppings and size as per your choice.
Simple view which allow you to customise your pizza's toppings and size as per your choice.

TwistedPizzaToppingsView Overview Simple view which allows options to customize your pizza toppings and size as per your choice. Features Android 12 s

Simple composable for rendering transitions between backstacks.
Simple composable for rendering transitions between backstacks.

compose-backstack Simple library for Jetpack Compose for rendering backstacks of screens and animated transitions when the stack changes. It is not a

A framework for writing composable parsers based on Kotlin Coroutines.

Parsus A framework for writing composable parsers based on Kotlin Coroutines. val booleanGrammar = object : GrammarBooleanExpression() { val ws

Kermit is a Kotlin Multiplatform logging utility with composable log outputs

Kermit is a Kotlin Multiplatform logging utility with composable log outputs. The library provides prebuilt loggers for outputting to platform logging tools such as Logcat and NSLog.

a set of Settings like composable items to help android Jetpack Compose developers build complex settings screens
a set of Settings like composable items to help android Jetpack Compose developers build complex settings screens

This library provides a set of Settings like composable items to help android Jetpack Compose developers build complex settings screens without all the boilerplate

Sample app that shows how to create a bitmap from a Jetpack composable
Sample app that shows how to create a bitmap from a Jetpack composable

Creating Bitmaps From Jetpack Composables This app demonstrates how to create a bitmap from a Jetpack composable without the need to display the compo

Releases(1.0.0)
  • 1.0.0(Sep 12, 2022)

    What's Changed

    • Minor Demo update by @mbpatel6245 in https://github.com/mbpatel6245/cdp/pull/1

    New Contributors

    • @mbpatel6245 made their first contribution in https://github.com/mbpatel6245/cdp/pull/1

    Full Changelog: https://github.com/mbpatel6245/cdp/commits/1.0.0

    Source code(tar.gz)
    Source code(zip)
Owner
Mehul Patel
Mobile Software Engineer
Mehul Patel
CSP - A Scalable Size Unit For Texts

csp - A Composable Scalable Size Unit for Texts An android lib that provides a new size unit - csp (compose sp). This size unit scales with the screen

Mehul Patel 4 Nov 30, 2022
An ActivityScenario extension and a Junit4 TestRule to simulate changing the font size on a device/emulator, as it would be done by going to Settings > display > Font size

FontSizeActivityScenario and FontSizeTestRule An ActivityScenario and a Junit4 TestRule to be used together with its org.junit.runners.Parameterized.

Sergio Sastre Flórez 19 Jan 6, 2022
This is an open-source project connected to Formaloo CDP

Twitter Rank Android Application This is an open-source project connected to Formaloo CDP to calculate a tweeter and his/her followings rank. For each

Formaloo 11 Jun 12, 2022
Scalable vector graphics for Android

Sharp Sharp is a Scalable Vector Graphics (SVG) implementation for Android. It facilitates loading vector graphics as SharpDrawables, and can effectiv

Pixplicity 1k Dec 31, 2022
Scalable Layout For Android

ScalableLayout for Android. Class: com.ssomai.android.scalablelayout.ScalableLayout 한글버전 README.md: https://github.com/ssomai/ScalableLayout/blob/mast

Youngmann Kim 273 Nov 21, 2022
Jitsi Meet - Secure, Simple and Scalable Video Conferences

Jitsi Meet is an open-source (Apache) WebRTC JavaScript application that uses Jitsi Videobridge to provide high quality, secure and scalable video conferences.

Jitsi 19.1k Jan 2, 2023
A scalable cluster computing proof-of-concept that calculates prime numbers upto 2^32!

Project Crumbler An proof-of-concept of oppurtunistic computing which also uses cluster computing This serves as a project as part of the Cloud Comput

Hemanth Krishna 3 Feb 18, 2022
A simple and scalable Android bot emulation framework, as presented at Black Hat Europe's Arsenal

m3 A simple and scalable Android bot emulation framework. A detailed explanation can be found here. This project was first published at Black Hat Euro

null 22 Aug 20, 2022
Command framework built around Kord, built to be robust and scalable, following Kord's convention and design patterns.

Command framework built around Kord, built to be robust and scalable, following Kord's convention and design patterns.

ZeroTwo Bot 4 Jun 15, 2022
Clean Android multi-module offline-first scalable app in 2022. Including Jetpack Compose, MVI, Kotlin coroutines/Flow, Kotlin serialization, Hilt and Room.

Android Kotlin starter project - 2022 edition Android starter project, described precisely in this article. Purpose To show good practices using Kotli

Krzysztof Dąbrowski 176 Jan 3, 2023