4.2 KiB
Project Overview
Activity Launcher is an Android application that launches hidden activities and creates shortcuts for installed apps. It is an open-source utility tool.
Tech Stack
- Language: Kotlin
- Build System: Gradle (Kotlin DSL)
- Minimum SDK: 16
- Target SDK: 36
- Compile SDK: 36
Key Libraries
- Dependency Injection: Hilt
- UI Toolkit: Android Views (XML Layouts) with ViewBinding
- Navigation: Android Jetpack Navigation Component
- UI Components: Material Design 3 (Material Components)
- Compatibility: AndroidX (AppCompat, Core-KTX, Preference, MultiDex)
Project Structure
The project follows a standard Android Gradle project structure with a single module :app.
Root Directory
app/: Main application moduledescriptions/: Store listing descriptionswhatsnew/: Changelogs/Release notesupdate-listing.py&update-translations.sh: Maintenance scripts
App Module (app/src/main/java/de/szalkowski/activitylauncher/)
ui/: UI related classes (Fragments, Adapters, etc.)services/: Background services or logicMainActivity.kt: The main entry point of the application. Handles navigation hosting.ShortcutActivity.kt: Handles the launching of shortcuts created by the app.ActivityLauncherApp.kt: The Application class, annotated with@HiltAndroidApp.SettingsActivity.kt: Manages application settings.
Build Variants
The project uses productFlavors with a "distribution" dimension:
- oss: For direct distribution (F-Droid, etc.). Pure FOSS.
- playStore: For Google Play Store distribution. Includes
com.google.android.play:review-ktxfor in-app reviews.
Development Guidelines
- View Binding: Used for interacting with XML layouts.
- Hilt: Used for dependency injection. Ensure new components are properly annotated (e.g.,
@AndroidEntryPoint). - Navigation: Uses the Navigation Component. Navigation graph is likely defined in
res/navigation. - Service Implementation: The interface and the default implementation are co-located in the same file (e.g.,
FavoritesService.kt). This is the default/noop convention in all services.
Handling non-FOSS features
Features that are not free and open-source (like Google Play Services APIs) should not be part of the oss build. To achieve this, the project uses Hilt and different service bindings for different product flavors.
An interface for the feature is defined in the main source set (e.g., InAppReviewService).
Two implementations of this interface are created:
- A real implementation that uses non-FOSS APIs, located in the
playStoresource set (e.g.,InAppReviewServiceImpl). - A stub or no-op implementation that does nothing, located in the
osssource set (e.g.,InAppReviewServiceImplStub).
Hilt's @Binds in flavor-specific Bindings.kt files are used to provide the correct implementation for each build variant. This ensures that the oss version remains fully FOSS.
Verification
Always check if the project builds after applying changes and ensure all build issues are fixed.
Relevant Commands
- Build Debug APK:
./gradlew app:assembleDebug - Check Lint:
./gradlew app:lintDebug - Run Unit Tests:
./gradlew app:testDebugUnitTest
Code Style and Formatting
This project uses Spotless for automatic code formatting and style checking.
Code Style Commands
- Check code formatting:
./gradlew spotlessCheck - Apply code formatting:
./gradlew spotlessApply - Format Kotlin files:
./gradlew spotlessApply - Check only Kotlin formatting:
./gradlew app:spotlessKotlinCheck
Automatic Formatting
- Development builds: Code is automatically formatted during
./gradlew buildor./gradlew assembleDebug - Git pre-commit: Code is automatically formatted before each commit
- CI/CD: Pull requests are blocked if code formatting fails
IDE Integration (Android Studio)
- Install the "Spotless" plugin from JetBrains Marketplace
- Enable "Format on save" in Settings → Editor → Code Style
- Configure actions to run
spotlessApplyon save
Configuration Files
app/build.gradle.kts: Spotless configuration with ktlint rules.editorconfig: Basic formatting rules for IDEs