Skip to content

CircleToSearch with multi search engine support for all android

Kotlin

used dynamic colors for overlay and added borders to active selected overlay

AKS Labs492d86675cc3
diff --git a/app/src/main/java/com/akslabs/circletosearch/CircleToSearchAccessibilityService.kt b/app/src/main/java/com/akslabs/circletosearch/CircleToSearchAccessibilityService.kt
index 371ba50..689dcc9 100644
--- a/app/src/main/java/com/akslabs/circletosearch/CircleToSearchAccessibilityService.kt
+++ b/app/src/main/java/com/akslabs/circletosearch/CircleToSearchAccessibilityService.kt
@@ -29,6 +29,7 @@ import android.content.res.Configuration
import android.graphics.Bitmap
import android.graphics.Color
import android.graphics.PixelFormat
+import android.graphics.drawable.GradientDrawable
import android.hardware.camera2.CameraManager
import android.os.Build
import android.os.VibrationEffect
@@ -38,6 +39,7 @@ import android.view.GestureDetector
import android.view.Gravity
import android.view.MotionEvent
import android.view.View
+import android.view.ViewOutlineProvider
import android.view.WindowManager
import android.view.accessibility.AccessibilityEvent
import com.akslabs.circletosearch.data.ActionType
@@ -177,6 +179,36 @@ class CircleToSearchAccessibilityService : AccessibilityService() {
overlayViews.clear()
return
}
+
+ // --- Resolution of Colors ---
+ val primaryColor = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
+ getColor(android.R.color.system_accent1_500)
+ } else {
+ Color.parseColor("#FF6200EE") // Default Material Primary
+ }
+
+ val themePalette = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
+ listOf(
+ android.R.color.system_accent1_200,
+ android.R.color.system_accent2_200,
+ android.R.color.system_accent3_200,
+ android.R.color.system_neutral1_200,
+ android.R.color.system_neutral2_200
+ ).map {
+ val color = getColor(it)
+ // Set alpha to 40% (approx 102/255) for subtle blending
+ Color.argb(102, Color.red(color), Color.green(color), Color.blue(color))
+ }
+ } else {
+ // Legacy fallbacks with 40% opacity
+ listOf(
+ Color.parseColor("#66FF0000"), // Red
+ Color.parseColor("#6600FF00"), // Green
+ Color.parseColor("#660000FF"), // Blue
+ Color.parseColor("#66FFFF00"), // Yellow
+ Color.parseColor("#66FF00FF") // Magenta
+ )
+ }
// Landscape check
val currentOrientation = resources.configuration.orientation
@@ -215,10 +247,20 @@ class CircleToSearchAccessibilityService : AccessibilityService() {
// Update Color (Debug)
if (config.isVisible) {
- val colors = listOf(Color.parseColor("#80FF0000"), Color.parseColor("#8000FF00"), Color.parseColor("#800000FF"), Color.parseColor("#80FFFF00"), Color.parseColor("#80FF00FF")) // Red, Green, Blue, Yellow, Magenta
- view.setBackgroundColor(colors[index % colors.size])
+ val color = themePalette[index % themePalette.size]
+ val drawable = GradientDrawable().apply {
+ setColor(color)
+ // Only show solid primary border for the expanded/active overlay
+ if (index == config.activeSegmentIndex) {
+ setStroke(3, primaryColor)
+ }
+ }
+ view.background = drawable
+ view.elevation = 0f
} else {
+ view.background = null
view.setBackgroundColor(Color.TRANSPARENT)
+ view.elevation = 0f
}
// Update gesture listener
@@ -254,10 +296,20 @@ class CircleToSearchAccessibilityService : AccessibilityService() {
params.y = segment.yOffset
if (config.isVisible) {
- val colors = listOf(Color.parseColor("#80FF0000"), Color.parseColor("#8000FF00"), Color.parseColor("#800000FF"), Color.parseColor("#80FFFF00"), Color.parseColor("#80FF00FF"))
- view.setBackgroundColor(colors[index % colors.size])
+ val color = themePalette[index % themePalette.size]
+ val drawable = GradientDrawable().apply {
+ setColor(color)
+ // Only show solid primary border for the expanded/active overlay
+ if (index == config.activeSegmentIndex) {
+ setStroke(3, primaryColor)
+ }
+ }
+ view.background = drawable
+ view.elevation = 0f
} else {
+ view.background = null
view.setBackgroundColor(Color.TRANSPARENT)
+ view.elevation = 0f
}
attachTouchListener(view, segment, index)
diff --git a/app/src/main/java/com/akslabs/circletosearch/data/OverlayConfig.kt b/app/src/main/java/com/akslabs/circletosearch/data/OverlayConfig.kt
index 88b93a0..37f63bb 100644
--- a/app/src/main/java/com/akslabs/circletosearch/data/OverlayConfig.kt
+++ b/app/src/main/java/com/akslabs/circletosearch/data/OverlayConfig.kt
@@ -13,6 +13,7 @@ data class OverlayConfig(
@SerializedName("isEnabled") val isEnabled: Boolean = true,
@SerializedName("isEnabledInLandscape") val isEnabledInLandscape: Boolean = false,
@SerializedName("isVisible") val isVisible: Boolean = false, // Debug visibility (colored)
+ @SerializedName("activeSegmentIndex") val activeSegmentIndex: Int = -1, // Currently being edited in settings
@SerializedName("segments") val segments: List<OverlaySegment> = listOf(OverlaySegment(width = 1080)) // Default to a common large width
)
diff --git a/app/src/main/java/com/akslabs/circletosearch/ui/OverlaySettingsScreen.kt b/app/src/main/java/com/akslabs/circletosearch/ui/OverlaySettingsScreen.kt
index 73140f1..0e1554f 100644
--- a/app/src/main/java/com/akslabs/circletosearch/ui/OverlaySettingsScreen.kt
+++ b/app/src/main/java/com/akslabs/circletosearch/ui/OverlaySettingsScreen.kt
@@ -21,8 +21,11 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.ImageVector
+import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.font.FontWeight
+import androidx.core.content.ContextCompat
+import android.os.Build
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog
import androidx.compose.ui.window.DialogProperties
@@ -46,6 +49,8 @@ fun OverlaySettingsScreen(
configManager.saveConfig(newConfig)
}
+ val overlayPalette = rememberOverlayPalette(context)
+
Scaffold(
topBar = {
TopAppBar(
@@ -75,7 +80,7 @@ fun OverlaySettingsScreen(
// 1. Main Toggles
SettingsSectionHeader(title = "General")
SettingsToggleItem(
- title = "Enable Overlay",
+ title = "Enable StatusBar Overlay",
subtitle = "Show trigger zone over status bar",
icon = Icons.Default.Layers,
checked = config.isEnabled,
@@ -91,8 +96,8 @@ fun OverlaySettingsScreen(
)
Spacer(modifier = Modifier.height(12.dp))
SettingsToggleItem(
- title = "Debug Visibility",
- subtitle = "Show color to adjust position",
+ title = "Show Overlay",
+ subtitle = "Show overlay to adjust position",
icon = Icons.Default.Visibility,
checked = config.isVisible,
onCheckedChange = { updateConfig(config.copy(isVisible = it)) }
@@ -131,6 +136,12 @@ fun OverlaySettingsScreen(
SegmentEditorItem(
index = index,
segment = segment,
+ overlayPalette = overlayPalette,
+ isExpanded = config.activeSegmentIndex == index,
+ onExpandToggle = {
+ val nextIndex = if (config.activeSegmentIndex == index) -1 else index
+ updateConfig(config.copy(activeSegmentIndex = nextIndex))
+ },
onUpdate = { updatedSegment ->
val newSegments = config.segments.toMutableList()
newSegments[index] = updatedSegment
@@ -139,7 +150,11 @@ fun OverlaySettingsScreen(
onDelete = {
val newSegments = config.segments.toMutableList()
newSegments.removeAt(index)
- updateConfig(config.copy(segments = newSegments))
+ // If we deleted the active one or shifted indices, reset/update active index
+ val nextActiveIndex = if (config.activeSegmentIndex == index) -1
+ else if (config.activeSegmentIndex > index) config.activeSegmentIndex - 1
+ else config.activeSegmentIndex
+ updateConfig(config.copy(segments = newSegments, activeSegmentIndex = nextActiveIndex))
}
)
Spacer(modifier = Modifier.height(16.dp))
@@ -153,10 +168,12 @@ fun OverlaySettingsScreen(
fun SegmentEditorItem(
index: Int,
segment: OverlaySegment,
+ overlayPalette: List<Color>,
+ isExpanded: Boolean,
+ onExpandToggle: () -> Unit,
onUpdate: (OverlaySegment) -> Unit,
onDelete: () -> Unit
) {
- var isExpanded by remember { mutableStateOf(false) }
var showGestureDialog by remember { mutableStateOf(false) }
// Get screen dimensions for sliders
@@ -183,12 +200,12 @@ fun SegmentEditorItem(
// Header
Row(
verticalAlignment = Alignment.CenterVertically,
- modifier = Modifier.clickable { isExpanded = !isExpanded }
+ modifier = Modifier.clickable { onExpandToggle() }
) {
Icon(
imageVector = Icons.Default.Layers,
contentDescription = null,
- tint = listOf(Color.Red, Color.Blue, Color.Green, Color.Yellow, Color.Magenta)[index % 5],
+ tint = overlayPalette[index % overlayPalette.size],
modifier = Modifier.size(24.dp)
)
Spacer(modifier = Modifier.width(8.dp))
@@ -623,3 +640,27 @@ fun AppPickerDialog(onDismiss: () -> Unit, onAppSelected: (String) -> Unit) {
}
}
}
+@Composable
+fun rememberOverlayPalette(context: Context): List<Color> {
+ return remember(context) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
+ listOf(
+ android.R.color.system_accent1_200,
+ android.R.color.system_accent2_200,
+ android.R.color.system_accent3_200,
+ android.R.color.system_neutral1_200,
+ android.R.color.system_neutral2_200
+ ).map {
+ Color(ContextCompat.getColor(context, it))
+ }
+ } else {
+ listOf(
+ Color.Red,
+ Color.Green,
+ Color.Blue,
+ Color.Yellow,
+ Color.Magenta
+ )
+ }
+ }
+}
diff --git a/builderors.md b/builderors.md
index 6af242e..e69de29 100644
--- a/builderors.md
+++ b/builderors.md
@@ -1,22 +0,0 @@
- I com.akslabs.circletosearch:9a3f8c78: onCancelled at PHASE_CLIENT_ALREADY_HIDDEN
-2026-01-12 02:17:16.624 29031-29031 HWUI com.akslabs.circletosearch W Image decoding logging dropped!
-2026-01-12 02:17:25.214 29031-29031 CircleToSearchTile com.akslabs.circletosearch D Tile clicked. Service enabled: false
-2026-01-12 02:17:25.228 29031-29031 AndroidRuntime com.akslabs.circletosearch D Shutting down VM
-2026-01-12 02:17:25.241 29031-29031 AndroidRuntime com.akslabs.circletosearch E FATAL EXCEPTION: main (Fix with AI)
- Process: com.akslabs.circletosearch, PID: 29031
- java.lang.UnsupportedOperationException: startActivityAndCollapse: Starting activity from TileService using an Intent is not allowed.
- at android.service.quicksettings.TileService.startActivityAndCollapse(TileService.java:355)
- at com.akslabs.circletosearch.CircleToSearchTileService.onClick(CircleToSearchTileService.kt:33)
- at android.service.quicksettings.TileService$H.handleMessage(TileService.java:494)
- at android.os.Handler.dispatchMessage(Handler.java:109)
- at android.os.Looper.loopOnce(Looper.java:232)
- at android.os.Looper.loop(Looper.java:317)
- at android.app.ActivityThread.main(ActivityThread.java:8929)
- at java.lang.reflect.Method.invoke(Native Method)
- at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591)
- at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911)
-2026-01-12 02:17:25.271 29031-29031 Process com.akslabs.circletosearch I Sending signal. PID: 29031 SIG: 9
----------------------------- PROCESS ENDED (29031) for package com.akslabs.circletosearch ----------------------------
-2026-01-12 02:17:25.288 1981-2383 InputDispatcher system_server E channel '3901bb2 com.akslabs.circletosearch' ~ Channel is unrecoverably broken and will be disposed!
----------------------------- PROCESS STARTED (29485) for package com.akslabs.circletosearch ----------------------------
-2026-01-12 02:17:30.578 29485-29485 nativeloader com.akslabs.circletosearch D
\ No newline at end of file