Hourbit is an Android application for tracking focused work sessions and breaks.
A completed session can contain more than just a duration. Hourbit can optionally attach the location, city, temperature, and weather conditions that were present when the session ended.
The application was developed as an Android final project with a focus on clean architecture, persistent local data, API integration, reactive state management, error handling, and a polished Compose interface.
|
|
|
|
|
|
|
|
Hourbit follows an MVVM architecture with a Repository layer.
βββββββββββββββββββββββββ
β Compose UI β
β HomeScreen / History β
βββββββββββββ¬ββββββββββββ
β
βΌ
βββββββββββββββββββββββββ
β ViewModels β
β HomeVM / HistoryVM β
βββββββββββββ¬ββββββββββββ
β
βΌ
βββββββββββββββββββββββββ
β WorkSessionRepository β
ββββββββββ¬ββββββββββ¬βββββ
β β
βΌ βΌ
βββββββββββββββ βββββββββββββββ
β Room β β Retrofit β
β Local data β β Open-Meteo β
βββββββββββββββ βββββββββββββββ
βββββββββββββββββββββββββ
β Home-screen Widget β
β RemoteViews β
βββββββββββββ¬ββββββββββββ
β
βΌ
βββββββββββββββββββββββββ
β SessionStateStore β
β SharedPreferences β
βββββββββββββββββββββββββ
The UI does not directly access Room or the weather API.
- The Compose UI displays state and sends user actions.
- The ViewModel manages application logic and UI state.
- The Repository provides access to local and remote data.
- Room stores completed work sessions.
- Retrofit communicates with Open-Meteo.
Hourbit does not use an incrementing counter as the source of truth.
Instead, the timer is calculated from real timestamps.
Session start
β
βββββββββ Work βββββββββ
β β
β Break start β
β β β
β βββ Break ββββββ€
β β
β Resume work β
β β
βββββββββββββββ Session end
The effective work duration is:
Work time = Total session duration - Total break duration
This allows an active session to be reconstructed after the app is reopened instead of losing the timer state.
While a session is active, Hourbit stores:
- session start timestamp
- whether a break is active
- break start timestamp
- accumulated break duration
- running state
This temporary state is stored with SharedPreferences through SessionStateStore.
Completed sessions are stored separately in Room.
Hourbit includes an interactive Android home-screen widget built with AppWidgetProvider and RemoteViews.
The widget uses the same persisted active-session state as the main application and provides quick access to the current session without requiring Hourbit to remain open.
Depending on the current state, the widget can display:
- Ready β start a new work session
- Focusing β show a live work timer and start a break
- On break β freeze the work timer, show a live break timer and resume work
The widget reconstructs elapsed time from timestamps instead of maintaining a separate counter. This keeps its timer consistent with Hourbit's timer design.
Finishing a session returns the user to Hourbit, where the normal completion flow can retrieve optional location and weather information before storing the completed session in Room.
Completed sessions are represented by WorkSession.
WorkSession
β
βββ id
βββ startTime
βββ endTime
βββ breakDurationSeconds
β
βββ latitude
βββ longitude
βββ cityName
β
βββ temperature
βββ weatherCode
Location and weather information are nullable because neither is required for the core timer functionality.
Hourbit uses the Fused Location Provider from Google Play Services.
When a session ends:
Device
β
βΌ
Fused Location Provider
β
βΌ
Latitude + Longitude
β
βΌ
Android Geocoder
β
βΌ
Readable city name
Location permission is optional. If location cannot be retrieved, the session is still saved.
Hourbit uses the free Open-Meteo API. No API key is required.
Requested values:
temperature_2m
weather_code
Endpoint:
https://api.open-meteo.com/v1/forecast
The saved WMO weather code is translated into a readable condition and corresponding UI icon.
| Code | Display |
|---|---|
0 |
Clear |
1β3 |
Cloudy |
45β48 |
Fog |
51β57 |
Drizzle |
61β67 |
Rain |
71β77 |
Snow |
80β82 |
Showers |
95β99 |
Thunderstorm |
Weather is requested only when coordinates are available. If the request fails, the session is still saved.
The History screen is centered around a swipeable weekly calendar running from Monday to Sunday.
Current week β swipe β Previous week β swipe β Earlier weeks
The session list follows the visible calendar period automatically.
Each session can show:
| π Date | β± Work duration |
| π Start / end time | β Break duration |
| π€ Weather | π City |
History entries use a custom swipe interaction instead of immediately deleting at a swipe threshold.
Normal card
β
β swipe left
βΌ
βββββββββββββββββββββββββββββββββββ
β Session β π Delete
βββββββββββββββββββββββββββββββββββ
The card settles with the delete action revealed. The user must explicitly tap Delete, after which a confirmation dialog appears.
This prevents accidental deletion while keeping the interaction fast.
Optional features do not block the core session flow.
Location unavailable
β
Save session without location
Weather unavailable
β
Save session without weather
Database and API operations are wrapped in error handling so failures can be surfaced to the UI instead of crashing the application.
Hourbit uses:
android.permission.ACCESS_FINE_LOCATION
android.permission.ACCESS_COARSE_LOCATION
android.permission.INTERNETLocation permission is optional.
Internet access is used for weather requests.
Hourbit uses type-safe Navigation Compose routes.
HomeRoute
HistoryRoute
The bottom navigation switches directly between the two main sections without manually maintained route strings.
| Area | Technology |
|---|---|
| Language | Kotlin |
| UI | Jetpack Compose |
| Architecture | MVVM + Repository |
| Database | Room |
| Networking | Retrofit |
| Weather API | Open-Meteo |
| Location | Google Play Services Location |
| Navigation | Navigation Compose |
| State | StateFlow / Flow |
| Concurrency | Kotlin Coroutines |
| Active session state | SharedPreferences |
| Home-screen widget | AppWidgetProvider + RemoteViews |
| Build system | Gradle Kotlin DSL |
com.arj4ng.hourbit
β
βββ data
β βββ local
β β βββ HourbitDatabase
β β βββ WorkSession
β β βββ WorkSessionDao
β β βββ SessionStateStore
β β
β βββ location
β β βββ LocationProvider
β β
β βββ remote
β β βββ RetrofitClient
β β βββ WeatherApi
β β
β βββ WorkSessionRepository
β
βββ ui
β βββ home
β β βββ HomeScreen
β β βββ HomeViewModel
β β βββ HomeViewModelFactory
β β
β βββ history
β β βββ HistoryScreen
β β βββ HistoryViewModel
β β βββ HistoryViewModelFactory
β β
β βββ navigation
β βββ theme
β
βββ widget
β βββ HourbitWidgetProvider
β
βββ MainActivity
Hourbit uses a custom color system for both light and dark mode.
| Color role | Meaning |
|---|---|
| π΅ Blue | Active work, primary actions, selected states |
| π Amber | Breaks and paused work |
| π΄ Red | Destructive actions |
| βͺ Neutral | Surfaces, metadata, secondary UI |
The app follows the device light/dark appearance and is optimized for portrait use.
Clone the repository and build the debug APK:
./gradlew assembleDebugOr install directly on a connected device/emulator:
./gradlew installDebug- Session titles or project/category assignment
- Daily and weekly statistics
- Charts for working time and breaks
- Manual editing of completed sessions
- Export to CSV
- Search and filtering
- Configurable work goals
- Notifications or reminders
- Cloud synchronization
- Tablet layouts
Hourbit was created as an Android Abschlussprojekt.
The project demonstrates:
- an original app concept
- Jetpack Compose UI development
- MVVM architecture
- Repository pattern
- Room persistence
- Retrofit API integration
- device location access
- Kotlin Coroutines and Flow
- type-safe navigation
- error handling
- persistent application state
- interactive Android home-screen widget
- AppWidgetProvider and RemoteViews
- custom light and dark themes

