Add Android Bench sample: tasks and runs (part 6)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- .gitattributes+14
- submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/agent/sessions/projects/-workspace-testbed/memory/MEMORY.mdAdded+1
- submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/agent/sessions/projects/-workspace-testbed/memory/signal-offline-testing.mdAdded+17
- submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/agent/trajectory.jsonAdded
- submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/artifacts/manifest.jsonAdded+10
- submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/config.jsonAdded+1
- submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/result.jsonAdded+1
- submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/verifier/artifacts/generated/logs/artifacts/_detailed_scores.jsonAdded+144
- submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/verifier/artifacts/generated/logs/artifacts/_submission.patchAdded+2436
- submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/verifier/artifacts/manifest.jsonAdded+11
- submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/verifier/code_quality.jsonAdded+5
- submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/verifier/detailed_scores.jsonAdded+144
- submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/verifier/evaluator.logAdded
- submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/verifier/reward.txtAdded+1
- submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/verifier/submission.patchAdded+2436
- submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/verifier/test-stdout.txtAdded
- submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/verifier/test_failures.txtAdded+1
- submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/verifier/tests_manifest.jsonAdded+4
- submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/verifier/validate_results.txtAdded+42
- submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/verifier/visual/actual/gradient_edit.pngAdded
- submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/verifier/visual/actual/gradient_new_color.pngAdded
- submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/verifier/visual/actual/solid_adjusted.pngAdded
- submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/verifier/visual/actual/solid_dark.pngAdded
- submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/verifier/visual/actual/solid_new_color.pngAdded
- submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/verifier/visual_score.jsonAdded+43
- submissions/claude-code__claude-opus-5-5/metadata.yamlAdded+11
- submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/config.jsonAdded+99
- submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/result.jsonAdded+304
- submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/agent/claude-code.txtAdded+3
- submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/agent/sessions/.claude.jsonAdded+23
- submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/agent/sessions/.last-cleanupAdded+1
- submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/agent/sessions/backups/.claude.json.backup.1794477813028Added+4
- submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/agent/sessions/projects/-workspace-testbed/01bd1df5-f827-42aa-8747-91c14f0974e3.jsonlAdded+3
- submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/agent/sessions/projects/-workspace-testbed/01bd1df5-f827-42aa-8747-91c14f0974e3/tool-results/bbkj9rpal.txtAdded+1233
- submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/agent/trajectory.jsonAdded+3
- submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/artifacts/manifest.jsonAdded+10
- submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/config.jsonAdded+1
- submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/result.jsonAdded+1
- submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/verifier/artifacts/generated/logs/artifacts/_detailed_scores.jsonAdded+208
- submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/verifier/artifacts/generated/logs/artifacts/_submission.patchAdded
- submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/verifier/artifacts/manifest.jsonAdded+11
- submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/verifier/code_quality.jsonAdded+5
- submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/verifier/detailed_scores.jsonAdded+208
- submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/verifier/evaluator.logAdded
- submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/verifier/reward.txtAdded+1
- submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/verifier/submission.patchAdded
- submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/verifier/test-stdout.txtAdded
- submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/verifier/test_failures.txtAdded+2
- submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/verifier/tests_manifest.jsonAdded+4
- submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/verifier/validate_results.txtAdded+68
90 unmodified lines91929394959697989910010110210310410510610790 unmodified linessubmissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-5a7637cf-1/agent/trajectory.json filter=lfs diff=lfs merge=lfs -textsubmissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-7931895e-1/agent/trajectory.json filter=lfs diff=lfs merge=lfs -textsubmissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-d112da4c-1/agent/trajectory.json filter=lfs diff=lfs merge=lfs -textsubmissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/agent/claude-code.txt filter=lfs diff=lfs merge=lfs -textsubmissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/agent/sessions/projects/-workspace-testbed/01bd1df5-f827-42aa-8747-91c14f0974e3.jsonl filter=lfs diff=lfs merge=lfs -textsubmissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/agent/trajectory.json filter=lfs diff=lfs merge=lfs -textsubmissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-c77c61fa-1/agent/claude-code.txt filter=lfs diff=lfs merge=lfs -textsubmissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-c77c61fa-1/agent/sessions/projects/-workspace-testbed/e04da812-3baa-4c74-8368-f9329111f844.jsonl filter=lfs diff=lfs merge=lfs -textsubmissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-c77c61fa-1/agent/trajectory.json filter=lfs diff=lfs merge=lfs -textsubmissions/claude-code__deepseek-v4.1-flash/efflora__pocket-casts-retrofit-to-ktor/t-1f72a918-1/agent/claude-code.txt filter=lfs diff=lfs merge=lfs -textsubmissions/claude-code__deepseek-v4.1-flash/efflora__signal-custom-chat-color/t-0f08b933-1/agent/claude-code.txt filter=lfs diff=lfs merge=lfs -textsubmissions/claude-code__deepseek-v4.1-flash/efflora__signal-custom-chat-color/t-2c1871da-1/agent/claude-code.txt filter=lfs diff=lfs merge=lfs -textsubmissions/claude-code__deepseek-v4.1-flash/efflora__signal-custom-chat-color/t-c0aa551d-1/agent/claude-code.txt filter=lfs diff=lfs merge=lfs -textsubmissions/claude-code__deepseek-v4.1-flash/efflora__signal-custom-chat-color/t-c7fdb08e-1/agent/claude-code.txt filter=lfs diff=lfs merge=lfs -textsubmissions/claude-code__glm-5.3/efflora__fossify-viewmodel-layer/t-efa8adb8-1/agent/claude-code.txt filter=lfs diff=lfs merge=lfs -textsubmissions/claude-code__glm-5.3/efflora__fossify-viewmodel-layer/t-efa8adb8-1/agent/trajectory.json filter=lfs diff=lfs merge=lfs -textsubmissions/claude-code__glm-5.3/efflora__fossify-viewmodel-layer/t-f8bed8ba-1/agent/claude-code.txt filter=lfs diff=lfs merge=lfs -text1- [Offline testing in this sandbox](signal-offline-testing.md) — test commands, no ktlint, Compose/fragment test hosting, screenshot comparisons1234567891011121314151617---name: signal-offline-testingdescription: "How to run Signal-Android unit/Compose/screenshot tests offline in this sandbox, and which tools are unavailable"metadata: node_type: memory type: reference originSessionId: e71918fb-d1f1-4c83-a2ea-4ff1cd3e5bfb modified: 2026-10-21T07:52:33.528Z---
- Build: `/opt/bench/build.sh` (`:Signal-Android:assemblePlayProdDebug --offline`, ~2-6 min warm).- Unit tests: `./gradlew :Signal-Android:testPlayProdDebugUnitTest --tests '<filter>' --offline -I /opt/bench/unit-warmup.init.gradle` (reuse build.sh's jvmargs). Robolectric android-all for SDK 28 and 35 are cached in `~/.m2`; nothing else can be downloaded.- ktlint cannot run (`ktlint-cli` not in the offline cache): check import order (others, then java/javax/kotlin), unused imports and trailing commas by hand.- Compose screens under test need `CoreUiDependenciesRule` (core/ui testFixtures) or `SignalTheme` crashes.- Hosting a Fragment: `Robolectric.buildActivity(FragmentActivity::class.java)`, `setTheme(R.style.Signal_DayNight_NoActionBar)` before `setup()`, add with `commitNow()`, use `createEmptyComposeRule()`; set a mock NavController with `Navigation.setViewNavController` on `android.R.id.content`.- Screenshots: `@GraphicsMode(NATIVE)` + `sdk = [35]`, `decorView.draw(Canvas(bitmap))` captures Views and Compose alike; good for before/after comparisons by stashing changes.- With no Compose root attached, each `composeTestRule.waitForIdle()` stalls ~2s.12345678910[ { "source": "/logs/artifacts", "destination": "artifacts/logs/artifacts", "type": "file", "status": "failed", "service": null, "exclude": [] }]1{"task":{"path":"tasks/task"},"trial_name":"t-f8621cc5-1","trials_dir":"jobs","environment_build_timeout_multiplier":2.0,"agent":{"import_path":null,"model_name":"claude-opus-5-5","max_timeout_sec":129600.0,"kwargs":{"reasoning_effort":"max","disallowed_tools":"WebSearch"},"env":{"ANTHROPIC_API_KEY":"****","ANTHROPIC_BASE_URL":"https://api.anthropic.com","DISABLE_AUTOUPDATER":"1","CLAUDE_CODE_OAUTH_TOKEN":"****","ANTHROPIC_AUTH_TOKEN":"****","CLAUDE_CODE_USE_BEDROCK":"","CLAUDE_CODE_USE_VERTEX":"","CLAUDE_CODE_USE_FOUNDRY":"","AWS_BEARER_TOKEN_BEDROCK":"****","ANTHROPIC_DEFAULT_OPUS_MODEL":"claude-opus-5-5","ANTHROPIC_DEFAULT_SONNET_MODEL":"claude-opus-5-5","ANTHROPIC_DEFAULT_HAIKU_MODEL":"claude-opus-5-5","ANTHROPIC_DEFAULT_FABLE_MODEL":"claude-opus-5-5","CLAUDE_CODE_SUBAGENT_MODEL":"claude-opus-5-5"},"name":"claude-code"},"environment":{"import_path":null,"kwargs":{},"type":"docker"},"job_id":"573ca5b7-bd46-4faa-b8a8-1739e7a0376e"}1{"id":"9ae35b08-ca5c-4099-b2de-c9bd73018f12","task_name":"android-bench/efflora__signal-custom-chat-color","trial_name":"t-f8621cc5-1","trial_uri":"file:///jobs/trial","task_id":{"path":"tasks/task"},"source":null,"task_checksum":"","config":{"task":{"path":"tasks/task","git_url":null,"git_commit_id":null,"name":null,"ref":null,"overwrite":false,"download_dir":null,"source":null},"trial_name":"t-f8621cc5-1","trials_dir":"jobs","install_only":false,"timeout_multiplier":1.0,"agent_timeout_multiplier":null,"verifier_timeout_multiplier":null,"agent_setup_timeout_multiplier":null,"environment_build_timeout_multiplier":2.0,"agent":{"name":"claude-code","import_path":null,"model_name":"claude-opus-5-5","n_concurrent":null,"concurrency_group":null,"skills":[],"override_timeout_sec":null,"override_setup_timeout_sec":null,"max_timeout_sec":129600.0,"resume_trajectory":false,"load_trajectory":null,"extra_allowed_hosts":[],"kwargs":{"reasoning_effort":"max","disallowed_tools":"WebSearch"},"env":{"ANTHROPIC_API_KEY":"****","ANTHROPIC_BASE_URL":"https://api.anthropic.com","DISABLE_AUTOUPDATER":"1","CLAUDE_CODE_OAUTH_TOKEN":"****","ANTHROPIC_AUTH_TOKEN":"****","CLAUDE_CODE_USE_BEDROCK":"","CLAUDE_CODE_USE_VERTEX":"","CLAUDE_CODE_USE_FOUNDRY":"","AWS_BEARER_TOKEN_BEDROCK":"****","ANTHROPIC_DEFAULT_OPUS_MODEL":"claude-opus-5-5","ANTHROPIC_DEFAULT_SONNET_MODEL":"claude-opus-5-5","ANTHROPIC_DEFAULT_HAIKU_MODEL":"claude-opus-5-5","ANTHROPIC_DEFAULT_FABLE_MODEL":"claude-opus-5-5","CLAUDE_CODE_SUBAGENT_MODEL":"claude-opus-5-5"},"mcp_servers":[]},"user_agent":null,"environment":{"type":"docker","import_path":null,"force_build":false,"delete":true,"cpu_enforcement_policy":"auto","memory_enforcement_policy":"auto","override_cpus":null,"override_memory_mb":null,"override_storage_mb":null,"override_gpus":null,"override_tpu":null,"mounts":null,"extra_docker_compose":[],"kwargs":{},"extra_allowed_hosts":[]},"verifier":{"override_timeout_sec":null,"max_timeout_sec":null,"disable":false},"artifacts":[],"extra_instruction_paths":[],"extra_instructions":[],"job_id":"573ca5b7-bd46-4faa-b8a8-1739e7a0376e","source_trial":null},"agent_info":{"name":"claude-code","version":"2.1.287","model_info":{"name":"claude-opus-5-5","provider":"anthropic"}},"agent_result":{"n_input_tokens":51713975,"n_cache_tokens":50896225,"n_output_tokens":308423,"cost_usd":null,"model_usage":{"claude-opus-5-5":{"n_input_tokens":51713975,"n_cache_tokens":50896225,"n_output_tokens":308423,"cost_usd":null}},"rollout_details":null,"metadata":null},"verifier_result":{"rewards":{"reward":0.95}},"exception_info":null,"started_at":"2026-10-21T06:09:42.315954Z","finished_at":"2026-10-21T08:09:22.561183Z","environment_setup":{"started_at":"2026-10-21T06:09:42.318904Z","finished_at":"2026-10-21T06:13:53.548924Z"},"agent_setup":{"started_at":"2026-10-21T06:13:53.548957Z","finished_at":"2026-10-21T06:13:57.865508Z"},"agent_execution":{"started_at":"2026-10-21T06:13:57.890186Z","finished_at":"2026-10-21T07:55:33.845902Z"},"verifier":{"started_at":"2026-11-03T19:59:55.919052Z","finished_at":"2026-11-03T20:21:44.376808Z"},"step_results":null}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144{ "efflora__signal-custom-chat-color": { "score": 0.0, "diagnostics": [ "Verifying 38 pass_to_pass tests and 4 fail_to_pass tests.", "Running test attempt: 1", "Test attempt 1: PASSED", "validation failed: regression#legacy_editor_resources_removed" ], "status": "AGENT_FAILED_VALIDATION", "used_tokens": null, "exported_passed_tests": [], "exported_failed_tests": [], "partial_score": 0.95, "pass_rate": 0.9881, "validation_results": { "cheating#patch": 1.0, "gate#migration_started": 1.0, "functional#migrationDefaultAddEntryIsCompose": 1.0, "functional#migrationGradientIsCompose": 1.0, "functional#migrationConfirmationUsesCompose": 1.0, "functional#migrationViewRecreationStillUsesCompose": 1.0, "functional#behaviorNewSolidDefaults": 1.0, "functional#behaviorSolidSliderBoundariesAndSave": 1.0, "functional#behaviorGeneratedHueSaturationPairs": 1.0, "functional#behaviorGradientStartPageAndSave": 1.0, "functional#behaviorEdgesAreIndependentlyEditable": 1.0, "functional#behaviorSwitchTabsSharesSelectedEdge": 1.0, "functional#behaviorRotateGradientPersistsDirection": 1.0, "functional#behaviorEditSolidLoadsAndKeepsIdentity": 1.0, "functional#behaviorEditGradientLoadsBothColorsAndAngle": 1.0, "functional#behaviorDelayedLoadUpdatesEditor": 1.0, "functional#behaviorUsedColorCancelDoesNotWrite": 1.0, "functional#behaviorUsedColorConfirmWritesOnce": 1.0, "functional#behaviorCancelThenChangeAndConfirmLatest": 1.0, "functional#behaviorBackDiscardsUnsavedColor": 1.0, "functional#behaviorRecipientContextReachesBothBoundaries": 1.0, "functional#behaviorGlobalContextRemainsGlobal": 1.0, "functional#behaviorViewRecreationRetainsEditing": 1.0, "functional#regressionSelectionEntryRemainsUsableAfterCancel": 1.0, "functional#behaviorWallpaperReachesLivePreview": 1.0, "functional#behaviorGradientGuidancePreferenceIsConsumed": 1.0, "functional#behaviorDarkThemeEditorStillEditsAndSaves": 1.0, "penalty#preview_view_unchanged": 1.0, "requirements#destination_has_no_legacy_editor": 1.0, "constraint#legacy_editor_code_removed": 1.0, "regression#legacy_editor_resources_removed": 0.0, "regression#editor_text_localized": 1.0, "cheating#no_prebuilt_binaries": 1.0, "cheating#foreign_language_files": 1.0, "cheating#static_gradle_test_hooks": 1.0, "cheating#static_test_identity": 1.0, "visual#solid_adjusted": 1.0, "visual#solid_new_color": 1.0, "visual#gradient_new_color": 1.0, "visual#gradient_edit": 1.0, "visual#solid_dark": 1.0, "visual#preview_card_background": 1.0 }, "scoring_breakdown": { "base_score": 1.0, "categories": { "functional": { "passed": 25, "total": 25, "weight": 0.5, "raw_weight": 0.5, "score": 1.0, "contribution": 0.5 }, "regression": { "passed": 17, "total": 17, "weight": 0.15, "raw_weight": 0.15, "score": 1.0, "contribution": 0.15 }, "requirements": { "passed": 1, "total": 1, "weight": 0.1, "raw_weight": 0.1, "score": 1.0, "contribution": 0.1 }, "visual": { "passed": 6, "total": 6, "weight": 0.25, "raw_weight": 0.25, "score": 1.0, "contribution": 0.25 }, "code_quality": { "passed": 0.9, "total": 1.0, "weight": 0.0, "raw_weight": 0.0, "score": 0.9, "contribution": 0.0, "violations_count": 2 } }, "multipliers_applied": [ { "name": "validate#regression#legacy_editor_resources_removed", "value": 0.95, "reasoning": "old editor resources still present: tooltip_arrow_up.9.png unchanged" } ], "logs": [ "WARNING: Test 'testPlayProdDebugUnitTest#Test migrationDefaultAddEntryIsCompose(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test migrationConfirmationUsesCompose(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorSwitchTabsSharesSelectedEdge(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorRotateGradientPersistsDirection(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorUsedColorConfirmWritesOnce(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorGradientStartPageAndSave(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorRecipientContextReachesBothBoundaries(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorGeneratedHueSaturationPairs(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorGlobalContextRemainsGlobal(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorNewSolidDefaults(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorDarkThemeEditorStillEditsAndSaves(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorGradientGuidancePreferenceIsConsumed(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorCancelThenChangeAndConfirmLatest(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorEditSolidLoadsAndKeepsIdentity(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test migrationGradientIsCompose(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorEdgesAreIndependentlyEditable(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorUsedColorCancelDoesNotWrite(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test migrationViewRecreationStillUsesCompose(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorSolidSliderBoundariesAndSave(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorWallpaperReachesLivePreview(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test regressionSelectionEntryRemainsUsableAfterCancel(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorBackDiscardsUnsavedColor(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorEditGradientLoadsBothColorsAndAngle(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorViewRecreationRetainsEditing(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorDelayedLoadUpdatesEditor(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored." ] }, "status_description": "Agent created a patch that fails the validate.sh", "code_quality_score": 0.9, "code_quality_violations": 2 }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436diff --git a/app/lint-baseline.xml b/app/lint-baseline.xmlindex bdecdca..75fefeb 100644--- a/app/lint-baseline.xml+++ b/app/lint-baseline.xml@@ -35050,17 +35050,6 @@ column="7"/> </issue> - <issue- id="ClickableViewAccessibility"- message="Custom view `CustomChatColorGradientToolView` overrides `onTouchEvent` but not `performClick`"- errorLine1=" override fun onTouchEvent(event: MotionEvent): Boolean {"- errorLine2=" ~~~~~~~~~~~~">- <location- file="src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorGradientToolView.kt"- line="151"- column="16"/>- </issue>- <issue id="ClickableViewAccessibility" message="Custom view `HackyViewPager` overrides `onTouchEvent` but not `performClick`"diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorCreatorFragment.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorCreatorFragment.ktindex 660666b..b95d0ff 100644--- a/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorCreatorFragment.kt+++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorCreatorFragment.kt@@ -2,41 +2,137 @@ package org.thoughtcrime.securesms.conversation.colors.ui.custom import android.os.Bundle import android.view.View-import androidx.appcompat.widget.Toolbar-import androidx.fragment.app.Fragment-import androidx.navigation.Navigation-import androidx.viewpager2.widget.ViewPager2-import com.google.android.material.tabs.TabLayout-import com.google.android.material.tabs.TabLayoutMediator-import org.thoughtcrime.securesms.R+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.MutableState+import androidx.compose.runtime.getValue+import androidx.compose.runtime.livedata.observeAsState+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.saveable.rememberSaveable+import androidx.compose.runtime.setValue+import androidx.fragment.app.viewModels+import androidx.navigation.fragment.findNavController+import org.signal.core.ui.compose.ComposeFragment+import org.thoughtcrime.securesms.conversation.colors.ChatColors+import org.thoughtcrime.securesms.conversation.colors.ui.ChatColorSelectionViewModel+import org.thoughtcrime.securesms.keyvalue.SignalStore -class CustomChatColorCreatorFragment : Fragment(R.layout.custom_chat_color_creator_fragment) {+/**+ * Creates a new custom chat color, or edits an existing one.+ */+class CustomChatColorCreatorFragment : ComposeFragment() {++ private val args: CustomChatColorCreatorFragmentArgs by lazy {+ CustomChatColorCreatorFragmentArgs.fromBundle(requireArguments())+ }++ private val viewModel: CustomChatColorCreatorViewModel by viewModels(+ factoryProducer = {+ CustomChatColorCreatorViewModel.Factory(+ MAX_SLIDER_VALUE,+ ChatColors.Id.forLongValue(args.chatColorId),+ args.recipientId,+ CustomChatColorCreatorRepository(requireContext())+ )+ }+ )++ /** The number of chats using the color, while the user is asked to confirm saving changes to it. */+ private var usageWarning: Int? by mutableStateOf(null)++ /** Set once the editor starts leaving, so that it saves at most once and only leaves once. */+ private var isClosing = false override fun onViewCreated(view: View, savedInstanceState: Bundle?) {- val toolbar: Toolbar = view.findViewById(R.id.toolbar)- val tabLayout: TabLayout = view.findViewById(R.id.tab_layout)- val pager: ViewPager2 = view.findViewById(R.id.pager)- val adapter = CustomChatColorPagerAdapter(this, requireArguments())- val tabLayoutMediator = TabLayoutMediator(tabLayout, pager) { tab, position ->- tab.setText(- if (position == 0) {- R.string.CustomChatColorCreatorFragment__solid- } else {- R.string.CustomChatColorCreatorFragment__gradient- }+ super.onViewCreated(view, savedInstanceState)++ viewModel.events.observe(viewLifecycleOwner) { event ->+ when (event) {+ is CustomChatColorCreatorViewModel.Event.SaveNow -> save(event.chatColors)+ is CustomChatColorCreatorViewModel.Event.Warn -> if (!isClosing) usageWarning = event.usageCount+ }+ }+ }++ @Composable+ override fun FragmentContent() {+ val state: CustomChatColorCreatorState? by viewModel.state.observeAsState()+ val selectedTab: MutableState<CustomChatColorCreatorTab> = rememberSaveable { mutableStateOf(CustomChatColorCreatorTab.fromStartPage(args.startPage)) }+ val showGradientTip: MutableState<Boolean> = rememberSaveable { mutableStateOf(false) }+ val callbacks = remember { Callbacks(selectedTab, showGradientTip) }++ LaunchedEffect(selectedTab.value) {+ if (selectedTab.value == CustomChatColorCreatorTab.GRADIENT && SignalStore.chatColors.shouldShowGradientTooltip) {+ SignalStore.chatColors.shouldShowGradientTooltip = false+ showGradientTip.value = true+ }+ }++ state?.let {+ CustomChatColorCreatorScreen(+ state = it,+ selectedTab = selectedTab.value,+ callbacks = callbacks,+ showGradientTip = showGradientTip.value,+ usageWarning = usageWarning ) }+ } - toolbar.setNavigationOnClickListener {- Navigation.findNavController(it).popBackStack()+ private fun save(chatColors: ChatColors) {+ if (isClosing) {+ return } - pager.isUserInputEnabled = false- pager.adapter = adapter+ val chatColorSelectionViewModel = ChatColorSelectionViewModel.getOrCreate(requireActivity(), args.recipientId)+ viewModel.saveNow(chatColors) { savedColors ->+ chatColorSelectionViewModel.save(savedColors)+ } - tabLayoutMediator.attach()+ close()+ } - val startPage = CustomChatColorCreatorFragmentArgs.fromBundle(requireArguments()).startPage- pager.setCurrentItem(startPage, false)+ private fun close() {+ if (!isClosing) {+ isClosing = true+ findNavController().popBackStack()+ }+ }++ private inner class Callbacks(+ private val selectedTab: MutableState<CustomChatColorCreatorTab>,+ private val showGradientTip: MutableState<Boolean>+ ) : CustomChatColorCreatorScreenCallbacks {+ override fun onNavigationClick() = close()++ override fun onTabSelected(tab: CustomChatColorCreatorTab) {+ selectedTab.value = tab+ showGradientTip.value = false+ }++ override fun onHueChange(huePosition: Int) = viewModel.setHueProgress(huePosition)++ override fun onSaturationChange(saturationPosition: Int) = viewModel.setSaturationProgress(saturationPosition)++ override fun onSelectedEdgeChange(edge: CustomChatColorEdge) = viewModel.setSelectedEdge(edge)++ override fun onDegreesChange(degrees: Float) = viewModel.setDegrees(degrees)++ override fun onSaveClick(chatColors: ChatColors) {+ if (!isClosing) {+ viewModel.startSave(chatColors)+ }+ }++ override fun onSaveConfirmed(chatColors: ChatColors) = save(chatColors)++ override fun onUsageWarningDismissed() {+ usageWarning = null+ }++ override fun onGradientTipDismissed() {+ showGradientTip.value = false+ } } }diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorCreatorPageFragment.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorCreatorPageFragment.ktdeleted file mode 100644index 08ca86c..0000000--- a/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorCreatorPageFragment.kt+++ /dev/null@@ -1,400 +0,0 @@-package org.thoughtcrime.securesms.conversation.colors.ui.custom--import android.content.Context-import android.graphics.Canvas-import android.graphics.Color-import android.graphics.ColorFilter-import android.graphics.Paint-import android.graphics.Path-import android.graphics.PixelFormat-import android.graphics.PointF-import android.graphics.RectF-import android.graphics.drawable.Drawable-import android.graphics.drawable.GradientDrawable-import android.os.Build-import android.os.Bundle-import android.view.View-import android.view.ViewGroup-import android.widget.PopupWindow-import android.widget.ScrollView-import android.widget.SeekBar-import androidx.annotation.ColorInt-import androidx.annotation.Dimension-import androidx.appcompat.widget.AppCompatSeekBar-import androidx.core.content.ContextCompat-import androidx.core.graphics.ColorUtils-import androidx.fragment.app.Fragment-import androidx.lifecycle.ViewModelProvider-import androidx.navigation.Navigation-import com.google.android.material.dialog.MaterialAlertDialogBuilder-import org.signal.core.util.Util-import org.thoughtcrime.securesms.R-import org.thoughtcrime.securesms.conversation.colors.ChatColors-import org.thoughtcrime.securesms.conversation.colors.ui.ChatColorPreviewView-import org.thoughtcrime.securesms.conversation.colors.ui.ChatColorSelectionViewModel-import org.thoughtcrime.securesms.keyvalue.SignalStore-import org.thoughtcrime.securesms.util.ViewUtil-import org.thoughtcrime.securesms.util.customizeOnDraw--private const val MAX_SEEK_DIVISIONS = 1023-private const val MAX_HUE = 360--private const val PAGE_ARG = "page"-private const val SINGLE_PAGE = 0-private const val GRADIENT_PAGE = 1--class CustomChatColorCreatorPageFragment :- Fragment(R.layout.custom_chat_color_creator_fragment_page) {-- private lateinit var hueSlider: AppCompatSeekBar- private lateinit var saturationSlider: AppCompatSeekBar- private lateinit var preview: ChatColorPreviewView-- override fun onViewCreated(view: View, savedInstanceState: Bundle?) {- val args: CustomChatColorCreatorFragmentArgs = CustomChatColorCreatorFragmentArgs.fromBundle(requireArguments())- val chatColorSelectionViewModel: ChatColorSelectionViewModel = ChatColorSelectionViewModel.getOrCreate(requireActivity(), args.recipientId)- val page: Int = requireArguments().getInt(PAGE_ARG)- val factory: CustomChatColorCreatorViewModel.Factory = CustomChatColorCreatorViewModel.Factory(MAX_SEEK_DIVISIONS, ChatColors.Id.forLongValue(args.chatColorId), args.recipientId, createRepository())- val viewModel: CustomChatColorCreatorViewModel = ViewModelProvider(- requireParentFragment(),- factory- )[CustomChatColorCreatorViewModel::class.java]-- preview = view.findViewById(R.id.chat_color_preview)-- val hueThumb = ThumbDrawable(requireContext())- val saturationThumb = ThumbDrawable(requireContext())-- val gradientTool: CustomChatColorGradientToolView = view.findViewById(R.id.gradient_tool)- val save: View = view.findViewById(R.id.save)- val scrollView: ScrollView = view.findViewById(R.id.scroll_view)-- if (page == SINGLE_PAGE) {- gradientTool.visibility = View.GONE- } else {- gradientTool.setListener(object : CustomChatColorGradientToolView.Listener {- override fun onGestureStarted() {- scrollView.requestDisallowInterceptTouchEvent(true)- }-- override fun onGestureFinished() {- scrollView.requestDisallowInterceptTouchEvent(false)- }-- override fun onDegreesChanged(degrees: Float) {- viewModel.setDegrees(degrees)- }-- override fun onSelectedEdgeChanged(edge: CustomChatColorEdge) {- viewModel.setSelectedEdge(edge)- }- })- }-- hueSlider = view.findViewById(R.id.hue_slider)- saturationSlider = view.findViewById(R.id.saturation_slider)-- hueSlider.thumb = hueThumb- saturationSlider.thumb = saturationThumb-- hueSlider.max = MAX_SEEK_DIVISIONS- saturationSlider.max = MAX_SEEK_DIVISIONS-- val colors: IntArray = (0..MAX_SEEK_DIVISIONS).map { hue ->- ColorUtils.HSLToColor(- floatArrayOf(- hue.toHue(MAX_SEEK_DIVISIONS),- 1f,- calculateLightness(hue.toFloat(), valueFor60To80 = 0.4f)- )- )- }.toIntArray()-- val hueGradientDrawable = GradientDrawable(GradientDrawable.Orientation.LEFT_RIGHT, colors)-- hueSlider.progressDrawable = hueGradientDrawable.forSeekBar()-- val saturationProgressDrawable = GradientDrawable().apply {- orientation = GradientDrawable.Orientation.LEFT_RIGHT- }-- saturationSlider.progressDrawable = saturationProgressDrawable.forSeekBar()-- hueSlider.setOnSeekBarChangeListener(- OnProgressChangedListener {- viewModel.setHueProgress(it)- }- )-- saturationSlider.setOnSeekBarChangeListener(- OnProgressChangedListener {- viewModel.setSaturationProgress(it)- }- )-- viewModel.events.observe(viewLifecycleOwner) { event ->- when (event) {- is CustomChatColorCreatorViewModel.Event.SaveNow -> {- viewModel.saveNow(event.chatColors) { colors ->- chatColorSelectionViewModel.save(colors)- }- Navigation.findNavController(requireParentFragment().requireView()).popBackStack()- }- is CustomChatColorCreatorViewModel.Event.Warn -> MaterialAlertDialogBuilder(requireContext())- .setTitle(R.string.CustomChatColorCreatorFragmentPage__edit_color)- .setMessage(resources.getQuantityString(R.plurals.CustomChatColorCreatorFragmentPage__this_color_is_used, event.usageCount, event.usageCount))- .setPositiveButton(R.string.save) { dialog, _ ->- dialog.dismiss()- viewModel.saveNow(event.chatColors) { colors ->- chatColorSelectionViewModel.save(colors)- }- Navigation.findNavController(requireParentFragment().requireView()).popBackStack()- }- .setNegativeButton(android.R.string.cancel) { dialog, _ ->- dialog.dismiss()- }- .show()- }- }-- viewModel.state.observe(viewLifecycleOwner) { state ->- if (state.loading) {- return@observe- }-- val sliderState: ColorSlidersState = requireNotNull(state.sliderStates[state.selectedEdge])-- hueSlider.progress = sliderState.huePosition- saturationSlider.progress = sliderState.saturationPosition-- val color: Int = sliderState.getColor()- hueThumb.setColor(sliderState.getHueColor())- saturationThumb.setColor(color)- saturationProgressDrawable.colors = sliderState.getSaturationColors()-- preview.setWallpaper(state.wallpaper)-- if (page == 0) {- val chatColor = ChatColors.forColor(ChatColors.Id.NotSet, color)- preview.setChatColors(chatColor)- save.setOnClickListener {- viewModel.startSave(chatColor)- }- } else {- val topEdgeColor: ColorSlidersState = requireNotNull(state.sliderStates[CustomChatColorEdge.TOP])- val bottomEdgeColor: ColorSlidersState = requireNotNull(state.sliderStates[CustomChatColorEdge.BOTTOM])- val chatColor: ChatColors = ChatColors.forGradient(- ChatColors.Id.NotSet,- ChatColors.LinearGradient(- state.degrees,- intArrayOf(topEdgeColor.getColor(), bottomEdgeColor.getColor()),- floatArrayOf(0f, 1f)- )- )- preview.setChatColors(chatColor)- gradientTool.setSelectedEdge(state.selectedEdge)- gradientTool.setDegrees(state.degrees)- gradientTool.setTopColor(topEdgeColor.getColor())- gradientTool.setBottomColor(bottomEdgeColor.getColor())- save.setOnClickListener {- viewModel.startSave(chatColor)- }- }- }-- if (page == 1 && SignalStore.chatColors.shouldShowGradientTooltip) {- view.post {- SignalStore.chatColors.shouldShowGradientTooltip = false- val contentView = layoutInflater.inflate(R.layout.gradient_tool_tooltip, view as ViewGroup, false)- val popupWindow = PopupWindow(contentView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)-- popupWindow.isOutsideTouchable = false- popupWindow.isFocusable = true-- if (Build.VERSION.SDK_INT > 21) {- popupWindow.elevation = ViewUtil.dpToPx(8).toFloat()- }-- popupWindow.showAsDropDown(gradientTool, 0, -gradientTool.measuredHeight + ViewUtil.dpToPx(48))- }- }- }-- private fun createRepository(): CustomChatColorCreatorRepository {- return CustomChatColorCreatorRepository(requireContext())- }-- @ColorInt- private fun ColorSlidersState.getHueColor(): Int {- val hue = huePosition.toHue(MAX_SEEK_DIVISIONS)- return ColorUtils.HSLToColor(- floatArrayOf(- hue,- 1f,- calculateLightness(hue, 0.4f)- )- )- }-- @ColorInt- private fun ColorSlidersState.getColor(): Int {- val hue = huePosition.toHue(MAX_SEEK_DIVISIONS)- return ColorUtils.HSLToColor(- floatArrayOf(- hue,- saturationPosition.toUnit(MAX_SEEK_DIVISIONS),- calculateLightness(hue)- )- )- }-- private fun ColorSlidersState.getSaturationColors(): IntArray {- val hue = huePosition.toHue(MAX_SEEK_DIVISIONS)- val level = calculateLightness(hue)-- return listOf(0f, 1f).map {- ColorUtils.HSLToColor(- floatArrayOf(- hue,- it,- level- )- )- }.toIntArray()- }-- private fun calculateLightness(hue: Float, valueFor60To80: Float = 0.3f): Float {- val point1 = PointF()- val point2 = PointF()-- if (hue >= 0f && hue < 60f) {- point1.set(0f, 0.45f)- point2.set(60f, valueFor60To80)- } else if (hue >= 60f && hue < 180f) {- return valueFor60To80- } else if (hue >= 180f && hue < 240f) {- point1.set(180f, valueFor60To80)- point2.set(240f, 0.5f)- } else if (hue >= 240f && hue < 300f) {- point1.set(240f, 0.5f)- point2.set(300f, 0.4f)- } else if (hue >= 300f && hue < 360f) {- point1.set(300f, 0.4f)- point2.set(360f, 0.45f)- } else {- return 0.45f- }-- return interpolate(point1, point2, hue)- }-- private fun interpolate(point1: PointF, point2: PointF, x: Float): Float {- return ((point1.y * (point2.x - x)) + (point2.y * (x - point1.x))) / (point2.x - point1.x)- }-- private fun Number.toHue(max: Number): Float {- return Util.clamp(toFloat() * (MAX_HUE / max.toFloat()), 0f, MAX_HUE.toFloat())- }-- private fun Number.toUnit(max: Number): Float {- return Util.clamp(toFloat() / max.toFloat(), 0f, 1f)- }-- private fun Drawable.forSeekBar(): Drawable {- val height: Int = ViewUtil.dpToPx(8)- val radii: FloatArray = (1..8).map { 50f }.toFloatArray()- val bounds = RectF()- val clipPath = Path()-- return customizeOnDraw { wrapped, canvas ->- canvas.save()- bounds.set(this.bounds)- bounds.inset(0f, (height / 2f) + 1)-- clipPath.rewind()- clipPath.addRoundRect(bounds, radii, Path.Direction.CW)-- canvas.clipPath(clipPath)- wrapped.draw(canvas)- canvas.restore()- }- }-- private class OnProgressChangedListener(private val updateFn: (Int) -> Unit) :- SeekBar.OnSeekBarChangeListener {- override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {- updateFn(progress)- }-- override fun onStartTrackingTouch(seekBar: SeekBar?) = Unit- override fun onStopTrackingTouch(seekBar: SeekBar?) = Unit- }-- private class ThumbDrawable(context: Context) : Drawable() {-- private val borderPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {- color = ContextCompat.getColor(context, R.color.signal_background_primary)- }-- private val paint = Paint(Paint.ANTI_ALIAS_FLAG).apply {- color = Color.TRANSPARENT- }-- private val borderWidth: Int = ViewUtil.dpToPx(THUMB_MARGIN)- private val thumbInnerSize: Int = ViewUtil.dpToPx(THUMB_INNER_SIZE)- private val innerRadius: Float = thumbInnerSize / 2f- private val thumbSize: Float = (thumbInnerSize + borderWidth).toFloat()- private val thumbRadius: Float = thumbSize / 2f-- override fun getIntrinsicHeight(): Int = ViewUtil.dpToPx(48)-- override fun getIntrinsicWidth(): Int = ViewUtil.dpToPx(48)-- fun setColor(@ColorInt color: Int) {- paint.color = color- invalidateSelf()- }-- override fun draw(canvas: Canvas) {- canvas.drawCircle(- (bounds.width() / 2f) + bounds.left,- (bounds.height() / 2f) + bounds.top,- thumbRadius,- borderPaint- )- canvas.drawCircle(- (bounds.width() / 2f) + bounds.left,- (bounds.height() / 2f) + bounds.top,- innerRadius,- paint- )- }-- override fun setAlpha(alpha: Int) = Unit- override fun setColorFilter(colorFilter: ColorFilter?) = Unit-- override fun getOpacity(): Int = PixelFormat.TRANSPARENT-- companion object {- @Dimension(unit = Dimension.DP)- private val THUMB_INNER_SIZE = 16-- @Dimension(unit = Dimension.DP)- private val THUMB_MARGIN = 1- }- }-- companion object {-- fun forSingle(bundle: Bundle): Fragment = forPage(SINGLE_PAGE, bundle)-- fun forGradient(bundle: Bundle): Fragment = forPage(GRADIENT_PAGE, bundle)-- private fun forPage(page: Int, bundle: Bundle): Fragment = CustomChatColorCreatorPageFragment().apply {- arguments = Bundle().apply {- putInt(PAGE_ARG, page)- putAll(bundle)- }- }- }-}diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorCreatorScreen.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorCreatorScreen.ktnew file mode 100644index 0000000..40deca9--- /dev/null+++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorCreatorScreen.kt@@ -0,0 +1,602 @@+/*+ * Copyright 2026 Signal Messenger, LLC+ * SPDX-License-Identifier: AGPL-3.0-only+ */++package org.thoughtcrime.securesms.conversation.colors.ui.custom++import android.view.LayoutInflater+import androidx.annotation.ColorInt+import androidx.annotation.StringRes+import androidx.compose.foundation.Canvas+import androidx.compose.foundation.background+import androidx.compose.foundation.gestures.awaitEachGesture+import androidx.compose.foundation.gestures.awaitFirstDown+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.BoxWithConstraints+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Spacer+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.widthIn+import androidx.compose.foundation.layout.wrapContentHeight+import androidx.compose.foundation.rememberScrollState+import androidx.compose.foundation.shape.GenericShape+import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.foundation.verticalScroll+import androidx.compose.material3.Card+import androidx.compose.material3.ExperimentalMaterial3Api+import androidx.compose.material3.Icon+import androidx.compose.material3.IconButton+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.PrimaryTabRow+import androidx.compose.material3.Scaffold+import androidx.compose.material3.Slider+import androidx.compose.material3.Tab+import androidx.compose.material3.TabRowDefaults+import androidx.compose.material3.Text+import androidx.compose.material3.TopAppBar+import androidx.compose.runtime.Composable+import androidx.compose.runtime.CompositionLocalProvider+import androidx.compose.runtime.remember+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.geometry.CornerRadius+import androidx.compose.ui.graphics.Brush+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.graphics.toArgb+import androidx.compose.ui.input.pointer.PointerEventPass+import androidx.compose.ui.input.pointer.pointerInput+import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.platform.LocalInspectionMode+import androidx.compose.ui.platform.LocalLayoutDirection+import androidx.compose.ui.res.colorResource+import androidx.compose.ui.res.pluralStringResource+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.semantics.ProgressBarRangeInfo+import androidx.compose.ui.semantics.clearAndSetSemantics+import androidx.compose.ui.semantics.contentDescription+import androidx.compose.ui.semantics.disabled+import androidx.compose.ui.semantics.progressBarRangeInfo+import androidx.compose.ui.semantics.semantics+import androidx.compose.ui.semantics.setProgress+import androidx.compose.ui.text.font.FontWeight+import androidx.compose.ui.unit.Dp+import androidx.compose.ui.unit.LayoutDirection+import androidx.compose.ui.unit.dp+import androidx.compose.ui.unit.sp+import androidx.compose.ui.viewinterop.AndroidView+import androidx.core.graphics.ColorUtils+import com.google.android.material.color.MaterialColors+import org.signal.core.ui.compose.Buttons+import org.signal.core.ui.compose.DayNightPreviews+import org.signal.core.ui.compose.Dialogs+import org.signal.core.ui.compose.Previews+import org.signal.core.ui.compose.SignalIcons+import org.signal.core.util.Util+import org.thoughtcrime.securesms.R+import org.thoughtcrime.securesms.conversation.colors.ChatColors+import org.thoughtcrime.securesms.conversation.colors.ui.ChatColorPreviewView+import org.thoughtcrime.securesms.wallpaper.ChatWallpaper+import java.util.EnumMap+import kotlin.math.roundToInt++/** The largest position of the hue and saturation sliders. */+internal const val MAX_SLIDER_VALUE = 1023++private const val MAX_HUE = 360++private val GRADIENT_TOOL_MARGIN = 10.dp+private val GRADIENT_TIP_OFFSET = 48.dp+private val SLIDER_THUMB_SIZE = 17.dp+private val SLIDER_THUMB_INNER_RADIUS = 8.dp+private val SLIDER_TRACK_HEIGHT = 8.dp++/** Lines the slider tracks up 16dp in from the edges of the screen, accounting for the half of the thumb that hangs past them. */+private val SLIDER_HORIZONTAL_PADDING = 16.dp - SLIDER_THUMB_SIZE / 2++/**+ * The editor's tabs, in the order of the `start_page` navigation argument.+ */+enum class CustomChatColorCreatorTab(@StringRes val label: Int) {+ SOLID(R.string.CustomChatColorCreatorFragment__solid),+ GRADIENT(R.string.CustomChatColorCreatorFragment__gradient);++ companion object {+ fun fromStartPage(startPage: Int): CustomChatColorCreatorTab = entries[startPage.coerceIn(0, entries.lastIndex)]+ }+}++interface CustomChatColorCreatorScreenCallbacks {+ fun onNavigationClick() = Unit+ fun onTabSelected(tab: CustomChatColorCreatorTab) = Unit+ fun onHueChange(huePosition: Int) = Unit+ fun onSaturationChange(saturationPosition: Int) = Unit+ fun onSelectedEdgeChange(edge: CustomChatColorEdge) = Unit+ fun onDegreesChange(degrees: Float) = Unit+ fun onSaveClick(chatColors: ChatColors) = Unit+ fun onSaveConfirmed(chatColors: ChatColors) = Unit+ fun onUsageWarningDismissed() = Unit+ fun onGradientTipDismissed() = Unit++ object Empty : CustomChatColorCreatorScreenCallbacks+}++/**+ * Creates or edits a custom chat color, as either a solid color or a gradient, with a live preview over the chat's wallpaper.+ *+ * @param showGradientTip Whether to explain how to use the gradient tool. Any touch dismisses it.+ * @param usageWarning When not null, the number of chats already using the color, which the user has to confirm before saving changes to it.+ */+@Composable+fun CustomChatColorCreatorScreen(+ state: CustomChatColorCreatorState,+ selectedTab: CustomChatColorCreatorTab,+ callbacks: CustomChatColorCreatorScreenCallbacks,+ showGradientTip: Boolean = false,+ usageWarning: Int? = null+) {+ val chatColors: ChatColors = state.toChatColors(selectedTab)+ val selectedSliders: ColorSlidersState = requireNotNull(state.sliderStates[state.selectedEdge])+ val hueTrack: Brush = remember { Brush.horizontalGradient(hueTrackColors()) }++ Scaffold(+ topBar = { TopBar(onNavigationClick = callbacks::onNavigationClick) },+ modifier = Modifier.dismissOnTouch(enabled = showGradientTip, onDismiss = callbacks::onGradientTipDismissed)+ ) { contentPadding ->+ Column(modifier = Modifier.padding(contentPadding)) {+ Tabs(+ selectedTab = selectedTab,+ onTabSelected = callbacks::onTabSelected+ )++ BoxWithConstraints(modifier = Modifier.weight(1f)) {+ Column(+ modifier = Modifier+ .verticalScroll(rememberScrollState())+ .heightIn(min = maxHeight)+ ) {+ Box {+ ChatColorPreview(+ wallpaper = state.wallpaper,+ chatColors = if (state.loading) null else chatColors,+ modifier = Modifier+ .fillMaxWidth()+ .padding(16.dp)+ )++ if (selectedTab == CustomChatColorCreatorTab.GRADIENT && !state.loading) {+ CustomChatColorGradientTool(+ degrees = state.degrees,+ selectedEdge = state.selectedEdge,+ topColor = Color(requireNotNull(state.sliderStates[CustomChatColorEdge.TOP]).getColor()),+ bottomColor = Color(requireNotNull(state.sliderStates[CustomChatColorEdge.BOTTOM]).getColor()),+ onSelectedEdgeChange = callbacks::onSelectedEdgeChange,+ onDegreesChange = callbacks::onDegreesChange,+ modifier = Modifier+ .matchParentSize()+ .padding(GRADIENT_TOOL_MARGIN)+ )+ }++ if (selectedTab == CustomChatColorCreatorTab.GRADIENT && showGradientTip) {+ GradientTip(+ modifier = Modifier+ .align(Alignment.TopCenter)+ .padding(top = GRADIENT_TOOL_MARGIN + GRADIENT_TIP_OFFSET)+ )+ }+ }++ ColorSlider(+ label = stringResource(R.string.CustomChatColorCreatorFragment__hue),+ position = selectedSliders.huePosition,+ onPositionChange = callbacks::onHueChange,+ track = hueTrack,+ thumbColor = Color(selectedSliders.getHueColor()),+ enabled = !state.loading+ )++ ColorSlider(+ label = stringResource(R.string.CustomChatColorCreatorFragment__saturation),+ position = selectedSliders.saturationPosition,+ onPositionChange = callbacks::onSaturationChange,+ track = Brush.horizontalGradient(selectedSliders.getSaturationColors()),+ thumbColor = Color(selectedSliders.getColor()),+ enabled = !state.loading+ )++ Spacer(modifier = Modifier.weight(1f))++ Buttons.LargePrimary(+ onClick = { callbacks.onSaveClick(chatColors) },+ enabled = !state.loading,+ modifier = Modifier+ .align(Alignment.End)+ .padding(end = 16.dp, bottom = 16.dp)+ .widthIn(min = 88.dp)+ ) {+ Text(text = stringResource(R.string.CustomChatColorCreatorFragmentPage__save))+ }+ }+ }+ }+ }++ if (usageWarning != null) {+ Dialogs.SimpleAlertDialog(+ title = stringResource(R.string.CustomChatColorCreatorFragmentPage__edit_color),+ body = pluralStringResource(R.plurals.CustomChatColorCreatorFragmentPage__this_color_is_used, usageWarning, usageWarning),+ confirm = stringResource(R.string.save),+ dismiss = stringResource(android.R.string.cancel),+ onConfirm = { callbacks.onSaveConfirmed(chatColors) },+ onDismiss = callbacks::onUsageWarningDismissed+ )+ }+}++@OptIn(ExperimentalMaterial3Api::class)+@Composable+private fun TopBar(onNavigationClick: () -> Unit) {+ TopAppBar(+ title = {+ Text(+ text = stringResource(R.string.ChatColorSelectionFragment__chat_color),+ style = MaterialTheme.typography.titleLarge.copy(fontSize = 20.sp, fontWeight = FontWeight.Medium)+ )+ },+ navigationIcon = {+ IconButton(+ onClick = onNavigationClick,+ modifier = Modifier.padding(end = 4.dp)+ ) {+ Icon(+ imageVector = SignalIcons.ArrowStart.imageVector,+ contentDescription = stringResource(R.string.CallQualitySomethingElseScreen__back)+ )+ }+ },+ expandedHeight = 56.dp+ )+}++@Composable+private fun Tabs(+ selectedTab: CustomChatColorCreatorTab,+ onTabSelected: (CustomChatColorCreatorTab) -> Unit+) {+ // The tabs take the hosting activity's primary color, which in light mode differs from the Compose theme's.+ val context = LocalContext.current+ val defaultColor = MaterialTheme.colorScheme.primary+ val selectedColor = remember(context, defaultColor) {+ Color(MaterialColors.getColor(context, androidx.appcompat.R.attr.colorPrimary, defaultColor.toArgb()))+ }++ PrimaryTabRow(+ selectedTabIndex = selectedTab.ordinal,+ indicator = {+ TabRowDefaults.PrimaryIndicator(+ modifier = Modifier.tabIndicatorOffset(selectedTab.ordinal, matchContentSize = true),+ width = Dp.Unspecified,+ color = selectedColor+ )+ }+ ) {+ CustomChatColorCreatorTab.entries.forEach { tab ->+ Tab(+ selected = tab == selectedTab,+ onClick = { onTabSelected(tab) },+ text = { Text(text = stringResource(tab.label), style = MaterialTheme.typography.labelLarge) },+ selectedContentColor = selectedColor,+ unselectedContentColor = MaterialTheme.colorScheme.onSurfaceVariant+ )+ }+ }+}++/**+ * The shared [ChatColorPreviewView], showing four chat bubbles in the given colors over the wallpaper.+ */+@Composable+private fun ChatColorPreview(+ wallpaper: ChatWallpaper?,+ chatColors: ChatColors?,+ modifier: Modifier = Modifier+) {+ Card(+ shape = RoundedCornerShape(4.dp),+ modifier = modifier+ ) {+ if (LocalInspectionMode.current) {+ Spacer(+ modifier = Modifier+ .fillMaxWidth()+ .height(300.dp)+ )+ } else {+ AndroidView(+ factory = { context -> LayoutInflater.from(context).inflate(R.layout.custom_chat_color_creator_preview, null) as ChatColorPreviewView },+ update = { preview ->+ preview.setWallpaper(wallpaper)+ if (chatColors != null) {+ preview.setChatColors(chatColors)+ }+ },+ modifier = Modifier.fillMaxWidth()+ )+ }+ }+}++/**+ * A slider labelled by the text above it, which TalkBack reads as a single adjustable control.+ */+@OptIn(ExperimentalMaterial3Api::class)+@Composable+private fun ColorSlider(+ label: String,+ position: Int,+ onPositionChange: (Int) -> Unit,+ track: Brush,+ thumbColor: Color,+ enabled: Boolean,+ modifier: Modifier = Modifier+) {+ Column(+ modifier = modifier.semantics(mergeDescendants = true) {+ contentDescription = label+ progressBarRangeInfo = ProgressBarRangeInfo(position.toFloat(), 0f..MAX_SLIDER_VALUE.toFloat())+ if (enabled) {+ setProgress { value ->+ onPositionChange(value.coerceIn(0f, MAX_SLIDER_VALUE.toFloat()).roundToInt())+ true+ }+ } else {+ disabled()+ }+ }+ ) {+ Text(+ text = label,+ style = MaterialTheme.typography.labelLarge,+ color = MaterialTheme.colorScheme.onSurfaceVariant,+ modifier = Modifier+ .fillMaxWidth()+ .heightIn(min = 40.dp)+ .wrapContentHeight(Alignment.CenterVertically)+ .padding(horizontal = 16.dp)+ )++ // The track's colors always run left to right, so the slider must too.+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Ltr) {+ Slider(+ value = position.toFloat(),+ onValueChange = { onPositionChange(it.roundToInt()) },+ enabled = enabled,+ valueRange = 0f..MAX_SLIDER_VALUE.toFloat(),+ thumb = { SliderThumb(color = thumbColor) },+ track = { SliderTrack(brush = track) },+ modifier = Modifier+ .fillMaxWidth()+ .padding(horizontal = SLIDER_HORIZONTAL_PADDING)+ .clearAndSetSemantics { }+ )+ }+ }+}++@Composable+private fun SliderThumb(color: Color) {+ val borderColor = colorResource(R.color.signal_background_primary)++ Canvas(modifier = Modifier.size(SLIDER_THUMB_SIZE)) {+ drawCircle(borderColor)+ drawCircle(color, radius = SLIDER_THUMB_INNER_RADIUS.toPx())+ }+}++@Composable+private fun SliderTrack(brush: Brush) {+ Canvas(+ modifier = Modifier+ .fillMaxWidth()+ .height(SLIDER_TRACK_HEIGHT)+ ) {+ drawRoundRect(brush = brush, cornerRadius = CornerRadius(size.height / 2f))+ }+}++@Composable+private fun GradientTip(modifier: Modifier = Modifier) {+ val color = colorResource(R.color.signal_accent_primary)++ Column(+ horizontalAlignment = Alignment.CenterHorizontally,+ modifier = modifier.padding(horizontal = 12.dp)+ ) {+ Spacer(+ modifier = Modifier+ .size(width = 16.dp, height = 8.dp)+ .background(color = color, shape = TipArrowShape)+ )++ Text(+ text = stringResource(R.string.CustomChatColorCreatorFragment__drag_to_change_the_direction_of_the_gradient),+ style = MaterialTheme.typography.bodyLarge,+ color = Color.White,+ modifier = Modifier+ .widthIn(max = 295.dp)+ .background(color = color, shape = RoundedCornerShape(8.dp))+ .padding(horizontal = 12.dp, vertical = 10.dp)+ )+ }+}++private val TipArrowShape = GenericShape { size, _ ->+ moveTo(size.width / 2f, 0f)+ lineTo(size.width, size.height)+ lineTo(0f, size.height)+ close()+}++/**+ * Calls [onDismiss] as soon as anything is touched, without getting in the way of the touch.+ */+private fun Modifier.dismissOnTouch(enabled: Boolean, onDismiss: () -> Unit): Modifier {+ if (!enabled) {+ return this+ }++ return pointerInput(onDismiss) {+ awaitEachGesture {+ awaitFirstDown(requireUnconsumed = false, pass = PointerEventPass.Initial)+ onDismiss()+ }+ }+}++/**+ * The colors on screen for the given tab: on the solid tab, the color of the selected edge, and on the gradient tab, a gradient+ * from the top edge's color to the bottom edge's.+ */+private fun CustomChatColorCreatorState.toChatColors(tab: CustomChatColorCreatorTab): ChatColors {+ return when (tab) {+ CustomChatColorCreatorTab.SOLID -> {+ ChatColors.forColor(ChatColors.Id.NotSet, requireNotNull(sliderStates[selectedEdge]).getColor())+ }++ CustomChatColorCreatorTab.GRADIENT -> {+ val topEdge: ColorSlidersState = requireNotNull(sliderStates[CustomChatColorEdge.TOP])+ val bottomEdge: ColorSlidersState = requireNotNull(sliderStates[CustomChatColorEdge.BOTTOM])++ ChatColors.forGradient(+ ChatColors.Id.NotSet,+ ChatColors.LinearGradient(+ degrees,+ intArrayOf(topEdge.getColor(), bottomEdge.getColor()),+ floatArrayOf(0f, 1f)+ )+ )+ }+ }+}++@ColorInt+private fun ColorSlidersState.getColor(): Int {+ val hue = huePosition.toHue()+ return ColorUtils.HSLToColor(+ floatArrayOf(+ hue,+ saturationPosition.toUnit(),+ calculateLightness(hue)+ )+ )+}++@ColorInt+private fun ColorSlidersState.getHueColor(): Int {+ val hue = huePosition.toHue()+ return ColorUtils.HSLToColor(+ floatArrayOf(+ hue,+ 1f,+ calculateLightness(hue, valueFor60To180 = 0.4f)+ )+ )+}++private fun ColorSlidersState.getSaturationColors(): List<Color> {+ val hue = huePosition.toHue()+ val lightness = calculateLightness(hue)++ return listOf(0f, 1f).map { saturation ->+ Color(ColorUtils.HSLToColor(floatArrayOf(hue, saturation, lightness)))+ }+}++/**+ * The hue track's colors, one per slider position. Their lightness is looked up by slider position rather than by hue, which is how+ * the track has always been drawn.+ */+private fun hueTrackColors(): List<Color> {+ return (0..MAX_SLIDER_VALUE).map { position ->+ Color(+ ColorUtils.HSLToColor(+ floatArrayOf(+ position.toHue(),+ 1f,+ calculateLightness(position.toFloat(), valueFor60To180 = 0.4f)+ )+ )+ )+ }+}++private fun calculateLightness(hue: Float, valueFor60To180: Float = 0.3f): Float {+ return when {+ hue >= 0f && hue < 60f -> interpolate(0f, 0.45f, 60f, valueFor60To180, hue)+ hue >= 60f && hue < 180f -> valueFor60To180+ hue >= 180f && hue < 240f -> interpolate(180f, valueFor60To180, 240f, 0.5f, hue)+ hue >= 240f && hue < 300f -> interpolate(240f, 0.5f, 300f, 0.4f, hue)+ hue >= 300f && hue < 360f -> interpolate(300f, 0.4f, 360f, 0.45f, hue)+ else -> 0.45f+ }+}++/**+ * The value at [x] on the line through ([x1], [y1]) and ([x2], [y2]).+ */+private fun interpolate(x1: Float, y1: Float, x2: Float, y2: Float, x: Float): Float {+ return ((y1 * (x2 - x)) + (y2 * (x - x1))) / (x2 - x1)+}++private fun Number.toHue(): Float {+ return Util.clamp(toFloat() * (MAX_HUE / MAX_SLIDER_VALUE.toFloat()), 0f, MAX_HUE.toFloat())+}++private fun Number.toUnit(): Float {+ return Util.clamp(toFloat() / MAX_SLIDER_VALUE.toFloat(), 0f, 1f)+}++@DayNightPreviews+@Composable+private fun CustomChatColorCreatorScreenSolidPreview() {+ Previews.Preview {+ CustomChatColorCreatorScreen(+ state = previewState(),+ selectedTab = CustomChatColorCreatorTab.SOLID,+ callbacks = CustomChatColorCreatorScreenCallbacks.Empty+ )+ }+}++@DayNightPreviews+@Composable+private fun CustomChatColorCreatorScreenGradientPreview() {+ Previews.Preview {+ CustomChatColorCreatorScreen(+ state = previewState(),+ selectedTab = CustomChatColorCreatorTab.GRADIENT,+ callbacks = CustomChatColorCreatorScreenCallbacks.Empty,+ showGradientTip = true+ )+ }+}++private fun previewState(): CustomChatColorCreatorState {+ return CustomChatColorCreatorState(+ loading = false,+ wallpaper = null,+ sliderStates = EnumMap(+ mapOf(+ CustomChatColorEdge.TOP to ColorSlidersState(huePosition = 200, saturationPosition = 800),+ CustomChatColorEdge.BOTTOM to ColorSlidersState(huePosition = 700, saturationPosition = 600)+ )+ ),+ selectedEdge = CustomChatColorEdge.BOTTOM,+ degrees = 150f+ )+}diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorCreatorViewModel.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorCreatorViewModel.ktindex d044771..ad6ad14 100644--- a/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorCreatorViewModel.kt+++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorCreatorViewModel.kt@@ -77,7 +77,7 @@ class CustomChatColorCreatorViewModel( fun setHueProgress(progress: Int) { store.update { state -> state.copy(- sliderStates = state.sliderStates.apply {+ sliderStates = EnumMap(state.sliderStates).apply { val oldData: ColorSlidersState = requireNotNull(get(state.selectedEdge)) put(state.selectedEdge, oldData.copy(huePosition = progress)) }@@ -88,7 +88,7 @@ class CustomChatColorCreatorViewModel( fun setSaturationProgress(progress: Int) { store.update { state -> state.copy(- sliderStates = state.sliderStates.apply {+ sliderStates = EnumMap(state.sliderStates).apply { val oldData: ColorSlidersState = requireNotNull(get(state.selectedEdge)) put(state.selectedEdge, oldData.copy(saturationPosition = progress)) }diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorGradientTool.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorGradientTool.ktnew file mode 100644index 0000000..0dfee23--- /dev/null+++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorGradientTool.kt@@ -0,0 +1,160 @@+/*+ * Copyright 2026 Signal Messenger, LLC+ * SPDX-License-Identifier: AGPL-3.0-only+ */++package org.thoughtcrime.securesms.conversation.colors.ui.custom++import androidx.compose.foundation.Canvas+import androidx.compose.foundation.gestures.awaitEachGesture+import androidx.compose.foundation.gestures.awaitFirstDown+import androidx.compose.foundation.gestures.drag+import androidx.compose.runtime.Composable+import androidx.compose.runtime.getValue+import androidx.compose.runtime.rememberUpdatedState+import androidx.compose.ui.Modifier+import androidx.compose.ui.geometry.Offset+import androidx.compose.ui.geometry.Size+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.input.pointer.pointerInput+import androidx.compose.ui.res.colorResource+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.semantics.contentDescription+import androidx.compose.ui.semantics.semantics+import androidx.compose.ui.unit.dp+import androidx.compose.ui.unit.toSize+import org.thoughtcrime.securesms.R+import kotlin.math.abs+import kotlin.math.atan2+import kotlin.math.cos+import kotlin.math.min+import kotlin.math.sin++/** Distance from the tool's bounds to the outline the handles travel along, and how close a touch must be to grab a handle. */+private val HANDLE_TOUCH_RADIUS = 24.dp+private val HANDLE_RADIUS = 20.dp+private val HANDLE_BORDER = 1.dp+private val HANDLE_BORDER_SELECTED = 4.dp+private val HANDLE_PADDING = 2.dp+private val HANDLE_PADDING_SELECTED = 1.dp+private val PIPE_WIDTH = 6.dp+private val PIPE_BORDER = 1.dp++/**+ * Renders the gradient customization tool.+ *+ * The tool is two selectable handles on either side of a rectangle with a pipe connecting them, a TOP and a BOTTOM (an edge).+ *+ * Touching a handle selects its edge, and dragging it moves it around the outline of the rectangle while the other edge traces+ * along the opposite side.+ *+ * The handles are where a line through the center of the rectangle, at the tool's angle, crosses the outline. The tool's math+ * uses an origin at the center and measures angles counter-clockwise from a vector pointing directly towards the right hand side.+ * This doesn't line up with what the gradient rendering math requires, so degrees are converted when they come into or leave this+ * tool (see [invertDegrees]).+ */+@Composable+fun CustomChatColorGradientTool(+ degrees: Float,+ selectedEdge: CustomChatColorEdge,+ topColor: Color,+ bottomColor: Color,+ onSelectedEdgeChange: (CustomChatColorEdge) -> Unit,+ onDegreesChange: (Float) -> Unit,+ modifier: Modifier = Modifier+) {+ val label = stringResource(R.string.CustomChatColorCreatorFragment__gradient_direction)+ val backgroundColor = colorResource(R.color.signal_background_primary)+ val borderColor = colorResource(R.color.signal_inverse_transparent_10)+ val selectedBorderColor = colorResource(R.color.signal_inverse_transparent_60)++ val currentDegrees by rememberUpdatedState(degrees)+ val currentOnSelectedEdgeChange by rememberUpdatedState(onSelectedEdgeChange)+ val currentOnDegreesChange by rememberUpdatedState(onDegreesChange)++ Canvas(+ modifier = modifier+ .semantics { contentDescription = label }+ .pointerInput(Unit) {+ awaitEachGesture {+ val down = awaitFirstDown()+ val handles = GradientHandles(size.toSize(), HANDLE_TOUCH_RADIUS.toPx(), currentDegrees)+ val edge = handles.edgeAt(down.position, HANDLE_TOUCH_RADIUS.toPx()) ?: return@awaitEachGesture++ down.consume()+ currentOnSelectedEdgeChange(edge)++ drag(down.id) { change ->+ change.consume()+ currentOnDegreesChange(handles.degreesTowards(change.position, edge))+ }+ }+ }+ ) {+ val handles = GradientHandles(size, HANDLE_TOUCH_RADIUS.toPx(), degrees)++ val (selected, other) = when (selectedEdge) {+ CustomChatColorEdge.TOP -> handles.top to handles.bottom+ CustomChatColorEdge.BOTTOM -> handles.bottom to handles.top+ }++ val (selectedColor, otherColor) = when (selectedEdge) {+ CustomChatColorEdge.TOP -> topColor to bottomColor+ CustomChatColorEdge.BOTTOM -> bottomColor to topColor+ }++ drawLine(borderColor, selected, other, strokeWidth = PIPE_WIDTH.toPx())+ drawLine(backgroundColor, selected, other, strokeWidth = (PIPE_WIDTH - PIPE_BORDER * 2).toPx())++ drawCircle(borderColor, radius = (HANDLE_RADIUS + HANDLE_BORDER).toPx(), center = other)+ drawCircle(backgroundColor, radius = HANDLE_RADIUS.toPx(), center = other)+ drawCircle(otherColor, radius = (HANDLE_RADIUS - HANDLE_PADDING).toPx(), center = other)++ drawCircle(selectedBorderColor, radius = (HANDLE_RADIUS + HANDLE_BORDER_SELECTED).toPx(), center = selected)+ drawCircle(backgroundColor, radius = HANDLE_RADIUS.toPx(), center = selected)+ drawCircle(selectedColor, radius = (HANDLE_RADIUS - HANDLE_PADDING_SELECTED).toPx(), center = selected)+ }+}++/**+ * Where the handles sit for the given gradient [degrees], within a tool of the given [size] whose outline is inset by [inset].+ */+private class GradientHandles(size: Size, inset: Float, degrees: Float) {++ private val center = Offset(size.width / 2f, size.height / 2f)++ val top: Offset+ val bottom: Offset++ init {+ val radians = degrees.invertDegrees().toRadians()+ val direction = Offset(cos(radians), -sin(radians))+ val distance = min((center.x - inset) / abs(direction.x), (center.y - inset) / abs(direction.y)).coerceAtLeast(0f)++ top = center + direction * distance+ bottom = center - direction * distance+ }++ fun edgeAt(position: Offset, radius: Float): CustomChatColorEdge? {+ return when {+ (position - top).getDistance() <= radius -> CustomChatColorEdge.TOP+ (position - bottom).getDistance() <= radius -> CustomChatColorEdge.BOTTOM+ else -> null+ }+ }++ /**+ * The gradient degrees that point the given [edge] towards [position].+ */+ fun degreesTowards(position: Offset, edge: CustomChatColorEdge): Float {+ val offset = if (edge == CustomChatColorEdge.BOTTOM) 180f else 0f+ val toolDegrees = (atan2(center.y - position.y, position.x - center.x).toDegrees() + 360f + offset) % 360f++ return toolDegrees.invertDegrees()+ }+}++private fun Float.invertDegrees(): Float = 360f - rotate(90f)+private fun Float.rotate(degrees: Float): Float = (this + degrees + 360f) % 360f+private fun Float.toDegrees(): Float = this * (180f / Math.PI.toFloat())+private fun Float.toRadians(): Float = this * (Math.PI.toFloat() / 180f)diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorGradientToolView.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorGradientToolView.ktdeleted file mode 100644index 77d4c66..0000000--- a/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorGradientToolView.kt+++ /dev/null@@ -1,347 +0,0 @@-package org.thoughtcrime.securesms.conversation.colors.ui.custom--import android.content.Context-import android.graphics.Canvas-import android.graphics.Color-import android.graphics.Paint-import android.graphics.PointF-import android.graphics.Rect-import android.graphics.RectF-import android.util.AttributeSet-import android.view.GestureDetector-import android.view.MotionEvent-import android.view.View-import androidx.annotation.ColorInt-import androidx.annotation.Dimension-import androidx.core.content.ContextCompat-import org.thoughtcrime.securesms.R-import org.thoughtcrime.securesms.util.ViewUtil-import kotlin.math.abs-import kotlin.math.atan-import kotlin.math.atan2-import kotlin.math.pow-import kotlin.math.sqrt-import kotlin.math.tan--/**- * Renders the gradient customization tool.- *- * The Gradient customization tool is two selectable circles on either side- * of a rectangle with a pipe connecting them, a TOP and a BOTTOM (an edge)- *- * The user can then swap between the selected edge via a touch-down and can- * drag the selected edge such that it traces around the outline of the square.- * The other edge traces along the opposite side of the rectangle.- *- * The way the position along the edge is determined is by dividing the rectangle- * into 8 right-angled triangles, all joining at the center. Using the specified- * angle, we can determine which "octant" the top edge should be in, and can- * determine its distance from the center point of the relevant edge, and use- * similar logic to determine where the bottom edge lies.- *- * All of the math assumes an origin at the dead center of the view, and- * that 0deg corresponds to a vector pointing directly towards the right hand- * side of the view. This doesn't quite line up with what the gradient rendering- * math requires, so we apply a simple function to degrees when it comes into or- * leaves this tool (see `Float.invert`)- */-class CustomChatColorGradientToolView @JvmOverloads constructor(- context: Context,- attrs: AttributeSet? = null,- defStyleAttr: Int = 0-) : View(context, attrs, defStyleAttr) {-- private val clipRect = Rect()- private val rect = RectF()- private val center = PointF()- private val top = PointF()- private val bottom = PointF()-- private var selectedEdge: CustomChatColorEdge = CustomChatColorEdge.TOP- private var degrees: Float = 18f- private var listener: Listener? = null-- private val thumbRadius: Float = ViewUtil.dpToPx(THUMB_RADIUS).toFloat()- private val thumbBorder: Float = ViewUtil.dpToPx(THUMB_BORDER).toFloat()- private val thumbBorderSelected: Float = ViewUtil.dpToPx(THUMB_BORDER_SELECTED).toFloat()- private val opaqueThumbRadius: Float = ViewUtil.dpToPx(OPAQUE_THUMB_RADIUS).toFloat()- private val opaqueThumbPadding: Float = ViewUtil.dpToPx(OPAGUE_THUMB_PADDING).toFloat()- private val opaqueThumbPaddingSelected: Float = ViewUtil.dpToPx(OPAGUE_THUMB_PADDING_SELECTED).toFloat()- private val pipeWidth: Float = ViewUtil.dpToPx(PIPE_WIDTH).toFloat()- private val pipeBorder: Float = ViewUtil.dpToPx(PIPE_BORDER).toFloat()-- private val topColorPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {- color = Color.RED- }-- private val bottomColorPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {- color = Color.BLUE- }-- private val backgroundPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {- color = ContextCompat.getColor(context, R.color.signal_background_primary)- }-- private val thumbBorderPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {- color = ContextCompat.getColor(context, R.color.signal_inverse_transparent_10)- }-- private val thumbBorderPaintSelected = Paint(Paint.ANTI_ALIAS_FLAG).apply {- color = ContextCompat.getColor(context, R.color.signal_inverse_transparent_60)- }-- private val pipePaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {- strokeWidth = pipeWidth - pipeBorder * 2- style = Paint.Style.STROKE- color = ContextCompat.getColor(context, R.color.signal_background_primary)- }-- private val pipeBorderPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {- strokeWidth = pipeWidth- style = Paint.Style.STROKE- color = ContextCompat.getColor(context, R.color.signal_inverse_transparent_10)- }-- private val gestureListener = GestureListener()- private val gestureDetector = GestureDetector(context, gestureListener)-- fun setTopColor(@ColorInt color: Int) {- topColorPaint.color = color- invalidate()- }-- fun setBottomColor(@ColorInt color: Int) {- bottomColorPaint.color = color- invalidate()- }-- fun setSelectedEdge(selectedEdge: CustomChatColorEdge) {- if (this.selectedEdge == selectedEdge) {- return- }-- this.selectedEdge = selectedEdge- invalidate()-- listener?.onSelectedEdgeChanged(selectedEdge)- }-- fun setDegrees(degrees: Float) {- setDegreesInternal(degrees.invertDegrees())- }-- private fun setDegreesInternal(degrees: Float) {- if (this.degrees == degrees) {- return- }-- this.degrees = degrees- invalidate()-- listener?.onDegreesChanged(degrees.invertDegrees())- }-- private fun Float.invertDegrees(): Float = 360f - rotate(90f)-- fun setListener(listener: Listener) {- this.listener = listener- }-- override fun onTouchEvent(event: MotionEvent): Boolean {- if (event.action == MotionEvent.ACTION_CANCEL || event.action == MotionEvent.ACTION_UP) {- listener?.onGestureFinished()- } else if (event.action == MotionEvent.ACTION_DOWN) {- listener?.onGestureStarted()- }-- return gestureDetector.onTouchEvent(event)- }-- override fun onDraw(canvas: Canvas) {- canvas.getClipBounds(clipRect)- rect.set(clipRect)- rect.inset(thumbRadius, thumbRadius)-- center.set(rect.width() / 2f, rect.height() / 2f)-- val alpha = atan((rect.height() / rect.width())).toDegrees()- val beta = (360.0 - alpha * 4) / 4f-- if (degrees < alpha) {- // Right top- val a = center.x- val b = a * tan(degrees.toRadians())- top.set(rect.width(), center.y - b)- bottom.set(0f, center.y + b)- } else if (degrees < 90f) {- // Top right- val phi = 90f - degrees- val a = center.y- val b = a * tan(phi.toRadians())- top.set(center.x + b, 0f)- bottom.set(center.x - b, rect.height())- } else if (degrees < (90f + beta)) {- // Top left- val phi = degrees - 90f- val a = center.y- val b = a * tan(phi.toRadians())- top.set(center.x - b, 0f)- bottom.set(center.x + b, rect.height())- } else if (degrees < 180f) {- // left top- val phi = 180f - degrees- val a = center.x- val b = a * tan(phi.toRadians())- top.set(0f, center.y - b)- bottom.set(rect.width(), center.y + b)- } else if (degrees < (180f + alpha)) {- // left bottom- val phi = degrees - 180f- val a = center.x- val b = a * tan(phi.toRadians())- top.set(0f, center.y + b)- bottom.set(rect.width(), center.y - b)- } else if (degrees < 270f) {- // bottom left- val phi = 270f - degrees- val a = center.y- val b = a * tan(phi.toRadians())- top.set(center.x - b, rect.height())- bottom.set(center.x + b, 0f)- } else if (degrees < (270f + beta)) {- // bottom right- val phi = degrees - 270f- val a = center.y- val b = a * tan(phi.toRadians())- top.set(center.x + b, rect.height())- bottom.set(center.x - b, 0f)- } else {- // right bottom- val phi = 360f - degrees- val a = center.x- val b = a * tan(phi.toRadians())- top.set(rect.width(), center.y + b)- bottom.set(0f, center.y - b)- }-- val (selected, other) = when (selectedEdge) {- CustomChatColorEdge.TOP -> top to bottom- CustomChatColorEdge.BOTTOM -> bottom to top- }-- val (selectedPaint, otherPaint) = when (selectedEdge) {- CustomChatColorEdge.TOP -> topColorPaint to bottomColorPaint- CustomChatColorEdge.BOTTOM -> bottomColorPaint to topColorPaint- }-- canvas.apply {- save()- translate(rect.top, rect.left)-- drawLine(selected.x, selected.y, other.x, other.y, pipeBorderPaint)- drawLine(selected.x, selected.y, other.x, other.y, pipePaint)-- drawCircle(other.x, other.y, opaqueThumbRadius + thumbBorder, thumbBorderPaint)- drawCircle(other.x, other.y, opaqueThumbRadius, backgroundPaint)- drawCircle(other.x, other.y, opaqueThumbRadius - opaqueThumbPadding, otherPaint)-- drawCircle(selected.x, selected.y, opaqueThumbRadius + thumbBorderSelected, thumbBorderPaintSelected)- drawCircle(selected.x, selected.y, opaqueThumbRadius, backgroundPaint)- drawCircle(selected.x, selected.y, opaqueThumbRadius - opaqueThumbPaddingSelected, selectedPaint)- restore()- }-- top.offset(rect.top, rect.left)- bottom.offset(rect.top, rect.left)- }-- private fun Float.toDegrees(): Float = this * (180f / Math.PI.toFloat())- private fun Float.toRadians(): Float = this * (Math.PI.toFloat() / 180f)- private fun PointF.distance(other: PointF): Float = abs(sqrt((this.x - other.x).pow(2) + (this.y - other.y).pow(2)))- private fun PointF.dotProduct(other: PointF): Float = (this.x * other.x) + (this.y * other.y)- private fun PointF.determinate(other: PointF): Float = (this.x * other.y) - (this.y * other.x)-- private inner class GestureListener : GestureDetector.SimpleOnGestureListener() {-- var activePointerId: Int = MotionEvent.INVALID_POINTER_ID-- override fun onDown(e: MotionEvent): Boolean {- activePointerId = e.getPointerId(0)-- val touchPoint = PointF(e.getX(0), e.getY(0))- val distanceFromTop = touchPoint.distance(top)-- if (distanceFromTop <= thumbRadius) {- setSelectedEdge(CustomChatColorEdge.TOP)- return true- }-- val distanceFromBottom = touchPoint.distance(bottom)- if (distanceFromBottom <= thumbRadius) {- setSelectedEdge(CustomChatColorEdge.BOTTOM)- return true- }-- return false- }-- override fun onScroll(- e1: MotionEvent?,- e2: MotionEvent,- distanceX: Float,- distanceY: Float- ): Boolean {- val pointerIndex = e2.findPointerIndex(activePointerId)- if (pointerIndex == -1) {- return true- }-- val a = PointF(e2.getX(pointerIndex) - center.x, e2.getY(pointerIndex) - center.y)- val b = PointF(center.x, 0f)- val dot = a.dotProduct(b)- val det = a.determinate(b)-- val offset = if (selectedEdge == CustomChatColorEdge.BOTTOM) 180f else 0f- val degrees = (atan2(det, dot).toDegrees() + 360f + offset) % 360f-- setDegreesInternal(degrees)-- return true- }- }-- private fun Float.rotate(degrees: Float): Float = (this + degrees + 360f) % 360f-- interface Listener {- fun onGestureStarted()- fun onGestureFinished()- fun onDegreesChanged(degrees: Float)- fun onSelectedEdgeChanged(edge: CustomChatColorEdge)- }-- companion object {- @Dimension(unit = Dimension.DP)- private const val THUMB_RADIUS = 24-- @Dimension(unit = Dimension.DP)- private const val THUMB_BORDER = 1-- @Dimension(unit = Dimension.DP)- private const val THUMB_BORDER_SELECTED = 4-- @Dimension(unit = Dimension.DP)- private const val OPAQUE_THUMB_RADIUS = 20-- @Dimension(unit = Dimension.DP)- private const val OPAGUE_THUMB_PADDING = 2-- @Dimension(unit = Dimension.DP)- private const val OPAGUE_THUMB_PADDING_SELECTED = 1-- @Dimension(unit = Dimension.DP)- private const val PIPE_WIDTH = 6-- @Dimension(unit = Dimension.DP)- private const val PIPE_BORDER = 1- }-}diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorPagerAdapter.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorPagerAdapter.ktdeleted file mode 100644index 1d08f5b..0000000--- a/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorPagerAdapter.kt+++ /dev/null@@ -1,19 +0,0 @@-package org.thoughtcrime.securesms.conversation.colors.ui.custom--import android.os.Bundle-import androidx.fragment.app.Fragment-import androidx.viewpager2.adapter.FragmentStateAdapter--class CustomChatColorPagerAdapter(parentFragment: Fragment, private val arguments: Bundle) : FragmentStateAdapter(parentFragment) {- override fun getItemCount(): Int = 2-- override fun createFragment(position: Int): Fragment {- return when (position) {- 0 -> CustomChatColorCreatorPageFragment.forSingle(arguments)- 1 -> CustomChatColorCreatorPageFragment.forGradient(arguments)- else -> {- throw AssertionError()- }- }- }-}diff --git a/app/src/main/res/drawable/chat_wallpaper_preview_bubble_8.xml b/app/src/main/res/drawable/chat_wallpaper_preview_bubble_8.xmldeleted file mode 100644index 0974eab..0000000--- a/app/src/main/res/drawable/chat_wallpaper_preview_bubble_8.xml+++ /dev/null@@ -1,5 +0,0 @@-<?xml version="1.0" encoding="utf-8"?>-<shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android">- <solid android:color="@color/core_white" />- <corners android:radius="8dp" />-</shape>\ No newline at end of filediff --git a/app/src/main/res/layout/custom_chat_color_creator_fragment.xml b/app/src/main/res/layout/custom_chat_color_creator_fragment.xmldeleted file mode 100644index 58c6f41..0000000--- a/app/src/main/res/layout/custom_chat_color_creator_fragment.xml+++ /dev/null@@ -1,38 +0,0 @@-<?xml version="1.0" encoding="utf-8"?>-<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"- xmlns:tools="http://schemas.android.com/tools"- tools:viewBindingIgnore="true"- xmlns:app="http://schemas.android.com/apk/res-auto"- android:layout_width="match_parent"- android:layout_height="match_parent">-- <org.thoughtcrime.securesms.util.views.DarkOverflowToolbar- android:id="@+id/toolbar"- android:layout_width="match_parent"- android:layout_height="56dp"- android:theme="?attr/settingsToolbarStyle"- app:layout_constraintEnd_toEndOf="parent"- app:layout_constraintStart_toStartOf="parent"- app:layout_constraintTop_toTopOf="parent"- app:navigationIcon="@drawable/symbol_arrow_start_24"- app:titleTextAppearance="@style/Signal.Text.Title"- app:title="@string/ChatColorSelectionFragment__chat_color" />-- <com.google.android.material.tabs.TabLayout- android:id="@+id/tab_layout"- android:layout_width="match_parent"- android:layout_height="wrap_content"- app:layout_constraintEnd_toEndOf="parent"- app:layout_constraintStart_toStartOf="parent"- app:layout_constraintTop_toBottomOf="@id/toolbar" />-- <androidx.viewpager2.widget.ViewPager2- android:id="@+id/pager"- android:layout_width="match_parent"- android:layout_height="0dp"- app:layout_constraintBottom_toBottomOf="parent"- app:layout_constraintEnd_toEndOf="parent"- app:layout_constraintStart_toStartOf="parent"- app:layout_constraintTop_toBottomOf="@id/tab_layout" />--</androidx.constraintlayout.widget.ConstraintLayout>\ No newline at end of filediff --git a/app/src/main/res/layout/custom_chat_color_creator_fragment_page.xml b/app/src/main/res/layout/custom_chat_color_creator_fragment_page.xmldeleted file mode 100644index 0a95d36..0000000--- a/app/src/main/res/layout/custom_chat_color_creator_fragment_page.xml+++ /dev/null@@ -1,110 +0,0 @@-<?xml version="1.0" encoding="utf-8"?>-<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"- xmlns:tools="http://schemas.android.com/tools"- tools:viewBindingIgnore="true"- xmlns:app="http://schemas.android.com/apk/res-auto"- android:id="@+id/scroll_view"- android:layout_width="match_parent"- android:layout_height="match_parent"- android:fillViewport="true">-- <androidx.constraintlayout.widget.ConstraintLayout- android:layout_width="match_parent"- android:layout_height="wrap_content">-- <com.google.android.material.card.MaterialCardView- android:id="@+id/preview_card"- android:layout_width="match_parent"- android:layout_height="wrap_content"- android:layout_marginLeft="16dp"- android:layout_marginTop="16dp"- android:layout_marginRight="16dp"- app:cardCornerRadius="4dp"- app:cardElevation="0dp"- app:layout_constraintEnd_toEndOf="parent"- app:layout_constraintStart_toStartOf="parent"- app:layout_constraintTop_toTopOf="parent">-- <org.thoughtcrime.securesms.conversation.colors.ui.ChatColorPreviewView- android:id="@+id/chat_color_preview"- android:layout_width="match_parent"- android:layout_height="wrap_content"- app:ccpv_chat_bubble_count="4" />- </com.google.android.material.card.MaterialCardView>-- <org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomChatColorGradientToolView- android:id="@+id/gradient_tool"- android:layout_width="0dp"- android:layout_height="0dp"- android:layout_margin="10dp"- app:layout_constraintBottom_toTopOf="@id/hue_label"- app:layout_constraintEnd_toEndOf="parent"- app:layout_constraintStart_toStartOf="parent"- app:layout_constraintTop_toTopOf="parent" />-- <TextView- android:id="@+id/hue_label"- android:layout_width="match_parent"- android:layout_height="wrap_content"- android:layout_marginTop="16dp"- android:gravity="center_vertical"- android:minHeight="40dp"- android:paddingStart="16dp"- android:paddingEnd="16dp"- android:text="@string/CustomChatColorCreatorFragment__hue"- android:textAppearance="@style/TextAppearance.Signal.Body2.Bold"- android:textColor="@color/signal_text_secondary"- app:layout_constraintEnd_toEndOf="parent"- app:layout_constraintStart_toStartOf="parent"- app:layout_constraintTop_toBottomOf="@id/preview_card" />-- <androidx.appcompat.widget.AppCompatSeekBar- android:id="@+id/hue_slider"- android:layout_width="match_parent"- android:layout_height="wrap_content"- android:splitTrack="false"- app:layout_constraintEnd_toEndOf="parent"- app:layout_constraintStart_toStartOf="parent"- app:layout_constraintTop_toBottomOf="@id/hue_label" />-- <TextView- android:id="@+id/saturation_label"- android:layout_width="match_parent"- android:layout_height="wrap_content"- android:gravity="center_vertical"- android:minHeight="40dp"- android:paddingStart="16dp"- android:paddingEnd="16dp"- android:text="@string/CustomChatColorCreatorFragment__saturation"- android:textAppearance="@style/TextAppearance.Signal.Body2.Bold"- android:textColor="@color/signal_text_secondary"- app:layout_constraintEnd_toEndOf="parent"- app:layout_constraintStart_toStartOf="parent"- app:layout_constraintTop_toBottomOf="@id/hue_slider" />-- <androidx.appcompat.widget.AppCompatSeekBar- android:id="@+id/saturation_slider"- android:layout_width="match_parent"- android:layout_height="wrap_content"- android:splitTrack="false"- app:layout_constraintEnd_toEndOf="parent"- app:layout_constraintStart_toStartOf="parent"- app:layout_constraintTop_toBottomOf="@id/saturation_label" />-- <com.google.android.material.button.MaterialButton- android:id="@+id/save"- style="@style/Signal.Widget.Button.Large.Primary"- android:layout_width="wrap_content"- android:layout_height="wrap_content"- android:layout_marginEnd="16dp"- android:layout_marginBottom="16dp"- android:elevation="8dp"- android:text="@string/CustomChatColorCreatorFragmentPage__save"- app:cornerRadius="68dp"- app:layout_constraintBottom_toBottomOf="parent"- app:layout_constraintEnd_toEndOf="parent"- app:layout_constraintTop_toBottomOf="@id/saturation_slider"- app:layout_constraintVertical_bias="1" />-- </androidx.constraintlayout.widget.ConstraintLayout>-</ScrollView>\ No newline at end of filediff --git a/app/src/main/res/layout/custom_chat_color_creator_preview.xml b/app/src/main/res/layout/custom_chat_color_creator_preview.xmlnew file mode 100644index 0000000..191ffc3--- /dev/null+++ b/app/src/main/res/layout/custom_chat_color_creator_preview.xml@@ -0,0 +1,8 @@+<?xml version="1.0" encoding="utf-8"?>+<org.thoughtcrime.securesms.conversation.colors.ui.ChatColorPreviewView xmlns:android="http://schemas.android.com/apk/res/android"+ xmlns:app="http://schemas.android.com/apk/res-auto"+ xmlns:tools="http://schemas.android.com/tools"+ tools:viewBindingIgnore="true"+ android:layout_width="match_parent"+ android:layout_height="wrap_content"+ app:ccpv_chat_bubble_count="4" />diff --git a/app/src/main/res/layout/gradient_tool_tooltip.xml b/app/src/main/res/layout/gradient_tool_tooltip.xmldeleted file mode 100644index c9c8b0d..0000000--- a/app/src/main/res/layout/gradient_tool_tooltip.xml+++ /dev/null@@ -1,62 +0,0 @@-<?xml version="1.0" encoding="utf-8"?>-<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"- xmlns:tools="http://schemas.android.com/tools"- tools:viewBindingIgnore="true"- xmlns:app="http://schemas.android.com/apk/res-auto"- android:layout_width="match_parent"- android:layout_height="wrap_content"- android:paddingHorizontal="12dp"- android:paddingBottom="12dp">-- <androidx.appcompat.widget.AppCompatImageView- android:layout_width="wrap_content"- android:layout_height="wrap_content"- android:tint="@color/signal_accent_primary"- app:layout_constraintEnd_toEndOf="parent"- app:layout_constraintStart_toStartOf="parent"- app:layout_constraintTop_toTopOf="parent"- app:srcCompat="@drawable/tooltip_arrow_up" />-- <androidx.appcompat.widget.AppCompatImageView- android:id="@+id/bubble"- android:layout_width="0dp"- android:layout_height="0dp"- android:layout_marginTop="12dp"- app:layout_constraintBottom_toBottomOf="parent"- app:layout_constraintEnd_toEndOf="parent"- app:layout_constraintStart_toStartOf="parent"- app:layout_constraintTop_toTopOf="parent"- app:layout_constraintWidth_max="295dp"- app:srcCompat="@drawable/chat_wallpaper_preview_bubble_8"- app:tint="@color/signal_accent_primary" />-- <androidx.appcompat.widget.AppCompatImageView- android:id="@+id/icon"- android:layout_width="44dp"- android:layout_height="44dp"- android:layout_marginStart="12dp"- android:layout_marginTop="7dp"- android:layout_marginEnd="10dp"- android:layout_marginBottom="7dp"- android:scaleType="centerInside"- app:layout_constraintBottom_toBottomOf="@id/bubble"- app:layout_constraintEnd_toStartOf="@id/text"- app:layout_constraintHorizontal_chainStyle="packed"- app:layout_constraintStart_toStartOf="@id/bubble"- app:layout_constraintTop_toTopOf="@id/bubble" />-- <TextView- android:id="@+id/text"- android:layout_width="0dp"- android:layout_height="wrap_content"- android:layout_marginTop="7dp"- android:layout_marginEnd="12dp"- android:text="@string/CustomChatColorCreatorFragment__drag_to_change_the_direction_of_the_gradient"- android:textAppearance="@style/Signal.Text.Body"- android:textColor="@color/white"- app:layout_constraintEnd_toEndOf="@id/bubble"- app:layout_constraintStart_toEndOf="@id/icon"- app:layout_constraintTop_toTopOf="@id/bubble" />---</androidx.constraintlayout.widget.ConstraintLayout>\ No newline at end of filediff --git a/app/src/main/res/navigation/chat_wallpaper.xml b/app/src/main/res/navigation/chat_wallpaper.xmlindex 605fbb8..238c8aa 100644--- a/app/src/main/res/navigation/chat_wallpaper.xml+++ b/app/src/main/res/navigation/chat_wallpaper.xml@@ -54,8 +54,7 @@ <fragment android:id="@+id/customChatColorCreatorFragment" android:name="org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomChatColorCreatorFragment"- android:label="custom_chat_color_creator_fragment"- tools:layout="@layout/custom_chat_color_creator_fragment">+ android:label="custom_chat_color_creator_fragment"> <argument android:name="recipient_id"diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xmlindex b8cf40e..a483f22 100644--- a/app/src/main/res/values/strings.xml+++ b/app/src/main/res/values/strings.xml@@ -6088,6 +6088,8 @@ <string name="CustomChatColorCreatorFragment__gradient">Gradient</string> <string name="CustomChatColorCreatorFragment__hue">Hue</string> <string name="CustomChatColorCreatorFragment__saturation">Saturation</string>+ <!-- Accessibility label for the area over the chat color preview where the two ends of a gradient are dragged to change its direction -->+ <string name="CustomChatColorCreatorFragment__gradient_direction">Gradient direction</string> <!-- CustomChatColorCreatorFragmentPage --> <string name="CustomChatColorCreatorFragmentPage__save">Save</string>diff --git a/app/src/test/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorCreatorFragmentTest.kt b/app/src/test/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorCreatorFragmentTest.ktnew file mode 100644index 0000000..44e0a38--- /dev/null+++ b/app/src/test/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorCreatorFragmentTest.kt@@ -0,0 +1,376 @@+/*+ * Copyright 2026 Signal Messenger, LLC+ * SPDX-License-Identifier: AGPL-3.0-only+ */++package org.thoughtcrime.securesms.conversation.colors.ui.custom++import android.app.Application+import android.os.Looper+import androidx.compose.ui.geometry.Offset+import androidx.compose.ui.semantics.ProgressBarRangeInfo+import androidx.compose.ui.semantics.Role+import androidx.compose.ui.semantics.SemanticsActions+import androidx.compose.ui.semantics.SemanticsProperties+import androidx.compose.ui.test.SemanticsMatcher+import androidx.compose.ui.test.assert+import androidx.compose.ui.test.assertHasClickAction+import androidx.compose.ui.test.assertIsEnabled+import androidx.compose.ui.test.assertIsNotEnabled+import androidx.compose.ui.test.assertIsNotSelected+import androidx.compose.ui.test.assertIsSelected+import androidx.compose.ui.test.click+import androidx.compose.ui.test.hasAnyAncestor+import androidx.compose.ui.test.hasText+import androidx.compose.ui.test.isDialog+import androidx.compose.ui.test.junit4.createEmptyComposeRule+import androidx.compose.ui.test.onAllNodesWithText+import androidx.compose.ui.test.onNodeWithContentDescription+import androidx.compose.ui.test.onNodeWithText+import androidx.compose.ui.test.performClick+import androidx.compose.ui.test.performSemanticsAction+import androidx.compose.ui.test.performTouchInput+import androidx.compose.ui.test.swipe+import androidx.compose.ui.unit.dp+import androidx.core.graphics.ColorUtils+import androidx.fragment.app.FragmentActivity+import androidx.navigation.NavController+import androidx.navigation.Navigation+import androidx.test.core.app.ApplicationProvider+import io.mockk.every+import io.mockk.mockk+import io.mockk.mockkConstructor+import io.mockk.mockkObject+import io.mockk.unmockkAll+import io.mockk.verify+import org.junit.After+import org.junit.Assert.assertArrayEquals+import org.junit.Assert.assertEquals+import org.junit.Assert.assertFalse+import org.junit.Assert.assertTrue+import org.junit.Before+import org.junit.Rule+import org.junit.Test+import org.junit.runner.RunWith+import org.robolectric.Robolectric+import org.robolectric.RobolectricTestRunner+import org.robolectric.Shadows.shadowOf+import org.robolectric.annotation.Config+import org.signal.core.ui.CoreUiDependenciesRule+import org.thoughtcrime.securesms.R+import org.thoughtcrime.securesms.conversation.colors.ChatColors+import org.thoughtcrime.securesms.conversation.colors.ui.ChatColorSelectionViewModel+import org.thoughtcrime.securesms.keyvalue.ChatColorsValues+import org.thoughtcrime.securesms.keyvalue.SignalStore+import org.thoughtcrime.securesms.wallpaper.ChatWallpaper+import java.util.concurrent.CopyOnWriteArrayList+import kotlin.math.roundToInt++@RunWith(RobolectricTestRunner::class)+@Config(application = Application::class, sdk = [35], qualifiers = "w411dp-h891dp-xxhdpi")+class CustomChatColorCreatorFragmentTest {++ companion object {+ private const val EXISTING_ID = 5L++ /** Colors the editor has always produced for these (hue, saturation) slider positions. */+ private const val COLOR_100_900 = 0xFFAE6A0B.toInt()+ private const val COLOR_100_511 = 0xFF8A642E.toInt()+ private const val COLOR_511_511 = 0xFF267372.toInt()+ private const val COLOR_300_700 = 0xFF318118.toInt()+ private const val COLOR_800_200 = 0xFF765883.toInt()+ }++ @get:Rule+ val composeTestRule = createEmptyComposeRule()++ @get:Rule+ val coreUiDependenciesRule = CoreUiDependenciesRule(ApplicationProvider.getApplicationContext())++ private val navController = mockk<NavController>(relaxed = true)+ private val chatColorSelectionViewModel = mockk<ChatColorSelectionViewModel>(relaxed = true)+ private val savedColors = CopyOnWriteArrayList<ChatColors>()++ private var showGradientTooltip = false+ private var usageCount = 0+ private var existingColors: ChatColors? = null+ private var finishLoading: ((ChatColors) -> Unit)? = null++ private lateinit var activity: FragmentActivity+ private lateinit var fragment: CustomChatColorCreatorFragment++ @Before+ fun setUp() {+ val chatColorsValues = mockk<ChatColorsValues>()+ every { chatColorsValues.shouldShowGradientTooltip } answers { showGradientTooltip }+ every { chatColorsValues.shouldShowGradientTooltip = any() } answers { showGradientTooltip = firstArg() }+ mockkObject(SignalStore)+ every { SignalStore.chatColors } returns chatColorsValues++ mockkConstructor(CustomChatColorCreatorRepository::class)+ every { anyConstructed<CustomChatColorCreatorRepository>().getWallpaper(any(), any()) } answers { secondArg<(ChatWallpaper?) -> Unit>().invoke(null) }+ every { anyConstructed<CustomChatColorCreatorRepository>().loadColors(any(), any()) } answers {+ val consumer = secondArg<(ChatColors) -> Unit>()+ val colors = existingColors+ if (colors != null) consumer(colors) else finishLoading = consumer+ }+ every { anyConstructed<CustomChatColorCreatorRepository>().getUsageCount(any(), any()) } answers { secondArg<(Int) -> Unit>().invoke(usageCount) }+ every { anyConstructed<CustomChatColorCreatorRepository>().setChatColors(any(), any()) } answers {+ savedColors += firstArg<ChatColors>()+ secondArg<(ChatColors) -> Unit>().invoke(firstArg())+ }++ mockkObject(ChatColorSelectionViewModel.Companion)+ every { ChatColorSelectionViewModel.getOrCreate(any(), any()) } returns chatColorSelectionViewModel+ }++ @After+ fun tearDown() {+ unmockkAll()+ }++ @Test+ fun `opens on the requested tab`() {+ launch(startPage = 1)++ composeTestRule.onNodeWithText("Gradient").assertIsSelected()+ composeTestRule.onNodeWithText("Solid").assertIsNotSelected()+ composeTestRule.onNodeWithContentDescription("Gradient direction").assertExists()+ }++ @Test+ fun `labels its controls for accessibility services`() {+ launch(startPage = 1)++ composeTestRule.onNodeWithContentDescription("Back").assertHasClickAction()+ composeTestRule.onNodeWithText("Solid").assert(SemanticsMatcher.expectValue(SemanticsProperties.Role, Role.Tab))+ composeTestRule.onNodeWithText("Save").assert(SemanticsMatcher.expectValue(SemanticsProperties.Role, Role.Button))+ composeTestRule.onNodeWithContentDescription("Gradient direction").assertExists()++ for (slider in listOf("Hue", "Saturation")) {+ composeTestRule.onNodeWithText(slider)+ .assert(SemanticsMatcher.keyIsDefined(SemanticsProperties.ProgressBarRangeInfo))+ .assert(SemanticsMatcher.keyIsDefined(SemanticsActions.SetProgress))+ }+ }++ @Test+ fun `saves a new solid color once and returns`() {+ launch(startPage = 0)+ assertEquals(511f, rangeOf("Hue").current)+ assertEquals(511f, rangeOf("Saturation").current)++ setSlider("Hue", 100)+ setSlider("Saturation", 900)+ composeTestRule.onNodeWithText("Save").performClick()+ composeTestRule.onNodeWithText("Save").performClick()+ waitUntil { savedColors.isNotEmpty() }+ idle()++ val saved = savedColors.single()+ assertEquals(ChatColors.Id.NotSet, saved.id)+ assertEquals(COLOR_100_900, saved.singleColor)+ verify(exactly = 1) { chatColorSelectionViewModel.save(saved) }+ verify(exactly = 1) { navController.popBackStack() }+ }++ @Test+ fun `saves the gradient with the selected end and the dragged direction`() {+ launch(startPage = 1)++ // Pick the top end, which starts out at the top center.+ composeTestRule.onNodeWithContentDescription("Gradient direction").performTouchInput {+ click(Offset(width / 2f, 24.dp.toPx()))+ }+ setSlider("Hue", 100)++ // Drag it to the middle of the right hand side.+ composeTestRule.onNodeWithContentDescription("Gradient direction").performTouchInput {+ swipe(start = Offset(width / 2f, 24.dp.toPx()), end = Offset(width - 24.dp.toPx(), height / 2f), durationMillis = 300)+ }++ // The selected end and its changes survive switching tabs.+ composeTestRule.onNodeWithText("Solid").performClick()+ idle()+ assertEquals(100f, rangeOf("Hue").current)+ composeTestRule.onNodeWithText("Gradient").performClick()++ composeTestRule.onNodeWithText("Save").performClick()+ waitUntil { savedColors.isNotEmpty() }++ val gradient = requireNotNull(savedColors.single().linearGradient)+ assertArrayEquals(intArrayOf(COLOR_100_511, COLOR_511_511), gradient.colors)+ assertArrayEquals(floatArrayOf(0f, 1f), gradient.positions, 0f)+ assertEquals(270f, gradient.degrees, 0.5f)+ }++ @Test+ fun `dragging the bottom end points the gradient the other way`() {+ launch(startPage = 1)++ composeTestRule.onNodeWithContentDescription("Gradient direction").performTouchInput {+ swipe(start = Offset(width / 2f, height - 24.dp.toPx()), end = Offset(width - 24.dp.toPx(), height / 2f), durationMillis = 300)+ }++ composeTestRule.onNodeWithText("Save").performClick()+ waitUntil { savedColors.isNotEmpty() }++ assertEquals(90f, requireNotNull(savedColors.single().linearGradient).degrees, 0.5f)+ }++ @Test+ fun `fills in an existing color when it finishes loading`() {+ launch(startPage = 1, chatColorId = EXISTING_ID)+ composeTestRule.onNodeWithText("Save").assertIsNotEnabled()++ val loaded = ChatColors.forGradient(ChatColors.Id.forLongValue(EXISTING_ID), ChatColors.LinearGradient(45f, intArrayOf(COLOR_300_700, COLOR_800_200), floatArrayOf(0f, 1f)))+ requireNotNull(finishLoading).invoke(loaded)++ val (bottomHue, bottomSaturation) = sliderPositionsOf(COLOR_800_200)+ waitUntil { rangeOf("Hue").current == bottomHue.toFloat() }+ assertEquals(bottomSaturation.toFloat(), rangeOf("Saturation").current)+ composeTestRule.onNodeWithText("Save").assertIsEnabled()++ composeTestRule.onNodeWithText("Save").performClick()+ waitUntil { savedColors.isNotEmpty() }++ val saved = savedColors.single()+ assertEquals(ChatColors.Id.forLongValue(EXISTING_ID), saved.id)+ assertEquals(45f, requireNotNull(saved.linearGradient).degrees)+ }++ @Test+ fun `asks before saving a color used by other chats`() {+ usageCount = 3+ existingColors = ChatColors.forColor(ChatColors.Id.forLongValue(EXISTING_ID), COLOR_100_511)+ launch(startPage = 0, chatColorId = EXISTING_ID)+ waitUntil { rangeOf("Hue").current == sliderPositionsOf(COLOR_100_511).first.toFloat() }++ composeTestRule.onNodeWithText("Save").performClick()+ waitUntil { composeTestRule.onAllNodesWithText("This color is used in 3 chats. Do you want to save changes for all chats?").fetchSemanticsNodes().isNotEmpty() }+ composeTestRule.onNodeWithText("Edit color").assertExists()++ composeTestRule.onNodeWithText("Cancel").performClick()+ idle()+ composeTestRule.onNodeWithText("Edit color").assertDoesNotExist()+ assertTrue(savedColors.isEmpty())+ verify(exactly = 0) { navController.popBackStack() }++ setSlider("Hue", 100)+ setSlider("Saturation", 900)+ composeTestRule.onNodeWithText("Save").performClick()+ waitUntil { composeTestRule.onAllNodesWithText("Edit color").fetchSemanticsNodes().isNotEmpty() }+ composeTestRule.onNode(hasText("Save") and hasAnyAncestor(isDialog())).performClick()+ waitUntil { savedColors.isNotEmpty() }++ assertEquals(ChatColors.Id.forLongValue(EXISTING_ID), savedColors.single().id)+ assertEquals(COLOR_100_900, savedColors.single().singleColor)+ verify(exactly = 1) { navController.popBackStack() }+ }++ @Test+ fun `back leaves without saving`() {+ launch(startPage = 0)++ composeTestRule.onNodeWithContentDescription("Back").performClick()+ composeTestRule.onNodeWithContentDescription("Back").performClick()+ composeTestRule.onNodeWithText("Save").performClick()+ idle()++ verify(exactly = 1) { navController.popBackStack() }+ assertTrue(savedColors.isEmpty())+ }++ @Test+ fun `keeps edits when its view is recreated`() {+ launch(startPage = 1)+ composeTestRule.onNodeWithContentDescription("Gradient direction").performTouchInput {+ click(Offset(width / 2f, 24.dp.toPx()))+ }+ setSlider("Hue", 100)+ composeTestRule.onNodeWithText("Solid").performClick()+ idle()++ activity.supportFragmentManager.beginTransaction().detach(fragment).commitNow()+ activity.supportFragmentManager.beginTransaction().attach(fragment).commitNow()+ idle()++ composeTestRule.onNodeWithText("Solid").assertIsSelected()+ assertEquals(100f, rangeOf("Hue").current)++ composeTestRule.onNodeWithText("Save").performClick()+ waitUntil { savedColors.isNotEmpty() }+ assertEquals(COLOR_100_511, savedColors.single().singleColor)+ }++ @Test+ fun `explains the gradient tool only the first time it is shown`() {+ showGradientTooltip = true+ launch(startPage = 0)+ composeTestRule.onNodeWithText("Drag to change the direction of the gradient").assertDoesNotExist()+ assertTrue(showGradientTooltip)++ composeTestRule.onNodeWithText("Gradient").performClick()+ idle()+ composeTestRule.onNodeWithText("Drag to change the direction of the gradient").assertExists()+ assertFalse(showGradientTooltip)++ composeTestRule.onNodeWithText("Solid").performClick()+ composeTestRule.onNodeWithText("Gradient").performClick()+ idle()+ composeTestRule.onNodeWithText("Drag to change the direction of the gradient").assertDoesNotExist()+ }++ private fun launch(startPage: Int, chatColorId: Long = 0L) {+ val controller = Robolectric.buildActivity(FragmentActivity::class.java)+ controller.get().setTheme(R.style.Signal_DayNight_NoActionBar)+ controller.setup()+ activity = controller.get()++ fragment = CustomChatColorCreatorFragment().apply {+ arguments = CustomChatColorCreatorFragmentArgs.Builder(null, startPage).setChatColorId(chatColorId).build().toBundle()+ }+ activity.supportFragmentManager.beginTransaction().add(android.R.id.content, fragment).commitNow()+ Navigation.setViewNavController(activity.findViewById(android.R.id.content), navController)+ idle()+ }++ private fun rangeOf(slider: String): ProgressBarRangeInfo {+ return composeTestRule.onNodeWithContentDescription(slider).fetchSemanticsNode().config[SemanticsProperties.ProgressBarRangeInfo]+ }++ /** Moves a slider and waits for the editor to show the new position. */+ private fun setSlider(slider: String, position: Int) {+ composeTestRule.onNodeWithContentDescription(slider).performSemanticsAction(SemanticsActions.SetProgress) { it(position.toFloat()) }+ waitUntil { rangeOf(slider).current == position.toFloat() }+ }++ /** The slider positions the view model derives from a stored color. */+ private fun sliderPositionsOf(color: Int): Pair<Int, Int> {+ val hsl = FloatArray(3)+ ColorUtils.colorToHSL(color, hsl)+ return ((hsl[0] / 360f) * MAX_SLIDER_VALUE).roundToInt() to (hsl[1] * MAX_SLIDER_VALUE).roundToInt()+ }++ /** State updates and saves happen on background threads before reaching the main thread, so give them a moment. */+ private fun idle() {+ repeat(5) {+ Thread.sleep(20)+ shadowOf(Looper.getMainLooper()).idle()+ composeTestRule.waitForIdle()+ }+ }++ private fun waitUntil(condition: () -> Boolean) {+ val timeout = System.currentTimeMillis() + 5_000+ while (true) {+ idle()+ if (condition()) {+ return+ }+ if (System.currentTimeMillis() > timeout) {+ throw AssertionError("Condition not met in time")+ }+ }+ }+}1234567891011[ { "phase": "verifier-generated", "source": "/logs/artifacts", "service": "main", "type": "directory", "exclude": [], "status": "ok", "destination": "artifacts/generated/logs/artifacts" }]12345{ "score": 0.9, "violations_count": 2, "reasoning": "Overall, the patch represents high-quality work converting legacy XML custom views and fragments into modern Jetpack Compose composables with comprehensive unit tests and accessibility support. However, two violations of the guidelines were identified:\n\n1. **Jetpack Compose Modifier Ownership**: The public Composable `CustomChatColorCreatorScreen` does not accept `modifier: Modifier = Modifier` as its first optional parameter (or at all), and caller-provided layout styling cannot be applied to its root component (`Scaffold`). Under Section 2 ('Modifier Ownership'), every public Composable should accept `modifier: Modifier = Modifier` as its first optional parameter and apply it to the root component.\n2. **Monotonic Time for Intervals**: In `CustomChatColorCreatorFragmentTest.kt` inside `waitUntil()`, `System.currentTimeMillis()` is used to measure the 5-second timeout interval instead of `SystemClock.elapsedRealtime()`. Under Section 4 ('Structured Concurrency - Monotonic Time'), `SystemClock.elapsedRealtime()` must be used for measuring intervals and durations as `System.currentTimeMillis()` is susceptible to clock drift."}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144{ "efflora__signal-custom-chat-color": { "score": 0.0, "diagnostics": [ "Verifying 38 pass_to_pass tests and 4 fail_to_pass tests.", "Running test attempt: 1", "Test attempt 1: PASSED", "validation failed: regression#legacy_editor_resources_removed" ], "status": "AGENT_FAILED_VALIDATION", "used_tokens": null, "exported_passed_tests": [], "exported_failed_tests": [], "partial_score": 0.95, "pass_rate": 0.9881, "validation_results": { "cheating#patch": 1.0, "gate#migration_started": 1.0, "functional#migrationDefaultAddEntryIsCompose": 1.0, "functional#migrationGradientIsCompose": 1.0, "functional#migrationConfirmationUsesCompose": 1.0, "functional#migrationViewRecreationStillUsesCompose": 1.0, "functional#behaviorNewSolidDefaults": 1.0, "functional#behaviorSolidSliderBoundariesAndSave": 1.0, "functional#behaviorGeneratedHueSaturationPairs": 1.0, "functional#behaviorGradientStartPageAndSave": 1.0, "functional#behaviorEdgesAreIndependentlyEditable": 1.0, "functional#behaviorSwitchTabsSharesSelectedEdge": 1.0, "functional#behaviorRotateGradientPersistsDirection": 1.0, "functional#behaviorEditSolidLoadsAndKeepsIdentity": 1.0, "functional#behaviorEditGradientLoadsBothColorsAndAngle": 1.0, "functional#behaviorDelayedLoadUpdatesEditor": 1.0, "functional#behaviorUsedColorCancelDoesNotWrite": 1.0, "functional#behaviorUsedColorConfirmWritesOnce": 1.0, "functional#behaviorCancelThenChangeAndConfirmLatest": 1.0, "functional#behaviorBackDiscardsUnsavedColor": 1.0, "functional#behaviorRecipientContextReachesBothBoundaries": 1.0, "functional#behaviorGlobalContextRemainsGlobal": 1.0, "functional#behaviorViewRecreationRetainsEditing": 1.0, "functional#regressionSelectionEntryRemainsUsableAfterCancel": 1.0, "functional#behaviorWallpaperReachesLivePreview": 1.0, "functional#behaviorGradientGuidancePreferenceIsConsumed": 1.0, "functional#behaviorDarkThemeEditorStillEditsAndSaves": 1.0, "penalty#preview_view_unchanged": 1.0, "requirements#destination_has_no_legacy_editor": 1.0, "constraint#legacy_editor_code_removed": 1.0, "regression#legacy_editor_resources_removed": 0.0, "regression#editor_text_localized": 1.0, "cheating#no_prebuilt_binaries": 1.0, "cheating#foreign_language_files": 1.0, "cheating#static_gradle_test_hooks": 1.0, "cheating#static_test_identity": 1.0, "visual#solid_adjusted": 1.0, "visual#solid_new_color": 1.0, "visual#gradient_new_color": 1.0, "visual#gradient_edit": 1.0, "visual#solid_dark": 1.0, "visual#preview_card_background": 1.0 }, "scoring_breakdown": { "base_score": 1.0, "categories": { "functional": { "passed": 25, "total": 25, "weight": 0.5, "raw_weight": 0.5, "score": 1.0, "contribution": 0.5 }, "regression": { "passed": 17, "total": 17, "weight": 0.15, "raw_weight": 0.15, "score": 1.0, "contribution": 0.15 }, "requirements": { "passed": 1, "total": 1, "weight": 0.1, "raw_weight": 0.1, "score": 1.0, "contribution": 0.1 }, "visual": { "passed": 6, "total": 6, "weight": 0.25, "raw_weight": 0.25, "score": 1.0, "contribution": 0.25 }, "code_quality": { "passed": 0.9, "total": 1.0, "weight": 0.0, "raw_weight": 0.0, "score": 0.9, "contribution": 0.0, "violations_count": 2 } }, "multipliers_applied": [ { "name": "validate#regression#legacy_editor_resources_removed", "value": 0.95, "reasoning": "old editor resources still present: tooltip_arrow_up.9.png unchanged" } ], "logs": [ "WARNING: Test 'testPlayProdDebugUnitTest#Test migrationDefaultAddEntryIsCompose(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test migrationConfirmationUsesCompose(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorSwitchTabsSharesSelectedEdge(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorRotateGradientPersistsDirection(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorUsedColorConfirmWritesOnce(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorGradientStartPageAndSave(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorRecipientContextReachesBothBoundaries(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorGeneratedHueSaturationPairs(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorGlobalContextRemainsGlobal(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorNewSolidDefaults(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorDarkThemeEditorStillEditsAndSaves(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorGradientGuidancePreferenceIsConsumed(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorCancelThenChangeAndConfirmLatest(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorEditSolidLoadsAndKeepsIdentity(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test migrationGradientIsCompose(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorEdgesAreIndependentlyEditable(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorUsedColorCancelDoesNotWrite(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test migrationViewRecreationStillUsesCompose(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorSolidSliderBoundariesAndSave(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorWallpaperReachesLivePreview(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test regressionSelectionEntryRemainsUsableAfterCancel(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorBackDiscardsUnsavedColor(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorEditGradientLoadsBothColorsAndAngle(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorViewRecreationRetainsEditing(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testPlayProdDebugUnitTest#Test behaviorDelayedLoadUpdatesEditor(org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomColorMigrationTest)' did not match any category rules. It will be IGNORED and not scored." ] }, "status_description": "Agent created a patch that fails the validate.sh", "code_quality_score": 0.9, "code_quality_violations": 2 }}10.95123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436diff --git a/app/lint-baseline.xml b/app/lint-baseline.xmlindex bdecdca..75fefeb 100644--- a/app/lint-baseline.xml+++ b/app/lint-baseline.xml@@ -35050,17 +35050,6 @@ column="7"/> </issue> - <issue- id="ClickableViewAccessibility"- message="Custom view `CustomChatColorGradientToolView` overrides `onTouchEvent` but not `performClick`"- errorLine1=" override fun onTouchEvent(event: MotionEvent): Boolean {"- errorLine2=" ~~~~~~~~~~~~">- <location- file="src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorGradientToolView.kt"- line="151"- column="16"/>- </issue>- <issue id="ClickableViewAccessibility" message="Custom view `HackyViewPager` overrides `onTouchEvent` but not `performClick`"diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorCreatorFragment.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorCreatorFragment.ktindex 660666b..b95d0ff 100644--- a/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorCreatorFragment.kt+++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorCreatorFragment.kt@@ -2,41 +2,137 @@ package org.thoughtcrime.securesms.conversation.colors.ui.custom import android.os.Bundle import android.view.View-import androidx.appcompat.widget.Toolbar-import androidx.fragment.app.Fragment-import androidx.navigation.Navigation-import androidx.viewpager2.widget.ViewPager2-import com.google.android.material.tabs.TabLayout-import com.google.android.material.tabs.TabLayoutMediator-import org.thoughtcrime.securesms.R+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.MutableState+import androidx.compose.runtime.getValue+import androidx.compose.runtime.livedata.observeAsState+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.saveable.rememberSaveable+import androidx.compose.runtime.setValue+import androidx.fragment.app.viewModels+import androidx.navigation.fragment.findNavController+import org.signal.core.ui.compose.ComposeFragment+import org.thoughtcrime.securesms.conversation.colors.ChatColors+import org.thoughtcrime.securesms.conversation.colors.ui.ChatColorSelectionViewModel+import org.thoughtcrime.securesms.keyvalue.SignalStore -class CustomChatColorCreatorFragment : Fragment(R.layout.custom_chat_color_creator_fragment) {+/**+ * Creates a new custom chat color, or edits an existing one.+ */+class CustomChatColorCreatorFragment : ComposeFragment() {++ private val args: CustomChatColorCreatorFragmentArgs by lazy {+ CustomChatColorCreatorFragmentArgs.fromBundle(requireArguments())+ }++ private val viewModel: CustomChatColorCreatorViewModel by viewModels(+ factoryProducer = {+ CustomChatColorCreatorViewModel.Factory(+ MAX_SLIDER_VALUE,+ ChatColors.Id.forLongValue(args.chatColorId),+ args.recipientId,+ CustomChatColorCreatorRepository(requireContext())+ )+ }+ )++ /** The number of chats using the color, while the user is asked to confirm saving changes to it. */+ private var usageWarning: Int? by mutableStateOf(null)++ /** Set once the editor starts leaving, so that it saves at most once and only leaves once. */+ private var isClosing = false override fun onViewCreated(view: View, savedInstanceState: Bundle?) {- val toolbar: Toolbar = view.findViewById(R.id.toolbar)- val tabLayout: TabLayout = view.findViewById(R.id.tab_layout)- val pager: ViewPager2 = view.findViewById(R.id.pager)- val adapter = CustomChatColorPagerAdapter(this, requireArguments())- val tabLayoutMediator = TabLayoutMediator(tabLayout, pager) { tab, position ->- tab.setText(- if (position == 0) {- R.string.CustomChatColorCreatorFragment__solid- } else {- R.string.CustomChatColorCreatorFragment__gradient- }+ super.onViewCreated(view, savedInstanceState)++ viewModel.events.observe(viewLifecycleOwner) { event ->+ when (event) {+ is CustomChatColorCreatorViewModel.Event.SaveNow -> save(event.chatColors)+ is CustomChatColorCreatorViewModel.Event.Warn -> if (!isClosing) usageWarning = event.usageCount+ }+ }+ }++ @Composable+ override fun FragmentContent() {+ val state: CustomChatColorCreatorState? by viewModel.state.observeAsState()+ val selectedTab: MutableState<CustomChatColorCreatorTab> = rememberSaveable { mutableStateOf(CustomChatColorCreatorTab.fromStartPage(args.startPage)) }+ val showGradientTip: MutableState<Boolean> = rememberSaveable { mutableStateOf(false) }+ val callbacks = remember { Callbacks(selectedTab, showGradientTip) }++ LaunchedEffect(selectedTab.value) {+ if (selectedTab.value == CustomChatColorCreatorTab.GRADIENT && SignalStore.chatColors.shouldShowGradientTooltip) {+ SignalStore.chatColors.shouldShowGradientTooltip = false+ showGradientTip.value = true+ }+ }++ state?.let {+ CustomChatColorCreatorScreen(+ state = it,+ selectedTab = selectedTab.value,+ callbacks = callbacks,+ showGradientTip = showGradientTip.value,+ usageWarning = usageWarning ) }+ } - toolbar.setNavigationOnClickListener {- Navigation.findNavController(it).popBackStack()+ private fun save(chatColors: ChatColors) {+ if (isClosing) {+ return } - pager.isUserInputEnabled = false- pager.adapter = adapter+ val chatColorSelectionViewModel = ChatColorSelectionViewModel.getOrCreate(requireActivity(), args.recipientId)+ viewModel.saveNow(chatColors) { savedColors ->+ chatColorSelectionViewModel.save(savedColors)+ } - tabLayoutMediator.attach()+ close()+ } - val startPage = CustomChatColorCreatorFragmentArgs.fromBundle(requireArguments()).startPage- pager.setCurrentItem(startPage, false)+ private fun close() {+ if (!isClosing) {+ isClosing = true+ findNavController().popBackStack()+ }+ }++ private inner class Callbacks(+ private val selectedTab: MutableState<CustomChatColorCreatorTab>,+ private val showGradientTip: MutableState<Boolean>+ ) : CustomChatColorCreatorScreenCallbacks {+ override fun onNavigationClick() = close()++ override fun onTabSelected(tab: CustomChatColorCreatorTab) {+ selectedTab.value = tab+ showGradientTip.value = false+ }++ override fun onHueChange(huePosition: Int) = viewModel.setHueProgress(huePosition)++ override fun onSaturationChange(saturationPosition: Int) = viewModel.setSaturationProgress(saturationPosition)++ override fun onSelectedEdgeChange(edge: CustomChatColorEdge) = viewModel.setSelectedEdge(edge)++ override fun onDegreesChange(degrees: Float) = viewModel.setDegrees(degrees)++ override fun onSaveClick(chatColors: ChatColors) {+ if (!isClosing) {+ viewModel.startSave(chatColors)+ }+ }++ override fun onSaveConfirmed(chatColors: ChatColors) = save(chatColors)++ override fun onUsageWarningDismissed() {+ usageWarning = null+ }++ override fun onGradientTipDismissed() {+ showGradientTip.value = false+ } } }diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorCreatorPageFragment.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorCreatorPageFragment.ktdeleted file mode 100644index 08ca86c..0000000--- a/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorCreatorPageFragment.kt+++ /dev/null@@ -1,400 +0,0 @@-package org.thoughtcrime.securesms.conversation.colors.ui.custom--import android.content.Context-import android.graphics.Canvas-import android.graphics.Color-import android.graphics.ColorFilter-import android.graphics.Paint-import android.graphics.Path-import android.graphics.PixelFormat-import android.graphics.PointF-import android.graphics.RectF-import android.graphics.drawable.Drawable-import android.graphics.drawable.GradientDrawable-import android.os.Build-import android.os.Bundle-import android.view.View-import android.view.ViewGroup-import android.widget.PopupWindow-import android.widget.ScrollView-import android.widget.SeekBar-import androidx.annotation.ColorInt-import androidx.annotation.Dimension-import androidx.appcompat.widget.AppCompatSeekBar-import androidx.core.content.ContextCompat-import androidx.core.graphics.ColorUtils-import androidx.fragment.app.Fragment-import androidx.lifecycle.ViewModelProvider-import androidx.navigation.Navigation-import com.google.android.material.dialog.MaterialAlertDialogBuilder-import org.signal.core.util.Util-import org.thoughtcrime.securesms.R-import org.thoughtcrime.securesms.conversation.colors.ChatColors-import org.thoughtcrime.securesms.conversation.colors.ui.ChatColorPreviewView-import org.thoughtcrime.securesms.conversation.colors.ui.ChatColorSelectionViewModel-import org.thoughtcrime.securesms.keyvalue.SignalStore-import org.thoughtcrime.securesms.util.ViewUtil-import org.thoughtcrime.securesms.util.customizeOnDraw--private const val MAX_SEEK_DIVISIONS = 1023-private const val MAX_HUE = 360--private const val PAGE_ARG = "page"-private const val SINGLE_PAGE = 0-private const val GRADIENT_PAGE = 1--class CustomChatColorCreatorPageFragment :- Fragment(R.layout.custom_chat_color_creator_fragment_page) {-- private lateinit var hueSlider: AppCompatSeekBar- private lateinit var saturationSlider: AppCompatSeekBar- private lateinit var preview: ChatColorPreviewView-- override fun onViewCreated(view: View, savedInstanceState: Bundle?) {- val args: CustomChatColorCreatorFragmentArgs = CustomChatColorCreatorFragmentArgs.fromBundle(requireArguments())- val chatColorSelectionViewModel: ChatColorSelectionViewModel = ChatColorSelectionViewModel.getOrCreate(requireActivity(), args.recipientId)- val page: Int = requireArguments().getInt(PAGE_ARG)- val factory: CustomChatColorCreatorViewModel.Factory = CustomChatColorCreatorViewModel.Factory(MAX_SEEK_DIVISIONS, ChatColors.Id.forLongValue(args.chatColorId), args.recipientId, createRepository())- val viewModel: CustomChatColorCreatorViewModel = ViewModelProvider(- requireParentFragment(),- factory- )[CustomChatColorCreatorViewModel::class.java]-- preview = view.findViewById(R.id.chat_color_preview)-- val hueThumb = ThumbDrawable(requireContext())- val saturationThumb = ThumbDrawable(requireContext())-- val gradientTool: CustomChatColorGradientToolView = view.findViewById(R.id.gradient_tool)- val save: View = view.findViewById(R.id.save)- val scrollView: ScrollView = view.findViewById(R.id.scroll_view)-- if (page == SINGLE_PAGE) {- gradientTool.visibility = View.GONE- } else {- gradientTool.setListener(object : CustomChatColorGradientToolView.Listener {- override fun onGestureStarted() {- scrollView.requestDisallowInterceptTouchEvent(true)- }-- override fun onGestureFinished() {- scrollView.requestDisallowInterceptTouchEvent(false)- }-- override fun onDegreesChanged(degrees: Float) {- viewModel.setDegrees(degrees)- }-- override fun onSelectedEdgeChanged(edge: CustomChatColorEdge) {- viewModel.setSelectedEdge(edge)- }- })- }-- hueSlider = view.findViewById(R.id.hue_slider)- saturationSlider = view.findViewById(R.id.saturation_slider)-- hueSlider.thumb = hueThumb- saturationSlider.thumb = saturationThumb-- hueSlider.max = MAX_SEEK_DIVISIONS- saturationSlider.max = MAX_SEEK_DIVISIONS-- val colors: IntArray = (0..MAX_SEEK_DIVISIONS).map { hue ->- ColorUtils.HSLToColor(- floatArrayOf(- hue.toHue(MAX_SEEK_DIVISIONS),- 1f,- calculateLightness(hue.toFloat(), valueFor60To80 = 0.4f)- )- )- }.toIntArray()-- val hueGradientDrawable = GradientDrawable(GradientDrawable.Orientation.LEFT_RIGHT, colors)-- hueSlider.progressDrawable = hueGradientDrawable.forSeekBar()-- val saturationProgressDrawable = GradientDrawable().apply {- orientation = GradientDrawable.Orientation.LEFT_RIGHT- }-- saturationSlider.progressDrawable = saturationProgressDrawable.forSeekBar()-- hueSlider.setOnSeekBarChangeListener(- OnProgressChangedListener {- viewModel.setHueProgress(it)- }- )-- saturationSlider.setOnSeekBarChangeListener(- OnProgressChangedListener {- viewModel.setSaturationProgress(it)- }- )-- viewModel.events.observe(viewLifecycleOwner) { event ->- when (event) {- is CustomChatColorCreatorViewModel.Event.SaveNow -> {- viewModel.saveNow(event.chatColors) { colors ->- chatColorSelectionViewModel.save(colors)- }- Navigation.findNavController(requireParentFragment().requireView()).popBackStack()- }- is CustomChatColorCreatorViewModel.Event.Warn -> MaterialAlertDialogBuilder(requireContext())- .setTitle(R.string.CustomChatColorCreatorFragmentPage__edit_color)- .setMessage(resources.getQuantityString(R.plurals.CustomChatColorCreatorFragmentPage__this_color_is_used, event.usageCount, event.usageCount))- .setPositiveButton(R.string.save) { dialog, _ ->- dialog.dismiss()- viewModel.saveNow(event.chatColors) { colors ->- chatColorSelectionViewModel.save(colors)- }- Navigation.findNavController(requireParentFragment().requireView()).popBackStack()- }- .setNegativeButton(android.R.string.cancel) { dialog, _ ->- dialog.dismiss()- }- .show()- }- }-- viewModel.state.observe(viewLifecycleOwner) { state ->- if (state.loading) {- return@observe- }-- val sliderState: ColorSlidersState = requireNotNull(state.sliderStates[state.selectedEdge])-- hueSlider.progress = sliderState.huePosition- saturationSlider.progress = sliderState.saturationPosition-- val color: Int = sliderState.getColor()- hueThumb.setColor(sliderState.getHueColor())- saturationThumb.setColor(color)- saturationProgressDrawable.colors = sliderState.getSaturationColors()-- preview.setWallpaper(state.wallpaper)-- if (page == 0) {- val chatColor = ChatColors.forColor(ChatColors.Id.NotSet, color)- preview.setChatColors(chatColor)- save.setOnClickListener {- viewModel.startSave(chatColor)- }- } else {- val topEdgeColor: ColorSlidersState = requireNotNull(state.sliderStates[CustomChatColorEdge.TOP])- val bottomEdgeColor: ColorSlidersState = requireNotNull(state.sliderStates[CustomChatColorEdge.BOTTOM])- val chatColor: ChatColors = ChatColors.forGradient(- ChatColors.Id.NotSet,- ChatColors.LinearGradient(- state.degrees,- intArrayOf(topEdgeColor.getColor(), bottomEdgeColor.getColor()),- floatArrayOf(0f, 1f)- )- )- preview.setChatColors(chatColor)- gradientTool.setSelectedEdge(state.selectedEdge)- gradientTool.setDegrees(state.degrees)- gradientTool.setTopColor(topEdgeColor.getColor())- gradientTool.setBottomColor(bottomEdgeColor.getColor())- save.setOnClickListener {- viewModel.startSave(chatColor)- }- }- }-- if (page == 1 && SignalStore.chatColors.shouldShowGradientTooltip) {- view.post {- SignalStore.chatColors.shouldShowGradientTooltip = false- val contentView = layoutInflater.inflate(R.layout.gradient_tool_tooltip, view as ViewGroup, false)- val popupWindow = PopupWindow(contentView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)-- popupWindow.isOutsideTouchable = false- popupWindow.isFocusable = true-- if (Build.VERSION.SDK_INT > 21) {- popupWindow.elevation = ViewUtil.dpToPx(8).toFloat()- }-- popupWindow.showAsDropDown(gradientTool, 0, -gradientTool.measuredHeight + ViewUtil.dpToPx(48))- }- }- }-- private fun createRepository(): CustomChatColorCreatorRepository {- return CustomChatColorCreatorRepository(requireContext())- }-- @ColorInt- private fun ColorSlidersState.getHueColor(): Int {- val hue = huePosition.toHue(MAX_SEEK_DIVISIONS)- return ColorUtils.HSLToColor(- floatArrayOf(- hue,- 1f,- calculateLightness(hue, 0.4f)- )- )- }-- @ColorInt- private fun ColorSlidersState.getColor(): Int {- val hue = huePosition.toHue(MAX_SEEK_DIVISIONS)- return ColorUtils.HSLToColor(- floatArrayOf(- hue,- saturationPosition.toUnit(MAX_SEEK_DIVISIONS),- calculateLightness(hue)- )- )- }-- private fun ColorSlidersState.getSaturationColors(): IntArray {- val hue = huePosition.toHue(MAX_SEEK_DIVISIONS)- val level = calculateLightness(hue)-- return listOf(0f, 1f).map {- ColorUtils.HSLToColor(- floatArrayOf(- hue,- it,- level- )- )- }.toIntArray()- }-- private fun calculateLightness(hue: Float, valueFor60To80: Float = 0.3f): Float {- val point1 = PointF()- val point2 = PointF()-- if (hue >= 0f && hue < 60f) {- point1.set(0f, 0.45f)- point2.set(60f, valueFor60To80)- } else if (hue >= 60f && hue < 180f) {- return valueFor60To80- } else if (hue >= 180f && hue < 240f) {- point1.set(180f, valueFor60To80)- point2.set(240f, 0.5f)- } else if (hue >= 240f && hue < 300f) {- point1.set(240f, 0.5f)- point2.set(300f, 0.4f)- } else if (hue >= 300f && hue < 360f) {- point1.set(300f, 0.4f)- point2.set(360f, 0.45f)- } else {- return 0.45f- }-- return interpolate(point1, point2, hue)- }-- private fun interpolate(point1: PointF, point2: PointF, x: Float): Float {- return ((point1.y * (point2.x - x)) + (point2.y * (x - point1.x))) / (point2.x - point1.x)- }-- private fun Number.toHue(max: Number): Float {- return Util.clamp(toFloat() * (MAX_HUE / max.toFloat()), 0f, MAX_HUE.toFloat())- }-- private fun Number.toUnit(max: Number): Float {- return Util.clamp(toFloat() / max.toFloat(), 0f, 1f)- }-- private fun Drawable.forSeekBar(): Drawable {- val height: Int = ViewUtil.dpToPx(8)- val radii: FloatArray = (1..8).map { 50f }.toFloatArray()- val bounds = RectF()- val clipPath = Path()-- return customizeOnDraw { wrapped, canvas ->- canvas.save()- bounds.set(this.bounds)- bounds.inset(0f, (height / 2f) + 1)-- clipPath.rewind()- clipPath.addRoundRect(bounds, radii, Path.Direction.CW)-- canvas.clipPath(clipPath)- wrapped.draw(canvas)- canvas.restore()- }- }-- private class OnProgressChangedListener(private val updateFn: (Int) -> Unit) :- SeekBar.OnSeekBarChangeListener {- override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {- updateFn(progress)- }-- override fun onStartTrackingTouch(seekBar: SeekBar?) = Unit- override fun onStopTrackingTouch(seekBar: SeekBar?) = Unit- }-- private class ThumbDrawable(context: Context) : Drawable() {-- private val borderPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {- color = ContextCompat.getColor(context, R.color.signal_background_primary)- }-- private val paint = Paint(Paint.ANTI_ALIAS_FLAG).apply {- color = Color.TRANSPARENT- }-- private val borderWidth: Int = ViewUtil.dpToPx(THUMB_MARGIN)- private val thumbInnerSize: Int = ViewUtil.dpToPx(THUMB_INNER_SIZE)- private val innerRadius: Float = thumbInnerSize / 2f- private val thumbSize: Float = (thumbInnerSize + borderWidth).toFloat()- private val thumbRadius: Float = thumbSize / 2f-- override fun getIntrinsicHeight(): Int = ViewUtil.dpToPx(48)-- override fun getIntrinsicWidth(): Int = ViewUtil.dpToPx(48)-- fun setColor(@ColorInt color: Int) {- paint.color = color- invalidateSelf()- }-- override fun draw(canvas: Canvas) {- canvas.drawCircle(- (bounds.width() / 2f) + bounds.left,- (bounds.height() / 2f) + bounds.top,- thumbRadius,- borderPaint- )- canvas.drawCircle(- (bounds.width() / 2f) + bounds.left,- (bounds.height() / 2f) + bounds.top,- innerRadius,- paint- )- }-- override fun setAlpha(alpha: Int) = Unit- override fun setColorFilter(colorFilter: ColorFilter?) = Unit-- override fun getOpacity(): Int = PixelFormat.TRANSPARENT-- companion object {- @Dimension(unit = Dimension.DP)- private val THUMB_INNER_SIZE = 16-- @Dimension(unit = Dimension.DP)- private val THUMB_MARGIN = 1- }- }-- companion object {-- fun forSingle(bundle: Bundle): Fragment = forPage(SINGLE_PAGE, bundle)-- fun forGradient(bundle: Bundle): Fragment = forPage(GRADIENT_PAGE, bundle)-- private fun forPage(page: Int, bundle: Bundle): Fragment = CustomChatColorCreatorPageFragment().apply {- arguments = Bundle().apply {- putInt(PAGE_ARG, page)- putAll(bundle)- }- }- }-}diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorCreatorScreen.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorCreatorScreen.ktnew file mode 100644index 0000000..40deca9--- /dev/null+++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorCreatorScreen.kt@@ -0,0 +1,602 @@+/*+ * Copyright 2026 Signal Messenger, LLC+ * SPDX-License-Identifier: AGPL-3.0-only+ */++package org.thoughtcrime.securesms.conversation.colors.ui.custom++import android.view.LayoutInflater+import androidx.annotation.ColorInt+import androidx.annotation.StringRes+import androidx.compose.foundation.Canvas+import androidx.compose.foundation.background+import androidx.compose.foundation.gestures.awaitEachGesture+import androidx.compose.foundation.gestures.awaitFirstDown+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.BoxWithConstraints+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Spacer+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.widthIn+import androidx.compose.foundation.layout.wrapContentHeight+import androidx.compose.foundation.rememberScrollState+import androidx.compose.foundation.shape.GenericShape+import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.foundation.verticalScroll+import androidx.compose.material3.Card+import androidx.compose.material3.ExperimentalMaterial3Api+import androidx.compose.material3.Icon+import androidx.compose.material3.IconButton+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.PrimaryTabRow+import androidx.compose.material3.Scaffold+import androidx.compose.material3.Slider+import androidx.compose.material3.Tab+import androidx.compose.material3.TabRowDefaults+import androidx.compose.material3.Text+import androidx.compose.material3.TopAppBar+import androidx.compose.runtime.Composable+import androidx.compose.runtime.CompositionLocalProvider+import androidx.compose.runtime.remember+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.geometry.CornerRadius+import androidx.compose.ui.graphics.Brush+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.graphics.toArgb+import androidx.compose.ui.input.pointer.PointerEventPass+import androidx.compose.ui.input.pointer.pointerInput+import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.platform.LocalInspectionMode+import androidx.compose.ui.platform.LocalLayoutDirection+import androidx.compose.ui.res.colorResource+import androidx.compose.ui.res.pluralStringResource+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.semantics.ProgressBarRangeInfo+import androidx.compose.ui.semantics.clearAndSetSemantics+import androidx.compose.ui.semantics.contentDescription+import androidx.compose.ui.semantics.disabled+import androidx.compose.ui.semantics.progressBarRangeInfo+import androidx.compose.ui.semantics.semantics+import androidx.compose.ui.semantics.setProgress+import androidx.compose.ui.text.font.FontWeight+import androidx.compose.ui.unit.Dp+import androidx.compose.ui.unit.LayoutDirection+import androidx.compose.ui.unit.dp+import androidx.compose.ui.unit.sp+import androidx.compose.ui.viewinterop.AndroidView+import androidx.core.graphics.ColorUtils+import com.google.android.material.color.MaterialColors+import org.signal.core.ui.compose.Buttons+import org.signal.core.ui.compose.DayNightPreviews+import org.signal.core.ui.compose.Dialogs+import org.signal.core.ui.compose.Previews+import org.signal.core.ui.compose.SignalIcons+import org.signal.core.util.Util+import org.thoughtcrime.securesms.R+import org.thoughtcrime.securesms.conversation.colors.ChatColors+import org.thoughtcrime.securesms.conversation.colors.ui.ChatColorPreviewView+import org.thoughtcrime.securesms.wallpaper.ChatWallpaper+import java.util.EnumMap+import kotlin.math.roundToInt++/** The largest position of the hue and saturation sliders. */+internal const val MAX_SLIDER_VALUE = 1023++private const val MAX_HUE = 360++private val GRADIENT_TOOL_MARGIN = 10.dp+private val GRADIENT_TIP_OFFSET = 48.dp+private val SLIDER_THUMB_SIZE = 17.dp+private val SLIDER_THUMB_INNER_RADIUS = 8.dp+private val SLIDER_TRACK_HEIGHT = 8.dp++/** Lines the slider tracks up 16dp in from the edges of the screen, accounting for the half of the thumb that hangs past them. */+private val SLIDER_HORIZONTAL_PADDING = 16.dp - SLIDER_THUMB_SIZE / 2++/**+ * The editor's tabs, in the order of the `start_page` navigation argument.+ */+enum class CustomChatColorCreatorTab(@StringRes val label: Int) {+ SOLID(R.string.CustomChatColorCreatorFragment__solid),+ GRADIENT(R.string.CustomChatColorCreatorFragment__gradient);++ companion object {+ fun fromStartPage(startPage: Int): CustomChatColorCreatorTab = entries[startPage.coerceIn(0, entries.lastIndex)]+ }+}++interface CustomChatColorCreatorScreenCallbacks {+ fun onNavigationClick() = Unit+ fun onTabSelected(tab: CustomChatColorCreatorTab) = Unit+ fun onHueChange(huePosition: Int) = Unit+ fun onSaturationChange(saturationPosition: Int) = Unit+ fun onSelectedEdgeChange(edge: CustomChatColorEdge) = Unit+ fun onDegreesChange(degrees: Float) = Unit+ fun onSaveClick(chatColors: ChatColors) = Unit+ fun onSaveConfirmed(chatColors: ChatColors) = Unit+ fun onUsageWarningDismissed() = Unit+ fun onGradientTipDismissed() = Unit++ object Empty : CustomChatColorCreatorScreenCallbacks+}++/**+ * Creates or edits a custom chat color, as either a solid color or a gradient, with a live preview over the chat's wallpaper.+ *+ * @param showGradientTip Whether to explain how to use the gradient tool. Any touch dismisses it.+ * @param usageWarning When not null, the number of chats already using the color, which the user has to confirm before saving changes to it.+ */+@Composable+fun CustomChatColorCreatorScreen(+ state: CustomChatColorCreatorState,+ selectedTab: CustomChatColorCreatorTab,+ callbacks: CustomChatColorCreatorScreenCallbacks,+ showGradientTip: Boolean = false,+ usageWarning: Int? = null+) {+ val chatColors: ChatColors = state.toChatColors(selectedTab)+ val selectedSliders: ColorSlidersState = requireNotNull(state.sliderStates[state.selectedEdge])+ val hueTrack: Brush = remember { Brush.horizontalGradient(hueTrackColors()) }++ Scaffold(+ topBar = { TopBar(onNavigationClick = callbacks::onNavigationClick) },+ modifier = Modifier.dismissOnTouch(enabled = showGradientTip, onDismiss = callbacks::onGradientTipDismissed)+ ) { contentPadding ->+ Column(modifier = Modifier.padding(contentPadding)) {+ Tabs(+ selectedTab = selectedTab,+ onTabSelected = callbacks::onTabSelected+ )++ BoxWithConstraints(modifier = Modifier.weight(1f)) {+ Column(+ modifier = Modifier+ .verticalScroll(rememberScrollState())+ .heightIn(min = maxHeight)+ ) {+ Box {+ ChatColorPreview(+ wallpaper = state.wallpaper,+ chatColors = if (state.loading) null else chatColors,+ modifier = Modifier+ .fillMaxWidth()+ .padding(16.dp)+ )++ if (selectedTab == CustomChatColorCreatorTab.GRADIENT && !state.loading) {+ CustomChatColorGradientTool(+ degrees = state.degrees,+ selectedEdge = state.selectedEdge,+ topColor = Color(requireNotNull(state.sliderStates[CustomChatColorEdge.TOP]).getColor()),+ bottomColor = Color(requireNotNull(state.sliderStates[CustomChatColorEdge.BOTTOM]).getColor()),+ onSelectedEdgeChange = callbacks::onSelectedEdgeChange,+ onDegreesChange = callbacks::onDegreesChange,+ modifier = Modifier+ .matchParentSize()+ .padding(GRADIENT_TOOL_MARGIN)+ )+ }++ if (selectedTab == CustomChatColorCreatorTab.GRADIENT && showGradientTip) {+ GradientTip(+ modifier = Modifier+ .align(Alignment.TopCenter)+ .padding(top = GRADIENT_TOOL_MARGIN + GRADIENT_TIP_OFFSET)+ )+ }+ }++ ColorSlider(+ label = stringResource(R.string.CustomChatColorCreatorFragment__hue),+ position = selectedSliders.huePosition,+ onPositionChange = callbacks::onHueChange,+ track = hueTrack,+ thumbColor = Color(selectedSliders.getHueColor()),+ enabled = !state.loading+ )++ ColorSlider(+ label = stringResource(R.string.CustomChatColorCreatorFragment__saturation),+ position = selectedSliders.saturationPosition,+ onPositionChange = callbacks::onSaturationChange,+ track = Brush.horizontalGradient(selectedSliders.getSaturationColors()),+ thumbColor = Color(selectedSliders.getColor()),+ enabled = !state.loading+ )++ Spacer(modifier = Modifier.weight(1f))++ Buttons.LargePrimary(+ onClick = { callbacks.onSaveClick(chatColors) },+ enabled = !state.loading,+ modifier = Modifier+ .align(Alignment.End)+ .padding(end = 16.dp, bottom = 16.dp)+ .widthIn(min = 88.dp)+ ) {+ Text(text = stringResource(R.string.CustomChatColorCreatorFragmentPage__save))+ }+ }+ }+ }+ }++ if (usageWarning != null) {+ Dialogs.SimpleAlertDialog(+ title = stringResource(R.string.CustomChatColorCreatorFragmentPage__edit_color),+ body = pluralStringResource(R.plurals.CustomChatColorCreatorFragmentPage__this_color_is_used, usageWarning, usageWarning),+ confirm = stringResource(R.string.save),+ dismiss = stringResource(android.R.string.cancel),+ onConfirm = { callbacks.onSaveConfirmed(chatColors) },+ onDismiss = callbacks::onUsageWarningDismissed+ )+ }+}++@OptIn(ExperimentalMaterial3Api::class)+@Composable+private fun TopBar(onNavigationClick: () -> Unit) {+ TopAppBar(+ title = {+ Text(+ text = stringResource(R.string.ChatColorSelectionFragment__chat_color),+ style = MaterialTheme.typography.titleLarge.copy(fontSize = 20.sp, fontWeight = FontWeight.Medium)+ )+ },+ navigationIcon = {+ IconButton(+ onClick = onNavigationClick,+ modifier = Modifier.padding(end = 4.dp)+ ) {+ Icon(+ imageVector = SignalIcons.ArrowStart.imageVector,+ contentDescription = stringResource(R.string.CallQualitySomethingElseScreen__back)+ )+ }+ },+ expandedHeight = 56.dp+ )+}++@Composable+private fun Tabs(+ selectedTab: CustomChatColorCreatorTab,+ onTabSelected: (CustomChatColorCreatorTab) -> Unit+) {+ // The tabs take the hosting activity's primary color, which in light mode differs from the Compose theme's.+ val context = LocalContext.current+ val defaultColor = MaterialTheme.colorScheme.primary+ val selectedColor = remember(context, defaultColor) {+ Color(MaterialColors.getColor(context, androidx.appcompat.R.attr.colorPrimary, defaultColor.toArgb()))+ }++ PrimaryTabRow(+ selectedTabIndex = selectedTab.ordinal,+ indicator = {+ TabRowDefaults.PrimaryIndicator(+ modifier = Modifier.tabIndicatorOffset(selectedTab.ordinal, matchContentSize = true),+ width = Dp.Unspecified,+ color = selectedColor+ )+ }+ ) {+ CustomChatColorCreatorTab.entries.forEach { tab ->+ Tab(+ selected = tab == selectedTab,+ onClick = { onTabSelected(tab) },+ text = { Text(text = stringResource(tab.label), style = MaterialTheme.typography.labelLarge) },+ selectedContentColor = selectedColor,+ unselectedContentColor = MaterialTheme.colorScheme.onSurfaceVariant+ )+ }+ }+}++/**+ * The shared [ChatColorPreviewView], showing four chat bubbles in the given colors over the wallpaper.+ */+@Composable+private fun ChatColorPreview(+ wallpaper: ChatWallpaper?,+ chatColors: ChatColors?,+ modifier: Modifier = Modifier+) {+ Card(+ shape = RoundedCornerShape(4.dp),+ modifier = modifier+ ) {+ if (LocalInspectionMode.current) {+ Spacer(+ modifier = Modifier+ .fillMaxWidth()+ .height(300.dp)+ )+ } else {+ AndroidView(+ factory = { context -> LayoutInflater.from(context).inflate(R.layout.custom_chat_color_creator_preview, null) as ChatColorPreviewView },+ update = { preview ->+ preview.setWallpaper(wallpaper)+ if (chatColors != null) {+ preview.setChatColors(chatColors)+ }+ },+ modifier = Modifier.fillMaxWidth()+ )+ }+ }+}++/**+ * A slider labelled by the text above it, which TalkBack reads as a single adjustable control.+ */+@OptIn(ExperimentalMaterial3Api::class)+@Composable+private fun ColorSlider(+ label: String,+ position: Int,+ onPositionChange: (Int) -> Unit,+ track: Brush,+ thumbColor: Color,+ enabled: Boolean,+ modifier: Modifier = Modifier+) {+ Column(+ modifier = modifier.semantics(mergeDescendants = true) {+ contentDescription = label+ progressBarRangeInfo = ProgressBarRangeInfo(position.toFloat(), 0f..MAX_SLIDER_VALUE.toFloat())+ if (enabled) {+ setProgress { value ->+ onPositionChange(value.coerceIn(0f, MAX_SLIDER_VALUE.toFloat()).roundToInt())+ true+ }+ } else {+ disabled()+ }+ }+ ) {+ Text(+ text = label,+ style = MaterialTheme.typography.labelLarge,+ color = MaterialTheme.colorScheme.onSurfaceVariant,+ modifier = Modifier+ .fillMaxWidth()+ .heightIn(min = 40.dp)+ .wrapContentHeight(Alignment.CenterVertically)+ .padding(horizontal = 16.dp)+ )++ // The track's colors always run left to right, so the slider must too.+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Ltr) {+ Slider(+ value = position.toFloat(),+ onValueChange = { onPositionChange(it.roundToInt()) },+ enabled = enabled,+ valueRange = 0f..MAX_SLIDER_VALUE.toFloat(),+ thumb = { SliderThumb(color = thumbColor) },+ track = { SliderTrack(brush = track) },+ modifier = Modifier+ .fillMaxWidth()+ .padding(horizontal = SLIDER_HORIZONTAL_PADDING)+ .clearAndSetSemantics { }+ )+ }+ }+}++@Composable+private fun SliderThumb(color: Color) {+ val borderColor = colorResource(R.color.signal_background_primary)++ Canvas(modifier = Modifier.size(SLIDER_THUMB_SIZE)) {+ drawCircle(borderColor)+ drawCircle(color, radius = SLIDER_THUMB_INNER_RADIUS.toPx())+ }+}++@Composable+private fun SliderTrack(brush: Brush) {+ Canvas(+ modifier = Modifier+ .fillMaxWidth()+ .height(SLIDER_TRACK_HEIGHT)+ ) {+ drawRoundRect(brush = brush, cornerRadius = CornerRadius(size.height / 2f))+ }+}++@Composable+private fun GradientTip(modifier: Modifier = Modifier) {+ val color = colorResource(R.color.signal_accent_primary)++ Column(+ horizontalAlignment = Alignment.CenterHorizontally,+ modifier = modifier.padding(horizontal = 12.dp)+ ) {+ Spacer(+ modifier = Modifier+ .size(width = 16.dp, height = 8.dp)+ .background(color = color, shape = TipArrowShape)+ )++ Text(+ text = stringResource(R.string.CustomChatColorCreatorFragment__drag_to_change_the_direction_of_the_gradient),+ style = MaterialTheme.typography.bodyLarge,+ color = Color.White,+ modifier = Modifier+ .widthIn(max = 295.dp)+ .background(color = color, shape = RoundedCornerShape(8.dp))+ .padding(horizontal = 12.dp, vertical = 10.dp)+ )+ }+}++private val TipArrowShape = GenericShape { size, _ ->+ moveTo(size.width / 2f, 0f)+ lineTo(size.width, size.height)+ lineTo(0f, size.height)+ close()+}++/**+ * Calls [onDismiss] as soon as anything is touched, without getting in the way of the touch.+ */+private fun Modifier.dismissOnTouch(enabled: Boolean, onDismiss: () -> Unit): Modifier {+ if (!enabled) {+ return this+ }++ return pointerInput(onDismiss) {+ awaitEachGesture {+ awaitFirstDown(requireUnconsumed = false, pass = PointerEventPass.Initial)+ onDismiss()+ }+ }+}++/**+ * The colors on screen for the given tab: on the solid tab, the color of the selected edge, and on the gradient tab, a gradient+ * from the top edge's color to the bottom edge's.+ */+private fun CustomChatColorCreatorState.toChatColors(tab: CustomChatColorCreatorTab): ChatColors {+ return when (tab) {+ CustomChatColorCreatorTab.SOLID -> {+ ChatColors.forColor(ChatColors.Id.NotSet, requireNotNull(sliderStates[selectedEdge]).getColor())+ }++ CustomChatColorCreatorTab.GRADIENT -> {+ val topEdge: ColorSlidersState = requireNotNull(sliderStates[CustomChatColorEdge.TOP])+ val bottomEdge: ColorSlidersState = requireNotNull(sliderStates[CustomChatColorEdge.BOTTOM])++ ChatColors.forGradient(+ ChatColors.Id.NotSet,+ ChatColors.LinearGradient(+ degrees,+ intArrayOf(topEdge.getColor(), bottomEdge.getColor()),+ floatArrayOf(0f, 1f)+ )+ )+ }+ }+}++@ColorInt+private fun ColorSlidersState.getColor(): Int {+ val hue = huePosition.toHue()+ return ColorUtils.HSLToColor(+ floatArrayOf(+ hue,+ saturationPosition.toUnit(),+ calculateLightness(hue)+ )+ )+}++@ColorInt+private fun ColorSlidersState.getHueColor(): Int {+ val hue = huePosition.toHue()+ return ColorUtils.HSLToColor(+ floatArrayOf(+ hue,+ 1f,+ calculateLightness(hue, valueFor60To180 = 0.4f)+ )+ )+}++private fun ColorSlidersState.getSaturationColors(): List<Color> {+ val hue = huePosition.toHue()+ val lightness = calculateLightness(hue)++ return listOf(0f, 1f).map { saturation ->+ Color(ColorUtils.HSLToColor(floatArrayOf(hue, saturation, lightness)))+ }+}++/**+ * The hue track's colors, one per slider position. Their lightness is looked up by slider position rather than by hue, which is how+ * the track has always been drawn.+ */+private fun hueTrackColors(): List<Color> {+ return (0..MAX_SLIDER_VALUE).map { position ->+ Color(+ ColorUtils.HSLToColor(+ floatArrayOf(+ position.toHue(),+ 1f,+ calculateLightness(position.toFloat(), valueFor60To180 = 0.4f)+ )+ )+ )+ }+}++private fun calculateLightness(hue: Float, valueFor60To180: Float = 0.3f): Float {+ return when {+ hue >= 0f && hue < 60f -> interpolate(0f, 0.45f, 60f, valueFor60To180, hue)+ hue >= 60f && hue < 180f -> valueFor60To180+ hue >= 180f && hue < 240f -> interpolate(180f, valueFor60To180, 240f, 0.5f, hue)+ hue >= 240f && hue < 300f -> interpolate(240f, 0.5f, 300f, 0.4f, hue)+ hue >= 300f && hue < 360f -> interpolate(300f, 0.4f, 360f, 0.45f, hue)+ else -> 0.45f+ }+}++/**+ * The value at [x] on the line through ([x1], [y1]) and ([x2], [y2]).+ */+private fun interpolate(x1: Float, y1: Float, x2: Float, y2: Float, x: Float): Float {+ return ((y1 * (x2 - x)) + (y2 * (x - x1))) / (x2 - x1)+}++private fun Number.toHue(): Float {+ return Util.clamp(toFloat() * (MAX_HUE / MAX_SLIDER_VALUE.toFloat()), 0f, MAX_HUE.toFloat())+}++private fun Number.toUnit(): Float {+ return Util.clamp(toFloat() / MAX_SLIDER_VALUE.toFloat(), 0f, 1f)+}++@DayNightPreviews+@Composable+private fun CustomChatColorCreatorScreenSolidPreview() {+ Previews.Preview {+ CustomChatColorCreatorScreen(+ state = previewState(),+ selectedTab = CustomChatColorCreatorTab.SOLID,+ callbacks = CustomChatColorCreatorScreenCallbacks.Empty+ )+ }+}++@DayNightPreviews+@Composable+private fun CustomChatColorCreatorScreenGradientPreview() {+ Previews.Preview {+ CustomChatColorCreatorScreen(+ state = previewState(),+ selectedTab = CustomChatColorCreatorTab.GRADIENT,+ callbacks = CustomChatColorCreatorScreenCallbacks.Empty,+ showGradientTip = true+ )+ }+}++private fun previewState(): CustomChatColorCreatorState {+ return CustomChatColorCreatorState(+ loading = false,+ wallpaper = null,+ sliderStates = EnumMap(+ mapOf(+ CustomChatColorEdge.TOP to ColorSlidersState(huePosition = 200, saturationPosition = 800),+ CustomChatColorEdge.BOTTOM to ColorSlidersState(huePosition = 700, saturationPosition = 600)+ )+ ),+ selectedEdge = CustomChatColorEdge.BOTTOM,+ degrees = 150f+ )+}diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorCreatorViewModel.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorCreatorViewModel.ktindex d044771..ad6ad14 100644--- a/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorCreatorViewModel.kt+++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorCreatorViewModel.kt@@ -77,7 +77,7 @@ class CustomChatColorCreatorViewModel( fun setHueProgress(progress: Int) { store.update { state -> state.copy(- sliderStates = state.sliderStates.apply {+ sliderStates = EnumMap(state.sliderStates).apply { val oldData: ColorSlidersState = requireNotNull(get(state.selectedEdge)) put(state.selectedEdge, oldData.copy(huePosition = progress)) }@@ -88,7 +88,7 @@ class CustomChatColorCreatorViewModel( fun setSaturationProgress(progress: Int) { store.update { state -> state.copy(- sliderStates = state.sliderStates.apply {+ sliderStates = EnumMap(state.sliderStates).apply { val oldData: ColorSlidersState = requireNotNull(get(state.selectedEdge)) put(state.selectedEdge, oldData.copy(saturationPosition = progress)) }diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorGradientTool.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorGradientTool.ktnew file mode 100644index 0000000..0dfee23--- /dev/null+++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorGradientTool.kt@@ -0,0 +1,160 @@+/*+ * Copyright 2026 Signal Messenger, LLC+ * SPDX-License-Identifier: AGPL-3.0-only+ */++package org.thoughtcrime.securesms.conversation.colors.ui.custom++import androidx.compose.foundation.Canvas+import androidx.compose.foundation.gestures.awaitEachGesture+import androidx.compose.foundation.gestures.awaitFirstDown+import androidx.compose.foundation.gestures.drag+import androidx.compose.runtime.Composable+import androidx.compose.runtime.getValue+import androidx.compose.runtime.rememberUpdatedState+import androidx.compose.ui.Modifier+import androidx.compose.ui.geometry.Offset+import androidx.compose.ui.geometry.Size+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.input.pointer.pointerInput+import androidx.compose.ui.res.colorResource+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.semantics.contentDescription+import androidx.compose.ui.semantics.semantics+import androidx.compose.ui.unit.dp+import androidx.compose.ui.unit.toSize+import org.thoughtcrime.securesms.R+import kotlin.math.abs+import kotlin.math.atan2+import kotlin.math.cos+import kotlin.math.min+import kotlin.math.sin++/** Distance from the tool's bounds to the outline the handles travel along, and how close a touch must be to grab a handle. */+private val HANDLE_TOUCH_RADIUS = 24.dp+private val HANDLE_RADIUS = 20.dp+private val HANDLE_BORDER = 1.dp+private val HANDLE_BORDER_SELECTED = 4.dp+private val HANDLE_PADDING = 2.dp+private val HANDLE_PADDING_SELECTED = 1.dp+private val PIPE_WIDTH = 6.dp+private val PIPE_BORDER = 1.dp++/**+ * Renders the gradient customization tool.+ *+ * The tool is two selectable handles on either side of a rectangle with a pipe connecting them, a TOP and a BOTTOM (an edge).+ *+ * Touching a handle selects its edge, and dragging it moves it around the outline of the rectangle while the other edge traces+ * along the opposite side.+ *+ * The handles are where a line through the center of the rectangle, at the tool's angle, crosses the outline. The tool's math+ * uses an origin at the center and measures angles counter-clockwise from a vector pointing directly towards the right hand side.+ * This doesn't line up with what the gradient rendering math requires, so degrees are converted when they come into or leave this+ * tool (see [invertDegrees]).+ */+@Composable+fun CustomChatColorGradientTool(+ degrees: Float,+ selectedEdge: CustomChatColorEdge,+ topColor: Color,+ bottomColor: Color,+ onSelectedEdgeChange: (CustomChatColorEdge) -> Unit,+ onDegreesChange: (Float) -> Unit,+ modifier: Modifier = Modifier+) {+ val label = stringResource(R.string.CustomChatColorCreatorFragment__gradient_direction)+ val backgroundColor = colorResource(R.color.signal_background_primary)+ val borderColor = colorResource(R.color.signal_inverse_transparent_10)+ val selectedBorderColor = colorResource(R.color.signal_inverse_transparent_60)++ val currentDegrees by rememberUpdatedState(degrees)+ val currentOnSelectedEdgeChange by rememberUpdatedState(onSelectedEdgeChange)+ val currentOnDegreesChange by rememberUpdatedState(onDegreesChange)++ Canvas(+ modifier = modifier+ .semantics { contentDescription = label }+ .pointerInput(Unit) {+ awaitEachGesture {+ val down = awaitFirstDown()+ val handles = GradientHandles(size.toSize(), HANDLE_TOUCH_RADIUS.toPx(), currentDegrees)+ val edge = handles.edgeAt(down.position, HANDLE_TOUCH_RADIUS.toPx()) ?: return@awaitEachGesture++ down.consume()+ currentOnSelectedEdgeChange(edge)++ drag(down.id) { change ->+ change.consume()+ currentOnDegreesChange(handles.degreesTowards(change.position, edge))+ }+ }+ }+ ) {+ val handles = GradientHandles(size, HANDLE_TOUCH_RADIUS.toPx(), degrees)++ val (selected, other) = when (selectedEdge) {+ CustomChatColorEdge.TOP -> handles.top to handles.bottom+ CustomChatColorEdge.BOTTOM -> handles.bottom to handles.top+ }++ val (selectedColor, otherColor) = when (selectedEdge) {+ CustomChatColorEdge.TOP -> topColor to bottomColor+ CustomChatColorEdge.BOTTOM -> bottomColor to topColor+ }++ drawLine(borderColor, selected, other, strokeWidth = PIPE_WIDTH.toPx())+ drawLine(backgroundColor, selected, other, strokeWidth = (PIPE_WIDTH - PIPE_BORDER * 2).toPx())++ drawCircle(borderColor, radius = (HANDLE_RADIUS + HANDLE_BORDER).toPx(), center = other)+ drawCircle(backgroundColor, radius = HANDLE_RADIUS.toPx(), center = other)+ drawCircle(otherColor, radius = (HANDLE_RADIUS - HANDLE_PADDING).toPx(), center = other)++ drawCircle(selectedBorderColor, radius = (HANDLE_RADIUS + HANDLE_BORDER_SELECTED).toPx(), center = selected)+ drawCircle(backgroundColor, radius = HANDLE_RADIUS.toPx(), center = selected)+ drawCircle(selectedColor, radius = (HANDLE_RADIUS - HANDLE_PADDING_SELECTED).toPx(), center = selected)+ }+}++/**+ * Where the handles sit for the given gradient [degrees], within a tool of the given [size] whose outline is inset by [inset].+ */+private class GradientHandles(size: Size, inset: Float, degrees: Float) {++ private val center = Offset(size.width / 2f, size.height / 2f)++ val top: Offset+ val bottom: Offset++ init {+ val radians = degrees.invertDegrees().toRadians()+ val direction = Offset(cos(radians), -sin(radians))+ val distance = min((center.x - inset) / abs(direction.x), (center.y - inset) / abs(direction.y)).coerceAtLeast(0f)++ top = center + direction * distance+ bottom = center - direction * distance+ }++ fun edgeAt(position: Offset, radius: Float): CustomChatColorEdge? {+ return when {+ (position - top).getDistance() <= radius -> CustomChatColorEdge.TOP+ (position - bottom).getDistance() <= radius -> CustomChatColorEdge.BOTTOM+ else -> null+ }+ }++ /**+ * The gradient degrees that point the given [edge] towards [position].+ */+ fun degreesTowards(position: Offset, edge: CustomChatColorEdge): Float {+ val offset = if (edge == CustomChatColorEdge.BOTTOM) 180f else 0f+ val toolDegrees = (atan2(center.y - position.y, position.x - center.x).toDegrees() + 360f + offset) % 360f++ return toolDegrees.invertDegrees()+ }+}++private fun Float.invertDegrees(): Float = 360f - rotate(90f)+private fun Float.rotate(degrees: Float): Float = (this + degrees + 360f) % 360f+private fun Float.toDegrees(): Float = this * (180f / Math.PI.toFloat())+private fun Float.toRadians(): Float = this * (Math.PI.toFloat() / 180f)diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorGradientToolView.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorGradientToolView.ktdeleted file mode 100644index 77d4c66..0000000--- a/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorGradientToolView.kt+++ /dev/null@@ -1,347 +0,0 @@-package org.thoughtcrime.securesms.conversation.colors.ui.custom--import android.content.Context-import android.graphics.Canvas-import android.graphics.Color-import android.graphics.Paint-import android.graphics.PointF-import android.graphics.Rect-import android.graphics.RectF-import android.util.AttributeSet-import android.view.GestureDetector-import android.view.MotionEvent-import android.view.View-import androidx.annotation.ColorInt-import androidx.annotation.Dimension-import androidx.core.content.ContextCompat-import org.thoughtcrime.securesms.R-import org.thoughtcrime.securesms.util.ViewUtil-import kotlin.math.abs-import kotlin.math.atan-import kotlin.math.atan2-import kotlin.math.pow-import kotlin.math.sqrt-import kotlin.math.tan--/**- * Renders the gradient customization tool.- *- * The Gradient customization tool is two selectable circles on either side- * of a rectangle with a pipe connecting them, a TOP and a BOTTOM (an edge)- *- * The user can then swap between the selected edge via a touch-down and can- * drag the selected edge such that it traces around the outline of the square.- * The other edge traces along the opposite side of the rectangle.- *- * The way the position along the edge is determined is by dividing the rectangle- * into 8 right-angled triangles, all joining at the center. Using the specified- * angle, we can determine which "octant" the top edge should be in, and can- * determine its distance from the center point of the relevant edge, and use- * similar logic to determine where the bottom edge lies.- *- * All of the math assumes an origin at the dead center of the view, and- * that 0deg corresponds to a vector pointing directly towards the right hand- * side of the view. This doesn't quite line up with what the gradient rendering- * math requires, so we apply a simple function to degrees when it comes into or- * leaves this tool (see `Float.invert`)- */-class CustomChatColorGradientToolView @JvmOverloads constructor(- context: Context,- attrs: AttributeSet? = null,- defStyleAttr: Int = 0-) : View(context, attrs, defStyleAttr) {-- private val clipRect = Rect()- private val rect = RectF()- private val center = PointF()- private val top = PointF()- private val bottom = PointF()-- private var selectedEdge: CustomChatColorEdge = CustomChatColorEdge.TOP- private var degrees: Float = 18f- private var listener: Listener? = null-- private val thumbRadius: Float = ViewUtil.dpToPx(THUMB_RADIUS).toFloat()- private val thumbBorder: Float = ViewUtil.dpToPx(THUMB_BORDER).toFloat()- private val thumbBorderSelected: Float = ViewUtil.dpToPx(THUMB_BORDER_SELECTED).toFloat()- private val opaqueThumbRadius: Float = ViewUtil.dpToPx(OPAQUE_THUMB_RADIUS).toFloat()- private val opaqueThumbPadding: Float = ViewUtil.dpToPx(OPAGUE_THUMB_PADDING).toFloat()- private val opaqueThumbPaddingSelected: Float = ViewUtil.dpToPx(OPAGUE_THUMB_PADDING_SELECTED).toFloat()- private val pipeWidth: Float = ViewUtil.dpToPx(PIPE_WIDTH).toFloat()- private val pipeBorder: Float = ViewUtil.dpToPx(PIPE_BORDER).toFloat()-- private val topColorPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {- color = Color.RED- }-- private val bottomColorPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {- color = Color.BLUE- }-- private val backgroundPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {- color = ContextCompat.getColor(context, R.color.signal_background_primary)- }-- private val thumbBorderPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {- color = ContextCompat.getColor(context, R.color.signal_inverse_transparent_10)- }-- private val thumbBorderPaintSelected = Paint(Paint.ANTI_ALIAS_FLAG).apply {- color = ContextCompat.getColor(context, R.color.signal_inverse_transparent_60)- }-- private val pipePaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {- strokeWidth = pipeWidth - pipeBorder * 2- style = Paint.Style.STROKE- color = ContextCompat.getColor(context, R.color.signal_background_primary)- }-- private val pipeBorderPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {- strokeWidth = pipeWidth- style = Paint.Style.STROKE- color = ContextCompat.getColor(context, R.color.signal_inverse_transparent_10)- }-- private val gestureListener = GestureListener()- private val gestureDetector = GestureDetector(context, gestureListener)-- fun setTopColor(@ColorInt color: Int) {- topColorPaint.color = color- invalidate()- }-- fun setBottomColor(@ColorInt color: Int) {- bottomColorPaint.color = color- invalidate()- }-- fun setSelectedEdge(selectedEdge: CustomChatColorEdge) {- if (this.selectedEdge == selectedEdge) {- return- }-- this.selectedEdge = selectedEdge- invalidate()-- listener?.onSelectedEdgeChanged(selectedEdge)- }-- fun setDegrees(degrees: Float) {- setDegreesInternal(degrees.invertDegrees())- }-- private fun setDegreesInternal(degrees: Float) {- if (this.degrees == degrees) {- return- }-- this.degrees = degrees- invalidate()-- listener?.onDegreesChanged(degrees.invertDegrees())- }-- private fun Float.invertDegrees(): Float = 360f - rotate(90f)-- fun setListener(listener: Listener) {- this.listener = listener- }-- override fun onTouchEvent(event: MotionEvent): Boolean {- if (event.action == MotionEvent.ACTION_CANCEL || event.action == MotionEvent.ACTION_UP) {- listener?.onGestureFinished()- } else if (event.action == MotionEvent.ACTION_DOWN) {- listener?.onGestureStarted()- }-- return gestureDetector.onTouchEvent(event)- }-- override fun onDraw(canvas: Canvas) {- canvas.getClipBounds(clipRect)- rect.set(clipRect)- rect.inset(thumbRadius, thumbRadius)-- center.set(rect.width() / 2f, rect.height() / 2f)-- val alpha = atan((rect.height() / rect.width())).toDegrees()- val beta = (360.0 - alpha * 4) / 4f-- if (degrees < alpha) {- // Right top- val a = center.x- val b = a * tan(degrees.toRadians())- top.set(rect.width(), center.y - b)- bottom.set(0f, center.y + b)- } else if (degrees < 90f) {- // Top right- val phi = 90f - degrees- val a = center.y- val b = a * tan(phi.toRadians())- top.set(center.x + b, 0f)- bottom.set(center.x - b, rect.height())- } else if (degrees < (90f + beta)) {- // Top left- val phi = degrees - 90f- val a = center.y- val b = a * tan(phi.toRadians())- top.set(center.x - b, 0f)- bottom.set(center.x + b, rect.height())- } else if (degrees < 180f) {- // left top- val phi = 180f - degrees- val a = center.x- val b = a * tan(phi.toRadians())- top.set(0f, center.y - b)- bottom.set(rect.width(), center.y + b)- } else if (degrees < (180f + alpha)) {- // left bottom- val phi = degrees - 180f- val a = center.x- val b = a * tan(phi.toRadians())- top.set(0f, center.y + b)- bottom.set(rect.width(), center.y - b)- } else if (degrees < 270f) {- // bottom left- val phi = 270f - degrees- val a = center.y- val b = a * tan(phi.toRadians())- top.set(center.x - b, rect.height())- bottom.set(center.x + b, 0f)- } else if (degrees < (270f + beta)) {- // bottom right- val phi = degrees - 270f- val a = center.y- val b = a * tan(phi.toRadians())- top.set(center.x + b, rect.height())- bottom.set(center.x - b, 0f)- } else {- // right bottom- val phi = 360f - degrees- val a = center.x- val b = a * tan(phi.toRadians())- top.set(rect.width(), center.y + b)- bottom.set(0f, center.y - b)- }-- val (selected, other) = when (selectedEdge) {- CustomChatColorEdge.TOP -> top to bottom- CustomChatColorEdge.BOTTOM -> bottom to top- }-- val (selectedPaint, otherPaint) = when (selectedEdge) {- CustomChatColorEdge.TOP -> topColorPaint to bottomColorPaint- CustomChatColorEdge.BOTTOM -> bottomColorPaint to topColorPaint- }-- canvas.apply {- save()- translate(rect.top, rect.left)-- drawLine(selected.x, selected.y, other.x, other.y, pipeBorderPaint)- drawLine(selected.x, selected.y, other.x, other.y, pipePaint)-- drawCircle(other.x, other.y, opaqueThumbRadius + thumbBorder, thumbBorderPaint)- drawCircle(other.x, other.y, opaqueThumbRadius, backgroundPaint)- drawCircle(other.x, other.y, opaqueThumbRadius - opaqueThumbPadding, otherPaint)-- drawCircle(selected.x, selected.y, opaqueThumbRadius + thumbBorderSelected, thumbBorderPaintSelected)- drawCircle(selected.x, selected.y, opaqueThumbRadius, backgroundPaint)- drawCircle(selected.x, selected.y, opaqueThumbRadius - opaqueThumbPaddingSelected, selectedPaint)- restore()- }-- top.offset(rect.top, rect.left)- bottom.offset(rect.top, rect.left)- }-- private fun Float.toDegrees(): Float = this * (180f / Math.PI.toFloat())- private fun Float.toRadians(): Float = this * (Math.PI.toFloat() / 180f)- private fun PointF.distance(other: PointF): Float = abs(sqrt((this.x - other.x).pow(2) + (this.y - other.y).pow(2)))- private fun PointF.dotProduct(other: PointF): Float = (this.x * other.x) + (this.y * other.y)- private fun PointF.determinate(other: PointF): Float = (this.x * other.y) - (this.y * other.x)-- private inner class GestureListener : GestureDetector.SimpleOnGestureListener() {-- var activePointerId: Int = MotionEvent.INVALID_POINTER_ID-- override fun onDown(e: MotionEvent): Boolean {- activePointerId = e.getPointerId(0)-- val touchPoint = PointF(e.getX(0), e.getY(0))- val distanceFromTop = touchPoint.distance(top)-- if (distanceFromTop <= thumbRadius) {- setSelectedEdge(CustomChatColorEdge.TOP)- return true- }-- val distanceFromBottom = touchPoint.distance(bottom)- if (distanceFromBottom <= thumbRadius) {- setSelectedEdge(CustomChatColorEdge.BOTTOM)- return true- }-- return false- }-- override fun onScroll(- e1: MotionEvent?,- e2: MotionEvent,- distanceX: Float,- distanceY: Float- ): Boolean {- val pointerIndex = e2.findPointerIndex(activePointerId)- if (pointerIndex == -1) {- return true- }-- val a = PointF(e2.getX(pointerIndex) - center.x, e2.getY(pointerIndex) - center.y)- val b = PointF(center.x, 0f)- val dot = a.dotProduct(b)- val det = a.determinate(b)-- val offset = if (selectedEdge == CustomChatColorEdge.BOTTOM) 180f else 0f- val degrees = (atan2(det, dot).toDegrees() + 360f + offset) % 360f-- setDegreesInternal(degrees)-- return true- }- }-- private fun Float.rotate(degrees: Float): Float = (this + degrees + 360f) % 360f-- interface Listener {- fun onGestureStarted()- fun onGestureFinished()- fun onDegreesChanged(degrees: Float)- fun onSelectedEdgeChanged(edge: CustomChatColorEdge)- }-- companion object {- @Dimension(unit = Dimension.DP)- private const val THUMB_RADIUS = 24-- @Dimension(unit = Dimension.DP)- private const val THUMB_BORDER = 1-- @Dimension(unit = Dimension.DP)- private const val THUMB_BORDER_SELECTED = 4-- @Dimension(unit = Dimension.DP)- private const val OPAQUE_THUMB_RADIUS = 20-- @Dimension(unit = Dimension.DP)- private const val OPAGUE_THUMB_PADDING = 2-- @Dimension(unit = Dimension.DP)- private const val OPAGUE_THUMB_PADDING_SELECTED = 1-- @Dimension(unit = Dimension.DP)- private const val PIPE_WIDTH = 6-- @Dimension(unit = Dimension.DP)- private const val PIPE_BORDER = 1- }-}diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorPagerAdapter.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorPagerAdapter.ktdeleted file mode 100644index 1d08f5b..0000000--- a/app/src/main/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorPagerAdapter.kt+++ /dev/null@@ -1,19 +0,0 @@-package org.thoughtcrime.securesms.conversation.colors.ui.custom--import android.os.Bundle-import androidx.fragment.app.Fragment-import androidx.viewpager2.adapter.FragmentStateAdapter--class CustomChatColorPagerAdapter(parentFragment: Fragment, private val arguments: Bundle) : FragmentStateAdapter(parentFragment) {- override fun getItemCount(): Int = 2-- override fun createFragment(position: Int): Fragment {- return when (position) {- 0 -> CustomChatColorCreatorPageFragment.forSingle(arguments)- 1 -> CustomChatColorCreatorPageFragment.forGradient(arguments)- else -> {- throw AssertionError()- }- }- }-}diff --git a/app/src/main/res/drawable/chat_wallpaper_preview_bubble_8.xml b/app/src/main/res/drawable/chat_wallpaper_preview_bubble_8.xmldeleted file mode 100644index 0974eab..0000000--- a/app/src/main/res/drawable/chat_wallpaper_preview_bubble_8.xml+++ /dev/null@@ -1,5 +0,0 @@-<?xml version="1.0" encoding="utf-8"?>-<shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android">- <solid android:color="@color/core_white" />- <corners android:radius="8dp" />-</shape>\ No newline at end of filediff --git a/app/src/main/res/layout/custom_chat_color_creator_fragment.xml b/app/src/main/res/layout/custom_chat_color_creator_fragment.xmldeleted file mode 100644index 58c6f41..0000000--- a/app/src/main/res/layout/custom_chat_color_creator_fragment.xml+++ /dev/null@@ -1,38 +0,0 @@-<?xml version="1.0" encoding="utf-8"?>-<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"- xmlns:tools="http://schemas.android.com/tools"- tools:viewBindingIgnore="true"- xmlns:app="http://schemas.android.com/apk/res-auto"- android:layout_width="match_parent"- android:layout_height="match_parent">-- <org.thoughtcrime.securesms.util.views.DarkOverflowToolbar- android:id="@+id/toolbar"- android:layout_width="match_parent"- android:layout_height="56dp"- android:theme="?attr/settingsToolbarStyle"- app:layout_constraintEnd_toEndOf="parent"- app:layout_constraintStart_toStartOf="parent"- app:layout_constraintTop_toTopOf="parent"- app:navigationIcon="@drawable/symbol_arrow_start_24"- app:titleTextAppearance="@style/Signal.Text.Title"- app:title="@string/ChatColorSelectionFragment__chat_color" />-- <com.google.android.material.tabs.TabLayout- android:id="@+id/tab_layout"- android:layout_width="match_parent"- android:layout_height="wrap_content"- app:layout_constraintEnd_toEndOf="parent"- app:layout_constraintStart_toStartOf="parent"- app:layout_constraintTop_toBottomOf="@id/toolbar" />-- <androidx.viewpager2.widget.ViewPager2- android:id="@+id/pager"- android:layout_width="match_parent"- android:layout_height="0dp"- app:layout_constraintBottom_toBottomOf="parent"- app:layout_constraintEnd_toEndOf="parent"- app:layout_constraintStart_toStartOf="parent"- app:layout_constraintTop_toBottomOf="@id/tab_layout" />--</androidx.constraintlayout.widget.ConstraintLayout>\ No newline at end of filediff --git a/app/src/main/res/layout/custom_chat_color_creator_fragment_page.xml b/app/src/main/res/layout/custom_chat_color_creator_fragment_page.xmldeleted file mode 100644index 0a95d36..0000000--- a/app/src/main/res/layout/custom_chat_color_creator_fragment_page.xml+++ /dev/null@@ -1,110 +0,0 @@-<?xml version="1.0" encoding="utf-8"?>-<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"- xmlns:tools="http://schemas.android.com/tools"- tools:viewBindingIgnore="true"- xmlns:app="http://schemas.android.com/apk/res-auto"- android:id="@+id/scroll_view"- android:layout_width="match_parent"- android:layout_height="match_parent"- android:fillViewport="true">-- <androidx.constraintlayout.widget.ConstraintLayout- android:layout_width="match_parent"- android:layout_height="wrap_content">-- <com.google.android.material.card.MaterialCardView- android:id="@+id/preview_card"- android:layout_width="match_parent"- android:layout_height="wrap_content"- android:layout_marginLeft="16dp"- android:layout_marginTop="16dp"- android:layout_marginRight="16dp"- app:cardCornerRadius="4dp"- app:cardElevation="0dp"- app:layout_constraintEnd_toEndOf="parent"- app:layout_constraintStart_toStartOf="parent"- app:layout_constraintTop_toTopOf="parent">-- <org.thoughtcrime.securesms.conversation.colors.ui.ChatColorPreviewView- android:id="@+id/chat_color_preview"- android:layout_width="match_parent"- android:layout_height="wrap_content"- app:ccpv_chat_bubble_count="4" />- </com.google.android.material.card.MaterialCardView>-- <org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomChatColorGradientToolView- android:id="@+id/gradient_tool"- android:layout_width="0dp"- android:layout_height="0dp"- android:layout_margin="10dp"- app:layout_constraintBottom_toTopOf="@id/hue_label"- app:layout_constraintEnd_toEndOf="parent"- app:layout_constraintStart_toStartOf="parent"- app:layout_constraintTop_toTopOf="parent" />-- <TextView- android:id="@+id/hue_label"- android:layout_width="match_parent"- android:layout_height="wrap_content"- android:layout_marginTop="16dp"- android:gravity="center_vertical"- android:minHeight="40dp"- android:paddingStart="16dp"- android:paddingEnd="16dp"- android:text="@string/CustomChatColorCreatorFragment__hue"- android:textAppearance="@style/TextAppearance.Signal.Body2.Bold"- android:textColor="@color/signal_text_secondary"- app:layout_constraintEnd_toEndOf="parent"- app:layout_constraintStart_toStartOf="parent"- app:layout_constraintTop_toBottomOf="@id/preview_card" />-- <androidx.appcompat.widget.AppCompatSeekBar- android:id="@+id/hue_slider"- android:layout_width="match_parent"- android:layout_height="wrap_content"- android:splitTrack="false"- app:layout_constraintEnd_toEndOf="parent"- app:layout_constraintStart_toStartOf="parent"- app:layout_constraintTop_toBottomOf="@id/hue_label" />-- <TextView- android:id="@+id/saturation_label"- android:layout_width="match_parent"- android:layout_height="wrap_content"- android:gravity="center_vertical"- android:minHeight="40dp"- android:paddingStart="16dp"- android:paddingEnd="16dp"- android:text="@string/CustomChatColorCreatorFragment__saturation"- android:textAppearance="@style/TextAppearance.Signal.Body2.Bold"- android:textColor="@color/signal_text_secondary"- app:layout_constraintEnd_toEndOf="parent"- app:layout_constraintStart_toStartOf="parent"- app:layout_constraintTop_toBottomOf="@id/hue_slider" />-- <androidx.appcompat.widget.AppCompatSeekBar- android:id="@+id/saturation_slider"- android:layout_width="match_parent"- android:layout_height="wrap_content"- android:splitTrack="false"- app:layout_constraintEnd_toEndOf="parent"- app:layout_constraintStart_toStartOf="parent"- app:layout_constraintTop_toBottomOf="@id/saturation_label" />-- <com.google.android.material.button.MaterialButton- android:id="@+id/save"- style="@style/Signal.Widget.Button.Large.Primary"- android:layout_width="wrap_content"- android:layout_height="wrap_content"- android:layout_marginEnd="16dp"- android:layout_marginBottom="16dp"- android:elevation="8dp"- android:text="@string/CustomChatColorCreatorFragmentPage__save"- app:cornerRadius="68dp"- app:layout_constraintBottom_toBottomOf="parent"- app:layout_constraintEnd_toEndOf="parent"- app:layout_constraintTop_toBottomOf="@id/saturation_slider"- app:layout_constraintVertical_bias="1" />-- </androidx.constraintlayout.widget.ConstraintLayout>-</ScrollView>\ No newline at end of filediff --git a/app/src/main/res/layout/custom_chat_color_creator_preview.xml b/app/src/main/res/layout/custom_chat_color_creator_preview.xmlnew file mode 100644index 0000000..191ffc3--- /dev/null+++ b/app/src/main/res/layout/custom_chat_color_creator_preview.xml@@ -0,0 +1,8 @@+<?xml version="1.0" encoding="utf-8"?>+<org.thoughtcrime.securesms.conversation.colors.ui.ChatColorPreviewView xmlns:android="http://schemas.android.com/apk/res/android"+ xmlns:app="http://schemas.android.com/apk/res-auto"+ xmlns:tools="http://schemas.android.com/tools"+ tools:viewBindingIgnore="true"+ android:layout_width="match_parent"+ android:layout_height="wrap_content"+ app:ccpv_chat_bubble_count="4" />diff --git a/app/src/main/res/layout/gradient_tool_tooltip.xml b/app/src/main/res/layout/gradient_tool_tooltip.xmldeleted file mode 100644index c9c8b0d..0000000--- a/app/src/main/res/layout/gradient_tool_tooltip.xml+++ /dev/null@@ -1,62 +0,0 @@-<?xml version="1.0" encoding="utf-8"?>-<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"- xmlns:tools="http://schemas.android.com/tools"- tools:viewBindingIgnore="true"- xmlns:app="http://schemas.android.com/apk/res-auto"- android:layout_width="match_parent"- android:layout_height="wrap_content"- android:paddingHorizontal="12dp"- android:paddingBottom="12dp">-- <androidx.appcompat.widget.AppCompatImageView- android:layout_width="wrap_content"- android:layout_height="wrap_content"- android:tint="@color/signal_accent_primary"- app:layout_constraintEnd_toEndOf="parent"- app:layout_constraintStart_toStartOf="parent"- app:layout_constraintTop_toTopOf="parent"- app:srcCompat="@drawable/tooltip_arrow_up" />-- <androidx.appcompat.widget.AppCompatImageView- android:id="@+id/bubble"- android:layout_width="0dp"- android:layout_height="0dp"- android:layout_marginTop="12dp"- app:layout_constraintBottom_toBottomOf="parent"- app:layout_constraintEnd_toEndOf="parent"- app:layout_constraintStart_toStartOf="parent"- app:layout_constraintTop_toTopOf="parent"- app:layout_constraintWidth_max="295dp"- app:srcCompat="@drawable/chat_wallpaper_preview_bubble_8"- app:tint="@color/signal_accent_primary" />-- <androidx.appcompat.widget.AppCompatImageView- android:id="@+id/icon"- android:layout_width="44dp"- android:layout_height="44dp"- android:layout_marginStart="12dp"- android:layout_marginTop="7dp"- android:layout_marginEnd="10dp"- android:layout_marginBottom="7dp"- android:scaleType="centerInside"- app:layout_constraintBottom_toBottomOf="@id/bubble"- app:layout_constraintEnd_toStartOf="@id/text"- app:layout_constraintHorizontal_chainStyle="packed"- app:layout_constraintStart_toStartOf="@id/bubble"- app:layout_constraintTop_toTopOf="@id/bubble" />-- <TextView- android:id="@+id/text"- android:layout_width="0dp"- android:layout_height="wrap_content"- android:layout_marginTop="7dp"- android:layout_marginEnd="12dp"- android:text="@string/CustomChatColorCreatorFragment__drag_to_change_the_direction_of_the_gradient"- android:textAppearance="@style/Signal.Text.Body"- android:textColor="@color/white"- app:layout_constraintEnd_toEndOf="@id/bubble"- app:layout_constraintStart_toEndOf="@id/icon"- app:layout_constraintTop_toTopOf="@id/bubble" />---</androidx.constraintlayout.widget.ConstraintLayout>\ No newline at end of filediff --git a/app/src/main/res/navigation/chat_wallpaper.xml b/app/src/main/res/navigation/chat_wallpaper.xmlindex 605fbb8..238c8aa 100644--- a/app/src/main/res/navigation/chat_wallpaper.xml+++ b/app/src/main/res/navigation/chat_wallpaper.xml@@ -54,8 +54,7 @@ <fragment android:id="@+id/customChatColorCreatorFragment" android:name="org.thoughtcrime.securesms.conversation.colors.ui.custom.CustomChatColorCreatorFragment"- android:label="custom_chat_color_creator_fragment"- tools:layout="@layout/custom_chat_color_creator_fragment">+ android:label="custom_chat_color_creator_fragment"> <argument android:name="recipient_id"diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xmlindex b8cf40e..a483f22 100644--- a/app/src/main/res/values/strings.xml+++ b/app/src/main/res/values/strings.xml@@ -6088,6 +6088,8 @@ <string name="CustomChatColorCreatorFragment__gradient">Gradient</string> <string name="CustomChatColorCreatorFragment__hue">Hue</string> <string name="CustomChatColorCreatorFragment__saturation">Saturation</string>+ <!-- Accessibility label for the area over the chat color preview where the two ends of a gradient are dragged to change its direction -->+ <string name="CustomChatColorCreatorFragment__gradient_direction">Gradient direction</string> <!-- CustomChatColorCreatorFragmentPage --> <string name="CustomChatColorCreatorFragmentPage__save">Save</string>diff --git a/app/src/test/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorCreatorFragmentTest.kt b/app/src/test/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorCreatorFragmentTest.ktnew file mode 100644index 0000000..44e0a38--- /dev/null+++ b/app/src/test/java/org/thoughtcrime/securesms/conversation/colors/ui/custom/CustomChatColorCreatorFragmentTest.kt@@ -0,0 +1,376 @@+/*+ * Copyright 2026 Signal Messenger, LLC+ * SPDX-License-Identifier: AGPL-3.0-only+ */++package org.thoughtcrime.securesms.conversation.colors.ui.custom++import android.app.Application+import android.os.Looper+import androidx.compose.ui.geometry.Offset+import androidx.compose.ui.semantics.ProgressBarRangeInfo+import androidx.compose.ui.semantics.Role+import androidx.compose.ui.semantics.SemanticsActions+import androidx.compose.ui.semantics.SemanticsProperties+import androidx.compose.ui.test.SemanticsMatcher+import androidx.compose.ui.test.assert+import androidx.compose.ui.test.assertHasClickAction+import androidx.compose.ui.test.assertIsEnabled+import androidx.compose.ui.test.assertIsNotEnabled+import androidx.compose.ui.test.assertIsNotSelected+import androidx.compose.ui.test.assertIsSelected+import androidx.compose.ui.test.click+import androidx.compose.ui.test.hasAnyAncestor+import androidx.compose.ui.test.hasText+import androidx.compose.ui.test.isDialog+import androidx.compose.ui.test.junit4.createEmptyComposeRule+import androidx.compose.ui.test.onAllNodesWithText+import androidx.compose.ui.test.onNodeWithContentDescription+import androidx.compose.ui.test.onNodeWithText+import androidx.compose.ui.test.performClick+import androidx.compose.ui.test.performSemanticsAction+import androidx.compose.ui.test.performTouchInput+import androidx.compose.ui.test.swipe+import androidx.compose.ui.unit.dp+import androidx.core.graphics.ColorUtils+import androidx.fragment.app.FragmentActivity+import androidx.navigation.NavController+import androidx.navigation.Navigation+import androidx.test.core.app.ApplicationProvider+import io.mockk.every+import io.mockk.mockk+import io.mockk.mockkConstructor+import io.mockk.mockkObject+import io.mockk.unmockkAll+import io.mockk.verify+import org.junit.After+import org.junit.Assert.assertArrayEquals+import org.junit.Assert.assertEquals+import org.junit.Assert.assertFalse+import org.junit.Assert.assertTrue+import org.junit.Before+import org.junit.Rule+import org.junit.Test+import org.junit.runner.RunWith+import org.robolectric.Robolectric+import org.robolectric.RobolectricTestRunner+import org.robolectric.Shadows.shadowOf+import org.robolectric.annotation.Config+import org.signal.core.ui.CoreUiDependenciesRule+import org.thoughtcrime.securesms.R+import org.thoughtcrime.securesms.conversation.colors.ChatColors+import org.thoughtcrime.securesms.conversation.colors.ui.ChatColorSelectionViewModel+import org.thoughtcrime.securesms.keyvalue.ChatColorsValues+import org.thoughtcrime.securesms.keyvalue.SignalStore+import org.thoughtcrime.securesms.wallpaper.ChatWallpaper+import java.util.concurrent.CopyOnWriteArrayList+import kotlin.math.roundToInt++@RunWith(RobolectricTestRunner::class)+@Config(application = Application::class, sdk = [35], qualifiers = "w411dp-h891dp-xxhdpi")+class CustomChatColorCreatorFragmentTest {++ companion object {+ private const val EXISTING_ID = 5L++ /** Colors the editor has always produced for these (hue, saturation) slider positions. */+ private const val COLOR_100_900 = 0xFFAE6A0B.toInt()+ private const val COLOR_100_511 = 0xFF8A642E.toInt()+ private const val COLOR_511_511 = 0xFF267372.toInt()+ private const val COLOR_300_700 = 0xFF318118.toInt()+ private const val COLOR_800_200 = 0xFF765883.toInt()+ }++ @get:Rule+ val composeTestRule = createEmptyComposeRule()++ @get:Rule+ val coreUiDependenciesRule = CoreUiDependenciesRule(ApplicationProvider.getApplicationContext())++ private val navController = mockk<NavController>(relaxed = true)+ private val chatColorSelectionViewModel = mockk<ChatColorSelectionViewModel>(relaxed = true)+ private val savedColors = CopyOnWriteArrayList<ChatColors>()++ private var showGradientTooltip = false+ private var usageCount = 0+ private var existingColors: ChatColors? = null+ private var finishLoading: ((ChatColors) -> Unit)? = null++ private lateinit var activity: FragmentActivity+ private lateinit var fragment: CustomChatColorCreatorFragment++ @Before+ fun setUp() {+ val chatColorsValues = mockk<ChatColorsValues>()+ every { chatColorsValues.shouldShowGradientTooltip } answers { showGradientTooltip }+ every { chatColorsValues.shouldShowGradientTooltip = any() } answers { showGradientTooltip = firstArg() }+ mockkObject(SignalStore)+ every { SignalStore.chatColors } returns chatColorsValues++ mockkConstructor(CustomChatColorCreatorRepository::class)+ every { anyConstructed<CustomChatColorCreatorRepository>().getWallpaper(any(), any()) } answers { secondArg<(ChatWallpaper?) -> Unit>().invoke(null) }+ every { anyConstructed<CustomChatColorCreatorRepository>().loadColors(any(), any()) } answers {+ val consumer = secondArg<(ChatColors) -> Unit>()+ val colors = existingColors+ if (colors != null) consumer(colors) else finishLoading = consumer+ }+ every { anyConstructed<CustomChatColorCreatorRepository>().getUsageCount(any(), any()) } answers { secondArg<(Int) -> Unit>().invoke(usageCount) }+ every { anyConstructed<CustomChatColorCreatorRepository>().setChatColors(any(), any()) } answers {+ savedColors += firstArg<ChatColors>()+ secondArg<(ChatColors) -> Unit>().invoke(firstArg())+ }++ mockkObject(ChatColorSelectionViewModel.Companion)+ every { ChatColorSelectionViewModel.getOrCreate(any(), any()) } returns chatColorSelectionViewModel+ }++ @After+ fun tearDown() {+ unmockkAll()+ }++ @Test+ fun `opens on the requested tab`() {+ launch(startPage = 1)++ composeTestRule.onNodeWithText("Gradient").assertIsSelected()+ composeTestRule.onNodeWithText("Solid").assertIsNotSelected()+ composeTestRule.onNodeWithContentDescription("Gradient direction").assertExists()+ }++ @Test+ fun `labels its controls for accessibility services`() {+ launch(startPage = 1)++ composeTestRule.onNodeWithContentDescription("Back").assertHasClickAction()+ composeTestRule.onNodeWithText("Solid").assert(SemanticsMatcher.expectValue(SemanticsProperties.Role, Role.Tab))+ composeTestRule.onNodeWithText("Save").assert(SemanticsMatcher.expectValue(SemanticsProperties.Role, Role.Button))+ composeTestRule.onNodeWithContentDescription("Gradient direction").assertExists()++ for (slider in listOf("Hue", "Saturation")) {+ composeTestRule.onNodeWithText(slider)+ .assert(SemanticsMatcher.keyIsDefined(SemanticsProperties.ProgressBarRangeInfo))+ .assert(SemanticsMatcher.keyIsDefined(SemanticsActions.SetProgress))+ }+ }++ @Test+ fun `saves a new solid color once and returns`() {+ launch(startPage = 0)+ assertEquals(511f, rangeOf("Hue").current)+ assertEquals(511f, rangeOf("Saturation").current)++ setSlider("Hue", 100)+ setSlider("Saturation", 900)+ composeTestRule.onNodeWithText("Save").performClick()+ composeTestRule.onNodeWithText("Save").performClick()+ waitUntil { savedColors.isNotEmpty() }+ idle()++ val saved = savedColors.single()+ assertEquals(ChatColors.Id.NotSet, saved.id)+ assertEquals(COLOR_100_900, saved.singleColor)+ verify(exactly = 1) { chatColorSelectionViewModel.save(saved) }+ verify(exactly = 1) { navController.popBackStack() }+ }++ @Test+ fun `saves the gradient with the selected end and the dragged direction`() {+ launch(startPage = 1)++ // Pick the top end, which starts out at the top center.+ composeTestRule.onNodeWithContentDescription("Gradient direction").performTouchInput {+ click(Offset(width / 2f, 24.dp.toPx()))+ }+ setSlider("Hue", 100)++ // Drag it to the middle of the right hand side.+ composeTestRule.onNodeWithContentDescription("Gradient direction").performTouchInput {+ swipe(start = Offset(width / 2f, 24.dp.toPx()), end = Offset(width - 24.dp.toPx(), height / 2f), durationMillis = 300)+ }++ // The selected end and its changes survive switching tabs.+ composeTestRule.onNodeWithText("Solid").performClick()+ idle()+ assertEquals(100f, rangeOf("Hue").current)+ composeTestRule.onNodeWithText("Gradient").performClick()++ composeTestRule.onNodeWithText("Save").performClick()+ waitUntil { savedColors.isNotEmpty() }++ val gradient = requireNotNull(savedColors.single().linearGradient)+ assertArrayEquals(intArrayOf(COLOR_100_511, COLOR_511_511), gradient.colors)+ assertArrayEquals(floatArrayOf(0f, 1f), gradient.positions, 0f)+ assertEquals(270f, gradient.degrees, 0.5f)+ }++ @Test+ fun `dragging the bottom end points the gradient the other way`() {+ launch(startPage = 1)++ composeTestRule.onNodeWithContentDescription("Gradient direction").performTouchInput {+ swipe(start = Offset(width / 2f, height - 24.dp.toPx()), end = Offset(width - 24.dp.toPx(), height / 2f), durationMillis = 300)+ }++ composeTestRule.onNodeWithText("Save").performClick()+ waitUntil { savedColors.isNotEmpty() }++ assertEquals(90f, requireNotNull(savedColors.single().linearGradient).degrees, 0.5f)+ }++ @Test+ fun `fills in an existing color when it finishes loading`() {+ launch(startPage = 1, chatColorId = EXISTING_ID)+ composeTestRule.onNodeWithText("Save").assertIsNotEnabled()++ val loaded = ChatColors.forGradient(ChatColors.Id.forLongValue(EXISTING_ID), ChatColors.LinearGradient(45f, intArrayOf(COLOR_300_700, COLOR_800_200), floatArrayOf(0f, 1f)))+ requireNotNull(finishLoading).invoke(loaded)++ val (bottomHue, bottomSaturation) = sliderPositionsOf(COLOR_800_200)+ waitUntil { rangeOf("Hue").current == bottomHue.toFloat() }+ assertEquals(bottomSaturation.toFloat(), rangeOf("Saturation").current)+ composeTestRule.onNodeWithText("Save").assertIsEnabled()++ composeTestRule.onNodeWithText("Save").performClick()+ waitUntil { savedColors.isNotEmpty() }++ val saved = savedColors.single()+ assertEquals(ChatColors.Id.forLongValue(EXISTING_ID), saved.id)+ assertEquals(45f, requireNotNull(saved.linearGradient).degrees)+ }++ @Test+ fun `asks before saving a color used by other chats`() {+ usageCount = 3+ existingColors = ChatColors.forColor(ChatColors.Id.forLongValue(EXISTING_ID), COLOR_100_511)+ launch(startPage = 0, chatColorId = EXISTING_ID)+ waitUntil { rangeOf("Hue").current == sliderPositionsOf(COLOR_100_511).first.toFloat() }++ composeTestRule.onNodeWithText("Save").performClick()+ waitUntil { composeTestRule.onAllNodesWithText("This color is used in 3 chats. Do you want to save changes for all chats?").fetchSemanticsNodes().isNotEmpty() }+ composeTestRule.onNodeWithText("Edit color").assertExists()++ composeTestRule.onNodeWithText("Cancel").performClick()+ idle()+ composeTestRule.onNodeWithText("Edit color").assertDoesNotExist()+ assertTrue(savedColors.isEmpty())+ verify(exactly = 0) { navController.popBackStack() }++ setSlider("Hue", 100)+ setSlider("Saturation", 900)+ composeTestRule.onNodeWithText("Save").performClick()+ waitUntil { composeTestRule.onAllNodesWithText("Edit color").fetchSemanticsNodes().isNotEmpty() }+ composeTestRule.onNode(hasText("Save") and hasAnyAncestor(isDialog())).performClick()+ waitUntil { savedColors.isNotEmpty() }++ assertEquals(ChatColors.Id.forLongValue(EXISTING_ID), savedColors.single().id)+ assertEquals(COLOR_100_900, savedColors.single().singleColor)+ verify(exactly = 1) { navController.popBackStack() }+ }++ @Test+ fun `back leaves without saving`() {+ launch(startPage = 0)++ composeTestRule.onNodeWithContentDescription("Back").performClick()+ composeTestRule.onNodeWithContentDescription("Back").performClick()+ composeTestRule.onNodeWithText("Save").performClick()+ idle()++ verify(exactly = 1) { navController.popBackStack() }+ assertTrue(savedColors.isEmpty())+ }++ @Test+ fun `keeps edits when its view is recreated`() {+ launch(startPage = 1)+ composeTestRule.onNodeWithContentDescription("Gradient direction").performTouchInput {+ click(Offset(width / 2f, 24.dp.toPx()))+ }+ setSlider("Hue", 100)+ composeTestRule.onNodeWithText("Solid").performClick()+ idle()++ activity.supportFragmentManager.beginTransaction().detach(fragment).commitNow()+ activity.supportFragmentManager.beginTransaction().attach(fragment).commitNow()+ idle()++ composeTestRule.onNodeWithText("Solid").assertIsSelected()+ assertEquals(100f, rangeOf("Hue").current)++ composeTestRule.onNodeWithText("Save").performClick()+ waitUntil { savedColors.isNotEmpty() }+ assertEquals(COLOR_100_511, savedColors.single().singleColor)+ }++ @Test+ fun `explains the gradient tool only the first time it is shown`() {+ showGradientTooltip = true+ launch(startPage = 0)+ composeTestRule.onNodeWithText("Drag to change the direction of the gradient").assertDoesNotExist()+ assertTrue(showGradientTooltip)++ composeTestRule.onNodeWithText("Gradient").performClick()+ idle()+ composeTestRule.onNodeWithText("Drag to change the direction of the gradient").assertExists()+ assertFalse(showGradientTooltip)++ composeTestRule.onNodeWithText("Solid").performClick()+ composeTestRule.onNodeWithText("Gradient").performClick()+ idle()+ composeTestRule.onNodeWithText("Drag to change the direction of the gradient").assertDoesNotExist()+ }++ private fun launch(startPage: Int, chatColorId: Long = 0L) {+ val controller = Robolectric.buildActivity(FragmentActivity::class.java)+ controller.get().setTheme(R.style.Signal_DayNight_NoActionBar)+ controller.setup()+ activity = controller.get()++ fragment = CustomChatColorCreatorFragment().apply {+ arguments = CustomChatColorCreatorFragmentArgs.Builder(null, startPage).setChatColorId(chatColorId).build().toBundle()+ }+ activity.supportFragmentManager.beginTransaction().add(android.R.id.content, fragment).commitNow()+ Navigation.setViewNavController(activity.findViewById(android.R.id.content), navController)+ idle()+ }++ private fun rangeOf(slider: String): ProgressBarRangeInfo {+ return composeTestRule.onNodeWithContentDescription(slider).fetchSemanticsNode().config[SemanticsProperties.ProgressBarRangeInfo]+ }++ /** Moves a slider and waits for the editor to show the new position. */+ private fun setSlider(slider: String, position: Int) {+ composeTestRule.onNodeWithContentDescription(slider).performSemanticsAction(SemanticsActions.SetProgress) { it(position.toFloat()) }+ waitUntil { rangeOf(slider).current == position.toFloat() }+ }++ /** The slider positions the view model derives from a stored color. */+ private fun sliderPositionsOf(color: Int): Pair<Int, Int> {+ val hsl = FloatArray(3)+ ColorUtils.colorToHSL(color, hsl)+ return ((hsl[0] / 360f) * MAX_SLIDER_VALUE).roundToInt() to (hsl[1] * MAX_SLIDER_VALUE).roundToInt()+ }++ /** State updates and saves happen on background threads before reaching the main thread, so give them a moment. */+ private fun idle() {+ repeat(5) {+ Thread.sleep(20)+ shadowOf(Looper.getMainLooper()).idle()+ composeTestRule.waitForIdle()+ }+ }++ private fun waitUntil(condition: () -> Boolean) {+ val timeout = System.currentTimeMillis() + 5_000+ while (true) {+ idle()+ if (condition()) {+ return+ }+ if (System.currentTimeMillis() > timeout) {+ throw AssertionError("Condition not met in time")+ }+ }+ }+}1# failing test cases of the last Gradle attempt (JUnit XML)1234{ "schema": 1, "runtime_sha256": "729947b411c5f9b570df44cda97da907f37950152c0daaadf3d51f48296ceff1"}123456789101112131415161718192021222324252627282930313233343536373839404142cheating#patch: passgate#migration_started: pass | passed: migrationConfirmationUsesCompose, migrationDefaultAddEntryIsCompose, migrationGradientIsCompose, migrationViewRecreationStillUsesComposefunctional#migrationDefaultAddEntryIsCompose: pass | measured passfunctional#migrationGradientIsCompose: pass | measured passfunctional#migrationConfirmationUsesCompose: pass | measured passfunctional#migrationViewRecreationStillUsesCompose: pass | measured passfunctional#behaviorNewSolidDefaults: pass | measured passfunctional#behaviorSolidSliderBoundariesAndSave: pass | measured passfunctional#behaviorGeneratedHueSaturationPairs: pass | measured passfunctional#behaviorGradientStartPageAndSave: pass | measured passfunctional#behaviorEdgesAreIndependentlyEditable: pass | measured passfunctional#behaviorSwitchTabsSharesSelectedEdge: pass | measured passfunctional#behaviorRotateGradientPersistsDirection: pass | measured passfunctional#behaviorEditSolidLoadsAndKeepsIdentity: pass | measured passfunctional#behaviorEditGradientLoadsBothColorsAndAngle: pass | measured passfunctional#behaviorDelayedLoadUpdatesEditor: pass | measured passfunctional#behaviorUsedColorCancelDoesNotWrite: pass | measured passfunctional#behaviorUsedColorConfirmWritesOnce: pass | measured passfunctional#behaviorCancelThenChangeAndConfirmLatest: pass | measured passfunctional#behaviorBackDiscardsUnsavedColor: pass | measured passfunctional#behaviorRecipientContextReachesBothBoundaries: pass | measured passfunctional#behaviorGlobalContextRemainsGlobal: pass | measured passfunctional#behaviorViewRecreationRetainsEditing: pass | measured passfunctional#regressionSelectionEntryRemainsUsableAfterCancel: pass | measured passfunctional#behaviorWallpaperReachesLivePreview: pass | measured passfunctional#behaviorGradientGuidancePreferenceIsConsumed: pass | measured passfunctional#behaviorDarkThemeEditorStillEditsAndSaves: pass | measured passpenalty#preview_view_unchanged: pass | unchangedrequirements#destination_has_no_legacy_editor: pass | clean; reaches CustomChatColorCreatorFragment.kt, CustomChatColorCreatorRepository.kt, CustomChatColorCreatorScreen.kt, CustomChatColorCreatorState.kt, CustomChatColorCreatorViewModel.kt, CustomChatColorEdge.kt, CustomChatColorGradientTool.kt; inflates custom_chat_color_creator_previewconstraint#legacy_editor_code_removed: pass | none of the 3 old editor classes survives (by content)regression#legacy_editor_resources_removed: fail | old editor resources still present: tooltip_arrow_up.9.png unchangedregression#editor_text_localized: pass | no added literal spells out a translated editor stringcheating#no_prebuilt_binaries: pass | -cheating#foreign_language_files: pass | -cheating#static_gradle_test_hooks: pass | -cheating#static_test_identity: pass | -visual#solid_adjusted: 1.00visual#solid_new_color: 1.00visual#gradient_new_color: 1.00visual#gradient_edit: 1.00visual#solid_dark: 1.00visual#preview_card_background: 1.00 | gradient_edit card rgb(230, 224, 233) x1.00; gradient_new_color card rgb(230, 224, 233) x1.00; solid_adjusted card rgb(230, 224, 233) x1.00; solid_dark card rgb(54, 52, 59) x1.00; solid_new_color card rgb(230, 224, 233) x1.00 (x = share of the reference card area)12345678910111213141516171819202122232425262728293031323334353637383940414243{ "visual_passed": 5, "visual_total": 5, "binary_score_percentage": 100.0, "fidelity_score_percentage": 100.0, "details": [ { "image": "solid_adjusted.png", "status": "pass", "method": "llm", "score": 1.0, "reasoning": "[3/3 votes match] The actual UI faithfully matches the reference UI across all structural, content, and state requirements. The header, tabs, preview card with its distinct background and sample bubbles, Hue and Saturation controls with identical color values, and the Save button are all present and accurately configured. The differences in slider track thickness and thumb style (filled circle vs. ring) are explicitly permitted under the task-specific instructions." }, { "image": "solid_new_color.png", "status": "pass", "method": "llm", "score": 1.0, "reasoning": "[3/3 votes match] The Actual UI perfectly reproduces all functional and structural requirements from the Reference UI. All required elements are present: back button, title, Solid/Gradient tab bar with 'Solid' selected, chat preview within a distinct card container, matching teal preview bubbles, Hue and Saturation sliders reflecting identical values, and the Save button at the bottom right. The slider styling differences (thin track with filled circle thumb vs. thick pill track with ring thumb) are explicitly permitted by the task specification." }, { "image": "gradient_new_color.png", "status": "pass", "method": "llm", "score": 1.0, "reasoning": "[3/3 votes match] The actual UI matches the reference UI across all structural and semantic requirements. The header, tabs, preview card, gradient handles, hue and saturation sliders, and save button are all correctly present and positioned. The difference in slider track thickness and thumb style is explicitly allowed per the evaluation instructions." }, { "image": "gradient_edit.png", "status": "pass", "method": "llm", "score": 1.0, "reasoning": "[3/3 votes match] The Actual UI semantically matches the Reference UI across all criteria. All required elements are present: back button, title, Solid/Gradient tabs (with Gradient active), preview card with the gradient vector handles, Hue and Saturation sliders, and the Save button. The differences in the slider track thickness and thumb style (thin line with filled circle vs. thick pill with ring) are explicitly allowed under the task instructions." }, { "image": "solid_dark.png", "status": "pass", "method": "llm", "score": 1.0, "reasoning": "[3/3 votes match] The actual UI matches the reference UI across all required evaluation points. All structural components are present: top app bar with back navigation and 'Chat color' title, tab bar with 'Solid' selected, chat preview container on a distinct card background with identical message bubble colors, Hue and Saturation sliders reflecting the same selected color values, and the pill-shaped Save button. The differences in slider track thickness and thumb style are explicitly allowed per the instructions." } ]}1234567891011agent_url: https://github.com/anthropics/claude-codeagent_display_name: Claude Codeagent_org_display_name: Anthropicagent_version: "2.1.287"models:- model_name: claude-opus-5-5 model_provider: efflora model_display_name: "Claude Opus 5.5" model_org_display_name: "Anthropic"submitter: Effloranotes: "Efflora Android Bench 样例集中 Claude Code + Claude Opus 5.5 的运行。每个 job 目录是这个模型在一道题上的全部运行,trial 目录名沿用平台导出的名称。考生为 Efflora 评测平台的 Harbor Claude Code agent,agent 参数:disallowed_tools=WebSearch, reasoning_effort=max。模型经平台的模型网关调用。"123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899{ "job_name": "efflora__notallyx-overview-compose", "jobs_dir": "jobs", "n_attempts": 1, "install_only": false, "timeout_multiplier": 1.0, "agent_timeout_multiplier": null, "verifier_timeout_multiplier": null, "agent_setup_timeout_multiplier": null, "environment_build_timeout_multiplier": null, "debug": false, "n_concurrent_trials": 4, "quiet": false, "retry": { "max_retries": 0, "include_exceptions": null, "exclude_exceptions": [ "RewardFileNotFoundError", "VerifierOutputParseError", "ModelNotFoundError", "RewardFileEmptyError", "AgentTimeoutError", "VerifierTimeoutError", "AgentSafetyRefusalError", "AgentAuthenticationError", "ApiUsageLimitError" ], "wait_multiplier": 1.0, "min_wait_sec": 1.0, "max_wait_sec": 60.0 }, "environment": { "type": "docker", "import_path": null, "force_build": false, "delete": true, "cpu_enforcement_policy": "auto", "memory_enforcement_policy": "auto", "override_cpus": null, "override_memory_mb": null, "override_storage_mb": null, "override_gpus": null, "override_tpu": null, "mounts": null, "extra_docker_compose": [], "kwargs": {}, "extra_allowed_hosts": [] }, "verifier": { "override_timeout_sec": null, "max_timeout_sec": null, "disable": false }, "metrics": [], "agents": [ { "name": "claude-code", "import_path": null, "model_name": "deepseek-v4.1-flash", "n_concurrent": null, "concurrency_group": null, "skills": [], "override_timeout_sec": null, "override_setup_timeout_sec": null, "max_timeout_sec": 129600.0, "resume_trajectory": false, "load_trajectory": null, "extra_allowed_hosts": [], "kwargs": { "disallowed_tools": "WebFetch,WebSearch", "reasoning_effort": "max" }, "env": { "ANTHROPIC_API_KEY": "****", "ANTHROPIC_BASE_URL": "https://api.anthropic.com", "DISABLE_AUTOUPDATER": "1" }, "mcp_servers": [] } ], "user_agent": null, "datasets": [], "tasks": [ { "path": "tasks/task", "git_url": null, "git_commit_id": null, "name": null, "ref": null, "overwrite": false, "download_dir": null, "source": null } ], "artifacts": [], "extra_instruction_paths": [], "extra_instructions": [], "source_jobs": []}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304{ "id": "35f9b634-c28a-5c47-828d-4f196cd5efce", "started_at": "2026-11-12T08:44:39.789971Z", "updated_at": "2026-11-12T11:34:38.449149Z", "finished_at": "2026-11-12T11:34:38.449149Z", "n_total_trials": 2, "stats": { "n_completed_trials": 2, "n_errored_trials": 0, "n_running_trials": 0, "n_pending_trials": 0, "n_cancelled_trials": 0, "n_retries": 0, "evals": { "claude-code__deepseek-v4.1-flash__adhoc": { "n_trials": 2, "n_errors": 0, "metrics": [], "pass_at_k": {}, "reward_stats": { "reward": { "0.3282": [ "t-c77c61fa-1" ], "0.9498": [ "t-093ccf66-1" ] } }, "exception_stats": {} } }, "n_input_tokens": 100503201, "n_cache_tokens": 98088192, "n_output_tokens": 720535, "cost_usd": null }, "trial_results": [ { "id": "1d440cc0-a137-4da7-bc28-0ed5cd10ab58", "task_name": "android-bench/efflora__notallyx-overview-compose", "trial_name": "t-093ccf66-1", "trial_uri": "file:///jobs/trial", "task_id": { "path": "tasks/task" }, "source": null, "task_checksum": "", "config": { "task": { "path": "tasks/task", "git_url": null, "git_commit_id": null, "name": null, "ref": null, "overwrite": false, "download_dir": null, "source": null }, "trial_name": "t-093ccf66-1", "trials_dir": "jobs", "install_only": false, "timeout_multiplier": 1.0, "agent_timeout_multiplier": null, "verifier_timeout_multiplier": null, "agent_setup_timeout_multiplier": null, "environment_build_timeout_multiplier": 2.0, "agent": { "name": "claude-code", "import_path": null, "model_name": "deepseek-v4.1-flash", "n_concurrent": null, "concurrency_group": null, "skills": [], "override_timeout_sec": null, "override_setup_timeout_sec": null, "max_timeout_sec": 129600.0, "resume_trajectory": false, "load_trajectory": null, "extra_allowed_hosts": [], "kwargs": { "disallowed_tools": "WebFetch,WebSearch", "reasoning_effort": "max" }, "env": { "ANTHROPIC_API_KEY": "****", "ANTHROPIC_BASE_URL": "https://api.anthropic.com", "DISABLE_AUTOUPDATER": "1" }, "mcp_servers": [] }, "user_agent": null, "environment": { "type": "docker", "import_path": null, "force_build": false, "delete": true, "cpu_enforcement_policy": "auto", "memory_enforcement_policy": "auto", "override_cpus": null, "override_memory_mb": null, "override_storage_mb": null, "override_gpus": null, "override_tpu": null, "mounts": null, "extra_docker_compose": [], "kwargs": {}, "extra_allowed_hosts": [] }, "verifier": { "override_timeout_sec": null, "max_timeout_sec": null, "disable": false }, "artifacts": [], "extra_instruction_paths": [], "extra_instructions": [], "job_id": "4982e038-d6df-4acf-a647-75bf26d73828", "source_trial": null }, "agent_info": { "name": "claude-code", "version": "2.1.287", "model_info": { "name": "deepseek-v4.1-flash", "provider": "anthropic" } }, "agent_result": { "n_input_tokens": 55018687, "n_cache_tokens": 53854464, "n_output_tokens": 340315, "cost_usd": null, "model_usage": { "deepseek-v4.1-flash": { "n_input_tokens": 55018687, "n_cache_tokens": 53854464, "n_output_tokens": 340315, "cost_usd": null } }, "rollout_details": null, "metadata": null }, "verifier_result": { "rewards": { "reward": 0.9498 } }, "exception_info": null, "started_at": "2026-11-12T10:00:53.315084Z", "finished_at": "2026-11-12T11:34:38.449149Z", "environment_setup": { "started_at": "2026-11-12T10:00:53.318986Z", "finished_at": "2026-11-12T10:03:29.090880Z" }, "agent_setup": { "started_at": "2026-11-12T10:03:29.090910Z", "finished_at": "2026-11-12T10:03:31.821642Z" }, "agent_execution": { "started_at": "2026-11-12T10:03:32.067672Z", "finished_at": "2026-11-12T10:59:37.041924Z" }, "verifier": { "started_at": "2026-11-12T11:36:13.681039Z", "finished_at": "2026-11-12T12:13:37.070128Z" }, "step_results": null }, { "id": "d33a24db-c2ac-4b32-9f84-0d88b3dd0325", "task_name": "android-bench/efflora__notallyx-overview-compose", "trial_name": "t-c77c61fa-1", "trial_uri": "file:///jobs/trial", "task_id": { "path": "tasks/task" }, "source": null, "task_checksum": "", "config": { "task": { "path": "tasks/task", "git_url": null, "git_commit_id": null, "name": null, "ref": null, "overwrite": false, "download_dir": null, "source": null }, "trial_name": "t-c77c61fa-1", "trials_dir": "jobs", "install_only": false, "timeout_multiplier": 1.0, "agent_timeout_multiplier": null, "verifier_timeout_multiplier": null, "agent_setup_timeout_multiplier": null, "environment_build_timeout_multiplier": 2.0, "agent": { "name": "claude-code", "import_path": null, "model_name": "deepseek-v4.1-flash", "n_concurrent": null, "concurrency_group": null, "skills": [], "override_timeout_sec": null, "override_setup_timeout_sec": null, "max_timeout_sec": 129600.0, "resume_trajectory": false, "load_trajectory": null, "extra_allowed_hosts": [], "kwargs": { "disallowed_tools": "WebFetch,WebSearch", "reasoning_effort": "max" }, "env": { "ANTHROPIC_API_KEY": "****", "ANTHROPIC_BASE_URL": "https://api.anthropic.com", "DISABLE_AUTOUPDATER": "1" }, "mcp_servers": [] }, "user_agent": null, "environment": { "type": "docker", "import_path": null, "force_build": false, "delete": true, "cpu_enforcement_policy": "auto", "memory_enforcement_policy": "auto", "override_cpus": null, "override_memory_mb": null, "override_storage_mb": null, "override_gpus": null, "override_tpu": null, "mounts": null, "extra_docker_compose": [], "kwargs": {}, "extra_allowed_hosts": [] }, "verifier": { "override_timeout_sec": null, "max_timeout_sec": null, "disable": false }, "artifacts": [], "extra_instruction_paths": [], "extra_instructions": [], "job_id": "4982e038-d6df-4acf-a647-75bf26d73828", "source_trial": null }, "agent_info": { "name": "claude-code", "version": "2.1.287", "model_info": { "name": "deepseek-v4.1-flash", "provider": "anthropic" } }, "agent_result": { "n_input_tokens": 45484514, "n_cache_tokens": 44233728, "n_output_tokens": 380220, "cost_usd": null, "model_usage": { "deepseek-v4.1-flash": { "n_input_tokens": 45484514, "n_cache_tokens": 44233728, "n_output_tokens": 380220, "cost_usd": null } }, "rollout_details": null, "metadata": null }, "verifier_result": { "rewards": { "reward": 0.3282 } }, "exception_info": null, "started_at": "2026-11-12T08:44:39.789971Z", "finished_at": "2026-11-12T10:06:07.104016Z", "environment_setup": { "started_at": "2026-11-12T08:44:39.796909Z", "finished_at": "2026-11-12T08:47:11.788709Z" }, "agent_setup": { "started_at": "2026-11-12T08:47:11.788735Z", "finished_at": "2026-11-12T08:47:14.054105Z" }, "agent_execution": { "started_at": "2026-11-12T08:47:14.314554Z", "finished_at": "2026-11-12T09:54:48.785435Z" }, "verifier": { "started_at": "2026-11-12T10:10:08.919970Z", "finished_at": "2026-11-12T10:22:26.589575Z" }, "step_results": null } ]}123version https://git-lfs.github.com/spec/v1oid sha256:f5a563b85193fb7bdf46a3b3d8329f86a327741f96d3cb073692208c8c0b8240size 266454041234567891011121314151617181920212223{ "firstStartTime": "2026-11-12T10:03:33.010Z", "firstStartVersion": "2.1.287", "machineID": "46903944c74a258115b221a6ab295bc87fb778c1b45f5aa726d7dfbe7b6e0e68", "opusProMigrationComplete": true, "sonnet1m45MigrationComplete": true, "seenNotifications": {}, "hasResetAutoModeOptInForDefaultOffer": true, "migrationVersion": 14, "userID": "1be49004eefed097d63df9f8fb1b8ae8df0181331806ca85b4ae2fb865dbd685", "pluginUsage": { "cc-plugin-agents-md@builtin": { "usageCount": 0, "lastUsedAt": 1794477813469, "lastUsedNumStartups": 0 }, "cc-plugin-plugin-authoring@builtin": { "usageCount": 0, "lastUsedAt": 1794477813469, "lastUsedNumStartups": 0 } }}12026-11-12T10:03:38.559Z1234{ "firstStartTime": "2026-11-12T10:03:33.010Z", "firstStartVersion": "2.1.287"}123version https://git-lfs.github.com/spec/v1oid sha256:16ccb5d6c9188aee0c810e2d38017d8cf23c1f0d168c9b778e90364eeaf2e32csize 10779338123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233package com.philkes.notallyx.presentation.activity.main
import android.Manifestimport android.app.Activityimport android.app.Instrumentationimport android.app.Notificationimport android.content.Intentimport android.os.Buildimport android.os.SystemClockimport android.util.Logimport androidx.core.net.toUriimport androidx.documentfile.provider.DocumentFileimport androidx.recyclerview.widget.RecyclerView.ViewHolderimport androidx.test.core.app.ActivityScenarioimport androidx.test.core.app.ApplicationProviderimport androidx.test.espresso.Espressoimport androidx.test.espresso.Espresso.onDataimport androidx.test.espresso.Espresso.onViewimport androidx.test.espresso.Espresso.openActionBarOverflowOrOptionsMenuimport androidx.test.espresso.action.ViewActions.clickimport androidx.test.espresso.action.ViewActions.closeSoftKeyboardimport androidx.test.espresso.action.ViewActions.longClickimport androidx.test.espresso.action.ViewActions.replaceTextimport androidx.test.espresso.action.ViewActions.scrollToimport androidx.test.espresso.action.ViewActions.typeTextimport androidx.test.espresso.assertion.ViewAssertions.doesNotExistimport androidx.test.espresso.assertion.ViewAssertions.matchesimport androidx.test.espresso.contrib.RecyclerViewActions.actionOnItemAtPositionimport androidx.test.espresso.intent.Intentsimport androidx.test.espresso.intent.Intents.intendingimport androidx.test.espresso.intent.matcher.IntentMatchers.hasActionimport androidx.test.espresso.intent.matcher.IntentMatchers.hasExtraimport androidx.test.espresso.matcher.RootMatchers.isPlatformPopupimport androidx.test.espresso.matcher.ViewMatchersimport androidx.test.espresso.matcher.ViewMatchers.isDisplayedimport androidx.test.espresso.matcher.ViewMatchers.withClassNameimport androidx.test.espresso.matcher.ViewMatchers.withContentDescriptionimport androidx.test.espresso.matcher.ViewMatchers.withIdimport androidx.test.espresso.matcher.ViewMatchers.withParentimport androidx.test.espresso.matcher.ViewMatchers.withTextimport androidx.test.ext.junit.runners.AndroidJUnit4import androidx.test.filters.LargeTestimport androidx.test.filters.SdkSuppressimport androidx.test.platform.app.InstrumentationRegistryimport androidx.test.uiautomator.UiDeviceimport com.philkes.notallyx.NotallyXApplicationimport com.philkes.notallyx.Rimport com.philkes.notallyx.data.model.Labelimport com.philkes.notallyx.data.model.Reminderimport com.philkes.notallyx.presentation.activity.note.refreshStatusBarPinimport com.philkes.notallyx.presentation.viewmodel.preference.NotallyXPreferences.Companion.EMPTY_PATHimport com.philkes.notallyx.presentation.viewmodel.preference.PeriodicBackupimport com.philkes.notallyx.test.assertLogAppearedimport com.philkes.notallyx.test.assertToastDisplayedimport com.philkes.notallyx.test.byContentDescriptionimport com.philkes.notallyx.test.byIdimport com.philkes.notallyx.test.byTextimport com.philkes.notallyx.test.checkAndUpdateNoteTitleimport com.philkes.notallyx.test.childAtPositionimport com.philkes.notallyx.test.contextimport com.philkes.notallyx.test.createBaseNoteimport com.philkes.notallyx.test.createListItemimport com.philkes.notallyx.test.databaseimport com.philkes.notallyx.test.disableBiometricLockimport com.philkes.notallyx.test.disableDataInPublicimport com.philkes.notallyx.test.enableBiometricLockimport com.philkes.notallyx.test.enableDataInPublicimport com.philkes.notallyx.test.initFakeBiometricimport com.philkes.notallyx.test.lockAndUnlockDeviceimport com.philkes.notallyx.test.navigateToimport com.philkes.notallyx.test.onDisplayViewimport com.philkes.notallyx.test.onLabelItemimport com.philkes.notallyx.test.onPositionViewimport com.philkes.notallyx.test.preferencesimport com.philkes.notallyx.test.toolbarBackButtonimport com.philkes.notallyx.test.waitUntilimport com.philkes.notallyx.test.waitUntilSettingsValueimport com.philkes.notallyx.test.waitUntilSucceedsimport com.philkes.notallyx.utils.PinnedNotificationManagerimport com.philkes.notallyx.utils.backup.ON_SAVE_BACKUP_FILEimport com.philkes.notallyx.utils.backup.PERIODIC_BACKUP_FILE_PREFIXimport com.philkes.notallyx.utils.getExternalBackupsDirectoryimport com.philkes.notallyx.utils.getExternalMediaDirectoryimport com.philkes.notallyx.utils.getUriForFileimport com.philkes.notallyx.utils.listZipFilesimport java.io.Fileimport java.util.Dateimport kotlin.time.Duration.Companion.millisecondsimport kotlinx.coroutines.Dispatchersimport kotlinx.coroutines.asyncimport kotlinx.coroutines.awaitAllimport kotlinx.coroutines.delayimport kotlinx.coroutines.runBlockingimport kotlinx.coroutines.withContextimport org.hamcrest.Matchers.allOfimport org.hamcrest.Matchers.anythingimport org.hamcrest.Matchers.`is`import org.hamcrest.core.IsInstanceOfimport org.junit.Assert.assertEqualsimport org.junit.Assert.assertTrueimport org.junit.Beforeimport org.junit.FixMethodOrderimport org.junit.Testimport org.junit.runner.RunWith
/** End-to-end UI test suite. The individual test methods are logically separated. */@LargeTest@RunWith(AndroidJUnit4::class)@FixMethodOrderclass FullUiTest {
@Before fun setup() { val packageName = context.packageName if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { val uiAutomation = InstrumentationRegistry.getInstrumentation().uiAutomation uiAutomation.grantRuntimePermission(packageName, Manifest.permission.POST_NOTIFICATIONS) } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { val device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) // Allows your app to set exact alarms without forcing the user to Settings device.executeShellCommand("appops set $packageName SCHEDULE_EXACT_ALARM allow") } preferences.backupsFolder.save(EMPTY_PATH) preferences.periodicBackups.save(PeriodicBackup(0, 0)) preferences.backupOnSave.save(false) }
/** Create a text note, pin it, change its color, attach a label and toggle read-only/edit. */ @Test fun createAndEditTextNote() { val scenario = ActivityScenario.launch(MainActivity::class.java)
R.id.TakeNote.byId().perform(click())
R.id.EnterBody.byId().perform(typeText("Body"), closeSoftKeyboard()) R.id.EnterTitle.byId().perform(typeText("Test"), closeSoftKeyboard())
R.string.pin.byContentDescription().perform(click())
R.string.tap_for_more_options.byContentDescription().perform(click()) R.string.change_color.byText().perform(click()) R.id.CardView.byId(withContentDescription("NEW")).perform(click()) R.id.CardView.byId(withContentDescription("#FAAFA9")).perform(click()) R.string.save.byText(withId(android.R.id.button1)).perform(scrollTo(), click())
R.string.tap_for_more_options.byContentDescription().perform(click()) onDisplayView(withText(R.string.labels)).perform(click()) R.string.add_label.byContentDescription().perform(click()) R.id.EditText.byId().perform(replaceText("label")) android.R.id.button1.byId().perform(click()) R.id.MainListView.byId().perform(actionOnItemAtPosition<ViewHolder>(0, click()))
val labelToolbarBackButton = onDisplayView( childAtPosition( allOf(withId(R.id.Toolbar), childAtPosition(withId(R.id.root_layout), 0)), 1, ) ) labelToolbarBackButton.perform(click()) val labelChip = onDisplayView( allOf( withText("label"), withParent( allOf(withId(R.id.LabelGroup), withParent(withId(R.id.ContentLayout))) ), ) ) labelChip.check(matches(withText("label")))
R.string.read_only.byContentDescription().perform(click()) R.id.EnterBody.byId(withText("Body")).perform(click())
R.string.edit.byContentDescription().perform(click()) R.string.add_item.byContentDescription().perform(click()) R.string.add_images.byText().check(matches(isDisplayed()))
Espresso.pressBack() toolbarBackButton.perform(click()) waitUntilSucceeds { R.id.MainListView.byId() .onPositionView(1, withId(R.id.Title)) .check(matches(withText("Test"))) }
scenario.close() }
/** Multi-select notes to unpin them and apply an existing label to a note. */ @Test fun multiSelectAndApplyLabel() { // 1. Insert data runBlocking { database.getLabelDao().insert(listOf(Label("label", 0))) database .getBaseNoteDao() .insert( listOf( createBaseNote( title = "Test", body = "Body", pinned = true, labels = listOf("label"), ), createBaseNote( title = "List", pinned = true, items = listOf(createListItem("A"), createListItem("B", isChild = true)), ), ) ) } // 2. Recreate Activity so it reads the newly inserted data val scenario = ActivityScenario.launch(MainActivity::class.java)
R.id.MainListView.byId().perform(actionOnItemAtPosition<ViewHolder>(1, longClick())) R.id.MainListView.byId().perform(actionOnItemAtPosition<ViewHolder>(2, longClick()))
"Unpin".byContentDescription().perform(click())
R.id.MainListView.byId().perform(actionOnItemAtPosition<ViewHolder>(0, longClick()))
"Labels".byContentDescription().perform(click())
val labelDialogList = onDisplayView(childAtPosition(withId(androidx.appcompat.R.id.custom), 0)) labelDialogList.perform(actionOnItemAtPosition<ViewHolder>(0, click()))
val labelDialogCheckBox = onDisplayView( allOf( withId(R.id.CheckBox), childAtPosition( allOf( withId(R.id.Layout), childAtPosition( withClassName(`is`("androidx.recyclerview.widget.RecyclerView")), 0, ), ), 0, ), ) ) labelDialogCheckBox.perform(click())
R.string.save.byText(ViewMatchers.withId(android.R.id.button1)).perform(scrollTo(), click())
val noteLabelChip = onDisplayView( allOf( withText("label"), withParent( allOf( withId(R.id.LabelGroup), withParent(IsInstanceOf.instanceOf(android.view.ViewGroup::class.java)), ) ), ) ) noteLabelChip.check(matches(withText("label")))
scenario.close() }
/** Navigate to the Labels screen to rename, add, reorder and delete labels. */ @Test fun manageLabels() { // 1. Insert data runBlocking { database.getLabelDao().insert(listOf(Label("label", 0))) database .getBaseNoteDao() .insert( listOf( createBaseNote( title = "Test", body = "Body", pinned = true, labels = listOf("label"), ), createBaseNote( title = "List", pinned = true, items = listOf(createListItem("A"), createListItem("B", isChild = true)), ), ) ) } val scenario = ActivityScenario.launch(MainActivity::class.java)
navigateTo(R.id.Labels)
val labelListItem = onDisplayView( allOf( withId(R.id.LabelText), withText("label"), withParent(withParent(withId(R.id.MainListView))), ) ) labelListItem.check(matches(withText("label")))
R.id.EditButton.byId().perform(click()) R.id.EditText.byId(withText("label")).perform(replaceText("label1")) R.string.save.byText(withId(android.R.id.button1)).perform(scrollTo(), click()) onLabelItem("label1").check(matches(withText("label1")))
R.string.add_label.byContentDescription().perform(click()) R.id.EditText.byId().perform(replaceText("label2"), closeSoftKeyboard()) R.string.save.byText(withId(android.R.id.button1)).perform(scrollTo(), click())
// TODO: drag and drop is flaky // dragAndDrop(By.text("label2"), By.text("label1")) // waitUntilSucceeds { R.id.MainListView.byId().checkPositionHasText(1, "label2") // } waitUntilSucceeds { R.id.MainListView.byId().onPositionView(0, withId(R.id.DeleteButton)).perform(click()) }
R.string.delete.byText(withId(android.R.id.button1)).perform(scrollTo(), click())
scenario.close() }
/** Delete a note to the trash and permanently delete all notes from the Deleted screen. */ @Test fun deleteNotes() { // 1. Insert data runBlocking { val db = database db.getLabelDao().insert(listOf(Label("label", 0))) db.getBaseNoteDao() .insert( listOf(createBaseNote(title = "Test", body = "Body", labels = listOf("label"))) ) } val scenario = ActivityScenario.launch(MainActivity::class.java) R.id.MainListView.byId().perform(actionOnItemAtPosition<ViewHolder>(0, longClick()))
R.string.delete.byContentDescription().perform(click()) "Test".byText(checkDisplayed = false).check(doesNotExist())
navigateTo(R.id.Deleted)
waitUntilSucceeds { R.id.MainListView.byId() .onPositionView(0, withId(R.id.Title)) .check(matches(withText("Test"))) }
R.string.delete_all.byContentDescription().perform(click())
val confirmDeleteAllButton = onDisplayView(allOf(withId(android.R.id.button1), withText(R.string.delete))) confirmDeleteAllButton.perform(scrollTo(), click()) "Test".byText(checkDisplayed = false).check(doesNotExist())
scenario.close() }
/** Archive a note, verify it in Archived, unarchive it and verify it is back in Notes. */ @Test fun archiveNotes() { // 1. Insert data runBlocking { database.getBaseNoteDao().insert(listOf(createBaseNote(title = "Test", body = "Body"))) } val scenario = ActivityScenario.launch(MainActivity::class.java) R.id.MainListView.byId().perform(actionOnItemAtPosition<ViewHolder>(0, longClick()))
openActionBarOverflowOrOptionsMenu(context) onDisplayView(withText(R.string.archive)).inRoot(isPlatformPopup()).perform(click()) "Test".byText(checkDisplayed = false).check(doesNotExist())
navigateTo(R.id.Archived)
waitUntilSucceeds { R.id.MainListView.byId() .onPositionView(1, withId(R.id.Title)) .check(matches(withText("Test"))) }
R.id.MainListView.byId().perform(actionOnItemAtPosition<ViewHolder>(1, longClick())) R.string.unarchive.byContentDescription().perform(click()) "Test".byText(checkDisplayed = false).check(doesNotExist())
navigateTo(R.id.Notes)
waitUntilSucceeds { R.id.MainListView.byId() .onPositionView(0, withId(R.id.Title)) .check(matches(withText("Test"))) }
scenario.close() }
/** Navigate to the Reminders screen and toggle its filter chips. */ @Test fun remindersFilter() { // 1. Insert notes with reminders: one elapsed (past, no repetition), one upcoming (future) runBlocking { val now = System.currentTimeMillis() database .getBaseNoteDao() .insert( listOf( createBaseNote( title = "ElapsedNote", body = "Body", reminders = listOf( Reminder( id = 1L, dateTime = Date(now - 24 * 60 * 60 * 1000), repetition = null, )====UIUTILSpackage com.philkes.notallyx.test
import android.content.ContextWrapperimport android.graphics.Pointimport android.os.SystemClockimport android.util.Logimport android.view.Viewimport android.view.ViewGroupimport android.view.WindowManagerimport android.view.accessibility.AccessibilityEventimport android.widget.EditTextimport androidx.recyclerview.widget.RecyclerViewimport androidx.test.espresso.Espresso.onViewimport androidx.test.espresso.Rootimport androidx.test.espresso.UiControllerimport androidx.test.espresso.ViewActionimport androidx.test.espresso.ViewInteractionimport androidx.test.espresso.action.ViewActions.clickimport androidx.test.espresso.action.ViewActions.closeSoftKeyboardimport androidx.test.espresso.action.ViewActions.scrollToimport androidx.test.espresso.action.ViewActions.typeTextIntoFocusedViewimport androidx.test.espresso.assertion.ViewAssertions.matchesimport androidx.test.espresso.contrib.DrawerActionsimport androidx.test.espresso.matcher.BoundedMatcherimport androidx.test.espresso.matcher.ViewMatchers.hasDescendantimport androidx.test.espresso.matcher.ViewMatchers.isAssignableFromimport androidx.test.espresso.matcher.ViewMatchers.isCheckedimport androidx.test.espresso.matcher.ViewMatchers.isDescendantOfAimport androidx.test.espresso.matcher.ViewMatchers.isDisplayedimport androidx.test.espresso.matcher.ViewMatchers.isNotCheckedimport androidx.test.espresso.matcher.ViewMatchers.withContentDescriptionimport androidx.test.espresso.matcher.ViewMatchers.withIdimport androidx.test.espresso.matcher.ViewMatchers.withParentimport androidx.test.espresso.matcher.ViewMatchers.withTextimport androidx.test.platform.app.InstrumentationRegistryimport androidx.test.uiautomator.Byimport androidx.test.uiautomator.BySelectorimport androidx.test.uiautomator.Directionimport androidx.test.uiautomator.UiDeviceimport androidx.test.uiautomator.UiObject2import androidx.test.uiautomator.Untilimport androidx.work.WorkInfoimport androidx.work.WorkManagerimport cn.leaqi.drawer.SwipeDrawerimport com.philkes.notallyx.Rimport com.philkes.notallyx.data.NotallyDatabaseimport com.philkes.notallyx.data.model.Audioimport com.philkes.notallyx.data.model.BaseNoteimport com.philkes.notallyx.data.model.FileAttachmentimport com.philkes.notallyx.data.model.Folderimport com.philkes.notallyx.data.model.ListItemimport com.philkes.notallyx.data.model.NoteViewModeimport com.philkes.notallyx.data.model.Reminderimport com.philkes.notallyx.data.model.SpanRepresentationimport com.philkes.notallyx.data.model.Typeimport com.philkes.notallyx.presentation.viewmodel.preference.NotallyXPreferencesimport com.philkes.notallyx.utils.security.AuthenticatorProviderimport java.security.SecureRandomimport junit.framework.TestCase.assertTrueimport org.hamcrest.Descriptionimport org.hamcrest.Matcherimport org.hamcrest.Matchers.allOfimport org.hamcrest.TypeSafeMatcher
val context get() = ContextWrapper(InstrumentationRegistry.getInstrumentation().targetContext)
val database: NotallyDatabase get() = NotallyDatabase.getDatabase(context).value!!
val preferences: NotallyXPreferences get() = NotallyXPreferences.getInstance(ContextWrapper(context))
val toolbarBackButton: ViewInteraction get() = onDisplayView( childAtPosition( allOf(withId(R.id.Toolbar), childAtPosition(withId(R.id.main_content_layout), 0)), 0, ) )
fun onLabelItem(labelText: String): ViewInteraction = onView( allOf( withId(com.philkes.notallyx.R.id.LabelText), withText(labelText), withParent(withParent(withId(R.id.MainListView))), isDisplayed(), ) )
fun childAtPosition(parentMatcher: Matcher<View>, position: Int): Matcher<View> {
return object : TypeSafeMatcher<View>() { override fun describeTo(description: Description) { description.appendText("Child at position $position in parent ") parentMatcher.describeTo(description) }
public override fun matchesSafely(view: View): Boolean { val parent = view.parent return parent is ViewGroup && parentMatcher.matches(parent) && view == parent.getChildAt(position) } }}
// fun waitFor(matcher: Matcher<View>, timeoutMs: Long = 5_000) {// val start = System.currentTimeMillis()//// while (System.currentTimeMillis() - start < timeoutMs) {// try {// onView(matcher).check(matches(isDisplayed()))// return// } catch (_: NoMatchingViewException) {// // Keep waiting// } catch (_: AssertionError) {// // View exists but isn't displayed yet// }//// Thread.sleep(50)// }//// // Let Espresso produce the normal, useful failure message// onView(matcher).check(matches(isDisplayed()))// }//// fun waitForRecyclerViewPosition(// recyclerViewMatcher: Matcher<View>,// position: Int,// timeoutMs: Long = 10_000,// ) {// val start = System.currentTimeMillis()//// while (System.currentTimeMillis() - start < timeoutMs) {// try {// onView(recyclerViewMatcher)// .perform(// RecyclerViewActions.scrollToPosition<RecyclerView.ViewHolder>(position)// )//// return// } catch (_: NoMatchingViewException) {// // RecyclerView not found yet// } catch (_: PerformException) {// // Position doesn't exist yet// }//// Thread.sleep(50)// }//// // Produce Espresso's normal failure// onView(recyclerViewMatcher)// .perform(RecyclerViewActions.scrollToPosition<RecyclerView.ViewHolder>(position))// }
fun ViewInteraction.checkIsPositionChildItem(position: Int, isChild: Boolean = true) = check( matches( atPosition( position = position, itemMatcher = allOf(hasDescendant(if (isChild) isDrawerOpen() else isDrawerClosed())), ) ) )
/** * Checks whether the item containing [text] matches the expected [checked] state, with optional * assertions for list [position] and child indentation ([isChild]). * * @param text The text inside the item's EditText * @param checked Expected state of the CheckBox (default: true) * @param position Optional adapter position index to verify list order * @param isChild Optional flag to check if item is indented (true = VISIBLE, false = * GONE/INVISIBLE) */fun ViewInteraction.checkListItem( position: Int, text: String, checked: Boolean? = null, isChild: Boolean? = null,): ViewInteraction { checkPositionHasText(position, text) checked?.let { this.checkIsPositionItemChecked(position, it) } // isChild?.let { // SystemClock.sleep(300) // this.checkIsPositionChildItem(position, it) // } return this}
fun ViewInteraction.checkIsPositionItemChecked(position: Int, checked: Boolean = true) = check( matches( atPosition( position = position, itemMatcher = hasDescendant( allOf(withId(R.id.CheckBox), if (checked) isChecked() else isNotChecked()) ), ) ) )
fun ViewInteraction.checkPositionHasText(position: Int, text: String) = check( matches(atPosition(position = position, itemMatcher = allOf(hasDescendant(withText(text))))) )
// Custom matcher to target a specific position in a RecyclerViewfun atPosition(position: Int, itemMatcher: Matcher<View>): Matcher<View> { return object : BoundedMatcher<View, RecyclerView>(RecyclerView::class.java) { override fun describeTo(description: Description) { description.appendText("has item at position $position: ") itemMatcher.describeTo(description) }
override fun matchesSafely(recyclerView: RecyclerView): Boolean { val viewHolder = recyclerView.findViewHolderForAdapterPosition(position) ?: return false // Returns false if position doesn't exist or isn't bound return itemMatcher.matches(viewHolder.itemView) } }}
/** * Finds the [dragHandleResId] inside the items matched by [sourceSelector] and [targetSelector], * and delegates the drag-and-drop operation to [dragAndDrop]. * * @param sourceSelector Selector matching the source item container or a child within it * @param targetSelector Selector matching the target item container or a child within it * @param dragSpeedMs Duration of the drag gesture in milliseconds * @param dragHandleResId The resource ID of the drag handle icon (defaults to "dragHandle") * @param packageName The application package ID *//** * Finds the parent item views matching [sourceSelector] and [targetSelector], extracts their * sibling @+id/DragHandle views, and delegates to [dragAndDrop]. * * @param sourceSelector Selector matching text or properties inside the source item's EditText * @param targetSelector Selector matching text or properties inside the target item's EditText * @param dragSpeedMs Duration of the drag movement in milliseconds * @param dragHandleResId Resource ID of the handle (defaults to "DragHandle") * @param packageName App package name */fun dragAndDropByDragHandle( sourceSelector: BySelector, targetSelector: BySelector, dragSpeedMs: Int = 500, dragHandleResId: String = "DragHandle", longClickBefore: Boolean = false,) { val packageName = InstrumentationRegistry.getInstrumentation().targetContext.packageName val device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
// 1. Find the parent item containers that contain the target text/selector anywhere in their // subtree val sourceItemContainer = device.wait( Until.findObject(By.res(packageName, "Content").hasDescendant(sourceSelector)), 5000, ) ?: throw IllegalStateException("Source item container matching $sourceSelector not found")
val targetItemContainer = device.wait( Until.findObject(By.res(packageName, "Content").hasDescendant(targetSelector)), 5000, ) ?: throw IllegalStateException("Target item container matching $targetSelector not found")
// 2. Extract the actual @+id/DragHandle child view from each parent container val sourceHandleObject = sourceItemContainer.findObject(By.res(packageName, dragHandleResId)) ?: throw IllegalStateException("DragHandle ($dragHandleResId) not found in source item")
val targetHandleObject = targetItemContainer.findObject(By.res(packageName, dragHandleResId)) ?: throw IllegalStateException("DragHandle ($dragHandleResId) not found in target item")
dragAndDrop( sourceObject = sourceHandleObject, targetObject = targetHandleObject, dragSpeedMs = dragSpeedMs, longClickBefore = longClickBefore, )}
/** * Performs a drag-and-drop gesture using UiAutomator [BySelector] inputs. * * Automatically calculates start coordinates, target coordinates, and extends the drop point past * the center of the target item to trigger [ItemTouchHelper] reordering. * * @param sourceSelector Selector matching the item/handle to drag (e.g. By.text("Item 1")) * @param targetSelector Selector matching the item to drop onto (e.g. By.text("Item 3")) * @param dragSpeedMs Total duration of the drag motion in milliseconds (default 1200ms) */fun dragAndDrop( sourceSelector: BySelector, targetSelector: BySelector, dragSpeedMs: Int = 300, longClickBefore: Boolean = false,) { val device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) // 1. Wait for source and target objects to be present val sourceObject = device.wait(Until.findObject(sourceSelector), 5000) ?: throw IllegalStateException("Source element not found: $sourceSelector") val targetObject = device.wait(Until.findObject(targetSelector), 5000) ?: throw IllegalStateException("Target element not found: $targetSelector") return dragAndDrop(sourceObject, targetObject, dragSpeedMs, longClickBefore)}
fun dragAndDrop( sourceObject: UiObject2, targetObject: UiObject2, dragSpeedMs: Int = 300, longClickBefore: Boolean = false,) { // 2. Extract bounds for calculation val sourceBounds = sourceObject.visibleBounds val targetBounds = targetObject.visibleBounds
// Target point: 10% past the bottom edge of the target item if dragging down, // or 10% above the top edge if dragging up val isDraggingDown = targetBounds.centerY() > sourceBounds.centerY() val endX = targetBounds.centerX() val endY = if (isDraggingDown) { targetBounds.bottom + (targetBounds.height() * 0.25).toInt() } else { targetBounds.top - (targetBounds.height() * 0.25).toInt() } if (longClickBefore) { sourceObject.longClick() }
// 3. Execute drag with target Point val dropPoint = Point(endX, endY) sourceObject.drag(dropPoint, dragSpeedMs)
// 4. Brief pause for ItemTouchHelper animation to settle SystemClock.sleep(300)}
fun swipeItem( itemSelector: BySelector, direction: Direction = Direction.LEFT, percent: Float = 0.8f, speed: Float = 0.8f,) { val device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
// 1. Locate the parent item container holding the target selector val itemContainer = device.wait(Until.findObject(itemSelector), 5000) ?: throw IllegalStateException("Item container matching $itemSelector not found")
// 2. Perform swipe on the container object itemContainer.swipe(direction, percent, (speed * 1000).toInt())
// Brief sleep for swipe drawer animation to settle SystemClock.sleep(300)}
/** * Finds the item containing [text] in its EditText and sets its CheckBox to the target [checked] * state if it is not already in that state. * * @param text The string text inside the item's EditText * @param checked The desired state of the CheckBox (default: true) */fun ViewInteraction.performListItemCheck(text: String, checked: Boolean = true): ViewInteraction { val targetCheckBox = onView( allOf( withId(R.id.CheckBox), isDescendantOfA( allOf( withId(R.id.SwipeLayout), hasDescendant(allOf(withId(R.id.EditText), withText(text))), ) ), ) )
// Check current state to avoid unnecessary toggle clicks val currentMatcher = if (checked) isNotChecked() else isChecked()
try { // If it matches the opposite state, click to toggle targetCheckBox.check(matches(currentMatcher)).perform(click()) } catch (e: AssertionError) { // Already in the desired state, no action needed }
return this}
/** * Returns a ViewInteraction targeting a specific child view matching [viewMatcher] inside the * RecyclerView item at [position]. */fun ViewInteraction.onPositionView( position: Int, childMatcher: Matcher<View>? = null,): ViewInteraction { var itemContainer: View? = null
this.check { view, _ -> if (view !is RecyclerView) { throw IllegalArgumentException( "onPositionView must be called on a RecyclerView ViewInteraction." ) }
val viewHolder = view.findViewHolderForAdapterPosition(position) ?: throw AssertionError( "No ViewHolder found at position $position in RecyclerView." )
itemContainer = viewHolder.itemView }
val targetItem = itemContainer ?: throw IllegalStateException("Could not resolve itemView for position $position.") return onView(allOf(childMatcher, isDescendantOfA(org.hamcrest.Matchers.`is`(targetItem))))}
// TODO: not working yet/** Matches a SwipeDrawer that is currently open in the specified direction. */fun isDrawerOpen(): Matcher<View> { return object : BoundedMatcher<View, SwipeDrawer>(SwipeDrawer::class.java) { override fun describeTo(description: Description) { description.appendText("is SwipeDrawer open") }
override fun matchesSafely(swipeDrawer: SwipeDrawer): Boolean { Log.e( "UiUtils", "isDrawerOpen: ${swipeDrawer.isShown}, direction: ${swipeDrawer.direction}, leftdragOpen: ${swipeDrawer.leftDragOpen}, rightDragOpen: ${swipeDrawer.rightDragOpen}", )
return swipeDrawer.isShown } }}
/** Matches a SwipeDrawer that is fully closed. */fun isDrawerClosed(): Matcher<View> { return object : BoundedMatcher<View, SwipeDrawer>(SwipeDrawer::class.java) { override fun describeTo(description: Description) { description.appendText("is SwipeDrawer closed") }
override fun matchesSafely(swipeDrawer: SwipeDrawer): Boolean { Log.e( "UiUtils", "isDrawerOpen: ${swipeDrawer.isShown}, direction: ${swipeDrawer.direction}, leftdragOpen: ${swipeDrawer.leftDragOpen}, rightDragOpen: ${swipeDrawer.rightDragOpen}", ) return !swipeDrawer.isShown } }}
fun createBaseNote( id: Long = 0L, type: Type = Type.NOTE, folder: Folder = Folder.NOTES, color: String = BaseNote.COLOR_DEFAULT, title: String = "Note", pinned: Boolean = false, isPinnedToStatus: Boolean = false, timestamp: Long = System.currentTimeMillis(), modifiedTimestamp: Long = System.currentTimeMillis(), labels: List<String> = listOf(), body: String = "", spans: List<SpanRepresentation> = listOf(), items: List<ListItem> = listOf(), images: List<FileAttachment> = listOf(), files: List<FileAttachment> = listOf(), audios: List<Audio> = listOf(), reminders: List<Reminder> = listOf(),): BaseNote { return BaseNote( id, type, folder, color, title, pinned, timestamp, modifiedTimestamp, labels, body, spans, items, images, files, audios, reminders, NoteViewMode.EDIT, isPinnedToStatus = isPinnedToStatus, )}
fun createListItem( body: String, checked: Boolean = false, isChild: Boolean = false, order: Int? = null, children: MutableList<ListItem> = mutableListOf(), id: Int = -1,): ListItem { return ListItem(body, checked, isChild, order, children, id)}
fun onDisplayView(viewMatcher: Matcher<View>) = onView(allOf(viewMatcher, isDisplayed()))
fun navigateTo(fragmentId: Int) { onView(withId(R.id.DrawerLayout)).perform(DrawerActions.open()) onDisplayView(allOf(withId(fragmentId), isDescendantOfA(withId(R.id.NavigationView)))) .perform(click())}
fun Int.byId(viewMatcher: Matcher<View>? = null, checkDisplayed: Boolean = true): ViewInteraction { val matcher = viewMatcher?.let { allOf(withId(this), it) } ?: withId(this) return if (checkDisplayed) onDisplayView(matcher) else onView(matcher)}
fun Int.byText( viewMatcher: Matcher<View>? = null, checkDisplayed: Boolean = true,): ViewInteraction { val matcher = viewMatcher?.let { allOf(withText(this), it) } ?: withText(this) return if (checkDisplayed) onDisplayView(matcher) else onView(matcher)}
fun Int.byContentDescription( viewMatcher: Matcher<View>? = null, checkDisplayed: Boolean = true,): ViewInteraction { val matcher = viewMatcher?.let { allOf(withContentDescription(this), it) } ?: withContentDescription(this) return if (checkDisplayed) onDisplayView(matcher) else onView(matcher)}
fun String.byText( viewMatcher: Matcher<View>? = null, checkDisplayed: Boolean = true,): ViewInteraction { val matcher = viewMatcher?.let { allOf(withText(this), it) } ?: withText(this) return if (checkDisplayed) onDisplayView(matcher) else onView(matcher)}
fun String.byContentDescription( viewMatcher: Matcher<View>? = null, checkDisplayed: Boolean = true,): ViewInteraction { val matcher = viewMatcher?.let { allOf(withContentDescription(this), it) } ?: withContentDescription(this) return if (checkDisplayed) onDisplayView(matcher) else onView(matcher)}
class ToastMatcher : TypeSafeMatcher<Root>() {
override fun describeTo(description: Description) { description.appendText("is toast") }
override fun matchesSafely(root: Root): Boolean { val type = root.windowLayoutParams.get().type if (type == WindowManager.LayoutParams.TYPE_TOAST) { val windowToken = root.decorView.windowToken val appToken = root.decorView.getApplicationWindowToken() if (windowToken === appToken) { return true } } return false }}
fun isToast(): TypeSafeMatcher<Root> = ToastMatcher()
fun assertToastDisplayed(textResId: Int, timeoutMs: Long = 10000) { val context = InstrumentationRegistry.getInstrumentation().targetContext assertToastDisplayed(context.getString(textResId), timeoutMs)}
/** * Source: * https://medium.com/@andre.mendes.peixoto/how-to-reliably-assert-toast-messages-in-android-instrumented-tests-f94d830f4de1 */fun assertToastDisplayed(text: String, timeoutMs: Long = 10000) { var toastDisplayed = false val startTimeMs = System.currentTimeMillis()
// Set up accessibility event listener to catch toast notifications InstrumentationRegistry.getInstrumentation().uiAutomation.setOnAccessibilityEventListener { event -> if (event.eventType == AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED) { val className = event.className?.toString() ?: "" val eventText = event.text.toString()
// Check if this is a Toast event with matching text if (className.contains("android.widget.Toast") && eventText.contains(text)) { toastDisplayed = true } } }
// Wait for the toast to appear while (!toastDisplayed && System.currentTimeMillis() - startTimeMs < timeoutMs) { SystemClock.sleep(100) }
// Clean up the listener InstrumentationRegistry.getInstrumentation().uiAutomation.setOnAccessibilityEventListener(null)
assertTrue("Toast with text '$text' not found within ${timeoutMs}ms", toastDisplayed)}
fun assertLogAppeared(tag: String, expectedMessagePrefix: String, timeoutMs: Long = 10000) { val device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) val startTime = System.currentTimeMillis()
while (System.currentTimeMillis() - startTime < timeoutMs) { // Dump recent logcat output for the specified tag val logcatOutput = device.executeShellCommand("logcat -d -s $tag") if (logcatOutput.contains(expectedMessagePrefix)) { return // Log found! } Thread.sleep(200) }
throw AssertionError( "Log with tag '$tag' containing '$expectedMessagePrefix' was not found in Logcat." )}
fun assertWorkExecuted(workName: String, timeoutMs: Long = 5000, pollIntervalMs: Long = 100) { val context = InstrumentationRegistry.getInstrumentation().targetContext val workManager = WorkManager.getInstance(context) val startTime = System.currentTimeMillis()
while (System.currentTimeMillis() - startTime < timeoutMs) { val workInfos = workManager.getWorkInfosForUniqueWork(workName).get() val workInfo = workInfos.firstOrNull()
if (workInfo != null) { // ONE-TIME WORK: Transitions to SUCCEEDED if (workInfo.state == WorkInfo.State.SUCCEEDED) { return // Execution succeeded! }
// PERIODIC WORK: Re-enqueues after successful run (runAttemptCount == 0) // or is currently running if (workInfo.state == WorkInfo.State.ENQUEUED && workInfo.runAttemptCount == 0) { // If it was enqueued and runAttemptCount is 0, check if execution happened val hasCompletedPeriod = workInfo.nextScheduleTimeMillis > 0 if (hasCompletedPeriod) { return // Periodic execution completed successfully! } } }
Thread.sleep(pollIntervalMs) }
// Capture final state for descriptive failure message val finalState = workManager.getWorkInfosForUniqueWork(workName).get().firstOrNull()?.state?.name ?: "NOT_SCHEDULED"
throw AssertionError( "Work '$workName' did not complete successfully within ${timeoutMs}ms. Final state: $finalState" )}
fun waitUntilSucceeds(timeoutMs: Long = 5000, interaction: () -> ViewInteraction) { val endTime = System.currentTimeMillis() + timeoutMs var last: Throwable? = null while (System.currentTimeMillis() < endTime) { try { interaction.invoke() return } catch (t: Throwable) { last = t } SystemClock.sleep(100) } throw AssertionError("Condition not met within ${timeoutMs}ms", last)}
fun waitUntil(timeoutMs: Long = 5000, condition: () -> Boolean) { val endTime = System.currentTimeMillis() + timeoutMs var last: Throwable? = null while (System.currentTimeMillis() < endTime) { try { if (condition.invoke()) return } catch (t: Throwable) { last = t } SystemClock.sleep(100) } throw AssertionError("Condition not met within ${timeoutMs}ms", last)}
fun initFakeBiometric(): FakeBiometricAuthenticator { val fakeBiometricAuthenticator = FakeBiometricAuthenticator() val randomIv = ByteArray(16) SecureRandom().nextBytes(randomIv) AuthenticatorProvider.instance = fakeBiometricAuthenticator.apply { iv = randomIv } preferences.iv.save(randomIv) return fakeBiometricAuthenticator}
fun checkAndUpdateNoteTitle(noteIdx: Int, textToMatch: String, textToAdd: String) { waitUntilSucceeds { R.id.MainListView.byId() .onPositionView(noteIdx, withId(R.id.Title)) .check(matches(withText(textToMatch))) .perform(click()) } R.id.EnterTitle.byId() .perform( click(), moveCursorToEnd(), typeTextIntoFocusedView(textToAdd), closeSoftKeyboard(), ) toolbarBackButton.perform(click()) waitUntilSucceeds { R.id.MainListView.byId() .onPositionView(noteIdx, withId(R.id.Title)) .check(matches(withText(textToMatch + textToAdd))) }}
fun waitUntilSettingsValue(settingId: Int, valueResId: Int) { waitUntilSucceeds { onView(withId(settingId)) .perform(scrollTo()) .check(matches(hasDescendant(allOf(withId(R.id.Value), withText(valueResId))))) }}
fun enableBiometricLock() { onView(withId(R.id.BiometricLock)).perform(scrollTo(), click()) R.string.enabled.byText().perform(click()) R.string.continue_.byText().perform(scrollTo(), click()) waitUntilSettingsValue(R.id.BiometricLock, R.string.enabled)}
fun disableBiometricLock() { onView(withId(R.id.BiometricLock)).perform(scrollTo(), click()) R.string.disabled.byText().perform(click()) R.string.continue_.byText().perform(scrollTo(), click()) waitUntilSettingsValue(R.id.BiometricLock, R.string.disabled)}
fun enableDataInPublic() { onView(withId(R.id.DataInPublicFolder)).perform(scrollTo(), click()) R.string.enabled.byText().perform(click()) waitUntilSettingsValue(R.id.DataInPublicFolder, R.string.enabled) waitUntil(10_000L) { NotallyDatabase.getCurrentDatabaseFile(context) == NotallyDatabase.getExternalDatabaseFile(context) }}
fun disableDataInPublic() { onView(withId(R.id.DataInPublicFolder)).perform(scrollTo(), click()) R.string.disabled.byText().perform(click()) waitUntilSettingsValue(R.id.DataInPublicFolder, R.string.disabled) waitUntil(10_000L) { NotallyDatabase.getCurrentDatabaseFile(context) == NotallyDatabase.getInternalDatabaseFile(context) }}
fun lockAndUnlockDevice() { val device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) device.sleep() SystemClock.sleep(2000) device.wakeUp() device.pressMenu()}
fun moveCursorToEnd(): ViewAction { return object : ViewAction { override fun getConstraints(): Matcher<View> { return isAssignableFrom(EditText::class.java) }
override fun getDescription(): String { return "Move cursor to end of EditText" }
override fun perform(uiController: UiController?, view: View?) { val editText = view as EditText editText.setSelection(editText.text.length) } }}123version https://git-lfs.github.com/spec/v1oid sha256:b2ea0488701591857264f60b5a560c8c628c679fc99462b273584dcf75defb5esize 1323506912345678910[ { "source": "/logs/artifacts", "destination": "artifacts/logs/artifacts", "type": "file", "status": "failed", "service": null, "exclude": [] }]1{"task":{"path":"tasks/task"},"trial_name":"t-093ccf66-1","trials_dir":"jobs","environment_build_timeout_multiplier":2.0,"agent":{"import_path":null,"model_name":"deepseek-v4.1-flash","max_timeout_sec":129600.0,"kwargs":{"disallowed_tools":"WebFetch,WebSearch","reasoning_effort":"max"},"env":{"ANTHROPIC_API_KEY":"****","ANTHROPIC_BASE_URL":"https://api.anthropic.com","DISABLE_AUTOUPDATER":"1"},"name":"claude-code"},"environment":{"import_path":null,"kwargs":{},"type":"docker"},"job_id":"4982e038-d6df-4acf-a647-75bf26d73828"}1{"id":"1d440cc0-a137-4da7-bc28-0ed5cd10ab58","task_name":"android-bench/efflora__notallyx-overview-compose","trial_name":"t-093ccf66-1","trial_uri":"file:///jobs/trial","task_id":{"path":"tasks/task"},"source":null,"task_checksum":"","config":{"task":{"path":"tasks/task","git_url":null,"git_commit_id":null,"name":null,"ref":null,"overwrite":false,"download_dir":null,"source":null},"trial_name":"t-093ccf66-1","trials_dir":"jobs","install_only":false,"timeout_multiplier":1.0,"agent_timeout_multiplier":null,"verifier_timeout_multiplier":null,"agent_setup_timeout_multiplier":null,"environment_build_timeout_multiplier":2.0,"agent":{"name":"claude-code","import_path":null,"model_name":"deepseek-v4.1-flash","n_concurrent":null,"concurrency_group":null,"skills":[],"override_timeout_sec":null,"override_setup_timeout_sec":null,"max_timeout_sec":129600.0,"resume_trajectory":false,"load_trajectory":null,"extra_allowed_hosts":[],"kwargs":{"disallowed_tools":"WebFetch,WebSearch","reasoning_effort":"max"},"env":{"ANTHROPIC_API_KEY":"****","ANTHROPIC_BASE_URL":"https://api.anthropic.com","DISABLE_AUTOUPDATER":"1"},"mcp_servers":[]},"user_agent":null,"environment":{"type":"docker","import_path":null,"force_build":false,"delete":true,"cpu_enforcement_policy":"auto","memory_enforcement_policy":"auto","override_cpus":null,"override_memory_mb":null,"override_storage_mb":null,"override_gpus":null,"override_tpu":null,"mounts":null,"extra_docker_compose":[],"kwargs":{},"extra_allowed_hosts":[]},"verifier":{"override_timeout_sec":null,"max_timeout_sec":null,"disable":false},"artifacts":[],"extra_instruction_paths":[],"extra_instructions":[],"job_id":"4982e038-d6df-4acf-a647-75bf26d73828","source_trial":null},"agent_info":{"name":"claude-code","version":"2.1.287","model_info":{"name":"deepseek-v4.1-flash","provider":"anthropic"}},"agent_result":{"n_input_tokens":55018687,"n_cache_tokens":53854464,"n_output_tokens":340315,"cost_usd":null,"model_usage":{"deepseek-v4.1-flash":{"n_input_tokens":55018687,"n_cache_tokens":53854464,"n_output_tokens":340315,"cost_usd":null}},"rollout_details":null,"metadata":null},"verifier_result":{"rewards":{"reward":0.9498}},"exception_info":null,"started_at":"2026-11-12T10:00:53.315084Z","finished_at":"2026-11-12T11:34:38.449149Z","environment_setup":{"started_at":"2026-11-12T10:00:53.318986Z","finished_at":"2026-11-12T10:03:29.090880Z"},"agent_setup":{"started_at":"2026-11-12T10:03:29.090910Z","finished_at":"2026-11-12T10:03:31.821642Z"},"agent_execution":{"started_at":"2026-11-12T10:03:32.067672Z","finished_at":"2026-11-12T10:59:37.041924Z"},"verifier":{"started_at":"2026-11-12T11:36:13.681039Z","finished_at":"2026-11-12T12:13:37.070128Z"},"step_results":null}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208{ "efflora__notallyx-overview-compose": { "score": 0.0, "diagnostics": [ "Verifying 250 pass_to_pass tests and 11 fail_to_pass tests.", "Running test attempt: 1", "Build failed for command: './gradlew :app:testDebugUnitTest -I /tests/test.init.gradle --offline --console=plain --no-daemon --max-workers=4 '-Dorg.gradle.jvmargs=-Xmx6g -XX:MaxMetaspaceSize=1g''", "Test failed, command: './gradlew :app:testDebugUnitTest -I /tests/test.init.gradle --offline --console=plain --no-daemon --max-workers=4 '-Dorg.gradle.jvmargs=-Xmx6g -XX:MaxMetaspaceSize=1g''", "Must Pass test failed: 'testDebugUnitTest#Test longPressingAnotherNoteSelectsTheRange(com.philkes.notallyx.overview.NotesOverviewTest)'", "Test attempt 1: AGENT_FAILED_TEST", "Running test attempt: 2", "Build failed for command: './gradlew :app:testDebugUnitTest -I /tests/test.init.gradle --offline --console=plain --no-daemon --max-workers=4 '-Dorg.gradle.jvmargs=-Xmx6g -XX:MaxMetaspaceSize=1g''", "Test failed, command: './gradlew :app:testDebugUnitTest -I /tests/test.init.gradle --offline --console=plain --no-daemon --max-workers=4 '-Dorg.gradle.jvmargs=-Xmx6g -XX:MaxMetaspaceSize=1g''", "Must Pass test failed: 'testDebugUnitTest#Test longPressingAnotherNoteSelectsTheRange(com.philkes.notallyx.overview.NotesOverviewTest)'", "Test attempt 2: AGENT_FAILED_TEST", "Running test attempt: 3", "Build failed for command: './gradlew :app:testDebugUnitTest -I /tests/test.init.gradle --offline --console=plain --no-daemon --max-workers=4 '-Dorg.gradle.jvmargs=-Xmx6g -XX:MaxMetaspaceSize=1g''", "Test failed, command: './gradlew :app:testDebugUnitTest -I /tests/test.init.gradle --offline --console=plain --no-daemon --max-workers=4 '-Dorg.gradle.jvmargs=-Xmx6g -XX:MaxMetaspaceSize=1g''", "Must Pass test failed: 'testDebugUnitTest#Test longPressingAnotherNoteSelectsTheRange(com.philkes.notallyx.overview.NotesOverviewTest)'", "Test attempt 3: AGENT_FAILED_TEST", "validation failed: visual#deleted_selection", "validation failed: visual#notes_selection", "validation failed: visual#search_archived", "validation failed: functional#longPressingAnotherNoteSelectsTheRange" ], "status": "AGENT_FAILED_VALIDATION", "used_tokens": null, "exported_passed_tests": [], "exported_failed_tests": [], "partial_score": 0.9498, "pass_rate": 0.9848, "validation_results": { "cheating#patch": 1.0, "gate#migration_started": 1.0, "requirements#legacy_views_removed": 1.0, "penalty#no_legacy_framework": 1.0, "requirements#toolchain_and_versions_unchanged": 1.0, "requirements#schema_and_preference_keys_unchanged": 1.0, "cheating#no_prebuilt_binaries": 1.0, "cheating#foreign_language_files": 1.0, "cheating#static_gradle_test_hooks": 1.0, "cheating#static_test_identity": 1.0, "visual#archived_empty": 1.0, "visual#reminders_all": 1.0, "visual#deleted_selection": 0.6, "visual#notes_grid": 1.0, "visual#notes_selection": 0.6, "visual#search_archived": 0.6, "visual#notes_list": 1.0, "functional#pinnedAndOthersHeadersInCreationOrder": 1.0, "functional#sortByTitleAscending": 1.0, "functional#sortByTitleDescending": 1.0, "functional#sortByModifiedDateDescending": 1.0, "functional#sortByCreationDateAscending": 1.0, "functional#sortByColorKeepsSameColourByLatestEdit": 1.0, "functional#cardsShowBodiesItemsLabelsAndCreationDate": 1.0, "functional#dateOnCardsFollowsTheSortKey": 1.0, "functional#noDateOnCardsWhenSortedByTitle": 1.0, "functional#listCardsShowAtMostTheConfiguredItemsAndTheRemainder": 1.0, "functional#labelsHiddenOnCardsWhenConfigured": 1.0, "functional#tappingANoteOpensItsEditor": 1.0, "functional#tappingAReminderOpensTheNotesReminders": 1.0, "functional#editorMovingANoteOffersUndo": 1.0, "functional#gridViewPlacesNotesSideBySide": 1.0, "functional#newNoteFromALabelGetsThatLabel": 1.0, "functional#deleteAllInBinAsksFirst": 1.0, "functional#rotationKeepsTheDestination": 1.0, "functional#destinationSurvivesProcessDeath": 1.0, "functional#longPressStartsSelectionAndTapsToggle": 1.0, "functional#longPressingAnotherNoteSelectsTheRange": 0.0, "functional#backEndsSelection": 1.0, "functional#closeButtonEndsSelection": 1.0, "functional#selectAllSelectsEveryNoteListed": 1.0, "functional#notesSelectionActionsAndOverflow": 1.0, "functional#pinActionFollowsTheSelection": 1.0, "functional#shareOfferedForASingleNote": 1.0, "functional#shareNotOfferedForSeveralNotes": 1.0, "functional#exportOffersEveryFormat": 1.0, "functional#archiveFromSelectionCanBeUndone": 1.0, "functional#deleteFromSelectionMovesToBinWithUndo": 1.0, "functional#labelsActionKeepsPartlyAppliedLabels": 1.0, "functional#labelsActionWithoutLabelsOpensLabelsScreen": 1.0, "functional#rotationKeepsTheSelection": 1.0, "functional#archivedSelectionActionsAndOverflow": 1.0, "functional#deletedSelectionActionsAndOverflow": 1.0, "functional#deleteForeverAsksFirstAndCanBeUndone": 1.0, "functional#restoreFromBinCanBeUndone": 1.0, "functional#unarchiveCanBeUndone": 1.0, "functional#searchFindsNotesAndFolderChipsSwitchFolder": 1.0, "functional#searchStartedInArchivedSearchesArchived": 1.0, "functional#searchInsideALabelHasNoFolderChips": 1.0, "functional#searchWithoutMatchesShowsNoNotes": 1.0, "functional#openingANoteFromSearchCarriesTheQuery": 1.0, "functional#rotationKeepsTheSearch": 1.0, "functional#searchSurvivesProcessDeath": 1.0, "functional#remindersFiltersAndTheirOrder": 1.0, "functional#remindersAllListsTheLatestReminderFirst": 1.0, "functional#rotationKeepsTheReminderFilter": 1.0, "functional#linkPickerLeavesOutTheEditedNoteAndReturnsThePick": 1.0, "functional#widgetConfigurationBindsThePickedNote": 1.0 }, "scoring_breakdown": { "base_score": 0.9498, "categories": { "functional": { "passed": 61, "total": 62, "weight": 0.45, "raw_weight": 0.45, "score": 0.9839, "contribution": 0.4427 }, "regression": { "passed": 197, "total": 197, "weight": 0.15, "raw_weight": 0.15, "score": 1.0, "contribution": 0.15 }, "requirements": { "passed": 1, "total": 1, "weight": 0.15, "raw_weight": 0.15, "score": 1.0, "contribution": 0.15 }, "visual": { "passed": 5.8, "total": 7, "weight": 0.25, "raw_weight": 0.25, "score": 0.8286, "contribution": 0.2071 }, "code_quality": { "passed": 0.65, "total": 1.0, "weight": 0.0, "raw_weight": 0.0, "score": 0.65, "contribution": 0.0, "violations_count": 5 } }, "multipliers_applied": [], "logs": [ "WARNING: Test 'testDebugUnitTest#Test longPressingAnotherNoteSelectsTheRange(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test sortByModifiedDateDescending(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test rotationKeepsTheReminderFilter(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test archivedSelectionActionsAndOverflow(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test searchStartedInArchivedSearchesArchived(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test exportOffersEveryFormat(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test linkPickerLeavesOutTheEditedNoteAndReturnsThePick(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test cardsShowBodiesItemsLabelsAndCreationDate(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test backEndsSelection(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test destinationSurvivesProcessDeath(com.philkes.notallyx.overview.NotesOverviewMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test sortByColorKeepsSameColourByLatestEdit(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test deleteFromSelectionMovesToBinWithUndo(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test widgetConfigurationBindsThePickedNote(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test pinnedAndOthersHeadersInCreationOrder(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test deleteAllInBinAsksFirst(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test BaseNote toJson()(com.philkes.notallyx.data.model.ModelExtensionsTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test searchInsideALabelHasNoFolderChips(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test labelsHiddenOnCardsWhenConfigured(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test rotationKeepsTheSelection(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test deleteForeverAsksFirstAndCanBeUndone(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test noDateOnCardsWhenSortedByTitle(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test newNoteFromALabelGetsThatLabel(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test labelsActionKeepsPartlyAppliedLabels(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test Json toBaseNote()(com.philkes.notallyx.data.model.ModelExtensionsTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test sortByTitleAscending(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test editorMovingANoteOffersUndo(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test restoreFromBinCanBeUndone(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test sortByTitleDescending(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test unarchiveCanBeUndone(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test sortByCreationDateAscending(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test remindersFiltersAndTheirOrder(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test openingANoteFromSearchCarriesTheQuery(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test tappingAReminderOpensTheNotesReminders(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test gridViewPlacesNotesSideBySide(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test dateOnCardsFollowsTheSortKey(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test closeButtonEndsSelection(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test rotationKeepsTheSearch(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test rotationKeepsTheDestination(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test shareOfferedForASingleNote(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test deletedSelectionActionsAndOverflow(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test selectAllSelectsEveryNoteListed(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test archiveFromSelectionCanBeUndone(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test searchSurvivesProcessDeath(com.philkes.notallyx.overview.NotesOverviewMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test shareNotOfferedForSeveralNotes(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test searchFindsNotesAndFolderChipsSwitchFolder(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test longPressStartsSelectionAndTapsToggle(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test listCardsShowAtMostTheConfiguredItemsAndTheRemainder(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test labelsActionWithoutLabelsOpensLabelsScreen(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test tappingANoteOpensItsEditor(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test remindersAllListsTheLatestReminderFirst(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test notesSelectionActionsAndOverflow(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test pinActionFollowsTheSelection(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test searchWithoutMatchesShowsNoNotes(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored." ] }, "status_description": "Agent created a patch that fails the validate.sh", "code_quality_score": 0.65, "code_quality_violations": 5 }}1234567891011[ { "phase": "verifier-generated", "source": "/logs/artifacts", "service": "main", "type": "directory", "exclude": [], "status": "ok", "destination": "artifacts/generated/logs/artifacts" }]12345{ "score": 0.65, "violations_count": 5, "reasoning": "The patch replaces the legacy RecyclerView and ActionMode in the notes overview with Jetpack Compose implementations. While the refactoring is comprehensive, several violations of the code quality checklist were introduced:\n\n1. Defensive Programming & Null Safety (Checklist 3.1 & Review Item 2):\n - In `MainActivity.kt` line 727: `database.value!!.getBaseNoteDao()` uses the forbidden `!!` operator despite already checking `if (database.value == null)`.\n - In `NoteCard.kt` line 333: `bitmap!!.asImageBitmap()` uses `!!` inside `CardImage`.\n - In `OverviewItems.kt` lines 103 and 122: `next!!.compareTo(otherNext!!)` and `last!!.compareTo(otherLast!!)` use multiple `!!` operators.\n\n2. Modifier Ownership (Checklist 2.1 & Review Item 4):\n - Public composables `NoteCard`, `NotesOverviewScreen`, `PickNoteScreen`, and `SelectionBar` do not accept `modifier: Modifier = Modifier` as their first optional parameter and instead hardcode modifiers directly onto their root components.\n\n3. Async Loading & Performance in Compose (Checklist 2.2 & Review Item 3):\n - In `NoteCard.kt` (`CardImage`), image/bitmap decoding is performed directly inside `LaunchedEffect` using synchronous `Glide...submit().get()` on `Dispatchers.IO` rather than exposing states or using idiomatic Compose image loading libraries.\n\n4. Flow Observation (Checklist 2.2):\n - In `MainActivity.kt` and `NotallyFragment.kt`, `StateFlow` instances (`selectedIds`, `items`, `keyword`, etc.) are observed in Compose via `collectAsState()` instead of `collectAsStateWithLifecycle()`.\n\n5. API Design & Boolean Traps (Checklist 3.2 & Review Item 7):\n - Boolean trap calls without named arguments are present in `MainActivity.kt` (e.g., `setPinned(viewModel, true)`, `setPinnedToStatusBar(viewModel, false)`)."}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208{ "efflora__notallyx-overview-compose": { "score": 0.0, "diagnostics": [ "Verifying 250 pass_to_pass tests and 11 fail_to_pass tests.", "Running test attempt: 1", "Build failed for command: './gradlew :app:testDebugUnitTest -I /tests/test.init.gradle --offline --console=plain --no-daemon --max-workers=4 '-Dorg.gradle.jvmargs=-Xmx6g -XX:MaxMetaspaceSize=1g''", "Test failed, command: './gradlew :app:testDebugUnitTest -I /tests/test.init.gradle --offline --console=plain --no-daemon --max-workers=4 '-Dorg.gradle.jvmargs=-Xmx6g -XX:MaxMetaspaceSize=1g''", "Must Pass test failed: 'testDebugUnitTest#Test longPressingAnotherNoteSelectsTheRange(com.philkes.notallyx.overview.NotesOverviewTest)'", "Test attempt 1: AGENT_FAILED_TEST", "Running test attempt: 2", "Build failed for command: './gradlew :app:testDebugUnitTest -I /tests/test.init.gradle --offline --console=plain --no-daemon --max-workers=4 '-Dorg.gradle.jvmargs=-Xmx6g -XX:MaxMetaspaceSize=1g''", "Test failed, command: './gradlew :app:testDebugUnitTest -I /tests/test.init.gradle --offline --console=plain --no-daemon --max-workers=4 '-Dorg.gradle.jvmargs=-Xmx6g -XX:MaxMetaspaceSize=1g''", "Must Pass test failed: 'testDebugUnitTest#Test longPressingAnotherNoteSelectsTheRange(com.philkes.notallyx.overview.NotesOverviewTest)'", "Test attempt 2: AGENT_FAILED_TEST", "Running test attempt: 3", "Build failed for command: './gradlew :app:testDebugUnitTest -I /tests/test.init.gradle --offline --console=plain --no-daemon --max-workers=4 '-Dorg.gradle.jvmargs=-Xmx6g -XX:MaxMetaspaceSize=1g''", "Test failed, command: './gradlew :app:testDebugUnitTest -I /tests/test.init.gradle --offline --console=plain --no-daemon --max-workers=4 '-Dorg.gradle.jvmargs=-Xmx6g -XX:MaxMetaspaceSize=1g''", "Must Pass test failed: 'testDebugUnitTest#Test longPressingAnotherNoteSelectsTheRange(com.philkes.notallyx.overview.NotesOverviewTest)'", "Test attempt 3: AGENT_FAILED_TEST", "validation failed: visual#deleted_selection", "validation failed: visual#notes_selection", "validation failed: visual#search_archived", "validation failed: functional#longPressingAnotherNoteSelectsTheRange" ], "status": "AGENT_FAILED_VALIDATION", "used_tokens": null, "exported_passed_tests": [], "exported_failed_tests": [], "partial_score": 0.9498, "pass_rate": 0.9848, "validation_results": { "cheating#patch": 1.0, "gate#migration_started": 1.0, "requirements#legacy_views_removed": 1.0, "penalty#no_legacy_framework": 1.0, "requirements#toolchain_and_versions_unchanged": 1.0, "requirements#schema_and_preference_keys_unchanged": 1.0, "cheating#no_prebuilt_binaries": 1.0, "cheating#foreign_language_files": 1.0, "cheating#static_gradle_test_hooks": 1.0, "cheating#static_test_identity": 1.0, "visual#archived_empty": 1.0, "visual#reminders_all": 1.0, "visual#deleted_selection": 0.6, "visual#notes_grid": 1.0, "visual#notes_selection": 0.6, "visual#search_archived": 0.6, "visual#notes_list": 1.0, "functional#pinnedAndOthersHeadersInCreationOrder": 1.0, "functional#sortByTitleAscending": 1.0, "functional#sortByTitleDescending": 1.0, "functional#sortByModifiedDateDescending": 1.0, "functional#sortByCreationDateAscending": 1.0, "functional#sortByColorKeepsSameColourByLatestEdit": 1.0, "functional#cardsShowBodiesItemsLabelsAndCreationDate": 1.0, "functional#dateOnCardsFollowsTheSortKey": 1.0, "functional#noDateOnCardsWhenSortedByTitle": 1.0, "functional#listCardsShowAtMostTheConfiguredItemsAndTheRemainder": 1.0, "functional#labelsHiddenOnCardsWhenConfigured": 1.0, "functional#tappingANoteOpensItsEditor": 1.0, "functional#tappingAReminderOpensTheNotesReminders": 1.0, "functional#editorMovingANoteOffersUndo": 1.0, "functional#gridViewPlacesNotesSideBySide": 1.0, "functional#newNoteFromALabelGetsThatLabel": 1.0, "functional#deleteAllInBinAsksFirst": 1.0, "functional#rotationKeepsTheDestination": 1.0, "functional#destinationSurvivesProcessDeath": 1.0, "functional#longPressStartsSelectionAndTapsToggle": 1.0, "functional#longPressingAnotherNoteSelectsTheRange": 0.0, "functional#backEndsSelection": 1.0, "functional#closeButtonEndsSelection": 1.0, "functional#selectAllSelectsEveryNoteListed": 1.0, "functional#notesSelectionActionsAndOverflow": 1.0, "functional#pinActionFollowsTheSelection": 1.0, "functional#shareOfferedForASingleNote": 1.0, "functional#shareNotOfferedForSeveralNotes": 1.0, "functional#exportOffersEveryFormat": 1.0, "functional#archiveFromSelectionCanBeUndone": 1.0, "functional#deleteFromSelectionMovesToBinWithUndo": 1.0, "functional#labelsActionKeepsPartlyAppliedLabels": 1.0, "functional#labelsActionWithoutLabelsOpensLabelsScreen": 1.0, "functional#rotationKeepsTheSelection": 1.0, "functional#archivedSelectionActionsAndOverflow": 1.0, "functional#deletedSelectionActionsAndOverflow": 1.0, "functional#deleteForeverAsksFirstAndCanBeUndone": 1.0, "functional#restoreFromBinCanBeUndone": 1.0, "functional#unarchiveCanBeUndone": 1.0, "functional#searchFindsNotesAndFolderChipsSwitchFolder": 1.0, "functional#searchStartedInArchivedSearchesArchived": 1.0, "functional#searchInsideALabelHasNoFolderChips": 1.0, "functional#searchWithoutMatchesShowsNoNotes": 1.0, "functional#openingANoteFromSearchCarriesTheQuery": 1.0, "functional#rotationKeepsTheSearch": 1.0, "functional#searchSurvivesProcessDeath": 1.0, "functional#remindersFiltersAndTheirOrder": 1.0, "functional#remindersAllListsTheLatestReminderFirst": 1.0, "functional#rotationKeepsTheReminderFilter": 1.0, "functional#linkPickerLeavesOutTheEditedNoteAndReturnsThePick": 1.0, "functional#widgetConfigurationBindsThePickedNote": 1.0 }, "scoring_breakdown": { "base_score": 0.9498, "categories": { "functional": { "passed": 61, "total": 62, "weight": 0.45, "raw_weight": 0.45, "score": 0.9839, "contribution": 0.4427 }, "regression": { "passed": 197, "total": 197, "weight": 0.15, "raw_weight": 0.15, "score": 1.0, "contribution": 0.15 }, "requirements": { "passed": 1, "total": 1, "weight": 0.15, "raw_weight": 0.15, "score": 1.0, "contribution": 0.15 }, "visual": { "passed": 5.8, "total": 7, "weight": 0.25, "raw_weight": 0.25, "score": 0.8286, "contribution": 0.2071 }, "code_quality": { "passed": 0.65, "total": 1.0, "weight": 0.0, "raw_weight": 0.0, "score": 0.65, "contribution": 0.0, "violations_count": 5 } }, "multipliers_applied": [], "logs": [ "WARNING: Test 'testDebugUnitTest#Test longPressingAnotherNoteSelectsTheRange(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test sortByModifiedDateDescending(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test rotationKeepsTheReminderFilter(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test archivedSelectionActionsAndOverflow(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test searchStartedInArchivedSearchesArchived(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test exportOffersEveryFormat(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test linkPickerLeavesOutTheEditedNoteAndReturnsThePick(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test cardsShowBodiesItemsLabelsAndCreationDate(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test backEndsSelection(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test destinationSurvivesProcessDeath(com.philkes.notallyx.overview.NotesOverviewMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test sortByColorKeepsSameColourByLatestEdit(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test deleteFromSelectionMovesToBinWithUndo(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test widgetConfigurationBindsThePickedNote(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test pinnedAndOthersHeadersInCreationOrder(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test deleteAllInBinAsksFirst(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test BaseNote toJson()(com.philkes.notallyx.data.model.ModelExtensionsTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test searchInsideALabelHasNoFolderChips(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test labelsHiddenOnCardsWhenConfigured(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test rotationKeepsTheSelection(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test deleteForeverAsksFirstAndCanBeUndone(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test noDateOnCardsWhenSortedByTitle(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test newNoteFromALabelGetsThatLabel(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test labelsActionKeepsPartlyAppliedLabels(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test Json toBaseNote()(com.philkes.notallyx.data.model.ModelExtensionsTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test sortByTitleAscending(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test editorMovingANoteOffersUndo(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test restoreFromBinCanBeUndone(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test sortByTitleDescending(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test unarchiveCanBeUndone(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test sortByCreationDateAscending(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test remindersFiltersAndTheirOrder(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test openingANoteFromSearchCarriesTheQuery(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test tappingAReminderOpensTheNotesReminders(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test gridViewPlacesNotesSideBySide(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test dateOnCardsFollowsTheSortKey(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test closeButtonEndsSelection(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test rotationKeepsTheSearch(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test rotationKeepsTheDestination(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test shareOfferedForASingleNote(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test deletedSelectionActionsAndOverflow(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test selectAllSelectsEveryNoteListed(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test archiveFromSelectionCanBeUndone(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test searchSurvivesProcessDeath(com.philkes.notallyx.overview.NotesOverviewMigrationTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test shareNotOfferedForSeveralNotes(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test searchFindsNotesAndFolderChipsSwitchFolder(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test longPressStartsSelectionAndTapsToggle(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test listCardsShowAtMostTheConfiguredItemsAndTheRemainder(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test labelsActionWithoutLabelsOpensLabelsScreen(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test tappingANoteOpensItsEditor(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test remindersAllListsTheLatestReminderFirst(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test notesSelectionActionsAndOverflow(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test pinActionFollowsTheSelection(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored.", "WARNING: Test 'testDebugUnitTest#Test searchWithoutMatchesShowsNoNotes(com.philkes.notallyx.overview.NotesOverviewTest)' did not match any category rules. It will be IGNORED and not scored." ] }, "status_description": "Agent created a patch that fails the validate.sh", "code_quality_score": 0.65, "code_quality_violations": 5 }}10.949812# tests failed in the last test round: 1com.philkes.notallyx.overview.NotesOverviewTest#longPressingAnotherNoteSelectsTheRange: java.lang.AssertionError: Timed out waiting for: range selected Visible texts: [2, Pinned, Grocery run, Created 06.10.25, Milk, Bread, Eggs, Quarterly plan, Created 05.10.25, Draft the roadmap, Work, 1234{ "schema": 1, "runtime_sha256": "39e8a80a45f82b61eacf72eab4932eb9d713f2d6610a98acbb587876fab5555b"}1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768cheating#patch: passgate#migration_started: pass | passed: migrationGridIsCompose, migrationLinkPickerIsCompose, migrationNotesListIsCompose, migrationOtherDestinationsAreCompose, migrationRemindersIsCompose, migrationSearchIsCompose, migrationSelectionBarIsCompose, migrationWidgetPickerIsComposerequirements#legacy_views_removed: pass | old note list views unusedpenalty#no_legacy_framework: pass | cleanrequirements#toolchain_and_versions_unchanged: pass | unchangedrequirements#schema_and_preference_keys_unchanged: pass | schema unchanged, 37 preference keys keptcheating#no_prebuilt_binaries: pass | -cheating#foreign_language_files: pass | -cheating#static_gradle_test_hooks: pass | -cheating#static_test_identity: pass | -visual#archived_empty: 1.00visual#reminders_all: 1.00visual#deleted_selection: 0.60visual#notes_grid: 1.00visual#notes_selection: 0.60visual#search_archived: 0.60visual#notes_list: 1.00functional#pinnedAndOthersHeadersInCreationOrder: pass | notes list migrated; measured passfunctional#sortByTitleAscending: pass | notes list migrated; measured passfunctional#sortByTitleDescending: pass | notes list migrated; measured passfunctional#sortByModifiedDateDescending: pass | notes list migrated; measured passfunctional#sortByCreationDateAscending: pass | notes list migrated; measured passfunctional#sortByColorKeepsSameColourByLatestEdit: pass | notes list migrated; measured passfunctional#cardsShowBodiesItemsLabelsAndCreationDate: pass | notes list migrated; measured passfunctional#dateOnCardsFollowsTheSortKey: pass | notes list migrated; measured passfunctional#noDateOnCardsWhenSortedByTitle: pass | notes list migrated; measured passfunctional#listCardsShowAtMostTheConfiguredItemsAndTheRemainder: pass | notes list migrated; measured passfunctional#labelsHiddenOnCardsWhenConfigured: pass | notes list migrated; measured passfunctional#tappingANoteOpensItsEditor: pass | notes list migrated; measured passfunctional#tappingAReminderOpensTheNotesReminders: pass | notes list migrated; measured passfunctional#editorMovingANoteOffersUndo: pass | notes list migrated; measured passfunctional#gridViewPlacesNotesSideBySide: pass | notes grid migrated; measured passfunctional#newNoteFromALabelGetsThatLabel: pass | other destinations migrated; measured passfunctional#deleteAllInBinAsksFirst: pass | other destinations migrated; measured passfunctional#rotationKeepsTheDestination: pass | other destinations migrated; measured passfunctional#destinationSurvivesProcessDeath: pass | other destinations migrated; measured passfunctional#longPressStartsSelectionAndTapsToggle: pass | notes list and selection bar migrated; measured passfunctional#longPressingAnotherNoteSelectsTheRange: fail | notes list and selection bar migrated; measured failfunctional#backEndsSelection: pass | notes list and selection bar migrated; measured passfunctional#closeButtonEndsSelection: pass | notes list and selection bar migrated; measured passfunctional#selectAllSelectsEveryNoteListed: pass | notes list and selection bar migrated; measured passfunctional#notesSelectionActionsAndOverflow: pass | notes list and selection bar migrated; measured passfunctional#pinActionFollowsTheSelection: pass | notes list and selection bar migrated; measured passfunctional#shareOfferedForASingleNote: pass | notes list and selection bar migrated; measured passfunctional#shareNotOfferedForSeveralNotes: pass | notes list and selection bar migrated; measured passfunctional#exportOffersEveryFormat: pass | notes list and selection bar migrated; measured passfunctional#archiveFromSelectionCanBeUndone: pass | notes list and selection bar migrated; measured passfunctional#deleteFromSelectionMovesToBinWithUndo: pass | notes list and selection bar migrated; measured passfunctional#labelsActionKeepsPartlyAppliedLabels: pass | notes list and selection bar migrated; measured passfunctional#labelsActionWithoutLabelsOpensLabelsScreen: pass | notes list and selection bar migrated; measured passfunctional#rotationKeepsTheSelection: pass | notes list and selection bar migrated; measured passfunctional#archivedSelectionActionsAndOverflow: pass | other destinations and selection bar migrated; measured passfunctional#deletedSelectionActionsAndOverflow: pass | other destinations and selection bar migrated; measured passfunctional#deleteForeverAsksFirstAndCanBeUndone: pass | other destinations and selection bar migrated; measured passfunctional#restoreFromBinCanBeUndone: pass | other destinations and selection bar migrated; measured passfunctional#unarchiveCanBeUndone: pass | other destinations and selection bar migrated; measured passfunctional#searchFindsNotesAndFolderChipsSwitchFolder: pass | search migrated; measured passfunctional#searchStartedInArchivedSearchesArchived: pass | search migrated; measured passfunctional#searchInsideALabelHasNoFolderChips: pass | search migrated; measured passfunctional#searchWithoutMatchesShowsNoNotes: pass | search migrated; measured passfunctional#openingANoteFromSearchCarriesTheQuery: pass | search migrated; measured passfunctional#rotationKeepsTheSearch: pass | search migrated; measured passfunctional#searchSurvivesProcessDeath: pass | search migrated; measured passfunctional#remindersFiltersAndTheirOrder: pass | reminders migrated; measured passfunctional#remindersAllListsTheLatestReminderFirst: pass | reminders migrated; measured passfunctional#rotationKeepsTheReminderFilter: pass | reminders migrated; measured passfunctional#linkPickerLeavesOutTheEditedNoteAndReturnsThePick: pass | link picker migrated; measured passfunctional#widgetConfigurationBindsThePickedNote: pass | widget picker migrated; measured pass.gitattributes+14
submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/agent/sessions/projects/-workspace-testbed/memory/MEMORY.mdAdded+1
submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/agent/sessions/projects/-workspace-testbed/memory/signal-offline-testing.mdAdded+17
submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/agent/trajectory.jsonAdded
submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/artifacts/manifest.jsonAdded+10
submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/config.jsonAdded+1
submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/result.jsonAdded+1
submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/verifier/artifacts/generated/logs/artifacts/_detailed_scores.jsonAdded+144
submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/verifier/artifacts/generated/logs/artifacts/_submission.patchAdded+2436
submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/verifier/artifacts/manifest.jsonAdded+11
submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/verifier/code_quality.jsonAdded+5
submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/verifier/detailed_scores.jsonAdded+144
submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/verifier/evaluator.logAdded
submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/verifier/reward.txtAdded+1
submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/verifier/submission.patchAdded+2436
submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/verifier/test-stdout.txtAdded
submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/verifier/test_failures.txtAdded+1
submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/verifier/tests_manifest.jsonAdded+4
submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/verifier/validate_results.txtAdded+42
submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/verifier/visual/actual/gradient_edit.pngAdded

Large File Pointer Details
- SHA256: 4afdc58f1d51aaa6c29f597d725f6f4ee2436efc210dbe028b1c973e764cfdfd
- Pointer size: 130 Bytes
- Size of remote file: 57.2 kB
submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/verifier/visual/actual/gradient_new_color.pngAdded

Large File Pointer Details
- SHA256: 41b02aa4971d2dc3b3accaa3b25e0f08c660d7b857f3d8b914aeefcbe13207af
- Pointer size: 130 Bytes
- Size of remote file: 37.4 kB
submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/verifier/visual/actual/solid_adjusted.pngAdded

Large File Pointer Details
- SHA256: 16d66927f21ff021549ae4b41b0405e24f05abcd1cb25f27d17873ae8c5d6214
- Pointer size: 130 Bytes
- Size of remote file: 32.8 kB
submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/verifier/visual/actual/solid_dark.pngAdded

Large File Pointer Details
- SHA256: ace6bcde3fbb6e7dd07de2c21118349574e1bdbd38412de0a67bdbad0200fe89
- Pointer size: 130 Bytes
- Size of remote file: 33.2 kB
submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/verifier/visual/actual/solid_new_color.pngAdded

Large File Pointer Details
- SHA256: 4eeb5cd45320f4dc7c8b57b218508f12a039f887e43329b8e4986817c5f038d8
- Pointer size: 130 Bytes
- Size of remote file: 32.4 kB
submissions/claude-code__claude-opus-5-5/efflora__signal-custom-chat-color/t-f8621cc5-1/verifier/visual_score.jsonAdded+43
submissions/claude-code__claude-opus-5-5/metadata.yamlAdded+11
submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/config.jsonAdded+99
submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/result.jsonAdded+304
submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/agent/claude-code.txtAdded+3
submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/agent/sessions/.claude.jsonAdded+23
submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/agent/sessions/.last-cleanupAdded+1
submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/agent/sessions/backups/.claude.json.backup.1794477813028Added+4
submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/agent/sessions/projects/-workspace-testbed/01bd1df5-f827-42aa-8747-91c14f0974e3.jsonlAdded+3
submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/agent/sessions/projects/-workspace-testbed/01bd1df5-f827-42aa-8747-91c14f0974e3/tool-results/bbkj9rpal.txtAdded+1233
submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/agent/trajectory.jsonAdded+3
submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/artifacts/manifest.jsonAdded+10
submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/config.jsonAdded+1
submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/result.jsonAdded+1
submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/verifier/artifacts/generated/logs/artifacts/_detailed_scores.jsonAdded+208
submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/verifier/artifacts/generated/logs/artifacts/_submission.patchAdded
submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/verifier/artifacts/manifest.jsonAdded+11
submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/verifier/code_quality.jsonAdded+5
submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/verifier/detailed_scores.jsonAdded+208
submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/verifier/evaluator.logAdded
submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/verifier/reward.txtAdded+1
submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/verifier/submission.patchAdded
submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/verifier/test-stdout.txtAdded
submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/verifier/test_failures.txtAdded+2
submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/verifier/tests_manifest.jsonAdded+4
submissions/claude-code__deepseek-v4.1-flash/efflora__notallyx-overview-compose/t-093ccf66-1/verifier/validate_results.txtAdded+68