Skip to content

Project Structure

Adi Andrea edited this page Oct 15, 2024 · 2 revisions

In this boilerplate project, you'll find some directory in app/src/main/java/<YOUR_PACKAGE_NAME>:

├── App.kt
├── base
│   ├── AppViewModelFactory.kt
│   ├── BaseActivity.kt
│   ├── BaseFragment.kt
│   └── BaseViewModel.kt
├── data
│   ├── AppDatabase.kt
│   ├── DataManager.kt
│   ├── PreferencesHelper.kt
│   └── local
│       └── pokemon
│           ├── LocalPokemon.kt
│           └── LocalPokemonDao.kt
├── di
│   ├── component
│   │   └── AppComponent.kt
│   ├── modules
│   │   ├── AppModule.kt
│   │   ├── BuildersModule.kt
│   │   ├── FragmentBuildersModule.kt
│   │   ├── NetworkModule.kt
│   │   └── ViewModelModule.kt
│   └── scopes
│       ├── ActivityContext.kt
│       ├── ApplicationContext.kt
│       └── ViewModelKey.kt
├── feature
│   ├── detailpokemon
│   │   ├── DetailPokemonActivity.kt
│   │   ├── DetailPokemonViewModel.kt
│   │   ├── TabAdapter.kt
│   │   ├── TypeAdapter.kt
│   │   ├── basestat
│   │   │   ├── BaseStatAdapter.kt
│   │   │   ├── BaseStatFragment.kt
│   │   │   └── BaseStatViewModel.kt
│   │   └── moves
│   │       ├── MovesAdapter.kt
│   │       ├── MovesFragment.kt
│   │       └── MovesViewModel.kt
│   └── listpokemon
│       ├── ListPokemonActivity.kt
│       ├── ListPokemonAdapter.kt
│       ├── ListPokemonDataSource.kt
│       ├── ListPokemonRemoteMediator.kt
│       └── ListPokemonViewModel.kt
├── model
│   └── api
│       ├── detailpokemon
│       │   └── DetailPokemonResponse.kt
│       └── pokemon
│           ├── Pokemon.kt
│           └── PokemonResponse.kt
├── network
│   └── ApiService.kt
└── util
    ├── CommonUtil.kt
    └── NetworkState.kt

base

Contains classes that used for abstraction used to provide a common interface and implementation for its subclasses. Which is for our case will be used to be implemented on our activities, fragments, and viewmodels.

data

Contains classes that responsible for accessing app data. DataManager class will have important role to give & manage access to local database, shared preferences, and API endpoint.

di

Contains classes that responsible to manage Dependency Injection using Dagger 2.

feature

This directory will be the place that mostly we working on. It is should be contains sub directory that represents specific app feature such as authentication, home page, detail product, etc.

model

As the name suggest, all Model or Data classes should be stored here. Usually the data we get from the API.

network

Contains our implementations of the API endpoints defined by the service interface.

util

Contains helper class that we can used to make life simpler.

Clone this wiki locally