Skip to content

Chrizz-coder/OOPS-PROJECT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zenith Habit Tracker

A lightweight Java Swing application for tracking habits, viewing completion streaks, and visualizing progress with a calendar heatmap.

Zenith Habit Tracker UI

✨ Features

  • Create, edit, and delete habits
  • Daily logging with one-click toggle for today and yesterday
  • Streak tracking (current + longest)
  • Scrollable log history per habit
  • Heatmap calendar panel for visual streak overview
  • Lightweight embedded SQLite persistence (single file habits.db)
  • Theming utilities (LightTheme) for future style expansion
  • Scaled UI based on a runtime factor for HiDPI displays

🗂 Project Structure

habit-tracker/
  src/
    com/crizz/zenith/
      App.java                # Entry point (bootstraps UI + scaling)
      dao/                    # Data access layer (SQLite + in-memory flags)
      model/                  # POJOs representing domain entities
      service/                # Business logic & streak computation
      ui/                     # Swing UI components (frame, heatmap, theme)
  lib/                        # Third-party libraries (e.g., sqlite-jdbc)
  bin/                        # (Ignored) Compiled classes output
  habits.db                   # Local user data (ignored by git)
  README.md                   # This documentation
  .gitignore

🧱 Architecture

Layered design:

  • Model: Habit, HabitLog
  • DAO: HabitDAO, HabitLogDAO + HabitLogDAOImpl, DatabaseManager
  • Service: HabitService (habit CRUD + date marking), HabitLogService (logs + streak logic)
  • UI: HabitTrackerFrame, HeatmapPanel, LightTheme
  • Bootstrap: App

The DAOs isolate SQL + persistence. Services provide higher-level operations and enforce invariants (e.g., avoiding duplicate date marks). UI remains thin and event-driven.

Streak Logic

Current streak walks logs backward from today, counting consecutive completion days. Longest streak scans chronologically, accumulating ranges of sequential days.

Heatmap

HeatmapPanel queries completion dates in a range and renders a simple streak calendar block grid. (See code for details.)

🚀 Getting Started

Prerequisites

  • Java 17+ (tested) — earlier versions supporting text blocks (Java 15+) likely work
  • SQLite JDBC driver (included in lib/sqlite-jdbc-<version>.jar)

Build & Run (Manual javac)

From the project root (habit-tracker):

# Compile
javac -d bin -cp lib/sqlite-jdbc-3.50.3.0.jar $(find src -name "*.java")

# Run
java -cp bin:lib/sqlite-jdbc-3.50.3.0.jar com.crizz.zenith.App

(Use ; instead of : as the classpath separator on Windows.)

Login & Users

  • Default user is created automatically: username "dude", password "dude".
  • Start app → Login screen → you can login with default credentials or register a new user.
  • Each user has separate habits and logs.

Run in VS Code

A launch configuration is already present under .vscode/launch.json. Open the folder in VS Code and press F5 (ensure Java extensions are installed).

🗃 Persistence

The SQLite file habits.db is created in the working directory if missing. It's ignored by git to prevent leaking personal activity data. Deleting it resets the app state.

🧪 Testing (Suggested Future Work)

Planned additions:

  • JUnit 5 tests for streak calculations (HabitLogService)
  • DAO integration tests using in-memory SQLite (jdbc:sqlite::memory:)

🎨 Theming

LightTheme centralizes gradient tokens (currently used minimally). Additional palette strategies or dark mode can extend this pattern.

📸 Screenshots

Add a screenshot named screenshot-main.png under docs/images/ (already referenced above). Example command (Linux):

# While app is running
import -window "Zenith Habit Tracker" docs/images/screenshot-main.png

(Or use your OS screenshot tool.)

🤝 Contributing

  1. Fork the repo
  2. Create a feature branch: git checkout -b feature/some-improvement
  3. Commit changes: git commit -m "Add some improvement"
  4. Push branch: git push origin feature/some-improvement
  5. Open a Pull Request

Coding style: keep classes focused, avoid static coupling in services, and prefer constructor injection for new dependencies (already used in HabitLogService).

🐛 Troubleshooting

Issue Cause Fix
SQLite driver missing JAR not on classpath Ensure -cp lib/sqlite-jdbc-*.jar in compile & run
UI very large/small Scale factor Adjust SCALE constant in App.java
No habits persist Deleted habits.db This resets state intentionally

📄 License

Add a license of your choice (e.g., MIT) by creating a LICENSE file. Current code is unlicensed (all rights reserved by default).

🔮 Roadmap Ideas

  • Dark theme + custom color picker
  • Export/import habits + logs (JSON)
  • Weekly / monthly analytics panel
  • Notification / reminder integration (desktop or email)
  • Multi-device sync (switch to remote backend)

📚 Acknowledgements

  • SQLite JDBC driver (Xerial)
  • Swing — still alive and productive for fast desktop tools

Happy tracking and stay consistent! 🌱

About

No description, website, or topics provided.

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors