public boolean onPreferenceChange(Preference preference, Object newValue) {
   if (preference == mPieMode) {
     int pieMode = Integer.valueOf((String) newValue);
     Settings.System.putInt(getActivity().getContentResolver(), Settings.System.PIE_MODE, pieMode);
     return true;
   } else if (preference == mPieSize) {
     float pieSize = Float.valueOf((String) newValue);
     Settings.System.putFloat(
         getActivity().getContentResolver(), Settings.System.PIE_SIZE, pieSize);
     return true;
   } else if (preference == mPieGravity) {
     int pieGravity = Integer.valueOf((String) newValue);
     Settings.System.putInt(
         getActivity().getContentResolver(), Settings.System.PIE_GRAVITY, pieGravity);
     return true;
   } else if (preference == mPieAngle) {
     int pieAngle = Integer.valueOf((String) newValue);
     Settings.System.putInt(
         getActivity().getContentResolver(), Settings.System.PIE_ANGLE, pieAngle);
     return true;
   } else if (preference == mPieGap) {
     int pieGap = Integer.valueOf((String) newValue);
     Settings.System.putInt(getActivity().getContentResolver(), Settings.System.PIE_GAP, pieGap);
     return true;
   } else if (preference == mPieTrigger) {
     float pieTrigger = Float.valueOf((String) newValue);
     Settings.System.putFloat(
         getActivity().getContentResolver(), Settings.System.PIE_TRIGGER, pieTrigger);
     return true;
   }
   return false;
 }
  @Override
  public boolean onPreferenceChange(Preference preference, Object newValue) {

    if (preference == menuDisplayLocation) {
      int val = Integer.parseInt((String) newValue);
      Settings.System.putInt(mContentRes, Settings.System.MENU_LOCATION, val);
      refreshSettings();
      mNavBarMenuDisplay.setEnabled(val < 4 ? true : false);
      return true;
    } else if (preference == mNavBarMenuDisplay) {
      Settings.System.putInt(
          mContentRes, Settings.System.MENU_VISIBILITY, Integer.parseInt((String) newValue));
      return true;
    } else if (preference == mNavigationBarWidth) {
      String newVal = (String) newValue;
      int dp = Integer.parseInt(newVal);
      int width = mapChosenDpToPixels(dp);
      Settings.System.putInt(mContentRes, Settings.System.NAVIGATION_BAR_WIDTH, width);
      return true;
    } else if (preference == mNavigationBarHeight) {
      String newVal = (String) newValue;
      int dp = Integer.parseInt(newVal);
      int height = mapChosenDpToPixels(dp);
      Settings.System.putInt(mContentRes, Settings.System.NAVIGATION_BAR_HEIGHT, height);
      return true;
    } else if (preference == mNavBarHideTimeout) {
      int val = Integer.parseInt((String) newValue);
      Settings.System.putInt(mContentRes, Settings.System.NAV_HIDE_TIMEOUT, val);
      return true;
    } else if (preference == mNavigationBarHeightLandscape) {
      String newVal = (String) newValue;
      int dp = Integer.parseInt(newVal);
      int height = mapChosenDpToPixels(dp);
      Settings.System.putInt(mContentRes, Settings.System.NAVIGATION_BAR_HEIGHT_LANDSCAPE, height);
      return true;
    } else if (preference == mNavigationColor) {
      String hex = ColorPickerPreference.convertToARGB(Integer.valueOf(String.valueOf(newValue)));
      preference.setSummary(hex);
      int intHex = ColorPickerPreference.convertToColorInt(hex) & 0x00FFFFFF;
      Settings.System.putInt(mContentRes, Settings.System.NAVIGATION_BAR_COLOR, intHex);
      refreshSettings();
      return true;
    } else if (preference == mNavigationBarColor) {
      String hex = ColorPickerPreference.convertToARGB(Integer.valueOf(String.valueOf(newValue)));
      preference.setSummary(hex);
      int intHex = ColorPickerPreference.convertToColorInt(hex);
      Settings.System.putInt(mContentRes, Settings.System.NAVIGATION_BAR_TINT, intHex);
      refreshSettings();
      return true;
    } else if (preference == mNavigationBarGlowColor) {
      String hex = ColorPickerPreference.convertToARGB(Integer.valueOf(String.valueOf(newValue)));
      preference.setSummary(hex);
      int intHex = ColorPickerPreference.convertToColorInt(hex);
      Settings.System.putInt(mContentRes, Settings.System.NAVIGATION_BAR_GLOW_TINT, intHex);
      refreshSettings();
      return true;
    } else if (preference == mGlowTimes) {
      // format is (on|off) both in MS
      String value = (String) newValue;
      String[] breakIndex = value.split("\\|");
      int onTime = Integer.valueOf(breakIndex[0]);
      int offTime = Integer.valueOf(breakIndex[1]);

      Settings.System.putInt(mContentRes, Settings.System.NAVIGATION_BAR_GLOW_DURATION[0], offTime);
      Settings.System.putInt(mContentRes, Settings.System.NAVIGATION_BAR_GLOW_DURATION[1], onTime);
      updateGlowTimesSummary();
      return true;
    } else if (preference == mButtonAlpha) {
      float val = Float.parseFloat((String) newValue);
      Settings.System.putFloat(
          mContentRes, Settings.System.NAVIGATION_BAR_BUTTON_ALPHA, val * 0.01f);
      refreshSettings();
      return true;
    } else if (preference == mDragHandleOpacity) {
      String newVal = (String) newValue;
      int op = Integer.parseInt(newVal);
      Settings.System.putInt(mContentRes, Settings.System.DRAG_HANDLE_OPACITY, op);
      return true;
    } else if (preference == mDragHandleWidth) {
      String newVal = (String) newValue;
      int dp = Integer.parseInt(newVal);
      // int height = mapChosenDpToPixels(dp);
      Settings.System.putInt(mContentRes, Settings.System.DRAG_HANDLE_WEIGHT, dp);
      return true;
    } else if (preference == mWidthPort) {
      float val = Float.parseFloat((String) newValue);
      Settings.System.putFloat(mContentRes, Settings.System.NAVIGATION_BAR_WIDTH_PORT, val * 0.4f);
      return true;
    } else if (preference == mWidthLand) {
      float val = Float.parseFloat((String) newValue);
      Settings.System.putFloat(mContentRes, Settings.System.NAVIGATION_BAR_WIDTH_LAND, val * 0.4f);
      return true;
    }
    return false;
  }