Skip to content

CircleToSearch with multi search engine support for all android

Kotlin

Immersive View

AKS Labse6bb9168d240
diff --git a/.kotlin/errors/errors-1774802776087.log b/.kotlin/errors/errors-1774802776087.log
new file mode 100644
index 0000000..1219b50
--- /dev/null
+++ b/.kotlin/errors/errors-1774802776087.log
@@ -0,0 +1,4 @@
+kotlin version: 2.0.21
+error message: The daemon has terminated unexpectedly on startup attempt #1 with error code: 0. The daemon process output:
+ 1. Kotlin compile daemon is ready
+
diff --git a/analyze_depth.ps1 b/analyze_depth.ps1
new file mode 100644
index 0000000..4d242cf
--- /dev/null
+++ b/analyze_depth.ps1
@@ -0,0 +1,10 @@
+$lines = Get-Content "c:\Users\ashin\AndroidStudioProjects\CircleToSearch\app\src\main\java\com\akslabs\circletosearch\ui\CircleToSearchScreen.kt"
+$depth = 0
+for ($i = 0; $i -lt $lines.Length; $i++) {
+ $line = $lines[$i]
+ $opens = ($line.ToCharArray() | Where-Object { $_ -eq '{' }).Count
+ $closes = ($line.ToCharArray() | Where-Object { $_ -eq '}' }).Count
+ $depth += ($opens - $closes)
+ # Output any line where depth changes significantly or looks suspicious
+ Write-Host "Line $($i+1): Depth=$depth | $line"
+}
diff --git a/app/src/main/java/com/akslabs/circletosearch/ui/CircleToSearchScreen.kt b/app/src/main/java/com/akslabs/circletosearch/ui/CircleToSearchScreen.kt
index 50eb4fe..0f501a6 100644
--- a/app/src/main/java/com/akslabs/circletosearch/ui/CircleToSearchScreen.kt
+++ b/app/src/main/java/com/akslabs/circletosearch/ui/CircleToSearchScreen.kt
@@ -1142,7 +1142,7 @@ fun CircleToSearchScreen(
// 4. Header (Top)
androidx.compose.animation.AnimatedVisibility(
- visible = isUIVisible && !isCopyMode,
+ visible = isUIVisible && !isCopyMode && !isEntityExtractMode,
enter = androidx.compose.animation.slideInVertically(
initialOffsetY = { -it }, // Commence au-dessus de l'écran (-100%)
animationSpec = tween(500, easing = androidx.compose.animation.core.FastOutSlowInEasing)
@@ -1328,7 +1328,7 @@ fun CircleToSearchScreen(
var isCopyTextTriggered by remember { mutableStateOf(false) }
androidx.compose.animation.AnimatedVisibility(
- visible = isUIVisible && !isCopyMode,
+ visible = isUIVisible && !isCopyMode && !isEntityExtractMode,
enter = slideInVertically(
initialOffsetY = { it }, // slides up from below
animationSpec = tween(300, easing = androidx.compose.animation.core.CubicBezierEasing(0f, 0f, 0.2f, 1f))
@@ -1554,21 +1554,32 @@ fun CircleToSearchScreen(
val urlRegex = android.util.Patterns.WEB_URL.toRegex()
val emailRegex = android.util.Patterns.EMAIL_ADDRESS.toRegex()
- val phoneRegex = Regex("""[\+\d\s\-\(\)]{7,15}""")
+ val phoneRegexLine = Regex("""(\+?[\d\s\-\(\).]{9,20})""")
val upiRegex = Regex("""[a-zA-Z0-9.\-_]{2,256}@[a-zA-Z]{2,64}""")
textNodes.forEach { node ->
+ val lineText = node.fullText
+ phoneRegexLine.findAll(lineText).forEach { match ->
+ val phoneCandidate = match.value.trim()
+ if (phoneCandidate.count { it.isDigit() } >= 10) {
+ val startIdx = match.range.first
+ val endIdx = match.range.last + 1
+ val ratioStart = startIdx.toFloat() / lineText.length.coerceAtLeast(1)
+ val ratioEnd = endIdx.toFloat() / lineText.length.coerceAtLeast(1)
+ val entityBounds = android.graphics.RectF(
+ node.bounds.left.toFloat() + (ratioStart * node.bounds.width().toFloat()),
+ node.bounds.top.toFloat(),
+ node.bounds.left.toFloat() + (ratioEnd * node.bounds.width().toFloat()),
+ node.bounds.bottom.toFloat()
+ )
+ entities.add(SmartEntity.Phone(phoneCandidate, entityBounds))
+ }
+ }
node.words.forEach { word ->
val txt = word.text.trim()
- if (emailRegex.matches(txt)) {
- entities.add(SmartEntity.Email(txt, word.bounds))
- } else if (upiRegex.matches(txt)) {
- entities.add(SmartEntity.Upi(txt, word.bounds))
- } else if (urlRegex.matches(txt)) {
- entities.add(SmartEntity.Url(txt, word.bounds))
- } else if (phoneRegex.matches(txt) && txt.count { it.isDigit() } >= 10) {
- entities.add(SmartEntity.Phone(txt, word.bounds))
- }
+ if (emailRegex.matches(txt)) entities.add(SmartEntity.Email(txt, word.bounds))
+ else if (upiRegex.matches(txt)) entities.add(SmartEntity.Upi(txt, word.bounds))
+ else if (urlRegex.matches(txt)) entities.add(SmartEntity.Url(txt, word.bounds))
}
}
kotlinx.coroutines.withContext(kotlinx.coroutines.Dispatchers.Main) {
@@ -1609,6 +1620,20 @@ fun CircleToSearchScreen(
}
}
+ // Phase 44: Smart Entity Extractor Exit Overlay (Full Screen tap capture)
+ if (isEntityExtractMode) {
+ Box(
+ modifier = Modifier
+ .fillMaxSize()
+ .zIndex(2550f)
+ .pointerInput(Unit) {
+ detectTapGestures {
+ isEntityExtractMode = false
+ }
+ }
+ )
+ }
+
// Copy Text overlay integration (Activity-based)
if (isCopyMode && copyTextManager != null) {
AndroidView(
@@ -1855,6 +1880,11 @@ fun CircleToSearchScreen(
.border(1.5.dp, entity.sourceColor, CircleShape)
.clickable {
try {
+ // Auto-copy clicked content to clipboard
+ val clipboard = context.getSystemService(android.content.Context.CLIPBOARD_SERVICE) as android.content.ClipboardManager
+ val clip = android.content.ClipData.newPlainText(entity.typeName, entity.text)
+ clipboard.setPrimaryClip(clip)
+
val intent = when(entity) {
is SmartEntity.Url -> android.content.Intent(android.content.Intent.ACTION_VIEW, android.net.Uri.parse(if (!entity.text.startsWith("http")) "http://${entity.text}" else entity.text))
is SmartEntity.Email -> android.content.Intent(android.content.Intent.ACTION_SENDTO, android.net.Uri.parse("mailto:${entity.text}"))
diff --git a/build_error_current.txt b/build_error_current.txt
new file mode 100644
index 0000000..cf1f7d3
Binary files /dev/null and b/build_error_current.txt differ
diff --git a/build_error_final.txt b/build_error_final.txt
new file mode 100644
index 0000000..7d67bbb
Binary files /dev/null and b/build_error_final.txt differ
diff --git a/build_log.txt b/build_log.txt
new file mode 100644
index 0000000..46b134b
--- /dev/null
+++ b/build_log.txt
@@ -0,0 +1 @@
+��
\ No newline at end of file
diff --git a/build_output.txt b/build_output.txt
new file mode 100644
index 0000000..fdac3af
Binary files /dev/null and b/build_output.txt differ
diff --git a/count_braces.ps1 b/count_braces.ps1
new file mode 100644
index 0000000..4557d7b
--- /dev/null
+++ b/count_braces.ps1
@@ -0,0 +1,6 @@
+$content = Get-Content "c:\Users\ashin\AndroidStudioProjects\CircleToSearch\app\src\main\java\com\akslabs\circletosearch\ui\CircleToSearchScreen.kt" -Raw
+$open = ($content.ToCharArray() | Where-Object { $_ -eq '{' }).Count
+$close = ($content.ToCharArray() | Where-Object { $_ -eq '}' }).Count
+Write-Host "Open: $open"
+Write-Host "Close: $close"
+Write-Host "Diff: $($open - $close)"
diff --git a/count_braces_range.ps1 b/count_braces_range.ps1
new file mode 100644
index 0000000..c03ea3f
--- /dev/null
+++ b/count_braces_range.ps1
@@ -0,0 +1,13 @@
+$lines = Get-Content "c:\Users\ashin\AndroidStudioProjects\CircleToSearch\app\src\main\java\com\akslabs\circletosearch\ui\CircleToSearchScreen.kt"
+$totalOpen = 0
+$totalClose = 0
+for ($i = 0; $i -lt $lines.Length; $i++) {
+ $line = $lines[$i]
+ $open = ($line.ToCharArray() | Where-Object { $_ -eq '{' }).Count
+ $close = ($line.ToCharArray() | Where-Object { $_ -eq '}' }).Count
+ $totalOpen += $open
+ $totalClose += $close
+ if ($i % 500 -eq 0 -or $i -eq $lines.Length - 1) {
+ Write-Host "Line $($i+1): Open=$totalOpen, Close=$totalClose, Diff=$($totalOpen - $totalClose)"
+ }
+}
diff --git a/depth_log.txt b/depth_log.txt
new file mode 100644
index 0000000..3f3b5fa
Binary files /dev/null and b/depth_log.txt differ
diff --git a/find_zero_depth.ps1 b/find_zero_depth.ps1
new file mode 100644
index 0000000..4520a1f
--- /dev/null
+++ b/find_zero_depth.ps1
@@ -0,0 +1,12 @@
+$lines = Get-Content "c:\Users\ashin\AndroidStudioProjects\CircleToSearch\app\src\main\java\com\akslabs\circletosearch\ui\CircleToSearchScreen.kt"
+$depth = 0
+for ($i = 0; $i -lt $lines.Length; $i++) {
+ $line = $lines[$i]
+ $opens = ($line.ToCharArray() | Where-Object { $_ -eq '{' }).Count
+ $closes = ($line.ToCharArray() | Where-Object { $_ -eq '}' }).Count
+ $depth += ($opens - $closes)
+ if ($depth -le 0 -and $i -gt 200 -and $i -lt ($lines.Length - 10)) {
+ Write-Host "CRITICAL: Depth hit 0 at line $($i+1): $line"
+ # break
+ }
+}