“This is the second day of my participation in the Gwen Challenge in November. See details: The Last Gwen Challenge in 2021”
Settings screen loading
(The source of the Settings section is under Packages /Settings)
Android system source code, the Settings module has more than 20 or 30 functions, including wifi, Bluetooth, NFC, screen Settings and other important function modules.
Androidmanifest.xml shows that the entry is the Settings class, which inherits from SettingsActivity and does not override any lifecycle functions. It just defines some empty implementation of the inner class, which launches a separate class when a shortcut is created. The Activity on the main interface of the Setings module is Settings. The Activity on the subinterface of the Setings module is SubSettings
SettingsActivity:
1. MIsShowingDashboard obtains the current class name, determines the loading layout based on the class name, and determines whether the current is Settings or SubSettings to determine which layout is displayed.
LaunchSettingFragment (initialFragmentName, isSubSettings, Intent)
(1) First call the getMetaData() method, which gets the fragmentClass value from the Activity node declared in the Androidmanifest when loading the Settings. Role is the Activity for meta tags – is the key in the data label for the com. Android. Settings. FRAGMENT_CLASS value.
(2) Call getIntent: returns intent.
The getStartingFragmentClass(superIntent) method creates the startingFragment object to assign an Intent value.
After the startingFragment is retrieved, build an intent and add a special key-value pair to it
Key: Settings :show_fragment(EXTRA_SHOW_FRAGMENT), value: mfragmentClass Specifies the class nameCopy the code
(3)final String initialFragmentName = intent.getStringExtra(EXTRA_SHOW_FRAGMENT);
LaunchSettingFragment (initialFragmentName, isSubSettings, Intent); mIsShowingDashboard = true; Use DashboardSummary(Fragment) to fill the main window.
When you click to enter the subinterface, the subinterface uses its own Fragment and sets its own theme.
The data loading of the Settings module is divided into primary menu data loading and secondary menu data loading. See the next article for details.