A modern Android client for ActivityPub and Mastodon instances built with Jetpack Compose.
My ActivityPub is a beautiful, user-friendly Android application that allows you to interact with Mastodon and other ActivityPub-compatible social networks. The app features a clean, modern UI built entirely with Jetpack Compose and Material Design 3.
- π± Modern Material Design 3 UI - Beautiful, responsive interface
- π Multi-Instance Support - Connect to any Mastodon/ActivityPub instance
- π OAuth Authentication - Secure login with OAuth 2.0
- π° Public & Home Timelines - Browse federated and personal timelines
- π Pull-to-Refresh - Swipe down to update your timeline
- β‘ Auto-Refresh - Timeline automatically updates every 30 seconds
- π Interactive Links & Hashtags - Click URLs and hashtags in posts
- πΌοΈ Media Attachments - View images and media in posts
- π¬ Post Interactions - Reply, boost, and favorite posts
- π Status Details - View full posts with reply threads
- π Notifications - Stay updated with mentions and interactions
- βΎοΈ Infinite Scrolling - Load more posts as you scroll
- π¨ Dynamic Colors - Adapts to your system theme (Android 12+)
- π Dark Mode - Full dark theme support
(Coming soon)
- Language: Kotlin
- UI Framework: Jetpack Compose
- Architecture: MVVM (Model-View-ViewModel)
- Networking: Retrofit 2 + OkHttp
- Image Loading: Coil
- Async Operations: Kotlin Coroutines + Flow
- Material Design: Material 3
app/
βββ src/main/java/com/manalejandro/myactivitypub/
β βββ MainActivity.kt # Main entry point
β βββ data/
β β βββ api/
β β β βββ MastodonApiService.kt # API service interface
β β βββ models/
β β β βββ Account.kt # User account model
β β β βββ Status.kt # Post/status model
β β β βββ MediaAttachment.kt # Media attachment model
β β β βββ Instance.kt # Instance information model
β β βββ repository/
β β βββ MastodonRepository.kt # Data repository
β βββ ui/
β βββ components/
β β βββ StatusCard.kt # Status card component
β βββ viewmodel/
β β βββ TimelineViewModel.kt # Timeline view model
β βββ theme/
β βββ Color.kt # Color definitions
β βββ Theme.kt # Theme configuration
β βββ Type.kt # Typography
The app follows the MVVM (Model-View-ViewModel) architecture pattern:
- Model: Data classes representing API responses (
Status,Account, etc.) - View: Composable functions for UI (
StatusCard,MyActivityPubApp) - ViewModel:
TimelineViewModelmanages UI state and business logic - Repository:
MastodonRepositoryhandles data operations and API calls
API Service β Repository β ViewModel β UI State β Composable UI
- Android Studio Hedgehog (2023.1.1) or newer
- JDK 11 or higher
- Android SDK with API level 24+ (Android 7.0+)
- Clone the repository:
git clone <repository-url>
cd MyActivityPub-
Open the project in Android Studio
-
Sync Gradle files
-
Build and run:
./gradlew assembleDebugThe APK will be generated at:
app/build/outputs/apk/debug/app-debug.apk
- Connect your Android device or start an emulator
- Click "Run" in Android Studio or use:
./gradlew installDebugThe app uses the Mastodon API v1 specification. By default, it connects to mastodon.social, but you can modify the base URL in MainActivity.kt.
GET /api/v1/timelines/public- Fetch public timelineGET /api/v1/instance- Get instance informationGET /api/v1/accounts/:id- Get account detailsGET /api/v1/accounts/:id/statuses- Get account statuses
For more information, see the Mastodon API documentation.
To connect to a different Mastodon instance, modify the base URL in MainActivity.kt:
val retrofit = Retrofit.Builder()
.baseUrl("https://your-instance.social/")
// ...Key configuration files:
build.gradle.kts- App dependencies and build configurationgradle.properties- Gradle properties (JVM memory, etc.)libs.versions.toml- Version catalog for dependencies
| Library | Version | Purpose |
|---|---|---|
| Retrofit | 2.9.0 | REST API client |
| OkHttp | 4.12.0 | HTTP client |
| Gson | 2.9.0 | JSON serialization |
| Coil | 2.5.0 | Image loading |
| Coroutines | 1.7.3 | Async programming |
| Compose BOM | 2024.09.00 | Jetpack Compose libraries |
| Material 3 | Latest | Material Design 3 components |
This project follows the official Kotlin coding conventions. Key guidelines:
- Use 4 spaces for indentation
- Use camelCase for variables and functions
- Use PascalCase for classes
- Add KDoc comments for public APIs
- Keep functions small and focused
- Create data models in
data/models/ - Add API endpoints in
MastodonApiService.kt - Implement repository methods in
MastodonRepository.kt - Create ViewModel with UI state in
ui/viewmodel/ - Build UI components in
ui/components/ - Wire everything together in composable screens
Gradle daemon crashes:
- Increase JVM memory in
gradle.properties:org.gradle.jvmargs=-Xmx4096m
Dependency resolution fails:
- Clear Gradle cache:
./gradlew clean --no-daemon - Invalidate caches in Android Studio
Compose compiler issues:
- Ensure Kotlin and Compose versions are compatible
- Check
libs.versions.tomlfor version alignment
Network errors:
- Verify
INTERNETpermission inAndroidManifest.xml - Check device/emulator internet connection
- Ensure HTTPS URLs are used (clear text traffic is disabled)
Image loading failures:
- Coil requires valid URLs
- Check LogCat for detailed error messages
The app now supports pull-to-refresh functionality on all timelines. Simply swipe down from the top of the timeline to fetch the latest posts from your instance.
Timelines now automatically check for new posts every 30 seconds. New posts appear seamlessly at the top of your timeline without interrupting your reading experience.
How it works:
- Background coroutine checks for new posts using
since_idparameter - Updates are silent and don't interfere with scrolling
- Auto-refresh restarts when switching between timelines
- Minimal network usage - only fetches posts newer than the current top post
Post content is now fully interactive with support for:
- Clickable URLs: Tap any link to open in your default browser
- Hashtags: Styled and clickable hashtags
- Rich HTML content: Proper rendering of formatted text
All links and hashtags are displayed in your theme's primary color with underlines for easy identification.
For detailed information about all features, see FEATURES.md.
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Mastodon for the API specification
- Takahe for API reference
- Material Design 3 for the beautiful design system
- The Android and Kotlin communities
For questions or feedback, please open an issue on GitHub.
Note: This is a demonstration project showcasing modern Android development with Jetpack Compose. For production use, consider adding authentication, error handling improvements, and additional features like posting, following, and notifications.