Пример #1
0
  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);
    }
  }
 public RotateTextToast(Activity activity, int textResourceId, int orientation) {
   mLayoutRoot = (ViewGroup) activity.getWindow().getDecorView();
   LayoutInflater inflater = activity.getLayoutInflater();
   View v = inflater.inflate(R.layout.rotate_text_toast, mLayoutRoot);
   mToast = (RotateLayout) v.findViewById(R.id.rotate_toast);
   TextView tv = (TextView) mToast.findViewById(R.id.message);
   tv.setText(textResourceId);
   mToast.setOrientation(orientation, false);
   mHandler = new Handler();
 }
Пример #3
0
  @Override
  protected void onFinishInflate() {
    super.onFinishInflate();

    mTitle = (TextView) findViewById(R.id.title);
    mSettingList = (ViewGroup) findViewById(R.id.settingList);
  }
 public void show(int time) {
   mToast.setVisibility(View.VISIBLE);
   mHandler.postDelayed(mRunnable, time);
 }
 public void show() {
   mToast.setVisibility(View.VISIBLE);
   mHandler.postDelayed(mRunnable, TOAST_DURATION);
 }
Пример #6
0
  public void onTouchAreas(MotionEvent e) {
    // Initialize variables.
    int x = Math.round(e.getX());
    int y = Math.round(e.getY());
    int focusWidth = mFocusIndicatorRotateLayout.getWidth();
    int focusHeight = mFocusIndicatorRotateLayout.getHeight();
    int previewWidth = mPreviewWidth;
    int previewHeight = mPreviewHeight;
    int displayWidth = ApplicationScreen.getAppResources().getDisplayMetrics().widthPixels;
    int diffWidth = displayWidth - previewWidth;

    int paramsLayoutHeight = 0;

    int xOffset = (focusLayout.getWidth() - previewWidth) / 2;
    int yOffset = (focusLayout.getHeight() - previewHeight) / 2;

    if (mFocusArea == null) {
      mFocusArea = new ArrayList<Area>();
      mFocusArea.add(new Area(new Rect(), 1000));
    }

    if (mMeteringArea == null) {
      mMeteringArea = new ArrayList<Area>();
      mMeteringArea.add(new Area(new Rect(), 1000));
    }

    boolean isNexus6 = CameraController.isNexus6;
    // Convert the coordinates to driver format.
    // AE area is bigger because exposure is sensitive and
    // easy to over- or underexposure if area is too small.
    calculateTapArea(
        focusWidth,
        focusHeight,
        1f,
        x,
        y,
        ApplicationScreen.getPreviewSurfaceView().getWidth(),
        ApplicationScreen.getPreviewSurfaceView().getHeight(),
        mFocusArea.get(0).rect);
    if (ApplicationScreen.getMeteringMode() != -1
        && ApplicationScreen.getMeteringMode() == CameraParameters.meteringModeSpot)
      calculateTapArea(
          20 + (isNexus6 ? focusWidth : 0),
          20 + (isNexus6 ? focusHeight : 0),
          1f,
          x,
          y,
          ApplicationScreen.getPreviewSurfaceView().getWidth(),
          ApplicationScreen.getPreviewSurfaceView().getHeight(),
          mMeteringArea.get(0).rect);
    else mMeteringArea = null;

    if (mFocusAreaSupported) {
      // Use margin to set the focus indicator to the touched area.
      RelativeLayout.LayoutParams p =
          (RelativeLayout.LayoutParams) mFocusIndicatorRotateLayout.getLayoutParams();
      int left =
          Util.clamp(
              x - focusWidth / 2 + xOffset,
              diffWidth / 2,
              (previewWidth - focusWidth + xOffset * 2) - diffWidth / 2);
      int top =
          Util.clamp(
              y - focusHeight / 2 + yOffset,
              paramsLayoutHeight / 2,
              (previewHeight - focusHeight + yOffset * 2) - paramsLayoutHeight / 2);
      p.setMargins(left, top, 0, 0);
      // Disable "center" rule because we no longer want to put it in the
      // center.
      int[] rules = p.getRules();
      rules[RelativeLayout.CENTER_IN_PARENT] = 0;
      mFocusIndicatorRotateLayout.requestLayout();
    }

    // Set the focus area and metering area.
    if (mFocusAreaSupported && needAutoFocusCall() && (e.getAction() == MotionEvent.ACTION_UP)) {
      CameraController.cancelAutoFocus();
      if (preferenceFocusMode == CameraParameters.AF_MODE_CONTINUOUS_PICTURE
          || preferenceFocusMode == CameraParameters.AF_MODE_CONTINUOUS_VIDEO) {
        CameraController.setCameraFocusMode(CameraParameters.AF_MODE_AUTO);
      }

      setFocusParameters();
      setMeteringParameters();
      autoFocus();

    } else if (e.getAction() == MotionEvent.ACTION_UP
        && ApplicationScreen.instance.isShotOnTap() == 1
        && !PluginManager.getInstance().getActiveMode().modeID.equals("video")) {

      ApplicationScreen.getGUIManager().onHardwareShutterButtonPressed();
    } else if (e.getAction() == MotionEvent.ACTION_UP
        && ApplicationScreen.instance.isShotOnTap() == 2
        && !PluginManager.getInstance().getActiveMode().modeID.equals("video")) {
      if (isDoubleClick) {
        ApplicationScreen.getGUIManager().onHardwareShutterButtonPressed();
        isDoubleClick = false;
      }
    } else { // Just show the indicator in all other cases.
      autoFocus();
      // Reset the metering area in 3 seconds.
      mHandler.removeMessages(RESET_TOUCH_FOCUS);
      mHandler.sendEmptyMessageDelayed(RESET_TOUCH_FOCUS, RESET_TOUCH_FOCUS_DELAY);
    }
  }
