Skip to content

abdemirza/leetcode-streak-widget

Repository files navigation

πŸ”₯ LeetCode Streak Widget

A beautiful Android home screen widget inspired by Duolingo's streak feature, designed to help you stay consistent with your LeetCode practice.

Widget Preview React Native Kotlin

✨ Features

  • πŸ”₯ Fire Icons: Completed days show with fire emojis instead of boring checkmarks
  • πŸ“Š Live Streak Tracking: Real-time streak updates from your LeetCode profile
  • πŸ“… 7-Day Rolling View: Shows the last 7 days with today always as the last day
  • πŸ“ˆ Statistics: Total solved problems, longest streak, and difficulty breakdown
  • πŸ”„ Auto-Refresh: Updates every 30 minutes automatically
  • 🎯 Manual Refresh: Tap the refresh button for instant updates
  • 🎨 Modern UI: Clean, Duolingo-inspired design that fits perfectly on your home screen

πŸ“± Screenshots

Widget on Home Screen

Widget Screenshot

App Dashboard

App Screenshot

πŸš€ Quick Start

Download & Install

Download APK

Latest Release: v1.0.0

Installation Steps

  1. Download the APK from the link above
  2. Enable Unknown Sources:
    • Go to Settings β†’ Security β†’ Unknown Sources (Android 7 and below)
    • Or Settings β†’ Apps β†’ Special Access β†’ Install Unknown Apps (Android 8+)
  3. Install the APK by tapping on the downloaded file
  4. Add Widget to Home Screen:
    • Long press on your home screen
    • Tap the "+" button
    • Search for "LeetCode Streak"
    • Select the widget size and tap "Add Widget"
  5. Configure in App:
    • Open the LeetCode Streak app
    • Enter your LeetCode username
    • Tap "Save"

πŸ› οΈ Development

Prerequisites

  • Node.js >= 20.19.4
  • React Native CLI
  • Android Studio
  • Java Development Kit (JDK)

Setup

# Clone the repository
git clone https://github.com/YOUR_USERNAME/LeetcodeStreakWidget.git
cd LeetcodeStreakWidget

# Install dependencies
npm install

# For Android
cd android
./gradlew clean
cd ..

# Run the app
npm run android

Building Release APK

# Build release APK
cd android
./gradlew assembleRelease

# APK will be generated at:
# android/app/build/outputs/apk/release/app-release.apk

πŸ—οΈ Architecture

Tech Stack

  • Frontend: React Native 0.82.0
  • Backend: LeetCode GraphQL API
  • Widget: Native Android (Kotlin)
  • Data Storage: AsyncStorage + SharedPreferences
  • State Management: React Hooks

Project Structure

β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/          # React Native components
β”‚   β”œβ”€β”€ services/           # API and storage services
β”‚   └── screens/            # App screens
β”œβ”€β”€ android/
β”‚   β”œβ”€β”€ app/src/main/
β”‚   β”‚   β”œβ”€β”€ java/com/leetcodestreakwidget/
β”‚   β”‚   β”‚   β”œβ”€β”€ LeetCodeWidgetProvider.kt    # Widget logic
β”‚   β”‚   β”‚   β”œβ”€β”€ WidgetDataService.kt         # Data management
β”‚   β”‚   β”‚   └── WidgetBridgeModule.kt        # React Native bridge
β”‚   β”‚   └── res/
β”‚   β”‚       β”œβ”€β”€ layout/                    # Widget layouts
β”‚   β”‚       └── drawable/                   # Icons and graphics
└── README.md

Key Components

React Native Side

  • LeetCodeAPI: Fetches user data from LeetCode GraphQL API
  • WidgetService: Manages data synchronization with native widget
  • StorageService: Handles local data persistence

Native Android Side

  • LeetCodeWidgetProvider: Main widget provider handling updates
  • WidgetDataService: Manages widget data storage
  • WidgetBridgeModule: Bridge between React Native and native code

πŸ”§ Configuration

Widget Settings

The widget automatically updates every 30 minutes. You can manually refresh by:

  • Pulling down in the app
  • Tapping the refresh button on the widget

Data Sources

  • LeetCode Username: Your public LeetCode profile
  • Submission Calendar: Daily coding activity data
  • Statistics: Total solved problems by difficulty

🎯 How It Works

  1. Data Fetching: App fetches your LeetCode data via GraphQL API
  2. Streak Calculation: Calculates consecutive days with submissions
  3. Widget Update: Native Android widget displays the data
  4. Auto-Refresh: Widget updates automatically every 30 minutes

Streak Logic

The widget shows a 7-day rolling window:

  • Day 1-6: Previous days (6 days ago to yesterday)
  • Day 7: Today (always the rightmost day)
  • Fire Icons: Days with LeetCode submissions
  • Gray Circles: Days without submissions

🀝 Contributing

We welcome contributions! Please feel free to submit a Pull Request.

Development Guidelines

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Inspired by Duolingo's streak feature
  • LeetCode for providing the API
  • React Native community for excellent documentation
  • Android widget development community

πŸ“ž Support

If you encounter any issues or have questions:

  1. Check the Issues page
  2. Create a new issue with detailed description
  3. Include screenshots if applicable

πŸŽ‰ Show Your Support

Give a ⭐️ if this project helped you stay consistent with your coding practice!


Happy Coding! πŸ”₯ Keep that streak alive! πŸ’ͺ

About

A simple widget to track your streak

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors