# fast-code-scanner **Repository Path**: captainwilson/fast-code-scanner ## Basic Information - **Project Name**: fast-code-scanner - **Description**: G520低功耗设备上优化的快速qrcode,barcode扫码器 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-04-14 - **Last Updated**: 2026-04-14 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # scan_standalone Standalone Android QR/barcode scanner app built with Kotlin, Android Views, and ZXing. ## Overview This project is a small single-module Android application focused on one job: scanning QR codes and common 1D barcodes, showing the decoded result, and letting the user copy it to the clipboard. The app appears designed for a **landscape-only, large-screen / device-style scanning experience**: - fullscreen UI - keep-screen-on behavior - many `values-swNNNdp` dimension buckets for different screen widths - DPAD/Enter key handling inside the scan screen ## Features - Requests camera permission at runtime - Launches a dedicated scan screen with ZXing embedded scanner - Supports these barcode formats: - `QR_CODE` - `EAN_13` - `EAN_8` - `UPC_A` - `UPC_E` - `CODE_128` - `CODE_39` - Shows: - scan state - decoded content - barcode format - Lets the user copy the latest result to the clipboard - Supports flashlight toggle and DPAD-based zoom/toggle behavior in the capture screen - Includes localized string resources: - default Chinese - English - German - Spanish - Portuguese ## Tech stack - Kotlin - Android Views + ViewBinding - ConstraintLayout - Material Components - ZXing via `com.journeyapps:zxing-android-embedded:4.3.0` - Android Gradle Plugin `8.1.3` - Kotlin plugin `1.9.0` ## Android config - `applicationId`: `com.goolton.scan` - `namespace`: `com.goolton.scan` - `compileSdk`: `33` - `targetSdk`: `33` - `minSdk`: `28` - `versionName`: `1.0.0` ## Project structure ```text scan_standalone/ +-- app/ | +-- src/main/java/com/goolton/scan/ | | +-- ScanActivity.kt | | \-- ScanCodeActivity.kt | +-- src/main/res/ | | +-- layout/activity_scan.xml | | +-- drawable/ | | +-- values/ | | +-- values-en/ | | +-- values-de/ | | +-- values-es/ | | +-- values-pt/ | | \-- values-sw*/ # screen-width-specific dimensions | +-- build.gradle.kts | \-- proguard-rules.pro +-- gradle/ +-- build.gradle.kts +-- settings.gradle.kts \-- gradlew.bat ``` ## Main flow ### `ScanActivity` The launcher activity: - inflates the main result screen - requests camera permission - starts scanning immediately when permission is available - stores the latest decoded text + format in memory - lets the user rescan or copy the last result ### `ScanCodeActivity` Custom scan/capture activity built on top of ZXing `CaptureActivity`: - uses ZXing's capture layout - configures autofocus / infinity focus based on device capability - adds flashlight controls - handles hardware keys: - `DPAD_LEFT` / `DPAD_RIGHT`: zoom - `DPAD_CENTER` / `ENTER`: toggle flashlight ## Build requirements To build this project locally, you should have: - **JDK 17 or newer** for AGP 8.1.x - Android SDK Platform 33 - Android build tools installed through Android Studio / SDK Manager Create your own `local.properties` if needed: ```properties sdk.dir=/path/to/Android/Sdk ``` ## Build commands From the project root: ```bash ./gradlew assembleDebug ./gradlew testDebugUnitTest ./gradlew lintDebug ``` On Windows: ```powershell .\gradlew.bat assembleDebug .\gradlew.bat testDebugUnitTest .\gradlew.bat lintDebug ``` ## Permissions The app requests: - `android.permission.CAMERA` It also declares: - camera hardware required - autofocus optional ## Privacy / behavior notes - The app does **not** include networking code. - Scan results are displayed locally and can be copied to the clipboard. - There is no persistence layer in the current codebase for saving scan history. - `android:allowBackup="true"` is enabled; revisit this if future versions store sensitive data. ## Current repo assessment ### Strengths - Very small and easy-to-understand codebase - Focused single-purpose UX - Minimal permission surface - No backend dependency in current implementation - Good fit for embedded / kiosk-like hardware thanks to landscape + key handling ### Gaps / risks - No unit tests or instrumentation tests are checked into the repo - Release build hardening is minimal: - `isMinifyEnabled = false` - `proguard-rules.pro` is effectively empty - Permission denial flow does not guide the user to system settings when permission is permanently denied - Scan result is kept only in memory and is not restored after process death - Flash controls in the capture screen are implemented with transparent overlay buttons, which may be device-specific and should be validated on target hardware ## Suggested next improvements 1. Add unit tests for scan state transitions 2. Add basic instrumentation / smoke tests 3. Improve permission UX for "Don't ask again" 4. Decide whether release builds should enable shrinking / obfuscation 5. Document target hardware and expected input methods 6. Consider saving recent scan history if product requirements need it ## Useful files - `app/src/main/java/com/goolton/scan/ScanActivity.kt` - `app/src/main/java/com/goolton/scan/ScanCodeActivity.kt` - `app/src/main/res/layout/activity_scan.xml` - `app/src/main/AndroidManifest.xml` - `app/build.gradle.kts`