@Override
  public boolean onPreferenceChange(Preference preference, Object newValue) {
    if (preference == mLockscreenOption) {
      int val = Integer.parseInt((String) newValue);
      Settings.System.putInt(
          getActivity().getContentResolver(), Settings.System.LOCKSCREEN_LAYOUT, val);
      refreshSettings();
      return true;

    } else if (preference.getKey().startsWith("lockscreen_target")) {
      int index =
          Integer.parseInt(preference.getKey().substring(preference.getKey().lastIndexOf("_") + 1));
      Log.e("ROMAN", "lockscreen target, index: " + index);

      if (newValue.equals("**app**")) {
        mCurrentCustomActivityPreference = preference;
        mCurrentCustomActivityString = Settings.System.LOCKSCREEN_CUSTOM_APP_ACTIVITIES[index];
        mPicker.pickShortcut();
      } else {
        Settings.System.putString(
            getContentResolver(),
            Settings.System.LOCKSCREEN_CUSTOM_APP_ACTIVITIES[index],
            (String) newValue);
        refreshSettings();
      }
      return true;
    }

    return false;
  }
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
    Log.e("ROMAN", "ACTIVITY RESULT");

    mPicker.onActivityResult(requestCode, resultCode, data);

    super.onActivityResult(requestCode, resultCode, data);
  }
  private String getProperSummary(int i) {
    String uri =
        Settings.System.getString(
            getActivity().getContentResolver(),
            Settings.System.LOCKSCREEN_CUSTOM_APP_ACTIVITIES[i]);

    if (uri == null) return getResources().getString(R.string.lockscreen_action_none);

    if (uri.startsWith("**")) {
      if (uri.equals("**unlock**"))
        return getResources().getString(R.string.lockscreen_action_unlock);
      else if (uri.equals("**sound**"))
        return getResources().getString(R.string.lockscreen_action_sound);
      else if (uri.equals("**camera**"))
        return getResources().getString(R.string.lockscreen_action_camera);
      else if (uri.equals("**phone**"))
        return getResources().getString(R.string.lockscreen_action_phone);
      else if (uri.equals("**null**"))
        return getResources().getString(R.string.lockscreen_action_none);
    } else {
      return mPicker.getFriendlyNameForUri(uri);
    }
    return null;
  }