CircleToSearch with multi search engine support for all android
Kotlin
added donate and more apps bottom sheet
AKS Labsfaf6fe7bfc4f
diff --git a/app/src/main/java/com/akslabs/circletosearch/ui/CircleToSearchScreen.kt b/app/src/main/java/com/akslabs/circletosearch/ui/CircleToSearchScreen.ktindex 2fe9380..a5eff02 100644--- a/app/src/main/java/com/akslabs/circletosearch/ui/CircleToSearchScreen.kt+++ b/app/src/main/java/com/akslabs/circletosearch/ui/CircleToSearchScreen.kt@@ -158,6 +158,9 @@ import com.akslabs.circletosearch.utils.QrResultWithBoundsimport com.akslabs.circletosearch.utils.QrScannerimport com.akslabs.circletosearch.ui.qrResultShortLabelimport com.akslabs.circletosearch.utils.UIPreferences+import com.akslabs.circletosearch.ui.components.MoreAppsBottomSheet+import com.akslabs.circletosearch.ui.components.DonateBottomSheet+import android.net.Uriimport kotlinx.coroutines.delayimport kotlinx.coroutines.Dispatchersimport kotlinx.coroutines.launch@@ -171,6 +174,7 @@ import androidx.compose.foundation.isSystemInDarkThemeimport androidx.compose.material3.dynamicDarkColorSchemeimport androidx.compose.material3.dynamicLightColorSchemeimport android.os.Build+import androidx.compose.material.icons.filled.Appsimport androidx.compose.material3.Surface@OptIn(ExperimentalMaterial3Api::class)@@ -188,9 +192,10 @@ fun CircleToSearchScreen(// Initialize preferencesval uiPreferences = remember { UIPreferences(context) }- // Support Sheet State- var showSupportSheet by remember { mutableStateOf(false) }- val supportSheetState = rememberModalBottomSheetState()++ // New Sheet States+ var showMoreAppsSheet by remember { mutableStateOf(false) }+ var showDonateSheet by remember { mutableStateOf(false) }// Material You logic for colorsval isDark = isSystemInDarkTheme()@@ -1485,26 +1490,9 @@ fun CircleToSearchScreen(}}- // Share- BottomBarButton("Share", { Icon(Icons.Default.Send, null) }) {- if (screenshot != null) {- scope.launch {- try {- val fileName = "share_${java.util.UUID.randomUUID()}.png"- val path = ImageUtils.saveBitmap(context, selectedBitmap ?: screenshot, fileName)- val file = java.io.File(path)- val uri = androidx.core.content.FileProvider.getUriForFile(context, "com.akslabs.circletosearch.fileprovider", file)- val shareIntent = android.content.Intent(android.content.Intent.ACTION_SEND).apply {- type = "image/png"- putExtra(android.content.Intent.EXTRA_STREAM, uri)- clipData = android.content.ClipData.newRawUri("Selection", uri)- addFlags(android.content.Intent.FLAG_GRANT_READ_URI_PERMISSION)- addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK)- }- context.startActivity(android.content.Intent.createChooser(shareIntent, "Share Image").apply { addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK) })- } catch (e: Exception) {}- }- }+ // More Apps+ BottomBarButton("More Apps", { Icon(Icons.Default.Apps, null) }) {+ showMoreAppsSheet = true}// Pin@@ -1593,7 +1581,7 @@ fun CircleToSearchScreen(// DonateBottomBarButton("Donate", { Icon(painterResource(id = com.akslabs.circletosearch.R.drawable.donation), null, modifier = Modifier.size(22.dp)) }) {- showSupportSheet = true+ showDonateSheet = true}// Copy Text@@ -1985,17 +1973,26 @@ fun CircleToSearchScreen(}}- if (showSupportSheet) {- com.akslabs.circletosearch.SupportSheet(- sheetState = supportSheetState,- onDismissRequest = {- scope.launch {- supportSheetState.hide()- }.invokeOnCompletion {- if (!supportSheetState.isVisible) {- showSupportSheet = false- }- }+ if (showMoreAppsSheet) {+ MoreAppsBottomSheet(+ onDismiss = { showMoreAppsSheet = false },+ onAppSelected = { url ->+ try {+ context.startActivity(android.content.Intent(android.content.Intent.ACTION_VIEW, Uri.parse(url)).apply { addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK) })+ } catch (e: Exception) {}+ showMoreAppsSheet = false+ }+ )+ }++ if (showDonateSheet) {+ DonateBottomSheet(+ onDismiss = { showDonateSheet = false },+ onDonateOptionSelected = { url ->+ try {+ context.startActivity(android.content.Intent(android.content.Intent.ACTION_VIEW, Uri.parse(url)).apply { addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK) })+ } catch (e: Exception) {}+ showDonateSheet = false})}diff --git a/app/src/main/java/com/akslabs/circletosearch/ui/components/BottomSheets.kt b/app/src/main/java/com/akslabs/circletosearch/ui/components/BottomSheets.ktnew file mode 100644index 0000000..08d40ab--- /dev/null+++ b/app/src/main/java/com/akslabs/circletosearch/ui/components/BottomSheets.kt@@ -0,0 +1,484 @@+/*+ *+ * * 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.components++/*+ * 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/>.+ */++import androidx.compose.animation.*+import androidx.compose.animation.core.*+import androidx.compose.foundation.Image+import androidx.compose.foundation.background+import androidx.compose.foundation.interaction.MutableInteractionSource+import androidx.compose.foundation.interaction.collectIsPressedAsState+import androidx.compose.foundation.layout.*+import androidx.compose.foundation.shape.CircleShape+import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.material.icons.Icons+import androidx.compose.material.icons.filled.*+import androidx.compose.material.icons.outlined.*+import androidx.compose.material3.*+import androidx.compose.runtime.*+import androidx.compose.runtime.getValue+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.graphics.Brush+import androidx.compose.ui.graphics.graphicsLayer+import androidx.compose.ui.graphics.vector.ImageVector+import androidx.compose.ui.res.painterResource+import androidx.compose.ui.text.font.FontWeight+import androidx.compose.ui.text.style.TextAlign+import androidx.compose.ui.platform.LocalClipboardManager+import androidx.compose.ui.text.AnnotatedString+import androidx.compose.ui.unit.dp+import androidx.compose.ui.unit.sp+import com.akslabs.circletosearch.R+++/*+ * 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/>.+ */+++@Composable+fun FeedbackChannelOption(+ icon: ImageVector? = null,+ painter: androidx.compose.ui.graphics.painter.Painter? = null,+ title: String,+ subtitle: String,+ onClick: () -> Unit+) {+ val interactionSource = remember { MutableInteractionSource() }+ val isPressed by interactionSource.collectIsPressedAsState()++ val scale by animateFloatAsState(+ targetValue = if (isPressed) 0.98f else 1f,+ animationSpec = spring(dampingRatio = Spring.DampingRatioLowBouncy, stiffness = Spring.StiffnessLow)+ )++ Surface(+ onClick = onClick,+ interactionSource = interactionSource,+ shape = RoundedCornerShape(16.dp),+ color = MaterialTheme.colorScheme.surfaceContainerHigh,+ modifier = Modifier+ .fillMaxWidth()+ .graphicsLayer {+ scaleX = scale+ scaleY = scale+ }+ ) {+ Row(+ modifier = Modifier.padding(16.dp),+ verticalAlignment = Alignment.CenterVertically+ ) {+ Surface(+ modifier = Modifier.size(40.dp),+ shape = CircleShape,+ color = MaterialTheme.colorScheme.primary.copy(alpha = 0.1f)+ ) {+ Box(contentAlignment = Alignment.Center) {+ if (painter != null) {+ Icon(+ painter = painter,+ contentDescription = null,+ modifier = Modifier.size(20.dp),+ tint = MaterialTheme.colorScheme.primary+ )+ } else if (icon != null) {+ Icon(+ imageVector = icon,+ contentDescription = null,+ modifier = Modifier.size(20.dp),+ tint = MaterialTheme.colorScheme.primary+ )+ }+ }+ }+ Spacer(modifier = Modifier.width(16.dp))+ Column(modifier = Modifier.weight(1f)) {+ Text(+ text = title,+ style = MaterialTheme.typography.titleMedium,+ fontWeight = FontWeight.Bold,+ color = MaterialTheme.colorScheme.onSurface+ )+ Text(+ text = subtitle,+ style = MaterialTheme.typography.bodySmall,+ color = MaterialTheme.colorScheme.onSurfaceVariant+ )+ }+ Icon(+ imageVector = Icons.Default.ChevronRight,+ contentDescription = null,+ tint = MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.3f),+ modifier = Modifier.size(20.dp)+ )+ }+ }+}+@OptIn(ExperimentalMaterial3Api::class)+@Composable+fun MoreAppsBottomSheet(+ onDismiss: () -> Unit,+ onAppSelected: (String) -> Unit+) {+ val sheetState = rememberModalBottomSheetState()++ ModalBottomSheet(+ onDismissRequest = onDismiss,+ sheetState = sheetState,+ dragHandle = { BottomSheetDefaults.DragHandle() },+ containerColor = MaterialTheme.colorScheme.primaryContainer+ ) {+ Column(+ modifier = Modifier.fillMaxWidth()+ ) {+ // Premium gradient header+ Box(+ modifier = Modifier+ .fillMaxWidth()+ .height(160.dp)+ .background(+ Brush.verticalGradient(+ colors = listOf(+ MaterialTheme.colorScheme.primaryContainer,+ MaterialTheme.colorScheme.surface+ )+ )+ ),+ contentAlignment = Alignment.Center+ ) {+ Column(+ horizontalAlignment = Alignment.CenterHorizontally+ ) {+ Icon(+ imageVector = Icons.Default.Apps,+ contentDescription = null,+ modifier = Modifier.size(56.dp),+ tint = MaterialTheme.colorScheme.primary+ )+ Spacer(modifier = Modifier.height(12.dp))+ Text(+ text = "More Apps by AKS-Labs",+ style = MaterialTheme.typography.headlineSmall,+ fontWeight = FontWeight.Bold,+ color = MaterialTheme.colorScheme.onSurface+ )+ Text(+ text = "Explore our other projects",+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurfaceVariant,+ textAlign = TextAlign.Center,+ modifier = Modifier.padding(top = 4.dp)+ )+ }+ }++ Column(+ modifier = Modifier+ .fillMaxWidth()+ .background(MaterialTheme.colorScheme.surface)+ .padding(horizontal = 16.dp)+ .padding(bottom = 32.dp, top = 16.dp)+ ) {+ Text(+ text = "OUR APPS",+ style = MaterialTheme.typography.labelSmall,+ fontWeight = FontWeight.Black,+ color = MaterialTheme.colorScheme.primary,+ letterSpacing = 1.5.sp,+ modifier = Modifier.padding(bottom = 12.dp, start = 4.dp)+ )++ // Apps list+ Column(+ verticalArrangement = Arrangement.spacedBy(12.dp)+ ) {+ AppItemWithDrawable(+ iconRes = R.drawable.logo,+ title = "Pixel Screenshots",+ subtitle = "Screenshot Manager: Organize Screenshots via drag-and-drop instantly.",+// isFoss = true,+ onClick = { onAppSelected("https://play.google.com/store/apps/details?id=com.akslabs.pixelscreenshots") }+ )++ AppItemWithDrawable(+ iconRes = R.drawable.tulsi,+ title = "Tulsi Gallery",+ subtitle = "A sweet looking gallery app with OCR Text Search",+ isFoss = true,+ onClick = { onAppSelected("https://play.google.com/store/apps/details?id=com.aks_labs.tulsi") }+ )++ AppItemWithDrawable(+ iconRes = R.drawable.cts1,+ title = "Circle To Search",+ subtitle = "Circle To Search with multi search engine support",+ isFoss = true,+ onClick = { onAppSelected("https://github.com/AKS-Labs/CircleToSearch") }+ )++ AppItemWithDrawable(+ iconRes = R.drawable.chitralaya1,+ title = "Chitralaya Cloudgallery",+ subtitle = "Privacy-focused Unlimited cloud storage",+ isFoss = true,+ onClick = { onAppSelected("https://github.com/AKS-Labs/CloudGallery") }+ )++ AppItemWithDrawable(+ iconRes = R.drawable.sandeshvahak,+ title = "SandeshVahak",+ subtitle = "Securely sync messages from your secondary device to your primary device using Telegram",+ isFoss = true,+ onClick = { onAppSelected("https://github.com/AKS-Labs/SandeshVahak") }+ )++ // View all apps+ FeedbackChannelOption(+ icon = Icons.Default.Apps,+ title = "View in Play Store",+ subtitle = "See apps on Play Store",+ onClick = { onAppSelected("https://play.google.com/store/apps/dev?id=5379443231912092235") }+ )+ }+ }+ }+ }+}++++@OptIn(ExperimentalMaterial3Api::class)+@Composable+fun DonateBottomSheet(+ onDismiss: () -> Unit,+ onDonateOptionSelected: (String) -> Unit+) {+ val sheetState = rememberModalBottomSheetState()++ ModalBottomSheet(+ onDismissRequest = onDismiss,+ sheetState = sheetState,+ dragHandle = { BottomSheetDefaults.DragHandle() },+ containerColor = MaterialTheme.colorScheme.primaryContainer+ ) {+ Column(+ modifier = Modifier.fillMaxWidth()+ ) {+ // Premium gradient header+ Box(+ modifier = Modifier+ .fillMaxWidth()+ .height(160.dp)+ .background(+ Brush.verticalGradient(+ colors = listOf(+ MaterialTheme.colorScheme.primaryContainer,+ MaterialTheme.colorScheme.surface+ )+ )+ ),+ contentAlignment = Alignment.Center+ ) {+ Column(+ horizontalAlignment = Alignment.CenterHorizontally+ ) {+ Icon(+ painter = painterResource(id = R.drawable.donation),+ contentDescription = null,+ modifier = Modifier.size(56.dp),+ tint = MaterialTheme.colorScheme.primary+ )+ Spacer(modifier = Modifier.height(12.dp))+ Text(+ text = "Support Our Work",+ style = MaterialTheme.typography.headlineSmall,+ fontWeight = FontWeight.Bold,+ color = MaterialTheme.colorScheme.onSurface+ )+ Text(+ text = "Your support helps us build better apps",+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurfaceVariant,+ textAlign = TextAlign.Center,+ modifier = Modifier.padding(top = 4.dp)+ )+ }+ }++ Column(+ modifier = Modifier+ .fillMaxWidth()+ .background(MaterialTheme.colorScheme.surface)+ .padding(horizontal = 16.dp)+ .padding(bottom = 32.dp, top = 16.dp)+ ) {+ Text(+ text = "CHOOSE PAYMENT METHOD",+ style = MaterialTheme.typography.labelSmall,+ fontWeight = FontWeight.Black,+ color = MaterialTheme.colorScheme.primary,+ letterSpacing = 1.5.sp,+ modifier = Modifier.padding(bottom = 12.dp, start = 4.dp)+ )++ // Donation options+ Column(+ verticalArrangement = Arrangement.spacedBy(12.dp)+ ) {+ FeedbackChannelOption(+ icon = Icons.Default.Code,+ title = "GitHub Sponsors",+ subtitle = "Little to no fees",+ onClick = { onDonateOptionSelected("https://github.com/sponsors/AKS-Labs") }+ )++ val clipboardManager = LocalClipboardManager.current+ FeedbackChannelOption(+ icon = Icons.Default.CurrencyRupee,+ title = "UPI (India) akslabs@upi",+ subtitle = "Instant • No fees • Pay via UPI",+ onClick = {+ clipboardManager.setText(AnnotatedString("akslabs@upi"))+ onDonateOptionSelected("upi://pay?pa=akslabs@upi&pn=AKS-Labs&cu=INR")+ }+ )++ FeedbackChannelOption(+ icon = Icons.Default.Payment,+ title = "PayPal",+ subtitle = "Fixed fee up to 5% • Conversion loss ≈ 5% per dollar",+ onClick = { onDonateOptionSelected("https://paypal.me/akslabsOfficial") }+ )+ }+ }+ }+ }+}+++@Composable+fun AppItemWithDrawable(+ iconRes: Int,+ title: String,+ subtitle: String,+ isFoss: Boolean = false,+ onClick: () -> Unit++) {+ val interactionSource = remember { MutableInteractionSource() }+ val isPressed by interactionSource.collectIsPressedAsState()++ val scale by animateFloatAsState(+ targetValue = if (isPressed) 0.98f else 1f,+ animationSpec = spring(dampingRatio = Spring.DampingRatioLowBouncy, stiffness = Spring.StiffnessLow)+ )++ Surface(+ onClick = onClick,+ interactionSource = interactionSource,+ shape = RoundedCornerShape(16.dp),+ color = MaterialTheme.colorScheme.surfaceContainerHigh,+ modifier = Modifier+ .fillMaxWidth()+ .graphicsLayer {+ scaleX = scale+ scaleY = scale+ }+ ) {+ Row(+ modifier = Modifier.padding(16.dp),+ verticalAlignment = Alignment.CenterVertically+ ) {+ Image(+ painter = painterResource(id = iconRes),+ contentDescription = null,+ modifier = Modifier.size(56.dp)+ )+ Spacer(modifier = Modifier.width(16.dp))+ Column(modifier = Modifier.weight(1f)) {+ Row(verticalAlignment = Alignment.CenterVertically) {+ Text(+ text = title,+ style = MaterialTheme.typography.titleMedium,+ fontWeight = FontWeight.Bold,+ color = MaterialTheme.colorScheme.onSurface+ )+ if (isFoss) {+ Spacer(modifier = Modifier.width(8.dp))+ Surface(+ color = MaterialTheme.colorScheme.primaryContainer,+ shape = RoundedCornerShape(6.dp)+ ) {+ Text(+ text = "FOSS",+ style = MaterialTheme.typography.labelSmall,+ color = MaterialTheme.colorScheme.primary,+ modifier = Modifier.padding(horizontal = 6.dp, vertical = 2.dp),+ fontWeight = FontWeight.Bold+ )+ }+ }+ }+ Text(+ text = subtitle,+ style = MaterialTheme.typography.bodySmall,+ color = MaterialTheme.colorScheme.onSurfaceVariant+ )+ }+ Icon(+ imageVector = Icons.Default.KeyboardArrowRight,+ contentDescription = null,+ tint = MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.3f),+ modifier = Modifier.size(24.dp)+ )+ }+ }+}\ No newline at end of filediff --git a/app/src/main/res/drawable/chitralaya1.webp b/app/src/main/res/drawable/chitralaya1.webpnew file mode 100644index 0000000..ad3cae3Binary files /dev/null and b/app/src/main/res/drawable/chitralaya1.webp differdiff --git a/app/src/main/res/drawable/cts1.webp b/app/src/main/res/drawable/cts1.webpnew file mode 100644index 0000000..c8da20fBinary files /dev/null and b/app/src/main/res/drawable/cts1.webp differdiff --git a/app/src/main/res/drawable/logo.png b/app/src/main/res/drawable/logo.pngnew file mode 100644index 0000000..e05a81dBinary files /dev/null and b/app/src/main/res/drawable/logo.png differdiff --git a/app/src/main/res/drawable/sandeshvahak.webp b/app/src/main/res/drawable/sandeshvahak.webpnew file mode 100644index 0000000..f145b91Binary files /dev/null and b/app/src/main/res/drawable/sandeshvahak.webp differdiff --git a/app/src/main/res/drawable/tulsi.webp b/app/src/main/res/drawable/tulsi.webpnew file mode 100644index 0000000..2ec0081Binary files /dev/null and b/app/src/main/res/drawable/tulsi.webp differ