Super‑charge your Jetpack Compose previews with production‑grade device specs for rugged enterprise handhelds and popular Android OEM devices – Zebra, Honeywell, Datalogic, Samsung, and more – plus Google reference devices through their stable IDs.
Stop eyeballing layouts on a single Pixel. Catch density, width/height & aspect issues instantly – before they ship.
Total devices: 24282 across 2668 manufacturers. See the full list: Supported Devices.
The built‑in Compose preview device list is limited and focused on consumer phones. Enterprise & vertical‑market apps often run on purpose‑built scanners, sleds and rugged handhelds with very different screen metrics. This library ships curated, de‑duplicated specs so you can preview realistically with a single import.
- One Kotlin object per manufacturer (e.g.
Zebra,Honeywell,Samsung) - Simple constant strings drop straight into
@Preview(device = Zebra.MC33)style usage - Google devices use official
id:previews; others use explicitspec:width=...,height=...,dpi=...strings - Automatic markdown catalog generation: browse all supported devices in docs/devices
- Deterministic naming with conflict resolution (resolution / DPI / short hash fallbacks)
- Regenerate & extend via a Kotlin generator module (no shell scripts)
Add the dependency from Maven Central:
// Module build.gradle.kts
dependencies {
implementation("se.premex.compose.preview:android-compose-preview-ext:1.0.0")
}The library is hosted on Maven Central, so no additional repository configuration is needed if you already have mavenCentral() in your repositories block.
Import the manufacturer object you need and reference a constant:
import androidx.compose.ui.tooling.preview.Preview
import se.premex.compose.preview.device.catalog.android.Zebra
@Preview(name = "Zebra MC33", device = Zebra.MC33)
@Composable
fun ZebraPreview() { /* ... */ }Multiple devices in one file:
@Preview(name = "Rugged (MC33)", device = Zebra.MC33)
@Preview(name = "Rugged (EC50)", device = Zebra.EC50)
@Preview(name = "Scanner (CK65)", device = Honeywell.CK65)
@Composable
fun MultiDevicePreview() { /* ... */ }Google reference devices (Pixels etc.) use their id: values automatically in constants, so you still write:
@Preview(name = "Pixel 8", device = Google.PIXEL_8)A regenerated catalog lives here: docs/devices/README.md. (If the link is empty, run the generator locally.)
The device-generator module fetches & normalizes specs, then outputs:
- Kotlin sources under
android-compose-preview-ext/src/main/kotlin/se/premex/compose/preview/device/catalog/android/ - Markdown docs under
docs/devices/ - Updated stats block in this README (between markers)
Run:
./gradlew :device-generator:runCommit the changed Kotlin & Markdown files.
- Locate the fetch logic inside
device-generator(e.g.DeviceFetcher) and extend its source lists. - Run the generator.
- Verify new constants & docs.
- Open a PR describing the source/reference for the spec (link to vendor PDF / site preferred).
Constant names are derived from vendor model codes. If a conflict occurs (same code, different resolution) a suffix (resolution, DPI or short hash) is appended. This keeps existing names stable for the common case.
MIT – see LICENSE.
Maintained by Premex AB. Vendor names & trademarks belong to their respective owners.
Device catalog data is sourced from android-device-catalog-parser by Hossain Khan.
Enjoy faster feedback loops? Star the repo so others can discover it ⭐