MF project specific implementation steps and source code
- Project framework diagram
- Specific architecture
-
- BaseModel
- Two, SharePreferenceUtil (only used in Repository
- Three or five Entity classes (corresponding to the four interfaces, a new Entity class will be added according to the requirements)
- Four, Constants
- 、 Repository extends BaseModel
- 六、BaseViewModel 《M extends Repository 》extends ViewModel
- 七、VehicleApplication extends Application
- Icle 、 VehicleViewModel extends BaseViewModel 《Repository》
- Specific interface class
- other
Project framework diagram
Reference: MF project overall framework diagram
Specific architecture
BaseModel
Source code and analysis: BaseModel source code and analysis
Two, SharePreferenceUtil (only used in Repository
Source code and analysis: SharePreferenceUtil source code and analysis
Three or five Entity classes (corresponding to the four interfaces, a new Entity class will be added according to the requirements)
Source code and analysis: AssistDrivingEntity, CommonEntity, DrivingPreferenceEntity, VehicleSettingEntity, PowerDrivingEntity source code and analysis
Four, Constants
Source code and analysis: Constants source code of MF tools
、 Repository extends BaseModel
Source code and analysis: Repository extends BaseModel source code and analysis (compared to a core class)
六、BaseViewModel 《M extends Repository 》extends ViewModel
Source code and analysis: BaseViewModel source code and analysis
七、VehicleApplication extends Application
Source code and analysis: VehicleApplication source code and analysis
Icle 、 VehicleViewModel extends BaseViewModel 《Repository》
Source code and analysis: VehicleViewModel extends BaseViewModel<Repository> source code and analysis
Specific interface class
One, BaseActivity
二、BaseFragment
3. SettIng_item.xml corresponding to custom View SettingItemView, including SwitchCompat
Custom View's setting_item.xml source code and analysis (including SwitchCompat)
4. Customize View SettingItemView.java, including attrs.xml
Custom View SettingItemView.java source code and analysis (including custom attributes attrs.xml)
Five, activity_main.xml and MainActivity.java
Activity_main.xml source code and analysis
MainActivity extends BaseActivity<ActivityMainBinding, VehicleViewModel> source code and analysis
Six, four Fragments and corresponding xml
A simple code example
(1) assist_driving_fragment.xml and AssistDrivingFragment source code and analysis
A relatively detailed example of the function, namely the driving preference page, contains switches and settings
(2) driving_preference_fragment.xml and DrivingPreferenceFragment source code and analysis are the
same as 2, and the remaining two The effect and source code are directly implemented on the interface, without specific analysis:
(3) common_user_fragment.xml and CommonUserFragment source code
(4) vehicle_setting_fragment.xml and VehicleSettingFragment source code
other
One, AndroidManifest.xml
MF project AndroidManifest.xml source code and analysis
二、build.gradle(app)
Build.gradle (app) source code and analysis