Пример #7
0
  public void onTouchFocusAndMeteringArea(MotionEvent e) {
    if (!mFocusAreaSupported) return;

    int xRaw = (int) e.getRawX();
    int yRaw = (int) e.getRawY();

    // Initialize variables.
    int focusWidth = mFocusIndicatorRotateLayout.getWidth();
    int focusHeight = mFocusIndicatorRotateLayout.getHeight();
    int previewWidth = mPreviewWidth;
    int previewHeight = mPreviewHeight;
    int displayWidth = ApplicationScreen.getAppResources().getDisplayMetrics().widthPixels;
    int displayHeight = ApplicationScreen.getAppResources().getDisplayMetrics().heightPixels;
    int diffWidth = displayWidth - previewWidth;
    int diffHeight = displayHeight - previewHeight;

    // Initialize variables.
    int xOffset = (focusLayout.getWidth() - previewWidth) / 2;
    int yOffset = (focusLayout.getHeight() - previewHeight) / 2;

    if (mFocusArea == null) {
      mFocusArea = new ArrayList<Area>();
      mFocusArea.add(new Area(new Rect(), 1000));
    }

    if (mMeteringArea == null) {
      mMeteringArea = new ArrayList<Area>();
      mMeteringArea.add(new Area(new Rect(), 1000));
    }

    // Use margin to set the metering indicator to the touched area.
    RelativeLayout.LayoutParams p =
        (RelativeLayout.LayoutParams) mFocusIndicatorRotateLayout.getLayoutParams();
    int left =
        Util.clamp(
            xRaw - focusWidth / 2 + xOffset,
            diffWidth / 2,
            (previewWidth - focusWidth + xOffset * 2) - diffWidth / 2);
    int top =
        Util.clamp(
            yRaw - focusHeight / 2 + yOffset - diffHeight / 2,
            0,
            previewHeight - focusHeight + yOffset * 2);

    p.leftMargin = left;
    p.topMargin = top;

    int[] rules = p.getRules();
    rules[RelativeLayout.CENTER_IN_PARENT] = 0;

    mFocusIndicatorRotateLayout.setLayoutParams(p);

    calculateTapAreaByTopLeft(
        focusWidth,
        focusHeight,
        1f,
        top,
        left,
        ApplicationScreen.getPreviewSurfaceView().getWidth(),
        ApplicationScreen.getPreviewSurfaceView().getHeight(),
        mFocusArea.get(0).rect);

    if (ApplicationScreen.getMeteringMode() != -1
        && ApplicationScreen.getMeteringMode() == CameraParameters.meteringModeSpot)
      calculateTapAreaByTopLeft(
          focusWidth,
          focusHeight,
          1f,
          top,
          left,
          ApplicationScreen.getPreviewSurfaceView().getWidth(),
          ApplicationScreen.getPreviewSurfaceView().getHeight(),
          mMeteringArea.get(0).rect);
    else mMeteringArea = null;

    // Set the focus area and metering area.
    if ((mFocusAreaSupported && needAutoFocusCall() && (e.getAction() == MotionEvent.ACTION_UP))
        || CameraController.isRemoteCamera()) {
      CameraController.cancelAutoFocus();
      if (preferenceFocusMode == CameraParameters.AF_MODE_CONTINUOUS_PICTURE
          || preferenceFocusMode == CameraParameters.AF_MODE_CONTINUOUS_VIDEO) {
        CameraController.setCameraFocusMode(CameraParameters.AF_MODE_AUTO);
      }

      setFocusParameters();
      setMeteringParameters();
      autoFocus();

    } else if (e.getAction() == MotionEvent.ACTION_UP
        && ApplicationScreen.instance.isShotOnTap() == 1
        && !PluginManager.getInstance().getActiveMode().modeID.equals("video")
        && !currentTouch) {

      ApplicationScreen.getGUIManager().onHardwareShutterButtonPressed();
    } else if (e.getAction() == MotionEvent.ACTION_UP
        && ApplicationScreen.instance.isShotOnTap() == 2
        && !PluginManager.getInstance().getActiveMode().modeID.equals("video")
        && !currentTouch) {
      if (isDoubleClick) {
        ApplicationScreen.getGUIManager().onHardwareShutterButtonPressed();
        isDoubleClick = false;
      }
    } else if (e.getAction()
        == MotionEvent.ACTION_UP) { // Just show the indicator in all other cases.
      autoFocus();
      // updateFocusUI();
      // Reset the metering area in 3 seconds.
      mHandler.removeMessages(RESET_TOUCH_FOCUS);
      mHandler.sendEmptyMessageDelayed(RESET_TOUCH_FOCUS, RESET_TOUCH_FOCUS_DELAY);
    }

    mFocusIndicatorRotateLayout.requestLayout();
  }
Пример #8
0
  public void onTouchMeteringArea(MotionEvent e) {
    if (!mMeteringAreaSupported || CameraController.isGalaxyNote3) {
      if (e.getActionMasked() == MotionEvent.ACTION_POINTER_DOWN
          || e.getActionMasked() == MotionEvent.ACTION_DOWN)
        Toast.makeText(
                ApplicationScreen.instance,
                R.string.manual_exposure_unsupported,
                Toast.LENGTH_SHORT)
            .show();

      return;
    }

    int xRaw = (int) e.getRawX();
    int yRaw = (int) e.getRawY();

    if (e.getPointerCount() > 1) {
      final int location[] = {0, 0};
      focusLayout.getLocationOnScreen(location);
      xRaw = (int) e.getX(1) + location[0];
      yRaw = (int) e.getY(1) + location[1];
    }

    int meteringWidth = mMeteringIndicatorRotateLayout.getWidth();
    int meteringHeight = mMeteringIndicatorRotateLayout.getHeight();
    int previewWidth = mPreviewWidth;
    int previewHeight = mPreviewHeight;
    int displayWidth = ApplicationScreen.getAppResources().getDisplayMetrics().widthPixels;
    int displayHeight = ApplicationScreen.getAppResources().getDisplayMetrics().heightPixels;
    int diffWidth = displayWidth - previewWidth;
    int diffHeight = displayHeight - previewHeight;

    // Initialize variables.
    int paramsLayoutHeight = 0;

    int xOffset = (focusLayout.getWidth() - previewWidth) / 2;
    int yOffset = (focusLayout.getHeight() - previewHeight) / 2;

    if (mMeteringArea == null) {
      mMeteringArea = new ArrayList<Area>();
      mMeteringArea.add(new Area(new Rect(), 1000));
    }

    // Use margin to set the metering indicator to the touched area.
    RelativeLayout.LayoutParams p =
        (RelativeLayout.LayoutParams) mMeteringIndicatorRotateLayout.getLayoutParams();
    int left =
        Util.clamp(
            xRaw - meteringWidth / 2 + xOffset,
            diffWidth / 2,
            (previewWidth - meteringWidth + xOffset * 2) - diffWidth / 2);
    int top =
        Util.clamp(
            yRaw - meteringHeight / 2 + yOffset - diffHeight / 2,
            0,
            previewHeight - meteringHeight + yOffset * 2);

    p.leftMargin = left;
    p.topMargin = top;

    mMeteringIndicatorRotateLayout.setLayoutParams(p);

    // Convert the coordinates to driver format.
    calculateTapAreaByTopLeft(
        meteringWidth,
        meteringHeight,
        1f,
        top,
        left,
        ApplicationScreen.getPreviewSurfaceView().getWidth(),
        ApplicationScreen.getPreviewSurfaceView().getHeight(),
        mMeteringArea.get(0).rect);

    // Set the focus area and metering area.
    if (e.getActionMasked() == MotionEvent.ACTION_POINTER_DOWN
        || e.getActionMasked() == MotionEvent.ACTION_DOWN) {
      mMeteringIndicatorRotateLayout.setVisibility(View.VISIBLE);
    }

    if (e.getActionMasked() == MotionEvent.ACTION_POINTER_UP
        || e.getActionMasked() == MotionEvent.ACTION_UP) {
      setMeteringParameters();
    }

    mMeteringIndicatorRotateLayout.requestLayout();
  }
