Skip to content

Real-world Android interview challenges built with Jetpack Compose, Kotlin Coroutines, and Clean Architecture — a hands-on guide for modern Android development.

Notifications You must be signed in to change notification settings

AlaaEddinAlbarghoth/AndroidMastery

Repository files navigation

JetpackPrep (Kotlin • Jetpack Compose • Hilt • Retrofit • Room • Paging)

A realistic Android interview practice app built with modern Jetpack libraries — designed to sharpen your architecture and UI skills.

🔍 Features

  • Fetch posts from a public REST API (JSONPlaceholder)
  • Display a paginated list with integrated search and filtering
  • Navigate to details screens for individual items
  • Work offline with Room database and a RemoteMediator for caching & sync
  • Preserve state safely across configuration changes using ViewModel and SavedStateHandle

🚀 Quickstart

Requirements

  • Android Studio Hedgehog or newer (JDK 17)
  • Android SDK 26+

Run

  1. Open the project in Android Studio.
  2. Sync Gradle.
  3. Run the app configuration on an emulator or device.

Network: The app uses https://jsonplaceholder.typicode.com/ and does not require keys.


🧱 Tech Stack

  • Kotlin, Coroutines/Flow
  • Jetpack Compose + Material 3 + Navigation
  • Hilt for Dependency Injection
  • Retrofit + OkHttp + Kotlinx Serialization for networking/JSON
  • Room for local cache
  • Paging 3 with RemoteMediator (offline-first)

🧭 Architecture

  • MVVM + Repository
  • UI (Compose) observes StateFlow from ViewModels
  • Repository coordinates network ↔ database
  • RemoteMediator handles sync/pagination between server and Room
UI (Compose) ──observes──▶ ViewModel ──calls──▶ Repository ──▶ Retrofit (API)
                                         │
                                         └──▶ Room (Local cache)

📂 Project Structure (suggested)

app/
  src/main/java/<your.package>/
    app/                    # App-wide bootstrapping (Application, DI)
    common/                 # Result wrappers, utils, constants
    data/                   # remote/ (Retrofit), local/ (Room), paging/, repository/
    domain/                 # models/, usecases/ (optional)
    presentation/           # ui/, screens/, components/, nav/
      ui/theme/             # Theme (colors/typography)

🖥️ Main Activity (Compose entry)

Minimal example:

@AndroidEntryPoint
class MainActivity : ComponentActivity() {
  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContent {
      InterviewTheme {
        AppNavGraph() // startDestination = Home
      }
    }
  }
}

🔍 Features

  • Search with debounce + flatMapLatest
  • Paging list (append/loading states, error/retry)
  • Offline‑first (airplane mode after first load)
  • Safe state on rotation (SavedStateHandle)
  • Clean layering & DI

🧪 Testing (starter ideas)

  • Unit: Repository + ViewModel (fake API/DAO, kotlinx-coroutines-test)
  • UI: Compose tests for the list & details render

🧰 Troubleshooting

  • Build fails JDK: Ensure Gradle JVM is set to 17 (File → Settings → Build Tools → Gradle).
  • No internet: Check emulator has network or try on device.
  • Room schema change: For quick iteration, use fallbackToDestructiveMigration() (already enabled in sample) but avoid for production.

📌 Roadmap / Practice Tasks

  • Add Retry UI for network errors
  • Replace details workaround with DAO.getById(id)
  • Add UI & unit tests
  • Real server paging; remove client‑side slicing
  • CI (GitHub Actions) for build & lint

📜 License

MIT

Dev: ALAA EDDIN ALBARGHOTH

About

Real-world Android interview challenges built with Jetpack Compose, Kotlin Coroutines, and Clean Architecture — a hands-on guide for modern Android development.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages