Skip to content

JavFuentes/DailyJoke

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

26 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ˜‚ DailyJoke

Android Kotlin Jetpack Compose Material 3 API Level

A modern Android application that brings you a smile every day with random jokes. Built with the latest Android technologies following development best practices.

✨ Features

🎯 Random Jokes - Get fresh and funny jokes instantly
πŸ’– Favorites System - Save your preferred jokes to view them later
πŸ’Ύ Local Persistence - Your favorites are saved automatically

πŸš€ Screenshots

ss

πŸ› οΈ Technologies

This project is built using cutting-edge Android technologies:

πŸ§ͺ Testing

  • JUnit - Unit testing framework
  • Mockk - Mocking library for Kotlin
  • Turbine - Testing for Flow
  • Truth - Fluent assertions for tests

πŸ—οΈ Architecture

The project follows the MVVM (Model-View-ViewModel) pattern with Clean Architecture:

πŸ“ app/src/main/java/dev/javfuentes/dailyjoke/
β”œβ”€β”€ πŸ“ data/
β”‚   β”œβ”€β”€ πŸ“ datasource/          # Data sources (API, Local)
β”‚   β”œβ”€β”€ πŸ“ model/               # Data models and API
β”‚   └── πŸ“ repository/          # Repository pattern implementation
β”œβ”€β”€ πŸ“ di/                      # Manual dependency injection
β”œβ”€β”€ πŸ“ network/                 # Network configuration and APIs
β”œβ”€β”€ πŸ“ ui/
β”‚   β”œβ”€β”€ πŸ“ components/          # Reusable UI components
β”‚   β”œβ”€β”€ πŸ“ navigation/          # Screen navigation
β”‚   β”œβ”€β”€ πŸ“ screens/             # Main screens
β”‚   └── πŸ“ theme/               # Material 3 theme
β”œβ”€β”€ πŸ“ utils/                   # Utilities and constants
└── πŸ“ viewmodel/               # ViewModels and UI state

πŸ”„ Data Flow

UI (Compose) ↔ ViewModel ↔ Repository ↔ DataSource
                    ↓
                StateFlow/UiState

πŸ“± Technical Features

  • Single Activity Architecture - Single Activity with Composable navigation
  • Reactive Programming - StateFlow for reactive state management
  • Error Handling - Robust network and API error handling
  • Offline Support - Favorites work without connection
  • Edge-to-Edge Layout - Full support for modern screens

🎨 API

The application consumes the free JokeAPI:

  • Endpoint: https://v2.jokeapi.dev/joke/Programming
  • Format: JSON
  • Types: Two-part jokes (setup + punchline)
  • Filters: Safe mode enabled
  • Language: English

πŸš€ Installation

Prerequisites

  • Android Studio Hedgehog | 2023.1.1 or higher
  • JDK 11 or higher
  • Android SDK API 26+
  • Device/Emulator with Android 8.0+ (API 26)

Steps

  1. Clone the repository

    git clone https://github.com/yourusername/DailyJoke.git
    cd DailyJoke
  2. Open in Android Studio

    • File β†’ Open β†’ Select the project folder
  3. Sync the project

    • Android Studio will automatically sync dependencies
  4. Run the application

    • Connect a device or start an emulator
    • Click Run ▢️

πŸ—οΈ Build Commands

# Clean project
./gradlew clean

# Build debug
./gradlew assembleDebug

# Run tests
./gradlew test

# Run instrumented tests
./gradlew connectedAndroidTest

# Lint check
./gradlew lint

πŸ“– Usage

  1. Main Screen

    • View random jokes
    • Tap "New Joke" to get a new joke
    • Use the ❀️ button to save favorites
  2. Favorites Screen

    • Access from "Favorites" button
    • See all your saved jokes
    • Remove favorites with "Remove" button
  3. Navigation

    • Simple navigation between screens
    • Back button in favorites

πŸ§ͺ Testing

The project includes comprehensive tests following TDD approach:

# Unit tests
./gradlew test

# UI tests (requires device)
./gradlew connectedAndroidTest

# Coverage report
./gradlew jacocoTestReport

πŸ“Š Test Coverage

  • βœ… ViewModels (Business Logic)
  • βœ… Repository Pattern
  • βœ… Data Sources
  • βœ… UI Components (in development)

πŸ”„ CI/CD

Automated CI/CD pipeline with GitHub Actions:

  • βœ… Build & Test - Automatic builds and unit tests on push/PR
  • βœ… Instrumented Tests - UI tests on Android emulator
  • βœ… Code Quality - Lint checks and static analysis
  • 🎯 Branches: master, ci-testing
# Run CI checks locally
./gradlew clean build test lint

πŸ“„ License

MIT License

Copyright (c) 2023 Javier Fuentes

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

For more information about the author and his projects, visit http://javierfuentes.dev

πŸ‘¨β€πŸ’» Author

Javier Fuentes


Did you like the project? Give it a ⭐!

CΓ³mprame un cafΓ© en ko-fi.com

About

A modern Android application that brings you a smile every day with random jokes

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages