public void resetTouchFocus() {
    if (!mInitialized) return;

    splitMode = false;
    mMeteringIndicatorRotateLayout.setVisibility(View.GONE);

    // Put focus indicator to the center.
    RelativeLayout.LayoutParams p =
        (RelativeLayout.LayoutParams) mFocusIndicatorRotateLayout.getLayoutParams();
    int[] rules = p.getRules();
    rules[RelativeLayout.CENTER_IN_PARENT] = RelativeLayout.TRUE;
    p.setMargins(0, 0, 0, 0);

    mFocusArea = null;
    mMeteringArea = null;

    // allow driver to choose whatever it wants for focusing / metering
    // without these two lines Continuous focus is not re-enabled on HTC One
    int focusMode = getFocusMode();
    if ((focusMode == CameraParameters.AF_MODE_CONTINUOUS_PICTURE
            || focusMode == CameraParameters.AF_MODE_CONTINUOUS_VIDEO
            || focusMode == CameraParameters.AF_MODE_AUTO
            || focusMode == CameraParameters.AF_MODE_MACRO)
        && mFocusAreaSupported) {
      String modeName =
          PreferenceManager.getDefaultSharedPreferences(ApplicationScreen.getMainContext())
              .getString("defaultModeName", null);
      boolean isVideoRecording =
          PreferenceManager.getDefaultSharedPreferences(ApplicationScreen.getMainContext())
              .getBoolean("videorecording", false);
    }
  }
Example #2
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();
    }
  }
  @Override
  public void onStart() {
    // Get the xml/preferences.xml preferences
    SharedPreferences prefs =
        PreferenceManager.getDefaultSharedPreferences(ApplicationScreen.getMainContext());
    ModePreference = prefs.getString("modeStandardPref", "1");

    captureRAW = prefs.getBoolean(ApplicationScreen.sCaptureRAWPref, false);
  }
  @Override
  public void onClick(View v) {
    if (v == mSaveButton) {
      if (finishing) return;
      finishing = true;
      savePicture(ApplicationScreen.getMainContext());

      mHandler.sendEmptyMessage(MSG_LEAVING);
    }
  }
  @Override
  public void onCreate() {

    LayoutInflater inflator = ApplicationScreen.instance.getLayoutInflater();
    modeSwitcher =
        (Switch) inflator.inflate(R.layout.plugin_capture_standard_modeswitcher, null, false);

    SharedPreferences prefs =
        PreferenceManager.getDefaultSharedPreferences(ApplicationScreen.getMainContext());
    ModePreference = prefs.getString("modeStandardPref", "1");
    singleModeEV = ApplicationScreen.instance.getEVPref();
    modeSwitcher.setTextOn("DRO On");
    modeSwitcher.setTextOff("DRO Off");
    modeSwitcher.setChecked(ModePreference.compareTo("0") == 0 ? true : false);
    modeSwitcher.setOnCheckedChangeListener(
        new CompoundButton.OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isDro) {

            SharedPreferences prefs =
                PreferenceManager.getDefaultSharedPreferences(ApplicationScreen.getMainContext());

            if (isDro) {
              singleModeEV = ApplicationScreen.instance.getEVPref();

              ModePreference = "0";
              ApplicationScreen.setCaptureFormat(CameraController.YUV);
            } else {
              ModePreference = "1";
              ApplicationScreen.setCaptureFormat(CameraController.JPEG);
            }

            UpdateEv(isDro, singleModeEV);

            SharedPreferences.Editor editor = prefs.edit();
            editor.putString("modeStandardPref", ModePreference);
            editor.commit();

            ApplicationScreen.instance.relaunchCamera();

            if (ModePreference.compareTo("0") == 0)
              ApplicationScreen.getGUIManager()
                  .showHelp(
                      ApplicationScreen.instance.getString(R.string.Dro_Help_Header),
                      ApplicationScreen.getAppResources().getString(R.string.Dro_Help),
                      R.drawable.plugin_help_dro,
                      "droShowHelp");
          }
        });

    if (PluginManager.getInstance().getProcessingCounter() == 0) modeSwitcher.setEnabled(true);
  }
 public void setupSaveButton() {
   // put save button on screen
   mSaveButton = new Button(ApplicationScreen.instance);
   mSaveButton.setBackgroundResource(R.drawable.button_save_background);
   mSaveButton.setOnClickListener(this);
   LayoutParams saveLayoutParams =
       new LayoutParams(
           (int)
               (ApplicationScreen.getMainContext()
                   .getResources()
                   .getDimension(R.dimen.postprocessing_savebutton_size)),
           (int)
               (ApplicationScreen.getMainContext()
                   .getResources()
                   .getDimension(R.dimen.postprocessing_savebutton_size)));
   saveLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
   saveLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
   float density = ApplicationScreen.getAppResources().getDisplayMetrics().density;
   saveLayoutParams.setMargins((int) (density * 8), (int) (density * 8), 0, 0);
   ((RelativeLayout) postProcessingView.findViewById(R.id.sequenceLayout))
       .addView(mSaveButton, saveLayoutParams);
   mSaveButton.setRotation(mLayoutOrientationCurrent);
 }
  @Override
  public void onCameraParametersSetup() {
    SharedPreferences prefs =
        PreferenceManager.getDefaultSharedPreferences(ApplicationScreen.getMainContext());
    if (ModePreference.equals("0")) {
      // FixMe: why not setting exposure if we are in dro-off mode?
      UpdateEv(true, singleModeEV);
    }

    if (CameraController.isRemoteCamera()) {
      Size imageSize = CameraController.getCameraImageSize();
      CameraController.setPictureSize(imageSize.getWidth(), imageSize.getHeight());
    }
  }
