简体   繁体   中英

Where should i put downloader classes in MVVM?

I've written a download manager app for Android. Now i want to refactor it's structure to MVVM. but i have some questions.

  1. Into what layer I should move downloader classes such as DownloadManager.java (which manages download queue, etc), Downloader.java (which creates an empty file then downloads data and write into that empty file), etc?

  2. into what layer i should move Application class which is responsible for creating database for the first time?

thanks.

Let's say you have 3 layers,

  • View(Activities, Fragments, CustomView, ..)
  • BusinessLogic(Presenter, Viewmodel, ..)
  • Data(Repository, ..)

Downloader.java should be in the Data layer

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM