public void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (resultCode == Activity.RESULT_OK) {
     if (requestCode == ShortcutPickerHelper.REQUEST_PICK_SHORTCUT
         || requestCode == ShortcutPickerHelper.REQUEST_PICK_APPLICATION
         || requestCode == ShortcutPickerHelper.REQUEST_CREATE_SHORTCUT) {
       mPicker.onActivityResult(requestCode, resultCode, data);
     }
   }
   super.onActivityResult(requestCode, resultCode, data);
 }
  @Override
  public boolean onPreferenceChange(Preference preference, Object newValue) {
    boolean result = false;

    if (preference == mLeft) {
      mPreference = preference;
      mString = Settings.System.SPEN_ACTIONS[SWIPE_LEFT];
      if (newValue.equals(AwesomeConstant.ACTION_APP.value())) {
        mPicker.pickShortcut();
      } else {
        result =
            Settings.System.putString(
                getContentResolver(), Settings.System.SPEN_ACTIONS[SWIPE_LEFT], (String) newValue);
        mLeft.setSummary(getProperSummary(mLeft));
      }
    } else if (preference == mRight) {
      mPreference = preference;
      mString = Settings.System.SPEN_ACTIONS[SWIPE_RIGHT];
      if (newValue.equals(AwesomeConstant.ACTION_APP.value())) {
        mPicker.pickShortcut();
      } else {
        result =
            Settings.System.putString(
                getContentResolver(), Settings.System.SPEN_ACTIONS[SWIPE_RIGHT], (String) newValue);
        mRight.setSummary(getProperSummary(mRight));
      }
    } else if (preference == mUp) {
      mPreference = preference;
      mString = Settings.System.SPEN_ACTIONS[SWIPE_UP];
      if (newValue.equals(AwesomeConstant.ACTION_APP.value())) {
        mPicker.pickShortcut();
      } else {
        result =
            Settings.System.putString(
                getContentResolver(), Settings.System.SPEN_ACTIONS[SWIPE_UP], (String) newValue);
        mUp.setSummary(getProperSummary(mUp));
      }
    } else if (preference == mDown) {
      mPreference = preference;
      mString = Settings.System.SPEN_ACTIONS[SWIPE_DOWN];
      if (newValue.equals(AwesomeConstant.ACTION_APP.value())) {
        mPicker.pickShortcut();
      } else {
        result =
            Settings.System.putString(
                getContentResolver(), Settings.System.SPEN_ACTIONS[SWIPE_DOWN], (String) newValue);
        mDown.setSummary(getProperSummary(mDown));
      }
    } else if (preference == mDouble) {
      mPreference = preference;
      mString = Settings.System.SPEN_ACTIONS[TAP_DOUBLE];
      if (newValue.equals(AwesomeConstant.ACTION_APP.value())) {
        mPicker.pickShortcut();
      } else {
        result =
            Settings.System.putString(
                getContentResolver(), Settings.System.SPEN_ACTIONS[TAP_DOUBLE], (String) newValue);
        mDouble.setSummary(getProperSummary(mDouble));
      }
    } else if (preference == mLong) {
      mPreference = preference;
      mString = Settings.System.SPEN_ACTIONS[PRESS_LONG];
      if (newValue.equals(AwesomeConstant.ACTION_APP.value())) {
        mPicker.pickShortcut();
      } else {
        result =
            Settings.System.putString(
                getContentResolver(), Settings.System.SPEN_ACTIONS[PRESS_LONG], (String) newValue);
        mLong.setSummary(getProperSummary(mLong));
      }
    }
    return result;
  }
  private String getProperSummary(Preference preference) {
    if (preference == mLeft) {
      mString = Settings.System.SPEN_ACTIONS[SWIPE_LEFT];
    } else if (preference == mRight) {
      mString = Settings.System.SPEN_ACTIONS[SWIPE_RIGHT];
    } else if (preference == mUp) {
      mString = Settings.System.SPEN_ACTIONS[SWIPE_UP];
    } else if (preference == mDown) {
      mString = Settings.System.SPEN_ACTIONS[SWIPE_DOWN];
    } else if (preference == mDouble) {
      mString = Settings.System.SPEN_ACTIONS[TAP_DOUBLE];
    } else if (preference == mLong) {
      mString = Settings.System.SPEN_ACTIONS[PRESS_LONG];
    }

    String uri = Settings.System.getString(getActivity().getContentResolver(), mString);
    if (TextUtils.isEmpty(uri)) {
      return getResources().getString(R.string.navbar_action_none);
    }

    String newString = getResources().getString(R.string.navbar_action_none);
    AwesomeConstant AwesomeEnum = fromString(uri);
    switch (AwesomeEnum) {
      case ACTION_HOME:
        newString = getResources().getString(R.string.navbar_action_home);
        break;
      case ACTION_BACK:
        newString = getResources().getString(R.string.navbar_action_back);
        break;
      case ACTION_RECENTS:
        newString = getResources().getString(R.string.navbar_action_recents);
        break;
      case ACTION_RECENTS_GB:
        newString = getResources().getString(R.string.navbar_action_recents_gb);
        break;
      case ACTION_SEARCH:
        newString = getResources().getString(R.string.navbar_action_search);
        break;
      case ACTION_MENU:
        newString = getResources().getString(R.string.navbar_action_menu);
        break;
      case ACTION_IME:
        newString = getResources().getString(R.string.navbar_action_ime);
        break;
      case ACTION_KILL:
        newString = getResources().getString(R.string.navbar_action_kill);
        break;
      case ACTION_POWER:
        newString = getResources().getString(R.string.navbar_action_power);
        break;
      case ACTION_NOTIFICATIONS:
        newString = getResources().getString(R.string.navbar_action_notifications);
        break;
      case ACTION_LAST_APP:
        newString = getResources().getString(R.string.navbar_action_lastapp);
        break;
      case ACTION_NULL:
        newString = getResources().getString(R.string.navbar_action_none);
        break;
      case ACTION_APP:
        newString = mPicker.getFriendlyNameForUri(uri);
        break;
    }
    return newString;
  }