CircleToSearch with multi search engine support for all android
Kotlin
feature: added settings screen with tab preferance options
AKS Labseb47c33f7c9c
diff --git a/app/src/main/java/com/akslabs/circletosearch/ui/CircleToSearchScreen.kt b/app/src/main/java/com/akslabs/circletosearch/ui/CircleToSearchScreen.ktindex c246b66..4e9dc2a 100644--- a/app/src/main/java/com/akslabs/circletosearch/ui/CircleToSearchScreen.kt+++ b/app/src/main/java/com/akslabs/circletosearch/ui/CircleToSearchScreen.kt@@ -61,6 +61,7 @@ import androidx.compose.material.icons.filled.Micimport androidx.compose.material.icons.filled.MoreVertimport androidx.compose.material.icons.filled.MusicNoteimport androidx.compose.material.icons.filled.Send+import androidx.compose.material.icons.filled.Settingsimport androidx.compose.material.icons.filled.Translateimport androidx.compose.material3.BottomSheetDefaultsimport androidx.compose.material3.ExperimentalMaterial3Api@@ -139,20 +140,39 @@ fun CircleToSearchScreen(val supportSheetState = rememberModalBottomSheetState()- // Search Engines Definition (Moved top for scope access)- val searchEngines = SearchEngine.values()+ // Search Engines Order Logic+ val preferredOrder = remember(uiPreferences.getSearchEngineOrder()) {+ val allEngines = SearchEngine.values()+ val orderString = uiPreferences.getSearchEngineOrder()+ if (orderString == null) allEngines+ else {+ val preferredNames = orderString.split(",")+ val ordered = mutableListOf<SearchEngine>()+ preferredNames.forEach { name ->+ allEngines.find { it.name == name }?.let { ordered.add(it) }+ }+ allEngines.forEach { if (!ordered.contains(it)) ordered.add(it) }+ ordered+ }+ }+ val searchEngines = preferredOrder++ // Support Settings Sheet+ var showSettingsScreen by remember { mutableStateOf(false) }// Friendly Message Statevar friendlyMessage by remember { mutableStateOf("") }var isMessageVisible by remember { mutableStateOf(false) }LaunchedEffect(Unit) {- val manager = FriendlyMessageManager(context)- friendlyMessage = manager.getNextMessage()- delay(500) // Small delay for smooth entrance- isMessageVisible = true- delay(4000) // Show for 4 seconds- isMessageVisible = false+ if (uiPreferences.isShowFriendlyMessages()) {+ val manager = FriendlyMessageManager(context)+ friendlyMessage = manager.getNextMessage()+ delay(500) // Small delay for smooth entrance+ isMessageVisible = true+ delay(4000) // Show for 4 seconds+ isMessageVisible = false+ }}// Search State@@ -897,87 +917,99 @@ fun CircleToSearchScreen()Spacer(modifier = Modifier.weight(1f))- // Menu- Box {- var showMenu by remember { mutableStateOf(false) }+ // Action Buttons (Settings & Menu)+ Row(verticalAlignment = Alignment.CenterVertically) {IconButton(- onClick = { showMenu = true },+ onClick = { showSettingsScreen = true },modifier = Modifier.background(Color.Gray.copy(alpha = 0.5f), CircleShape).size(40.dp)) {- Icon(Icons.Default.MoreVert, contentDescription = "Menu", tint = Color.White)+ Icon(Icons.Default.Settings, contentDescription = "Settings", tint = Color.White)}- androidx.compose.material3.DropdownMenu(- expanded = showMenu,- onDismissRequest = { showMenu = false }- ) {- androidx.compose.material3.DropdownMenuItem(- text = { Text(if (isDesktop(selectedEngine)) "Mobile Mode" else "Desktop Mode") },- onClick = {- val newSet = desktopModeEngines.toMutableSet()- if (newSet.contains(selectedEngine)) {- newSet.remove(selectedEngine)- } else {- newSet.add(selectedEngine)+ Spacer(modifier = Modifier.width(8.dp))++ // Menu+ Box {+ var showMenu by remember { mutableStateOf(false) }+ IconButton(+ onClick = { showMenu = true },+ modifier = Modifier+ .background(Color.Gray.copy(alpha = 0.5f), CircleShape)+ .size(40.dp)+ ) {+ Icon(Icons.Default.MoreVert, contentDescription = "Menu", tint = Color.White)+ }++ androidx.compose.material3.DropdownMenu(+ expanded = showMenu,+ onDismissRequest = { showMenu = false }+ ) {+ androidx.compose.material3.DropdownMenuItem(+ text = { Text(if (isDesktop(selectedEngine)) "Mobile Mode" else "Desktop Mode") },+ onClick = {+ val newSet = desktopModeEngines.toMutableSet()+ if (newSet.contains(selectedEngine)) {+ newSet.remove(selectedEngine)+ } else {+ newSet.add(selectedEngine)+ }+ desktopModeEngines = newSet+ showMenu = false}- desktopModeEngines = newSet- showMenu = false- }- )- androidx.compose.material3.DropdownMenuItem(- text = { Text(if (isDarkMode) "Light Mode" else "Dark Mode") },- onClick = {- isDarkMode = !isDarkMode- showMenu = false- }- )- androidx.compose.material3.DropdownMenuItem(- text = { Text(if (showGradientBorder) "Hide Border" else "Show Border") },- onClick = {- showGradientBorder = !showGradientBorder- showMenu = false- }- )- androidx.compose.material3.DropdownMenuItem(- text = { Text("Refresh") },- onClick = {- webViews[selectedEngine]?.reload()- showMenu = false- }- )- androidx.compose.material3.DropdownMenuItem(- text = { Text("Copy URL") },- onClick = {- if (searchUrl != null) {- val clipboard = context.getSystemService(android.content.Context.CLIPBOARD_SERVICE) as android.content.ClipboardManager- val clip = android.content.ClipData.newPlainText("Search URL", searchUrl)- clipboard.setPrimaryClip(clip)+ )+ androidx.compose.material3.DropdownMenuItem(+ text = { Text(if (isDarkMode) "Light Mode" else "Dark Mode") },+ onClick = {+ isDarkMode = !isDarkMode+ showMenu = false}- showMenu = false- }- )- androidx.compose.material3.DropdownMenuItem(- text = { Text("Open in Browser") },- onClick = {- val currentUrl = webViews[selectedEngine]?.url ?: searchUrl- if (currentUrl != null) {- try {- val intent = android.content.Intent(android.content.Intent.ACTION_VIEW, android.net.Uri.parse(currentUrl))- context.startActivity(intent)- } catch (e: Exception) {- android.util.Log.e("CircleToSearch", "Failed to open browser", e)+ )+ androidx.compose.material3.DropdownMenuItem(+ text = { Text(if (showGradientBorder) "Hide Border" else "Show Border") },+ onClick = {+ showGradientBorder = !showGradientBorder+ showMenu = false+ }+ )+ androidx.compose.material3.DropdownMenuItem(+ text = { Text("Refresh") },+ onClick = {+ webViews[selectedEngine]?.reload()+ showMenu = false+ }+ )+ androidx.compose.material3.DropdownMenuItem(+ text = { Text("Copy URL") },+ onClick = {+ if (searchUrl != null) {+ val clipboard = context.getSystemService(android.content.Context.CLIPBOARD_SERVICE) as android.content.ClipboardManager+ val clip = android.content.ClipData.newPlainText("Search URL", searchUrl)+ clipboard.setPrimaryClip(clip)}+ showMenu = false}- showMenu = false- }- )+ )+ androidx.compose.material3.DropdownMenuItem(+ text = { Text("Open in Browser") },+ onClick = {+ val currentUrl = webViews[selectedEngine]?.url ?: searchUrl+ if (currentUrl != null) {+ try {+ val intent = android.content.Intent(android.content.Intent.ACTION_VIEW, android.net.Uri.parse(currentUrl))+ context.startActivity(intent)+ } catch (e: Exception) {+ android.util.Log.e("CircleToSearch", "Failed to open browser", e)+ }+ }+ showMenu = false+ }+ )+ }}}- }-- // 5. Search Bar / Pill (Bottom Fixed) - Clickable to open sheet+ } // 5. Search Bar / Pill (Bottom Fixed) - Clickable to open sheetBox(modifier = Modifier.align(Alignment.BottomCenter)@@ -1081,6 +1113,13 @@ fun CircleToSearchScreen()}+ if (showSettingsScreen) {+ SettingsScreen(+ uiPreferences = uiPreferences,+ onDismissRequest = { showSettingsScreen = false }+ )+ }+}}}diff --git a/app/src/main/java/com/akslabs/circletosearch/ui/SettingsScreen.kt b/app/src/main/java/com/akslabs/circletosearch/ui/SettingsScreen.ktnew file mode 100644index 0000000..b443141--- /dev/null+++ b/app/src/main/java/com/akslabs/circletosearch/ui/SettingsScreen.kt@@ -0,0 +1,277 @@+/*+ *+ * * Copyright (C) 2025 AKS-Labs (original author)+ * *+ * * This program is free software: you can redistribute it and/or modify+ * * it under the terms of the GNU General Public License as published by+ * * the Free Software Foundation, either version 3 of the License, or+ * * (at your option) any later version.+ * *+ * * This program is distributed in the hope that it will be useful,+ * * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * * GNU General Public License for more details.+ * *+ * * You should have received a copy of the GNU General Public License+ * * along with this program. If not, see <https://www.gnu.org/licenses/>.+ *+ */++package com.akslabs.circletosearch.ui++import androidx.compose.foundation.background+import androidx.compose.foundation.clickable+import androidx.compose.foundation.layout.*+import androidx.compose.foundation.lazy.LazyColumn+import androidx.compose.foundation.lazy.itemsIndexed+import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.material.icons.Icons+import androidx.compose.material.icons.filled.*+import androidx.compose.material3.*+import androidx.compose.runtime.*+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.draw.clip+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.graphics.vector.ImageVector+import androidx.compose.ui.text.font.FontWeight+import androidx.compose.ui.unit.dp+import androidx.compose.ui.unit.sp+import com.akslabs.circletosearch.data.SearchEngine+import com.akslabs.circletosearch.utils.UIPreferences++@OptIn(ExperimentalMaterial3Api::class)+@Composable+fun SettingsScreen(+ uiPreferences: UIPreferences,+ onDismissRequest: () -> Unit+) {+ val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true)++ var showFriendlyMessages by remember { mutableStateOf(uiPreferences.isShowFriendlyMessages()) }+ val initialOrderString = uiPreferences.getSearchEngineOrder()+ val allEngines = SearchEngine.values()++ // Parse order from preferences or use default+ val engineOrder = remember {+ val preferredNames = initialOrderString?.split(",") ?: emptyList()+ val ordered = mutableListOf<SearchEngine>()++ // Add existing engines in preferred order+ preferredNames.forEach { name ->+ allEngines.find { it.name == name }?.let { ordered.add(it) }+ }++ // Add any remaining engines+ allEngines.forEach { engine ->+ if (!ordered.contains(engine)) ordered.add(engine)+ }+ mutableStateListOf(*ordered.toTypedArray())+ }++ LaunchedEffect(showFriendlyMessages) {+ uiPreferences.setShowFriendlyMessages(showFriendlyMessages)+ }++ LaunchedEffect(engineOrder.toList()) {+ uiPreferences.setSearchEngineOrder(engineOrder.joinToString(",") { it.name })+ }++ ModalBottomSheet(+ onDismissRequest = onDismissRequest,+ sheetState = sheetState,+ containerColor = MaterialTheme.colorScheme.surface,+ dragHandle = { BottomSheetDefaults.DragHandle() }+ ) {+ Column(+ modifier = Modifier+ .fillMaxWidth()+ .padding(horizontal = 24.dp)+ .padding(bottom = 32.dp)+ ) {+ Text(+ text = "Settings",+ style = MaterialTheme.typography.headlineMedium.copy(+ fontWeight = FontWeight.ExtraBold,+ letterSpacing = (-0.5).sp+ ),+ color = MaterialTheme.colorScheme.onSurface+ )++ Spacer(modifier = Modifier.height(24.dp))++ // General Section+ SettingsSectionHeader(title = "General")++ SettingsToggleItem(+ title = "Friendly Messages",+ subtitle = "Show random greeting messages on trigger",+ icon = Icons.Default.ChatBubbleOutline,+ checked = showFriendlyMessages,+ onCheckedChange = { showFriendlyMessages = it }+ )++ Spacer(modifier = Modifier.height(24.dp))++ // Search Engines Section+ SettingsSectionHeader(title = "Search Engines")+ Text(+ text = "Tap arrows to change tab sequence",+ style = MaterialTheme.typography.labelMedium,+ color = MaterialTheme.colorScheme.onSurfaceVariant,+ modifier = Modifier.padding(bottom = 8.dp)+ )++ Surface(+ modifier = Modifier+ .fillMaxWidth()+ .clip(RoundedCornerShape(24.dp)),+ color = MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.3f)+ ) {+ Column {+ engineOrder.forEachIndexed { index, engine ->+ EngineOrderItem(+ engine = engine,+ isFirst = index == 0,+ isLast = index == engineOrder.size - 1,+ onMoveUp = {+ if (index > 0) {+ val temp = engineOrder[index]+ engineOrder[index] = engineOrder[index - 1]+ engineOrder[index - 1] = temp+ }+ },+ onMoveDown = {+ if (index < engineOrder.size - 1) {+ val temp = engineOrder[index]+ engineOrder[index] = engineOrder[index + 1]+ engineOrder[index + 1] = temp+ }+ }+ )+ if (index < engineOrder.size - 1) {+ HorizontalDivider(+ modifier = Modifier.padding(horizontal = 16.dp),+ thickness = 0.5.dp,+ color = MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.1f)+ )+ }+ }+ }+ }+ }+ }+}++@Composable+fun SettingsSectionHeader(title: String) {+ Text(+ text = title.uppercase(),+ style = MaterialTheme.typography.labelLarge.copy(+ fontWeight = FontWeight.Bold,+ letterSpacing = 1.sp+ ),+ color = MaterialTheme.colorScheme.primary,+ modifier = Modifier.padding(bottom = 12.dp)+ )+}++@Composable+fun SettingsToggleItem(+ title: String,+ subtitle: String,+ icon: ImageVector,+ checked: Boolean,+ onCheckedChange: (Boolean) -> Unit+) {+ Row(+ modifier = Modifier+ .fillMaxWidth()+ .clip(RoundedCornerShape(20.dp))+ .clickable { onCheckedChange(!checked) }+ .padding(vertical = 12.dp),+ verticalAlignment = Alignment.CenterVertically+ ) {+ Surface(+ modifier = Modifier.size(48.dp),+ shape = RoundedCornerShape(14.dp),+ color = MaterialTheme.colorScheme.primaryContainer.copy(alpha = 0.4f)+ ) {+ Icon(+ imageVector = icon,+ contentDescription = null,+ modifier = Modifier+ .padding(12.dp)+ .size(24.dp),+ tint = MaterialTheme.colorScheme.onPrimaryContainer+ )+ }++ Spacer(modifier = Modifier.width(16.dp))++ Column(modifier = Modifier.weight(1f)) {+ Text(+ text = title,+ style = MaterialTheme.typography.titleMedium.copy(fontWeight = FontWeight.Bold)+ )+ Text(+ text = subtitle,+ style = MaterialTheme.typography.bodySmall,+ color = MaterialTheme.colorScheme.onSurfaceVariant+ )+ }++ Switch(+ checked = checked,+ onCheckedChange = onCheckedChange,+ colors = SwitchDefaults.colors(+ checkedThumbColor = MaterialTheme.colorScheme.primary,+ checkedTrackColor = MaterialTheme.colorScheme.primaryContainer+ )+ )+ }+}++@Composable+fun EngineOrderItem(+ engine: SearchEngine,+ isFirst: Boolean,+ isLast: Boolean,+ onMoveUp: () -> Unit,+ onMoveDown: () -> Unit+) {+ Row(+ modifier = Modifier+ .fillMaxWidth()+ .padding(16.dp),+ verticalAlignment = Alignment.CenterVertically+ ) {+ Text(+ text = engine.displayName,+ style = MaterialTheme.typography.bodyLarge.copy(fontWeight = FontWeight.Medium),+ modifier = Modifier.weight(1f)+ )++ IconButton(+ onClick = onMoveUp,+ enabled = !isFirst+ ) {+ Icon(+ Icons.Default.KeyboardArrowUp,+ contentDescription = "Move Up",+ tint = if (!isFirst) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.3f)+ )+ }++ IconButton(+ onClick = onMoveDown,+ enabled = !isLast+ ) {+ Icon(+ Icons.Default.KeyboardArrowDown,+ contentDescription = "Move Down",+ tint = if (!isLast) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.3f)+ )+ }+ }+}diff --git a/app/src/main/java/com/akslabs/circletosearch/ui/components/GoogleLensHelper.kt b/app/src/main/java/com/akslabs/circletosearch/ui/components/GoogleLensHelper.ktnew file mode 100644index 0000000..7e63f11--- /dev/null+++ b/app/src/main/java/com/akslabs/circletosearch/ui/components/GoogleLensHelper.kt@@ -0,0 +1,203 @@+package com.akslabs.circletosearch.ui.components++import android.content.Context+import android.content.Intent+import android.net.Uri+import android.os.Build+import android.os.VibrationEffect+import android.os.Vibrator+import android.os.VibratorManager+import android.util.Log+import android.widget.Toast+import androidx.core.content.FileProvider+import java.io.File++//searchWithGoogleLens(mediaItem.uri, context)++/**+ * Helper class for Google Lens integration+ */+private const val TAG = "GoogleLensHelper"++/**+ * Launch Google Lens with the given image URI+ *+ * @param uri The URI of the image to search with Google Lens+ * @param context The context to use for launching the intent+ * @return True if Google Lens was launched successfully, false otherwise+ */+fun searchWithGoogleLens(uri: Uri, context: Context): Boolean {+ Log.d(TAG, "Launching Google Lens with URI: $uri")++ try {+ // Get the content URI using FileProvider if needed+ val contentUri = if (uri.scheme == "content") {+ uri+ } else {+ try {+ val file = File(uri.path ?: return false)+ if (!file.exists()) {+ Log.e(TAG, "Image file does not exist: ${file.absolutePath}")+ Toast.makeText(context, "Image file not found", Toast.LENGTH_SHORT).show()+ return false+ }++ FileProvider.getUriForFile(+ context,+ "com.aks_labs.tulsi.fileprovider",+ file+ )+ } catch (e: Exception) {+ Log.e(TAG, "Error creating content URI: ${e.message}")+ Toast.makeText(context, "Error preparing image for Google Lens", Toast.LENGTH_SHORT).show()+ return false+ }+ }++ Log.d(TAG, "Content URI: $contentUri")++ // Try different approaches to launch Google Lens+ var success = false++ // Approach 1: Use Google Lens directly with ACTION_SEND+ try {+ val lensIntent = Intent(Intent.ACTION_SEND).apply {+ type = "image/*"+ putExtra(Intent.EXTRA_STREAM, contentUri)+ setPackage("com.google.android.googlequicksearchbox")+ addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)+ addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)+ }++ context.startActivity(lensIntent)+ vibrateDevice(context) // Provide haptic feedback+ Log.d(TAG, "Google Lens launched with ACTION_SEND")+ success = true+ } catch (e: Exception) {+ Log.e(TAG, "Failed to launch Google Lens with ACTION_SEND: ${e.message}")+ }++ // Approach 2: Use Google Gallery with ACTION_SEND+ if (!success) {+ try {+ val GalleryIntent = Intent(Intent.ACTION_SEND).apply {+ type = "image/*"+ putExtra(Intent.EXTRA_STREAM, contentUri)+ setPackage("com.google.android.apps.Gallery")+ putExtra("lens", true) // Hint to open in Lens mode+ addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)+ addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)+ }++ context.startActivity(GalleryIntent)+ vibrateDevice(context) // Provide haptic feedback+ Log.d(TAG, "Google Gallery launched with ACTION_SEND")+ success = true+ } catch (e: Exception) {+ Log.e(TAG, "Failed to launch Google Gallery: ${e.message}")+ }+ }++ // Approach 3: Use a chooser with ACTION_SEND+ if (!success) {+ try {+ val sendIntent = Intent(Intent.ACTION_SEND).apply {+ type = "image/*"+ putExtra(Intent.EXTRA_STREAM, contentUri)+ addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)+ }++ val chooser = Intent.createChooser(sendIntent, "Search with Google Lens")+ chooser.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)++ context.startActivity(chooser)+ vibrateDevice(context) // Provide haptic feedback+ Log.d(TAG, "Chooser launched with ACTION_SEND")+ success = true+ } catch (e: Exception) {+ Log.e(TAG, "Failed to launch chooser: ${e.message}")+ }+ }++ // Approach 4: Use Google app with ACTION_VIEW+ if (!success) {+ try {+ val googleIntent = Intent(Intent.ACTION_VIEW).apply {+ setPackage("com.google.android.googlequicksearchbox")+ data = contentUri+ addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)+ addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)+ }++ context.startActivity(googleIntent)+ vibrateDevice(context) // Provide haptic feedback+ Log.d(TAG, "Google app launched with ACTION_VIEW")+ success = true+ } catch (e: Exception) {+ Log.e(TAG, "Failed to launch Google app with ACTION_VIEW: ${e.message}")+ }+ }++ // Approach 5: Use web browser with lens.google.com+ if (!success) {+ try {+ val webIntent = Intent(Intent.ACTION_VIEW, Uri.parse("https://lens.google.com")).apply {+ addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)+ }++ context.startActivity(webIntent)+ vibrateDevice(context) // Provide haptic feedback++ Toast.makeText(+ context,+ "Opening Google Lens website as fallback",+ Toast.LENGTH_SHORT+ ).show()++ Log.d(TAG, "Web Google Lens launched")+ success = true+ } catch (e: Exception) {+ Log.e(TAG, "Failed to launch web Google Lens: ${e.message}")+ }+ }++ // If all approaches failed+ if (!success) {+ Toast.makeText(context, "Google Lens is not available on this device", Toast.LENGTH_SHORT).show()+ Log.e(TAG, "Google Lens not available - all approaches failed")+ return false+ }++ return true+ } catch (e: Exception) {+ Log.e(TAG, "Error launching Google Lens", e)+ Toast.makeText(context, "Error launching Google Lens", Toast.LENGTH_SHORT).show()+ return false+ }+}++/**+ * Vibrates the device to provide haptic feedback+ */+private fun vibrateDevice(context: Context) {+ try {+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { // Android 12++ val vibratorManager = context.getSystemService(Context.VIBRATOR_MANAGER_SERVICE) as VibratorManager+ val vibrator = vibratorManager.defaultVibrator+ vibrator.vibrate(VibrationEffect.createOneShot(50, VibrationEffect.DEFAULT_AMPLITUDE))+ } else {+ @Suppress("DEPRECATION")+ val vibrator = context.getSystemService(Context.VIBRATOR_SERVICE) as Vibrator+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { // Android 8.0++ vibrator.vibrate(VibrationEffect.createOneShot(50, VibrationEffect.DEFAULT_AMPLITUDE))+ } else {+ @Suppress("DEPRECATION")+ vibrator.vibrate(50)+ }+ }+ } catch (e: Exception) {+ Log.e(TAG, "Error vibrating device", e)+ }+}++diff --git a/app/src/main/java/com/akslabs/circletosearch/utils/UIPreferences.kt b/app/src/main/java/com/akslabs/circletosearch/utils/UIPreferences.ktindex 8154edc..06a9f74 100644--- a/app/src/main/java/com/akslabs/circletosearch/utils/UIPreferences.kt+++ b/app/src/main/java/com/akslabs/circletosearch/utils/UIPreferences.kt@@ -29,6 +29,8 @@ class UIPreferences(context: Context) {private const val KEY_DESKTOP_MODE = "is_desktop_mode"private const val KEY_DARK_MODE = "is_dark_mode"private const val KEY_SHOW_GRADIENT_BORDER = "show_gradient_border"+ private const val KEY_SHOW_FRIENDLY_MESSAGES = "show_friendly_messages"+ private const val KEY_SEARCH_ENGINE_ORDER = "search_engine_order"}fun isDesktopMode(): Boolean {@@ -54,4 +56,20 @@ class UIPreferences(context: Context) {fun setShowGradientBorder(isEnabled: Boolean) {prefs.edit().putBoolean(KEY_SHOW_GRADIENT_BORDER, isEnabled).apply()}++ fun isShowFriendlyMessages(): Boolean {+ return prefs.getBoolean(KEY_SHOW_FRIENDLY_MESSAGES, true)+ }++ fun setShowFriendlyMessages(isEnabled: Boolean) {+ prefs.edit().putBoolean(KEY_SHOW_FRIENDLY_MESSAGES, isEnabled).apply()+ }++ fun getSearchEngineOrder(): String? {+ return prefs.getString(KEY_SEARCH_ENGINE_ORDER, null)+ }++ fun setSearchEngineOrder(order: String) {+ prefs.edit().putString(KEY_SEARCH_ENGINE_ORDER, order).apply()+ }}diff --git a/builderors.md b/builderors.mdindex 46d5b76..e69de29 100644--- a/builderors.md+++ b/builderors.md@@ -1,80 +0,0 @@-e: file:///C:/Users/ashin/AndroidStudioProjects/CircleToSearch/app/src/main/java/com/akslabs/circletosearch/ui/CircleToSearchScreen.kt:163:31 Cannot infer type for this parameter. Please specify it explicitly.-Fix with AI--e: file:///C:/Users/ashin/AndroidStudioProjects/CircleToSearch/app/src/main/java/com/akslabs/circletosearch/ui/CircleToSearchScreen.kt:163:31 Not enough information to infer type argument for 'T'.-Fix with AI--e: file:///C:/Users/ashin/AndroidStudioProjects/CircleToSearch/app/src/main/java/com/akslabs/circletosearch/ui/CircleToSearchScreen.kt:163:31 Cannot infer type for this parameter. Please specify it explicitly.-Fix with AI--e: file:///C:/Users/ashin/AndroidStudioProjects/CircleToSearch/app/src/main/java/com/akslabs/circletosearch/ui/CircleToSearchScreen.kt:163:31 Not enough information to infer type argument for 'T'.-Fix with AI--e: file:///C:/Users/ashin/AndroidStudioProjects/CircleToSearch/app/src/main/java/com/akslabs/circletosearch/ui/CircleToSearchScreen.kt:163:40 Cannot infer type for this parameter. Please specify it explicitly.-Fix with AI--e: file:///C:/Users/ashin/AndroidStudioProjects/CircleToSearch/app/src/main/java/com/akslabs/circletosearch/ui/CircleToSearchScreen.kt:163:42 Cannot infer type for this parameter. Please specify it explicitly.-Fix with AI--e: file:///C:/Users/ashin/AndroidStudioProjects/CircleToSearch/app/src/main/java/com/akslabs/circletosearch/ui/CircleToSearchScreen.kt:163:42 Not enough information to infer type argument for 'T'.-Fix with AI--e: file:///C:/Users/ashin/AndroidStudioProjects/CircleToSearch/app/src/main/java/com/akslabs/circletosearch/ui/CircleToSearchScreen.kt:163:57 Not enough information to infer type argument for 'K'.-Fix with AI--e: file:///C:/Users/ashin/AndroidStudioProjects/CircleToSearch/app/src/main/java/com/akslabs/circletosearch/ui/CircleToSearchScreen.kt:163:80 Unresolved reference 'searchEngines'.-Fix with AI--e: file:///C:/Users/ashin/AndroidStudioProjects/CircleToSearch/app/src/main/java/com/akslabs/circletosearch/ui/CircleToSearchScreen.kt:163:107 Cannot infer type for this parameter. Please specify it explicitly.-Fix with AI--e: file:///C:/Users/ashin/AndroidStudioProjects/CircleToSearch/app/src/main/java/com/akslabs/circletosearch/ui/CircleToSearchScreen.kt:163:107 Not enough information to infer type argument for 'T'.-Fix with AI--e: file:///C:/Users/ashin/AndroidStudioProjects/CircleToSearch/app/src/main/java/com/akslabs/circletosearch/ui/CircleToSearchScreen.kt:176:62 Overload resolution ambiguity between candidates:-fun <T> Array<out T>.contains(element: T): Boolean-fun <T> Iterable<T>.contains(element: T): Boolean-fun <K, V> Map<out K, V>.contains(key: K): Boolean-fun <T : Any, R : ClosedRange<T>, Iterable<T>> R.contains(element: T?): Boolean-fun <T : Any, R : OpenEndRange<T>, Iterable<T>> R.contains(element: T?): Boolean-fun <T> Sequence<T>.contains(element: T): Boolean-Fix with AI--e: file:///C:/Users/ashin/AndroidStudioProjects/CircleToSearch/app/src/main/java/com/akslabs/circletosearch/ui/CircleToSearchScreen.kt:201:49 Overload resolution ambiguity between candidates:-fun <T> Array<out T>.contains(element: T): Boolean-fun <T> Iterable<T>.contains(element: T): Boolean-fun <K, V> Map<out K, V>.contains(key: K): Boolean-fun <T : Any, R : ClosedRange<T>, Iterable<T>> R.contains(element: T?): Boolean-fun <T : Any, R : OpenEndRange<T>, Iterable<T>> R.contains(element: T?): Boolean-fun <T> Sequence<T>.contains(element: T): Boolean-Fix with AI--e: file:///C:/Users/ashin/AndroidStudioProjects/CircleToSearch/app/src/main/java/com/akslabs/circletosearch/ui/CircleToSearchScreen.kt:914:65 Overload resolution ambiguity between candidates:-fun <T> Array<out T>.toMutableSet(): MutableSet<T>-fun BooleanArray.toMutableSet(): MutableSet<Boolean>-fun ByteArray.toMutableSet(): MutableSet<Byte>-fun CharArray.toMutableSet(): MutableSet<Char>-fun DoubleArray.toMutableSet(): MutableSet<Double>-fun FloatArray.toMutableSet(): MutableSet<Float>-fun IntArray.toMutableSet(): MutableSet<Int>-fun LongArray.toMutableSet(): MutableSet<Long>-fun ShortArray.toMutableSet(): MutableSet<Short>-fun <T> Iterable<T>.toMutableSet(): MutableSet<T>-fun <T> Sequence<T>.toMutableSet(): MutableSet<T>-Fix with AI--e: file:///C:/Users/ashin/AndroidStudioProjects/CircleToSearch/app/src/main/java/com/akslabs/circletosearch/ui/CircleToSearchScreen.kt:915:44 Overload resolution ambiguity between candidates:-fun <T> Array<out T>.contains(element: T): Boolean-fun <T> Iterable<T>.contains(element: T): Boolean-fun <K, V> Map<out K, V>.contains(key: K): Boolean-fun <T> Sequence<T>.contains(element: T): Boolean-Fix with AI--e: file:///C:/Users/ashin/AndroidStudioProjects/CircleToSearch/app/src/main/java/com/akslabs/circletosearch/ui/CircleToSearchScreen.kt:916:44 Overload resolution ambiguity between candidates:-fun <T> MutableCollection<out T>.remove(element: T): Boolean-fun <K, V> MutableMap<out K, V>.remove(key: K): V?-Fix with AI--e: file:///C:/Users/ashin/AndroidStudioProjects/CircleToSearch/app/src/main/java/com/akslabs/circletosearch/ui/CircleToSearchScreen.kt:918:44 Unresolved reference 'add'.-Fix with AI-