Skip to content

CircleToSearch with multi search engine support for all android

Kotlin

readme

AKS Labs8658a7f5aabc
diff --git a/.idea/markdown.xml b/.idea/markdown.xml
new file mode 100644
index 0000000..c61ea33
--- /dev/null
+++ b/.idea/markdown.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="MarkdownSettings">
+ <option name="previewPanelProviderInfo">
+ <ProviderInfo name="Compose (experimental)" className="com.intellij.markdown.compose.preview.ComposePanelProvider" />
+ </option>
+ </component>
+</project>
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..a9db432
--- /dev/null
+++ b/README.md
@@ -0,0 +1,92 @@
+<!-- ---------- Header ---------- -->
+<div align="center">
+ <img src="app/src/main/res/drawable/chitralaya.png" width="200" height="200">
+ <h1>Circle To Search</h1>
+ <h3>Circle To Search: Multi-Engine Reverse Image Search</h3>
+ <p>🔒 <em>Google • Bing • Yandex • Tineye</em></p>
+
+<!-- ---------- Badges ---------- -->
+ <div align="center">
+ <img alt="License" src="https://img.shields.io/badge/License-Apache%202.0-blue.svg?style=flat-square">
+ <img alt="Downloads" src="https://img.shields.io/github/downloads/AKS-Labs/CircleToSearch/total?color=c3e7ff&style=flat-square">
+ <img alt="Last commit" src="https://img.shields.io/github/last-commit/AKS-Labs/CircleToSearch?color=c3e7ff&style=flat-square">
+ <img alt="Repo size" src="https://img.shields.io/github/repo-size/AKS-Labs/CircleToSearch?color=c3e7ff&style=flat-square">
+ <img alt="Stars" src="https://img.shields.io/github/stars/AKS-Labs/CircleToSearch?color=c3e7ff&style=flat-square">
+ <br>
+</div>
+
+<!-- ---------- Labels ---------- -->
+<div align="center">
+ <img alt="API" src="https://img.shields.io/badge/Api%2029+-50f270?logo=android&logoColor=black&style=for-the-badge"/>
+ <img alt="Kotlin" src="https://img.shields.io/badge/Kotlin-a503fc?logo=kotlin&logoColor=white&style=for-the-badge"/>
+ <img alt="Jetpack Compose" src="https://img.shields.io/static/v1?style=for-the-badge&message=Jetpack+Compose&color=4285F4&logo=Jetpack+Compose&logoColor=FFFFFF&label="/>
+ <img alt="material" src="https://custom-icon-badges.demolab.com/badge/material%20you-lightblue?style=for-the-badge&logocolor=333&logo=material-you"/>
+</div>
+</div>
+
+---
+# CircleToSearch
+
+**CircleToSearch** is an open-source Android application that brings the powerful "Circle to Search" feature to any Android device. It allows you to search for anything on your screen by simply drawing a circle around it.
+
+## ✨ Features
+
+- **Universal Compatibility**: Works on any Android device (Android 10+).
+- **Instant Search**: Double-tap the status bar or use the floating bubble to trigger.
+- **Multi-Engine Support**: Search using Google Lens, Bing, Yandex, TinEye.
+- **Smart Selection**: Draw a circle, scribble to select.
+- **Beautiful UI**: Modern Material 3 design with dark mode support and smooth animations.
+- **Customizable**: Toggle dark mode, desktop mode, and UI elements like the gradient border.
+
+## 🚀 Getting Started
+
+
+
+### Permissions
+
+The app requires the following permissions to function:
+
+1. **Accessibility Service**: To detect the trigger gesture (double-tap on status bar) and capture the screen content.
+2. **Internet**: To perform image searches.
+
+
+## 📱 Usage
+
+1. **Enable Service**: Open the app and tap "Enable Accessibility Service".
+2. **Trigger**:
+ - **Double-tap** the top status bar area.
+ - Or tap the **Floating Bubble** (if enabled).
+3. **Search**:
+ - The screen will freeze.
+ - Draw a circle around any object or text.
+ - Select your preferred search engine from the bottom sheet.
+
+## 🛠️ Built With
+
+- **Kotlin** - First-class and official programming language for Android development.
+- **Jetpack Compose** - Android’s modern toolkit for building native UI.
+- **Coroutines** - For asynchronous programming.
+- **Retrofit** - Type-safe HTTP client for Android.
+- **Coil** - Image loading library for Android backed by Kotlin Coroutines.
+
+## 🤝 Contributing
+
+Contributions are welcome! Please feel free to submit a Pull Request.
+
+1. Fork the project
+2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
+3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
+4. Push to the branch (`git push origin feature/AmazingFeature`)
+5. Open a Pull Request
+
+
+## 🙏 Acknowledgments
+
+- Inspired by Google's Circle to Search feature.
+- Icons by [Material Design Icons](https://fonts.google.com/icons).
+
+---
+
+<p align="center">
+ Made with ❤️ by <a href="https://github.com/akslabs">AKSLabs</a>
+</p>
diff --git a/app/src/main/java/com/akslabs/circletosearch/data/SearchEngine.kt b/app/src/main/java/com/akslabs/circletosearch/data/SearchEngine.kt
index 86f3367..9f4234e 100644
--- a/app/src/main/java/com/akslabs/circletosearch/data/SearchEngine.kt
+++ b/app/src/main/java/com/akslabs/circletosearch/data/SearchEngine.kt
@@ -1,24 +1,22 @@
package com.akslabs.circletosearch.data
sealed class SearchEngine(val displayName: String) {
- data object Google : SearchEngine("Google")
+ object Google : SearchEngine("Google")
object Bing : SearchEngine("Bing")
object Yandex : SearchEngine("Yandex")
object TinEye : SearchEngine("TinEye")
- object Baidu : SearchEngine("Baidu")
- object Lenso : SearchEngine("Lenso.ai")
-
object Perplexity : SearchEngine("Perplexity")
object ChatGPT : SearchEngine("ChatGPT")
companion object {
- fun values(): List<SearchEngine> = listOf(Google, Bing, Yandex, TinEye, Baidu, Lenso, Perplexity, ChatGPT)
+ fun values(): List<SearchEngine> = listOf(Google, Bing, Yandex, TinEye, Perplexity, ChatGPT)
}
val name: String get() = displayName
-
- val isDirectUpload: Boolean get() = when(this) {
- Baidu, Lenso, Perplexity, ChatGPT -> true
+}
+
+val SearchEngine.isDirectUpload: Boolean
+ get() = when (this) {
+ SearchEngine.Perplexity, SearchEngine.ChatGPT -> true
else -> false
}
-}
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 ba015fb..74840fc 100644
--- a/app/src/main/java/com/akslabs/circletosearch/ui/CircleToSearchScreen.kt
+++ b/app/src/main/java/com/akslabs/circletosearch/ui/CircleToSearchScreen.kt
@@ -89,6 +89,7 @@ import androidx.activity.compose.BackHandler
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import androidx.webkit.WebSettingsCompat
import androidx.webkit.WebViewFeature
+import com.akslabs.circletosearch.data.isDirectUpload
import kotlin.math.max
import kotlin.math.min
@@ -319,8 +320,6 @@ fun CircleToSearchScreen(
if (!preloadedUrls.containsKey(engine)) {
val url = if (engine.isDirectUpload) {
when (engine) {
- SearchEngine.Baidu -> ImageSearchUploader.getBaiduUrl(hostedImageUrl!!)
- SearchEngine.Lenso -> ImageSearchUploader.getLensoUrl(hostedImageUrl!!)
SearchEngine.Perplexity -> ImageSearchUploader.getPerplexityUrl(hostedImageUrl!!)
SearchEngine.ChatGPT -> ImageSearchUploader.getChatGPTUrl(hostedImageUrl!!)
else -> null
@@ -824,19 +823,19 @@ fun CircleToSearchScreen(
verticalAlignment = Alignment.CenterVertically
) {
IconButton(onClick = {
- val intent = android.content.Intent(android.content.Intent.ACTION_VIEW, android.net.Uri.parse("https://github.com/akslabs"))
+ val intent = android.content.Intent(android.content.Intent.ACTION_VIEW, android.net.Uri.parse("https://github.com/aks-labs"))
context.startActivity(intent)
}) {
Icon(Icons.Default.Code, "Github", tint = Color.White)
}
- Spacer(modifier = Modifier.width(8.dp))
+ Spacer(modifier = Modifier.width(4.dp))
IconButton(onClick = {
val intent = android.content.Intent(android.content.Intent.ACTION_VIEW, android.net.Uri.parse("https://github.com/sponsors/akslabs"))
context.startActivity(intent)
}) {
Icon(Icons.Default.Favorite, "Donate", tint = Color.White)
}
- Spacer(modifier = Modifier.width(8.dp))
+ Spacer(modifier = Modifier.width(4.dp))
IconButton(onClick = {
val intent = android.content.Intent(android.content.Intent.ACTION_VIEW, android.net.Uri.parse("https://t.me/akslabs"))
context.startActivity(intent)
diff --git a/app/src/main/java/com/akslabs/circletosearch/utils/ImageSearchUploader.kt b/app/src/main/java/com/akslabs/circletosearch/utils/ImageSearchUploader.kt
index 437225d..b3ebd43 100644
--- a/app/src/main/java/com/akslabs/circletosearch/utils/ImageSearchUploader.kt
+++ b/app/src/main/java/com/akslabs/circletosearch/utils/ImageSearchUploader.kt
@@ -98,18 +98,11 @@ object ImageSearchUploader {
return "https://yandex.com/images/search?rpt=imageview&url=$encodedUrl"
}
-
-
fun getTinEyeUrl(imageUrl: String): String {
val encodedUrl = URLEncoder.encode(imageUrl, "UTF-8")
return "https://tineye.com/search?url=$encodedUrl"
}
- fun getBaiduUrl(imageUrl: String): String {
- val encodedUrl = URLEncoder.encode(imageUrl, "UTF-8")
- return "https://graph.baidu.com/details?isfromtoybox=1&searchtype=searchSimple&objurl=$encodedUrl"
- }
-
fun getPerplexityUrl(imageUrl: String): String {
// Perplexity doesn't support URL params for image search directly yet
return "https://www.perplexity.ai/"
@@ -119,10 +112,4 @@ object ImageSearchUploader {
// ChatGPT doesn't support URL params for image search directly yet
return "https://chatgpt.com/"
}
-
- fun getLensoUrl(imageUrl: String): String {
- val encodedUrl = URLEncoder.encode(imageUrl, "UTF-8")
- // Try passing URL as query param, though Lenso usually requires upload
- return "https://lenso.ai/en/results?url=$encodedUrl"
- }
}
diff --git a/build_log.txt b/build_log.txt
index 7ae8882..04d2a1a 100644
Binary files a/build_log.txt and b/build_log.txt differ