Пример #9
0
  public void onTouchFocusArea(MotionEvent e) {
    if (!mFocusAreaSupported) return;

    int xRaw = (int) e.getRawX();
    int yRaw = (int) e.getRawY();

    if (e.getPointerCount() > 1) {
      final int location[] = {0, 0};
      focusLayout.getLocationOnScreen(location);
      xRaw = (int) e.getX(0) + location[0];
      yRaw = (int) e.getY(0) + location[1];
    }

    // Initialize variables.
    int focusWidth = mFocusIndicatorRotateLayout.getWidth();
    int focusHeight = mFocusIndicatorRotateLayout.getHeight();
    int previewWidth = mPreviewWidth;
    int previewHeight = mPreviewHeight;
    int displayWidth = ApplicationScreen.getAppResources().getDisplayMetrics().widthPixels;
    int displayHeight = ApplicationScreen.getAppResources().getDisplayMetrics().heightPixels;
    int diffWidth = displayWidth - previewWidth;
    int diffHeight = displayHeight - previewHeight;

    // Initialize variables.
    int paramsLayoutHeight = 0;

    int xOffset = (focusLayout.getWidth() - previewWidth) / 2;
    int yOffset = (focusLayout.getHeight() - previewHeight) / 2;

    if (mFocusArea == null) {
      mFocusArea = new ArrayList<Area>();
      mFocusArea.add(new Area(new Rect(), 1000));
    }

    // Use margin to set the metering indicator to the touched area.
    RelativeLayout.LayoutParams p =
        (RelativeLayout.LayoutParams) mFocusIndicatorRotateLayout.getLayoutParams();
    int left =
        Util.clamp(
            xRaw - focusWidth / 2 + xOffset,
            diffWidth / 2,
            (previewWidth - focusWidth + xOffset * 2) - diffWidth / 2);
    int top =
        Util.clamp(
            yRaw - focusHeight / 2 + yOffset - diffHeight / 2,
            0,
            previewHeight - focusHeight + yOffset * 2);

    p.leftMargin = left;
    p.topMargin = top;

    int[] rules = p.getRules();
    rules[RelativeLayout.CENTER_IN_PARENT] = 0;

    mFocusIndicatorRotateLayout.setLayoutParams(p);

    calculateTapAreaByTopLeft(
        focusWidth,
        focusHeight,
        1f,
        top,
        left,
        ApplicationScreen.getPreviewSurfaceView().getWidth(),
        ApplicationScreen.getPreviewSurfaceView().getHeight(),
        mFocusArea.get(0).rect);

    // Set the focus area and metering area.
    if (mFocusAreaSupported
        && (e.getActionMasked() == MotionEvent.ACTION_UP
            || e.getActionMasked() == MotionEvent.ACTION_POINTER_UP)) {
      setFocusParameters();

      int focusMode = CameraController.getFocusMode();
      if (focusMode == CameraParameters.AF_MODE_AUTO
          || focusMode == CameraParameters.AF_MODE_MACRO) {
        CameraController.cancelAutoFocus();
        autoFocus();
      } else {
        mState = STATE_FOCUSING;
        updateFocusUI();
      }
    }
    mFocusIndicatorRotateLayout.requestLayout();
  }
Пример #10
0
  @Override
  public boolean onTouch(View view, MotionEvent e) {
    if (CameraController.isRemoteCamera()) {
      if (e.getAction() == MotionEvent.ACTION_UP) {
        onTouchAreas(e);
      }
      return true;
    }

    updateCurrentTouch(e);

    if (e.getPointerCount() > 1) {
      splitMode = true;
      mHandler.removeMessages(START_TOUCH_FOCUS);

      onTouchMeteringArea(e);
      onTouchFocusArea(e);

      return true;
    }

    if (splitMode && e.getAction() == MotionEvent.ACTION_DOWN) {
      mMeteringIndicatorRotateLayout.setVisibility(View.GONE);
      ApplicationScreen.instance.setCameraMeteringMode(ApplicationScreen.getMeteringMode());
      splitMode = false;
    }

    if (splitMode) {
      return true;
    }

    // Check if it's double click
    if (e.getAction() == MotionEvent.ACTION_UP) {
      lastTouchTime1 = lastTouchTime2;
      lastTouchTime2 = System.currentTimeMillis();

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

        // If shot on double click
        if (ApplicationScreen.instance.isShotOnTap() == 2) {
          // Cancel delayed focus, which was created by second click
          mHandler.removeMessages(START_TOUCH_FOCUS);

          // If state is Focused start capture
          if (mState == STATE_SUCCESS) {
            String modeID = PluginManager.getInstance().getActiveMode().modeID;
            if (!modeID.equals("video") && !currentTouch) {
              ApplicationScreen.getGUIManager().onHardwareShutterButtonPressed();
              isDoubleClick = false;
            }
          }
          return true;
        }
      } else {
        isDoubleClick = false;
      }
    }

    // Not handle touch event if no need of autoFocus and refuse 'shot on
    // tap' in video mode.
    if (!mInitialized
        || mState == STATE_FOCUSING_SNAP_ON_FINISH
        || mState == STATE_INACTIVE
        || mFocusDisabled
        || !CameraController.isFocusModeSupported()
        || (!(needAutoFocusCall() || isContinuousFocusMode())
            && !(ApplicationScreen.instance.isShotOnTap() > 0
                && !PluginManager.getInstance().getActiveMode().modeID.equals("video"))))
      return false;

    // Let users be able to cancel previous touch focus.
    if ((mState == STATE_FOCUSING)
        && !delayedFocus
        && ApplicationScreen.instance.isShotOnTap() != 2) {
      focusCanceled = true;
      cancelAutoFocus();
      int fm = CameraController.getFocusMode();
      if ((preferenceFocusMode == CameraParameters.AF_MODE_CONTINUOUS_PICTURE
              || preferenceFocusMode == CameraParameters.AF_MODE_CONTINUOUS_VIDEO)
          && fm != CameraParameters.AF_MODE_UNSUPPORTED
          && preferenceFocusMode != CameraController.getFocusMode()
          && preferenceFocusMode != CameraParameters.MF_MODE) {
        CameraController.setCameraFocusMode(preferenceFocusMode);
      } else if (CameraController.isGalaxyNote3 && preferenceFocusMode != CameraParameters.MF_MODE)
      // Kind of hack to
      // prevent Note 3 of
      // permanent 'auto focus
      // failed' state
      {
        CameraController.setCameraFocusMode(CameraParameters.AF_MODE_CONTINUOUS_PICTURE);
        CameraController.setCameraFocusMode(preferenceFocusMode);
      }
      return true;
    }

    switch (e.getAction()) {
      case MotionEvent.ACTION_DOWN:
        focusCanceled = false;
        delayedFocus = false;
        X = e.getX();
        Y = e.getY();

        lastEvent = MotionEvent.obtain(e);
        mHandler.sendEmptyMessageDelayed(START_TOUCH_FOCUS, START_TOUCH_FOCUS_DELAY);

        return true;
      case MotionEvent.ACTION_MOVE:
        {
          float difX = e.getX();
          float difY = e.getY();

          if ((Math.abs(difX - X) > 50 || Math.abs(difY - Y) > 50) && !focusCanceled) {
            focusCanceled = true;
            cancelAutoFocus();
            mHandler.removeMessages(START_TOUCH_FOCUS);
            return true;
          } else return true;
        }
      case MotionEvent.ACTION_UP:
        mHandler.removeMessages(START_TOUCH_FOCUS);
        if (focusCanceled || delayedFocus) return true;
        break;
      default:
        break;
    }

    onTouchAreas(e);

    return true;
  }
Пример #11
0
  @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;
    }
  }
 @Override
 protected void onFinishInflate() {
   mDistanceMeasurementChild = (TextView) findViewById(R.id.distance_info);
   super.onFinishInflate();
 }