Skip to content

Instantly share code, notes, and snippets.

View LethalMaus's full-sized avatar

James Cullimore LethalMaus

View GitHub Profile
@LethalMaus
LethalMaus / combined-previews.kt
Created June 4, 2026 19:52
Compose preview matrix for translation screenshots
package dev.jamescullimore.app.ui.preview
import androidx.compose.ui.tooling.preview.Preview
// The unsupported locale intentionally falls back to showing string keys.
@Preview(name = "Keys", locale = "eo", fontScale = 1f, group = "Keys")
@Preview(name = "English - 85%", locale = "en", fontScale = 0.85f, group = "English")
@Preview(name = "English - 100%", locale = "en", fontScale = 1.0f, group = "English")
@Preview(name = "English - 150%", locale = "en", fontScale = 1.5f, group = "English")
@Preview(name = "English - 200%", locale = "en", fontScale = 2.0f, group = "English")
@LethalMaus
LethalMaus / scrollable-preview-workaround.kt
Created June 4, 2026 19:52
Scrollable Compose preview screenshot workaround
package dev.jamescullimore.app.ui.settings
import androidx.compose.foundation.ScrollState
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.rememberScrollState
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.material3.Surface
import dev.jamescullimore.app.ui.preview.CombinedPreviews
@LethalMaus
LethalMaus / preview-snapshot-tests.kt
Created June 4, 2026 19:52
Paparazzi preview snapshot test setup
package dev.jamescullimore.app.testing
import android.content.res.Configuration.UI_MODE_NIGHT_MASK
import android.content.res.Configuration.UI_MODE_NIGHT_YES
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
@LethalMaus
LethalMaus / generate-preview-gallery.py
Created June 4, 2026 19:52
Generate translator-friendly Paparazzi preview gallery
@LethalMaus
LethalMaus / scrollable-preview-workaround.kt
Created May 18, 2026 19:14
Scrollable preview workaround for screenshot review coverage
package dev.jamescullimore.app.ui.settings
import androidx.compose.foundation.ScrollState
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.rememberScrollState
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.material3.Surface
import dev.jamescullimore.app.ui.preview.CombinedPreviews
@LethalMaus
LethalMaus / generate-preview-gallery.py
Created May 18, 2026 19:14
Generate a translator-friendly gallery from Paparazzi preview output
@LethalMaus
LethalMaus / preview-snapshot-tests.kt
Created May 18, 2026 19:14
Preview-driven Paparazzi snapshot tests for Compose previews
package dev.jamescullimore.app.testing
import android.content.res.Configuration.UI_MODE_NIGHT_MASK
import android.content.res.Configuration.UI_MODE_NIGHT_YES
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
@LethalMaus
LethalMaus / combined-previews.kt
Created May 18, 2026 19:14
Combined preview matrix for locale, key, and font-scale screenshot testing
package dev.jamescullimore.app.ui.preview
import androidx.compose.ui.tooling.preview.Preview
// The unsupported locale intentionally falls back to showing string keys.
@Preview(name = "Keys", locale = "eo", fontScale = 1f, group = "Keys")
@Preview(name = "English - 85%", locale = "en", fontScale = 0.85f, group = "English")
@Preview(name = "English - 100%", locale = "en", fontScale = 1.0f, group = "English")
@Preview(name = "English - 150%", locale = "en", fontScale = 1.5f, group = "English")
@Preview(name = "English - 200%", locale = "en", fontScale = 2.0f, group = "English")
@LethalMaus
LethalMaus / dejavu-cleaner-fix-runtime.kt
Created May 7, 2026 19:50
Dejavu cleaner runtime fix for article
package dejavu.internal
import android.app.Activity
import android.app.Application
import android.os.Bundle
import androidx.compose.runtime.tooling.CompositionData
import java.lang.ref.WeakReference
import java.lang.reflect.Field
import java.util.Collections
import java.util.IdentityHashMap
@LethalMaus
LethalMaus / dejavu-minimal-fix-rule.kt
Created May 7, 2026 19:50
Dejavu minimal rule fix for article
package dejavu
import androidx.activity.ComponentActivity
import androidx.compose.ui.test.junit4.ComposeContentTestRule
import androidx.compose.ui.test.junit4.ComposeTestRule
import androidx.compose.ui.test.junit4.AndroidComposeTestRule
import androidx.compose.ui.test.junit4.createAndroidComposeRule
import androidx.test.ext.junit.rules.ActivityScenarioRule
import org.junit.runner.Description
import org.junit.runners.model.Statement