Skip to content

AlphsX/focus-states-preview

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

5 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Focus States - Productivity Timer Application

Focus States is a Java-based desktop productivity application that implements a Pomodoro-style focus timer with gamification elements. The application helps users improve concentration through timed focus sessions while rewarding them with virtual coins that can be used to unlock additional features.

๐ŸŒŸ Key Features

  • ๐Ÿ“… Customizable Timer: Set focus sessions from 1-60 minutes (default: 45 minutes)
  • ๐ŸŽฌ Visual Feedback: Animated GIF displays showing current state (waiting/focusing)
  • ๐ŸŽต Audio Management: Background music with mute/unmute functionality
  • ๐Ÿช™ Gamification System: Earn 10 coins for each completed session
  • ๐Ÿ”“ Unlockable Features: 9 different features that can be unlocked with earned coins
  • ๐Ÿ“Š Session Tracking: Statistics for total time, completed sessions, and earned coins
  • โธ๏ธ Break Functionality: Pause and resume focus sessions
  • ๐ŸŽฏ Clean GUI: Intuitive Swing-based user interface

๐Ÿ› ๏ธ Technology Stack

  • Language: Java SE 8+
  • GUI Framework: Java Swing
  • Audio: javax.sound.sampled API
  • Development Environment: BlueJ IDE compatible
  • Build System: Standard Java compilation

๐Ÿ—๏ธ System Architecture

Core Components

Component Responsibility Key Methods
FocusSystem Business logic, timer, audio, coins startCountdown(), toggleMute(), unlockFeature()
FocusFrame Main GUI window handleStart(), handleBreak(), handleCancel()
FocusRecapFrame Statistics and feature unlocking handleLockUnlock(), statistics display
CircularGIFPanel Visual feedback component setGif(), paintComponent()
FocusSystemListener Observer pattern interface Event callback methods

Design Patterns

  • Observer Pattern: FocusSystemListener interface enables loose coupling between business logic and GUI
  • Model-View-Controller: Clear separation between FocusSystem (Model), GUI classes (View), and event handlers (Controller)

๐Ÿš€ Installation & Setup

System Requirements

  • Java Version: Java SE 8 or higher
  • Operating System: Cross-platform (Windows, macOS, Linux)
  • Memory: Minimum 256 MB RAM
  • Storage: ~60 MB for application and assets

Compilation & Running

Command Line

# Navigate to project directory
cd "Focus States x1-preview"

# Compile all Java files
javac *.java

# Run the application
java FocusSystem

BlueJ IDE

  1. Open BlueJ IDE
  2. Open project folder containing Java files
  3. Right-click FocusSystem class
  4. Select "void main(String[] args)"

๐Ÿ“– Usage Guide

Starting a Focus Session

  1. Launch the application
  2. Optional: Click SET button to adjust timer (1-60 minutes)
  3. Click START button to begin focus session
  4. Application displays focus animation and starts countdown
  5. Background music plays automatically (unless muted)

Managing Audio

  • Click Mute/Unmute button (top-right) to toggle background music
  • Audio automatically starts during focus sessions
  • Mute state persists until manually changed

Using Break Feature

  • Click BREAK button during active session to pause
  • Click BREAK button again to resume
  • Or click CANCEL to abort session entirely

Unlocking Features

  1. Complete focus sessions to earn coins (10 coins per session)
  2. Click Home button to access Focus Recap window
  3. Click any Lock button to unlock features (10 coins each)
  4. Unlocked features display custom icons instead of lock symbol

Viewing Statistics

  • Total Time: Cumulative focus time across all completed sessions
  • Total Focus: Number of successfully completed sessions
  • Total Coins: Current coin balance (earned minus spent)

๐Ÿ“ Project Structure

Focus States x1-preview/
โ”œโ”€โ”€ FocusSystem.java          # Core business logic and main method
โ”œโ”€โ”€ FocusFrame.java           # Main GUI window
โ”œโ”€โ”€ FocusRecapFrame.java      # Statistics and unlocking window  
โ”œโ”€โ”€ CircularGIFPanel.java     # Custom GIF display component
โ”œโ”€โ”€ FocusSystemListener.java  # Observer interface
โ”œโ”€โ”€ images/                   # UI buttons and icons (required)
โ”‚   โ”œโ”€โ”€ LOGO.png
โ”‚   โ”œโ”€โ”€ StartBTN.png
โ”‚   โ”œโ”€โ”€ BreakBTN.png
โ”‚   โ”œโ”€โ”€ CancelBTN.png
โ”‚   โ”œโ”€โ”€ Lock.png
โ”‚   โ”œโ”€โ”€ Unlock1-9.png
โ”‚   โ””โ”€โ”€ ...
โ”œโ”€โ”€ gifs/                     # Animation assets (required)
โ”‚   โ”œโ”€โ”€ waiting.gif
โ”‚   โ””โ”€โ”€ penguin.gif
โ”œโ”€โ”€ musics/                   # Audio files (required)
โ”‚   โ””โ”€โ”€ M5.wav
โ””โ”€โ”€ README.md                 # This file

Asset Dependencies

โš ๏ธ Important: The application requires specific asset files to function properly:

  • Images: 22+ PNG files for buttons, icons, and unlockables
  • GIFs: 2 animation files for visual feedback
  • Audio: 1 WAV file for background music
  • Missing Assets: Application will display error messages if files not found

๐ŸŽฎ Gamification System

Coin Economy

  • Earning Rate: 10 coins per completed focus session
  • Spending: 10 coins per feature unlock
  • Features: 9 unlockable features (IDs 1-9)
  • Persistence: In-memory storage (resets on application restart)

Unlockable Features

Feature ID Unlock Cost Visual Asset Status
1-9 10 coins each Unlock{ID}.png Tracked in boolean array

๐Ÿงช Testing

Manual Testing Checklist

Timer Functionality

  • Timer displays correct initial value (45:00)
  • Timer counts down every second when started
  • Timer stops at 00:00 and shows completion message
  • Custom time setting (1-60 minutes) works correctly
  • Timer resets properly after completion or cancellation

Audio System

  • Background music plays during focus sessions
  • Mute button toggles audio on/off
  • Audio stops when session ends or is cancelled
  • Mute button icon updates correctly

UI Interactions

  • All buttons respond to clicks
  • Button visibility changes correctly based on state
  • GIF animations switch between waiting and focus states
  • Coin counter updates when sessions complete
  • Focus Recap window opens and closes properly

Feature Unlocking

  • Lock buttons display correctly (locked/unlocked states)
  • Unlock confirmation dialog appears
  • Coins deduct properly when features unlocked
  • Unlocked features show custom icons
  • Insufficient coins shows error message

โš ๏ธ Known Issues & Limitations

Current Limitations

  • Data Persistence: Application state resets on restart (coins, unlocked features)
  • Asset Dependencies: Hard-coded file paths may cause issues if assets moved
  • Audio Format: Limited to WAV format for background music
  • Single Session Type: Only focus sessions, no break timer implementation

Error Scenarios

  • Missing Assets: Application displays error messages but continues running
  • Audio Initialization: Fails gracefully if audio system unavailable
  • Timer Precision: May drift slightly over very long sessions

๐Ÿ”ฎ Future Enhancements

  • Data Persistence: Implement file-based or database storage
  • Multiple Timers: Add break timer and long break functionality
  • Customization: User-selectable themes, sounds, and animations
  • Statistics Enhancement: Historical data tracking and charts
  • Notification System: System notifications for session completion
  • Keyboard Shortcuts: Hotkey support for common actions

๐Ÿ‘ฅ Authors

Pomodoro Timer App | Focus States ยฉ 2024

๐Ÿ“„ License

This project is part of an academic assignment and is intended for educational purposes.


Get focused, stay productive! ๐ŸŽฏ

About

๐ŸŽฏ Focus States โ€ข Gamified Pomodoro timer to boost focus and productivity

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages