Ejemplo n.º 1
0
  void updatePreferences() {
    SharedPreferences prefs =
        PreferenceManager.getDefaultSharedPreferences(ApplicationScreen.getMainContext());
    mGyroState = prefs.getBoolean("PrefGyroVF", false);

    if (!prefs.contains("PrefGyroTypeVF")) {
      Editor editor = prefs.edit();
      if (mGyroscope != null) {
        editor.putBoolean("PrefGyroTypeVF", true);
      } else {
        editor.putBoolean("PrefGyroTypeVF", false);
      }
      editor.commit();
    }
    mPrefHardwareGyroscope = prefs.getBoolean("PrefGyroTypeVF", false);

    if (mGyroState == ON) {
      CameraController.setNeedPreviewFrame(true);
      quickControlIconID = R.drawable.gui_almalence_settings_gyro;
      if (mHorizonIndicatorContainer != null) {
        mHorizonIndicatorContainer.setVisibility(View.VISIBLE);
      }
      initSensors();
    } else {
      quickControlIconID = R.drawable.gui_almalence_settings_gyro_off;
      if (mHorizonIndicatorContainer != null) {
        mHorizonIndicatorContainer.setVisibility(View.GONE);
      }
      releaseSensors();
    }
  }