Skip to content

giovergos/study-buddy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Study Buddy 📚

An Android flashcard app with spaced repetition (SM-2 algorithm) for efficient long-term memorization.

Platform Language MinSDK TargetSDK License

✨ Features

  • 📇 Multiple decks — organize cards by subject (languages, biology, programming, etc.)
  • 🧠 SM-2 spaced repetition algorithm — the same algorithm used by Anki, schedules each card for review at optimal intervals based on user performance
  • 📊 Statistics dashboard — track day streak, retention rate, total reviews, and a 7-day activity chart
  • 🎨 Material Design 3 — modern, clean UI with proper theming and accessibility support
  • 💾 Offline-first — all data stored locally in SQLite, no internet required
  • 🚀 Lightweight — small APK size, no third-party charting libraries (custom BarChartView)

📸 Screenshots

Home Study Session Statistics
Home Study Stats

🏗 Architecture

The project follows a clean, layered architecture:

app/src/main/java/com/example/studybuddy/
├── MainActivity.java         ← decks list (entry point)
├── DeckActivity.java         ← cards inside a deck
├── StudyActivity.java        ← study session with SRS grading
├── AddCardActivity.java      ← create / edit card form
├── StatsActivity.java        ← statistics dashboard
├── model/                    ← POJOs: Deck, Card, ReviewLog
├── database/                 ← SQLiteOpenHelper + Repository pattern
├── adapter/                  ← RecyclerView adapters
└── util/
    ├── SpacedRepetition.java ← SM-2 algorithm implementation
    └── BarChartView.java     ← custom View for the 7-day chart

Key design decisions

  • Repository pattern: Activities never touch the database directly — all SQL is centralized in StudyRepository.java
  • Foreign keys with ON DELETE CASCADE: deleting a deck automatically removes its cards and review logs
  • Custom chart view: no MPAndroidChart or similar dependency, keeping the APK small

🧮 The SM-2 algorithm

Each card stores SRS state (easeFactor, intervalDays, repetitions, dueDate). When the user grades a card:

Grade Effect
Again (forgot) Reset progress, decrease ease, show again in 10 min
Hard Normal interval × 0.8
Good Normal interval × ease factor
Easy Normal interval × 1.3, increase ease factor

The interval grows exponentially for correctly remembered cards (1 day → 6 days → ~15 days → ~37 days...), so well-known cards appear rarely while forgotten ones come back quickly.

🚀 Building from source

Requirements

  • Android Studio Hedgehog (2023.1.1) or newer
  • JDK 17
  • Android SDK 34

Steps

  1. Clone the repository:
    git clone https://github.com/giovergos/study-buddy.git
  2. Open the project in Android Studio (File → Open → select the StudyBuddy folder)
  3. Wait for Gradle sync to complete
  4. Build APK: Build → Generate App Bundles or APKs → Generate APKs
  5. The APK will be at app/build/outputs/apk/debug/app-debug.apk

🗃 Database schema

Three tables with proper foreign key relationships:

decks       (_id, name, description, created_at)
cards       (_id, deck_id, front, back, ease_factor, interval_days,
             repetitions, due_date, created_at)
review_logs (_id, card_id, quality, reviewed_at)

🛠 Tech stack

  • Language: Java 8
  • UI: AndroidX AppCompat, Material Components 1.11
  • Persistence: SQLite via SQLiteOpenHelper
  • Architecture: Repository pattern, no external frameworks
  • Min API: 24 (Android 7.0)

📝 License

MIT License — feel free to use this code for learning or your own projects.

🙋 About

Built as a university assignment to demonstrate Android development fundamentals: multiple Activities, persistent storage, Material Design, clean code practices, and a touch of algorithmic substance via the SM-2 implementation.

About

Android flashcard app with SM-2 spaced repetition algorithm.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages