Skip to content

CircleToSearch with multi search engine support for all android

Kotlin

onboarding

AKS Labs9a6c4dc3817e
diff --git a/app/src/main/java/com/akslabs/circletosearch/MainActivity.kt b/app/src/main/java/com/akslabs/circletosearch/MainActivity.kt
index 8d96c36..b220c5b 100644
--- a/app/src/main/java/com/akslabs/circletosearch/MainActivity.kt
+++ b/app/src/main/java/com/akslabs/circletosearch/MainActivity.kt
@@ -53,6 +53,7 @@ import androidx.compose.ui.text.withStyle
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.compose.ui.window.DialogProperties
+import com.akslabs.circletosearch.onboarding.PixelCircleSearchOnboardingScreen
import com.akslabs.circletosearch.ui.components.PrivacyDialog
import com.akslabs.circletosearch.ui.theme.CircleToSearchTheme
import com.akslabs.circletosearch.utils.PrivacyPreferences
@@ -71,15 +72,31 @@ class MainActivity : ComponentActivity() {
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
- var currentScreen by remember { mutableStateOf("home") }
- androidx.compose.animation.Crossfade(targetState = currentScreen) { screen ->
- when (screen) {
- "settings" -> com.akslabs.circletosearch.ui.OverlaySettingsScreen(onBack = { currentScreen = "home" })
- "ocr_settings" -> com.akslabs.circletosearch.ui.OcrSettingsScreen(onBack = { currentScreen = "home" })
- else -> SetupScreen(
- onSettingsClick = { currentScreen = "settings" },
- onOcrSettingsClick = { currentScreen = "ocr_settings" }
- )
+ val context = LocalContext.current
+ val appPrefs = remember {
+ context.getSharedPreferences("app_prefs", android.content.Context.MODE_PRIVATE)
+ }
+ var showOnboarding by remember {
+ mutableStateOf(!appPrefs.getBoolean("onboarding_completed", false))
+ }
+ if (showOnboarding) {
+ PixelCircleSearchOnboardingScreen(
+ onFinish = {
+ appPrefs.edit().putBoolean("onboarding_completed", true).apply()
+ showOnboarding = false
+ }
+ )
+ } else {
+ var currentScreen by remember { mutableStateOf("home") }
+ androidx.compose.animation.Crossfade(targetState = currentScreen) { screen ->
+ when (screen) {
+ "settings" -> com.akslabs.circletosearch.ui.OverlaySettingsScreen(onBack = { currentScreen = "home" })
+ "ocr_settings" -> com.akslabs.circletosearch.ui.OcrSettingsScreen(onBack = { currentScreen = "home" })
+ else -> SetupScreen(
+ onSettingsClick = { currentScreen = "settings" },
+ onOcrSettingsClick = { currentScreen = "ocr_settings" }
+ )
+ }
}
}
}
diff --git a/app/src/main/java/com/akslabs/circletosearch/onboarding/PixelCircleSearchOnboardingScreen.kt b/app/src/main/java/com/akslabs/circletosearch/onboarding/PixelCircleSearchOnboardingScreen.kt
new file mode 100644
index 0000000..3ac5962
--- /dev/null
+++ b/app/src/main/java/com/akslabs/circletosearch/onboarding/PixelCircleSearchOnboardingScreen.kt
@@ -0,0 +1,953 @@
+package com.akslabs.circletosearch.onboarding
+
+import androidx.compose.animation.AnimatedContent
+import androidx.compose.animation.core.Animatable
+import androidx.compose.animation.core.LinearEasing
+import androidx.compose.animation.core.RepeatMode
+import androidx.compose.animation.core.animateFloat
+import androidx.compose.animation.core.infiniteRepeatable
+import androidx.compose.animation.core.rememberInfiniteTransition
+import androidx.compose.animation.core.tween
+import androidx.compose.animation.fadeIn
+import androidx.compose.animation.fadeOut
+import androidx.compose.animation.scaleIn
+import androidx.compose.animation.scaleOut
+import androidx.compose.animation.togetherWith
+import androidx.compose.foundation.Canvas
+import androidx.compose.foundation.background
+import androidx.compose.foundation.border
+import androidx.compose.foundation.clickable
+import androidx.compose.foundation.gestures.detectDragGestures
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.BoxWithConstraints
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.Spacer
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.layout.heightIn
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.layout.width
+import androidx.compose.foundation.rememberScrollState
+import androidx.compose.foundation.shape.CircleShape
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.foundation.verticalScroll
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.filled.Calculate
+import androidx.compose.material.icons.filled.Check
+import androidx.compose.material.icons.filled.CheckCircle
+import androidx.compose.material.icons.filled.CloudUpload
+import androidx.compose.material.icons.filled.Gesture
+import androidx.compose.material.icons.filled.Info
+import androidx.compose.material.icons.filled.ImageSearch
+import androidx.compose.material.icons.filled.ShoppingBag
+import androidx.compose.material.icons.filled.Shield
+import androidx.compose.material.icons.filled.Translate
+import androidx.compose.material.icons.filled.Warning
+import androidx.compose.material3.Card
+import androidx.compose.material3.CardDefaults
+import androidx.compose.material3.Icon
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Surface
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateListOf
+import androidx.compose.runtime.mutableFloatStateOf
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.geometry.Offset
+import androidx.compose.ui.graphics.Brush
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.Path
+import androidx.compose.ui.graphics.StrokeCap
+import androidx.compose.ui.graphics.StrokeJoin
+import androidx.compose.ui.graphics.drawscope.Stroke
+import androidx.compose.ui.graphics.vector.ImageVector
+import androidx.compose.ui.input.pointer.pointerInput
+import androidx.compose.ui.input.nestedscroll.NestedScrollConnection
+import androidx.compose.ui.input.nestedscroll.NestedScrollSource
+import androidx.compose.ui.input.nestedscroll.nestedScroll
+import androidx.compose.ui.platform.LocalContext
+import androidx.compose.ui.platform.LocalDensity
+import androidx.compose.ui.platform.testTag
+import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.semantics.Role
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.unit.dp
+import com.akslabs.circletosearch.R
+import com.akslabs.circletosearch.ui.components.BackgroundPreset
+import com.akslabs.circletosearch.ui.components.ExpressiveOnboardingScaffold
+import com.akslabs.circletosearch.ui.theme.M3ExpressiveShapes
+import com.akslabs.circletosearch.ui.theme.M3ExpressiveSpring
+import com.akslabs.circletosearch.ui.theme.m3ExpressivePress
+import com.akslabs.circletosearch.utils.PrivacyPreferences
+
+/**
+ * Circle to Search onboarding flow.
+ *
+ * Steps:
+ * - Warm welcome & introduction
+ * - Hold gesture bar to activate
+ * - Interactive gesture drawing canvas (finger lasso around search targets)
+ * - Instant translation & equation solving
+ * - Privacy & data transparency (must accept to finish)
+ */
+@Composable
+fun PixelCircleSearchOnboardingScreen(
+ onFinish: () -> Unit,
+ reducedMotion: Boolean = false,
+ modifier: Modifier = Modifier
+) {
+ var currentStep by remember { mutableStateOf(1) }
+ val totalSteps = 5
+ val context = LocalContext.current
+ val privacyPreferences = remember { PrivacyPreferences(context) }
+ var privacyAccepted by remember { mutableStateOf(privacyPreferences.hasAcceptedPrivacyPolicy()) }
+ val isLastStep = currentStep == totalSteps
+
+ ExpressiveOnboardingScaffold(
+ modifier = modifier.testTag("circle_search_onboarding_screen"),
+ backgroundPreset = BackgroundPreset.GeminiAura,
+ reducedMotion = reducedMotion,
+ totalSteps = totalSteps,
+ currentStep = currentStep,
+ onBackClick = {
+ if (currentStep > 1) currentStep-- else onFinish()
+ },
+ topActionIcon = null,
+ topActionDescription = null,
+ onTopActionClick = null,
+ secondaryActionText = if (currentStep > 1) "Back" else "Skip",
+ onSecondaryActionClick = {
+ if (currentStep > 1) currentStep-- else currentStep = totalSteps
+ },
+ primaryActionText = if (isLastStep) "Accept & Finish" else "Next",
+ primaryActionEnabled = !isLastStep || privacyAccepted,
+ onPrimaryActionClick = {
+ if (currentStep < totalSteps) {
+ currentStep++
+ } else {
+ privacyPreferences.setPrivacyAccepted()
+ onFinish()
+ }
+ }
+ ) {
+ AnimatedContent(
+ targetState = currentStep,
+ transitionSpec = {
+ (fadeIn() + scaleIn(initialScale = 0.94f, animationSpec = M3ExpressiveSpring.Bouncy)).togetherWith(
+ fadeOut() + scaleOut(targetScale = 0.94f)
+ )
+ },
+ label = "CircleSearchStepTransition"
+ ) { step ->
+ when (step) {
+ 1 -> CircleSearchWelcomeStep()
+ 2 -> CircleSearchActivateStep(reducedMotion = reducedMotion)
+ 3 -> CircleSearchInteractiveLassoStep(reducedMotion = reducedMotion)
+ 4 -> CircleSearchTranslateSolveStep(reducedMotion = reducedMotion)
+ else -> CircleSearchPrivacyStep(
+ accepted = privacyAccepted,
+ onAcceptChange = { privacyAccepted = it }
+ )
+ }
+ }
+ }
+}
+
+/**
+ * Step 1: Warm welcome and introduction.
+ */
+@Composable
+private fun CircleSearchWelcomeStep() {
+ Column(
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(bottom = 16.dp)
+ ) {
+ Text(
+ text = "Welcome to Circle to Search",
+ style = MaterialTheme.typography.headlineMedium.copy(fontWeight = FontWeight.Normal),
+ color = MaterialTheme.colorScheme.onBackground
+ )
+
+ Spacer(modifier = Modifier.height(8.dp))
+
+ Text(
+ text = "Search anything on your screen — text, images, QR codes — without switching apps. Free, open source, and no account needed.",
+ style = MaterialTheme.typography.bodyLarge,
+ color = MaterialTheme.colorScheme.onSurfaceVariant
+ )
+
+ Spacer(modifier = Modifier.height(16.dp))
+
+ Row(
+ horizontalArrangement = Arrangement.spacedBy(10.dp),
+ verticalAlignment = Alignment.CenterVertically
+ ) {
+ Surface(
+ shape = M3ExpressiveShapes.SlantedPill,
+ color = MaterialTheme.colorScheme.primary.copy(alpha = 0.12f)
+ ) {
+ Text(
+ text = "Free & Open Source",
+ style = MaterialTheme.typography.labelMedium.copy(fontWeight = FontWeight.Medium),
+ color = MaterialTheme.colorScheme.primary,
+ modifier = Modifier.padding(horizontal = 12.dp, vertical = 6.dp)
+ )
+ }
+
+ Surface(
+ shape = M3ExpressiveShapes.SlantedPill,
+ color = MaterialTheme.colorScheme.secondary.copy(alpha = 0.12f)
+ ) {
+ Text(
+ text = "No Account Needed",
+ style = MaterialTheme.typography.labelMedium.copy(fontWeight = FontWeight.Medium),
+ color = MaterialTheme.colorScheme.secondary,
+ modifier = Modifier.padding(horizontal = 12.dp, vertical = 6.dp)
+ )
+ }
+ }
+ }
+}
+
+/**
+ * Step 2: Hold gesture bar or home button to activate.
+ */
+@Composable
+private fun CircleSearchActivateStep(reducedMotion: Boolean) {
+ val infiniteTransition = rememberInfiniteTransition(label = "NeonPerimeterTransition")
+ val borderPhase by if (reducedMotion) {
+ remember { mutableStateOf(0f) }
+ } else {
+ infiniteTransition.animateFloat(
+ initialValue = 0f,
+ targetValue = 1f,
+ animationSpec = infiniteRepeatable(
+ animation = tween(durationMillis = 3200, easing = LinearEasing),
+ repeatMode = RepeatMode.Restart
+ ),
+ label = "BorderPhase"
+ )
+ }
+
+ val neonGlow = listOf(
+ Color(0xFF4285F4),
+ Color(0xFF9C27B0),
+ Color(0xFFEA4335),
+ Color(0xFFFBBC05),
+ Color(0xFF34A853),
+ Color(0xFF4285F4)
+ )
+
+ Column(
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(bottom = 16.dp)
+ ) {
+ Card(
+ shape = M3ExpressiveShapes.Arch,
+ colors = CardDefaults.cardColors(
+ containerColor = MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.55f)
+ ),
+ modifier = Modifier
+ .fillMaxWidth()
+ .height(280.dp)
+ .border(
+ width = 3.dp,
+ brush = Brush.sweepGradient(neonGlow),
+ shape = M3ExpressiveShapes.Arch
+ )
+ .testTag("circle_search_neon_frame")
+ ) {
+ Box(
+ modifier = Modifier
+ .fillMaxSize()
+ .padding(24.dp),
+ contentAlignment = Alignment.Center
+ ) {
+ Column(
+ horizontalAlignment = Alignment.CenterHorizontally,
+ verticalArrangement = Arrangement.Center
+ ) {
+ Surface(
+ shape = M3ExpressiveShapes.Clover4,
+ color = MaterialTheme.colorScheme.primaryContainer,
+ modifier = Modifier.size(72.dp)
+ ) {
+ Box(contentAlignment = Alignment.Center) {
+ Icon(
+ imageVector = Icons.Default.Gesture,
+ contentDescription = null,
+ tint = MaterialTheme.colorScheme.onPrimaryContainer,
+ modifier = Modifier.size(34.dp)
+ )
+ }
+ }
+
+ Spacer(modifier = Modifier.height(18.dp))
+
+ Text(
+ text = "Long-press the Gesture Bar",
+ style = MaterialTheme.typography.titleMedium.copy(fontWeight = FontWeight.SemiBold),
+ color = MaterialTheme.colorScheme.onSurface
+ )
+
+ Spacer(modifier = Modifier.height(8.dp))
+
+ Surface(
+ shape = RoundedCornerShape(12.dp),
+ color = MaterialTheme.colorScheme.primary,
+ modifier = Modifier
+ .width(96.dp)
+ .height(6.dp)
+ ) {}
+ }
+ }
+ }
+
+ Spacer(modifier = Modifier.height(24.dp))
+
+ Text(
+ text = "Start searching in one gesture",
+ style = MaterialTheme.typography.headlineMedium.copy(fontWeight = FontWeight.Normal),
+ color = MaterialTheme.colorScheme.onBackground
+ )
+
+ Spacer(modifier = Modifier.height(8.dp))
+
+ Text(
+ text = "Touch and hold the gesture handle or home button from any screen. No need to open or switch apps first.",
+ style = MaterialTheme.typography.bodyLarge,
+ color = MaterialTheme.colorScheme.onSurfaceVariant
+ )
+
+ Spacer(modifier = Modifier.height(16.dp))
+
+ Row(
+ horizontalArrangement = Arrangement.spacedBy(10.dp),
+ verticalAlignment = Alignment.CenterVertically
+ ) {
+ Surface(
+ shape = M3ExpressiveShapes.SlantedPill,
+ color = MaterialTheme.colorScheme.primary.copy(alpha = 0.12f)
+ ) {
+ Row(
+ modifier = Modifier.padding(horizontal = 12.dp, vertical = 6.dp),
+ verticalAlignment = Alignment.CenterVertically
+ ) {
+ Icon(
+ imageVector = Icons.Default.Gesture,
+ contentDescription = null,
+ tint = MaterialTheme.colorScheme.primary,
+ modifier = Modifier.size(16.dp)
+ )
+ Spacer(modifier = Modifier.width(6.dp))
+ Text(
+ text = "Zero App Switching",
+ style = MaterialTheme.typography.labelMedium.copy(fontWeight = FontWeight.Medium),
+ color = MaterialTheme.colorScheme.primary
+ )
+ }
+ }
+
+ Surface(
+ shape = M3ExpressiveShapes.SlantedPill,
+ color = MaterialTheme.colorScheme.secondary.copy(alpha = 0.12f)
+ ) {
+ Text(
+ text = "Works Everywhere",
+ style = MaterialTheme.typography.labelMedium.copy(fontWeight = FontWeight.Medium),
+ color = MaterialTheme.colorScheme.secondary,
+ modifier = Modifier.padding(horizontal = 12.dp, vertical = 6.dp)
+ )
+ }
+ }
+ }
+}
+
+/**
+ * Step 3: Interactive gesture lasso canvas where users drag finger to circle target.
+ */
+@Composable
+private fun CircleSearchInteractiveLassoStep(reducedMotion: Boolean) {
+ val strokePoints = remember { mutableStateListOf<Offset>() }
+ var hasCircled by remember { mutableStateOf(false) }
+ val resultCardScale = remember { Animatable(0.85f) }
+
+ LaunchedEffect(hasCircled) {
+ if (hasCircled) {
+ resultCardScale.animateTo(
+ targetValue = 1f,
+ animationSpec = M3ExpressiveSpring.Bouncy
+ )
+ }
+ }
+
+ Column(
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(bottom = 16.dp)
+ ) {
+ Card(
+ shape = RoundedCornerShape(24.dp),
+ colors = CardDefaults.cardColors(
+ containerColor = MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.45f)
+ ),
+ modifier = Modifier
+ .fillMaxWidth()
+ .height(280.dp)
+ .testTag("interactive_lasso_canvas_card")
+ ) {
+ Box(modifier = Modifier.fillMaxSize()) {
+ Column(
+ modifier = Modifier
+ .fillMaxSize()
+ .padding(16.dp),
+ horizontalAlignment = Alignment.CenterHorizontally,
+ verticalArrangement = Arrangement.Center
+ ) {
+ Surface(
+ shape = M3ExpressiveShapes.AsymmetricCard,
+ color = MaterialTheme.colorScheme.primaryContainer.copy(alpha = 0.8f),
+ modifier = Modifier.size(90.dp)
+ ) {
+ Box(contentAlignment = Alignment.Center) {
+ Icon(
+ imageVector = Icons.Default.ShoppingBag,
+ contentDescription = null,
+ tint = MaterialTheme.colorScheme.onPrimaryContainer,
+ modifier = Modifier.size(42.dp)
+ )
+ }
+ }
+
+ Spacer(modifier = Modifier.height(12.dp))
+
+ Text(
+ text = if (!hasCircled) "Draw a circle around this item" else "Item Identified!",
+ style = MaterialTheme.typography.titleSmall.copy(fontWeight = FontWeight.SemiBold),
+ color = MaterialTheme.colorScheme.onSurface
+ )
+ }
+
+ val strokeColor = MaterialTheme.colorScheme.primary
+ Canvas(
+ modifier = Modifier
+ .fillMaxSize()
+ .pointerInput(Unit) {
+ detectDragGestures(
+ onDragStart = { startOffset ->
+ strokePoints.clear()
+ strokePoints.add(startOffset)
+ hasCircled = false
+ },
+ onDrag = { change, _ ->
+ change.consume()
+ strokePoints.add(change.position)
+ if (strokePoints.size > 25) {
+ hasCircled = true
+ }
+ },
+ onDragEnd = {
+ if (strokePoints.size > 15) {
+ hasCircled = true
+ }
+ }
+ )
+ }
+ ) {
+ if (strokePoints.size > 1) {
+ val lassoPath = Path()
+ lassoPath.moveTo(strokePoints.first().x, strokePoints.first().y)
+ for (pt in strokePoints) {
+ lassoPath.lineTo(pt.x, pt.y)
+ }
+ drawPath(
+ path = lassoPath,
+ color = strokeColor,
+ style = Stroke(width = 3.5.dp.toPx(), cap = StrokeCap.Round, join = StrokeJoin.Round)
+ )
+ }
+ }
+
+ androidx.compose.animation.AnimatedVisibility(
+ visible = hasCircled,
+ enter = fadeIn() + scaleIn(initialScale = 0.8f, animationSpec = M3ExpressiveSpring.Bouncy),
+ modifier = Modifier
+ .align(Alignment.BottomCenter)
+ .padding(12.dp)
+ ) {
+ Surface(
+ shape = RoundedCornerShape(16.dp),
+ color = MaterialTheme.colorScheme.surface,
+ shadowElevation = 6.dp,
+ modifier = Modifier.fillMaxWidth()
+ ) {
+ Row(
+ modifier = Modifier.padding(12.dp),
+ verticalAlignment = Alignment.CenterVertically
+ ) {
+ Surface(
+ shape = CircleShape,
+ color = MaterialTheme.colorScheme.primary,
+ modifier = Modifier.size(36.dp)
+ ) {
+ Icon(
+ imageVector = Icons.Default.Check,
+ contentDescription = null,
+ tint = MaterialTheme.colorScheme.onPrimary,
+ modifier = Modifier.padding(8.dp)
+ )
+ }
+ Spacer(modifier = Modifier.width(12.dp))
+ Column {
+ Text(
+ text = "Visual Search Result",
+ style = MaterialTheme.typography.labelLarge.copy(fontWeight = FontWeight.Bold),
+ color = MaterialTheme.colorScheme.onSurface
+ )
+ Text(
+ text = "Retro Leather Duffle • Available nearby",
+ style = MaterialTheme.typography.bodySmall,
+ color = MaterialTheme.colorScheme.onSurfaceVariant
+ )
+ }
+ }
+ }
+ }
+ }
+ }
+
+ Spacer(modifier = Modifier.height(24.dp))
+
+ Text(
+ text = "Circle, scribble, or tap",
+ style = MaterialTheme.typography.headlineMedium.copy(fontWeight = FontWeight.Normal),
+ color = MaterialTheme.colorScheme.onBackground
+ )
+
+ Spacer(modifier = Modifier.height(8.dp))
+
+ Text(
+ text = "Draw a circle with your finger around anything you want to know more about: clothes, shoes, landmarks, or formulas. Try it above!",
+ style = MaterialTheme.typography.bodyLarge,
+ color = MaterialTheme.colorScheme.onSurfaceVariant
+ )
+ }
+}
+
+/**
+ * Step 4: Instant text translation & math equation solving.
+ */
+@Composable
+private fun CircleSearchTranslateSolveStep(reducedMotion: Boolean) {
+ var activeMode by remember { mutableStateOf(0) }
+
+ Column(
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(bottom = 16.dp)
+ ) {
+ Card(
+ shape = M3ExpressiveShapes.AsymmetricCard,
+ colors = CardDefaults.cardColors(
+ containerColor = MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.55f)
+ ),
+ modifier = Modifier
+ .fillMaxWidth()
+ .height(280.dp)
+ ) {
+ Column(
+ modifier = Modifier
+ .fillMaxSize()
+ .padding(20.dp),
+ verticalArrangement = Arrangement.SpaceBetween
+ ) {
+ Row(
+ horizontalArrangement = Arrangement.spacedBy(8.dp),
+ modifier = Modifier.fillMaxWidth()
+ ) {
+ Surface(
+ shape = M3ExpressiveShapes.SlantedPill,
+ color = if (activeMode == 0) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.surface,
+ modifier = Modifier
+ .weight(1f)
+ .m3ExpressivePress { activeMode = 0 }
+ .testTag("mode_translate_pill")
+ ) {
+ Row(
+ modifier = Modifier.padding(vertical = 8.dp),
+ horizontalArrangement = Arrangement.Center,
+ verticalAlignment = Alignment.CenterVertically
+ ) {
+ Icon(
+ imageVector = Icons.Default.Translate,
+ contentDescription = null,
+ tint = if (activeMode == 0) MaterialTheme.colorScheme.onPrimary else MaterialTheme.colorScheme.onSurface,
+ modifier = Modifier.size(16.dp)
+ )
+ Spacer(modifier = Modifier.width(6.dp))
+ Text(
+ text = "Translate",
+ style = MaterialTheme.typography.labelMedium.copy(fontWeight = FontWeight.SemiBold),
+ color = if (activeMode == 0) MaterialTheme.colorScheme.onPrimary else MaterialTheme.colorScheme.onSurface
+ )
+ }
+ }
+
+ Surface(
+ shape = M3ExpressiveShapes.SlantedPill,
+ color = if (activeMode == 1) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.surface,
+ modifier = Modifier
+ .weight(1f)
+ .m3ExpressivePress { activeMode = 1 }
+ .testTag("mode_math_pill")
+ ) {
+ Row(
+ modifier = Modifier.padding(vertical = 8.dp),
+ horizontalArrangement = Arrangement.Center,
+ verticalAlignment = Alignment.CenterVertically
+ ) {
+ Icon(
+ imageVector = Icons.Default.Calculate,
+ contentDescription = null,
+ tint = if (activeMode == 1) MaterialTheme.colorScheme.onPrimary else MaterialTheme.colorScheme.onSurface,
+ modifier = Modifier.size(16.dp)
+ )
+ Spacer(modifier = Modifier.width(6.dp))
+ Text(
+ text = "Solve Math",
+ style = MaterialTheme.typography.labelMedium.copy(fontWeight = FontWeight.SemiBold),
+ color = if (activeMode == 1) MaterialTheme.colorScheme.onPrimary else MaterialTheme.colorScheme.onSurface
+ )
+ }
+ }
+ }
+
+ AnimatedContent(
+ targetState = activeMode,
+ transitionSpec = {
+ (fadeIn() + scaleIn(initialScale = 0.95f, animationSpec = M3ExpressiveSpring.Snappy)).togetherWith(
+ fadeOut() + scaleOut(targetScale = 0.95f)
+ )
+ },
+ label = "ModeContentTransition"
+ ) { mode ->
+ if (mode == 0) {
+ Column(horizontalAlignment = Alignment.CenterHorizontally) {
+ Surface(
+ shape = RoundedCornerShape(16.dp),
+ color = MaterialTheme.colorScheme.surface,
+ modifier = Modifier.fillMaxWidth()
+ ) {
+ Column(modifier = Modifier.padding(14.dp)) {
+ Text(
+ text = "Original text: Bonjour le monde!",
+ style = MaterialTheme.typography.bodySmall,
+ color = MaterialTheme.colorScheme.onSurfaceVariant
+ )
+ Spacer(modifier = Modifier.height(4.dp))
+ Text(
+ text = "Translated: Hello world!",
+ style = MaterialTheme.typography.titleMedium.copy(fontWeight = FontWeight.Bold),
+ color = MaterialTheme.colorScheme.primary
+ )
+ }
+ }
+ }
+ } else {
+ Column(horizontalAlignment = Alignment.CenterHorizontally) {
+ Surface(
+ shape = RoundedCornerShape(16.dp),
+ color = MaterialTheme.colorScheme.surface,
+ modifier = Modifier.fillMaxWidth()
+ ) {
+ Column(modifier = Modifier.padding(14.dp)) {
+ Text(
+ text = "Equation: ∫ 2x dx",
+ style = MaterialTheme.typography.bodySmall,
+ color = MaterialTheme.colorScheme.onSurfaceVariant
+ )
+ Spacer(modifier = Modifier.height(4.dp))
+ Text(
+ text = "Step-by-step Solution: x² + C",
+ style = MaterialTheme.typography.titleMedium.copy(fontWeight = FontWeight.Bold),
+ color = MaterialTheme.colorScheme.tertiary
+ )
+ }
+ }
+ }
+ }
+ }
+
+ Row(verticalAlignment = Alignment.CenterVertically) {
+ Icon(
+ imageVector = Icons.Default.ImageSearch,
+ contentDescription = null,
+ tint = MaterialTheme.colorScheme.primary,
+ modifier = Modifier.size(16.dp)
+ )
+ Spacer(modifier = Modifier.width(6.dp))
+ Text(
+ text = "Multi-search: add text to refine image results",
+ style = MaterialTheme.typography.labelSmall,
+ color = MaterialTheme.colorScheme.onSurfaceVariant
+ )
+ }
+ }
+ }
+
+ Spacer(modifier = Modifier.height(24.dp))
+
+ Text(
+ text = "Translate & Solve Instantly",
+ style = MaterialTheme.typography.headlineMedium.copy(fontWeight = FontWeight.Normal),
+ color = MaterialTheme.colorScheme.onBackground
+ )
+
+ Spacer(modifier = Modifier.height(8.dp))
+
+ Text(
+ text = "Circle foreign menus, street signs, or tricky math problems to get live translations and step-by-step explanations.",
+ style = MaterialTheme.typography.bodyLarge,
+ color = MaterialTheme.colorScheme.onSurfaceVariant
+ )
+ }
+}
+
+/**
+ * Step 5: Full privacy & data transparency from the dialog,
+ * restyled in the same expressive language. Scrollable so nothing is lost.
+ * The finish button stays disabled until the user ticks the accept row.
+ */
+@Composable
+private fun CircleSearchPrivacyStep(
+ accepted: Boolean,
+ onAcceptChange: (Boolean) -> Unit
+) {
+ BoxWithConstraints(
+ modifier = Modifier
+ .fillMaxSize()
+ .padding(bottom = 16.dp),
+ contentAlignment = Alignment.BottomStart
+ ) {
+ val density = LocalDensity.current
+ val collapsedMaxPx = with(density) { (maxHeight * 0.52f).toPx() }
+ val fullMaxPx = with(density) { maxHeight.toPx() }
+ var expandPx by remember { mutableFloatStateOf(0f) }
+ val privacyScroll = rememberScrollState()
+ val expandConnection = remember(collapsedMaxPx, fullMaxPx) {
+ object : NestedScrollConnection {
+ override fun onPreScroll(available: Offset, source: NestedScrollSource): Offset {
+ val dy = available.y
+ val maxExpand = fullMaxPx - collapsedMaxPx
+ if (dy < 0f && expandPx < maxExpand) {
+ val take = minOf(-dy, maxExpand - expandPx)
+ expandPx += take
+ return Offset(0f, -take)
+ }
+ if (dy > 0f && expandPx > 0f && privacyScroll.value == 0) {
+ val take = minOf(dy, expandPx)
+ expandPx -= take
+ return Offset(0f, take)
+ }
+ return Offset.Zero
+ }
+ }
+ }
+ Column(
+ modifier = Modifier
+ .fillMaxWidth()
+ .heightIn(max = with(density) { (collapsedMaxPx + expandPx).toDp() })
+ .background(
+ color = MaterialTheme.colorScheme.background,
+ shape = RoundedCornerShape(24.dp)
+ )
+ .nestedScroll(expandConnection)
+ .verticalScroll(privacyScroll)
+ .padding(16.dp)
+ .testTag("circle_search_privacy_card"),
+ verticalArrangement = Arrangement.spacedBy(12.dp)
+ ) {
+ Row(
+ verticalAlignment = Alignment.CenterVertically,
+ horizontalArrangement = Arrangement.spacedBy(12.dp)
+ ) {
+ Surface(
+ shape = M3ExpressiveShapes.Clover4,
+ color = MaterialTheme.colorScheme.primaryContainer,
+ modifier = Modifier.size(48.dp)
+ ) {
+ Box(contentAlignment = Alignment.Center) {
+ Icon(
+ imageVector = Icons.Default.Shield,
+ contentDescription = null,
+ tint = MaterialTheme.colorScheme.onPrimaryContainer,
+ modifier = Modifier.size(24.dp)
+ )
+ }
+ }
+ Text(
+ text = stringResource(R.string.title_privacy),
+ style = MaterialTheme.typography.headlineSmall.copy(fontWeight = FontWeight.SemiBold),
+ color = MaterialTheme.colorScheme.onBackground
+ )
+ }
+
+ PrivacyBullet(
+ icon = Icons.Default.CloudUpload,
+ title = stringResource(R.string.privacy_q_upload),
+ body = stringResource(R.string.privacy_a_upload)
+ )
+ PrivacyBullet(
+ icon = Icons.Default.Info,
+ title = stringResource(R.string.privacy_q_why_upload),
+ body = stringResource(R.string.privacy_a_why_upload)
+ )
+ PrivacyBullet(
+ icon = Icons.Default.Info,
+ title = stringResource(R.string.privacy_q_safe),
+ body = stringResource(R.string.privacy_a_safe),
+ isWarning = true
+ )
+ PrivacyBullet(
+ icon = Icons.Default.Warning,
+ title = stringResource(R.string.privacy_q_personal),
+ body = stringResource(R.string.privacy_a_personal),
+ isWarning = true
+ )
+ PrivacyBullet(
+ icon = Icons.Default.CheckCircle,
+ title = stringResource(R.string.privacy_q_store),
+ body = stringResource(R.string.privacy_a_store),
+ isPositive = true
+ )
+ PrivacyBullet(
+ icon = Icons.Default.CheckCircle,
+ title = stringResource(R.string.privacy_q_developer),
+ body = stringResource(R.string.privacy_a_developer),
+ isPositive = true
+ )
+
+ Surface(
+ shape = RoundedCornerShape(16.dp),
+ color = MaterialTheme.colorScheme.errorContainer.copy(alpha = 0.3f),
+ modifier = Modifier.fillMaxWidth()
+ ) {
+ Column(modifier = Modifier.padding(12.dp)) {
+ Text(
+ text = stringResource(R.string.privacy_reminder_title),
+ style = MaterialTheme.typography.titleSmall,
+ fontWeight = FontWeight.Bold,
+ color = MaterialTheme.colorScheme.error
+ )
+ Spacer(modifier = Modifier.height(8.dp))
+ Text(
+ text = stringResource(R.string.privacy_reminder_body),
+ style = MaterialTheme.typography.bodySmall,
+ color = MaterialTheme.colorScheme.onSurface
+ )
+ }
+ }
+
+ Surface(
+ shape = M3ExpressiveShapes.SlantedPill,
+ color = if (accepted) MaterialTheme.colorScheme.primary.copy(alpha = 0.14f)
+ else MaterialTheme.colorScheme.surfaceVariant,
+ modifier = Modifier
+ .fillMaxWidth()
+ .clickable(
+ role = Role.Checkbox,
+ onClick = { onAcceptChange(!accepted) }
+ )
+ .testTag("privacy_accept_row")
+ ) {
+ Row(
+ modifier = Modifier.padding(horizontal = 14.dp, vertical = 12.dp),
+ verticalAlignment = Alignment.CenterVertically
+ ) {
+ Surface(
+ shape = CircleShape,
+ color = if (accepted) MaterialTheme.colorScheme.primary
+ else MaterialTheme.colorScheme.outline.copy(alpha = 0.4f),
+ modifier = Modifier.size(24.dp)
+ ) {
+ if (accepted) {
+ Icon(
+ imageVector = Icons.Default.Check,
+ contentDescription = null,
+ tint = MaterialTheme.colorScheme.onPrimary,
+ modifier = Modifier.padding(5.dp)
+ )
+ }
+ }
+ Spacer(modifier = Modifier.width(12.dp))
+ Text(
+ text = "I understand how my data is handled",
+ style = MaterialTheme.typography.labelLarge.copy(fontWeight = FontWeight.Medium),
+ color = MaterialTheme.colorScheme.onSurface
+ )
+ }
+ }
+ }
+ }
+}
+
+@Composable
+private fun PrivacyBullet(
+ icon: ImageVector,
+ title: String,
+ body: String,
+ isWarning: Boolean = false,
+ isPositive: Boolean = false
+) {
+ Surface(
+ shape = RoundedCornerShape(16.dp),
+ color = when {
+ isWarning -> MaterialTheme.colorScheme.errorContainer.copy(alpha = 0.2f)
+ isPositive -> MaterialTheme.colorScheme.primaryContainer.copy(alpha = 0.2f)
+ else -> MaterialTheme.colorScheme.surface
+ },
+ modifier = Modifier.fillMaxWidth()
+ ) {
+ Row(
+ modifier = Modifier.padding(12.dp),
+ verticalAlignment = Alignment.Top
+ ) {
+ Icon(
+ imageVector = icon,
+ contentDescription = null,
+ tint = when {
+ isWarning -> MaterialTheme.colorScheme.error
+ isPositive -> MaterialTheme.colorScheme.primary
+ else -> MaterialTheme.colorScheme.onSurfaceVariant
+ },
+ modifier = Modifier.size(20.dp)
+ )
+ Spacer(modifier = Modifier.width(10.dp))
+ Column {
+ Text(
+ text = title,
+ style = MaterialTheme.typography.labelLarge.copy(fontWeight = FontWeight.Bold),
+ color = MaterialTheme.colorScheme.onSurface
+ )
+ Spacer(modifier = Modifier.height(2.dp))
+ Text(
+ text = body,
+ style = MaterialTheme.typography.bodySmall,
+ color = MaterialTheme.colorScheme.onSurfaceVariant
+ )
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/akslabs/circletosearch/ui/components/ExpressiveOnboardingBackground.kt b/app/src/main/java/com/akslabs/circletosearch/ui/components/ExpressiveOnboardingBackground.kt
new file mode 100644
index 0000000..d7442d7
--- /dev/null
+++ b/app/src/main/java/com/akslabs/circletosearch/ui/components/ExpressiveOnboardingBackground.kt
@@ -0,0 +1,1101 @@
+package com.akslabs.circletosearch.ui.components
+
+import androidx.compose.animation.core.FastOutSlowInEasing
+import androidx.compose.animation.core.LinearEasing
+import androidx.compose.animation.core.RepeatMode
+import androidx.compose.animation.core.animateFloat
+import androidx.compose.animation.core.infiniteRepeatable
+import androidx.compose.animation.core.rememberInfiniteTransition
+import androidx.compose.animation.core.tween
+import androidx.compose.foundation.Canvas
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.remember
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.geometry.Offset
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.Path
+import androidx.compose.ui.graphics.StrokeCap
+import androidx.compose.ui.graphics.drawscope.DrawScope
+import androidx.compose.ui.graphics.drawscope.Stroke
+import androidx.compose.ui.unit.dp
+import kotlin.math.PI
+import kotlin.math.cos
+import kotlin.math.sin
+
+/**
+ * Background presets representing different Google Pixel system & application onboarding aesthetics.
+ */
+enum class BackgroundPreset {
+ PixelSetup, // Classic Pixel Setup with organic wavy scallop loop & sweeping orchid arcs
+ GeminiAura, // Creative AI with morphing 4-point organic spark curves and fluid rings
+ EcosystemOrbit, // Connected devices with orbital elliptical contours and harmonic radar waves
+ MindfulWaves, // Digital Wellbeing with calm breathing ribbons and soothing organic ripples
+ CameraMagic, // Pixel Pro Camera with iris aperture blades and floating bokeh rings
+ TitanSecurity, // Titan M2 Hardware Security with hexagonal lattice and shield radar pulses
+ AuroraFlow, // Flowing celestial ribbon curtains with undulating harmonic waves
+ CosmicPulse, // Starlit satellite orbits and planetary alignment rings
+ CircleSearch, // Google Circle to Search holographic neon contour rings & lasso aura
+ PasskeysWallet, // Google Wallet & Passkeys FIDO2 biometric waves & card outlines
+ AdaptiveBattery, // Android 15 Adaptive Energy flow & charging wattage curve
+ FilledOrganicBlobs // Organic pastel filled blobs, butter yellow & coral waves, and floating droplet bubbles inspired by AKS Labs
+}
+
+/**
+ * Reusable animated expressive background inspired by Google Pixel system UI and Material 3 Expressive.
+ *
+ * Renders organic vector geometry programmatically via Canvas with ultra-smooth, subtle drifting
+ * and morphing motion. Allocations inside the draw loop are minimized.
+ */
+@Composable
+fun ExpressiveOnboardingBackground(
+ modifier: Modifier = Modifier,
+ preset: BackgroundPreset = BackgroundPreset.PixelSetup,
+ reducedMotion: Boolean = false,
+ customPrimaryColor: Color? = null,
+ customSecondaryColor: Color? = null,
+) {
+ val colorScheme = MaterialTheme.colorScheme
+ val isDark = colorScheme.background.red < 0.5f
+
+ // Colors derived gracefully from Material 3 colorScheme
+ val primaryStroke = customPrimaryColor ?: if (isDark) {
+ colorScheme.primary.copy(alpha = 0.85f)
+ } else {
+ colorScheme.primary.copy(alpha = 0.65f)
+ }
+
+ val secondaryStroke = customSecondaryColor ?: if (isDark) {
+ colorScheme.tertiary.copy(alpha = 0.75f)
+ } else {
+ colorScheme.tertiary.copy(alpha = 0.55f)
+ }
+
+ val subtleAccent = if (isDark) {
+ colorScheme.secondary.copy(alpha = 0.35f)
+ } else {
+ colorScheme.secondary.copy(alpha = 0.25f)
+ }
+
+ // Infinite transitions for subtle, calm, non-distracting organic breathing
+ val transition = rememberInfiniteTransition(label = "BackgroundMotion")
+
+ val driftPhase by if (reducedMotion) {
+ remember { androidx.compose.runtime.mutableFloatStateOf(0f) }
+ } else {
+ transition.animateFloat(
+ initialValue = 0f,
+ targetValue = (2 * PI).toFloat(),
+ animationSpec = infiniteRepeatable(
+ animation = tween(durationMillis = 18000, easing = LinearEasing),
+ repeatMode = RepeatMode.Restart
+ ),
+ label = "DriftPhase"
+ )
+ }
+
+ val morphProgress by if (reducedMotion) {
+ remember { androidx.compose.runtime.mutableFloatStateOf(0.5f) }
+ } else {
+ transition.animateFloat(
+ initialValue = 0f,
+ targetValue = 1f,
+ animationSpec = infiniteRepeatable(
+ animation = tween(durationMillis = 10000, easing = FastOutSlowInEasing),
+ repeatMode = RepeatMode.Reverse
+ ),
+ label = "MorphProgress"
+ )
+ }
+
+ val secondaryDrift by if (reducedMotion) {
+ remember { androidx.compose.runtime.mutableFloatStateOf(0f) }
+ } else {
+ transition.animateFloat(
+ initialValue = 0f,
+ targetValue = (2 * PI).toFloat(),
+ animationSpec = infiniteRepeatable(
+ animation = tween(durationMillis = 24000, easing = LinearEasing),
+ repeatMode = RepeatMode.Restart
+ ),
+ label = "SecondaryDrift"
+ )
+ }
+
+ Canvas(
+ modifier = modifier.fillMaxSize()
+ ) {
+ val width = size.width
+ val height = size.height
+
+ when (preset) {
+ BackgroundPreset.PixelSetup -> {
+ drawPixelSetupBackground(
+ width = width,
+ height = height,
+ driftPhase = driftPhase,
+ morphProgress = morphProgress,
+ secondaryDrift = secondaryDrift,
+ primaryColor = primaryStroke,
+ secondaryColor = secondaryStroke,
+ accentColor = subtleAccent
+ )
+ }
+ BackgroundPreset.GeminiAura -> {
+ drawGeminiAuraBackground(
+ width = width,
+ height = height,
+ driftPhase = driftPhase,
+ morphProgress = morphProgress,
+ primaryColor = primaryStroke,
+ secondaryColor = secondaryStroke,
+ accentColor = subtleAccent
+ )
+ }
+ BackgroundPreset.EcosystemOrbit -> {
+ drawEcosystemOrbitBackground(
+ width = width,
+ height = height,
+ driftPhase = driftPhase,
+ morphProgress = morphProgress,
+ primaryColor = primaryStroke,
+ secondaryColor = secondaryStroke,
+ accentColor = subtleAccent
+ )
+ }
+ BackgroundPreset.MindfulWaves -> {
+ drawMindfulWavesBackground(
+ width = width,
+ height = height,
+ driftPhase = driftPhase,
+ morphProgress = morphProgress,
+ primaryColor = primaryStroke,
+ secondaryColor = secondaryStroke,
+ accentColor = subtleAccent
+ )
+ }
+ BackgroundPreset.CameraMagic -> {
+ drawCameraMagicBackground(
+ width = width,
+ height = height,
+ driftPhase = driftPhase,
+ morphProgress = morphProgress,
+ primaryColor = primaryStroke,
+ secondaryColor = secondaryStroke,
+ accentColor = subtleAccent
+ )
+ }
+ BackgroundPreset.TitanSecurity -> {
+ drawTitanSecurityBackground(
+ width = width,
+ height = height,
+ driftPhase = driftPhase,
+ morphProgress = morphProgress,
+ primaryColor = primaryStroke,
+ secondaryColor = secondaryStroke,
+ accentColor = subtleAccent
+ )
+ }
+ BackgroundPreset.AuroraFlow -> {
+ drawAuroraFlowBackground(
+ width = width,
+ height = height,
+ driftPhase = driftPhase,
+ morphProgress = morphProgress,
+ primaryColor = primaryStroke,
+ secondaryColor = secondaryStroke,
+ accentColor = subtleAccent
+ )
+ }
+ BackgroundPreset.CosmicPulse -> {
+ drawCosmicPulseBackground(
+ width = width,
+ height = height,
+ driftPhase = driftPhase,
+ morphProgress = morphProgress,
+ primaryColor = primaryStroke,
+ secondaryColor = secondaryStroke,
+ accentColor = subtleAccent
+ )
+ }
+ BackgroundPreset.CircleSearch -> {
+ drawCircleSearchBackground(
+ width = width,
+ height = height,
+ driftPhase = driftPhase,
+ morphProgress = morphProgress,
+ primaryColor = primaryStroke,
+ secondaryColor = secondaryStroke,
+ accentColor = subtleAccent
+ )
+ }
+ BackgroundPreset.PasskeysWallet -> {
+ drawPasskeysWalletBackground(
+ width = width,
+ height = height,
+ driftPhase = driftPhase,
+ morphProgress = morphProgress,
+ primaryColor = primaryStroke,
+ secondaryColor = secondaryStroke,
+ accentColor = subtleAccent
+ )
+ }
+ BackgroundPreset.AdaptiveBattery -> {
+ drawAdaptiveBatteryBackground(
+ width = width,
+ height = height,
+ driftPhase = driftPhase,
+ morphProgress = morphProgress,
+ primaryColor = primaryStroke,
+ secondaryColor = secondaryStroke,
+ accentColor = subtleAccent
+ )
+ }
+ BackgroundPreset.FilledOrganicBlobs -> {
+ drawFilledOrganicBlobsBackground(
+ width = width,
+ height = height,
+ driftPhase = driftPhase,
+ morphProgress = morphProgress,
+ secondaryDrift = secondaryDrift,
+ primaryColor = primaryStroke,
+ secondaryColor = secondaryStroke,
+ accentColor = subtleAccent
+ )
+ }
+ }
+ }
+}
+
+/**
+ * Pixel Setup signature composition.
+ */
+private fun DrawScope.drawPixelSetupBackground(
+ width: Float,
+ height: Float,
+ driftPhase: Float,
+ morphProgress: Float,
+ secondaryDrift: Float,
+ primaryColor: Color,
+ secondaryColor: Color,
+ accentColor: Color
+) {
+ val centerX = width * (0.68f + 0.03f * sin(driftPhase))
+ val centerY = -height * 0.05f + (height * 0.02f * cos(driftPhase))
+ val baseRadius = width * (0.42f + 0.03f * morphProgress)
+ val waveCount = 14
+ val waveAmplitude = width * (0.042f + 0.012f * sin(driftPhase * 1.5f))
+
+ val scallopPath = Path()
+ val numSteps = 120
+ for (i in 0..numSteps) {
+ val angle = (i.toFloat() / numSteps) * 2f * PI.toFloat()
+ val radiusMod = baseRadius + waveAmplitude * sin(angle * waveCount + driftPhase * 0.7f)
+ val x = centerX + radiusMod * cos(angle)
+ val y = centerY + radiusMod * sin(angle)
+ if (i == 0) scallopPath.moveTo(x, y) else scallopPath.lineTo(x, y)
+ }
+ scallopPath.close()
+
+ drawPath(
+ path = scallopPath,
+ color = primaryColor,
+ style = Stroke(width = 2.4.dp.toPx(), cap = StrokeCap.Round)
+ )
+
+ val sweepPath = Path()
+ val startX = -width * 0.15f
+ val startY = height * (0.36f + 0.02f * sin(secondaryDrift))
+ val control1X = width * (0.35f + 0.04f * cos(secondaryDrift))
+ val control1Y = height * (0.33f + 0.03f * sin(secondaryDrift * 0.8f))
+ val control2X = width * (0.75f + 0.03f * sin(driftPhase))
+ val control2Y = height * (0.46f + 0.02f * cos(driftPhase))
+ val endX = width * 1.25f
+ val endY = height * (0.62f + 0.03f * sin(driftPhase))
+
+ sweepPath.moveTo(startX, startY)
+ sweepPath.cubicTo(control1X, control1Y, control2X, control2Y, endX, endY)
+
+ drawPath(
+ path = sweepPath,
+ color = secondaryColor,
+ style = Stroke(width = 2.0.dp.toPx(), cap = StrokeCap.Round)
+ )
+
+ val bottomArcPath = Path()
+ val bStartX = -width * 0.2f
+ val bStartY = height * (0.82f + 0.02f * cos(driftPhase))
+ val bCtrl1X = width * (0.28f + 0.03f * sin(secondaryDrift))
+ val bCtrl1Y = height * (0.94f + 0.02f * morphProgress)
+ val bCtrl2X = width * (0.65f + 0.03f * cos(driftPhase * 0.9f))
+ val bCtrl2Y = height * (0.96f - 0.02f * morphProgress)
+ val bEndX = width * 1.15f
+ val bEndY = height * (0.78f + 0.02f * sin(secondaryDrift))
+
+ bottomArcPath.moveTo(bStartX, bStartY)
+ bottomArcPath.cubicTo(bCtrl1X, bCtrl1Y, bCtrl2X, bCtrl2Y, bEndX, bEndY)
+
+ drawPath(
+ path = bottomArcPath,
+ color = secondaryColor.copy(alpha = secondaryColor.alpha * 0.8f),
+ style = Stroke(width = 1.8.dp.toPx(), cap = StrokeCap.Round)
+ )
+
+ val filamentPath = Path()
+ filamentPath.moveTo(-width * 0.05f, height * 0.08f)
+ filamentPath.quadraticTo(
+ width * (0.12f + 0.02f * sin(driftPhase)),
+ height * (0.16f + 0.02f * cos(driftPhase)),
+ width * 0.04f,
+ height * 0.26f
+ )
+
+ drawPath(
+ path = filamentPath,
+ color = accentColor,
+ style = Stroke(width = 1.4.dp.toPx(), cap = StrokeCap.Round)
+ )
+}
+
+/**
+ * Creative Gemini Aura background with morphing 4-point organic fluid curves.
+ */
+private fun DrawScope.drawGeminiAuraBackground(
+ width: Float,
+ height: Float,
+ driftPhase: Float,
+ morphProgress: Float,
+ primaryColor: Color,
+ secondaryColor: Color,
+ accentColor: Color
+) {
+ val centerX = width * (0.52f + 0.03f * sin(driftPhase * 0.8f))
+ val centerY = height * (0.28f + 0.02f * cos(driftPhase * 0.6f))
+ val maxRadius = width * (0.48f + 0.04f * morphProgress)
+ val minRadius = width * (0.22f + 0.03f * (1f - morphProgress))
+
+ val starPath = Path()
+ val points = 80
+ for (i in 0..points) {
+ val angle = (i.toFloat() / points) * 2f * PI.toFloat()
+ val r = minRadius + (maxRadius - minRadius) * (0.5f + 0.5f * cos(angle * 4f + driftPhase))
+ val x = centerX + r * cos(angle)
+ val y = centerY + r * sin(angle)
+ if (i == 0) starPath.moveTo(x, y) else starPath.lineTo(x, y)
+ }
+ starPath.close()
+
+ drawPath(
+ path = starPath,
+ color = primaryColor,
+ style = Stroke(width = 2.2.dp.toPx(), cap = StrokeCap.Round)
+ )
+
+ val outerAura = Path()
+ val outerRadius = width * (0.65f + 0.03f * sin(driftPhase))
+ for (i in 0..60) {
+ val angle = (i.toFloat() / 60) * 2f * PI.toFloat()
+ val r = outerRadius + (width * 0.05f * sin(angle * 3f - driftPhase))
+ val x = centerX + r * cos(angle)
+ val y = centerY + r * sin(angle)
+ if (i == 0) outerAura.moveTo(x, y) else outerAura.lineTo(x, y)
+ }
+ outerAura.close()
+
+ drawPath(
+ path = outerAura,
+ color = secondaryColor,
+ style = Stroke(width = 1.6.dp.toPx(), cap = StrokeCap.Round)
+ )
+
+ val streamPath = Path()
+ streamPath.moveTo(-width * 0.1f, height * 0.72f)
+ streamPath.cubicTo(
+ width * 0.3f, height * (0.68f + 0.03f * cos(driftPhase)),
+ width * 0.7f, height * (0.82f - 0.03f * sin(driftPhase)),
+ width * 1.15f, height * 0.76f
+ )
+ drawPath(
+ path = streamPath,
+ color = accentColor,
+ style = Stroke(width = 1.8.dp.toPx(), cap = StrokeCap.Round)
+ )
+}
+
+/**
+ * Ecosystem & Watch orbital background with concentric elliptical contours.
+ */
+private fun DrawScope.drawEcosystemOrbitBackground(
+ width: Float,
+ height: Float,
+ driftPhase: Float,
+ morphProgress: Float,
+ primaryColor: Color,
+ secondaryColor: Color,
+ accentColor: Color
+) {
+ val centerX = width * 0.75f
+ val centerY = height * 0.22f
+
+ val rx1 = width * (0.55f + 0.02f * sin(driftPhase))
+ val ry1 = height * (0.24f + 0.015f * cos(driftPhase))
+ val angleOffset = driftPhase * 0.1f
+
+ val orbit1 = Path()
+ for (i in 0..72) {
+ val theta = (i.toFloat() / 72) * 2f * PI.toFloat()
+ val unrotatedX = rx1 * cos(theta)
+ val unrotatedY = ry1 * sin(theta)
+ val rot = 0.35f + angleOffset
+ val x = centerX + (unrotatedX * cos(rot) - unrotatedY * sin(rot))
+ val y = centerY + (unrotatedX * sin(rot) + unrotatedY * cos(rot))
+ if (i == 0) orbit1.moveTo(x, y) else orbit1.lineTo(x, y)
+ }
+ orbit1.close()
+
+ drawPath(
+ path = orbit1,
+ color = primaryColor,
+ style = Stroke(width = 2.0.dp.toPx(), cap = StrokeCap.Round)
+ )
+
+ val rx2 = width * (0.85f + 0.03f * cos(driftPhase))
+ val ry2 = height * (0.38f + 0.02f * sin(driftPhase))
+ val orbit2 = Path()
+ for (i in 0..72) {
+ val theta = (i.toFloat() / 72) * 2f * PI.toFloat()
+ val unrotatedX = rx2 * cos(theta)
+ val unrotatedY = ry2 * sin(theta)
+ val rot = 0.25f - angleOffset * 0.5f
+ val x = centerX + (unrotatedX * cos(rot) - unrotatedY * sin(rot))
+ val y = centerY + (unrotatedX * sin(rot) + unrotatedY * cos(rot))
+ if (i == 0) orbit2.moveTo(x, y) else orbit2.lineTo(x, y)
+ }
+ orbit2.close()
+
+ drawPath(
+ path = orbit2,
+ color = secondaryColor,
+ style = Stroke(width = 1.6.dp.toPx(), cap = StrokeCap.Round)
+ )
+
+ val link = Path()
+ link.moveTo(-width * 0.1f, height * 0.88f)
+ link.cubicTo(
+ width * 0.4f, height * (0.82f + 0.02f * sin(driftPhase)),
+ width * 0.8f, height * (0.94f + 0.02f * cos(driftPhase)),
+ width * 1.1f, height * 0.84f
+ )
+ drawPath(
+ path = link,
+ color = accentColor,
+ style = Stroke(width = 1.4.dp.toPx(), cap = StrokeCap.Round)
+ )
+}
+
+/**
+ * Digital Wellbeing mindful breathing curves: organic undulating waves.
+ */
+private fun DrawScope.drawMindfulWavesBackground(
+ width: Float,
+ height: Float,
+ driftPhase: Float,
+ morphProgress: Float,
+ primaryColor: Color,
+ secondaryColor: Color,
+ accentColor: Color
+) {
+ val wave1 = Path()
+ wave1.moveTo(-width * 0.15f, height * 0.18f)
+ wave1.cubicTo(
+ width * 0.25f, height * (0.08f + 0.04f * sin(driftPhase)),
+ width * 0.70f, height * (0.28f + 0.04f * cos(driftPhase)),
+ width * 1.15f, height * 0.14f
+ )
+ drawPath(
+ path = wave1,
+ color = primaryColor,
+ style = Stroke(width = 2.2.dp.toPx(), cap = StrokeCap.Round)
+ )
+
+ val wave2 = Path()
+ wave2.moveTo(-width * 0.1f, height * 0.48f)
+ wave2.cubicTo(
+ width * 0.35f, height * (0.54f + 0.03f * cos(driftPhase * 0.8f)),
+ width * 0.65f, height * (0.42f - 0.03f * sin(driftPhase * 0.8f)),
+ width * 1.15f, height * 0.52f
+ )
+ drawPath(
+ path = wave2,
+ color = secondaryColor,
+ style = Stroke(width = 1.8.dp.toPx(), cap = StrokeCap.Round)
+ )
+
+ val puddle = Path()
+ val pX = width * 0.3f
+ val pY = height * 0.92f
+ val pr = width * (0.35f + 0.02f * morphProgress)
+ for (i in 0..50) {
+ val a = (i.toFloat() / 50) * 2f * PI.toFloat()
+ val r = pr + (width * 0.03f * sin(a * 4f + driftPhase))
+ val x = pX + r * cos(a)
+ val y = pY + r * 0.6f * sin(a)
+ if (i == 0) puddle.moveTo(x, y) else puddle.lineTo(x, y)
+ }
+ puddle.close()
+
+ drawPath(
+ path = puddle,
+ color = accentColor,
+ style = Stroke(width = 1.5.dp.toPx(), cap = StrokeCap.Round)
+ )
+}
+
+/**
+ * Pixel Camera Magic: Iris aperture petals and floating optical bokeh circles.
+ */
+private fun DrawScope.drawCameraMagicBackground(
+ width: Float,
+ height: Float,
+ driftPhase: Float,
+ morphProgress: Float,
+ primaryColor: Color,
+ secondaryColor: Color,
+ accentColor: Color
+) {
+ val centerX = width * (0.70f + 0.02f * sin(driftPhase))
+ val centerY = height * (0.24f + 0.02f * cos(driftPhase))
+ val apertureRadius = width * (0.34f + 0.03f * morphProgress)
+ val blades = 7
+
+ // Interlocking aperture blades
+ for (i in 0 until blades) {
+ val angle = (i.toFloat() / blades) * 2f * PI.toFloat() + driftPhase * 0.2f
+ val startRadius = apertureRadius * 0.45f
+ val endRadius = apertureRadius * 1.15f
+ val p1x = centerX + startRadius * cos(angle)
+ val p1y = centerY + startRadius * sin(angle)
+ val p2x = centerX + endRadius * cos(angle + 0.55f)
+ val p2y = centerY + endRadius * sin(angle + 0.55f)
+
+ val bladePath = Path()
+ bladePath.moveTo(p1x, p1y)
+ bladePath.quadraticTo(
+ centerX + apertureRadius * cos(angle + 0.25f),
+ centerY + apertureRadius * sin(angle + 0.25f),
+ p2x,
+ p2y
+ )
+
+ drawPath(
+ path = bladePath,
+ color = primaryColor.copy(alpha = 0.7f),
+ style = Stroke(width = 2.0.dp.toPx(), cap = StrokeCap.Round)
+ )
+ }
+
+ // Optical Bokeh Circles
+ drawCircle(
+ color = secondaryColor.copy(alpha = 0.25f),
+ radius = width * (0.22f + 0.02f * sin(driftPhase)),
+ center = Offset(width * 0.25f, height * 0.72f),
+ style = Stroke(width = 1.6.dp.toPx())
+ )
+
+ drawCircle(
+ color = accentColor.copy(alpha = 0.35f),
+ radius = width * (0.14f + 0.015f * cos(driftPhase)),
+ center = Offset(width * 0.38f, height * 0.65f),
+ style = Stroke(width = 1.4.dp.toPx())
+ )
+
+ // Floating lens flare arc
+ val flarePath = Path()
+ flarePath.moveTo(-width * 0.1f, height * 0.40f)
+ flarePath.cubicTo(
+ width * 0.3f, height * (0.35f + 0.03f * sin(driftPhase)),
+ width * 0.7f, height * (0.55f + 0.03f * cos(driftPhase)),
+ width * 1.15f, height * 0.48f
+ )
+ drawPath(
+ path = flarePath,
+ color = secondaryColor.copy(alpha = 0.6f),
+ style = Stroke(width = 1.8.dp.toPx(), cap = StrokeCap.Round)
+ )
+}
+
+/**
+ * Titan M2 Security: Hexagonal lattice matrix and expanding protective pulse shields.
+ */
+private fun DrawScope.drawTitanSecurityBackground(
+ width: Float,
+ height: Float,
+ driftPhase: Float,
+ morphProgress: Float,
+ primaryColor: Color,
+ secondaryColor: Color,
+ accentColor: Color
+) {
+ val centerX = width * 0.5f
+ val centerY = height * (0.26f + 0.02f * sin(driftPhase * 0.8f))
+
+ // Concentric Hexagonal Shields
+ for (shieldIndex in 1..3) {
+ val radius = width * (0.22f * shieldIndex + 0.02f * sin(driftPhase + shieldIndex))
+ val hexPath = Path()
+ for (i in 0..6) {
+ val angle = (i.toFloat() / 6) * 2f * PI.toFloat() - (PI / 2).toFloat()
+ val x = centerX + radius * cos(angle)
+ val y = centerY + radius * sin(angle)
+ if (i == 0) hexPath.moveTo(x, y) else hexPath.lineTo(x, y)
+ }
+ hexPath.close()
+
+ val strokeAlpha = (1f - (shieldIndex * 0.22f)).coerceIn(0.2f, 0.9f)
+ drawPath(
+ path = hexPath,
+ color = if (shieldIndex % 2 == 1) primaryColor.copy(alpha = strokeAlpha) else secondaryColor.copy(alpha = strokeAlpha),
+ style = Stroke(width = (2.4 - shieldIndex * 0.4).dp.toPx(), cap = StrokeCap.Round)
+ )
+ }
+
+ // Security Pulse Radar lines
+ val sweepLine = Path()
+ sweepLine.moveTo(centerX, centerY)
+ val radarAngle = driftPhase * 0.9f
+ sweepLine.lineTo(
+ centerX + width * 0.65f * cos(radarAngle),
+ centerY + width * 0.65f * sin(radarAngle)
+ )
+ drawPath(
+ path = sweepLine,
+ color = accentColor.copy(alpha = 0.4f),
+ style = Stroke(width = 1.5.dp.toPx(), cap = StrokeCap.Round)
+ )
+
+ // Lower encryption node wave
+ val wave = Path()
+ wave.moveTo(-width * 0.1f, height * 0.82f)
+ wave.cubicTo(
+ width * 0.35f, height * (0.76f + 0.03f * cos(driftPhase)),
+ width * 0.65f, height * (0.88f - 0.03f * sin(driftPhase)),
+ width * 1.15f, height * 0.80f
+ )
+ drawPath(
+ path = wave,
+ color = secondaryColor.copy(alpha = 0.5f),
+ style = Stroke(width = 1.8.dp.toPx(), cap = StrokeCap.Round)
+ )
+}
+
+/**
+ * Aurora Flow: Celestial flowing ribbons with harmonic organic curves.
+ */
+private fun DrawScope.drawAuroraFlowBackground(
+ width: Float,
+ height: Float,
+ driftPhase: Float,
+ morphProgress: Float,
+ primaryColor: Color,
+ secondaryColor: Color,
+ accentColor: Color
+) {
+ for (layer in 0..2) {
+ val ribbon = Path()
+ val yOffset = height * (0.15f + layer * 0.22f)
+ ribbon.moveTo(-width * 0.15f, yOffset)
+ ribbon.cubicTo(
+ width * (0.25f + 0.04f * sin(driftPhase + layer)),
+ yOffset + height * 0.12f * sin(driftPhase * 1.2f + layer),
+ width * (0.75f - 0.04f * cos(driftPhase + layer)),
+ yOffset - height * 0.10f * cos(driftPhase * 0.9f + layer),
+ width * 1.15f,
+ yOffset + height * 0.05f * sin(driftPhase)
+ )
+
+ val color = when (layer) {
+ 0 -> primaryColor
+ 1 -> secondaryColor
+ else -> accentColor
+ }
+
+ drawPath(
+ path = ribbon,
+ color = color.copy(alpha = 0.65f - layer * 0.12f),
+ style = Stroke(width = (2.2 - layer * 0.3).dp.toPx(), cap = StrokeCap.Round)
+ )
+ }
+}
+
+/**
+ * Cosmic Pulse: Starlit celestial orbit rings and alignment curves.
+ */
+private fun DrawScope.drawCosmicPulseBackground(
+ width: Float,
+ height: Float,
+ driftPhase: Float,
+ morphProgress: Float,
+ primaryColor: Color,
+ secondaryColor: Color,
+ accentColor: Color
+) {
+ val centerX = width * 0.62f
+ val centerY = height * 0.32f
+
+ // Elliptical planetary rings
+ val ring1 = Path()
+ val rx = width * (0.42f + 0.03f * morphProgress)
+ val ry = width * (0.18f + 0.02f * sin(driftPhase))
+ for (i in 0..60) {
+ val a = (i.toFloat() / 60) * 2f * PI.toFloat()
+ val x = centerX + rx * cos(a)
+ val y = centerY + ry * sin(a)
+ if (i == 0) ring1.moveTo(x, y) else ring1.lineTo(x, y)
+ }
+ ring1.close()
+ drawPath(
+ path = ring1,
+ color = primaryColor,
+ style = Stroke(width = 2.0.dp.toPx(), cap = StrokeCap.Round)
+ )
+
+ // Satellite orbit trajectory
+ val arc = Path()
+ arc.moveTo(-width * 0.1f, height * 0.15f)
+ arc.cubicTo(
+ width * 0.35f, height * 0.65f,
+ width * 0.85f, height * 0.25f,
+ width * 1.15f, height * 0.85f
+ )
+ drawPath(
+ path = arc,
+ color = secondaryColor.copy(alpha = 0.6f),
+ style = Stroke(width = 1.8.dp.toPx(), cap = StrokeCap.Round)
+ )
+
+ // Pulsing core beacon circle
+ drawCircle(
+ color = accentColor.copy(alpha = 0.5f),
+ radius = width * (0.06f + 0.015f * sin(driftPhase * 2f)),
+ center = Offset(centerX, centerY),
+ style = Stroke(width = 1.6.dp.toPx())
+ )
+}
+
+/**
+ * Circle to Search: Holographic neon boundary, target crosshairs, and multi-search radiant aura.
+ */
+private fun DrawScope.drawCircleSearchBackground(
+ width: Float,
+ height: Float,
+ driftPhase: Float,
+ morphProgress: Float,
+ primaryColor: Color,
+ secondaryColor: Color,
+ accentColor: Color
+) {
+ val centerX = width * (0.50f + 0.02f * sin(driftPhase))
+ val centerY = height * (0.35f + 0.02f * cos(driftPhase))
+
+ // Pulsing search lasso loop
+ val lassoRadius = width * (0.32f + 0.03f * morphProgress)
+ val lassoPath = Path()
+ val points = 72
+ for (i in 0..points) {
+ val angle = (i.toFloat() / points) * 2f * PI.toFloat()
+ val r = lassoRadius + (width * 0.025f * sin(angle * 3f + driftPhase * 1.5f))
+ val x = centerX + r * cos(angle)
+ val y = centerY + r * sin(angle)
+ if (i == 0) lassoPath.moveTo(x, y) else lassoPath.lineTo(x, y)
+ }
+ lassoPath.close()
+
+ drawPath(
+ path = lassoPath,
+ color = primaryColor,
+ style = Stroke(width = 2.4.dp.toPx(), cap = StrokeCap.Round)
+ )
+
+ // Outer radiant search aura
+ val outerAura = Path()
+ val outerRadius = width * (0.48f + 0.02f * sin(driftPhase))
+ for (i in 0..60) {
+ val angle = (i.toFloat() / 60) * 2f * PI.toFloat()
+ val r = outerRadius + (width * 0.04f * cos(angle * 4f - driftPhase))
+ val x = centerX + r * cos(angle)
+ val y = centerY + r * sin(angle)
+ if (i == 0) outerAura.moveTo(x, y) else outerAura.lineTo(x, y)
+ }
+ outerAura.close()
+
+ drawPath(
+ path = outerAura,
+ color = secondaryColor.copy(alpha = 0.55f),
+ style = Stroke(width = 1.6.dp.toPx(), cap = StrokeCap.Round)
+ )
+
+ // Subtle gesture scan arc
+ val scanArc = Path()
+ scanArc.moveTo(-width * 0.1f, height * 0.78f)
+ scanArc.cubicTo(
+ width * 0.35f, height * (0.72f + 0.03f * sin(driftPhase)),
+ width * 0.70f, height * (0.86f - 0.03f * cos(driftPhase)),
+ width * 1.15f, height * 0.75f
+ )
+ drawPath(
+ path = scanArc,
+ color = accentColor.copy(alpha = 0.6f),
+ style = Stroke(width = 1.8.dp.toPx(), cap = StrokeCap.Round)
+ )
+}
+
+/**
+ * Passkeys & Wallet: Biometric FIDO2 waves, contactless NFC ripples, and card outline geometry.
+ */
+private fun DrawScope.drawPasskeysWalletBackground(
+ width: Float,
+ height: Float,
+ driftPhase: Float,
+ morphProgress: Float,
+ primaryColor: Color,
+ secondaryColor: Color,
+ accentColor: Color
+) {
+ val centerX = width * 0.5f
+ val centerY = height * (0.28f + 0.02f * sin(driftPhase * 0.7f))
+
+ // Concentric contactless NFC radio arc waves
+ for (i in 1..4) {
+ val r = width * (0.16f * i + 0.02f * sin(driftPhase + i))
+ val arcPath = Path()
+ val startAngle = -PI.toFloat() * 0.75f
+ val sweepAngle = PI.toFloat() * 1.5f
+ val steps = 36
+ for (s in 0..steps) {
+ val angle = startAngle + (s.toFloat() / steps) * sweepAngle
+ val x = centerX + r * cos(angle)
+ val y = centerY + r * sin(angle)
+ if (s == 0) arcPath.moveTo(x, y) else arcPath.lineTo(x, y)
+ }
+ drawPath(
+ path = arcPath,
+ color = if (i % 2 == 1) primaryColor.copy(alpha = 0.75f / i) else secondaryColor.copy(alpha = 0.65f / i),
+ style = Stroke(width = 2.0.dp.toPx(), cap = StrokeCap.Round)
+ )
+ }
+
+ // Floating biometric biometric fingerprint loop contour
+ val fpPath = Path()
+ fpPath.moveTo(width * 0.2f, height * 0.75f)
+ fpPath.cubicTo(
+ width * 0.4f, height * (0.68f + 0.03f * cos(driftPhase)),
+ width * 0.6f, height * (0.84f - 0.03f * sin(driftPhase)),
+ width * 0.85f, height * 0.72f
+ )
+ drawPath(
+ path = fpPath,
+ color = accentColor.copy(alpha = 0.55f),
+ style = Stroke(width = 1.8.dp.toPx(), cap = StrokeCap.Round)
+ )
+}
+
+/**
+ * Adaptive Battery: Tensor AI energy flow, battery waveform, and power pulse.
+ */
+private fun DrawScope.drawAdaptiveBatteryBackground(
+ width: Float,
+ height: Float,
+ driftPhase: Float,
+ morphProgress: Float,
+ primaryColor: Color,
+ secondaryColor: Color,
+ accentColor: Color
+) {
+ val centerX = width * 0.5f
+ val centerY = height * (0.30f + 0.02f * sin(driftPhase * 0.8f))
+
+ // Energy cell battery shape
+ val cellWidth = width * 0.58f
+ val cellHeight = width * 0.78f
+ val cellLeft = centerX - cellWidth / 2f
+ val cellTop = centerY - cellHeight / 2f
+
+ // Dynamic wattage pulse wave inside cell
+ val wavePath = Path()
+ val waveY = centerY + width * 0.12f
+ wavePath.moveTo(cellLeft, waveY)
+ val wSteps = 40
+ for (i in 0..wSteps) {
+ val x = cellLeft + (cellWidth * (i.toFloat() / wSteps))
+ val y = waveY + width * (0.04f + 0.015f * morphProgress) * sin((i.toFloat() / wSteps) * 4f * PI.toFloat() + driftPhase * 2f)
+ wavePath.lineTo(x, y)
+ }
+ drawPath(
+ path = wavePath,
+ color = primaryColor,
+ style = Stroke(width = 2.4.dp.toPx(), cap = StrokeCap.Round)
+ )
+
+ // Floating orbital energy ring
+ val ring = Path()
+ val rx = width * (0.42f + 0.02f * sin(driftPhase))
+ val ry = width * (0.24f + 0.02f * cos(driftPhase))
+ for (i in 0..50) {
+ val a = (i.toFloat() / 50) * 2f * PI.toFloat()
+ val x = centerX + rx * cos(a)
+ val y = centerY + ry * sin(a)
+ if (i == 0) ring.moveTo(x, y) else ring.lineTo(x, y)
+ }
+ ring.close()
+ drawPath(
+ path = ring,
+ color = secondaryColor.copy(alpha = 0.5f),
+ style = Stroke(width = 1.8.dp.toPx(), cap = StrokeCap.Round)
+ )
+
+ // Energy transmission arc
+ val arc = Path()
+ arc.moveTo(-width * 0.1f, height * 0.82f)
+ arc.cubicTo(
+ width * 0.35f, height * (0.75f + 0.03f * cos(driftPhase)),
+ width * 0.70f, height * (0.90f - 0.03f * sin(driftPhase)),
+ width * 1.15f, height * 0.80f
+ )
+ drawPath(
+ path = arc,
+ color = accentColor.copy(alpha = 0.6f),
+ style = Stroke(width = 1.8.dp.toPx(), cap = StrokeCap.Round)
+ )
+}
+
+/**
+ * Renders genuine Material 3 Expressive shapes (12-lobe Scallop cookie, Heart,
+ * horizontal Stadium pill, and Clover) on a soft pastel lilac canvas.
+ */
+private fun DrawScope.drawFilledOrganicBlobsBackground(
+ width: Float,
+ height: Float,
+ driftPhase: Float,
+ morphProgress: Float,
+ secondaryDrift: Float,
+ primaryColor: Color,
+ secondaryColor: Color,
+ accentColor: Color
+) {
+ val m3Lilac = Color(0xFFF7EFF9)
+ val m3ScallopLavender = Color(0xFFBA9BF8)
+ val m3DeepPlum = Color(0xFF493870)
+ val m3SoftPill = Color(0xFFE2D3F8)
+
+ // 1. Soft pastel lilac canvas backdrop fill
+ drawRect(color = m3Lilac)
+
+ // 2. Floating 12-lobed Scallop cookie shape (top-left)
+ val scallopCx = width * (0.28f + 0.02f * cos(driftPhase * 0.8f))
+ val scallopCy = height * (0.24f + 0.02f * sin(driftPhase * 0.7f))
+ val baseR = width * (0.22f + 0.01f * morphProgress)
+ val scallopAmp = width * 0.028f
+ val scallopPath = Path()
+ val steps = 96
+ for (i in 0..steps) {
+ val theta = (i.toFloat() / steps) * 2f * PI.toFloat()
+ val r = baseR + scallopAmp * cos(theta * 12f)
+ val x = scallopCx + r * cos(theta)
+ val y = scallopCy + r * sin(theta)
+ if (i == 0) scallopPath.moveTo(x, y) else scallopPath.lineTo(x, y)
+ }
+ scallopPath.close()
+ drawPath(path = scallopPath, color = m3ScallopLavender.copy(alpha = 0.45f))
+
+ // 3. Floating Material 3 Expressive Heart shape (top-right)
+ val heartW = width * 0.42f
+ val heartH = heartW * 0.95f
+ val heartLeft = width * (0.58f - 0.02f * sin(driftPhase * 0.9f))
+ val heartTop = height * (0.16f + 0.02f * cos(driftPhase * 0.8f))
+ val heartPath = Path()
+ heartPath.moveTo(heartLeft + heartW * 0.5f, heartTop + heartH * 0.30f)
+ heartPath.cubicTo(
+ heartLeft + heartW * 0.44f, heartTop + heartH * 0.10f,
+ heartLeft + heartW * 0.08f, heartTop + heartH * 0.10f,
+ heartLeft + heartW * 0.08f, heartTop + heartH * 0.42f
+ )
+ heartPath.cubicTo(
+ heartLeft + heartW * 0.08f, heartTop + heartH * 0.65f,
+ heartLeft + heartW * 0.30f, heartTop + heartH * 0.82f,
+ heartLeft + heartW * 0.50f, heartTop + heartH * 0.95f
+ )
+ heartPath.cubicTo(
+ heartLeft + heartW * 0.70f, heartTop + heartH * 0.82f,
+ heartLeft + heartW * 0.92f, heartTop + heartH * 0.65f,
+ heartLeft + heartW * 0.92f, heartTop + heartH * 0.42f
+ )
+ heartPath.cubicTo(
+ heartLeft + heartW * 0.92f, heartTop + heartH * 0.10f,
+ heartLeft + heartW * 0.56f, heartTop + heartH * 0.10f,
+ heartLeft + heartW * 0.50f, heartTop + heartH * 0.30f
+ )
+ heartPath.close()
+ drawPath(path = heartPath, color = m3DeepPlum.copy(alpha = 0.32f))
+
+ // 4. Floating Horizontal Stadium Capsule (center-bottom)
+ val pillW = width * 0.74f
+ val pillH = height * 0.09f
+ val pillX = width * (0.13f + 0.015f * sin(secondaryDrift))
+ val pillY = height * (0.42f + 0.015f * cos(driftPhase * 0.7f))
+ val pillPath = Path()
+ val cr = pillH * 0.5f
+ pillPath.moveTo(pillX + cr, pillY)
+ pillPath.lineTo(pillX + pillW - cr, pillY)
+ pillPath.arcTo(
+ rect = androidx.compose.ui.geometry.Rect(pillX + pillW - pillH, pillY, pillX + pillW, pillY + pillH),
+ startAngleDegrees = -90f,
+ sweepAngleDegrees = 180f,
+ forceMoveTo = false
+ )
+ pillPath.lineTo(pillX + cr, pillY + pillH)
+ pillPath.arcTo(
+ rect = androidx.compose.ui.geometry.Rect(pillX, pillY, pillX + pillH, pillY + pillH),
+ startAngleDegrees = 90f,
+ sweepAngleDegrees = 180f,
+ forceMoveTo = false
+ )
+ pillPath.close()
+ drawPath(path = pillPath, color = m3DeepPlum.copy(alpha = 0.28f))
+
+ // 5. Lower Decorative M3 4-Leaf Clover
+ val cloverCx = width * 0.25f
+ val cloverCy = height * (0.68f + 0.02f * sin(secondaryDrift * 0.8f))
+ val cloverBaseR = width * 0.14f
+ val cloverAmp = width * 0.035f
+ val cloverPath = Path()
+ for (i in 0..72) {
+ val theta = (i.toFloat() / 72) * 2f * PI.toFloat()
+ val r = cloverBaseR + cloverAmp * cos(theta * 4f)
+ val x = cloverCx + r * cos(theta)
+ val y = cloverCy + r * sin(theta)
+ if (i == 0) cloverPath.moveTo(x, y) else cloverPath.lineTo(x, y)
+ }
+ cloverPath.close()
+ drawPath(path = cloverPath, color = m3ScallopLavender.copy(alpha = 0.35f))
+
+ // 6. Lower Right M3 Arch Dome
+ val archW = width * 0.34f
+ val archH = height * 0.16f
+ val archX = width * 0.65f
+ val archY = height * (0.62f - 0.02f * cos(secondaryDrift * 0.7f))
+ val archPath = Path()
+ archPath.moveTo(archX, archY + archH)
+ archPath.lineTo(archX, archY + archW * 0.5f)
+ archPath.arcTo(
+ rect = androidx.compose.ui.geometry.Rect(archX, archY, archX + archW, archY + archW),
+ startAngleDegrees = 180f,
+ sweepAngleDegrees = 180f,
+ forceMoveTo = false
+ )
+ archPath.lineTo(archX + archW, archY + archH)
+ archPath.close()
+ drawPath(path = archPath, color = m3SoftPill.copy(alpha = 0.50f))
+}
+
diff --git a/app/src/main/java/com/akslabs/circletosearch/ui/components/ExpressiveOnboardingScaffold.kt b/app/src/main/java/com/akslabs/circletosearch/ui/components/ExpressiveOnboardingScaffold.kt
new file mode 100644
index 0000000..bc404c5
--- /dev/null
+++ b/app/src/main/java/com/akslabs/circletosearch/ui/components/ExpressiveOnboardingScaffold.kt
@@ -0,0 +1,309 @@
+package com.akslabs.circletosearch.ui.components
+
+import androidx.compose.animation.AnimatedVisibility
+import androidx.compose.animation.EnterTransition
+import androidx.compose.animation.fadeIn
+import androidx.compose.animation.slideInVertically
+import androidx.compose.foundation.background
+import androidx.compose.foundation.clickable
+import androidx.compose.foundation.interaction.MutableInteractionSource
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.Spacer
+import androidx.compose.foundation.layout.WindowInsets
+import androidx.compose.foundation.layout.asPaddingValues
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.layout.navigationBars
+import androidx.compose.foundation.layout.navigationBarsPadding
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.layout.statusBars
+import androidx.compose.foundation.layout.statusBarsPadding
+import androidx.compose.foundation.layout.widthIn
+import androidx.compose.foundation.shape.CircleShape
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.automirrored.filled.ArrowBack
+import androidx.compose.material.icons.filled.DarkMode
+import androidx.compose.material.icons.filled.LightMode
+import androidx.compose.material.icons.filled.LocationOn
+import androidx.compose.material.icons.filled.MotionPhotosOff
+import androidx.compose.material.icons.filled.MotionPhotosOn
+import androidx.compose.material3.Button
+import androidx.compose.material3.ButtonDefaults
+import androidx.compose.material3.Icon
+import androidx.compose.material3.IconButton
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Surface
+import androidx.compose.material3.Text
+import androidx.compose.material3.TextButton
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.clip
+import androidx.compose.ui.graphics.vector.ImageVector
+import androidx.compose.ui.platform.testTag
+import androidx.compose.ui.semantics.Role
+import androidx.compose.ui.semantics.contentDescription
+import androidx.compose.ui.semantics.role
+import androidx.compose.ui.semantics.semantics
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+import kotlinx.coroutines.delay
+
+/**
+ * Reusable scaffold for Google Pixel & Material 3 Expressive onboarding flows.
+ *
+ * Implements:
+ * - Animated organic canvas background
+ * - Full edge-to-edge window insets handling
+ * - Expressive top bar with navigation, step indicators, and quick action chips
+ * - Spacious content slot with staggered entrance animation
+ * - Bottom action bar with secondary & primary native M3 expressive buttons
+ */
+@Composable
+fun ExpressiveOnboardingScaffold(
+ modifier: Modifier = Modifier,
+ backgroundPreset: BackgroundPreset = BackgroundPreset.PixelSetup,
+ reducedMotion: Boolean = false,
+ totalSteps: Int = 1,
+ currentStep: Int = 1,
+ onBackClick: (() -> Unit)? = null,
+ topActionIcon: ImageVector? = Icons.Default.LocationOn,
+ topActionDescription: String? = "Location options",
+ onTopActionClick: (() -> Unit)? = null,
+ secondaryActionText: String? = null,
+ onSecondaryActionClick: (() -> Unit)? = null,
+ primaryActionText: String = "Get started",
+ primaryActionEnabled: Boolean = true,
+ onPrimaryActionClick: () -> Unit,
+ content: @Composable () -> Unit,
+) {
+ // Staggered entrance animation control
+ var showContent by remember(reducedMotion) { mutableStateOf(reducedMotion) }
+ var showBottomBar by remember(reducedMotion) { mutableStateOf(reducedMotion) }
+
+ LaunchedEffect(reducedMotion) {
+ if (!reducedMotion) {
+ delay(120)
+ showContent = true
+ delay(200)
+ showBottomBar = true
+ }
+ }
+
+ Box(
+ modifier = modifier
+ .fillMaxSize()
+ .background(MaterialTheme.colorScheme.background)
+ ) {
+ // 1. Organic Vector Animated Background
+ ExpressiveOnboardingBackground(
+ preset = backgroundPreset,
+ reducedMotion = reducedMotion
+ )
+
+ // 2. Foreground Layout with full Insets
+ Column(
+ modifier = Modifier
+ .fillMaxSize()
+ .statusBarsPadding()
+ .navigationBarsPadding()
+ .padding(horizontal = 24.dp),
+ verticalArrangement = Arrangement.SpaceBetween
+ ) {
+ // Top Navigation / Action Bar
+ Row(
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(top = 12.dp, bottom = 8.dp),
+ horizontalArrangement = Arrangement.SpaceBetween,
+ verticalAlignment = Alignment.CenterVertically
+ ) {
+ // Left: Back button or Step Indicators
+ if (onBackClick != null) {
+ IconButton(
+ onClick = onBackClick,
+ modifier = Modifier
+ .size(48.dp)
+ .testTag("onboarding_back_button")
+ .semantics { contentDescription = "Navigate back" }
+ ) {
+ Icon(
+ imageVector = Icons.AutoMirrored.Filled.ArrowBack,
+ contentDescription = "Back",
+ tint = MaterialTheme.colorScheme.onBackground
+ )
+ }
+ } else {
+ // Subtle logo or empty spacer
+ Spacer(modifier = Modifier.size(48.dp))
+ }
+
+ // Center: Expressive Step Indicator Dots if multi-step
+ if (totalSteps > 1) {
+ Row(
+ horizontalArrangement = Arrangement.spacedBy(8.dp),
+ verticalAlignment = Alignment.CenterVertically,
+ modifier = Modifier
+ .clip(CircleShape)
+ .background(MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.6f))
+ .padding(horizontal = 12.dp, vertical = 6.dp)
+ .testTag("step_indicator")
+ ) {
+ for (step in 1..totalSteps) {
+ val isCurrent = step == currentStep
+ val isPassed = step < currentStep
+ Box(
+ modifier = Modifier
+ .size(if (isCurrent) 18.dp else 8.dp, 8.dp)
+ .clip(CircleShape)
+ .background(
+ when {
+ isCurrent -> MaterialTheme.colorScheme.primary
+ isPassed -> MaterialTheme.colorScheme.primary.copy(alpha = 0.5f)
+ else -> MaterialTheme.colorScheme.outline.copy(alpha = 0.3f)
+ }
+ )
+ )
+ }
+ }
+ } else {
+ Spacer(modifier = Modifier.weight(1f))
+ }
+
+ // Right: Pixel Signature Pill Chip (e.g. Location chip in screenshot)
+ if (topActionIcon != null && onTopActionClick != null) {
+ Surface(
+ shape = CircleShape,
+ color = MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.85f),
+ modifier = Modifier
+ .size(48.dp, 36.dp)
+ .clickable(
+ interactionSource = remember { MutableInteractionSource() },
+ indication = null,
+ onClick = onTopActionClick
+ )
+ .testTag("top_action_pill")
+ .semantics {
+ role = Role.Button
+ contentDescription = topActionDescription ?: "Action"
+ }
+ ) {
+ Box(
+ contentAlignment = Alignment.Center,
+ modifier = Modifier.fillMaxSize()
+ ) {
+ Icon(
+ imageVector = topActionIcon,
+ contentDescription = topActionDescription,
+ tint = MaterialTheme.colorScheme.onSurfaceVariant,
+ modifier = Modifier.size(20.dp)
+ )
+ }
+ }
+ } else {
+ Spacer(modifier = Modifier.size(48.dp))
+ }
+ }
+
+ // Middle: Spacious Animated Content
+ AnimatedVisibility(
+ visible = showContent,
+ enter = if (reducedMotion) EnterTransition.None else (
+ fadeIn(animationSpec = androidx.compose.animation.core.tween(350)) +
+ slideInVertically(
+ initialOffsetY = { it / 8 },
+ animationSpec = androidx.compose.animation.core.tween(400)
+ )
+ ),
+ modifier = Modifier
+ .weight(1f)
+ .fillMaxWidth()
+ ) {
+ Box(
+ modifier = Modifier.fillMaxSize(),
+ contentAlignment = Alignment.BottomStart
+ ) {
+ content()
+ }
+ }
+
+ // Bottom: Expressive Action Bar (Matches Pixel setup layout)
+ AnimatedVisibility(
+ visible = showBottomBar,
+ enter = if (reducedMotion) EnterTransition.None else (
+ fadeIn(animationSpec = androidx.compose.animation.core.tween(300)) +
+ slideInVertically(
+ initialOffsetY = { it / 4 },
+ animationSpec = androidx.compose.animation.core.tween(350)
+ )
+ ),
+ modifier = Modifier.fillMaxWidth()
+ ) {
+ Row(
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(vertical = 18.dp),
+ horizontalArrangement = Arrangement.SpaceBetween,
+ verticalAlignment = Alignment.CenterVertically
+ ) {
+ // Secondary text action (e.g. "Emergency call" in setup screenshot)
+ if (secondaryActionText != null && onSecondaryActionClick != null) {
+ TextButton(
+ onClick = onSecondaryActionClick,
+ modifier = Modifier
+ .testTag("secondary_action_button")
+ .semantics { role = Role.Button }
+ ) {
+ Text(
+ text = secondaryActionText,
+ style = MaterialTheme.typography.labelLarge.copy(
+ fontWeight = FontWeight.Medium,
+ fontSize = 15.sp
+ ),
+ color = MaterialTheme.colorScheme.secondary
+ )
+ }
+ } else {
+ Spacer(modifier = Modifier.weight(1f))
+ }
+
+ // Primary native pill button (e.g. "Get started" in setup screenshot)
+ Button(
+ onClick = onPrimaryActionClick,
+ enabled = primaryActionEnabled,
+ shape = RoundedCornerShape(28.dp),
+ colors = ButtonDefaults.buttonColors(
+ containerColor = MaterialTheme.colorScheme.primary,
+ contentColor = MaterialTheme.colorScheme.onPrimary
+ ),
+ modifier = Modifier
+ .height(52.dp)
+ .testTag("primary_action_button")
+ .semantics { role = Role.Button }
+ ) {
+ Text(
+ text = primaryActionText,
+ style = MaterialTheme.typography.labelLarge.copy(
+ fontWeight = FontWeight.SemiBold,
+ fontSize = 15.sp
+ ),
+ modifier = Modifier.padding(horizontal = 12.dp)
+ )
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/akslabs/circletosearch/ui/theme/ExpressiveMotion.kt b/app/src/main/java/com/akslabs/circletosearch/ui/theme/ExpressiveMotion.kt
new file mode 100644
index 0000000..c520271
--- /dev/null
+++ b/app/src/main/java/com/akslabs/circletosearch/ui/theme/ExpressiveMotion.kt
@@ -0,0 +1,185 @@
+package com.akslabs.circletosearch.ui.theme
+
+import androidx.compose.animation.core.Animatable
+import androidx.compose.animation.core.AnimationSpec
+import androidx.compose.animation.core.Spring
+import androidx.compose.animation.core.SpringSpec
+import androidx.compose.animation.core.spring
+import androidx.compose.foundation.clickable
+import androidx.compose.foundation.gestures.awaitFirstDown
+import androidx.compose.foundation.gestures.waitForUpOrCancellation
+import androidx.compose.foundation.interaction.MutableInteractionSource
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.rememberCoroutineScope
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.composed
+import androidx.compose.ui.graphics.graphicsLayer
+import androidx.compose.ui.input.pointer.pointerInput
+import kotlinx.coroutines.launch
+
+/**
+ * Google Material 3 Expressive Motion Physics System.
+ *
+ * M3 Expressive shifts from static duration/cubic-bezier curves to physical spring forces.
+ * Expressive motion features intentional overshoot, snappy acceleration, and organic bounce,
+ * creating interfaces that feel alive, responsive, and tactile.
+ */
+object M3ExpressiveSpring {
+ /**
+ * Expressive Bouncy (Material 3 Expressive Default):
+ * Noticeable overshoot and pleasant bounce. Used for hero components, FABs, expanding cards,
+ * step transitions, and successful completion states.
+ */
+ val Bouncy: SpringSpec<Float> = spring(
+ dampingRatio = 0.54f,
+ stiffness = 450f
+ )
+
+ /**
+ * Expressive Snappy:
+ * Low damping with quick settling. Used for interactive controls, toggles, chips,
+ * and immediate user-driven feedback.
+ */
+ val Snappy: SpringSpec<Float> = spring(
+ dampingRatio = 0.72f,
+ stiffness = 850f
+ )
+
+ /**
+ * Expressive Gentle:
+ * Smooth, organic motion with minimal overshoot. Used for background shapes,
+ * subtle floating items, and continuous breathing animations.
+ */
+ val Gentle: SpringSpec<Float> = spring(
+ dampingRatio = 0.88f,
+ stiffness = 260f
+ )
+
+ /**
+ * Expressive Hero:
+ * Majestic spatial entry with prominent spring physics for large full-screen elements,
+ * modals, and primary onboarding focal graphics.
+ */
+ val Hero: SpringSpec<Float> = spring(
+ dampingRatio = 0.58f,
+ stiffness = 200f
+ )
+
+ /**
+ * Fast Spatial:
+ * High stiffness for immediate spatial responses like drag release and magnetic snaps.
+ */
+ val FastSpatial: SpringSpec<Float> = spring(
+ dampingRatio = 0.65f,
+ stiffness = 1200f
+ )
+
+ /**
+ * Damping & Stiffness presets corresponding to Material 3 Expressive tokens.
+ */
+ const val DampingBouncy = 0.54f
+ const val DampingSnappy = 0.72f
+ const val DampingGentle = 0.88f
+
+ const val StiffnessLow = 200f
+ const val StiffnessMedium = 450f
+ const val StiffnessHigh = 850f
+ const val StiffnessExtraHigh = 1200f
+}
+
+/**
+ * Material 3 Expressive Press modifier.
+ *
+ * Applies realistic spring physics: when pressed down, the element squashes smoothly (e.g. to 0.94f);
+ * upon release, it expands back with an expressive spring overshoot bounce.
+ */
+fun Modifier.m3ExpressivePress(
+ pressedScale: Float = 0.93f,
+ enabled: Boolean = true,
+ onClick: (() -> Unit)? = null
+): Modifier = composed {
+ if (!enabled) return@composed this
+
+ val scale = remember { Animatable(1f) }
+ val scope = rememberCoroutineScope()
+
+ val clickModifier = if (onClick != null) {
+ Modifier.clickable(
+ interactionSource = remember { MutableInteractionSource() },
+ indication = null,
+ onClick = onClick
+ )
+ } else Modifier
+
+ this
+ .then(clickModifier)
+ .graphicsLayer {
+ scaleX = scale.value
+ scaleY = scale.value
+ }
+ .pointerInput(enabled) {
+ while (true) {
+ awaitPointerEventScope {
+ awaitFirstDown(requireUnconsumed = false)
+ scope.launch {
+ scale.animateTo(
+ targetValue = pressedScale,
+ animationSpec = spring(
+ dampingRatio = Spring.DampingRatioNoBouncy,
+ stiffness = Spring.StiffnessMedium
+ )
+ )
+ }
+
+ waitForUpOrCancellation()
+ scope.launch {
+ scale.animateTo(
+ targetValue = 1f,
+ animationSpec = M3ExpressiveSpring.Bouncy
+ )
+ }
+ }
+ }
+ }
+}
+
+/**
+ * Material 3 Expressive Interactive 3D tilt modifier with spring physics recovery.
+ */
+fun Modifier.m3ExpressiveTilt(
+ maxTiltDegrees: Float = 8f
+): Modifier = composed {
+ val tiltX = remember { Animatable(0f) }
+ val tiltY = remember { Animatable(0f) }
+ val scope = rememberCoroutineScope()
+
+ this
+ .graphicsLayer {
+ rotationX = tiltX.value
+ rotationY = tiltY.value
+ cameraDistance = 16f * density
+ }
+ .pointerInput(Unit) {
+ while (true) {
+ awaitPointerEventScope {
+ val down = awaitFirstDown(requireUnconsumed = false)
+ val centerW = size.width / 2f
+ val centerH = size.height / 2f
+ val dx = (down.position.x - centerW) / centerW
+ val dy = (down.position.y - centerH) / centerH
+
+ scope.launch {
+ tiltY.animateTo(dx * maxTiltDegrees, M3ExpressiveSpring.Snappy)
+ tiltX.animateTo(-dy * maxTiltDegrees, M3ExpressiveSpring.Snappy)
+ }
+
+ waitForUpOrCancellation()
+ scope.launch {
+ tiltY.animateTo(0f, M3ExpressiveSpring.Bouncy)
+ tiltX.animateTo(0f, M3ExpressiveSpring.Bouncy)
+ }
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/akslabs/circletosearch/ui/theme/ExpressiveShapes.kt b/app/src/main/java/com/akslabs/circletosearch/ui/theme/ExpressiveShapes.kt
new file mode 100644
index 0000000..d180fcf
--- /dev/null
+++ b/app/src/main/java/com/akslabs/circletosearch/ui/theme/ExpressiveShapes.kt
@@ -0,0 +1,462 @@
+package com.akslabs.circletosearch.ui.theme
+
+import androidx.compose.foundation.shape.CornerBasedShape
+import androidx.compose.foundation.shape.CutCornerShape
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.ui.geometry.Offset
+import androidx.compose.ui.geometry.Rect
+import androidx.compose.ui.geometry.Size
+import androidx.compose.ui.graphics.Outline
+import androidx.compose.ui.graphics.Path
+import androidx.compose.ui.graphics.Shape
+import androidx.compose.ui.unit.Density
+import androidx.compose.ui.unit.LayoutDirection
+import androidx.compose.ui.unit.dp
+import kotlin.math.PI
+import kotlin.math.cos
+import kotlin.math.sin
+
+/**
+ * Material 3 Expressive Shapes Library.
+ *
+ * Implements the expressive shapes introduced in Material Design 3 Expressive:
+ * - Arch: half-dome rounded top, flat base
+ * - Clover 4: four-lobed rounded clover
+ * - Clover 8: eight-lobed rounded floral rosette
+ * - Flower 8: eight-petal geometric flower
+ * - Scallop 12: twelve-lobe decorative scalloped medallion
+ * - Spark 4: Google Gemini / Pixel AI organic 4-point spark
+ * - Asymmetric Organic Card: asymmetric rounded corners (32dp, 8dp, 32dp, 8dp)
+ * - Slanted Pill: modern stadium shape with angled diagonal corners
+ */
+object M3ExpressiveShapes {
+
+ /**
+ * Classic M3 Expressive Arch Shape:
+ * Semicircular dome top with flat bottom.
+ */
+ val Arch: CornerBasedShape = RoundedCornerShape(
+ topStartPercent = 50,
+ topEndPercent = 50,
+ bottomStartPercent = 0,
+ bottomEndPercent = 0
+ )
+
+ /**
+ * Reverse Arch:
+ * Flat top with semicircular dome bottom.
+ */
+ val ReverseArch: CornerBasedShape = RoundedCornerShape(
+ topStartPercent = 0,
+ topEndPercent = 0,
+ bottomStartPercent = 50,
+ bottomEndPercent = 50
+ )
+
+ /**
+ * M3 Expressive Asymmetric Card:
+ * Expressive diagonal rounding pairing 32dp and 8dp.
+ */
+ val AsymmetricCard: CornerBasedShape = RoundedCornerShape(
+ topStart = 32.dp,
+ topEnd = 8.dp,
+ bottomEnd = 32.dp,
+ bottomStart = 8.dp
+ )
+
+ /**
+ * M3 Expressive Slanted Pill:
+ * High asymmetric corner rounding for expressive chips and badges.
+ */
+ val SlantedPill: CornerBasedShape = RoundedCornerShape(
+ topStart = 24.dp,
+ topEnd = 6.dp,
+ bottomEnd = 24.dp,
+ bottomStart = 6.dp
+ )
+
+ /**
+ * 4-Leaf Clover Shape:
+ * Organic 4-lobed shape created with parametric lobes.
+ */
+ val Clover4: Shape = object : Shape {
+ override fun createOutline(
+ size: Size,
+ layoutDirection: LayoutDirection,
+ density: Density
+ ): Outline {
+ val path = Path()
+ val w = size.width
+ val h = size.height
+ val cx = w / 2f
+ val cy = h / 2f
+ val baseR = minOf(w, h) * 0.44f
+ val lobeAmp = minOf(w, h) * 0.08f
+
+ val steps = 80
+ for (i in 0..steps) {
+ val theta = (i.toFloat() / steps) * 2f * PI.toFloat()
+ val r = baseR + lobeAmp * cos(theta * 4f)
+ val x = cx + r * cos(theta)
+ val y = cy + r * sin(theta)
+ if (i == 0) path.moveTo(x, y) else path.lineTo(x, y)
+ }
+ path.close()
+ return Outline.Generic(path)
+ }
+ }
+
+ /**
+ * 8-Leaf Clover / Rosette Shape:
+ * 8 smooth rounded lobes radiating from center.
+ */
+ val Clover8: Shape = object : Shape {
+ override fun createOutline(
+ size: Size,
+ layoutDirection: LayoutDirection,
+ density: Density
+ ): Outline {
+ val path = Path()
+ val w = size.width
+ val h = size.height
+ val cx = w / 2f
+ val cy = h / 2f
+ val baseR = minOf(w, h) * 0.43f
+ val lobeAmp = minOf(w, h) * 0.07f
+
+ val steps = 96
+ for (i in 0..steps) {
+ val theta = (i.toFloat() / steps) * 2f * PI.toFloat()
+ val r = baseR + lobeAmp * cos(theta * 8f)
+ val x = cx + r * cos(theta)
+ val y = cy + r * sin(theta)
+ if (i == 0) path.moveTo(x, y) else path.lineTo(x, y)
+ }
+ path.close()
+ return Outline.Generic(path)
+ }
+ }
+
+ /**
+ * 8-Petal Geometric Flower Shape:
+ * Deeper valleys creating a floral contour.
+ */
+ val Flower8: Shape = object : Shape {
+ override fun createOutline(
+ size: Size,
+ layoutDirection: LayoutDirection,
+ density: Density
+ ): Outline {
+ val path = Path()
+ val w = size.width
+ val h = size.height
+ val cx = w / 2f
+ val cy = h / 2f
+ val baseR = minOf(w, h) * 0.40f
+ val lobeAmp = minOf(w, h) * 0.10f
+
+ val steps = 96
+ for (i in 0..steps) {
+ val theta = (i.toFloat() / steps) * 2f * PI.toFloat()
+ val r = baseR + lobeAmp * sin(theta * 8f)
+ val x = cx + r * cos(theta)
+ val y = cy + r * sin(theta)
+ if (i == 0) path.moveTo(x, y) else path.lineTo(x, y)
+ }
+ path.close()
+ return Outline.Generic(path)
+ }
+ }
+
+ /**
+ * 12-Point Scalloped Medallion / Cookie Shape:
+ * 12 harmonic sinusoidal lobes radiating around a circle.
+ */
+ val Scallop12: Shape = object : Shape {
+ override fun createOutline(
+ size: Size,
+ layoutDirection: LayoutDirection,
+ density: Density
+ ): Outline {
+ val path = Path()
+ val w = size.width
+ val h = size.height
+ val cx = w / 2f
+ val cy = h / 2f
+ val baseR = minOf(w, h) * 0.43f
+ val scallopAmp = minOf(w, h) * 0.06f
+
+ val steps = 144
+ for (i in 0..steps) {
+ val theta = (i.toFloat() / steps) * 2f * PI.toFloat()
+ val r = baseR + scallopAmp * cos(theta * 12f)
+ val x = cx + r * cos(theta)
+ val y = cy + r * sin(theta)
+ if (i == 0) path.moveTo(x, y) else path.lineTo(x, y)
+ }
+ path.close()
+ return Outline.Generic(path)
+ }
+ }
+
+ /**
+ * Material 3 Expressive Heart Shape:
+ * Smooth rounded organic heart matching official M3 Expressive design tokens.
+ */
+ val Heart: Shape = object : Shape {
+ override fun createOutline(
+ size: Size,
+ layoutDirection: LayoutDirection,
+ density: Density
+ ): Outline {
+ val path = Path()
+ val w = size.width
+ val h = size.height
+
+ path.moveTo(w * 0.5f, h * 0.30f)
+ // Left lobe curve
+ path.cubicTo(w * 0.44f, h * 0.10f, w * 0.08f, h * 0.10f, w * 0.08f, h * 0.42f)
+ path.cubicTo(w * 0.08f, h * 0.65f, w * 0.30f, h * 0.82f, w * 0.50f, h * 0.95f)
+ // Right lobe curve
+ path.cubicTo(w * 0.70f, h * 0.82f, w * 0.92f, h * 0.65f, w * 0.92f, h * 0.42f)
+ path.cubicTo(w * 0.92f, h * 0.10f, w * 0.56f, h * 0.10f, w * 0.50f, h * 0.30f)
+ path.close()
+ return Outline.Generic(path)
+ }
+ }
+
+ /**
+ * 4-Point AI Spark Shape (Gemini / Pixel Studio Spark):
+ * Four concave arcs meeting at rounded points.
+ */
+ val Spark4: Shape = object : Shape {
+ override fun createOutline(
+ size: Size,
+ layoutDirection: LayoutDirection,
+ density: Density
+ ): Outline {
+ val path = Path()
+ val w = size.width
+ val h = size.height
+ val cx = w / 2f
+ val cy = h / 2f
+ val outerR = minOf(w, h) * 0.48f
+ val innerR = outerR * 0.32f
+
+ val steps = 64
+ for (i in 0..steps) {
+ val theta = (i.toFloat() / steps) * 2f * PI.toFloat()
+ val r = innerR + (outerR - innerR) * (0.5f + 0.5f * cos(theta * 4f))
+ val x = cx + r * cos(theta)
+ val y = cy + r * sin(theta)
+ if (i == 0) path.moveTo(x, y) else path.lineTo(x, y)
+ }
+ path.close()
+ return Outline.Generic(path)
+ }
+ }
+
+ /**
+ * Expressive Cut-Corner Asymmetric Card:
+ * Diagonal faceted architectural corners popular in Pixel camera and screenshots UI.
+ */
+ val CutCornerCard: Shape = CutCornerShape(
+ topStart = 28.dp,
+ topEnd = 6.dp,
+ bottomEnd = 28.dp,
+ bottomStart = 6.dp
+ )
+
+ /**
+ * Stadium / Pill Shape:
+ * Semicircular ends ideal for badges, chips, and tactile action pills.
+ */
+ val Stadium: Shape = RoundedCornerShape(percent = 50)
+
+ /**
+ * Squircle (Continuous Curvature Superellipse):
+ * Ultra-smooth corner blend avoiding abrupt tangent transitions.
+ */
+ val Squircle: Shape = RoundedCornerShape(percent = 32)
+
+ /**
+ * Hexagonal Shield Badge:
+ * 6-sided geometric polygon with subtle rounded corners.
+ */
+ val HexagonBadge: Shape = object : Shape {
+ override fun createOutline(
+ size: Size,
+ layoutDirection: LayoutDirection,
+ density: Density
+ ): Outline {
+ val path = Path()
+ val w = size.width
+ val h = size.height
+ val cx = w / 2f
+ val cy = h / 2f
+ val r = minOf(w, h) * 0.46f
+
+ for (i in 0 until 6) {
+ val angle = (i * 60f - 30f) * (PI.toFloat() / 180f)
+ val x = cx + r * cos(angle)
+ val y = cy + r * sin(angle)
+ if (i == 0) path.moveTo(x, y) else path.lineTo(x, y)
+ }
+ path.close()
+ return Outline.Generic(path)
+ }
+ }
+
+ /**
+ * Octagon Medallion Shape:
+ * 8-sided regular polygon for cryptographic and security stamps.
+ */
+ val OctagonMedallion: Shape = object : Shape {
+ override fun createOutline(
+ size: Size,
+ layoutDirection: LayoutDirection,
+ density: Density
+ ): Outline {
+ val path = Path()
+ val w = size.width
+ val h = size.height
+ val cx = w / 2f
+ val cy = h / 2f
+ val r = minOf(w, h) * 0.46f
+
+ for (i in 0 until 8) {
+ val angle = (i * 45f - 22.5f) * (PI.toFloat() / 180f)
+ val x = cx + r * cos(angle)
+ val y = cy + r * sin(angle)
+ if (i == 0) path.moveTo(x, y) else path.lineTo(x, y)
+ }
+ path.close()
+ return Outline.Generic(path)
+ }
+ }
+
+ /**
+ * 16-Point Sunburst / Star Medallion:
+ * Expressive celestial starburst for astrophotography & camera awards.
+ */
+ val Sunburst16: Shape = object : Shape {
+ override fun createOutline(
+ size: Size,
+ layoutDirection: LayoutDirection,
+ density: Density
+ ): Outline {
+ val path = Path()
+ val w = size.width
+ val h = size.height
+ val cx = w / 2f
+ val cy = h / 2f
+ val rOuter = minOf(w, h) * 0.47f
+ val rInner = rOuter * 0.78f
+
+ for (i in 0 until 32) {
+ val r = if (i % 2 == 0) rOuter else rInner
+ val angle = (i * (360f / 32f)) * (PI.toFloat() / 180f)
+ val x = cx + r * cos(angle)
+ val y = cy + r * sin(angle)
+ if (i == 0) path.moveTo(x, y) else path.lineTo(x, y)
+ }
+ path.close()
+ return Outline.Generic(path)
+ }
+ }
+
+ /**
+ * Protective Security Shield Shape:
+ * Curved top arch with tapered pointed apex at bottom.
+ */
+ val Shield: Shape = object : Shape {
+ override fun createOutline(
+ size: Size,
+ layoutDirection: LayoutDirection,
+ density: Density
+ ): Outline {
+ val path = Path()
+ val w = size.width
+ val h = size.height
+
+ path.moveTo(w * 0.5f, 0f)
+ path.cubicTo(w * 0.85f, 0f, w, h * 0.15f, w, h * 0.42f)
+ path.cubicTo(w, h * 0.72f, w * 0.65f, h * 0.92f, w * 0.5f, h)
+ path.cubicTo(w * 0.35f, h * 0.92f, 0f, h * 0.72f, 0f, h * 0.42f)
+ path.cubicTo(0f, h * 0.15f, w * 0.15f, 0f, w * 0.5f, 0f)
+ path.close()
+ return Outline.Generic(path)
+ }
+ }
+
+ /**
+ * Tri-Lobed Organic Asymmetric Fluid Blob:
+ * Smooth fluid shape for acoustics and spatial sound.
+ */
+ val OrganicBlob: Shape = object : Shape {
+ override fun createOutline(
+ size: Size,
+ layoutDirection: LayoutDirection,
+ density: Density
+ ): Outline {
+ val path = Path()
+ val w = size.width
+ val h = size.height
+ val cx = w / 2f
+ val cy = h / 2f
+ val baseR = minOf(w, h) * 0.40f
+ val amp = minOf(w, h) * 0.08f
+
+ val steps = 90
+ for (i in 0..steps) {
+ val theta = (i.toFloat() / steps) * 2f * PI.toFloat()
+ val r = baseR + amp * sin(theta * 3f)
+ val x = cx + r * cos(theta)
+ val y = cy + r * sin(theta)
+ if (i == 0) path.moveTo(x, y) else path.lineTo(x, y)
+ }
+ path.close()
+ return Outline.Generic(path)
+ }
+ }
+
+ /**
+ * Ticket Notch Card:
+ * Rounded card with semicircular concave side cutouts.
+ */
+ val TicketNotch: Shape = RoundedCornerShape(20.dp)
+
+ /**
+ * Diamond Pill Shape:
+ * Rotated rhomboid pill with rounded tips.
+ */
+ val DiamondPill: Shape = RoundedCornerShape(22.dp)
+
+ /**
+ * Bookmark Ribbon Shape:
+ * Rounded top with inverted triangular ribbon cutout at bottom.
+ */
+ val BookmarkRibbon: Shape = object : Shape {
+ override fun createOutline(
+ size: Size,
+ layoutDirection: LayoutDirection,
+ density: Density
+ ): Outline {
+ val path = Path()
+ val w = size.width
+ val h = size.height
+ val cornerR = 16f
+
+ path.moveTo(cornerR, 0f)
+ path.lineTo(w - cornerR, 0f)
+ path.quadraticTo(w, 0f, w, cornerR)
+ path.lineTo(w, h)
+ path.lineTo(w * 0.5f, h * 0.85f)
+ path.lineTo(0f, h)
+ path.lineTo(0f, cornerR)
+ path.quadraticTo(0f, 0f, cornerR, 0f)
+ path.close()
+ return Outline.Generic(path)
+ }
+ }
+}