Example #8
0
  @Override
  public void onQuickControlClick() {
    SharedPreferences prefs =
        PreferenceManager.getDefaultSharedPreferences(ApplicationScreen.getMainContext());
    Editor editor = prefs.edit();

    if (mGyroState == ON) {
      quickControlIconID = R.drawable.gui_almalence_settings_gyro_off;
      editor.putBoolean("PrefGyroVF", false);
    } else {
      quickControlIconID = R.drawable.gui_almalence_settings_gyro;
      editor.putBoolean("PrefGyroVF", true);
    }
    editor.commit();

    updatePreferences();
  }
 @Override
 public void onShowPreferences() {
   SharedPreferences prefs =
       PreferenceManager.getDefaultSharedPreferences(ApplicationScreen.getMainContext());
   ModePreference = prefs.getString("modeStandardPref", "1");
 }
  @Override
  public void onCreate() {
    View v =
        LayoutInflater.from(ApplicationScreen.getMainContext())
            .inflate(R.layout.plugin_vf_focus_layout, null);
    focusLayout = (RelativeLayout) v.findViewById(R.id.focus_layout);

    RelativeLayout.LayoutParams viewLayoutParams =
        new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
    viewLayoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);

    mFocusIndicatorRotateLayout = (RotateLayout) v.findViewById(R.id.focus_indicator_rotate_layout);
    mMeteringIndicatorRotateLayout =
        (RotateLayout) v.findViewById(R.id.metering_indicator_rotate_layout);

    mFocusIndicatorRotateLayout.setOnTouchListener(
        new OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            updateCurrentTouch(event);

            if (splitMode) {
              onTouchFocusArea(event);
              return true;
            } else {
              // Check if it's double click
              if (event.getAction() == MotionEvent.ACTION_UP) {
                lastTouchTime1 = lastTouchTime2;
                lastTouchTime2 = System.currentTimeMillis();

                if (lastTouchTime2 - lastTouchTime1 < 1000) {
                  isDoubleClick = true;
                } else {
                  isDoubleClick = false;
                }
              }

              onTouchFocusAndMeteringArea(event);
              return true;
            }
          }
        });

    mMeteringIndicatorRotateLayout.setOnTouchListener(
        new OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            updateCurrentTouch(event);

            onTouchMeteringArea(event);
            return true;
          }
        });

    mFocusIndicator =
        (FocusIndicatorView) mFocusIndicatorRotateLayout.findViewById(R.id.focus_indicator);
    mMeteringIndicator =
        (ImageView) mMeteringIndicatorRotateLayout.findViewById(R.id.metering_indicator);

    resetTouchFocus();

    mPreferences =
        PreferenceManager.getDefaultSharedPreferences(ApplicationScreen.getMainContext());
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
      mDefaultFocusMode = CameraParameters.AF_MODE_CONTINUOUS_PICTURE;
    } else {
      mDefaultFocusMode = CameraParameters.AF_MODE_AUTO;
    }
  }
 private boolean focusOnShutterDisabled() {
   return PreferenceManager.getDefaultSharedPreferences(ApplicationScreen.getMainContext())
       .getBoolean("ContinuousCapturing", false);
 }
 public void initializeSoundPlayers(AssetFileDescriptor fd_ok, AssetFileDescriptor fd_false) {
   mSoundPlayerOK = new SoundPlayer(ApplicationScreen.getMainContext(), fd_ok);
   mSoundPlayerFalse = new SoundPlayer(ApplicationScreen.getMainContext(), fd_false);
 }