@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTitle(R.string.title_spen); // Load the preferences from an XML resource addPreferencesFromResource(R.xml.prefs_spen); PreferenceScreen prefs = getPreferenceScreen(); mPicker = new ShortcutPickerHelper(this, this); mEnableSPen = (CheckBoxPreference) findPreference("enable_spen"); mEnableSPen.setChecked( Settings.System.getBoolean( getContentResolver(), Settings.System.ENABLE_SPEN_ACTIONS, false)); mLeft = (ListPreference) findPreference("spen_left"); mLeft.setOnPreferenceChangeListener(this); mLeft.setSummary(getProperSummary(mLeft)); mRight = (ListPreference) findPreference("spen_right"); mRight.setOnPreferenceChangeListener(this); mRight.setSummary(getProperSummary(mRight)); mUp = (ListPreference) findPreference("spen_up"); mUp.setOnPreferenceChangeListener(this); mUp.setSummary(getProperSummary(mUp)); mDown = (ListPreference) findPreference("spen_down"); mDown.setOnPreferenceChangeListener(this); mDown.setSummary(getProperSummary(mDown)); mDouble = (ListPreference) findPreference("spen_double"); mDouble.setOnPreferenceChangeListener(this); mDouble.setSummary(getProperSummary(mDouble)); mLong = (ListPreference) findPreference("spen_long"); mLong.setOnPreferenceChangeListener(this); mLong.setSummary(getProperSummary(mLong)); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTitle(R.string.title_navbar); // Load the preferences from an XML resource addPreferencesFromResource(R.xml.navbar_settings); PreferenceScreen prefs = getPreferenceScreen(); mPicker = new ShortcutPickerHelper(this, this); mPackMan = getPackageManager(); mResources = mContext.getResources(); // Get NavBar Actions mActionCodes = NavBarHelpers.getNavBarActions(); mActions = new String[mActionCodes.length]; int actionqty = mActions.length; for (int i = 0; i < actionqty; i++) { mActions[i] = AwesomeConstants.getProperName(mContext, mActionCodes[i]); } menuDisplayLocation = (ListPreference) findPreference(PREF_MENU_UNLOCK); menuDisplayLocation.setOnPreferenceChangeListener(this); menuDisplayLocation.setValue( Settings.System.getInt(mContentRes, Settings.System.MENU_LOCATION, 0) + ""); mNavBarMenuDisplay = (ListPreference) findPreference(PREF_NAVBAR_MENU_DISPLAY); mNavBarMenuDisplay.setOnPreferenceChangeListener(this); mNavBarMenuDisplay.setValue( Settings.System.getInt(mContentRes, Settings.System.MENU_VISIBILITY, 0) + ""); mNavBarHideEnable = (CheckBoxPreference) findPreference(NAVBAR_HIDE_ENABLE); mNavBarHideEnable.setChecked( Settings.System.getBoolean(mContentRes, Settings.System.NAV_HIDE_ENABLE, false)); final int defaultDragOpacity = Settings.System.getInt(mContentRes, Settings.System.DRAG_HANDLE_OPACITY, 50); mDragHandleOpacity = (SeekBarPreference) findPreference(DRAG_HANDLE_OPACITY); mDragHandleOpacity.setInitValue((int) (defaultDragOpacity)); mDragHandleOpacity.setOnPreferenceChangeListener(this); final int defaultDragWidth = Settings.System.getInt(mContentRes, Settings.System.DRAG_HANDLE_WEIGHT, 5); mDragHandleWidth = (SeekBarPreference) findPreference(DRAG_HANDLE_WIDTH); mDragHandleWidth.setInitValue((int) (defaultDragWidth)); mDragHandleWidth.setOnPreferenceChangeListener(this); mNavBarHideTimeout = (ListPreference) findPreference(NAVBAR_HIDE_TIMEOUT); mNavBarHideTimeout.setOnPreferenceChangeListener(this); mNavBarHideTimeout.setValue( Settings.System.getInt(mContentRes, Settings.System.NAV_HIDE_TIMEOUT, 3000) + ""); boolean hasNavBarByDefault = mContext.getResources().getBoolean(com.android.internal.R.bool.config_showNavigationBar); mEnableNavigationBar = (CheckBoxPreference) findPreference(ENABLE_NAVIGATION_BAR); mEnableNavigationBar.setChecked( Settings.System.getBoolean( mContentRes, Settings.System.NAVIGATION_BAR_SHOW, hasNavBarByDefault)); mNavigationColor = (ColorPickerPreference) findPreference(NAVIGATION_BAR_COLOR); mNavigationColor.setOnPreferenceChangeListener(this); mNavigationBarColor = (ColorPickerPreference) findPreference(PREF_NAV_COLOR); mNavigationBarColor.setOnPreferenceChangeListener(this); mColorizeAllIcons = (CheckBoxPreference) findPreference("navigation_bar_allcolor"); mColorizeAllIcons.setChecked( Settings.System.getBoolean(mContentRes, Settings.System.NAVIGATION_BAR_ALLCOLOR, false)); mNavigationBarGlowColor = (ColorPickerPreference) findPreference(PREF_NAV_GLOW_COLOR); mNavigationBarGlowColor.setOnPreferenceChangeListener(this); mGlowTimes = (ListPreference) findPreference(PREF_GLOW_TIMES); mGlowTimes.setOnPreferenceChangeListener(this); final float defaultButtonAlpha = Settings.System.getFloat(mContentRes, Settings.System.NAVIGATION_BAR_BUTTON_ALPHA, 0.6f); mButtonAlpha = (SeekBarPreference) findPreference("button_transparency"); mButtonAlpha.setInitValue((int) (defaultButtonAlpha * 100)); mButtonAlpha.setOnPreferenceChangeListener(this); mWidthHelp = (Preference) findPreference("width_help"); float defaultPort = Settings.System.getFloat(mContentRes, Settings.System.NAVIGATION_BAR_WIDTH_PORT, 0f); mWidthPort = (SeekBarPreference) findPreference("width_port"); mWidthPort.setInitValue((int) (defaultPort * 2.5f)); mWidthPort.setOnPreferenceChangeListener(this); float defaultLand = Settings.System.getFloat(mContentRes, Settings.System.NAVIGATION_BAR_WIDTH_LAND, 0f); mWidthLand = (SeekBarPreference) findPreference("width_land"); mWidthLand.setInitValue((int) (defaultLand * 2.5f)); mWidthLand.setOnPreferenceChangeListener(this); mNavigationBarHeight = (ListPreference) findPreference("navigation_bar_height"); mNavigationBarHeight.setOnPreferenceChangeListener(this); mNavigationBarHeightLandscape = (ListPreference) findPreference("navigation_bar_height_landscape"); mNavigationBarHeightLandscape.setOnPreferenceChangeListener(this); mNavigationBarWidth = (ListPreference) findPreference("navigation_bar_width"); mNavigationBarWidth.setOnPreferenceChangeListener(this); mConfigureWidgets = findPreference(NAVIGATION_BAR_WIDGETS); mMenuArrowKeysCheckBox = (CheckBoxPreference) findPreference(PREF_MENU_ARROWS); mMenuArrowKeysCheckBox.setChecked( Settings.System.getBoolean( mContentRes, Settings.System.NAVIGATION_BAR_MENU_ARROW_KEYS, true)); // don't allow devices that must use a navigation bar to disable it if (hasNavBarByDefault) { prefs.removePreference(mEnableNavigationBar); } PreferenceGroup pg = (PreferenceGroup) prefs.findPreference("advanced_cat"); if (isTablet(mContext)) { mNavigationBarHeight.setTitle(R.string.system_bar_height_title); mNavigationBarHeight.setSummary(R.string.system_bar_height_summary); mNavigationBarHeightLandscape.setTitle(R.string.system_bar_height_landscape_title); mNavigationBarHeightLandscape.setSummary(R.string.system_bar_height_landscape_summary); pg.removePreference(mNavigationBarWidth); mNavBarHideEnable.setEnabled(false); mDragHandleOpacity.setEnabled(false); mDragHandleWidth.setEnabled(false); mNavBarHideTimeout.setEnabled(false); } else { // Phones&Phablets don't have SystemBar pg.removePreference(mWidthPort); pg.removePreference(mWidthLand); pg.removePreference(mWidthHelp); } if (Integer.parseInt(menuDisplayLocation.getValue()) == 4) { mNavBarMenuDisplay.setEnabled(false); } // Only show the hardware keys config on a device that does not have a navbar IWindowManager windowManager = IWindowManager.Stub.asInterface(ServiceManager.getService(Context.WINDOW_SERVICE)); if (hasNavBarByDefault) { // Let's assume they don't have hardware keys getPreferenceScreen().removePreference(findPreference(KEY_HARDWARE_KEYS)); } refreshSettings(); setHasOptionsMenu(true); updateGlowTimesSummary(); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Load the preferences from an XML resource addPreferencesFromResource(R.xml.prefs_powermenu); /* mShowPowerSaver = (CheckBoxPreference) findPreference(PREF_POWER_SAVER); int powerSaverVal = 0; try { powerSaverVal = Settings.Secure.getInt(mContentRes, Settings.Secure.POWER_SAVER_MODE); } catch (SettingNotFoundException e) { mShowPowerSaver.setEnabled(false); mShowPowerSaver .setSummary("You need to enable power saver before you can see it in the power menu."); } mShowPowerSaver.setChecked(powerSaverVal != 0); */ mShowTorchToggle = (CheckBoxPreference) findPreference(PREF_TORCH_TOGGLE); mShowTorchToggle.setChecked( Settings.System.getBoolean( mContentRes, Settings.System.POWER_DIALOG_SHOW_TORCH_TOGGLE, false)); mShowScreenShot = (CheckBoxPreference) findPreference(PREF_SCREENSHOT); mShowScreenShot.setChecked( Settings.System.getBoolean( mContentRes, Settings.System.POWER_DIALOG_SHOW_SCREENSHOT, true)); mShowAirplaneToggle = (CheckBoxPreference) findPreference(PREF_AIRPLANE_TOGGLE); mShowAirplaneToggle.setChecked( Settings.System.getBoolean( mContentRes, Settings.System.POWER_DIALOG_SHOW_AIRPLANE_TOGGLE, false)); mShowNavBarHide = (CheckBoxPreference) findPreference(PREF_NAVBAR_HIDE); mShowNavBarHide.setChecked( Settings.System.getBoolean( mContentRes, Settings.System.POWER_DIALOG_SHOW_NAVBAR_HIDE, false)); mShowVolumeStateToggle = (CheckBoxPreference) findPreference(PREF_VOLUME_STATE_TOGGLE); mShowVolumeStateToggle.setChecked( Settings.System.getBoolean( mContentRes, Settings.System.POWER_DIALOG_SHOW_VOLUME_STATE_TOGGLE, true)); mShowRebootKeyguard = (CheckBoxPreference) findPreference(PREF_REBOOT_KEYGUARD); mShowRebootKeyguard.setChecked( Settings.System.getBoolean( mContentRes, Settings.System.POWER_DIALOG_SHOW_REBOOT_KEYGUARD, true)); PreferenceScreen prefSet = getPreferenceScreen(); mExpandedDesktopPref = (ListPreference) prefSet.findPreference(KEY_EXPANDED_DESKTOP); mExpandedDesktopNoNavbarPref = (CheckBoxPreference) findPreference(KEY_EXPANDED_DESKTOP_NO_NAVBAR); int expandedDesktopValue = Settings.System.getInt(getContentResolver(), Settings.System.EXPANDED_DESKTOP_STYLE, 0); // Hide no-op "Status bar visible" mode on devices without navbar try { if (WindowManagerGlobal.getWindowManagerService().hasNavigationBar()) { mExpandedDesktopPref.setOnPreferenceChangeListener(this); mExpandedDesktopPref.setValue(String.valueOf(expandedDesktopValue)); updateExpandedDesktop(expandedDesktopValue); prefSet.removePreference(mExpandedDesktopNoNavbarPref); } else { mExpandedDesktopNoNavbarPref.setChecked(expandedDesktopValue > 0); prefSet.removePreference(mExpandedDesktopPref); } } catch (RemoteException e) { Log.e(TAG, "Error getting navigation bar status"); } }