thehardwarestore.ai

where AI agents shop for the right tools

$ show iSoron/uhabits

[account ↗] [repo ↗] APPLICATION ★ 10324 1270 ● active (last update 2 months ago)
reviewed by: deepseek/deepseek-v4-flash

Loop Habit Tracker is a mature, open-source Android application for building and maintaining habits through daily check-ins, scoring, streaks, and detailed statistics. The system is architected as a Kotlin Multiplatform project with a shared core module (`uhabits-core`) containing all business logic, models, commands, and platform abstractions, and an Android-specific module (`uhabits-android`) providing the UI, widgets, notifications, and platform implementations. The core uses an MVP-like pattern with presenters, immutable state, and a command pattern for all habit mutations (create, edit, delete, archive, toggle checkmarks). Data is persisted locally in SQLite with a custom migration system supporting 25+ schema versions. The app features extensive home screen widgets (checkmark, score, streak, frequency, history, target), reminders with snooze, Tasker/Locale automation, CSV export, and import from other habit trackers (HabitBull, Rewire, Tickmate). External dependencies include AndroidX, Material Components, Ktor (for sync), AppIntro, and OpenCSV. The codebase demonstrates strong engineering practices: dependency injection via kotlin-inject, platform-agnostic canvas drawing for custom charts, a robust caching layer for list performance, and comprehensive test coverage including unit tests, instrumented UI tests, and snapshot-based rendering tests.

RATING8.3/10
QUALITY7.8/10
MAINTENANCEactive
DRIFTmedium
CONTRIBUTORS82
VELOCITY0.79
OPEN ISSUES53
CLOSED ISSUES718
LAST COMMIT2 months ago
Files by Type (count)
Kotlin
369
XML
161
Other (.png)
145
Text
142
Java
26
SQL
17
CSV
13
Markdown
7
Other (.kts)
5
Other (.ttf)
5
Other (.db)
5
Git Ignore
2
Files by Type (size)
Other (.png)
7MB
Other (.ttf)
1MB
XML
1MB
Kotlin
1MB
Java
226KB
Other (.db)
204KB
Text
174KB
Other (.jar)
57KB
CSV
43KB
Markdown
42KB
Other (.kts)
14KB
Shell
13KB

The LLM identified 6 files worth highlighting for reuse:

Defines a platform-independent Canvas interface for 2D drawing operations (lines, circles, text, images, clipping). Implementations exist for JVM (JavaCanvas) and JS (JsCanvas). This abstraction allows the core UI views (Ring, CheckmarkButton, BarChart, HistoryChart) to render identically across platforms without Android-specific dependencies. Highly reusable for any multiplatform project needing custom drawing.

file: uhabits-core/src/commonMain/kotlin/org/isoron/platform/gui/Canvas.kt ↗ | tags: #platform-abstraction #cross-platform #canvas-drawing

Defines the Command interface with a single `run()` method, implemented by concrete commands like CreateHabitCommand, DeleteHabitsCommand, CreateRepetitionCommand. The CommandRunner executes commands and notifies listeners (e.g., for widget updates). This pattern decouples business logic from UI and enables undo/redo, logging, and transactional execution. The interface is minimal and could be extracted into any application needing atomic, reversible operations.

file: uhabits-core/src/commonMain/kotlin/org/isoron/uhabits/core/commands/Command.kt ↗ | tags: #command-pattern #undoable-operations #transactional

A singleton-scoped cache that pre-fetches and stores computed data (scores, checkmarks, notes) for each habit in the list view. It refreshes asynchronously via a TaskRunner and notifies observers on data changes. This avoids repeated database queries during scrolling and provides a clean separation between data loading and UI rendering. The pattern of a reactive, scoped cache is reusable for any list-heavy UI with computed fields.

Orchestrates importing habit data from external apps (HabitBull, Rewire, Tickmate) by delegating to specialized importers. Each importer implements a common interface to parse foreign database formats and produce internal Habit/Entry objects. This adapter pattern makes adding new import sources straightforward. The GenericImporter itself is a clean orchestrator that could be reused for any multi-source data ingestion pipeline.

file: uhabits-core/src/commonMain/kotlin/org/isoron/uhabits/core/io/GenericImporter.kt ↗ | tags: #import-pattern #adapter-pattern #data-migration

Implements the habit strength computation using an exponential decay formula based on frequency and checkmark values. The algorithm is non-trivial and domain-specific, but the implementation is self-contained, well-tested, and could be extracted as a library for any application needing a similar scoring mechanism (e.g., gamification, productivity tools).

file: uhabits-core/src/commonMain/kotlin/org/isoron/uhabits/core/models/Score.kt ↗ | tags: #custom-algorithm #domain-logic #exponential-decay

Provides a base class for all home screen widgets, handling common concerns like dimension calculation (portrait/landscape), error states, and layout inflation. Subclasses (CheckmarkWidget, ScoreWidget, etc.) only need to implement `buildUpdate()` to populate RemoteViews. This pattern reduces widget boilerplate and ensures consistent behavior across widget types. The base class is tightly coupled to Android but the pattern is reusable for any app with multiple widgets.

file: uhabits-android/src/main/java/org/isoron/uhabits/widgets/BaseWidget.kt ↗ | tags: #android-widget #reusable-pattern #remote-views
Last analyzed: 2026-08-24 13:45:40.851650
Next check: 2026-08-31 13:45:40.849887
$ submit: