@Override public void onCameraParametersSetup() { // replace here with [CF] mode as default. // Also, check if [CF] is available, and if not - set [AF], if [AF] is // not available - set first available preferenceFocusMode = ApplicationScreen.instance.getFocusModePref(ApplicationScreen.sDefaultFocusValue); int[] supportedFocusModes = CameraController.getSupportedFocusModes(); if (supportedFocusModes != null && supportedFocusModes.length > 0) { if (!CameraController.isModeAvailable(supportedFocusModes, preferenceFocusMode) && preferenceFocusMode != CameraParameters.MF_MODE) { if (CameraController.isModeAvailable(supportedFocusModes, CameraParameters.AF_MODE_AUTO)) preferenceFocusMode = CameraParameters.AF_MODE_AUTO; else preferenceFocusMode = supportedFocusModes[0]; } } initializeParameters(); initialize(CameraController.isFrontCamera(), 90); initializeSoundPlayers( ApplicationScreen.getAppResources().openRawResourceFd(R.raw.plugin_vf_focus_ok), ApplicationScreen.getAppResources().openRawResourceFd(R.raw.plugin_vf_focus_false)); cancelAutoFocus(); // Set the length of focus indicator according to preview frame size. int len = Math.min(mPreviewWidth, mPreviewHeight) / 25; ViewGroup.LayoutParams layout = mFocusIndicator.getLayoutParams(); layout.width = (int) (len * ApplicationScreen.getAppResources() .getInteger(R.integer.focusIndicator_cropFactor)); layout.height = (int) (len * ApplicationScreen.getAppResources() .getInteger(R.integer.focusIndicator_cropFactor)); mFocusIndicator.requestLayout(); layout = mMeteringIndicator.getLayoutParams(); layout.width = (int) (len * ApplicationScreen.getAppResources() .getInteger(R.integer.focusIndicator_cropFactor)); layout.height = (int) (len * ApplicationScreen.getAppResources() .getInteger(R.integer.focusIndicator_cropFactor)); mMeteringIndicator.requestLayout(); }