Editing Settings

From Omni
Jump to: navigation, search

Creating a settings screen

Notes

All our custom settings screen are located in the packages/apps/OmniGears directory. Whenever possible, add your changes to this directory instead of the Settings app. Edit Settings only when you need (ie. to add your headers into existing settings). This helps for future merging of upstream Android changes.

Case 1: Adding entries to an existing element

  • Locate the settings screen you want to edit, and add you entries into the corresponding xml in packages/apps/Settings/res/xml.
  • Edit the corresponding Java file in packages/apps/Settings
  • Build and enjoy

Case 2: Adding new screens

  • Create your fragment xml in OmniGears/res/xml, based on existing one.
  • Create your corresponding Java file in OmniGears/src, based on existing one. An easy-to-edit one is the BarsAndMenusSettings.java
  • Add an activity to Settings/src/com/android/settings/Settings.java to forward the fragment (search for BarsAndMenus)
  • Add your activity to Settings/AndroidManifest.xml (search for BarsAndMenus)
  • Edit the Settings res/xml/… if you need to add a header to an existing parameter screen. Don’t forget the package is org.omnirom.omnigears