There's a class group that's having trouble classifying packages.

Asked 1 years ago, Updated 1 years ago, 108 views

Based on MVC, we are currently classifying as described below.
I'm worried about what to do with the class in the last Other Fragment related.

I have designed mainly 1 screen 1 Fragment 1 custom ViewGroup [1DataLoader1Data].
I created a custom ViewGroup because I didn't want to new the class that corresponds to the view and
This eliminates the need to pass rootView from Fragment to the class.
Such Fragments are mainly generating DataLoader and Setting.

Class groups that are struggling with classification are class groups that define such custom ViewGroup and screen settings.
HeaderViewCreator is also Custom ViewGroup and I was going to take the Creator, but
There is a description that the controller should do, so it is left as it is.
There are other descriptions that the controller should do in PagerView and PhotoListView as well. It may be mixed.
Also, shouldn't Setting be custom View?What would you do with your name?
It's left as it is.
Also, LoginFragment and DialogFragment-based are not sure if separation is meaningful. It's left as it is.

At least not strictly MVC, but Other Fragment-related classes are acceptable to you.
I wish I could sort it into one package or multiple packages by organizing the contents as needed, but I don't know what to do.

View line can be summarized as view_controller even if controller is mixed
I think so, but what about other Setting?Don't you need SettingPhoto in the first place?
That's what it looks like.

There may be some parts that are not good for the original design, but
Please give me some advice.

route
├-- MainActivity --------------------------------------------------------------------------------------------------
├-- base------------------------------------------------------
│   -- --BaseDialogFragment --------------------- Base Class for DialogFragment
│   -- -- BaseFragment --------------- Fragment Base Class
│   ----BindableAdapter----------------- Adapter Base Class
├-- fragment ----------------------------------------------------------------------------------------------
│   -- --HeaderFragment ------------------------------------------------------------------------
│   -- --LoginFragment --------------------- Login Screen
│   -- --PhotoFragment --------------------------------------------------------
│   -- --PhotoListFragment ------------------------------------------------------
│   -- --PriceListFragment ---------------------- Price List Screen
│   -- -- WebViewFragment --------------- WebView Screen
│   ----dialog--------------------------------------------------------------------------
│       -- --ConfirmDialogFragment ----- Confirmation Dialog
│       -- -- MessageDialogFragment ----- Display Dialog
├-- model ------------------------------------------------------
│   ----Api--------------------------------------------------------------
│   -- -- AppController ----------------- Application Volley Management
│   -- --PagerData --------------------------------------------------------------------------------
│   -- --PagerDataLoader --------------------------------------------------------------------------------------
│   -- --PhotoDownloader ------------------------------------------------------------------------
│   -- --PhotoItem ------------------------------------------------------------------------------
│   -- -- PhotoListData ----------------------------------------------------------------------------------
│   -- --PhotoListDataLoader --------------------------------------------------------------------------------------
│   -- -- PriceItem ------------------------------------------------------------------------------
│   -- -- PriceListData ------------------------------------------------------------------------------
│   -- --PriceListDataLoader ----------------------------------------------------------------------------------
│   -- --User ------------------------------------------------------------------------------------
│   -- --UserEvent ------------------------------------------------------------------------------------
│   ----Watermark--------------------------------------------------------------------------------------------------------
├-- utility ----------------------------------------------------------
│   ----Animation------------------------------------------------------------------------
│   -- --UrlUtility ----------------------------------------------------------------------------------
├-- view --------------------------------------------------------------------------------
│   -- --CategoryView ------------------------- Custom TextView for Category Names
│   -- --PhotoView --------------------------------------------------------------------------------
│   -- --ScalingPhotoView ----------------------------------------------------------------------------------------------
│   ----------------------------------------------------------------------
│       -- --PhotoListAdapter --------------------------------------------------------------------------------------
│       ----PriceListAdapter----------------- Custom BindableAdapter for Price Listing Custom BindableAdapter
└-- Other Fragment related items ----------------------------------------------------------------------------------------
    ├-- HeaderViewCreator --------------- Header Settings and Behavior Definitions
    ├-- PagerView ------------------------- Custom FrameLayout for Photo Listing Pager
    ├-- PhotoItemView ------------------------------------------------------------------------------------------------
    ├-- PhotoListView --------------------------- PhotoListFragment Custom LinerLayout
    ├-- PriceListView ----------------------------------------------------------------------------------------------------
    ├-- SettingPhoto ------------------------- Just ask ScalingPhotoView to load
    └-- SettingWebView --------------------- Define WebView Configuration and URL Behavior

android mvc

2022-09-30 20:58

1 Answers

There are various opinions about MVC, so please refer to it.

So far, I have classified it as follows.

  • Controller
    • Entry points for processing (onCreate, onClick, etc.)
    • Instructing the Model to handle events such as UI operations
    • Activity, Fragment, etc. are mainly affected
    • Depending on the design, BroadcastReceiver or Service may be affected
  • View
    • Class Inherited from View (Custom View)
  • ModelViewAdapter
    • Bridge between Model and View, such as ArrayAdapter
  • Model
    • Anything that does not belong to the controller or View
    • When the Model is updated, notify View and so on to update it
  • Entry points for processing (onCreate, onClick, etc.)
  • Instructing the Model to handle events such as UI operations
  • Activity, Fragment, etc. are mainly affected
  • Depending on the design, BroadcastReceiver or Service may be affected
  • Class Inherited from View (Custom View)
  • Bridge between Model and View, such as ArrayAdapter
  • Anything that does not belong to the controller or View
  • When the Model is updated, notify View and so on to update it


2022-09-30 20:58

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.