Skip to content

CircleToSearch with multi search engine support for all android

Kotlin

Enhance UI: Whole Screen scan button, dynamic colors, haptics, and actions

Karim ALI5e8d72b3ba2b
diff --git a/.idea/deploymentTargetSelector.xml b/.idea/deploymentTargetSelector.xml
index b268ef3..040e4af 100644
--- a/.idea/deploymentTargetSelector.xml
+++ b/.idea/deploymentTargetSelector.xml
@@ -4,6 +4,14 @@
<selectionStates>
<SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" />
+ <DropdownSelection timestamp="2026-03-10T09:36:20.254133900Z">
+ <Target type="DEFAULT_BOOT">
+ <handle>
+ <DeviceId pluginId="PhysicalDevice" identifier="serial=42281JEHN12134" />
+ </handle>
+ </Target>
+ </DropdownSelection>
+ <DialogSelection />
</SelectionState>
</selectionStates>
</component>
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 639c779..02c4aa5 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -6,7 +6,6 @@
<GradleProjectSettings>
<option name="testRunner" value="CHOOSE_PER_TEST" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
- <option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
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 fdd65d3..aeb49dd 100644
--- a/app/src/main/java/com/akslabs/circletosearch/ui/CircleToSearchScreen.kt
+++ b/app/src/main/java/com/akslabs/circletosearch/ui/CircleToSearchScreen.kt
@@ -38,8 +38,10 @@ import androidx.compose.foundation.Canvas
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.border
+import androidx.compose.foundation.clickable
import androidx.compose.foundation.gestures.detectDragGestures
import androidx.compose.foundation.gestures.detectTapGestures
+import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
@@ -73,6 +75,7 @@ import androidx.compose.material.icons.filled.ContentCopy
import androidx.compose.material.icons.filled.OpenInNew
import androidx.compose.material.icons.filled.BorderOuter
import androidx.compose.material.icons.filled.Translate
+import androidx.compose.material.icons.filled.Fullscreen
import androidx.compose.material3.BottomSheetDefaults
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
@@ -133,6 +136,10 @@ import androidx.webkit.WebViewFeature
import com.akslabs.circletosearch.data.isDirectUpload
import kotlin.math.max
import kotlin.math.min
+import androidx.compose.foundation.isSystemInDarkTheme
+import androidx.compose.material3.dynamicDarkColorScheme
+import androidx.compose.material3.dynamicLightColorScheme
+import android.os.Build
@OptIn(ExperimentalMaterial3Api::class)
@Composable
@@ -149,7 +156,22 @@ fun CircleToSearchScreen(
// Support Sheet State
var showSupportSheet by remember { mutableStateOf(false) }
val supportSheetState = rememberModalBottomSheetState()
-
+
+ // Material You logic for colors
+ val isDark = isSystemInDarkTheme()
+ val dynamicColor = Build.VERSION.SDK_INT >= Build.VERSION_CODES.S
+ val colorScheme = when {
+ dynamicColor && isDark -> dynamicDarkColorScheme(context)
+ dynamicColor && !isDark -> dynamicLightColorScheme(context)
+ else -> MaterialTheme.colorScheme // Fallback standard
+ }
+ //Colors for dark theme
+ val barBgColor = if (isDark) Color(0xFF0D0D0D) else colorScheme.surface
+ val bubbleColor = if (isDark) Color(0xFF1F1F1F) else colorScheme.secondaryContainer.copy(alpha = 0.9f)
+ val contentColor = if (isDark) Color.White else colorScheme.onSecondaryContainer
+
+ //Haptic feedback
+ val haptic = androidx.compose.ui.platform.LocalHapticFeedback.current
// Search Engines Order Logic
val preferredOrder = remember(uiPreferences.getSearchEngineOrder()) {
@@ -168,6 +190,7 @@ fun CircleToSearchScreen(
}
val searchEngines = preferredOrder
+
// Support Settings Sheet
var showSettingsScreen by remember { mutableStateOf(false) }
@@ -932,7 +955,11 @@ fun CircleToSearchScreen(
verticalAlignment = Alignment.CenterVertically
) {
IconButton(
- onClick = onClose,
+ onClick =
+ {
+ haptic.performHapticFeedback(androidx.compose.ui.hapticfeedback.HapticFeedbackType.LongPress)
+ onClose()
+ },
modifier = Modifier
.background(Color.Gray.copy(alpha = 0.5f), CircleShape)
.size(40.dp)
@@ -940,13 +967,24 @@ fun CircleToSearchScreen(
Icon(Icons.Default.Close, contentDescription = "Close", tint = Color.White)
}
Spacer(modifier = Modifier.weight(1f))
- Text(
- text = selectedEngine.name,
- style = MaterialTheme.typography.headlineMedium.copy(
- fontWeight = FontWeight.Bold,
- color = Color.White
+ if (selectedEngine.name == "Google") {
+ // Si c'est Google, on affiche ta belle typo officielle
+ Image(
+ painter = painterResource(id = com.akslabs.circletosearch.R.drawable.googletypo),
+ contentDescription = "Google Search",
+ modifier = Modifier.height(50.dp), // Hauteur ajustable selon ton PNG
+ colorFilter = androidx.compose.ui.graphics.ColorFilter.tint(Color.White)
)
- )
+ } else {
+ // Si c'est Bing, Yandex, etc., on garde le texte stylé d'origine
+ Text(
+ text = selectedEngine.name,
+ style = MaterialTheme.typography.headlineMedium.copy(
+ fontWeight = FontWeight.Bold,
+ color = Color.White
+ )
+ )
+ }
Spacer(modifier = Modifier.weight(1f))
// Action Button (Menu)
@@ -957,7 +995,10 @@ fun CircleToSearchScreen(
contentAlignment = Alignment.Center
) {
var showMenu by remember { mutableStateOf(false) }
- IconButton(onClick = { showMenu = true }) {
+ IconButton(onClick = {
+ haptic.performHapticFeedback(androidx.compose.ui.hapticfeedback.HapticFeedbackType.LongPress)
+ showMenu = true
+ }) {
Icon(Icons.Default.MoreVert, contentDescription = "Menu", tint = Color.White)
}
@@ -1062,91 +1103,110 @@ fun CircleToSearchScreen(
)
}
}
- } // 5. Search Bar / Pill (Bottom Fixed) - Clickable to open sheet
- Box(
+ } // 5. Search Bar / Pill (Bottom Fixed)
+ // 5. Search Bar / Pill (Bottom Fixed)
+ androidx.compose.material3.Surface(
modifier = Modifier
.align(Alignment.BottomCenter)
.navigationBarsPadding()
.fillMaxWidth()
.padding(horizontal = 16.dp, vertical = 24.dp)
- .shadow(8.dp, CircleShape)
- .background(Color(0xFF1F1F1F), CircleShape)
- .height(64.dp)
- .padding(horizontal = 20.dp)
- .pointerInput(Unit) {
- detectTapGestures {
- scope.launch {
- scaffoldState.bottomSheetState.expand()
- }
- }
- }
+ .height(64.dp),
+ shape = CircleShape,
+ color = barBgColor, // Utilise la couleur dynamique/pitch black
+ border = androidx.compose.foundation.BorderStroke(
+ width = 1.dp,
+ color = contentColor.copy(alpha = 0.1f) // Bordure subtile assortie
+ ),
+ shadowElevation = 12.dp
) {
Row(
- modifier = Modifier.align(Alignment.CenterStart),
- verticalAlignment = Alignment.CenterVertically
- ) {
- if (selectedBitmap != null) {
- Image(
- bitmap = selectedBitmap!!.asImageBitmap(),
- contentDescription = "Selected",
- contentScale = ContentScale.Crop,
- modifier = Modifier
- .size(40.dp)
- .clip(RoundedCornerShape(12.dp))
- .border(1.dp, Color.Gray, RoundedCornerShape(12.dp))
- )
- } else {
- // G Logo
- Row {
- Text("G", style = MaterialTheme.typography.headlineMedium.copy(fontWeight = FontWeight.Bold, color = Color(0xFF4285F4)))
- Text("o", style = MaterialTheme.typography.headlineMedium.copy(fontWeight = FontWeight.Bold, color = Color(0xFFEA4335)))
- Text("o", style = MaterialTheme.typography.headlineMedium.copy(fontWeight = FontWeight.Bold, color = Color(0xFFFBBC05)))
- Text("g", style = MaterialTheme.typography.headlineMedium.copy(fontWeight = FontWeight.Bold, color = Color(0xFF4285F4)))
- Text("l", style = MaterialTheme.typography.headlineMedium.copy(fontWeight = FontWeight.Bold, color = Color(0xFF34A853)))
- Text("e", style = MaterialTheme.typography.headlineMedium.copy(fontWeight = FontWeight.Bold, color = Color(0xFFEA4335)))
- }
- }
- }
-
- Row(
- modifier = Modifier.align(Alignment.CenterEnd),
+ modifier = Modifier
+ .fillMaxSize()
+ .padding(horizontal = 12.dp),
verticalAlignment = Alignment.CenterVertically
) {
+ // Left: App Logo
+ Image(
+ painter = painterResource(id = com.akslabs.circletosearch.R.drawable.circletosearch),
+ contentDescription = "Logo",
+ modifier = Modifier
+ .size(50.dp)
+ .clickable {
+ haptic.performHapticFeedback(androidx.compose.ui.hapticfeedback.HapticFeedbackType.LongPress)
+ scope.launch { scaffoldState.bottomSheetState.expand() }
+ }
+ )
- IconButton(onClick = {
- showSupportSheet = true
- }, modifier = Modifier.size(32.dp)) {
- Icon(
- painter = painterResource(id = com.akslabs.circletosearch.R.drawable.donation),
- contentDescription = "Donate",
- tint = Color.White,
- modifier = Modifier.size(22.dp)
- )
- }
- Spacer(modifier = Modifier.width(3.dp))
- IconButton(onClick = {
- val intent = android.content.Intent(android.content.Intent.ACTION_VIEW, android.net.Uri.parse("https://github.com/aks-labs"))
- context.startActivity(intent)
- }, modifier = Modifier.size(32.dp)) {
- Icon(
- painter = painterResource(id = com.akslabs.circletosearch.R.drawable.github),
- contentDescription = "Github",
- tint = Color.White,
- modifier = Modifier.size(23.dp)
- )
- }
+ Spacer(modifier = Modifier.weight(1f))
- Spacer(modifier = Modifier.width(3.dp))
- IconButton(onClick = {
- val intent = android.content.Intent(android.content.Intent.ACTION_VIEW, android.net.Uri.parse("https://t.me/akslabs"))
- context.startActivity(intent)
- }, modifier = Modifier.size(32.dp)) {
- Icon(
- painter = painterResource(id = com.akslabs.circletosearch.R.drawable.telegram),
- contentDescription = "Telegram",
- tint = Color.White,
- modifier = Modifier.size(23.dp)
- )
+ // Right: Actions Container
+ Row(
+ verticalAlignment = Alignment.CenterVertically,
+ horizontalArrangement = Arrangement.spacedBy(8.dp)
+ ) {
+ // Social/Contribution Bubble (Anthracite / Dynamic)
+ androidx.compose.material3.Surface(
+ shape = CircleShape,
+ color = bubbleColor, // Utilise l'anthracite ou le container dynamique
+ modifier = Modifier.height(44.dp)
+ ) {
+ Row(
+ verticalAlignment = Alignment.CenterVertically,
+ modifier = Modifier.padding(horizontal = 4.dp)
+ ) {
+ // Boutons sociaux - On utilise contentColor pour les icônes
+ val socialButtons = listOf(
+ com.akslabs.circletosearch.R.drawable.telegram to "https://t.me/akslabs",
+ com.akslabs.circletosearch.R.drawable.github to "https://github.com/aks-labs"
+ )
+
+ socialButtons.forEach { (iconRes, url) ->
+ IconButton(onClick = {
+ haptic.performHapticFeedback(androidx.compose.ui.hapticfeedback.HapticFeedbackType.LongPress)
+ context.startActivity(android.content.Intent(android.content.Intent.ACTION_VIEW, android.net.Uri.parse(url)))
+ }, modifier = Modifier.size(36.dp)) {
+ Icon(painterResource(id = iconRes), null, tint = contentColor, modifier = Modifier.size(20.dp))
+ }
+ }
+
+ IconButton(onClick = { showSupportSheet = true }, modifier = Modifier.size(36.dp)) {
+ Icon(painterResource(id = com.akslabs.circletosearch.R.drawable.donation), null, tint = contentColor, modifier = Modifier.size(20.dp))
+ }
+ }
+ }
+
+ // Fullscreen Scan Bubble (Anthracite / Dynamic)
+ androidx.compose.material3.Surface(
+ modifier = Modifier
+ .size(44.dp)
+ .clip(CircleShape)
+ .clickable {
+ haptic.performHapticFeedback(androidx.compose.ui.hapticfeedback.HapticFeedbackType.LongPress)
+ if (screenshot != null) {
+ val rect = Rect(0, 0, screenshot.width, screenshot.height)
+ selectionRect = rect
+ currentPathPoints.clear()
+ scope.launch {
+ selectionAnim.snapTo(0f)
+ selectionAnim.animateTo(1f, tween(600))
+ selectedBitmap = screenshot
+ isSearching = true
+ }
+ }
+ },
+ shape = CircleShape,
+ color = bubbleColor // Même couleur anthracite/dynamique
+ ) {
+ Box(contentAlignment = Alignment.Center) {
+ Icon(
+ imageVector = Icons.Default.Fullscreen,
+ contentDescription = "Scan All",
+ tint = contentColor, // Icone blanche en sombre, colorée en clair
+ modifier = Modifier.size(24.dp)
+ )
+ }
+ }
}
}
}
diff --git a/app/src/main/res/drawable/googlefavicon2025.png b/app/src/main/res/drawable/googlefavicon2025.png
new file mode 100644
index 0000000..6f82c05
Binary files /dev/null and b/app/src/main/res/drawable/googlefavicon2025.png differ
diff --git a/app/src/main/res/drawable/googletypo.png b/app/src/main/res/drawable/googletypo.png
new file mode 100644
index 0000000..9967a3c
Binary files /dev/null and b/app/src/main/res/drawable/googletypo.png differ
diff --git a/gradle/gradle-daemon-jvm.properties b/gradle/gradle-daemon-jvm.properties
new file mode 100644
index 0000000..fb965cc
--- /dev/null
+++ b/gradle/gradle-daemon-jvm.properties
@@ -0,0 +1,13 @@
+#This file is generated by updateDaemonJvm
+toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/29ee363f71d060405f729a8f1b7f7aef/redirect
+toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/67a0fee3c4236b6397dcbe8575ca2011/redirect
+toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/29ee363f71d060405f729a8f1b7f7aef/redirect
+toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/67a0fee3c4236b6397dcbe8575ca2011/redirect
+toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/10fc3bf1ee0001078a473afe6e43cfdb/redirect
+toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/658299a896470fbb3103ba3a430ee227/redirect
+toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/29ee363f71d060405f729a8f1b7f7aef/redirect
+toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/67a0fee3c4236b6397dcbe8575ca2011/redirect
+toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/23adb857f3cb3cbe28750bc7faa7abc0/redirect
+toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/932015f6361ccaead0c6d9b8717ed96e/redirect
+toolchainVendor=JETBRAINS
+toolchainVersion=21
diff --git a/settings.gradle.kts b/settings.gradle.kts
index f7505c3..b6d79a2 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -30,6 +30,9 @@ pluginManagement {
gradlePluginPortal()
}
}
+plugins {
+ id("org.gradle.toolchains.foojay-resolver-convention") version "0.10.0"
+}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {