DEV Community

Niranjan Lamichhane
Niranjan Lamichhane

Posted on

From Broken Loop to Duolingo for Kotlin

I have an app called KOtlin Quiz, which is just a pet project. Previously, it was done and updated in the F-Droid store. However, it was just a one-time throwaway project with lots of problems and errors. The UI flow of the app is broken, the progress bar is not showing appropriate value, the user has to press twice the answer to go to the next question. Users have no idea where they are and how many questions have been solved and how many are remaining.

The main problem is that the loop of answer→question never gets completed and reaches the final page. So I found this project suitable for taking part in GitHub Finish-Up-A-Thon Challenge when it runs from May 15th to June 7th.

During this time, I aimed to do at least the following:

  • Fix the broken UI flow, complete the loop, and take it to the final result page
  • Progress bar showing the progress of the journey
  • Question-answer screen updated for minimal user interaction
  • Use some gamification techniques to enhance it
  • Change the app to make it a Duolingo for Kotlin

Phase 1: Fixing UI

I started with fixing the UI loop. From initial observation, I found that the UI loop is not broken the first time when a user opens it — it will go smoothly and reach up to the final page. In subsequent sessions, when the user enters the Q&A session, only then does the user enter into the endless loop.

During the fixes, I discovered more than what was initially thought. The quiz was getting stuck in a loop because:

  • It didn't know when to stop
  • It was sometimes reading the wrong quiz's data
  • It was carrying over answered questions from old sessions
  • Tapping the right answer was often marked wrong due to a numbering mismatch

I applied the following to solve the above:

  • Scoped answered progress to the current quiz instead of the global question table
  • Unified quiz ID across answers, scores, and navigation
  • Cleared stale unfinished quizzes when a new session starts
  • Switched answer validation to ID-based comparison instead of index math
  • Ended the quiz only when all questions in the current session are answered

The pull request was raised with the above-mentioned fixes, closing issues #15 and #18.

Pull Request: https://github.com/NiranjanNlc/Kotilin-Quiz/pull/19


Phase 2: Fixing Progress and Results

Once the loop worked, the next pain points were visibility and trust.

Result screen accuracy — The result page had been showing stale data such as a fixed name and score (for example, always "Niranjan" and "50"). That was not hardcoded UI text; it came from loading the wrong finished quiz from the database. The fix was to load results by the current quiz ID and show the real score as X out of Y.


Phase 3: Jetpack Compose and Gamification

With core logic stable, the UI was rebuilt with Jetpack Compose.

Quiz Screen

  • Large, full-width answer cards — one tap gives immediate feedback
  • Centered question text with minimal chrome
  • Top bar with quit (✕), segmented progress, hearts, and streak flame
  • Correct answers: green fill, bounce animation, checkmark
  • Wrong answers: red fill, shake animation, correct option highlighted
  • Floating feedback toast instead of option-like banners
  • Auto-advance after a short feedback delay (~3.5s)

Result Screen

  • XP bar animation on entry
  • Score count-up animation
  • Level-up badge pop
  • Top 10 leaderboard
  • Duolingo-style messaging:
    • Top 10: "You made it to the Top 10!"
    • Otherwise: encouraging messages to try again
  • Clear exit paths: Play Again and Back to Home, with navigation stack cleanup

Phase 4: Content and Scale

  • Expanded from 5 to 20 questions per session, drawn randomly from 100 questions in question.json
  • Session hearts (3 lives) and streak counter for light gamification

Phases 2, 3, and 4 are encompassed in the following pull request, which also closes issue #14 since the progress bar is replaced by progress tracking and three hearts.

Pull Request: https://github.com/NiranjanNlc/Kotilin-Quiz/pull/20


Outcome

What began as a broken F-Droid side project is now a stable, demonstrable Android app with:

  • A complete Welcome → Quiz → Results → Home flow
  • Honest progress and scoring
  • Modern Compose UI with purposeful gamification
  • Fixes for long-standing bugs and issues mentioned on GitHub

The GitHub Finish-Up-A-Thon Challenge gave this throwaway quiz a second life — not as a perfect Duolingo clone, but as a project I can confidently show recruiters: one where I diagnosed layered bugs, improved architecture, modernized the UI, and shipped a coherent user experience end to end.

Top comments (0)